Home | History | Annotate | Download | only in OpenglSystemCommon
      1 // Copyright (C) 2018 The Android Open Source Project
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 // http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 #ifndef __COMMON_EMULATOR_FEATURE_INFO_H
     15 #define __COMMON_EMULATOR_FEATURE_INFO_H
     16 
     17 // SyncImpl determines the presence of host/guest OpenGL fence sync
     18 // capabilities. It corresponds exactly to EGL_ANDROID_native_fence_sync
     19 // capability, but for the emulator, we need to make sure that
     20 // OpenGL pipe protocols match, so we use a special extension name
     21 // here.
     22 // SYNC_IMPL_NONE means that the native fence sync capability is
     23 // not present, and we will end up using the equivalent of glFinish
     24 // in order to preserve buffer swapping order.
     25 // SYNC_IMPL_NATIVE_SYNC means that we do have native fence sync
     26 // capability, and we will use a fence fd to synchronize buffer swaps.
     27 enum SyncImpl {
     28     SYNC_IMPL_NONE = 0,
     29     SYNC_IMPL_NATIVE_SYNC_V2 = 1,
     30     SYNC_IMPL_NATIVE_SYNC_V3 = 2,
     31 };
     32 
     33 // Interface:
     34 // Use the highest of v2 or v3 that show up, making us
     35 // SYNC_IMPL_NATIVE_SYNC_V2 or SYNC_IMPL_NATIVE_SYNC_V3.
     36 static const char kRCNativeSyncV2[] = "ANDROID_EMU_native_sync_v2";
     37 static const char kRCNativeSyncV3[] = "ANDROID_EMU_native_sync_v3";
     38 
     39 // DMA for OpenGL
     40 enum DmaImpl {
     41     DMA_IMPL_NONE = 0,
     42     DMA_IMPL_v1 = 1,
     43 };
     44 
     45 static const char kDmaExtStr_v1[] = "ANDROID_EMU_dma_v1";
     46 
     47 // OpenGL ES max supported version
     48 enum GLESMaxVersion {
     49     GLES_MAX_VERSION_2 = 0,
     50     GLES_MAX_VERSION_3_0 = 1,
     51     GLES_MAX_VERSION_3_1 = 2,
     52     GLES_MAX_VERSION_3_2 = 3,
     53 };
     54 
     55 static const char kGLESMaxVersion_2[] = "ANDROID_EMU_gles_max_version_2";
     56 static const char kGLESMaxVersion_3_0[] = "ANDROID_EMU_gles_max_version_3_0";
     57 static const char kGLESMaxVersion_3_1[] = "ANDROID_EMU_gles_max_version_3_1";
     58 static const char kGLESMaxVersion_3_2[] = "ANDROID_EMU_gles_max_version_3_2";
     59 
     60 enum HostComposition {
     61     HOST_COMPOSITION_NONE = 0,
     62     HOST_COMPOSITION_V1,
     63 };
     64 
     65 static const char kHostCompositionV1[] = "ANDROID_EMU_host_composition_v1";
     66 
     67 // No querying errors from host extension
     68 static const char kGLESNoHostError[] = "ANDROID_EMU_gles_no_host_error";
     69 
     70 // Host to guest memory mapping
     71 static const char kGLDirectMem[] = "ANDROID_EMU_direct_mem";
     72 
     73 // Vulkan host support
     74 // To be delivered/enabled when at least the following is working/available:
     75 // - HOST_COHERENT memory mapping
     76 // - Full gralloc interop: External memory, AHB
     77 static const char kVulkan[] = "ANDROID_EMU_vulkan";
     78 
     79 // Deferred Vulkan commands
     80 static const char kDeferredVulkanCommands[] = "ANDROID_EMU_deferred_vulkan_commands";
     81 
     82 // Struct describing available emulator features
     83 struct EmulatorFeatureInfo {
     84 
     85     EmulatorFeatureInfo() :
     86         syncImpl(SYNC_IMPL_NONE),
     87         dmaImpl(DMA_IMPL_NONE),
     88         hostComposition(HOST_COMPOSITION_NONE),
     89         glesMaxVersion(GLES_MAX_VERSION_2),
     90         hasDirectMem(false),
     91         hasVulkan(false),
     92         hasDeferredVulkanCommands(false) { }
     93 
     94     SyncImpl syncImpl;
     95     DmaImpl dmaImpl;
     96     HostComposition hostComposition;
     97     GLESMaxVersion glesMaxVersion;
     98     bool hasDirectMem;
     99     bool hasVulkan;
    100     bool hasDeferredVulkanCommands;
    101 };
    102 
    103 #endif // __COMMON_EMULATOR_FEATURE_INFO_H
    104