Home | History | Annotate | Download | only in default
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.1 (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.1
      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 #include "SurfaceFlingerConfigs.h"
     18 
     19 namespace android {
     20 namespace hardware {
     21 namespace configstore {
     22 namespace V1_0 {
     23 namespace implementation {
     24 
     25 // Methods from ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs
     26 // follow.
     27 Return<void> SurfaceFlingerConfigs::vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) {
     28 #ifdef VSYNC_EVENT_PHASE_OFFSET_NS
     29     _hidl_cb({true, VSYNC_EVENT_PHASE_OFFSET_NS});
     30 #else
     31     _hidl_cb({false, 0});
     32 #endif
     33     return Void();
     34 }
     35 
     36 Return<void> SurfaceFlingerConfigs::vsyncSfEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) {
     37 #ifdef SF_VSYNC_EVENT_PHASE_OFFSET_NS
     38     _hidl_cb({true, SF_VSYNC_EVENT_PHASE_OFFSET_NS});
     39 #else
     40     _hidl_cb({false, 0});
     41 #endif
     42     return Void();
     43 }
     44 
     45 Return<void> SurfaceFlingerConfigs::useContextPriority(useContextPriority_cb _hidl_cb) {
     46 #ifdef USE_CONTEXT_PRIORITY
     47     _hidl_cb({true, USE_CONTEXT_PRIORITY});
     48 #else
     49     _hidl_cb({false, false});
     50 #endif
     51     return Void();
     52 }
     53 
     54 Return<void> SurfaceFlingerConfigs::maxFrameBufferAcquiredBuffers(
     55     maxFrameBufferAcquiredBuffers_cb _hidl_cb) {
     56 #ifdef NUM_FRAMEBUFFER_SURFACE_BUFFERS
     57     _hidl_cb({true, NUM_FRAMEBUFFER_SURFACE_BUFFERS});
     58 #else
     59     _hidl_cb({false, 0});
     60 #endif
     61     return Void();
     62 }
     63 
     64 Return<void> SurfaceFlingerConfigs::hasWideColorDisplay(hasWideColorDisplay_cb _hidl_cb) {
     65     bool value = false;
     66 #ifdef HAS_WIDE_COLOR_DISPLAY
     67     value = true;
     68 #endif
     69     _hidl_cb({true, value});
     70     return Void();
     71 }
     72 
     73 Return<void> SurfaceFlingerConfigs::hasSyncFramework(hasSyncFramework_cb _hidl_cb) {
     74     bool value = true;
     75 #ifdef RUNNING_WITHOUT_SYNC_FRAMEWORK
     76     value = false;
     77 #endif
     78     _hidl_cb({true, value});
     79     return Void();
     80 }
     81 
     82 Return<void> SurfaceFlingerConfigs::hasHDRDisplay(hasHDRDisplay_cb _hidl_cb) {
     83     bool value = false;
     84 #ifdef HAS_HDR_DISPLAY
     85     value = true;
     86 #endif
     87     _hidl_cb({true, value});
     88     return Void();
     89 }
     90 
     91 Return<void> SurfaceFlingerConfigs::presentTimeOffsetFromVSyncNs(
     92     presentTimeOffsetFromVSyncNs_cb _hidl_cb) {
     93 #ifdef PRESENT_TIME_OFFSET_FROM_VSYNC_NS
     94     _hidl_cb({true, PRESENT_TIME_OFFSET_FROM_VSYNC_NS});
     95 #else
     96     _hidl_cb({false, 0});
     97 #endif
     98     return Void();
     99 }
    100 
    101 Return<void> SurfaceFlingerConfigs::useHwcForRGBtoYUV(useHwcForRGBtoYUV_cb _hidl_cb) {
    102     bool value = false;
    103 #ifdef FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS
    104     value = true;
    105 #endif
    106     _hidl_cb({true, value});
    107     return Void();
    108 }
    109 
    110 Return<void> SurfaceFlingerConfigs::maxVirtualDisplaySize(maxVirtualDisplaySize_cb _hidl_cb) {
    111     uint64_t maxSize = 0;
    112 #ifdef MAX_VIRTUAL_DISPLAY_DIMENSION
    113     maxSize = MAX_VIRTUAL_DISPLAY_DIMENSION;
    114     _hidl_cb({true, maxSize});
    115 #else
    116     _hidl_cb({false, maxSize});
    117 #endif
    118     return Void();
    119 }
    120 
    121 Return<void> SurfaceFlingerConfigs::useVrFlinger(useVrFlinger_cb _hidl_cb) {
    122     bool value = false;
    123     bool specified = false;
    124 #ifdef USE_VR_FLINGER
    125     value = true;
    126     specified = true;
    127 #endif
    128     _hidl_cb({specified, value});
    129     return Void();
    130 }
    131 
    132 Return<void> SurfaceFlingerConfigs::startGraphicsAllocatorService(
    133     startGraphicsAllocatorService_cb _hidl_cb) {
    134     bool value = false;
    135 #ifdef START_GRAPHICS_ALLOCATOR_SERVICE
    136     value = true;
    137 #endif
    138     _hidl_cb({true, value});
    139     return Void();
    140 }
    141 
    142 // Methods from ::android::hidl::base::V1_0::IBase follow.
    143 
    144 }  // namespace implementation
    145 }  // namespace V1_0
    146 }  // namespace configstore
    147 }  // namespace hardware
    148 }  // namespace android
    149