1 /* 2 * Copyright (C) 2006 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 #pragma once 18 19 #include <android/gui/CachingHint.h> 20 #include <android/gui/DisplayBrightness.h> 21 #include <android/gui/DisplayCaptureArgs.h> 22 #include <android/gui/FrameTimelineInfo.h> 23 #include <android/gui/IDisplayEventConnection.h> 24 #include <android/gui/IFpsListener.h> 25 #include <android/gui/IHdrLayerInfoListener.h> 26 #include <android/gui/IRegionSamplingListener.h> 27 #include <android/gui/IScreenCaptureListener.h> 28 #include <android/gui/ITunnelModeEnabledListener.h> 29 #include <android/gui/IWindowInfosListener.h> 30 #include <android/gui/IWindowInfosPublisher.h> 31 #include <android/gui/LayerCaptureArgs.h> 32 #include <binder/IBinder.h> 33 #include <binder/IInterface.h> 34 #include <gui/ITransactionCompletedListener.h> 35 #include <gui/SpHash.h> 36 #include <math/vec4.h> 37 #include <stdint.h> 38 #include <sys/types.h> 39 #include <ui/ConfigStoreTypes.h> 40 #include <ui/DisplayId.h> 41 #include <ui/DisplayMode.h> 42 #include <ui/DisplayedFrameStats.h> 43 #include <ui/FrameStats.h> 44 #include <ui/GraphicBuffer.h> 45 #include <ui/GraphicTypes.h> 46 #include <ui/PixelFormat.h> 47 #include <ui/Rotation.h> 48 #include <utils/Errors.h> 49 #include <utils/RefBase.h> 50 #include <utils/Timers.h> 51 #include <utils/Vector.h> 52 53 #include <optional> 54 #include <unordered_set> 55 #include <vector> 56 57 #include <aidl/android/hardware/graphics/common/DisplayDecorationSupport.h> 58 59 namespace android { 60 61 struct client_cache_t; 62 class ComposerState; 63 struct DisplayStatInfo; 64 struct DisplayState; 65 struct InputWindowCommands; 66 class HdrCapabilities; 67 class Rect; 68 class TransactionState; 69 70 using gui::FrameTimelineInfo; 71 using gui::IDisplayEventConnection; 72 using gui::IRegionSamplingListener; 73 using gui::IScreenCaptureListener; 74 using gui::SpHash; 75 76 namespace ui { 77 78 struct DisplayMode; 79 struct DisplayState; 80 struct DynamicDisplayInfo; 81 82 } // namespace ui 83 84 /* 85 * This class defines the Binder IPC interface for accessing various 86 * SurfaceFlinger features. 87 */ 88 class ISurfaceComposer: public IInterface { 89 public: 90 DECLARE_META_INTERFACE(SurfaceComposer) 91 92 // flags for setTransactionState() 93 enum { 94 eAnimation = 0x02, 95 96 // Explicit indication that this transaction and others to follow will likely result in a 97 // lot of layers being composed, and thus, SurfaceFlinger should wake-up earlier to avoid 98 // missing frame deadlines. In this case SurfaceFlinger will wake up at 99 // (sf vsync offset - debug.sf.early_phase_offset_ns). SurfaceFlinger will continue to be 100 // in the early configuration until it receives eEarlyWakeupEnd. These flags are 101 // expected to be used by WindowManager only and are guarded by 102 // android.permission.WAKEUP_SURFACE_FLINGER 103 eEarlyWakeupStart = 0x08, 104 eEarlyWakeupEnd = 0x10, 105 eOneWay = 0x20 106 }; 107 108 /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */ 109 virtual status_t setTransactionState(TransactionState&& state) = 0; 110 }; 111 112 // ---------------------------------------------------------------------------- 113 114 class BnSurfaceComposer: public BnInterface<ISurfaceComposer> { 115 public: 116 enum ISurfaceComposerTag { 117 // Note: BOOT_FINISHED must remain this value, it is called from 118 // Java by ActivityManagerService. 119 BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION, 120 CREATE_CONNECTION, // Deprecated. Autogenerated by .aidl now. 121 GET_STATIC_DISPLAY_INFO, // Deprecated. Autogenerated by .aidl now. 122 CREATE_DISPLAY_EVENT_CONNECTION, // Deprecated. Autogenerated by .aidl now. 123 CREATE_VIRTUAL_DISPLAY, // Deprecated. Autogenerated by .aidl now. 124 DESTROY_VIRTUAL_DISPLAY, // Deprecated. Autogenerated by .aidl now. 125 GET_PHYSICAL_DISPLAY_TOKEN, // Deprecated. Autogenerated by .aidl now. 126 SET_TRANSACTION_STATE, 127 AUTHENTICATE_SURFACE, // Deprecated. Autogenerated by .aidl now. 128 GET_SUPPORTED_FRAME_TIMESTAMPS, // Deprecated. Autogenerated by .aidl now. 129 GET_DISPLAY_MODES, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 130 GET_ACTIVE_DISPLAY_MODE, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 131 GET_DISPLAY_STATE, 132 CAPTURE_DISPLAY, // Deprecated. Autogenerated by .aidl now. 133 CAPTURE_LAYERS, // Deprecated. Autogenerated by .aidl now. 134 CLEAR_ANIMATION_FRAME_STATS, // Deprecated. Autogenerated by .aidl now. 135 GET_ANIMATION_FRAME_STATS, // Deprecated. Autogenerated by .aidl now. 136 SET_POWER_MODE, // Deprecated. Autogenerated by .aidl now. 137 GET_DISPLAY_STATS, 138 GET_HDR_CAPABILITIES, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 139 GET_DISPLAY_COLOR_MODES, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 140 GET_ACTIVE_COLOR_MODE, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 141 SET_ACTIVE_COLOR_MODE, // Deprecated. Autogenerated by .aidl now. 142 ENABLE_VSYNC_INJECTIONS, // Deprecated. Autogenerated by .aidl now. 143 INJECT_VSYNC, // Deprecated. Autogenerated by .aidl now. 144 GET_LAYER_DEBUG_INFO, // Deprecated. Autogenerated by .aidl now. 145 GET_COMPOSITION_PREFERENCE, // Deprecated. Autogenerated by .aidl now. 146 GET_COLOR_MANAGEMENT, // Deprecated. Autogenerated by .aidl now. 147 GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES, // Deprecated. Autogenerated by .aidl now. 148 SET_DISPLAY_CONTENT_SAMPLING_ENABLED, // Deprecated. Autogenerated by .aidl now. 149 GET_DISPLAYED_CONTENT_SAMPLE, 150 GET_PROTECTED_CONTENT_SUPPORT, // Deprecated. Autogenerated by .aidl now. 151 IS_WIDE_COLOR_DISPLAY, // Deprecated. Autogenerated by .aidl now. 152 GET_DISPLAY_NATIVE_PRIMARIES, // Deprecated. Autogenerated by .aidl now. 153 GET_PHYSICAL_DISPLAY_IDS, // Deprecated. Autogenerated by .aidl now. 154 ADD_REGION_SAMPLING_LISTENER, // Deprecated. Autogenerated by .aidl now. 155 REMOVE_REGION_SAMPLING_LISTENER, // Deprecated. Autogenerated by .aidl now. 156 SET_DESIRED_DISPLAY_MODE_SPECS, // Deprecated. Autogenerated by .aidl now. 157 GET_DESIRED_DISPLAY_MODE_SPECS, // Deprecated. Autogenerated by .aidl now. 158 GET_DISPLAY_BRIGHTNESS_SUPPORT, // Deprecated. Autogenerated by .aidl now. 159 SET_DISPLAY_BRIGHTNESS, // Deprecated. Autogenerated by .aidl now. 160 CAPTURE_DISPLAY_BY_ID, // Deprecated. Autogenerated by .aidl now. 161 NOTIFY_POWER_BOOST, // Deprecated. Autogenerated by .aidl now. 162 SET_GLOBAL_SHADOW_SETTINGS, 163 GET_AUTO_LOW_LATENCY_MODE_SUPPORT, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 164 SET_AUTO_LOW_LATENCY_MODE, // Deprecated. Autogenerated by .aidl now. 165 GET_GAME_CONTENT_TYPE_SUPPORT, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 166 SET_GAME_CONTENT_TYPE, // Deprecated. Use GET_DYNAMIC_DISPLAY_INFO instead. 167 SET_FRAME_RATE, // Deprecated. Autogenerated by .aidl now. 168 // Deprecated. Use DisplayManager.setShouldAlwaysRespectAppRequestedMode(true); 169 ACQUIRE_FRAME_RATE_FLEXIBILITY_TOKEN, 170 SET_FRAME_TIMELINE_INFO, // Deprecated. Autogenerated by .aidl now. 171 ADD_TRANSACTION_TRACE_LISTENER, // Deprecated. Autogenerated by .aidl now. 172 GET_GPU_CONTEXT_PRIORITY, 173 GET_MAX_ACQUIRED_BUFFER_COUNT, 174 GET_DYNAMIC_DISPLAY_INFO, // Deprecated. Autogenerated by .aidl now. 175 ADD_FPS_LISTENER, // Deprecated. Autogenerated by .aidl now. 176 REMOVE_FPS_LISTENER, // Deprecated. Autogenerated by .aidl now. 177 OVERRIDE_HDR_TYPES, // Deprecated. Autogenerated by .aidl now. 178 ADD_HDR_LAYER_INFO_LISTENER, // Deprecated. Autogenerated by .aidl now. 179 REMOVE_HDR_LAYER_INFO_LISTENER, // Deprecated. Autogenerated by .aidl now. 180 ON_PULL_ATOM, // Deprecated. Autogenerated by .aidl now. 181 ADD_TUNNEL_MODE_ENABLED_LISTENER, // Deprecated. Autogenerated by .aidl now. 182 REMOVE_TUNNEL_MODE_ENABLED_LISTENER, // Deprecated. Autogenerated by .aidl now. 183 ADD_WINDOW_INFOS_LISTENER, // Deprecated. Autogenerated by .aidl now. 184 REMOVE_WINDOW_INFOS_LISTENER, // Deprecated. Autogenerated by .aidl now. 185 GET_PRIMARY_PHYSICAL_DISPLAY_ID, // Deprecated. Autogenerated by .aidl now. 186 GET_DISPLAY_DECORATION_SUPPORT, 187 GET_BOOT_DISPLAY_MODE_SUPPORT, // Deprecated. Autogenerated by .aidl now. 188 SET_BOOT_DISPLAY_MODE, // Deprecated. Autogenerated by .aidl now. 189 CLEAR_BOOT_DISPLAY_MODE, // Deprecated. Autogenerated by .aidl now. 190 SET_OVERRIDE_FRAME_RATE, // Deprecated. Autogenerated by .aidl now. 191 GET_SCHEDULING_POLICY, 192 // Always append new enum to the end. 193 }; 194 195 virtual status_t onTransact(uint32_t code, const Parcel& data, 196 Parcel* reply, uint32_t flags = 0); 197 }; 198 199 } // namespace android 200