diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2018-02-28 01:19:45 +0000 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-03-05 13:27:57 -0500 |
commit | 8d0d89715984e321315631dd6667e05813d26e03 (patch) | |
tree | 0a2aa5ec952728fd321115db1e014776ee56aaf9 /glamor | |
parent | cef12efc15ca1444d6d8cd839116b318a4668692 (diff) |
glamor: Use gbm_bo_create_with_modifiers for internal pixmap allocation
Using modifier might allow the driver to use a more optimal format
(e.g. tiled/compressed). Let's try to use those if possible.
v2: Don't filter out multi-plane modifiers
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glamor')
-rw-r--r-- | glamor/glamor_egl.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index c00fb3c1b..ca368c15c 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -256,6 +256,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap) glamor_get_pixmap_private(pixmap); unsigned width = pixmap->drawable.width; unsigned height = pixmap->drawable.height; + uint32_t format; struct gbm_bo *bo; PixmapPtr exported; GCPtr scratch_gc; @@ -270,14 +271,33 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap) return FALSE; } - bo = gbm_bo_create(glamor_egl->gbm, width, height, - (pixmap->drawable.depth == 30) ? - GBM_FORMAT_ARGB2101010 : GBM_FORMAT_ARGB8888, + if (pixmap->drawable.depth == 30) + format = GBM_FORMAT_ARGB2101010; + else + format = GBM_FORMAT_ARGB8888; + +#ifdef GBM_BO_WITH_MODIFIERS + if (glamor_egl->dmabuf_capable) { + uint32_t num_modifiers; + uint64_t *modifiers = NULL; + + glamor_get_modifiers(screen, format, &num_modifiers, &modifiers); + + bo = gbm_bo_create_with_modifiers(glamor_egl->gbm, width, height, + format, modifiers, num_modifiers); + free(modifiers); + } + else +#endif + { + bo = gbm_bo_create(glamor_egl->gbm, width, height, format, #ifdef GLAMOR_HAS_GBM_LINEAR - (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ? - GBM_BO_USE_LINEAR : 0) | + (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ? + GBM_BO_USE_LINEAR : 0) | #endif - GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); + GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); + } + if (!bo) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make %dx%dx%dbpp GBM bo\n", |