diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2023-03-08 16:54:30 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2023-03-08 16:54:47 +0100 |
commit | 9bd83c02a8e02b902303a145de15c13ee650b910 (patch) | |
tree | 9e07e10457a23cbe8db2bad4217201dd1656af9d | |
parent | af255b16513bab34bfc527cae139eb09c3fdbf82 (diff) | |
download | xserver-9bd83c02a8e02b902303a145de15c13ee650b910.tar.gz |
xwayland/glamor/gbm: Use helper for implicit buffer params too
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
-rw-r--r-- | hw/xwayland/xwayland-glamor-gbm.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index 2e1a4bfd5..d545a570d 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -395,6 +395,26 @@ init_buffer_params_with_modifiers(struct xwl_pixmap *xwl_pixmap, return TRUE; } +#else +static Bool +init_buffer_params_fallback(struct xwl_pixmap *xwl_pixmap, + uint64_t *modifier, + int *num_planes, + int *prime_fds, + uint32_t *strides, + uint32_t *offsets) +{ + *num_planes = 1; + *modifier = DRM_FORMAT_MOD_INVALID; + prime_fds[0] = gbm_bo_get_fd(xwl_pixmap->bo); + if (prime_fds[0] == -1) + return FALSE; + + strides[0] = gbm_bo_get_stride(xwl_pixmap->bo); + offsets[0] = 0; + + return TRUE; +} #endif static struct wl_buffer * @@ -435,13 +455,13 @@ xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap) offsets)) return NULL; #else - num_planes = 1; - modifier = DRM_FORMAT_MOD_INVALID; - prime_fds[0] = gbm_bo_get_fd(xwl_pixmap->bo); - if (prime_fds[0] == -1) + if (!init_buffer_params_fallback(xwl_pixmap, + &modifier, + &num_planes, + prime_fds, + strides, + offsets)) return NULL; - strides[0] = gbm_bo_get_stride(xwl_pixmap->bo); - offsets[0] = 0; #endif if (xwl_screen->dmabuf && |