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