[Glamor] [PATCH v3] Add DRI3 support to glamor

davyaxel at free.fr davyaxel at free.fr
Mon Dec 9 10:44:05 PST 2013


On 09/12/2013, Gaetan Nadon wrote :
> On 13-12-09 04:28 AM, davyaxel at free.fr wrote:
>> If EGLNativePixmapType is a pointer on another structure than gbm_bo, it raises an error, and the helpers are disabled.
>> However if EGLNativePixmapType is (void *) the compilation works. Perhaps you know how we could have the compilation failing in this case too?
>
> The concept I tried is to access a data member of the gbm_bo struct that we are sure will not be a member of the struct in Android, Wayland or what not. . It was not easy as it is an anonymous struct in which case AC_CHECK_MEMBERS does not work. I modified your program to check for "gbm" which we know will never in other structures.
>
>     SAVE_CFLAGS=$CFLAGS
>     CFLAGS="$EGL_CFLAGS -Werror"
>     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
>     #include <inttypes.h>
>     #include <unistd.h>
>     #include <gbm.h>
>     struct gbm_bo {
>        struct gbm_device *gbm;
>        uint32_t width;
>        uint32_t height;
>        uint32_t stride;
>        uint32_t format;
>        union gbm_bo_handle  handle;
>        void *user_data;
>        void (*destroy_user_data)(struct gbm_bo *, void *);
>     };
>     #include <EGL/egl.h>
>     #include <EGL/eglext.h>]],[[
>         struct gbm_bo *bo = gbm_bo_create (gbm_create_device(1), 0, 0, GBM_FORMAT_ARGB8888,GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
>         EGLNativePixmapType native_pixmap = bo;
>         native_pixmap->gbm;
>     ]])], [], [GLAMOR_DRI3_HELPERS=no])
>     CFLAGS=$SAVE_CFLAGS 
>
> We cannot include gbmint.h which holds the definition of the structure, so I copied it into the program. I did not test on a setup that does not have gbm. I am not totally sure it works, I'll you dig into that. At least your program works on all but Symbian systems, so it is not that bad. There may be an indirect way of adding a check for that system.
>
I don't think we need to expose the gbm_bo content.

I found a warning flag: -Wc++-compat,

which will warn if we convert a void * to struct gbm_bo*.
So if we add to my code "bo = native_pixmap;", and the flag, then the test is complete.

However we may have to check the flag is available.

Axel Davy


More information about the Glamor mailing list