summaryrefslogtreecommitdiff
path: root/glamor
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2018-04-04 16:16:36 +0100
committerAdam Jackson <ajax@redhat.com>2018-04-04 13:46:57 -0400
commit86b2d8740a330deafe8a9bbf0402705a43efbb42 (patch)
tree7ede3ba49fddaf5ca21a512d2c9d0091e3192fe0 /glamor
parentaab5c46ccbe769830cae383330fd62c074a0d2f7 (diff)
glamor: Reallocate pixmap storage without modifiers if necessary
If we need a pixmap's storage to be exported to a context in which we aren't aware of modifiers, reallocate the buffer again without modifiers. 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>
Diffstat (limited to 'glamor')
-rw-r--r--glamor/glamor_egl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index dd6a9a2df..a1e0bc3c9 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -250,7 +250,7 @@ glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name)
}
static Bool
-glamor_make_pixmap_exportable(PixmapPtr pixmap)
+glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok)
{
ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
@@ -266,7 +266,8 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap)
PixmapPtr exported;
GCPtr scratch_gc;
- if (pixmap_priv->image)
+ if (pixmap_priv->image &&
+ (modifiers_ok || !pixmap_priv->used_modifiers))
return TRUE;
if (pixmap->drawable.bitsPerPixel != 32) {
@@ -282,7 +283,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap)
format = GBM_FORMAT_ARGB8888;
#ifdef GBM_BO_WITH_MODIFIERS
- if (glamor_egl->dmabuf_capable) {
+ if (modifiers_ok && glamor_egl->dmabuf_capable) {
uint32_t num_modifiers;
uint64_t *modifiers = NULL;
@@ -370,7 +371,7 @@ glamor_egl_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds,
int i;
#endif
- if (!glamor_make_pixmap_exportable(pixmap))
+ if (!glamor_make_pixmap_exportable(pixmap, TRUE))
return 0;
bo = glamor_gbm_bo_from_pixmap(screen, pixmap);
@@ -411,7 +412,7 @@ glamor_egl_fd_name_from_pixmap(ScreenPtr screen,
glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen));
- if (!glamor_make_pixmap_exportable(pixmap))
+ if (!glamor_make_pixmap_exportable(pixmap, FALSE))
goto failure;
bo = glamor_gbm_bo_from_pixmap(screen, pixmap);