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

Commit d827791b authored by Chris Forbes's avatar Chris Forbes Committed by Jesse Hall
Browse files

vulkan: Tolerate missing GetSwapchainGrallocUsageANDROID function

Some drivers implementing ANDROID_native_buffer V6 have /removed/ the
old function. We shouldn't really mind if they do that -- we're never
going to call it anyway if they do expose the new
GetSwapchainGrallocUsage2ANDROID function.

V2: Fail at CreateDevice-time if neither function is exposed.

Change-Id: Id1e3dd5e2e71a9291dd610e908f9906acaaf0ad0
Related bugs: b/34177594
Test: build
parent 5c0a87e5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -443,6 +443,8 @@ bool InitDriverTable(VkDevice dev, PFN_vkGetDeviceProcAddr get_proc,

  {{if eq $.Name "vkGetSwapchainGrallocUsage2ANDROID"}}
    false
  {{else if eq $.Name "vkGetSwapchainGrallocUsageANDROID"}}
    false
  {{else}}
    true
  {{end}}
+17 −0
Original line number Diff line number Diff line
@@ -899,6 +899,23 @@ VkResult CreateDevice(VkPhysicalDevice physicalDevice,

        return VK_ERROR_INCOMPATIBLE_DRIVER;
    }

    // sanity check ANDROID_native_buffer implementation, whose set of
    // entrypoints varies according to the spec version.
    if ((wrapper.GetHalExtensions()[ProcHook::ANDROID_native_buffer]) &&
        !data->driver.GetSwapchainGrallocUsageANDROID &&
        !data->driver.GetSwapchainGrallocUsage2ANDROID) {
        ALOGE("Driver's implementation of ANDROID_native_buffer is broken;"
              " must expose at least one of "
              "vkGetSwapchainGrallocUsageANDROID or "
              "vkGetSwapchainGrallocUsage2ANDROID");

        data->driver.DestroyDevice(dev, pAllocator);
        FreeDeviceData(data, data_allocator);

        return VK_ERROR_INCOMPATIBLE_DRIVER;
    }

    data->driver_device = dev;

    *pDevice = dev;
+1 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ bool InitDriverTable(VkDevice dev,
    INIT_PROC(true, dev, CreateImage);
    INIT_PROC(true, dev, DestroyImage);
    INIT_PROC(true, dev, AllocateCommandBuffers);
    INIT_PROC_EXT(ANDROID_native_buffer, true, dev, GetSwapchainGrallocUsageANDROID);
    INIT_PROC_EXT(ANDROID_native_buffer, false, dev, GetSwapchainGrallocUsageANDROID);
    INIT_PROC_EXT(ANDROID_native_buffer, false, dev, GetSwapchainGrallocUsage2ANDROID);
    INIT_PROC_EXT(ANDROID_native_buffer, true, dev, AcquireImageANDROID);
    INIT_PROC_EXT(ANDROID_native_buffer, true, dev, QueueSignalReleaseImageANDROID);