u_gralloc: Add a function that returns gralloc type

This is needed by some drivers to reject the fallback gralloc.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25256>
This commit is contained in:
Roman Stratiienko
2023-09-09 13:57:29 +03:00
committed by Marge Bot
parent d923d6234d
commit 8f513813b1
3 changed files with 10 additions and 2 deletions

View File

@@ -58,6 +58,7 @@ u_gralloc_create(enum u_gralloc_type type)
assert(u_gralloc_cache[type].u_gralloc->ops.get_buffer_basic_info);
assert(u_gralloc_cache[type].u_gralloc->ops.destroy);
u_gralloc_cache[type].u_gralloc->type = u_grallocs[i].type;
u_gralloc_cache[type].refcount = 1;
out_gralloc = u_gralloc_cache[type].u_gralloc;
@@ -148,3 +149,9 @@ u_gralloc_get_front_rendering_usage(struct u_gralloc *gralloc,
return gralloc->ops.get_front_rendering_usage(gralloc, out_usage);
}
int
u_gralloc_get_type(struct u_gralloc *gralloc)
{
return gralloc->type;
}

View File

@@ -49,9 +49,7 @@ struct u_gralloc_buffer_color_info {
enum u_gralloc_type {
U_GRALLOC_TYPE_AUTO,
#ifdef USE_IMAPPER4_METADATA_API
U_GRALLOC_TYPE_GRALLOC4,
#endif
U_GRALLOC_TYPE_CROS,
U_GRALLOC_TYPE_FALLBACK,
U_GRALLOC_TYPE_COUNT,
@@ -74,6 +72,8 @@ int u_gralloc_get_buffer_color_info(
int u_gralloc_get_front_rendering_usage(struct u_gralloc *gralloc,
uint64_t *out_usage);
int u_gralloc_get_type(struct u_gralloc *gralloc);
#ifdef __cplusplus
}
#endif

View File

@@ -28,6 +28,7 @@ struct u_gralloc_ops {
struct u_gralloc {
struct u_gralloc_ops ops;
int type;
};
extern struct u_gralloc *u_gralloc_cros_api_create(void);