[Glamor] dri3 warnings

davyaxel at free.fr davyaxel at free.fr
Sun Dec 8 05:45:47 PST 2013


On 08/12/2013, Gaetan Nadon wrote :
> On 13-12-08 06:24 AM, davyaxel at free.fr wrote:
>> ../../src/glamor_egl.c:456:9: warning: passing argument 4 of 'glamor_egl->egl_create_image_khr' makes pointer from integer without a cast [enabled by default]
>>
>> This is because we give a texture number as argument to eglCreateImageKHR.
>> The definition of this functions says it uses a EGLClientBuffer as argument, which is (void*) usually.
>>
>> The spec indicates that in this case we must 'cast into the type EGLClientBuffer'.
>> However for me, explicitly casting to EGLClientBuffer converts the warning into an error ('error: cast to pointer from integer of different size').
>
>         image = glamor_egl->egl_create_image_khr(glamor_egl->display,
>                              glamor_egl->context,
>                              EGL_GL_TEXTURE_2D_KHR,
>                              tex, attribs);
>
> There are other calls to egl_create_image_khr which do not have this
> problem. The tex variable is defined as an unsigned int in
> glamor_egl_dri3_fd_name_from_tex function. Just blindly passing a number
> along by casting and removing warnings does not mean it is going to work
> in the end. Do you know who is responsible to make the conversion?
>
> Sorry, I don't know the code, but it looks like something is wrong here.
> Have you tested that the code actually works as it is?
>
The other cases in which we uses eglCreateImageKHR are with arguments that fit well with EGLClientBuffer.
But EGL_KHR_gl_image is a special case in which we have to pass a texture name,
and not a pointer on a structure defining a buffer.

"If <target> is EGL_GL_TEXTURE_2D_KHR, <buffer> must be the name of a
    nonzero, GL_TEXTURE_2D target texture object, cast into
    the type EGLClientBuffer."

The code actually works on my pc, and the patch I proposed removes the compilation warning.
If you think of a better way to cast the texture name into EGLClientBuffer, please indicate it.

Thanks,

Axel Davy


More information about the Glamor mailing list