[Glamor] dri3 warnings

davyaxel at free.fr davyaxel at free.fr
Sun Dec 8 07:15:19 PST 2013


On 08/12/2013, Gaetan Nadon wrote :
> On 13-12-08 08:45 AM, davyaxel at free.fr wrote:
>> 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 for the info. I did a bit of reading as I suspected it is a common problem. The compiler complains because there is  no guaranty that an unsigned long is big enough to hold a pointer. This is one recommendation I saw, but I have no personal experience with it. You can give it a try to make sure it works, but it compiles ok.
>
>     (EGLClientBuffer)(uintptr_t)tex or just
>     (uintptr_t)tex 
>
> I checked that uintptr_t is widely used in xserver and X libraries and we do compile all of X with C99. It's worth a try because suppressing the warning is dangerous as you will not be notified for other cases where it will really be a problem.
>
> If that does not work, I'd rather keep the warning to be alerted of other places in the code. Opinions will vary on that, the maintainer has the last word.
>
> Thanks for looking into that.

Your solution works and is the best one.
I think ignoring the warning could have been a problem with some compilers on big endian systems.

Thanks for your efforts in finding it.

I let you post the patch.

Axel Davy


More information about the Glamor mailing list