Sean Paul | ed2ec4b | 2016-03-10 15:35:40 -0500 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS |
| 18 | #define LOG_TAG "hwc-drm-two" |
| 19 | |
| 20 | #include "drmhwctwo.h" |
| 21 | |
| 22 | #include <cutils/log.h> |
| 23 | #include <hardware/hwcomposer2.h> |
| 24 | |
| 25 | namespace android { |
| 26 | |
| 27 | DrmHwcTwo::DrmHwcTwo() { |
| 28 | common.close = HookDevClose; |
| 29 | getCapabilities = HookDevGetCapabilities; |
| 30 | getFunction = HookDevGetFunction; |
| 31 | } |
| 32 | |
| 33 | template <typename... Args> |
| 34 | static inline HWC2::Error unsupported(char const *func, Args... /*args*/) { |
| 35 | ALOGV("Unsupported function: %s", func); |
| 36 | return HWC2::Error::Unsupported; |
| 37 | } |
| 38 | |
| 39 | HWC2::Error DrmHwcTwo::CreateVirtualDisplay(uint32_t width, uint32_t height, |
| 40 | int32_t *format, |
| 41 | hwc2_display_t *display) { |
| 42 | // TODO: Implement virtual display |
| 43 | return unsupported(__func__, width, height, display); |
| 44 | } |
| 45 | |
| 46 | HWC2::Error DrmHwcTwo::DestroyVirtualDisplay(hwc2_display_t display) { |
| 47 | return unsupported(__func__, display); |
| 48 | } |
| 49 | |
| 50 | void DrmHwcTwo::Dump(uint32_t *size, char *buffer) { |
| 51 | unsupported(__func__, size, buffer); |
| 52 | } |
| 53 | |
| 54 | uint32_t DrmHwcTwo::GetMaxVirtualDisplayCount() { |
| 55 | unsupported(__func__); |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | HWC2::Error DrmHwcTwo::RegisterCallback(int32_t descriptor, |
| 60 | hwc2_callback_data_t data, |
| 61 | hwc2_function_pointer_t function) { |
| 62 | return unsupported(__func__, descriptor, data, function); |
| 63 | } |
| 64 | |
| 65 | HWC2::Error DrmHwcTwo::HwcDisplay::AcceptDisplayChanges() { |
| 66 | return unsupported(__func__); |
| 67 | } |
| 68 | |
| 69 | HWC2::Error DrmHwcTwo::HwcDisplay::CreateLayer(hwc2_layer_t *layer) { |
| 70 | return unsupported(__func__, layer); |
| 71 | } |
| 72 | |
| 73 | HWC2::Error DrmHwcTwo::HwcDisplay::DestroyLayer(hwc2_layer_t layer) { |
| 74 | return unsupported(__func__, layer); |
| 75 | } |
| 76 | |
| 77 | HWC2::Error DrmHwcTwo::HwcDisplay::GetActiveConfig(hwc2_config_t *config) { |
| 78 | return unsupported(__func__, config); |
| 79 | } |
| 80 | |
| 81 | HWC2::Error DrmHwcTwo::HwcDisplay::GetChangedCompositionTypes( |
| 82 | uint32_t *num_elements, hwc2_layer_t *layers, int32_t *types) { |
| 83 | return unsupported(__func__, num_elements, layers, types); |
| 84 | } |
| 85 | |
| 86 | HWC2::Error DrmHwcTwo::HwcDisplay::GetClientTargetSupport(uint32_t width, |
| 87 | uint32_t height, |
| 88 | int32_t format, |
| 89 | int32_t dataspace) { |
| 90 | return unsupported(__func__, width, height, format, dataspace); |
| 91 | } |
| 92 | |
| 93 | HWC2::Error DrmHwcTwo::HwcDisplay::GetColorModes(uint32_t *num_modes, |
| 94 | int32_t *modes) { |
| 95 | return unsupported(__func__, num_modes, modes); |
| 96 | } |
| 97 | |
| 98 | HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayAttribute(hwc2_config_t config, |
| 99 | int32_t attribute, |
| 100 | int32_t *value) { |
| 101 | return unsupported(__func__, config, attribute, value); |
| 102 | } |
| 103 | |
| 104 | HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayConfigs(uint32_t *num_configs, |
| 105 | hwc2_config_t *configs) { |
| 106 | return unsupported(__func__, num_configs, configs); |
| 107 | } |
| 108 | |
| 109 | HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayName(uint32_t *size, char *name) { |
| 110 | return unsupported(__func__, size, name); |
| 111 | } |
| 112 | |
| 113 | HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayRequests( |
| 114 | int32_t *display_requests, uint32_t *num_elements, hwc2_layer_t *layers, |
| 115 | int32_t *layer_requests) { |
| 116 | return unsupported(__func__, display_requests, num_elements, layers, |
| 117 | layer_requests); |
| 118 | } |
| 119 | |
| 120 | HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayType(int32_t *type) { |
| 121 | return unsupported(__func__, type); |
| 122 | } |
| 123 | |
| 124 | HWC2::Error DrmHwcTwo::HwcDisplay::GetDozeSupport(int32_t *support) { |
| 125 | return unsupported(__func__, support); |
| 126 | } |
| 127 | |
| 128 | HWC2::Error DrmHwcTwo::HwcDisplay::GetReleaseFences(uint32_t *num_elements, |
| 129 | hwc2_layer_t *layers, |
| 130 | int32_t *fences) { |
| 131 | return unsupported(__func__, num_elements, layers, fences); |
| 132 | } |
| 133 | |
| 134 | HWC2::Error DrmHwcTwo::HwcDisplay::PresentDisplay(int32_t *retire_fence) { |
| 135 | return unsupported(__func__, retire_fence); |
| 136 | } |
| 137 | |
| 138 | HWC2::Error DrmHwcTwo::HwcDisplay::SetActiveConfig(hwc2_config_t config) { |
| 139 | return unsupported(__func__, config); |
| 140 | } |
| 141 | |
| 142 | HWC2::Error DrmHwcTwo::HwcDisplay::SetClientTarget(buffer_handle_t target, |
| 143 | int32_t acquire_fence, |
| 144 | int32_t dataspace, |
| 145 | hwc_region_t damage) { |
| 146 | return unsupported(__func__, target, acquire_fence, dataspace, damage); |
| 147 | } |
| 148 | |
| 149 | HWC2::Error DrmHwcTwo::HwcDisplay::SetColorMode(int32_t mode) { |
| 150 | return unsupported(__func__, mode); |
| 151 | } |
| 152 | |
| 153 | HWC2::Error DrmHwcTwo::HwcDisplay::SetColorTransform(const float *matrix, |
| 154 | int32_t hint) { |
| 155 | return unsupported(__func__, matrix, hint); |
| 156 | } |
| 157 | |
| 158 | HWC2::Error DrmHwcTwo::HwcDisplay::SetOutputBuffer(buffer_handle_t buffer, |
| 159 | int32_t release_fence) { |
| 160 | return unsupported(__func__, buffer, release_fence); |
| 161 | } |
| 162 | |
| 163 | HWC2::Error DrmHwcTwo::HwcDisplay::SetPowerMode(int32_t mode) { |
| 164 | return unsupported(__func__, mode); |
| 165 | } |
| 166 | |
| 167 | HWC2::Error DrmHwcTwo::HwcDisplay::SetVsyncEnabled(int32_t enabled) { |
| 168 | return unsupported(__func__, enabled); |
| 169 | } |
| 170 | |
| 171 | HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, |
| 172 | uint32_t *num_requests) { |
| 173 | return unsupported(__func__, num_types, num_requests); |
| 174 | } |
| 175 | |
| 176 | HWC2::Error DrmHwcTwo::HwcLayer::SetCursorPosition(int32_t x, int32_t y) { |
| 177 | return unsupported(__func__, x, y); |
| 178 | } |
| 179 | |
| 180 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerBlendMode(int32_t mode) { |
| 181 | return unsupported(__func__, mode); |
| 182 | } |
| 183 | |
| 184 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerBuffer(buffer_handle_t buffer, |
| 185 | int32_t acquire_fence) { |
| 186 | return unsupported(__func__, buffer, acquire_fence); |
| 187 | } |
| 188 | |
| 189 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerColor(hwc_color_t color) { |
| 190 | return unsupported(__func__, color); |
| 191 | } |
| 192 | |
| 193 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerCompositionType(int32_t type) { |
| 194 | return unsupported(__func__, type); |
| 195 | } |
| 196 | |
| 197 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerDataspace(int32_t dataspace) { |
| 198 | return unsupported(__func__, dataspace); |
| 199 | } |
| 200 | |
| 201 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerDisplayFrame(hwc_rect_t frame) { |
| 202 | return unsupported(__func__, frame); |
| 203 | } |
| 204 | |
| 205 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerPlaneAlpha(float alpha) { |
| 206 | return unsupported(__func__, alpha); |
| 207 | } |
| 208 | |
| 209 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerSidebandStream( |
| 210 | const native_handle_t *stream) { |
| 211 | return unsupported(__func__, stream); |
| 212 | } |
| 213 | |
| 214 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerSourceCrop(hwc_frect_t crop) { |
| 215 | return unsupported(__func__, crop); |
| 216 | } |
| 217 | |
| 218 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerSurfaceDamage(hwc_region_t damage) { |
| 219 | return unsupported(__func__, damage); |
| 220 | } |
| 221 | |
| 222 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerTransform(int32_t transform) { |
| 223 | return unsupported(__func__, transform); |
| 224 | } |
| 225 | |
| 226 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerVisibleRegion(hwc_region_t visible) { |
| 227 | return unsupported(__func__, visible); |
| 228 | } |
| 229 | |
| 230 | HWC2::Error DrmHwcTwo::HwcLayer::SetLayerZOrder(uint32_t z) { |
| 231 | return unsupported(__func__, z); |
| 232 | } |
| 233 | |
| 234 | // static |
| 235 | int DrmHwcTwo::HookDevClose(hw_device_t * /*dev*/) { |
| 236 | unsupported(__func__); |
| 237 | return 0; |
| 238 | } |
| 239 | |
| 240 | // static |
| 241 | void DrmHwcTwo::HookDevGetCapabilities(hwc2_device_t * /*dev*/, |
| 242 | uint32_t *out_count, |
| 243 | int32_t * /*out_capabilities*/) { |
| 244 | unsupported(__func__); |
| 245 | *out_count = 0; |
| 246 | } |
| 247 | |
| 248 | // static |
| 249 | hwc2_function_pointer_t DrmHwcTwo::HookDevGetFunction(struct hwc2_device *dev, |
| 250 | int32_t descriptor) { |
| 251 | DrmHwcTwo *hwc = toDrmHwcTwo(dev); |
| 252 | HWC2::FunctionDescriptor func = (HWC2::FunctionDescriptor)descriptor; |
| 253 | |
| 254 | switch (func) { |
| 255 | // Device functions |
| 256 | case HWC2::FunctionDescriptor::CreateVirtualDisplay: |
| 257 | return ToHook<HWC2_PFN_CREATE_VIRTUAL_DISPLAY>( |
| 258 | DeviceHook<int32_t, decltype(&DrmHwcTwo::CreateVirtualDisplay), |
| 259 | &DrmHwcTwo::CreateVirtualDisplay, uint32_t, uint32_t, |
| 260 | int32_t*, hwc2_display_t *>); |
| 261 | case HWC2::FunctionDescriptor::DestroyVirtualDisplay: |
| 262 | return ToHook<HWC2_PFN_DESTROY_VIRTUAL_DISPLAY>( |
| 263 | DeviceHook<int32_t, decltype(&DrmHwcTwo::DestroyVirtualDisplay), |
| 264 | &DrmHwcTwo::DestroyVirtualDisplay, hwc2_display_t>); |
| 265 | case HWC2::FunctionDescriptor::Dump: |
| 266 | return ToHook<HWC2_PFN_DUMP>( |
| 267 | DeviceHook<void, decltype(&DrmHwcTwo::Dump), &DrmHwcTwo::Dump, |
| 268 | uint32_t *, char *>); |
| 269 | case HWC2::FunctionDescriptor::GetMaxVirtualDisplayCount: |
| 270 | return ToHook<HWC2_PFN_GET_MAX_VIRTUAL_DISPLAY_COUNT>( |
| 271 | DeviceHook<uint32_t, decltype(&DrmHwcTwo::GetMaxVirtualDisplayCount), |
| 272 | &DrmHwcTwo::GetMaxVirtualDisplayCount>); |
| 273 | case HWC2::FunctionDescriptor::RegisterCallback: |
| 274 | return ToHook<HWC2_PFN_REGISTER_CALLBACK>( |
| 275 | DeviceHook<int32_t, decltype(&DrmHwcTwo::RegisterCallback), |
| 276 | &DrmHwcTwo::RegisterCallback, int32_t, |
| 277 | hwc2_callback_data_t, hwc2_function_pointer_t>); |
| 278 | |
| 279 | // Display functions |
| 280 | case HWC2::FunctionDescriptor::AcceptDisplayChanges: |
| 281 | return ToHook<HWC2_PFN_ACCEPT_DISPLAY_CHANGES>( |
| 282 | DisplayHook<decltype(&HwcDisplay::AcceptDisplayChanges), |
| 283 | &HwcDisplay::AcceptDisplayChanges>); |
| 284 | case HWC2::FunctionDescriptor::CreateLayer: |
| 285 | return ToHook<HWC2_PFN_CREATE_LAYER>( |
| 286 | DisplayHook<decltype(&HwcDisplay::CreateLayer), |
| 287 | &HwcDisplay::CreateLayer, hwc2_layer_t *>); |
| 288 | case HWC2::FunctionDescriptor::DestroyLayer: |
| 289 | return ToHook<HWC2_PFN_DESTROY_LAYER>( |
| 290 | DisplayHook<decltype(&HwcDisplay::DestroyLayer), |
| 291 | &HwcDisplay::DestroyLayer, hwc2_layer_t>); |
| 292 | case HWC2::FunctionDescriptor::GetActiveConfig: |
| 293 | return ToHook<HWC2_PFN_GET_ACTIVE_CONFIG>( |
| 294 | DisplayHook<decltype(&HwcDisplay::GetActiveConfig), |
| 295 | &HwcDisplay::GetActiveConfig, hwc2_config_t *>); |
| 296 | case HWC2::FunctionDescriptor::GetChangedCompositionTypes: |
| 297 | return ToHook<HWC2_PFN_GET_CHANGED_COMPOSITION_TYPES>( |
| 298 | DisplayHook<decltype(&HwcDisplay::GetChangedCompositionTypes), |
| 299 | &HwcDisplay::GetChangedCompositionTypes, uint32_t *, |
| 300 | hwc2_layer_t *, int32_t *>); |
| 301 | case HWC2::FunctionDescriptor::GetClientTargetSupport: |
| 302 | return ToHook<HWC2_PFN_GET_CLIENT_TARGET_SUPPORT>( |
| 303 | DisplayHook<decltype(&HwcDisplay::GetClientTargetSupport), |
| 304 | &HwcDisplay::GetClientTargetSupport, uint32_t, uint32_t, |
| 305 | int32_t, int32_t>); |
| 306 | case HWC2::FunctionDescriptor::GetColorModes: |
| 307 | return ToHook<HWC2_PFN_GET_COLOR_MODES>( |
| 308 | DisplayHook<decltype(&HwcDisplay::GetColorModes), |
| 309 | &HwcDisplay::GetColorModes, uint32_t *, int32_t *>); |
| 310 | case HWC2::FunctionDescriptor::GetDisplayAttribute: |
| 311 | return ToHook<HWC2_PFN_GET_DISPLAY_ATTRIBUTE>(DisplayHook< |
| 312 | decltype(&HwcDisplay::GetDisplayAttribute), |
| 313 | &HwcDisplay::GetDisplayAttribute, hwc2_config_t, int32_t, int32_t *>); |
| 314 | case HWC2::FunctionDescriptor::GetDisplayConfigs: |
| 315 | return ToHook<HWC2_PFN_GET_DISPLAY_CONFIGS>(DisplayHook< |
| 316 | decltype(&HwcDisplay::GetDisplayConfigs), |
| 317 | &HwcDisplay::GetDisplayConfigs, uint32_t *, hwc2_config_t *>); |
| 318 | case HWC2::FunctionDescriptor::GetDisplayName: |
| 319 | return ToHook<HWC2_PFN_GET_DISPLAY_NAME>( |
| 320 | DisplayHook<decltype(&HwcDisplay::GetDisplayName), |
| 321 | &HwcDisplay::GetDisplayName, uint32_t *, char *>); |
| 322 | case HWC2::FunctionDescriptor::GetDisplayRequests: |
| 323 | return ToHook<HWC2_PFN_GET_DISPLAY_REQUESTS>( |
| 324 | DisplayHook<decltype(&HwcDisplay::GetDisplayRequests), |
| 325 | &HwcDisplay::GetDisplayRequests, int32_t *, uint32_t *, |
| 326 | hwc2_layer_t *, int32_t *>); |
| 327 | case HWC2::FunctionDescriptor::GetDisplayType: |
| 328 | return ToHook<HWC2_PFN_GET_DISPLAY_TYPE>( |
| 329 | DisplayHook<decltype(&HwcDisplay::GetDisplayType), |
| 330 | &HwcDisplay::GetDisplayType, int32_t *>); |
| 331 | case HWC2::FunctionDescriptor::GetDozeSupport: |
| 332 | return ToHook<HWC2_PFN_GET_DOZE_SUPPORT>( |
| 333 | DisplayHook<decltype(&HwcDisplay::GetDozeSupport), |
| 334 | &HwcDisplay::GetDozeSupport, int32_t *>); |
| 335 | case HWC2::FunctionDescriptor::GetReleaseFences: |
| 336 | return ToHook<HWC2_PFN_GET_RELEASE_FENCES>( |
| 337 | DisplayHook<decltype(&HwcDisplay::GetReleaseFences), |
| 338 | &HwcDisplay::GetReleaseFences, uint32_t *, hwc2_layer_t *, |
| 339 | int32_t *>); |
| 340 | case HWC2::FunctionDescriptor::PresentDisplay: |
| 341 | return ToHook<HWC2_PFN_PRESENT_DISPLAY>( |
| 342 | DisplayHook<decltype(&HwcDisplay::PresentDisplay), |
| 343 | &HwcDisplay::PresentDisplay, int32_t *>); |
| 344 | case HWC2::FunctionDescriptor::SetActiveConfig: |
| 345 | return ToHook<HWC2_PFN_SET_ACTIVE_CONFIG>( |
| 346 | DisplayHook<decltype(&HwcDisplay::SetActiveConfig), |
| 347 | &HwcDisplay::SetActiveConfig, hwc2_config_t>); |
| 348 | case HWC2::FunctionDescriptor::SetClientTarget: |
| 349 | return ToHook<HWC2_PFN_SET_CLIENT_TARGET>(DisplayHook< |
| 350 | decltype(&HwcDisplay::SetClientTarget), &HwcDisplay::SetClientTarget, |
| 351 | buffer_handle_t, int32_t, int32_t, hwc_region_t>); |
| 352 | case HWC2::FunctionDescriptor::SetColorMode: |
| 353 | return ToHook<HWC2_PFN_SET_COLOR_MODE>( |
| 354 | DisplayHook<decltype(&HwcDisplay::SetColorMode), |
| 355 | &HwcDisplay::SetColorMode, int32_t>); |
| 356 | case HWC2::FunctionDescriptor::SetColorTransform: |
| 357 | return ToHook<HWC2_PFN_SET_COLOR_TRANSFORM>( |
| 358 | DisplayHook<decltype(&HwcDisplay::SetColorTransform), |
| 359 | &HwcDisplay::SetColorTransform, const float *, int32_t>); |
| 360 | case HWC2::FunctionDescriptor::SetOutputBuffer: |
| 361 | return ToHook<HWC2_PFN_SET_OUTPUT_BUFFER>( |
| 362 | DisplayHook<decltype(&HwcDisplay::SetOutputBuffer), |
| 363 | &HwcDisplay::SetOutputBuffer, buffer_handle_t, int32_t>); |
| 364 | case HWC2::FunctionDescriptor::SetPowerMode: |
| 365 | return ToHook<HWC2_PFN_SET_POWER_MODE>( |
| 366 | DisplayHook<decltype(&HwcDisplay::SetPowerMode), |
| 367 | &HwcDisplay::SetPowerMode, int32_t>); |
| 368 | case HWC2::FunctionDescriptor::SetVsyncEnabled: |
| 369 | return ToHook<HWC2_PFN_SET_VSYNC_ENABLED>( |
| 370 | DisplayHook<decltype(&HwcDisplay::SetVsyncEnabled), |
| 371 | &HwcDisplay::SetVsyncEnabled, int32_t>); |
| 372 | case HWC2::FunctionDescriptor::ValidateDisplay: |
| 373 | return ToHook<HWC2_PFN_VALIDATE_DISPLAY>( |
| 374 | DisplayHook<decltype(&HwcDisplay::ValidateDisplay), |
| 375 | &HwcDisplay::ValidateDisplay, uint32_t *, uint32_t *>); |
| 376 | |
| 377 | // Layer functions |
| 378 | case HWC2::FunctionDescriptor::SetCursorPosition: |
| 379 | return ToHook<HWC2_PFN_SET_CURSOR_POSITION>( |
| 380 | LayerHook<decltype(&HwcLayer::SetCursorPosition), |
| 381 | &HwcLayer::SetCursorPosition, int32_t, int32_t>); |
| 382 | case HWC2::FunctionDescriptor::SetLayerBlendMode: |
| 383 | return ToHook<HWC2_PFN_SET_LAYER_BLEND_MODE>( |
| 384 | LayerHook<decltype(&HwcLayer::SetLayerBlendMode), |
| 385 | &HwcLayer::SetLayerBlendMode, int32_t>); |
| 386 | case HWC2::FunctionDescriptor::SetLayerBuffer: |
| 387 | return ToHook<HWC2_PFN_SET_LAYER_BUFFER>( |
| 388 | LayerHook<decltype(&HwcLayer::SetLayerBuffer), |
| 389 | &HwcLayer::SetLayerBuffer, buffer_handle_t, int32_t>); |
| 390 | case HWC2::FunctionDescriptor::SetLayerColor: |
| 391 | return ToHook<HWC2_PFN_SET_LAYER_COLOR>( |
| 392 | LayerHook<decltype(&HwcLayer::SetLayerColor), |
| 393 | &HwcLayer::SetLayerColor, hwc_color_t>); |
| 394 | case HWC2::FunctionDescriptor::SetLayerCompositionType: |
| 395 | return ToHook<HWC2_PFN_SET_LAYER_COMPOSITION_TYPE>( |
| 396 | LayerHook<decltype(&HwcLayer::SetLayerCompositionType), |
| 397 | &HwcLayer::SetLayerCompositionType, int32_t>); |
| 398 | case HWC2::FunctionDescriptor::SetLayerDataspace: |
| 399 | return ToHook<HWC2_PFN_SET_LAYER_DATASPACE>( |
| 400 | LayerHook<decltype(&HwcLayer::SetLayerDataspace), |
| 401 | &HwcLayer::SetLayerDataspace, int32_t>); |
| 402 | case HWC2::FunctionDescriptor::SetLayerDisplayFrame: |
| 403 | return ToHook<HWC2_PFN_SET_LAYER_DISPLAY_FRAME>( |
| 404 | LayerHook<decltype(&HwcLayer::SetLayerDisplayFrame), |
| 405 | &HwcLayer::SetLayerDisplayFrame, hwc_rect_t>); |
| 406 | case HWC2::FunctionDescriptor::SetLayerPlaneAlpha: |
| 407 | return ToHook<HWC2_PFN_SET_LAYER_PLANE_ALPHA>( |
| 408 | LayerHook<decltype(&HwcLayer::SetLayerPlaneAlpha), |
| 409 | &HwcLayer::SetLayerPlaneAlpha, float>); |
| 410 | case HWC2::FunctionDescriptor::SetLayerSidebandStream: |
| 411 | return ToHook<HWC2_PFN_SET_LAYER_SIDEBAND_STREAM>(LayerHook< |
| 412 | decltype(&HwcLayer::SetLayerSidebandStream), |
| 413 | &HwcLayer::SetLayerSidebandStream, const native_handle_t *>); |
| 414 | case HWC2::FunctionDescriptor::SetLayerSourceCrop: |
| 415 | return ToHook<HWC2_PFN_SET_LAYER_SOURCE_CROP>( |
| 416 | LayerHook<decltype(&HwcLayer::SetLayerSourceCrop), |
| 417 | &HwcLayer::SetLayerSourceCrop, hwc_frect_t>); |
| 418 | case HWC2::FunctionDescriptor::SetLayerSurfaceDamage: |
| 419 | return ToHook<HWC2_PFN_SET_LAYER_SURFACE_DAMAGE>( |
| 420 | LayerHook<decltype(&HwcLayer::SetLayerSurfaceDamage), |
| 421 | &HwcLayer::SetLayerSurfaceDamage, hwc_region_t>); |
| 422 | case HWC2::FunctionDescriptor::SetLayerTransform: |
| 423 | return ToHook<HWC2_PFN_SET_LAYER_TRANSFORM>( |
| 424 | LayerHook<decltype(&HwcLayer::SetLayerTransform), |
| 425 | &HwcLayer::SetLayerTransform, int32_t>); |
| 426 | case HWC2::FunctionDescriptor::SetLayerVisibleRegion: |
| 427 | return ToHook<HWC2_PFN_SET_LAYER_VISIBLE_REGION>( |
| 428 | LayerHook<decltype(&HwcLayer::SetLayerVisibleRegion), |
| 429 | &HwcLayer::SetLayerVisibleRegion, hwc_region_t>); |
| 430 | case HWC2::FunctionDescriptor::SetLayerZOrder: |
| 431 | return ToHook<HWC2_PFN_SET_LAYER_Z_ORDER>( |
| 432 | LayerHook<decltype(&HwcLayer::SetLayerZOrder), |
| 433 | &HwcLayer::SetLayerZOrder, uint32_t>); |
| 434 | default: |
| 435 | return NULL; |
| 436 | } |
| 437 | } |
| 438 | } |