From 9dac27a026bd61e1c0c613b399f1dcbff7d57eb9 Mon Sep 17 00:00:00 2001 From: Gurchetan Singh Date: Tue, 1 Dec 2020 16:08:28 -0800 Subject: [PATCH] vrend: match Mesa gbm header We can now use gbm_bo_map(..) directly to match Mesa. If minigbm doesn't define the needed use flags, we define it internally. This should allow us to build with minigbm allocation enabled and use the Mesa gbm header. Reviewed-by: Gert Wollny --- src/vrend_winsys_gbm.c | 2 +- src/vrend_winsys_gbm.h | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/vrend_winsys_gbm.c b/src/vrend_winsys_gbm.c index ce3f6fb..2ee5917 100644 --- a/src/vrend_winsys_gbm.c +++ b/src/vrend_winsys_gbm.c @@ -336,7 +336,7 @@ int virgl_gbm_transfer(struct gbm_bo *bo, uint32_t direction, const struct iovec host_map_stride0 = 0; uint32_t map_flags = (direction == VIRGL_TRANSFER_TO_HOST) ? GBM_BO_TRANSFER_WRITE : GBM_BO_TRANSFER_READ; - void *addr = gbm_bo_map2(bo, 0, 0, width, height, map_flags, &host_map_stride0, &map_data, 0); + void *addr = gbm_bo_map(bo, 0, 0, width, height, map_flags, &host_map_stride0, &map_data); if (!addr) return -1; diff --git a/src/vrend_winsys_gbm.h b/src/vrend_winsys_gbm.h index 6be6b0a..dd5ce36 100644 --- a/src/vrend_winsys_gbm.h +++ b/src/vrend_winsys_gbm.h @@ -40,6 +40,22 @@ #define GBM_FORMAT_ABGR16161616F __gbm_fourcc_code('A', 'B', '4', 'H') /* [63:0] A:B:G:R 16:16:16:16 little endian */ #endif +#ifndef MINIGBM + +#define GBM_BO_USE_TEXTURING (1 << 5), +#define GBM_BO_USE_CAMERA_WRITE (1 << 6) +#define GBM_BO_USE_CAMERA_READ (1 << 7) +#define GBM_BO_USE_PROTECTED (1 << 8) +#define GBM_BO_USE_SW_READ_OFTEN (1 << 9) +#define GBM_BO_USE_SW_READ_RARELY (1 << 10) +#define GBM_BO_USE_SW_WRITE_OFTEN (1 << 11) +#define GBM_BO_USE_SW_WRITE_RARELY (1 << 12) +#define GBM_BO_USE_HW_VIDEO_DECODER (1 << 13) +#define GBM_BO_USE_HW_VIDEO_ENCODER (1 << 14) +#define GBM_TEST_ALLOC (1 << 15) + +#endif + /* * If fd >= 0, virglrenderer owns the fd since it was opened via a rendernode * query. If fd < 0, the gbm device was opened with the fd provided by the