mesa/src/util/u_gralloc/u_gralloc_internal.h
Roman Stratiienko 4afcd0c6d6 u_gralloc: Add support for gbm_gralloc
Although gbm_gralloc has not been maintained for a long time, it is still
used in android-x86, BlissOS and WayDroid. Let's add support so that
x86 drivers no longer need to request tiling flags from the kernel.

Acked-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Tested-by: HMTheBoy154 <buingoc67@gmail.com>  # BlissOS 15 & Mesa 23.3.2
Tested-by: Mauro Rossi <issor.oruam@gmail.com>  # android-x86 for mesa 24.0.0-devel on Skylake GT2
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25380>
2024-01-10 22:26:18 +00:00

56 lines
1.6 KiB
C

/*
* Mesa 3-D graphics library
*
* Copyright (C) 2023 Roman Stratiienko (r.stratiienko@gmail.com)
* SPDX-License-Identifier: MIT
*/
#ifndef U_GRALLOC_INTERNAL_H
#define U_GRALLOC_INTERNAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "u_gralloc.h"
struct u_gralloc_ops {
int (*get_buffer_basic_info)(struct u_gralloc *gralloc,
struct u_gralloc_buffer_handle *hnd,
struct u_gralloc_buffer_basic_info *out);
int (*get_buffer_color_info)(struct u_gralloc *gralloc,
struct u_gralloc_buffer_handle *hnd,
struct u_gralloc_buffer_color_info *out);
int (*get_front_rendering_usage)(struct u_gralloc *gralloc,
uint64_t *out_usage);
int (*destroy)(struct u_gralloc *gralloc);
};
struct u_gralloc {
struct u_gralloc_ops ops;
int type;
};
extern struct u_gralloc *u_gralloc_cros_api_create(void);
#ifdef USE_IMAPPER4_METADATA_API
extern struct u_gralloc *u_gralloc_imapper_api_create(void);
#endif
extern struct u_gralloc *u_gralloc_qcom_create(void);
extern struct u_gralloc *u_gralloc_libdrm_create(void);
extern struct u_gralloc *u_gralloc_fallback_create(void);
/* Helpers for legacy grallocs */
struct android_ycbcr;
bool is_hal_format_yuv(int native);
int get_hal_format_bpp(int native);
int get_fourcc_from_hal_format(int native);
int bufferinfo_from_ycbcr(const struct android_ycbcr *ycbcr,
struct u_gralloc_buffer_handle *hnd,
struct u_gralloc_buffer_basic_info *out);
#ifdef __cplusplus
}
#endif
#endif /* U_GRALLOC_INTERNAL_H */