Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are |
| 6 | * met: |
| 7 | * * Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * * Redistributions in binary form must reproduce the above |
| 10 | * copyright notice, this list of conditions and the following |
| 11 | * disclaimer in the documentation and/or other materials provided |
| 12 | * with the distribution. |
| 13 | * * Neither the name of The Linux Foundation nor the names of its |
| 14 | * contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 21 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 27 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #ifndef __DRM_INTERFACE_H__ |
| 31 | #define __DRM_INTERFACE_H__ |
| 32 | |
| 33 | #include <map> |
| 34 | #include <string> |
| 35 | #include <utility> |
| 36 | #include <vector> |
| 37 | |
| 38 | #include "xf86drm.h" |
| 39 | #include "xf86drmMode.h" |
| 40 | |
| 41 | namespace sde_drm { |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 42 | |
| 43 | typedef std::map<std::pair<uint32_t, uint64_t>, float> CompRatioMap; |
| 44 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 45 | /* |
| 46 | * Drm Atomic Operation Codes |
| 47 | */ |
| 48 | enum struct DRMOps { |
| 49 | /* |
| 50 | * Op: Sets plane source crop |
| 51 | * Arg: uint32_t - Plane ID |
| 52 | * DRMRect - Source Rectangle |
| 53 | */ |
| 54 | PLANE_SET_SRC_RECT, |
| 55 | /* |
| 56 | * Op: Sets plane destination rect |
| 57 | * Arg: uint32_t - Plane ID |
| 58 | * DRMRect - Dst Rectangle |
| 59 | */ |
| 60 | PLANE_SET_DST_RECT, |
| 61 | /* |
| 62 | * Op: Sets plane zorder |
| 63 | * Arg: uint32_t - Plane ID |
| 64 | * uint32_t - zorder |
| 65 | */ |
| 66 | PLANE_SET_ZORDER, |
| 67 | /* |
| 68 | * Op: Sets plane rotation flags |
| 69 | * Arg: uint32_t - Plane ID |
| 70 | * uint32_t - bit mask of rotation flags (See drm_mode.h for enums) |
| 71 | */ |
| 72 | PLANE_SET_ROTATION, |
| 73 | /* |
| 74 | * Op: Sets plane alpha |
| 75 | * Arg: uint32_t - Plane ID |
| 76 | * uint32_t - alpha value |
| 77 | */ |
| 78 | PLANE_SET_ALPHA, |
| 79 | /* |
| 80 | * Op: Sets the blend type |
| 81 | * Arg: uint32_t - Plane ID |
| 82 | * uint32_t - blend type (see DRMBlendType) |
| 83 | */ |
| 84 | PLANE_SET_BLEND_TYPE, |
| 85 | /* |
| 86 | * Op: Sets horizontal decimation |
| 87 | * Arg: uint32_t - Plane ID |
| 88 | * uint32_t - decimation factor |
| 89 | */ |
| 90 | PLANE_SET_H_DECIMATION, |
| 91 | /* |
| 92 | * Op: Sets vertical decimation |
| 93 | * Arg: uint32_t - Plane ID |
| 94 | * uint32_t - decimation factor |
| 95 | */ |
| 96 | PLANE_SET_V_DECIMATION, |
| 97 | /* |
Prabhanjan Kandula | 585aa65 | 2017-01-26 18:39:11 -0800 | [diff] [blame] | 98 | * Op: Sets source config flags |
| 99 | * Arg: uint32_t - Plane ID |
| 100 | * uint32_t - flags to enable or disable a specific op. E.g. deinterlacing |
| 101 | */ |
| 102 | PLANE_SET_SRC_CONFIG, |
| 103 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 104 | * Op: Sets frame buffer ID for plane. Set together with CRTC. |
| 105 | * Arg: uint32_t - Plane ID |
| 106 | * uint32_t - Framebuffer ID |
| 107 | */ |
| 108 | PLANE_SET_FB_ID, |
| 109 | /* |
| 110 | * Op: Sets the crtc for this plane. Set together with FB_ID. |
| 111 | * Arg: uint32_t - Plane ID |
| 112 | * uint32_t - CRTC ID |
| 113 | */ |
| 114 | PLANE_SET_CRTC, |
| 115 | /* |
| 116 | * Op: Sets acquire fence for this plane's buffer. Set together with FB_ID, CRTC. |
| 117 | * Arg: uint32_t - Plane ID |
| 118 | * uint32_t - Input fence |
| 119 | */ |
| 120 | PLANE_SET_INPUT_FENCE, |
| 121 | /* |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 122 | * Op: Sets scaler config on this plane. |
| 123 | * Arg: uint32_t - Plane ID |
| 124 | * uint64_t - Address of the scaler config object (version based) |
| 125 | */ |
| 126 | PLANE_SET_SCALER_CONFIG, |
| 127 | /* |
Rohit Kulkarni | 8622e36 | 2017-01-30 18:14:10 -0800 | [diff] [blame] | 128 | * Op: Sets plane rotation destination rect |
| 129 | * Arg: uint32_t - Plane ID |
| 130 | * DRMRect - rotator dst Rectangle |
| 131 | */ |
| 132 | PLANE_SET_ROTATION_DST_RECT, |
| 133 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 134 | * Op: Activate or deactivate a CRTC |
| 135 | * Arg: uint32_t - CRTC ID |
| 136 | * uint32_t - 1 to enable, 0 to disable |
| 137 | */ |
| 138 | CRTC_SET_ACTIVE, |
| 139 | /* |
| 140 | * Op: Sets display mode |
| 141 | * Arg: uint32_t - CRTC ID |
| 142 | * drmModeModeInfo* - Pointer to display mode |
| 143 | */ |
| 144 | CRTC_SET_MODE, |
| 145 | /* |
| 146 | * Op: Sets an offset indicating when a release fence should be signalled. |
| 147 | * Arg: uint32_t - offset |
| 148 | * 0: non-speculative, default |
| 149 | * 1: speculative |
| 150 | */ |
| 151 | CRTC_SET_OUTPUT_FENCE_OFFSET, |
| 152 | /* |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 153 | * Op: Sets overall SDE core clock |
| 154 | * Arg: uint32_t - CRTC ID |
| 155 | * uint32_t - core_clk |
| 156 | */ |
| 157 | CRTC_SET_CORE_CLK, |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame^] | 158 | /* |
| 159 | * Op: Sets MNOC bus average bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 160 | * Arg: uint32_t - CRTC ID |
| 161 | * uint32_t - core_ab |
| 162 | */ |
| 163 | CRTC_SET_CORE_AB, |
| 164 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame^] | 165 | * Op: Sets MNOC bus instantaneous bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 166 | * Arg: uint32_t - CRTC ID |
| 167 | * uint32_t - core_ib |
| 168 | */ |
| 169 | CRTC_SET_CORE_IB, |
| 170 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame^] | 171 | * Op: Sets LLCC Bus average bandwidth |
| 172 | * Arg: uint32_t - CRTC ID |
| 173 | * uint32_t - llcc_ab |
| 174 | */ |
| 175 | CRTC_SET_LLCC_AB, |
| 176 | /* |
| 177 | * Op: Sets LLCC Bus instantaneous bandwidth |
| 178 | * Arg: uint32_t - CRTC ID |
| 179 | * uint32_t - llcc_ib |
| 180 | */ |
| 181 | CRTC_SET_LLCC_IB, |
| 182 | /* |
| 183 | * Op: Sets DRAM bus average bandwidth |
| 184 | * Arg: uint32_t - CRTC ID |
| 185 | * uint32_t - dram_ab |
| 186 | */ |
| 187 | CRTC_SET_DRAM_AB, |
| 188 | /* |
| 189 | * Op: Sets DRAM bus instantaneous bandwidth |
| 190 | * Arg: uint32_t - CRTC ID |
| 191 | * uint32_t - dram_ib |
| 192 | */ |
| 193 | CRTC_SET_DRAM_IB, |
| 194 | /* |
| 195 | * Op: Sets rotator clock for inline rotation |
| 196 | * Arg: uint32_t - CRTC ID |
| 197 | * uint32_t - rot_clk |
| 198 | */ |
| 199 | CRTC_SET_ROT_CLK, /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 200 | * Op: Returns release fence for this frame. Should be called after Commit() on |
| 201 | * DRMAtomicReqInterface. |
| 202 | * Arg: uint32_t - CRTC ID |
| 203 | * int * - Pointer to an integer that will hold the returned fence |
| 204 | */ |
| 205 | CRTC_GET_RELEASE_FENCE, |
| 206 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 207 | * Op: Sets PP feature |
| 208 | * Arg: uint32_t - CRTC ID |
| 209 | * DRMPPFeatureInfo * - PP feature data pointer |
| 210 | */ |
| 211 | CRTC_SET_POST_PROC, |
| 212 | /* |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 213 | * Op: Sets CRTC ROIs. |
| 214 | * Arg: uint32_t - CRTC ID |
| 215 | * uint32_t - number of ROIs |
| 216 | * DRMRect * - Array of CRTC ROIs |
| 217 | */ |
| 218 | CRTC_SET_ROI, |
| 219 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 220 | * Op: Returns retire fence for this commit. Should be called after Commit() on |
| 221 | * DRMAtomicReqInterface. |
| 222 | * Arg: uint32_t - Connector ID |
| 223 | * int * - Pointer to an integer that will hold the returned fence |
| 224 | */ |
| 225 | CONNECTOR_GET_RETIRE_FENCE, |
| 226 | /* |
| 227 | * Op: Sets writeback connector destination rect |
| 228 | * Arg: uint32_t - Connector ID |
| 229 | * DRMRect - Dst Rectangle |
| 230 | */ |
| 231 | CONNECTOR_SET_OUTPUT_RECT, |
| 232 | /* |
| 233 | * Op: Sets frame buffer ID for writeback connector. |
| 234 | * Arg: uint32_t - Connector ID |
| 235 | * uint32_t - Framebuffer ID |
| 236 | */ |
| 237 | CONNECTOR_SET_OUTPUT_FB_ID, |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 238 | /* |
| 239 | * Op: Sets power mode for connector. |
| 240 | * Arg: uint32_t - Connector ID |
| 241 | * uint32_t - Power Mode |
| 242 | */ |
| 243 | CONNECTOR_SET_POWER_MODE, |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 244 | /* |
| 245 | * Op: Sets panel ROIs. |
| 246 | * Arg: uint32_t - Connector ID |
| 247 | * uint32_t - number of ROIs |
| 248 | * DRMRect * - Array of Connector ROIs |
| 249 | */ |
| 250 | CONNECTOR_SET_ROI, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 251 | }; |
| 252 | |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 253 | enum struct DRMRotation { |
| 254 | FLIP_H = 0x1, |
| 255 | FLIP_V = 0x2, |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 256 | ROT_180 = FLIP_H | FLIP_V, |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 257 | ROT_90 = 0x4, |
| 258 | }; |
| 259 | |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 260 | enum struct DRMPowerMode { |
| 261 | ON, |
| 262 | DOZE, |
| 263 | DOZE_SUSPEND, |
| 264 | OFF, |
| 265 | }; |
| 266 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 267 | enum struct DRMBlendType { |
| 268 | UNDEFINED = 0, |
| 269 | OPAQUE = 1, |
| 270 | PREMULTIPLIED = 2, |
| 271 | COVERAGE = 3, |
| 272 | }; |
| 273 | |
Prabhanjan Kandula | 585aa65 | 2017-01-26 18:39:11 -0800 | [diff] [blame] | 274 | enum struct DRMSrcConfig { |
| 275 | DEINTERLACE = 0, |
| 276 | }; |
| 277 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 278 | /* Display type to identify a suitable connector */ |
| 279 | enum struct DRMDisplayType { |
| 280 | PERIPHERAL, |
| 281 | TV, |
| 282 | VIRTUAL, |
| 283 | }; |
| 284 | |
| 285 | struct DRMRect { |
| 286 | uint32_t left; // Left-most pixel coordinate. |
| 287 | uint32_t top; // Top-most pixel coordinate. |
| 288 | uint32_t right; // Right-most pixel coordinate. |
| 289 | uint32_t bottom; // Bottom-most pixel coordinate. |
| 290 | }; |
| 291 | |
| 292 | //------------------------------------------------------------------------ |
| 293 | // DRM Info Query Types |
| 294 | //------------------------------------------------------------------------ |
| 295 | |
| 296 | enum struct QSEEDVersion { |
| 297 | V1, |
| 298 | V2, |
| 299 | V3, |
| 300 | }; |
| 301 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 302 | enum struct SmartDMARevision { |
| 303 | V1, |
| 304 | V2, |
| 305 | }; |
| 306 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 307 | /* Per CRTC Resource Info*/ |
| 308 | struct DRMCrtcInfo { |
| 309 | bool has_src_split; |
| 310 | uint32_t max_blend_stages; |
| 311 | QSEEDVersion qseed_version; |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 312 | SmartDMARevision smart_dma_rev; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 313 | float ib_fudge_factor; |
| 314 | float clk_fudge_factor; |
| 315 | uint32_t dest_scale_prefill_lines; |
| 316 | uint32_t undersized_prefill_lines; |
| 317 | uint32_t macrotile_prefill_lines; |
| 318 | uint32_t nv12_prefill_lines; |
| 319 | uint32_t linear_prefill_lines; |
| 320 | uint32_t downscale_prefill_lines; |
| 321 | uint32_t extra_prefill_lines; |
| 322 | uint32_t amortized_threshold; |
| 323 | uint64_t max_bandwidth_low; |
| 324 | uint64_t max_bandwidth_high; |
| 325 | uint32_t max_sde_clk; |
| 326 | CompRatioMap comp_ratio_rt_map; |
| 327 | CompRatioMap comp_ratio_nrt_map; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 328 | }; |
| 329 | |
| 330 | enum struct DRMPlaneType { |
| 331 | // Has CSC and scaling capability |
| 332 | VIG = 0, |
| 333 | // Has scaling capability but no CSC |
| 334 | RGB, |
| 335 | // No scaling support |
| 336 | DMA, |
| 337 | // Supports a small dimension and doesn't use a CRTC stage |
| 338 | CURSOR, |
| 339 | MAX, |
| 340 | }; |
| 341 | |
| 342 | struct DRMPlaneTypeInfo { |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 343 | DRMPlaneType type; |
| 344 | uint32_t master_plane_id; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 345 | // FourCC format enum and modifier |
| 346 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 347 | uint32_t max_linewidth; |
| 348 | uint32_t max_upscale; |
| 349 | uint32_t max_downscale; |
| 350 | uint32_t max_horizontal_deci; |
| 351 | uint32_t max_vertical_deci; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 352 | uint64_t max_pipe_bandwidth; |
Rohit Kulkarni | 8622e36 | 2017-01-30 18:14:10 -0800 | [diff] [blame] | 353 | uint32_t cache_size; // cache size in bytes for inline rotation support. |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 354 | }; |
| 355 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 356 | // All DRM Planes as map<Plane_id , plane_type_info> listed from highest to lowest priority |
| 357 | typedef std::vector<std::pair<uint32_t, DRMPlaneTypeInfo>> DRMPlanesInfo; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 358 | |
| 359 | enum struct DRMTopology { |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 360 | UNKNOWN, // To be compat with driver defs in sde_rm.h |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 361 | SINGLE_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 362 | SINGLE_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 363 | DUAL_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 364 | DUAL_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 365 | DUAL_LM_MERGE, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 366 | DUAL_LM_MERGE_DSC, |
| 367 | DUAL_LM_DSCMERGE, |
| 368 | PPSPLIT, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 369 | }; |
| 370 | |
| 371 | enum struct DRMPanelMode { |
| 372 | VIDEO, |
| 373 | COMMAND, |
| 374 | }; |
| 375 | |
| 376 | /* Per Connector Info*/ |
| 377 | struct DRMConnectorInfo { |
| 378 | uint32_t mmWidth; |
| 379 | uint32_t mmHeight; |
| 380 | uint32_t type; |
| 381 | uint32_t num_modes; |
| 382 | drmModeModeInfo *modes; |
| 383 | DRMTopology topology; |
| 384 | std::string panel_name; |
| 385 | DRMPanelMode panel_mode; |
| 386 | bool is_primary; |
| 387 | // Valid only if DRMPanelMode is VIDEO |
| 388 | bool dynamic_fps; |
| 389 | // FourCC format enum and modifier |
| 390 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 391 | // Valid only if type is DRM_MODE_CONNECTOR_VIRTUAL |
| 392 | uint32_t max_linewidth; |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 393 | // Valid only if mode is command |
| 394 | int num_roi; |
| 395 | int xstart; |
| 396 | int ystart; |
| 397 | int walign; |
| 398 | int halign; |
| 399 | int wmin; |
| 400 | int hmin; |
| 401 | bool roi_merge; |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 402 | DRMRotation panel_orientation; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 403 | }; |
| 404 | |
| 405 | /* Identifier token for a display */ |
| 406 | struct DRMDisplayToken { |
| 407 | uint32_t conn_id; |
| 408 | uint32_t crtc_id; |
| 409 | }; |
| 410 | |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 411 | enum DRMPPFeatureID { |
| 412 | kFeaturePcc, |
| 413 | kFeatureIgc, |
| 414 | kFeaturePgc, |
| 415 | kFeatureMixerGc, |
| 416 | kFeaturePaV2, |
| 417 | kFeatureDither, |
| 418 | kFeatureGamut, |
| 419 | kFeaturePADither, |
| 420 | kPPFeaturesMax, |
| 421 | }; |
| 422 | |
| 423 | enum DRMPPPropType { |
| 424 | kPropEnum, |
| 425 | kPropRange, |
| 426 | kPropBlob, |
| 427 | kPropTypeMax, |
| 428 | }; |
| 429 | |
| 430 | struct DRMPPFeatureInfo { |
| 431 | DRMPPFeatureID id; |
| 432 | DRMPPPropType type; |
| 433 | uint32_t version; |
| 434 | uint32_t payload_size; |
| 435 | void *payload; |
| 436 | }; |
| 437 | |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 438 | struct DRMScalerLUTInfo { |
| 439 | uint32_t dir_lut_size = 0; |
| 440 | uint32_t cir_lut_size = 0; |
| 441 | uint32_t sep_lut_size = 0; |
| 442 | uint64_t dir_lut = 0; |
| 443 | uint64_t cir_lut = 0; |
| 444 | uint64_t sep_lut = 0; |
| 445 | }; |
| 446 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 447 | /* DRM Atomic Request Property Set. |
| 448 | * |
| 449 | * Helper class to create and populate atomic properties of DRM components |
| 450 | * when rendered in DRM atomic mode */ |
| 451 | class DRMAtomicReqInterface { |
| 452 | public: |
| 453 | virtual ~DRMAtomicReqInterface() {} |
| 454 | /* Perform request operation. |
| 455 | * |
| 456 | * [input]: opcode: operation code from DRMOps list. |
| 457 | * var_arg: arguments for DRMOps's can differ in number and |
| 458 | * data type. Refer above DRMOps to details. |
| 459 | * [return]: Error code if the API fails, 0 on success. |
| 460 | */ |
| 461 | virtual int Perform(DRMOps opcode, ...) = 0; |
| 462 | |
| 463 | /* |
| 464 | * Commit the params set via Perform(). Also resets the properties after commit. Needs to be |
| 465 | * called every frame. |
| 466 | * [input]: synchronous: Determines if the call should block until a h/w flip |
| 467 | * [return]: Error code if the API fails, 0 on success. |
| 468 | */ |
| 469 | virtual int Commit(bool synchronous) = 0; |
| 470 | /* |
| 471 | * Validate the params set via Perform(). |
| 472 | * [return]: Error code if the API fails, 0 on success. |
| 473 | */ |
| 474 | virtual int Validate() = 0; |
| 475 | }; |
| 476 | |
| 477 | class DRMManagerInterface; |
| 478 | |
| 479 | /* Populates a singleton instance of DRMManager */ |
| 480 | typedef int (*GetDRMManager)(int fd, DRMManagerInterface **intf); |
| 481 | |
| 482 | /* Destroy DRMManager instance */ |
Saurabh Shah | ab7807c | 2017-02-08 15:41:08 -0800 | [diff] [blame] | 483 | typedef int (*DestroyDRMManager)(); |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 484 | |
| 485 | /* |
| 486 | * DRM Manager Interface - Any class which plans to implement helper function for vendor |
| 487 | * specific DRM driver implementation must implement the below interface routines to work |
| 488 | * with SDM. |
| 489 | */ |
| 490 | |
| 491 | class DRMManagerInterface { |
| 492 | public: |
| 493 | virtual ~DRMManagerInterface() {} |
| 494 | |
| 495 | /* |
| 496 | * Since SDM completely manages the planes. GetPlanesInfo will provide all |
| 497 | * the plane information. |
| 498 | * [output]: DRMPlanesInfo: Resource Info for planes. |
| 499 | */ |
| 500 | virtual void GetPlanesInfo(DRMPlanesInfo *info) = 0; |
| 501 | |
| 502 | /* |
| 503 | * Will provide all the information of a selected crtc. |
| 504 | * [input]: Use crtc id 0 to obtain system wide info |
| 505 | * [output]: DRMCrtcInfo: Resource Info for the given CRTC id. |
| 506 | */ |
| 507 | virtual void GetCrtcInfo(uint32_t crtc_id, DRMCrtcInfo *info) = 0; |
| 508 | |
| 509 | /* |
| 510 | * Will provide all the information of a selected connector. |
| 511 | * [output]: DRMConnectorInfo: Resource Info for the given connector id |
| 512 | */ |
| 513 | virtual void GetConnectorInfo(uint32_t conn_id, DRMConnectorInfo *info) = 0; |
| 514 | |
| 515 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 516 | * Will query post propcessing feature info of a CRTC. |
| 517 | * [output]: DRMPPFeatureInfo: CRTC post processing feature info |
| 518 | */ |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 519 | virtual void GetCrtcPPInfo(uint32_t crtc_id, DRMPPFeatureInfo &info) = 0; |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 520 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 521 | * Register a logical display to receive a token. |
| 522 | * Each display pipeline in DRM is identified by its CRTC and Connector(s). |
| 523 | * On display connect(bootup or hotplug), clients should invoke this interface to |
| 524 | * establish the pipeline for the display and should get a DisplayToken |
| 525 | * populated with crtc and connnector(s) id's. Here onwards, Client should |
| 526 | * use this token to represent the display for any Perform operations if |
| 527 | * needed. |
| 528 | * |
| 529 | * [input]: disp_type - Peripheral / TV / Virtual |
| 530 | * [output]: DRMDisplayToken - CRTC and Connector id's for the display |
| 531 | * [return]: 0 on success, a negative error value otherwise |
| 532 | */ |
| 533 | virtual int RegisterDisplay(DRMDisplayType disp_type, DRMDisplayToken *tok) = 0; |
| 534 | |
| 535 | /* Client should invoke this interface on display disconnect. |
| 536 | * [input]: DRMDisplayToken - identifier for the display. |
| 537 | */ |
| 538 | virtual void UnregisterDisplay(const DRMDisplayToken &token) = 0; |
| 539 | |
| 540 | /* |
| 541 | * Creates and returns an instance of DRMAtomicReqInterface corresponding to a display token |
| 542 | * returned as part of RegisterDisplay API. Needs to be called per display. |
| 543 | * [input]: DRMDisplayToken that identifies a display pipeline |
| 544 | * [output]: Pointer to an instance of DRMAtomicReqInterface. |
| 545 | * [return]: Error code if the API fails, 0 on success. |
| 546 | */ |
| 547 | virtual int CreateAtomicReq(const DRMDisplayToken &token, DRMAtomicReqInterface **intf) = 0; |
| 548 | |
| 549 | /* |
| 550 | * Destroys the instance of DRMAtomicReqInterface |
| 551 | * [input]: Pointer to a DRMAtomicReqInterface |
| 552 | * [return]: Error code if the API fails, 0 on success. |
| 553 | */ |
| 554 | virtual int DestroyAtomicReq(DRMAtomicReqInterface *intf) = 0; |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 555 | /* |
| 556 | * Sets the global scaler LUT |
| 557 | * [input]: LUT Info |
| 558 | * [return]: Error code if the API fails, 0 on success. |
| 559 | */ |
| 560 | virtual int SetScalerLUT(const DRMScalerLUTInfo &lut_info) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 561 | }; |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 562 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 563 | } // namespace sde_drm |
| 564 | #endif // __DRM_INTERFACE_H__ |