diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2017-08-30 00:45:37 -0400 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2017-09-05 12:40:14 -0700 |
commit | 1bc3bc48055a9292d98808383ee5012fa2cc60eb (patch) | |
tree | 82a5966dc8852abe6836ccacec6b4f6bfd5568f5 /hw | |
parent | 2f35a048b6928ed9dc1417c1a43d794c0b2d2e29 (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.
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xwayland/xwayland-glamor.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index ca3785ff5..06ea78f7e 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -225,14 +225,30 @@ xwl_glamor_create_pixmap(ScreenPtr screen, { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct gbm_bo *bo; + uint32_t format; if (width > 0 && height > 0 && depth >= 15 && (hint == 0 || hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || hint == CREATE_PIXMAP_USAGE_SHARED)) { - bo = gbm_bo_create(xwl_screen->gbm, width, height, - gbm_format_for_depth(depth), - GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + format = gbm_format_for_depth(depth); + +#ifdef GBM_BO_WITH_MODIFIERS + if (xwl_screen->dmabuf_capable) { + uint32_t num_modifiers; + uint64_t *modifiers = NULL; + + glamor_get_modifiers(screen, format, &num_modifiers, &modifiers); + bo = gbm_bo_create_with_modifiers(xwl_screen->gbm, width, height, + format, modifiers, num_modifiers); + free(modifiers); + } + else +#endif + { + bo = gbm_bo_create(xwl_screen->gbm, width, height, format, + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + } if (bo) return xwl_glamor_create_pixmap_for_bo(screen, bo, depth); |