[Mesa-dev] [PATCH 2/2] egl/dri2: platform_drm should also try render node first.
Chad Versace
chad.versace at intel.com
Fri Apr 10 17:13:24 PDT 2015
On Fri 10 Apr 2015, Emil Velikov wrote:
>Hi Haixia,
>
>On 18/02/15 02:08, Haixia Shi wrote:
>> Signed-off-by: Haixia Shi <hshi at chromium.org>
>> ---
>> src/egl/drivers/dri2/platform_drm.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
>> index 02e87f7..834387f 100644
>> --- a/src/egl/drivers/dri2/platform_drm.c
>> +++ b/src/egl/drivers/dri2/platform_drm.c
>> @@ -589,6 +589,8 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
>> .get_sync_values = dri2_fallback_get_sync_values,
>> };
>>
>> +#define DRM_RENDER_DEV_NAME "%s/renderD%d"
>> +
>> EGLBoolean
>> dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
>> {
>> @@ -608,7 +610,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
>> gbm = disp->PlatformDisplay;
>> if (gbm == NULL) {
>> char buf[64];
>> - int n = snprintf(buf, sizeof(buf), DRM_DEV_NAME, DRM_DIR_NAME, 0);
>> + int n = snprintf(buf, sizeof(buf), DRM_RENDER_DEV_NAME, DRM_DIR_NAME, 128);
>> if (n != -1 && n < sizeof(buf))
>> fd = open(buf, O_RDWR);
>> if (fd < 0)
>>
>I'm not sure that the patch title reflects reality here. This patch
>essentially breaks old platforms that do not have render nodes, which is
>something we might want to avoid.
I agree with Emil.
Even if the platform *does* support rendernodes, this patch may still
break the application. The application using gbm may expect that the
underlying default device be card0, which has more permissions than
a rendernode.
More information about the mesa-dev
mailing list