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