gbm: Add USE_FRONT_RENDERING flag
Provide a use flag to let the driver know that the allocated buffer will be used for frontbuffer rendering. For example, bandwidth compressed formats should usually be avoided for frontbuffer rendering to avoid the visual corruption that results from this display racing with the GPU writing header data vs. pixel data. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17799>
This commit is contained in:
@@ -1146,6 +1146,8 @@ dri2_create_image_common(__DRIscreen *_screen,
|
||||
tex_usage |= PIPE_BIND_PROTECTED;
|
||||
if (use & __DRI_IMAGE_USE_PRIME_BUFFER)
|
||||
tex_usage |= PIPE_BIND_PRIME_BLIT_DST;
|
||||
if (use & __DRI_IMAGE_USE_FRONT_RENDERING)
|
||||
tex_usage |= PIPE_BIND_USE_FRONT_RENDERING;
|
||||
|
||||
img = CALLOC_STRUCT(__DRIimageRec);
|
||||
if (!img)
|
||||
|
||||
@@ -519,6 +519,7 @@ enum pipe_flush_flags
|
||||
#define PIPE_BIND_SAMPLER_REDUCTION_MINMAX (1 << 23) /* PIPE_CAP_SAMPLER_REDUCTION_MINMAX */
|
||||
/* Resource is the DRI_PRIME blit destination. Only set on on the render GPU. */
|
||||
#define PIPE_BIND_PRIME_BLIT_DST (1 << 24)
|
||||
#define PIPE_BIND_USE_FRONT_RENDERING (1 << 25) /* Resource may be used for frontbuffer rendering */
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1244,6 +1244,8 @@ gbm_dri_bo_create(struct gbm_device *gbm,
|
||||
dri_use |= __DRI_IMAGE_USE_LINEAR;
|
||||
if (usage & GBM_BO_USE_PROTECTED)
|
||||
dri_use |= __DRI_IMAGE_USE_PROTECTED;
|
||||
if (usage & GBM_BO_USE_FRONT_RENDERING)
|
||||
dri_use |= __DRI_IMAGE_USE_FRONT_RENDERING;
|
||||
|
||||
/* Gallium drivers requires shared in order to get the handle/stride */
|
||||
dri_use |= __DRI_IMAGE_USE_SHARE;
|
||||
|
||||
@@ -256,6 +256,14 @@ enum gbm_bo_flags {
|
||||
* OpenCL, and Vulkan applications.
|
||||
*/
|
||||
GBM_BO_USE_PROTECTED = (1 << 5),
|
||||
|
||||
/**
|
||||
* The buffer will be used for front buffer rendering. On some
|
||||
* platforms this may (for example) disable framebuffer compression
|
||||
* to avoid problems with compression flags data being out of sync
|
||||
* with pixel data.
|
||||
*/
|
||||
GBM_BO_USE_FRONT_RENDERING = (1 << 6),
|
||||
};
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user