mesa/src/util
Roman Stratiienko ee42e2166d android: Introduce the Android buffer info abstraction
Both EGL and Vulkan implementations require obtaining buffer metadata,
e.g., format, modifier, offsets, strides, etc.

Currently, mesa3d doesn't have a generic solution, and every Vulkan
implementation uses its getters. Most of the getters rely on
kernel metadata storage that is available for x86-based GPU drivers.

ARM-based Vulkan drivers rely on userspace metadata sharing, making it
important to use advanced metadata API. Otherwise, the driver will work
with limited functionality (no YUV, lack of support for modifiers, etc.)

Current EGL buffer getter implementation is advanced enough and used as
a base for a common Android buffer-getter logic.

Use example:

    void
    android_buffer_test(android_handle_type *a_handle)
    {
       // First, get the gralloc object. It will be created if it doesn't
       // exist. Use U_GRALLOC_TYPE_AUTO to let the implementation choose
       // the best gralloc
       struct u_gralloc *gralloc = u_gralloc_create(U_GRALLOC_TYPE_AUTO);

       // Prepare the internal handle structure (hal_format and
       // pixel_stride are required for the fallback implementation).
       // Both Vulkan and EGL clients expose HAL format / pixel stride
       // in their structures.
       u_gralloc_buffer_handle hnd = {
          .handle = a_handle->native_handle,
          .hal_format = a_handle->hal_format,
          .pixel_stride = a_handle->pixel_stride,
       };

       // Get the basic buffer info
       u_gralloc_buffer_basic_info basic_info;
       int ret = u_gralloc_get_buffer_basic_info(gralloc, &hnd, &basic_info);
       if (ret) {
          // Handle the error
       }

       // Get the color info
       u_gralloc_buffer_color_info color_info;
       ret = u_gralloc_get_buffer_color_info(gralloc, &hnd, &color_info);
       if (ret) {
          // Handle the error
       }

       // unref the gralloc object
       u_gralloc_destroy(&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/18215>
2023-08-12 18:46:57 +00:00
..
blake3 util: Blake3 - Identify arm64ec as aarch64 instead of x64 2023-07-13 15:30:39 +00:00
format gallium/st: lower NV21 to R8_B8G8 instead of G8_B8R8 2023-08-11 18:43:38 +00:00
perf util/perf: Use the Mesa base style 2023-05-29 21:06:12 +00:00
sha1 util: mark externally-unused functions as static 2023-05-23 20:32:19 +00:00
tests util/meson: Getting mesa util core to be self contained 2023-08-02 03:41:24 +00:00
tools util/tools: add the tool that generates perfect hash functions for GLenums 2022-12-18 14:35:59 -05:00
u_gralloc android: Introduce the Android buffer info abstraction 2023-08-12 18:46:57 +00:00
00-mesa-defaults.conf anv: fake non intel vendorID for Death Stranding 2023-08-08 09:50:44 +00:00
00-radv-defaults.conf radv: workaround WWZ exporting index=1 through location=1 2023-07-31 11:38:14 +00:00
anon_file.c
anon_file.h
bigmath.h
bitpack_helpers.h util: Add util_bitpack_[su]fixed_clamp helpers 2022-08-30 04:28:34 +00:00
bitscan.c
bitscan.h util: use uint32_t instead of unsigned in bitscan.h 2023-06-29 00:45:30 +00:00
bitset.h util/bitset: Add some extra functions 2023-07-03 19:51:04 +00:00
blend.h util/blend: Add helpers for normalizing inverts 2023-07-13 21:03:32 +00:00
blob.c util: revert back to ALIGN since it moved to util 2023-05-25 21:24:45 +00:00
blob.h
build_id.c
build_id.h
cnd_monotonic.h
compiler.h util: Merge p_compiler.h into src/util/compiler.h 2023-06-27 18:18:30 +08:00
compress.c
compress.h
crc32.c
crc32.h
dag.c util/dag: Add a validation function. 2022-09-29 23:40:18 +00:00
dag.h util/dag: Add a validation function. 2022-09-29 23:40:18 +00:00
dbghelp.h util: Move u_pack_color.h and dbughelp.h into src/util from/src/gallium/auxiliary/util/ 2023-08-02 03:41:24 +00:00
detect.h util: Rename src/gallium/include/pipe/p_config.h to src/util/detect_arch.h 2022-11-15 20:35:55 +00:00
detect_arch.h util: Remove the unused PIPE_(ARCH|OS|CC) macro defines from src/util/detect_arch.h and src/util/detect_cc.h 2022-11-15 20:35:55 +00:00
detect_cc.h util: Remove the unused PIPE_(ARCH|OS|CC) macro defines from src/util/detect_arch.h and src/util/detect_cc.h 2022-11-15 20:35:55 +00:00
detect_os.h
disk_cache.c util/u_queue: always enable UTIL_QUEUE_INIT_SCALE_THREADS, remove the flag 2023-07-18 11:11:12 -04:00
disk_cache.h util: Call mesa_bytes_to_hex directly instead of disk_cache_format_hex_id. 2023-04-19 04:19:51 +00:00
disk_cache_os.c util/disk_cache: fix ~/.cache/ permissions 2023-07-01 08:55:32 +00:00
disk_cache_os.h util/disk_cache: Align atomic size. 2023-04-11 12:57:15 +00:00
double.c
double.h
driconf.h anv: add fake sparse support 2023-08-03 19:57:18 +00:00
driconf_static.py driconf: add support for multiple input files in the static script 2022-12-01 16:55:31 +00:00
enum_operators.h
fast_idiv_by_const.c
fast_idiv_by_const.h
fast_urem_by_const.h
format_r11g11b10f.h
format_rgb9e5.h
format_srgb.h
format_srgb.py
fossilize_db.c util/fossilize_db: add ifdef for inotify header 2023-01-26 13:06:27 +00:00
fossilize_db.h util/fossilize_db: fix macOS inotify build error 2023-01-23 18:31:48 +00:00
futex.c futex: Change INT_MAX to INT32_MAX. 2023-01-19 03:25:55 +00:00
futex.h util: Move the implementation of futex_wake and futex_wait from futex.h to futex.c 2022-10-18 23:20:25 +00:00
glheader.h util: include gles header instead of hand crafted macros 2022-11-04 19:28:19 +00:00
glsl2spirv.py util/glsl2spirv: add support for include directive 2023-03-03 11:30:54 +00:00
half_float.c util: remove unused half_to_unorm8 2022-11-04 23:20:02 +00:00
half_float.h util: Do not include immintrin.h in half_float.h 2023-06-28 18:56:20 +00:00
hash_table.c util: rzalloc and free hash_table_u64 2023-02-28 08:35:32 +00:00
hash_table.h
hex.h util: Add dedicated hex conversion functions and use it. 2023-04-19 04:19:50 +00:00
libdrm.h util: Add a simple no-op libdrm shim 2023-03-05 16:31:51 +00:00
libsync.h replace sys/poll.h with poll.h 2022-11-14 20:13:20 +00:00
list.h
log.c util/log: Add missing "const" 2023-04-24 22:42:04 +00:00
log.h util/log: Add missing "const" 2023-04-24 22:42:04 +00:00
macros.h util: Add NONNULL macro 2023-08-12 18:46:57 +00:00
memstream.c util: Add #ifdefs for Xbox GDK support. 2023-01-19 03:25:55 +00:00
memstream.h util: Remove include of windows.h in memstream.h 2022-10-20 03:04:56 +00:00
mesa-blake3.c util/blake3: Add blake3_hash typedef. 2023-06-23 09:28:04 +00:00
mesa-blake3.h util/blake3: Add blake3_hash typedef. 2023-06-23 09:28:04 +00:00
mesa-sha1.c util: Add dedicated hex conversion functions and use it. 2023-04-19 04:19:50 +00:00
mesa-sha1.h
mesa_cache_db.c util/mesa-db: Introduce multipart mesa-db cache 2023-02-01 02:47:30 +00:00
mesa_cache_db.h util: Fixes error: no previous prototype for 'mesa_cache_db_entry_remove' 2023-02-09 04:05:39 +00:00
mesa_cache_db_multipart.c util/mesa-db: Introduce multipart mesa-db cache 2023-02-01 02:47:30 +00:00
mesa_cache_db_multipart.h util/mesa-db: Introduce multipart mesa-db cache 2023-02-01 02:47:30 +00:00
meson.build android: Introduce the Android buffer info abstraction 2023-08-12 18:46:57 +00:00
os_file.c util: avoid calling kcmp on Android 2023-02-12 17:11:16 +00:00
os_file.h
os_memory.h gallium/util: Remove the EMBEDDED_DEVICE macro because nobody use it 2022-11-08 02:37:20 +00:00
os_memory_aligned.h
os_memory_debug.h util: Replace all usage of __FUNCTION__ with __func__ in src/util/* 2022-11-11 06:15:42 +00:00
os_memory_fd.c
os_memory_fd.h
os_memory_stdc.h
os_misc.c treewide: Replace the usage of TRUE/FALSE with true/false 2023-06-27 18:18:28 +08:00
os_misc.h util: Add function debug_get_option_cached os_get_option_cached 2022-12-16 19:30:19 +00:00
os_mman.h util: Move src/gallium/auxiliary/os/os_mman.h to src/util/os_mman.h 2022-11-15 19:55:01 +00:00
os_socket.c
os_socket.h
os_time.c c11: Implement os_time_get_nano with timespec_get(&ts, TIME_MONOTONIC) 2023-06-20 00:05:48 +00:00
os_time.h util: Replace all usage of PIPE_TIMEOUT_INFINITE with OS_TIMEOUT_INFINITE 2023-06-05 05:12:02 +00:00
ptralloc.h
ralloc.c util: sizeof bucket are always 32bit width, use align instead align64 2023-06-29 00:45:31 +00:00
ralloc.h util: add freelist allocator with mark/sweep 2022-08-30 18:21:44 +00:00
rand_xor.c
rand_xor.h
rb_tree.c util: Update some copyright tags 2023-03-26 00:16:26 +00:00
rb_tree.h util: Update some copyright tags 2023-03-26 00:16:26 +00:00
reallocarray.h
register_allocate.c util: Do not use align64 over unsigned int in register_allocate.c 2023-06-29 00:45:31 +00:00
register_allocate.h
register_allocate_internal.h
rgtc.c
rgtc.h
rounding.h
rwlock.c util: Remove include of windows.h in rwlock.h 2022-10-20 03:04:56 +00:00
rwlock.h util: Remove include of windows.h in rwlock.h 2022-10-20 03:04:56 +00:00
set.c util: remove unused set_random_entry 2022-11-04 23:20:02 +00:00
set.h util: remove unused set_random_entry 2022-11-04 23:20:02 +00:00
simple_mtx.c util: Add util_call_once for optimize call to util_call_once_with_context out for hot path 2022-09-22 04:16:29 +00:00
simple_mtx.h util: #include "c11/threads.h" when necessary in simple_mtx.h 2022-10-20 03:04:56 +00:00
slab.c
slab.h
softfloat.c
softfloat.h
sparse_array.c
sparse_array.h
streaming-load-memcpy.c util: Use util_get_cpu_caps instead cpu_has_sse4_1 macro 2022-11-15 19:06:07 +00:00
streaming-load-memcpy.h
string_buffer.c
string_buffer.h
strndup.h
strtod.c util: check and initialize locale before using it 2023-04-27 15:43:33 +00:00
strtod.h
texcompress_rgtc_tmp.h
timespec.h
u_atomic.c
u_atomic.h util: Add aligned int64_t types for x86(non 64). 2023-04-11 12:57:15 +00:00
u_call_once.c util: Add util_call_once for optimize call to util_call_once_with_context out for hot path 2022-09-22 04:16:29 +00:00
u_call_once.h util: Add util_call_once for optimize call to util_call_once_with_context out for hot path 2022-09-22 04:16:29 +00:00
u_cpu_detect.c util: include "util/compiler.h" instead of "pipe/p_compiler.h" 2023-06-27 18:18:30 +08:00
u_cpu_detect.h util/cpu: add big.LITTLE cpu detection 2023-04-14 10:16:49 +00:00
u_debug.c util/debug: move null checks out of debug message macro 2023-04-20 02:52:16 +00:00
u_debug.h util/debug: move null checks out of debug message macro 2023-04-20 02:52:16 +00:00
u_debug_memory.c util: Rename src/gallium/include/pipe/p_config.h to src/util/detect_arch.h 2022-11-15 20:35:55 +00:00
u_debug_stack.c tree-wide: Convert all usage of PIPE_(OS|ARCH|CC)_* to DETECT_(OS|ARCH|CC)_* by use grep 2022-11-15 20:35:55 +00:00
u_debug_stack.h util: Include the needed util/detect*.h headers in multiple files 2022-11-15 20:35:55 +00:00
u_debug_stack_android.cpp android: Make libbacktrace optional again 2023-01-25 08:58:25 -03:00
u_debug_symbol.c util: include "util/compiler.h" instead of "pipe/p_compiler.h" 2023-06-27 18:18:30 +08:00
u_debug_symbol.h
u_dl.c
u_dl.h
u_drm.h
u_dynarray.c util: fix stack dynarray used by multiple tus 2023-05-25 15:46:35 +00:00
u_dynarray.h util: fix stack dynarray used by multiple tus 2023-05-25 15:46:35 +00:00
u_endian.h
u_hash_table.c util: Remove the usage of enum pipe_error in u_hash_table.* 2022-11-19 01:37:46 +00:00
u_hash_table.h util: Remove include "pipe/*.h" in src/util/* files 2023-08-02 03:41:24 +00:00
u_hexdump.h util: Add common hex dump utility 2023-05-19 16:30:44 +00:00
u_idalloc.c
u_idalloc.h
u_math.c tree-wide: Convert all usage of defined(PIPE_(OS|ARCH|CC)_*) to DETECT_(OS|ARCH|CC)_* by use grep 2022-11-15 20:35:55 +00:00
u_math.h util: Getting align and align64 consistence with ALIGN 2023-06-29 00:45:30 +00:00
u_memory.h util: Delete Offset() macro from u_memory.h 2023-04-15 00:54:16 +00:00
u_memset.h tree-wide: Convert all usage of defined(PIPE_(OS|ARCH|CC)_*) to DETECT_(OS|ARCH|CC)_* by use grep 2022-11-15 20:35:55 +00:00
u_mm.c
u_mm.h
u_pack_color.h util: Move u_pack_color.h and dbughelp.h into src/util from/src/gallium/auxiliary/util/ 2023-08-02 03:41:24 +00:00
u_pointer.h
u_printf.c util: Remove va_copy fixup because of c11 is required 2022-11-11 06:15:42 +00:00
u_printf.h
u_process.c util/u_process: implement util_get_command_line for BSDs 2023-02-20 21:26:49 +00:00
u_process.h util/u_process: remove util_get_process_name_may_override() 2023-01-31 22:02:58 +00:00
u_qsort.cpp
u_qsort.h util: Fixes -Wundef in u_qsort.h 2022-11-24 04:33:07 +00:00
u_queue.c util/u_queue: always enable UTIL_QUEUE_INIT_SCALE_THREADS, remove the flag 2023-07-18 11:11:12 -04:00
u_queue.h util/u_queue: always enable UTIL_QUEUE_INIT_SCALE_THREADS, remove the flag 2023-07-18 11:11:12 -04:00
u_string.h util: Remove redundant #if !defined(XF86_LIBC_H) in u_string.h 2023-06-30 03:33:11 +00:00
u_thread.c util: Move the function implementation from u_thread.h to u_thread.c 2022-10-20 03:04:56 +00:00
u_thread.h util: Move pipe_semaphore to u_thread.h and rename it to util_semaphore 2022-11-08 05:21:42 +00:00
u_vector.c util: Replace the usage of redundant u_align_u32 with align and remove u_align_u32 2023-06-29 00:45:30 +00:00
u_vector.h util: Replace the usage of redundant u_align_u32 with align and remove u_align_u32 2023-06-29 00:45:30 +00:00
u_worklist.c util,mesa,panfrost: Drop some author tags 2023-03-26 00:16:25 +00:00
u_worklist.h util,mesa,panfrost: Drop some author tags 2023-03-26 00:16:25 +00:00
vl_rbsp.h util/rbsp: keep track of removed bits for the emulation 2023-06-21 19:24:37 +09:00
vl_vlc.h util/vl: initialize data/end pointers. 2023-05-19 06:15:01 +00:00
vma.c util/vma: Allow initializing zero-size heaps 2023-08-04 21:32:00 +00:00
vma.h util/vma: Add "nospan" 2022-12-17 19:14:12 +00:00
xmlconfig.c util/xmlconfig: add MESA_DRICONF_EXECUTABLE_OVERRIDE 2023-01-31 22:02:58 +00:00
xmlconfig.h anv: work around for per-prim attributes corruption 2023-03-29 18:35:55 +00:00
xxd.py
xxhash.h