1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef HOST_CONNECTION_GLES_H 18 #define HOST_CONNECTION_GLES_H 19 20 #include "GLEncoder.h" 21 #include "GL2Encoder.h" 22 #include "renderControl_enc.h" 23 #include "renderControl_types.h" 24 25 // ExtendedRCEncoderContext is an extended version of renderControl_encoder_context_t 26 // that will be used to track available emulator features. 27 class ExtendedRCEncoderContext : public renderControl_encoder_context_t { 28 public: ExtendedRCEncoderContext(gfxstream::guest::IOStream * stream,gfxstream::guest::ChecksumCalculator * checksumCalculator)29 ExtendedRCEncoderContext(gfxstream::guest::IOStream *stream, 30 gfxstream::guest::ChecksumCalculator *checksumCalculator) 31 : renderControl_encoder_context_t(stream, checksumCalculator) {} setSyncImpl(SyncImpl syncImpl)32 void setSyncImpl(SyncImpl syncImpl) { m_featureInfo.syncImpl = syncImpl; } setHostComposition(HostComposition hostComposition)33 void setHostComposition(HostComposition hostComposition) { 34 m_featureInfo.hostComposition = hostComposition; } hasNativeSync()35 bool hasNativeSync() const { return m_featureInfo.syncImpl >= SYNC_IMPL_NATIVE_SYNC_V2; } hasNativeSyncV3()36 bool hasNativeSyncV3() const { return m_featureInfo.syncImpl >= SYNC_IMPL_NATIVE_SYNC_V3; } hasNativeSyncV4()37 bool hasNativeSyncV4() const { return m_featureInfo.syncImpl >= SYNC_IMPL_NATIVE_SYNC_V4; } hasVirtioGpuNativeSync()38 bool hasVirtioGpuNativeSync() const { return m_featureInfo.hasVirtioGpuNativeSync; } hasHostCompositionV1()39 bool hasHostCompositionV1() const { 40 return m_featureInfo.hostComposition == HOST_COMPOSITION_V1; } hasHostCompositionV2()41 bool hasHostCompositionV2() const { 42 return m_featureInfo.hostComposition == HOST_COMPOSITION_V2; } hasYUVCache()43 bool hasYUVCache() const { 44 return m_featureInfo.hasYUVCache; } hasAsyncUnmapBuffer()45 bool hasAsyncUnmapBuffer() const { 46 return m_featureInfo.hasAsyncUnmapBuffer; } hasHostSideTracing()47 bool hasHostSideTracing() const { 48 return m_featureInfo.hasHostSideTracing; 49 } hasAsyncFrameCommands()50 bool hasAsyncFrameCommands() const { 51 return m_featureInfo.hasAsyncFrameCommands; 52 } hasSyncBufferData()53 bool hasSyncBufferData() const { 54 return m_featureInfo.hasSyncBufferData; } hasHWCMultiConfigs()55 bool hasHWCMultiConfigs() const { 56 return m_featureInfo.hasHWCMultiConfigs; 57 } setGLESMaxVersion(GLESMaxVersion ver)58 void setGLESMaxVersion(GLESMaxVersion ver) { m_featureInfo.glesMaxVersion = ver; } getGLESMaxVersion()59 GLESMaxVersion getGLESMaxVersion() const { return m_featureInfo.glesMaxVersion; } hasDirectMem()60 bool hasDirectMem() const { 61 return m_featureInfo.hasDirectMem; 62 } 63 featureInfo_const()64 const EmulatorFeatureInfo* featureInfo_const() const { return &m_featureInfo; } featureInfo()65 EmulatorFeatureInfo* featureInfo() { return &m_featureInfo; } 66 private: 67 EmulatorFeatureInfo m_featureInfo; 68 }; 69 70 #endif 71