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" |
Sushil Chauhan | 80e5843 | 2017-07-06 11:39:17 -0700 | [diff] [blame] | 40 | #include <drm/msm_drm.h> |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 41 | |
| 42 | namespace sde_drm { |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 43 | |
| 44 | typedef std::map<std::pair<uint32_t, uint64_t>, float> CompRatioMap; |
| 45 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 46 | /* |
| 47 | * Drm Atomic Operation Codes |
| 48 | */ |
| 49 | enum struct DRMOps { |
| 50 | /* |
| 51 | * Op: Sets plane source crop |
| 52 | * Arg: uint32_t - Plane ID |
| 53 | * DRMRect - Source Rectangle |
| 54 | */ |
| 55 | PLANE_SET_SRC_RECT, |
| 56 | /* |
| 57 | * Op: Sets plane destination rect |
| 58 | * Arg: uint32_t - Plane ID |
| 59 | * DRMRect - Dst Rectangle |
| 60 | */ |
| 61 | PLANE_SET_DST_RECT, |
| 62 | /* |
| 63 | * Op: Sets plane zorder |
| 64 | * Arg: uint32_t - Plane ID |
| 65 | * uint32_t - zorder |
| 66 | */ |
| 67 | PLANE_SET_ZORDER, |
| 68 | /* |
| 69 | * Op: Sets plane rotation flags |
| 70 | * Arg: uint32_t - Plane ID |
| 71 | * uint32_t - bit mask of rotation flags (See drm_mode.h for enums) |
| 72 | */ |
| 73 | PLANE_SET_ROTATION, |
| 74 | /* |
| 75 | * Op: Sets plane alpha |
| 76 | * Arg: uint32_t - Plane ID |
| 77 | * uint32_t - alpha value |
| 78 | */ |
| 79 | PLANE_SET_ALPHA, |
| 80 | /* |
| 81 | * Op: Sets the blend type |
| 82 | * Arg: uint32_t - Plane ID |
| 83 | * uint32_t - blend type (see DRMBlendType) |
| 84 | */ |
| 85 | PLANE_SET_BLEND_TYPE, |
| 86 | /* |
| 87 | * Op: Sets horizontal decimation |
| 88 | * Arg: uint32_t - Plane ID |
| 89 | * uint32_t - decimation factor |
| 90 | */ |
| 91 | PLANE_SET_H_DECIMATION, |
| 92 | /* |
| 93 | * Op: Sets vertical decimation |
| 94 | * Arg: uint32_t - Plane ID |
| 95 | * uint32_t - decimation factor |
| 96 | */ |
| 97 | PLANE_SET_V_DECIMATION, |
| 98 | /* |
Prabhanjan Kandula | 585aa65 | 2017-01-26 18:39:11 -0800 | [diff] [blame] | 99 | * Op: Sets source config flags |
| 100 | * Arg: uint32_t - Plane ID |
| 101 | * uint32_t - flags to enable or disable a specific op. E.g. deinterlacing |
| 102 | */ |
| 103 | PLANE_SET_SRC_CONFIG, |
| 104 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 105 | * Op: Sets frame buffer ID for plane. Set together with CRTC. |
| 106 | * Arg: uint32_t - Plane ID |
| 107 | * uint32_t - Framebuffer ID |
| 108 | */ |
| 109 | PLANE_SET_FB_ID, |
| 110 | /* |
| 111 | * Op: Sets the crtc for this plane. Set together with FB_ID. |
| 112 | * Arg: uint32_t - Plane ID |
| 113 | * uint32_t - CRTC ID |
| 114 | */ |
| 115 | PLANE_SET_CRTC, |
| 116 | /* |
| 117 | * Op: Sets acquire fence for this plane's buffer. Set together with FB_ID, CRTC. |
| 118 | * Arg: uint32_t - Plane ID |
| 119 | * uint32_t - Input fence |
| 120 | */ |
| 121 | PLANE_SET_INPUT_FENCE, |
| 122 | /* |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 123 | * Op: Sets scaler config on this plane. |
| 124 | * Arg: uint32_t - Plane ID |
| 125 | * uint64_t - Address of the scaler config object (version based) |
| 126 | */ |
| 127 | PLANE_SET_SCALER_CONFIG, |
| 128 | /* |
Rohit Kulkarni | 8622e36 | 2017-01-30 18:14:10 -0800 | [diff] [blame] | 129 | * Op: Sets plane rotation destination rect |
| 130 | * Arg: uint32_t - Plane ID |
| 131 | * DRMRect - rotator dst Rectangle |
| 132 | */ |
| 133 | PLANE_SET_ROTATION_DST_RECT, |
| 134 | /* |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 135 | * Op: Sets FB Secure mode for this plane. |
| 136 | * Arg: uint32_t - Plane ID |
| 137 | * uint32_t - Value of the FB Secure mode. |
| 138 | */ |
| 139 | PLANE_SET_FB_SECURE_MODE, |
| 140 | /* |
Ping Li | 8d6dd62 | 2017-07-03 12:05:15 -0700 | [diff] [blame] | 141 | * Op: Sets csc config on this plane. |
| 142 | * Arg: uint32_t - Plane ID |
| 143 | * uint32_t* - pointer to csc type |
| 144 | */ |
| 145 | PLANE_SET_CSC_CONFIG, |
| 146 | /* |
Ramkumar Radhakrishnan | 0725430 | 2017-11-13 16:18:22 -0800 | [diff] [blame^] | 147 | * Op: Sets multirect mode on this plane. |
| 148 | * Arg: uint32_t - Plane ID |
| 149 | * uint32_t - multirect mode |
| 150 | */ |
| 151 | PLANE_SET_MULTIRECT_MODE, |
| 152 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 153 | * Op: Activate or deactivate a CRTC |
| 154 | * Arg: uint32_t - CRTC ID |
| 155 | * uint32_t - 1 to enable, 0 to disable |
| 156 | */ |
| 157 | CRTC_SET_ACTIVE, |
| 158 | /* |
| 159 | * Op: Sets display mode |
| 160 | * Arg: uint32_t - CRTC ID |
| 161 | * drmModeModeInfo* - Pointer to display mode |
| 162 | */ |
| 163 | CRTC_SET_MODE, |
| 164 | /* |
| 165 | * Op: Sets an offset indicating when a release fence should be signalled. |
| 166 | * Arg: uint32_t - offset |
| 167 | * 0: non-speculative, default |
| 168 | * 1: speculative |
| 169 | */ |
| 170 | CRTC_SET_OUTPUT_FENCE_OFFSET, |
| 171 | /* |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 172 | * Op: Sets overall SDE core clock |
| 173 | * Arg: uint32_t - CRTC ID |
| 174 | * uint32_t - core_clk |
| 175 | */ |
| 176 | CRTC_SET_CORE_CLK, |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 177 | /* |
| 178 | * Op: Sets MNOC bus average bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 179 | * Arg: uint32_t - CRTC ID |
| 180 | * uint32_t - core_ab |
| 181 | */ |
| 182 | CRTC_SET_CORE_AB, |
| 183 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 184 | * Op: Sets MNOC bus instantaneous bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 185 | * Arg: uint32_t - CRTC ID |
| 186 | * uint32_t - core_ib |
| 187 | */ |
| 188 | CRTC_SET_CORE_IB, |
| 189 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 190 | * Op: Sets LLCC Bus average bandwidth |
| 191 | * Arg: uint32_t - CRTC ID |
| 192 | * uint32_t - llcc_ab |
| 193 | */ |
| 194 | CRTC_SET_LLCC_AB, |
| 195 | /* |
| 196 | * Op: Sets LLCC Bus instantaneous bandwidth |
| 197 | * Arg: uint32_t - CRTC ID |
| 198 | * uint32_t - llcc_ib |
| 199 | */ |
| 200 | CRTC_SET_LLCC_IB, |
| 201 | /* |
| 202 | * Op: Sets DRAM bus average bandwidth |
| 203 | * Arg: uint32_t - CRTC ID |
| 204 | * uint32_t - dram_ab |
| 205 | */ |
| 206 | CRTC_SET_DRAM_AB, |
| 207 | /* |
| 208 | * Op: Sets DRAM bus instantaneous bandwidth |
| 209 | * Arg: uint32_t - CRTC ID |
| 210 | * uint32_t - dram_ib |
| 211 | */ |
| 212 | CRTC_SET_DRAM_IB, |
| 213 | /* |
| 214 | * Op: Sets rotator clock for inline rotation |
| 215 | * Arg: uint32_t - CRTC ID |
| 216 | * uint32_t - rot_clk |
| 217 | */ |
Namit Solanki | 24921ab | 2017-05-23 20:16:25 +0530 | [diff] [blame] | 218 | CRTC_SET_ROT_CLK, |
| 219 | /* |
| 220 | * Op: Sets destination scalar data |
| 221 | * Arg: uint32_t - CRTC ID |
| 222 | * uint64_t - Pointer to destination scalar data |
| 223 | */ |
| 224 | CRTC_SET_DEST_SCALER_CONFIG, |
| 225 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 226 | * Op: Returns release fence for this frame. Should be called after Commit() on |
| 227 | * DRMAtomicReqInterface. |
| 228 | * Arg: uint32_t - CRTC ID |
| 229 | * int * - Pointer to an integer that will hold the returned fence |
| 230 | */ |
| 231 | CRTC_GET_RELEASE_FENCE, |
| 232 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 233 | * Op: Sets PP feature |
| 234 | * Arg: uint32_t - CRTC ID |
| 235 | * DRMPPFeatureInfo * - PP feature data pointer |
| 236 | */ |
| 237 | CRTC_SET_POST_PROC, |
| 238 | /* |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 239 | * Op: Sets CRTC ROIs. |
| 240 | * Arg: uint32_t - CRTC ID |
| 241 | * uint32_t - number of ROIs |
| 242 | * DRMRect * - Array of CRTC ROIs |
| 243 | */ |
| 244 | CRTC_SET_ROI, |
| 245 | /* |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 246 | * Op: Sets Security level for CRTC. |
| 247 | * Arg: uint32_t - CRTC ID |
| 248 | * uint32_t - Security level |
| 249 | */ |
| 250 | CRTC_SET_SECURITY_LEVEL, |
| 251 | /* |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 252 | * Op: sets solid fill stages |
| 253 | * Arg: uint32_t - CRTC ID |
| 254 | * Vector of DRMSolidfillStage |
| 255 | */ |
| 256 | CRTC_SET_SOLIDFILL_STAGES, |
| 257 | /* |
Anjaneya Prasad Musunuri | e8c67f2 | 2017-07-01 16:16:13 +0530 | [diff] [blame] | 258 | * Op: Sets idle timeout. |
| 259 | * Arg: uint32_t - CRTC ID |
| 260 | * uint32_t - idle timeout in ms |
| 261 | */ |
| 262 | CRTC_SET_IDLE_TIMEOUT, |
| 263 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 264 | * Op: Returns retire fence for this commit. Should be called after Commit() on |
| 265 | * DRMAtomicReqInterface. |
| 266 | * Arg: uint32_t - Connector ID |
| 267 | * int * - Pointer to an integer that will hold the returned fence |
| 268 | */ |
| 269 | CONNECTOR_GET_RETIRE_FENCE, |
| 270 | /* |
| 271 | * Op: Sets writeback connector destination rect |
| 272 | * Arg: uint32_t - Connector ID |
| 273 | * DRMRect - Dst Rectangle |
| 274 | */ |
| 275 | CONNECTOR_SET_OUTPUT_RECT, |
| 276 | /* |
| 277 | * Op: Sets frame buffer ID for writeback connector. |
| 278 | * Arg: uint32_t - Connector ID |
| 279 | * uint32_t - Framebuffer ID |
| 280 | */ |
| 281 | CONNECTOR_SET_OUTPUT_FB_ID, |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 282 | /* |
| 283 | * Op: Sets power mode for connector. |
| 284 | * Arg: uint32_t - Connector ID |
| 285 | * uint32_t - Power Mode |
| 286 | */ |
| 287 | CONNECTOR_SET_POWER_MODE, |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 288 | /* |
| 289 | * Op: Sets panel ROIs. |
| 290 | * Arg: uint32_t - Connector ID |
| 291 | * uint32_t - number of ROIs |
| 292 | * DRMRect * - Array of Connector ROIs |
| 293 | */ |
| 294 | CONNECTOR_SET_ROI, |
Sushil Chauhan | e2f89c9 | 2017-08-23 11:30:34 -0700 | [diff] [blame] | 295 | /* |
Saurabh Shah | f363595 | 2017-10-16 17:08:18 -0700 | [diff] [blame] | 296 | * Op: Sets the connector to autorefresh mode. |
| 297 | * Arg: uint32_t - Connector ID |
| 298 | * uint32_t - Enable-1, Disable-0 |
| 299 | */ |
| 300 | CONNECTOR_SET_AUTOREFRESH, |
| 301 | /* |
Sushil Chauhan | e2f89c9 | 2017-08-23 11:30:34 -0700 | [diff] [blame] | 302 | * Op: Set FB secure mode for Writeback connector. |
| 303 | * Arg: uint32_t - Connector ID |
| 304 | * uint32_t - FB Secure mode |
| 305 | */ |
| 306 | CONNECTOR_SET_FB_SECURE_MODE, |
Saurabh Shah | 82b06f4 | 2017-09-06 16:43:49 -0700 | [diff] [blame] | 307 | /* |
| 308 | * Op: Sets a crtc id to this connector |
| 309 | * Arg: uint32_t - Connector ID |
| 310 | * uint32_t - CRTC ID |
| 311 | */ |
| 312 | CONNECTOR_SET_CRTC, |
Srikanth Rajagopalan | 7a09b2e | 2017-06-19 18:41:03 -0700 | [diff] [blame] | 313 | /* |
| 314 | * Op: Sets connector hdr metadata |
| 315 | * Arg: uint32_t - Connector ID |
| 316 | * drm_msm_ext_hdr_metadata - hdr_metadata |
| 317 | */ |
| 318 | CONNECTOR_SET_HDR_METADATA, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 319 | }; |
| 320 | |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 321 | enum struct DRMRotation { |
| 322 | FLIP_H = 0x1, |
| 323 | FLIP_V = 0x2, |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 324 | ROT_180 = FLIP_H | FLIP_V, |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 325 | ROT_90 = 0x4, |
| 326 | }; |
| 327 | |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 328 | enum struct DRMPowerMode { |
| 329 | ON, |
| 330 | DOZE, |
| 331 | DOZE_SUSPEND, |
| 332 | OFF, |
| 333 | }; |
| 334 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 335 | enum struct DRMBlendType { |
| 336 | UNDEFINED = 0, |
| 337 | OPAQUE = 1, |
| 338 | PREMULTIPLIED = 2, |
| 339 | COVERAGE = 3, |
| 340 | }; |
| 341 | |
Prabhanjan Kandula | 585aa65 | 2017-01-26 18:39:11 -0800 | [diff] [blame] | 342 | enum struct DRMSrcConfig { |
| 343 | DEINTERLACE = 0, |
| 344 | }; |
| 345 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 346 | /* Display type to identify a suitable connector */ |
| 347 | enum struct DRMDisplayType { |
| 348 | PERIPHERAL, |
| 349 | TV, |
| 350 | VIRTUAL, |
| 351 | }; |
| 352 | |
| 353 | struct DRMRect { |
| 354 | uint32_t left; // Left-most pixel coordinate. |
| 355 | uint32_t top; // Top-most pixel coordinate. |
| 356 | uint32_t right; // Right-most pixel coordinate. |
| 357 | uint32_t bottom; // Bottom-most pixel coordinate. |
| 358 | }; |
| 359 | |
| 360 | //------------------------------------------------------------------------ |
| 361 | // DRM Info Query Types |
| 362 | //------------------------------------------------------------------------ |
| 363 | |
| 364 | enum struct QSEEDVersion { |
| 365 | V1, |
| 366 | V2, |
| 367 | V3, |
| 368 | }; |
| 369 | |
Rohit Kulkarni | bfa855c | 2017-06-29 17:52:10 -0700 | [diff] [blame] | 370 | /* QSEED3 Step version */ |
| 371 | enum struct QSEEDStepVersion { |
| 372 | V2, |
| 373 | V3, |
| 374 | V4, |
| 375 | }; |
| 376 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 377 | enum struct SmartDMARevision { |
| 378 | V1, |
| 379 | V2, |
| 380 | }; |
| 381 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 382 | /* Per CRTC Resource Info*/ |
| 383 | struct DRMCrtcInfo { |
| 384 | bool has_src_split; |
Srikanth Rajagopalan | 4938078 | 2017-07-06 15:23:12 -0700 | [diff] [blame] | 385 | bool has_hdr; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 386 | uint32_t max_blend_stages; |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 387 | uint32_t max_solidfill_stages; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 388 | QSEEDVersion qseed_version; |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 389 | SmartDMARevision smart_dma_rev; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 390 | float ib_fudge_factor; |
| 391 | float clk_fudge_factor; |
| 392 | uint32_t dest_scale_prefill_lines; |
| 393 | uint32_t undersized_prefill_lines; |
| 394 | uint32_t macrotile_prefill_lines; |
| 395 | uint32_t nv12_prefill_lines; |
| 396 | uint32_t linear_prefill_lines; |
| 397 | uint32_t downscale_prefill_lines; |
| 398 | uint32_t extra_prefill_lines; |
| 399 | uint32_t amortized_threshold; |
| 400 | uint64_t max_bandwidth_low; |
| 401 | uint64_t max_bandwidth_high; |
| 402 | uint32_t max_sde_clk; |
| 403 | CompRatioMap comp_ratio_rt_map; |
| 404 | CompRatioMap comp_ratio_nrt_map; |
Gopikrishnaiah Anandan | 7681552 | 2017-06-27 15:18:04 -0700 | [diff] [blame] | 405 | uint32_t hw_version; |
Namit Solanki | 24921ab | 2017-05-23 20:16:25 +0530 | [diff] [blame] | 406 | uint32_t dest_scaler_count = 0; |
| 407 | uint32_t max_dest_scaler_input_width = 0; |
| 408 | uint32_t max_dest_scaler_output_width = 0; |
| 409 | uint32_t max_dest_scale_up = 1; |
Pullakavi Srinivas | 3e2c040 | 2017-12-05 17:50:15 +0530 | [diff] [blame] | 410 | uint32_t min_prefill_lines = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 411 | }; |
| 412 | |
| 413 | enum struct DRMPlaneType { |
| 414 | // Has CSC and scaling capability |
| 415 | VIG = 0, |
| 416 | // Has scaling capability but no CSC |
| 417 | RGB, |
| 418 | // No scaling support |
| 419 | DMA, |
| 420 | // Supports a small dimension and doesn't use a CRTC stage |
| 421 | CURSOR, |
| 422 | MAX, |
| 423 | }; |
| 424 | |
| 425 | struct DRMPlaneTypeInfo { |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 426 | DRMPlaneType type; |
| 427 | uint32_t master_plane_id; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 428 | // FourCC format enum and modifier |
| 429 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 430 | uint32_t max_linewidth; |
| 431 | uint32_t max_upscale; |
| 432 | uint32_t max_downscale; |
| 433 | uint32_t max_horizontal_deci; |
| 434 | uint32_t max_vertical_deci; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 435 | uint64_t max_pipe_bandwidth; |
Rohit Kulkarni | 8622e36 | 2017-01-30 18:14:10 -0800 | [diff] [blame] | 436 | uint32_t cache_size; // cache size in bytes for inline rotation support. |
Rohit Kulkarni | bfa855c | 2017-06-29 17:52:10 -0700 | [diff] [blame] | 437 | QSEEDStepVersion qseed3_version; |
Ramkumar Radhakrishnan | 0725430 | 2017-11-13 16:18:22 -0800 | [diff] [blame^] | 438 | bool multirect_prop_present = false; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 441 | // All DRM Planes as map<Plane_id , plane_type_info> listed from highest to lowest priority |
| 442 | typedef std::vector<std::pair<uint32_t, DRMPlaneTypeInfo>> DRMPlanesInfo; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 443 | |
| 444 | enum struct DRMTopology { |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 445 | UNKNOWN, // To be compat with driver defs in sde_rm.h |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 446 | SINGLE_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 447 | SINGLE_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 448 | DUAL_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 449 | DUAL_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 450 | DUAL_LM_MERGE, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 451 | DUAL_LM_MERGE_DSC, |
| 452 | DUAL_LM_DSCMERGE, |
| 453 | PPSPLIT, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 454 | }; |
| 455 | |
| 456 | enum struct DRMPanelMode { |
| 457 | VIDEO, |
| 458 | COMMAND, |
| 459 | }; |
| 460 | |
Saurabh Shah | 7e16c93 | 2017-11-03 17:55:36 -0700 | [diff] [blame] | 461 | /* Per mode info */ |
| 462 | struct DRMModeInfo { |
| 463 | drmModeModeInfo mode; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 464 | DRMTopology topology; |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 465 | // Valid only if mode is command |
| 466 | int num_roi; |
| 467 | int xstart; |
| 468 | int ystart; |
| 469 | int walign; |
| 470 | int halign; |
| 471 | int wmin; |
| 472 | int hmin; |
| 473 | bool roi_merge; |
Saurabh Shah | 7e16c93 | 2017-11-03 17:55:36 -0700 | [diff] [blame] | 474 | }; |
| 475 | |
| 476 | /* Per Connector Info*/ |
| 477 | struct DRMConnectorInfo { |
| 478 | uint32_t mmWidth; |
| 479 | uint32_t mmHeight; |
| 480 | uint32_t type; |
| 481 | std::vector<DRMModeInfo> modes; |
| 482 | std::string panel_name; |
| 483 | DRMPanelMode panel_mode; |
| 484 | bool is_primary; |
| 485 | // Valid only if DRMPanelMode is VIDEO |
| 486 | bool dynamic_fps; |
| 487 | // FourCC format enum and modifier |
| 488 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 489 | // Valid only if type is DRM_MODE_CONNECTOR_VIRTUAL |
| 490 | uint32_t max_linewidth; |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 491 | DRMRotation panel_orientation; |
Sushil Chauhan | 80e5843 | 2017-07-06 11:39:17 -0700 | [diff] [blame] | 492 | drm_panel_hdr_properties panel_hdr_prop; |
Ramkumar Radhakrishnan | 5c94f05 | 2017-07-06 11:59:14 -0700 | [diff] [blame] | 493 | uint32_t transfer_time_us; |
Srikanth Rajagopalan | ce0f7cb | 2017-06-12 15:14:26 -0700 | [diff] [blame] | 494 | drm_msm_ext_hdr_properties ext_hdr_prop; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 495 | }; |
| 496 | |
| 497 | /* Identifier token for a display */ |
| 498 | struct DRMDisplayToken { |
| 499 | uint32_t conn_id; |
| 500 | uint32_t crtc_id; |
| 501 | }; |
| 502 | |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 503 | enum DRMPPFeatureID { |
| 504 | kFeaturePcc, |
| 505 | kFeatureIgc, |
| 506 | kFeaturePgc, |
| 507 | kFeatureMixerGc, |
| 508 | kFeaturePaV2, |
| 509 | kFeatureDither, |
| 510 | kFeatureGamut, |
| 511 | kFeaturePADither, |
Rajesh Yadav | d30b0cc | 2017-09-22 00:26:54 +0530 | [diff] [blame] | 512 | kFeaturePAHsic, |
| 513 | kFeaturePASixZone, |
Rajesh Yadav | 99535ac | 2017-08-28 16:33:04 +0530 | [diff] [blame] | 514 | kFeaturePAMemColSkin, |
| 515 | kFeaturePAMemColSky, |
| 516 | kFeaturePAMemColFoliage, |
| 517 | kFeaturePAMemColProt, |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 518 | kPPFeaturesMax, |
| 519 | }; |
| 520 | |
| 521 | enum DRMPPPropType { |
| 522 | kPropEnum, |
| 523 | kPropRange, |
| 524 | kPropBlob, |
| 525 | kPropTypeMax, |
| 526 | }; |
| 527 | |
| 528 | struct DRMPPFeatureInfo { |
| 529 | DRMPPFeatureID id; |
| 530 | DRMPPPropType type; |
| 531 | uint32_t version; |
| 532 | uint32_t payload_size; |
| 533 | void *payload; |
| 534 | }; |
| 535 | |
Ping Li | 8d6dd62 | 2017-07-03 12:05:15 -0700 | [diff] [blame] | 536 | enum DRMCscType { |
| 537 | kCscYuv2Rgb601L, |
| 538 | kCscYuv2Rgb601FR, |
| 539 | kCscYuv2Rgb709L, |
| 540 | kCscYuv2Rgb2020L, |
| 541 | kCscYuv2Rgb2020FR, |
| 542 | kCscTypeMax, |
| 543 | }; |
| 544 | |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 545 | struct DRMScalerLUTInfo { |
| 546 | uint32_t dir_lut_size = 0; |
| 547 | uint32_t cir_lut_size = 0; |
| 548 | uint32_t sep_lut_size = 0; |
| 549 | uint64_t dir_lut = 0; |
| 550 | uint64_t cir_lut = 0; |
| 551 | uint64_t sep_lut = 0; |
| 552 | }; |
| 553 | |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 554 | enum struct DRMSecureMode { |
| 555 | NON_SECURE, |
| 556 | SECURE, |
| 557 | NON_SECURE_DIR_TRANSLATION, |
| 558 | SECURE_DIR_TRANSLATION, |
| 559 | }; |
| 560 | |
| 561 | enum struct DRMSecurityLevel { |
| 562 | SECURE_NON_SECURE, |
| 563 | SECURE_ONLY, |
| 564 | }; |
| 565 | |
Ramkumar Radhakrishnan | 0725430 | 2017-11-13 16:18:22 -0800 | [diff] [blame^] | 566 | enum struct DRMMultiRectMode { |
| 567 | NONE = 0, |
| 568 | PARALLEL = 1, |
| 569 | SERIAL = 2, |
| 570 | }; |
| 571 | |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 572 | struct DRMSolidfillStage { |
| 573 | DRMRect bounding_rect {}; |
| 574 | bool is_exclusion_rect = false; |
| 575 | uint32_t color = 0xff000000; // in 8bit argb |
Gopikrishnaiah Anandan | cc12306 | 2017-07-31 17:21:03 -0700 | [diff] [blame] | 576 | uint32_t red = 0; |
| 577 | uint32_t blue = 0; |
| 578 | uint32_t green = 0; |
| 579 | uint32_t alpha = 0xff; |
| 580 | uint32_t color_bit_depth = 0; |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 581 | uint32_t z_order = 0; |
| 582 | uint32_t plane_alpha = 0xff; |
| 583 | }; |
| 584 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 585 | /* DRM Atomic Request Property Set. |
| 586 | * |
| 587 | * Helper class to create and populate atomic properties of DRM components |
| 588 | * when rendered in DRM atomic mode */ |
| 589 | class DRMAtomicReqInterface { |
| 590 | public: |
| 591 | virtual ~DRMAtomicReqInterface() {} |
| 592 | /* Perform request operation. |
| 593 | * |
| 594 | * [input]: opcode: operation code from DRMOps list. |
| 595 | * var_arg: arguments for DRMOps's can differ in number and |
| 596 | * data type. Refer above DRMOps to details. |
| 597 | * [return]: Error code if the API fails, 0 on success. |
| 598 | */ |
| 599 | virtual int Perform(DRMOps opcode, ...) = 0; |
| 600 | |
| 601 | /* |
| 602 | * Commit the params set via Perform(). Also resets the properties after commit. Needs to be |
| 603 | * called every frame. |
| 604 | * [input]: synchronous: Determines if the call should block until a h/w flip |
Saurabh Shah | a917aa7 | 2017-09-15 13:27:24 -0700 | [diff] [blame] | 605 | * [input]: retain_planes: Retains already staged planes. Useful when not explicitly programming |
| 606 | * planes but still need the previously staged ones to not be unstaged |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 607 | * [return]: Error code if the API fails, 0 on success. |
| 608 | */ |
Saurabh Shah | a917aa7 | 2017-09-15 13:27:24 -0700 | [diff] [blame] | 609 | virtual int Commit(bool synchronous, bool retain_planes) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 610 | /* |
| 611 | * Validate the params set via Perform(). |
| 612 | * [return]: Error code if the API fails, 0 on success. |
| 613 | */ |
| 614 | virtual int Validate() = 0; |
| 615 | }; |
| 616 | |
| 617 | class DRMManagerInterface; |
| 618 | |
| 619 | /* Populates a singleton instance of DRMManager */ |
| 620 | typedef int (*GetDRMManager)(int fd, DRMManagerInterface **intf); |
| 621 | |
| 622 | /* Destroy DRMManager instance */ |
Saurabh Shah | ab7807c | 2017-02-08 15:41:08 -0800 | [diff] [blame] | 623 | typedef int (*DestroyDRMManager)(); |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 624 | |
| 625 | /* |
| 626 | * DRM Manager Interface - Any class which plans to implement helper function for vendor |
| 627 | * specific DRM driver implementation must implement the below interface routines to work |
| 628 | * with SDM. |
| 629 | */ |
| 630 | |
| 631 | class DRMManagerInterface { |
| 632 | public: |
| 633 | virtual ~DRMManagerInterface() {} |
| 634 | |
| 635 | /* |
| 636 | * Since SDM completely manages the planes. GetPlanesInfo will provide all |
| 637 | * the plane information. |
| 638 | * [output]: DRMPlanesInfo: Resource Info for planes. |
| 639 | */ |
| 640 | virtual void GetPlanesInfo(DRMPlanesInfo *info) = 0; |
| 641 | |
| 642 | /* |
| 643 | * Will provide all the information of a selected crtc. |
| 644 | * [input]: Use crtc id 0 to obtain system wide info |
| 645 | * [output]: DRMCrtcInfo: Resource Info for the given CRTC id. |
| 646 | */ |
| 647 | virtual void GetCrtcInfo(uint32_t crtc_id, DRMCrtcInfo *info) = 0; |
| 648 | |
| 649 | /* |
| 650 | * Will provide all the information of a selected connector. |
| 651 | * [output]: DRMConnectorInfo: Resource Info for the given connector id |
| 652 | */ |
| 653 | virtual void GetConnectorInfo(uint32_t conn_id, DRMConnectorInfo *info) = 0; |
| 654 | |
| 655 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 656 | * Will query post propcessing feature info of a CRTC. |
| 657 | * [output]: DRMPPFeatureInfo: CRTC post processing feature info |
| 658 | */ |
Namit Solanki | 24921ab | 2017-05-23 20:16:25 +0530 | [diff] [blame] | 659 | virtual void GetCrtcPPInfo(uint32_t crtc_id, DRMPPFeatureInfo *info) = 0; |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 660 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 661 | * Register a logical display to receive a token. |
| 662 | * Each display pipeline in DRM is identified by its CRTC and Connector(s). |
| 663 | * On display connect(bootup or hotplug), clients should invoke this interface to |
| 664 | * establish the pipeline for the display and should get a DisplayToken |
| 665 | * populated with crtc and connnector(s) id's. Here onwards, Client should |
| 666 | * use this token to represent the display for any Perform operations if |
| 667 | * needed. |
| 668 | * |
| 669 | * [input]: disp_type - Peripheral / TV / Virtual |
| 670 | * [output]: DRMDisplayToken - CRTC and Connector id's for the display |
| 671 | * [return]: 0 on success, a negative error value otherwise |
| 672 | */ |
| 673 | virtual int RegisterDisplay(DRMDisplayType disp_type, DRMDisplayToken *tok) = 0; |
| 674 | |
| 675 | /* Client should invoke this interface on display disconnect. |
| 676 | * [input]: DRMDisplayToken - identifier for the display. |
| 677 | */ |
| 678 | virtual void UnregisterDisplay(const DRMDisplayToken &token) = 0; |
| 679 | |
| 680 | /* |
| 681 | * Creates and returns an instance of DRMAtomicReqInterface corresponding to a display token |
| 682 | * returned as part of RegisterDisplay API. Needs to be called per display. |
| 683 | * [input]: DRMDisplayToken that identifies a display pipeline |
| 684 | * [output]: Pointer to an instance of DRMAtomicReqInterface. |
| 685 | * [return]: Error code if the API fails, 0 on success. |
| 686 | */ |
| 687 | virtual int CreateAtomicReq(const DRMDisplayToken &token, DRMAtomicReqInterface **intf) = 0; |
| 688 | |
| 689 | /* |
| 690 | * Destroys the instance of DRMAtomicReqInterface |
| 691 | * [input]: Pointer to a DRMAtomicReqInterface |
| 692 | * [return]: Error code if the API fails, 0 on success. |
| 693 | */ |
| 694 | virtual int DestroyAtomicReq(DRMAtomicReqInterface *intf) = 0; |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 695 | /* |
| 696 | * Sets the global scaler LUT |
| 697 | * [input]: LUT Info |
| 698 | * [return]: Error code if the API fails, 0 on success. |
| 699 | */ |
| 700 | virtual int SetScalerLUT(const DRMScalerLUTInfo &lut_info) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 701 | }; |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 702 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 703 | } // namespace sde_drm |
| 704 | #endif // __DRM_INTERFACE_H__ |