venus: cache front_rendering_usage bit at gralloc init
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15868>
This commit is contained in:
@@ -30,9 +30,12 @@
|
|||||||
|
|
||||||
/* perform options supported by CrOS Gralloc */
|
/* perform options supported by CrOS Gralloc */
|
||||||
#define CROS_GRALLOC_DRM_GET_BUFFER_INFO 4
|
#define CROS_GRALLOC_DRM_GET_BUFFER_INFO 4
|
||||||
|
#define CROS_GRALLOC_DRM_GET_USAGE 5
|
||||||
|
#define CROS_GRALLOC_DRM_GET_USAGE_FRONT_RENDERING_BIT 0x1
|
||||||
|
|
||||||
struct vn_android_gralloc {
|
struct vn_android_gralloc {
|
||||||
const gralloc_module_t *module;
|
const gralloc_module_t *module;
|
||||||
|
uint32_t front_rendering_usage;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct vn_android_gralloc _vn_android_gralloc;
|
static struct vn_android_gralloc _vn_android_gralloc;
|
||||||
@@ -42,6 +45,7 @@ vn_android_gralloc_init()
|
|||||||
{
|
{
|
||||||
static const char CROS_GRALLOC_MODULE_NAME[] = "CrOS Gralloc";
|
static const char CROS_GRALLOC_MODULE_NAME[] = "CrOS Gralloc";
|
||||||
const gralloc_module_t *gralloc = NULL;
|
const gralloc_module_t *gralloc = NULL;
|
||||||
|
uint32_t front_rendering_usage = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* get gralloc module for gralloc buffer info query */
|
/* get gralloc module for gralloc buffer info query */
|
||||||
@@ -64,6 +68,13 @@ vn_android_gralloc_init()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gralloc->perform(gralloc, CROS_GRALLOC_DRM_GET_USAGE,
|
||||||
|
CROS_GRALLOC_DRM_GET_USAGE_FRONT_RENDERING_BIT,
|
||||||
|
&front_rendering_usage) == 0) {
|
||||||
|
assert(front_rendering_usage);
|
||||||
|
_vn_android_gralloc.front_rendering_usage = front_rendering_usage;
|
||||||
|
}
|
||||||
|
|
||||||
_vn_android_gralloc.module = gralloc;
|
_vn_android_gralloc.module = gralloc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user