1 #include "SurfaceFlingerConfigs.h" 2 3 #include <android-base/logging.h> 4 5 namespace android { 6 namespace hardware { 7 namespace configstore { 8 namespace V1_0 { 9 namespace implementation { 10 11 // Methods from ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs follow. 12 Return<void> SurfaceFlingerConfigs::vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) { 13 #ifdef VSYNC_EVENT_PHASE_OFFSET_NS 14 _hidl_cb({true, VSYNC_EVENT_PHASE_OFFSET_NS}); 15 #else 16 _hidl_cb({false, 0}); 17 #endif 18 return Void(); 19 } 20 21 Return<void> SurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) { 22 #ifdef SF_VSYNC_EVENT_PHASE_OFFSET_NS 23 _hidl_cb({true, SF_VSYNC_EVENT_PHASE_OFFSET_NS}); 24 #else 25 _hidl_cb({false, 0}); 26 #endif 27 return Void(); 28 } 29 30 Return<void> SurfaceFlingerConfigs::useContextPriority(useContextPriority_cb _hidl_cb) { 31 #ifdef USE_CONTEXT_PRIORITY 32 _hidl_cb({true, USE_CONTEXT_PRIORITY}); 33 #else 34 _hidl_cb({false, false}); 35 #endif 36 return Void(); 37 } 38 39 Return<void> SurfaceFlingerConfigs::maxFrameBufferAcquiredBuffers(maxFrameBufferAcquiredBuffers_cb _hidl_cb) { 40 #ifdef NUM_FRAMEBUFFER_SURFACE_BUFFERS 41 _hidl_cb({true, NUM_FRAMEBUFFER_SURFACE_BUFFERS}); 42 #else 43 _hidl_cb({false, 0}); 44 #endif 45 return Void(); 46 } 47 48 Return<void> SurfaceFlingerConfigs::hasWideColorDisplay(hasWideColorDisplay_cb _hidl_cb) { 49 bool value = false; 50 #ifdef HAS_WIDE_COLOR_DISPLAY 51 value = true; 52 #endif 53 _hidl_cb({true, value}); 54 return Void(); 55 } 56 57 Return<void> SurfaceFlingerConfigs::hasSyncFramework(hasSyncFramework_cb _hidl_cb) { 58 bool value = true; 59 #ifdef RUNNING_WITHOUT_SYNC_FRAMEWORK 60 value = false; 61 #endif 62 _hidl_cb({true, value}); 63 return Void(); 64 } 65 66 Return<void> SurfaceFlingerConfigs::hasHDRDisplay(hasHDRDisplay_cb _hidl_cb) { 67 bool value = false; 68 #ifdef HAS_HDR_DISPLAY 69 value = true; 70 #endif 71 _hidl_cb({true, value}); 72 return Void(); 73 } 74 75 Return<void> SurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs(presentTimeOffsetFromVSyncNs_cb _hidl_cb) { 76 #ifdef PRESENT_TIME_OFFSET_FROM_VSYNC_NS 77 _hidl_cb({true, PRESENT_TIME_OFFSET_FROM_VSYNC_NS}); 78 #else 79 _hidl_cb({false, 0}); 80 #endif 81 return Void(); 82 } 83 84 Return<void> SurfaceFlingerConfigs::useHwcForRGBtoYUV(useHwcForRGBtoYUV_cb _hidl_cb) { 85 bool value = false; 86 #ifdef FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS 87 value = true; 88 #endif 89 _hidl_cb({true, value}); 90 return Void(); 91 } 92 93 Return<void> SurfaceFlingerConfigs::maxVirtualDisplaySize(maxVirtualDisplaySize_cb _hidl_cb) { 94 uint64_t maxSize = 0; 95 #ifdef MAX_VIRTUAL_DISPLAY_DIMENSION 96 maxSize = MAX_VIRTUAL_DISPLAY_DIMENSION; 97 _hidl_cb({true, maxSize}); 98 #else 99 _hidl_cb({false, maxSize}); 100 #endif 101 return Void(); 102 } 103 104 Return<void> SurfaceFlingerConfigs::useVrFlinger(useVrFlinger_cb _hidl_cb) { 105 bool value = false; 106 bool specified = false; 107 #ifdef USE_VR_FLINGER 108 value = true; 109 specified = true; 110 #endif 111 _hidl_cb({specified, value}); 112 return Void(); 113 } 114 115 Return<void> SurfaceFlingerConfigs::startGraphicsAllocatorService( 116 startGraphicsAllocatorService_cb _hidl_cb) { 117 bool value = false; 118 #ifdef START_GRAPHICS_ALLOCATOR_SERVICE 119 value = true; 120 #endif 121 _hidl_cb({true, value}); 122 return Void(); 123 } 124 125 } // namespace implementation 126 } // namespace V1_0 127 } // namespace configstore 128 } // namespace hardware 129 } // namespace android 130