virgl_hw: add allocator-specific bind flags

VIRGL_BIND_SHARED allows external allocators to intercept resource
creation. Reserve the upper byte of bind flags to allow passing
allocator-specific flags, and define a set of such flags for minigbm.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
David Stevens 5 years ago committed by Gurchetan Singh
parent d56f420217
commit dcc4fd2cb9
  1. 23
      src/virgl_gbm.c
  2. 12
      src/virgl_hw.h

@ -409,10 +409,31 @@ uint32_t virgl_gbm_convert_flags(uint32_t virgl_bind_flags)
if (virgl_bind_flags & VIRGL_BIND_LINEAR)
flags |= GBM_BO_USE_LINEAR;
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_CAMERA_WRITE)
flags |= GBM_BO_USE_CAMERA_WRITE;
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_CAMERA_READ)
flags |= GBM_BO_USE_CAMERA_READ;
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_HW_VIDEO_DECODER)
flags |= GBM_BO_USE_HW_VIDEO_DECODER;
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_HW_VIDEO_ENCODER)
flags |= GBM_BO_USE_HW_VIDEO_ENCODER;
if ((virgl_bind_flags & VIRGL_BIND_MINIGBM_PROTECTED) == VIRGL_BIND_MINIGBM_PROTECTED) {
flags |= GBM_BO_USE_PROTECTED;
} else {
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_SW_READ_OFTEN)
flags |= GBM_BO_USE_SW_READ_OFTEN;
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_SW_READ_RARELY)
flags |= GBM_BO_USE_SW_READ_RARELY;
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_SW_WRITE_OFTEN)
flags |= GBM_BO_USE_SW_WRITE_OFTEN;
if (virgl_bind_flags & VIRGL_BIND_MINIGBM_SW_WRITE_RARELY)
flags |= GBM_BO_USE_SW_WRITE_RARELY;
}
return flags;
}
int virgl_gbm_export_query(struct gbm_bo *bo, struct virgl_renderer_export_query *query)
{
int ret = -1;

@ -431,6 +431,18 @@ enum virgl_formats {
#define VIRGL_BIND_LINEAR (1 << 22)
#define VIRGL_BIND_SHARED_SUBFLAGS (0xff << 24)
#define VIRGL_BIND_MINIGBM_CAMERA_WRITE (1 << 24)
#define VIRGL_BIND_MINIGBM_CAMERA_READ (1 << 25)
#define VIRGL_BIND_MINIGBM_HW_VIDEO_DECODER (1 << 26)
#define VIRGL_BIND_MINIGBM_HW_VIDEO_ENCODER (1 << 27)
#define VIRGL_BIND_MINIGBM_SW_READ_OFTEN (1 << 28)
#define VIRGL_BIND_MINIGBM_SW_READ_RARELY (1 << 29)
#define VIRGL_BIND_MINIGBM_SW_WRITE_OFTEN (1 << 30)
#define VIRGL_BIND_MINIGBM_SW_WRITE_RARELY (1 << 31)
#define VIRGL_BIND_MINIGBM_PROTECTED (0xf << 28) // Mutually exclusive with SW_ flags
struct virgl_caps_bool_set1 {
unsigned indep_blend_enable:1;
unsigned indep_blend_func:1;

Loading…
Cancel
Save