Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab9189c8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "libvulkan: Check whether gralloc can do protected content" into main

parents 5953c8ae 8b62df5d
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1071,7 +1071,18 @@ VkResult GetPhysicalDeviceSurfaceCapabilities2KHR(
            case VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR: {
                VkSurfaceProtectedCapabilitiesKHR* protected_caps =
                    reinterpret_cast<VkSurfaceProtectedCapabilitiesKHR*>(pNext);
                protected_caps->supportsProtected = VK_TRUE;

                // Check if the device's gralloc can support protected content
                AHardwareBuffer_Desc desc = {
                    .width = 1,
                    .height = 1,
                    .layers = 1,
                    .format = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM,
                    .usage = AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
                        AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT
                };

                protected_caps->supportsProtected = AHardwareBuffer_isSupported(&desc) ? VK_TRUE : VK_FALSE;
            } break;

            case VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT: {