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

Commit 1a25e4ec authored by Kaylee Lubick's avatar Kaylee Lubick
Browse files

[native] Update deprecated GrVk type names

These are just aliases for the GPU-backend agnostic type name,
so we should just use them.

This also deletes seemingly unnecessary #includes.

Change-Id: I6d7cb04671fa67c9b59144583a6a296e7acd7b84
Bug: b/309785258
Flag: EXEMPT refactor
parent 3cd662b3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
#include <GrDirectContext.h>
#include <include/gpu/ganesh/vk/GrVkBackendSemaphore.h>
#include <include/gpu/ganesh/vk/GrVkDirectContext.h>
#include <vk/GrVkExtensions.h>
#include <vk/GrVkTypes.h>

#include <android-base/stringprintf.h>
+0 −2
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
#ifndef SF_SKIAVKRENDERENGINE_H_
#define SF_SKIAVKRENDERENGINE_H_

#include <vk/GrVkBackendContext.h>

#include "SkiaRenderEngine.h"
#include "VulkanInterface.h"
#include "compat/SkiaGpuContext.h"
+10 −23
Original line number Diff line number Diff line
@@ -32,21 +32,8 @@ namespace android {
namespace renderengine {
namespace skia {

GrVkBackendContext VulkanInterface::getGaneshBackendContext() {
    GrVkBackendContext backendContext;
    backendContext.fInstance = mInstance;
    backendContext.fPhysicalDevice = mPhysicalDevice;
    backendContext.fDevice = mDevice;
    backendContext.fQueue = mQueue;
    backendContext.fGraphicsQueueIndex = mQueueIndex;
    backendContext.fMaxAPIVersion = mApiVersion;
    backendContext.fVkExtensions = &mGrExtensions;
    backendContext.fDeviceFeatures2 = mPhysicalDeviceFeatures2;
    backendContext.fGetProc = mGrGetProc;
    backendContext.fProtectedContext = mIsProtected ? Protected::kYes : Protected::kNo;
    backendContext.fDeviceLostContext = this; // VulkanInterface is long-lived
    backendContext.fDeviceLostProc = onVkDeviceFault;
    return backendContext;
VulkanBackendContext VulkanInterface::getGaneshBackendContext() {
    return this->getGraphiteBackendContext();
};

VulkanBackendContext VulkanInterface::getGraphiteBackendContext() {
@@ -57,7 +44,7 @@ VulkanBackendContext VulkanInterface::getGraphiteBackendContext() {
    backendContext.fQueue = mQueue;
    backendContext.fGraphicsQueueIndex = mQueueIndex;
    backendContext.fMaxAPIVersion = mApiVersion;
    backendContext.fVkExtensions = &mGrExtensions;
    backendContext.fVkExtensions = &mVulkanExtensions;
    backendContext.fDeviceFeatures2 = mPhysicalDeviceFeatures2;
    backendContext.fGetProc = mGrGetProc;
    backendContext.fProtectedContext = mIsProtected ? Protected::kYes : Protected::kNo;
@@ -429,11 +416,11 @@ void VulkanInterface::init(bool protectedContent) {
        mDeviceExtensionNames.push_back(devExt.extensionName);
    }

    mGrExtensions.init(sGetProc, instance, physicalDevice, enabledInstanceExtensionNames.size(),
    mVulkanExtensions.init(sGetProc, instance, physicalDevice, enabledInstanceExtensionNames.size(),
                           enabledInstanceExtensionNames.data(), enabledDeviceExtensionNames.size(),
                           enabledDeviceExtensionNames.data());

    if (!mGrExtensions.hasExtension(VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, 1)) {
    if (!mVulkanExtensions.hasExtension(VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, 1)) {
        BAIL("Vulkan driver doesn't support external semaphore fd");
    }

@@ -458,7 +445,7 @@ void VulkanInterface::init(bool protectedContent) {
        tailPnext = &mProtectedMemoryFeatures->pNext;
    }

    if (mGrExtensions.hasExtension(VK_EXT_DEVICE_FAULT_EXTENSION_NAME, 1)) {
    if (mVulkanExtensions.hasExtension(VK_EXT_DEVICE_FAULT_EXTENSION_NAME, 1)) {
        mDeviceFaultFeatures = new VkPhysicalDeviceFaultFeaturesEXT;
        mDeviceFaultFeatures->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT;
        mDeviceFaultFeatures->pNext = nullptr;
@@ -484,7 +471,7 @@ void VulkanInterface::init(bool protectedContent) {
            queuePriority,
    };

    if (mGrExtensions.hasExtension(VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME, 2)) {
    if (mVulkanExtensions.hasExtension(VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME, 2)) {
        queueNextPtr = &queuePriorityCreateInfo;
    }

@@ -606,7 +593,7 @@ void VulkanInterface::teardown() {
    mQueue = VK_NULL_HANDLE;          // Implicitly destroyed by destroying mDevice.
    mQueueIndex = 0;
    mApiVersion = 0;
    mGrExtensions = skgpu::VulkanExtensions();
    mVulkanExtensions = skgpu::VulkanExtensions();
    mGrGetProc = nullptr;
    mIsProtected = false;
    mIsRealtimePriority = false;
+4 −7
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#pragma once

#include <include/gpu/vk/GrVkBackendContext.h>
#include <include/gpu/vk/VulkanBackendContext.h>
#include <include/gpu/vk/VulkanExtensions.h>
#include <include/gpu/vk/VulkanTypes.h>

@@ -24,10 +24,6 @@

using namespace skgpu;

namespace skgpu {
struct VulkanBackendContext;
} // namespace skgpu

namespace android {
namespace renderengine {
namespace skia {
@@ -48,7 +44,8 @@ public:
    bool takeOwnership();
    void teardown();

    GrVkBackendContext getGaneshBackendContext();
    // TODO(b/309785258) Combine these into one now that they are the same implementation.
    VulkanBackendContext getGaneshBackendContext();
    VulkanBackendContext getGraphiteBackendContext();
    VkSemaphore createExportableSemaphore();
    VkSemaphore importSemaphoreFromSyncFd(int syncFd);
@@ -86,7 +83,7 @@ private:
    VkQueue mQueue = VK_NULL_HANDLE;
    int mQueueIndex = 0;
    uint32_t mApiVersion = 0;
    skgpu::VulkanExtensions mGrExtensions;
    skgpu::VulkanExtensions mVulkanExtensions;
    VkPhysicalDeviceFeatures2* mPhysicalDeviceFeatures2 = nullptr;
    VkPhysicalDeviceSamplerYcbcrConversionFeatures* mSamplerYcbcrConversionFeatures = nullptr;
    VkPhysicalDeviceProtectedMemoryFeatures* mProtectedMemoryFeatures = nullptr;
+3 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
#include <include/gpu/ganesh/gl/GrGLDirectContext.h>
#include <include/gpu/ganesh/vk/GrVkDirectContext.h>
#include <include/gpu/gl/GrGLInterface.h>
#include <include/gpu/vk/GrVkBackendContext.h>
#include <include/gpu/vk/VulkanBackendContext.h>

#include "../AutoBackendTexture.h"
#include "GaneshBackendTexture.h"
@@ -56,10 +56,10 @@ std::unique_ptr<SkiaGpuContext> SkiaGpuContext::MakeGL_Ganesh(
}

std::unique_ptr<SkiaGpuContext> SkiaGpuContext::MakeVulkan_Ganesh(
        const GrVkBackendContext& grVkBackendContext,
        const skgpu::VulkanBackendContext& vkBackendContext,
        GrContextOptions::PersistentCache& skSLCacheMonitor) {
    return std::make_unique<GaneshGpuContext>(
            GrDirectContexts::MakeVulkan(grVkBackendContext, ganeshOptions(skSLCacheMonitor)));
            GrDirectContexts::MakeVulkan(vkBackendContext, ganeshOptions(skSLCacheMonitor)));
}

GaneshGpuContext::GaneshGpuContext(sk_sp<GrDirectContext> grContext) : mGrContext(grContext) {
Loading