drmmode: Track if BO allocation used modifiers

Keep track of whether or not we fed modifiers into GBM when we allocated
a BO. We'll use this later inside Glamor, to reallocate buffer storage
if we allocate buffer storage using modifiers, and a non-modifier-aware
client requests an export of that pixmap.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Daniel Stone 2018-04-04 16:16:33 +01:00 committed by Adam Jackson
parent 75bba3aedc
commit 0e9504e10c
2 changed files with 5 additions and 1 deletions

View File

@ -752,13 +752,16 @@ drmmode_create_bo(drmmode_ptr drmmode, drmmode_bo *bo,
format, modifiers, format, modifiers,
num_modifiers); num_modifiers);
free(modifiers); free(modifiers);
if (bo->gbm) if (bo->gbm) {
bo->used_modifiers = TRUE;
return TRUE; return TRUE;
}
} }
#endif #endif
bo->gbm = gbm_bo_create(drmmode->gbm, width, height, format, bo->gbm = gbm_bo_create(drmmode->gbm, width, height, format,
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT);
bo->used_modifiers = FALSE;
return bo->gbm != NULL; return bo->gbm != NULL;
} }
#endif #endif

View File

@ -75,6 +75,7 @@ typedef struct {
uint32_t height; uint32_t height;
struct dumb_bo *dumb; struct dumb_bo *dumb;
#ifdef GLAMOR_HAS_GBM #ifdef GLAMOR_HAS_GBM
Bool used_modifiers;
struct gbm_bo *gbm; struct gbm_bo *gbm;
#endif #endif
} drmmode_bo; } drmmode_bo;