cros_gralloc: Map GRALLOC_USAGE_PROTECTED to BO_USE_PROTECTED on API 35+

Bug: 433330646
Test: allocate a buffer with GRALLOC_USAGE_PROTECTED usage
Flag: EXEMPT: desktop-only change
Change-Id: I9a47dbb13655b141bfeaa9820632428647e7419b
This commit is contained in:
Hirokazu Honda 2025-07-21 21:29:34 -07:00
parent 9f2c22f6e9
commit c785301bd3

View file

@ -140,8 +140,13 @@ uint64_t cros_gralloc_convert_usage(uint64_t usage)
* usb monitors (evdi/udl). It's complicated so ignore it.
*/
handle_usage(&usage, GRALLOC_USAGE_EXTERNAL_DISP, &use_flags, BO_USE_NONE);
/* Map PROTECTED to linear until real HW protection is available on Android. */
#if ANDROID_API_LEVEL >= 35
handle_usage(&usage, GRALLOC_USAGE_PROTECTED, &use_flags, BO_USE_PROTECTED);
#else
handle_usage(&usage, GRALLOC_USAGE_PROTECTED, &use_flags, BO_USE_LINEAR);
#endif
handle_usage(&usage, GRALLOC_USAGE_CURSOR, &use_flags, BO_USE_CURSOR);
/* HACK: See b/30054495 for BO_USE_SW_READ_OFTEN. */
handle_usage(&usage, GRALLOC_USAGE_HW_VIDEO_ENCODER, &use_flags,