Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 1 | /* |
Mahesh Aia | 25b2271 | 2019-01-04 11:49:46 -0800 | [diff] [blame] | 2 | * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 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> |
Yuchao Ma | 577f0f7 | 2018-07-09 11:20:00 +0800 | [diff] [blame] | 41 | #include <drm/msm_drm_pp.h> |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 42 | |
| 43 | namespace sde_drm { |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 44 | |
| 45 | typedef std::map<std::pair<uint32_t, uint64_t>, float> CompRatioMap; |
| 46 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 47 | /* |
| 48 | * Drm Atomic Operation Codes |
| 49 | */ |
| 50 | enum struct DRMOps { |
| 51 | /* |
| 52 | * Op: Sets plane source crop |
| 53 | * Arg: uint32_t - Plane ID |
| 54 | * DRMRect - Source Rectangle |
| 55 | */ |
| 56 | PLANE_SET_SRC_RECT, |
| 57 | /* |
| 58 | * Op: Sets plane destination rect |
| 59 | * Arg: uint32_t - Plane ID |
| 60 | * DRMRect - Dst Rectangle |
| 61 | */ |
| 62 | PLANE_SET_DST_RECT, |
| 63 | /* |
Namit Solanki | 6d0d806 | 2017-11-30 17:29:48 +0530 | [diff] [blame] | 64 | * Op: Sets plane exclusion rect |
| 65 | * Arg: uint32_t - Plane ID |
| 66 | * drm_clip_rect - Exclusion Rectangle |
| 67 | */ |
| 68 | PLANE_SET_EXCL_RECT, |
| 69 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 70 | * Op: Sets plane zorder |
| 71 | * Arg: uint32_t - Plane ID |
| 72 | * uint32_t - zorder |
| 73 | */ |
| 74 | PLANE_SET_ZORDER, |
| 75 | /* |
| 76 | * Op: Sets plane rotation flags |
| 77 | * Arg: uint32_t - Plane ID |
| 78 | * uint32_t - bit mask of rotation flags (See drm_mode.h for enums) |
| 79 | */ |
| 80 | PLANE_SET_ROTATION, |
| 81 | /* |
| 82 | * Op: Sets plane alpha |
| 83 | * Arg: uint32_t - Plane ID |
| 84 | * uint32_t - alpha value |
| 85 | */ |
| 86 | PLANE_SET_ALPHA, |
| 87 | /* |
| 88 | * Op: Sets the blend type |
| 89 | * Arg: uint32_t - Plane ID |
| 90 | * uint32_t - blend type (see DRMBlendType) |
| 91 | */ |
| 92 | PLANE_SET_BLEND_TYPE, |
| 93 | /* |
| 94 | * Op: Sets horizontal decimation |
| 95 | * Arg: uint32_t - Plane ID |
| 96 | * uint32_t - decimation factor |
| 97 | */ |
| 98 | PLANE_SET_H_DECIMATION, |
| 99 | /* |
| 100 | * Op: Sets vertical decimation |
| 101 | * Arg: uint32_t - Plane ID |
| 102 | * uint32_t - decimation factor |
| 103 | */ |
| 104 | PLANE_SET_V_DECIMATION, |
| 105 | /* |
Prabhanjan Kandula | 585aa65 | 2017-01-26 18:39:11 -0800 | [diff] [blame] | 106 | * Op: Sets source config flags |
| 107 | * Arg: uint32_t - Plane ID |
| 108 | * uint32_t - flags to enable or disable a specific op. E.g. deinterlacing |
| 109 | */ |
| 110 | PLANE_SET_SRC_CONFIG, |
| 111 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 112 | * Op: Sets frame buffer ID for plane. Set together with CRTC. |
| 113 | * Arg: uint32_t - Plane ID |
| 114 | * uint32_t - Framebuffer ID |
| 115 | */ |
| 116 | PLANE_SET_FB_ID, |
| 117 | /* |
| 118 | * Op: Sets the crtc for this plane. Set together with FB_ID. |
| 119 | * Arg: uint32_t - Plane ID |
| 120 | * uint32_t - CRTC ID |
| 121 | */ |
| 122 | PLANE_SET_CRTC, |
| 123 | /* |
| 124 | * Op: Sets acquire fence for this plane's buffer. Set together with FB_ID, CRTC. |
| 125 | * Arg: uint32_t - Plane ID |
| 126 | * uint32_t - Input fence |
| 127 | */ |
| 128 | PLANE_SET_INPUT_FENCE, |
| 129 | /* |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 130 | * Op: Sets scaler config on this plane. |
| 131 | * Arg: uint32_t - Plane ID |
| 132 | * uint64_t - Address of the scaler config object (version based) |
| 133 | */ |
| 134 | PLANE_SET_SCALER_CONFIG, |
| 135 | /* |
Rohit Kulkarni | 8622e36 | 2017-01-30 18:14:10 -0800 | [diff] [blame] | 136 | * Op: Sets plane rotation destination rect |
| 137 | * Arg: uint32_t - Plane ID |
| 138 | * DRMRect - rotator dst Rectangle |
| 139 | */ |
| 140 | PLANE_SET_ROTATION_DST_RECT, |
| 141 | /* |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 142 | * Op: Sets FB Secure mode for this plane. |
| 143 | * Arg: uint32_t - Plane ID |
| 144 | * uint32_t - Value of the FB Secure mode. |
| 145 | */ |
| 146 | PLANE_SET_FB_SECURE_MODE, |
| 147 | /* |
Ping Li | 8d6dd62 | 2017-07-03 12:05:15 -0700 | [diff] [blame] | 148 | * Op: Sets csc config on this plane. |
| 149 | * Arg: uint32_t - Plane ID |
| 150 | * uint32_t* - pointer to csc type |
| 151 | */ |
| 152 | PLANE_SET_CSC_CONFIG, |
| 153 | /* |
Ramkumar Radhakrishnan | 0725430 | 2017-11-13 16:18:22 -0800 | [diff] [blame] | 154 | * Op: Sets multirect mode on this plane. |
| 155 | * Arg: uint32_t - Plane ID |
| 156 | * uint32_t - multirect mode |
| 157 | */ |
| 158 | PLANE_SET_MULTIRECT_MODE, |
| 159 | /* |
Rohit Kulkarni | 2d7151c | 2017-12-14 22:17:49 -0800 | [diff] [blame] | 160 | * Op: Sets rotator output frame buffer ID for plane. |
| 161 | * Arg: uint32_t - Plane ID |
| 162 | * uint32_t - Framebuffer ID |
| 163 | */ |
| 164 | PLANE_SET_ROT_FB_ID, |
| 165 | /* |
Arun Kumar K.R | 5d30ab5 | 2017-12-28 09:05:36 +0530 | [diff] [blame] | 166 | * Op: Sets inverse pma mode on this plane. |
| 167 | * Arg: uint32_t - Plane ID |
| 168 | * uint32_t - enable/disable inverse pma. |
| 169 | */ |
| 170 | PLANE_SET_INVERSE_PMA, |
| 171 | /* |
| 172 | * Op: Sets csc config on this plane. |
| 173 | * Arg: uint32_t - Plane ID |
| 174 | * uint64_t - Address of the csc config object(version based) |
| 175 | */ |
| 176 | PLANE_SET_DGM_CSC_CONFIG, |
| 177 | /* |
| 178 | * Op: Sets SSPP Feature |
| 179 | * Arg: uint32_t - Plane ID |
| 180 | * DRMPPFeatureInfo * - PP feature data pointer |
| 181 | */ |
| 182 | PLANE_SET_POST_PROC, |
| 183 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 184 | * Op: Activate or deactivate a CRTC |
| 185 | * Arg: uint32_t - CRTC ID |
| 186 | * uint32_t - 1 to enable, 0 to disable |
| 187 | */ |
| 188 | CRTC_SET_ACTIVE, |
| 189 | /* |
| 190 | * Op: Sets display mode |
| 191 | * Arg: uint32_t - CRTC ID |
| 192 | * drmModeModeInfo* - Pointer to display mode |
| 193 | */ |
| 194 | CRTC_SET_MODE, |
| 195 | /* |
| 196 | * Op: Sets an offset indicating when a release fence should be signalled. |
| 197 | * Arg: uint32_t - offset |
| 198 | * 0: non-speculative, default |
| 199 | * 1: speculative |
| 200 | */ |
| 201 | CRTC_SET_OUTPUT_FENCE_OFFSET, |
| 202 | /* |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 203 | * Op: Sets overall SDE core clock |
| 204 | * Arg: uint32_t - CRTC ID |
| 205 | * uint32_t - core_clk |
| 206 | */ |
| 207 | CRTC_SET_CORE_CLK, |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 208 | /* |
| 209 | * Op: Sets MNOC bus average bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 210 | * Arg: uint32_t - CRTC ID |
| 211 | * uint32_t - core_ab |
| 212 | */ |
| 213 | CRTC_SET_CORE_AB, |
| 214 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 215 | * Op: Sets MNOC bus instantaneous bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 216 | * Arg: uint32_t - CRTC ID |
| 217 | * uint32_t - core_ib |
| 218 | */ |
| 219 | CRTC_SET_CORE_IB, |
| 220 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 221 | * Op: Sets LLCC Bus average bandwidth |
| 222 | * Arg: uint32_t - CRTC ID |
| 223 | * uint32_t - llcc_ab |
| 224 | */ |
| 225 | CRTC_SET_LLCC_AB, |
| 226 | /* |
| 227 | * Op: Sets LLCC Bus instantaneous bandwidth |
| 228 | * Arg: uint32_t - CRTC ID |
| 229 | * uint32_t - llcc_ib |
| 230 | */ |
| 231 | CRTC_SET_LLCC_IB, |
| 232 | /* |
| 233 | * Op: Sets DRAM bus average bandwidth |
| 234 | * Arg: uint32_t - CRTC ID |
| 235 | * uint32_t - dram_ab |
| 236 | */ |
| 237 | CRTC_SET_DRAM_AB, |
| 238 | /* |
| 239 | * Op: Sets DRAM bus instantaneous bandwidth |
| 240 | * Arg: uint32_t - CRTC ID |
| 241 | * uint32_t - dram_ib |
| 242 | */ |
| 243 | CRTC_SET_DRAM_IB, |
| 244 | /* |
Ramkumar Radhakrishnan | b791044 | 2017-12-11 13:32:47 -0800 | [diff] [blame] | 245 | * Op: Sets Rotator BW for inline rotation |
| 246 | * Arg: uint32_t - CRTC ID |
| 247 | * uint32_t - rot_bw |
| 248 | */ |
| 249 | CRTC_SET_ROT_PREFILL_BW, |
| 250 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 251 | * Op: Sets rotator clock for inline rotation |
| 252 | * Arg: uint32_t - CRTC ID |
| 253 | * uint32_t - rot_clk |
| 254 | */ |
Namit Solanki | 24921ab | 2017-05-23 20:16:25 +0530 | [diff] [blame] | 255 | CRTC_SET_ROT_CLK, |
| 256 | /* |
| 257 | * Op: Sets destination scalar data |
| 258 | * Arg: uint32_t - CRTC ID |
| 259 | * uint64_t - Pointer to destination scalar data |
| 260 | */ |
| 261 | CRTC_SET_DEST_SCALER_CONFIG, |
| 262 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 263 | * Op: Returns release fence for this frame. Should be called after Commit() on |
| 264 | * DRMAtomicReqInterface. |
| 265 | * Arg: uint32_t - CRTC ID |
| 266 | * int * - Pointer to an integer that will hold the returned fence |
| 267 | */ |
| 268 | CRTC_GET_RELEASE_FENCE, |
| 269 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 270 | * Op: Sets PP feature |
| 271 | * Arg: uint32_t - CRTC ID |
| 272 | * DRMPPFeatureInfo * - PP feature data pointer |
| 273 | */ |
| 274 | CRTC_SET_POST_PROC, |
| 275 | /* |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 276 | * Op: Sets CRTC ROIs. |
| 277 | * Arg: uint32_t - CRTC ID |
| 278 | * uint32_t - number of ROIs |
| 279 | * DRMRect * - Array of CRTC ROIs |
| 280 | */ |
| 281 | CRTC_SET_ROI, |
| 282 | /* |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 283 | * Op: Sets Security level for CRTC. |
| 284 | * Arg: uint32_t - CRTC ID |
| 285 | * uint32_t - Security level |
| 286 | */ |
| 287 | CRTC_SET_SECURITY_LEVEL, |
| 288 | /* |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 289 | * Op: sets solid fill stages |
| 290 | * Arg: uint32_t - CRTC ID |
| 291 | * Vector of DRMSolidfillStage |
| 292 | */ |
| 293 | CRTC_SET_SOLIDFILL_STAGES, |
| 294 | /* |
Anjaneya Prasad Musunuri | e8c67f2 | 2017-07-01 16:16:13 +0530 | [diff] [blame] | 295 | * Op: Sets idle timeout. |
| 296 | * Arg: uint32_t - CRTC ID |
| 297 | * uint32_t - idle timeout in ms |
| 298 | */ |
| 299 | CRTC_SET_IDLE_TIMEOUT, |
| 300 | /* |
Sushil Chauhan | 741ac31 | 2018-04-02 12:22:16 -0700 | [diff] [blame] | 301 | * Op: Sets Capture mode for Concurrent Writeback feature. |
| 302 | * Arg: uint32_t - CRTC ID |
| 303 | * uint32_t - Capture mode |
| 304 | */ |
| 305 | CRTC_SET_CAPTURE_MODE, |
| 306 | /* |
Ramkumar Radhakrishnan | f985d48 | 2018-07-23 18:10:41 -0700 | [diff] [blame] | 307 | * Op: Sets Idle PC state for CRTC. |
| 308 | * Arg: uint32_t - CRTC ID |
| 309 | * uint32_t - idle pc state |
| 310 | */ |
| 311 | CRTC_SET_IDLE_PC_STATE, |
| 312 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 313 | * Op: Returns retire fence for this commit. Should be called after Commit() on |
| 314 | * DRMAtomicReqInterface. |
| 315 | * Arg: uint32_t - Connector ID |
| 316 | * int * - Pointer to an integer that will hold the returned fence |
| 317 | */ |
| 318 | CONNECTOR_GET_RETIRE_FENCE, |
| 319 | /* |
| 320 | * Op: Sets writeback connector destination rect |
| 321 | * Arg: uint32_t - Connector ID |
| 322 | * DRMRect - Dst Rectangle |
| 323 | */ |
| 324 | CONNECTOR_SET_OUTPUT_RECT, |
| 325 | /* |
| 326 | * Op: Sets frame buffer ID for writeback connector. |
| 327 | * Arg: uint32_t - Connector ID |
| 328 | * uint32_t - Framebuffer ID |
| 329 | */ |
| 330 | CONNECTOR_SET_OUTPUT_FB_ID, |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 331 | /* |
| 332 | * Op: Sets power mode for connector. |
| 333 | * Arg: uint32_t - Connector ID |
| 334 | * uint32_t - Power Mode |
| 335 | */ |
| 336 | CONNECTOR_SET_POWER_MODE, |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 337 | /* |
| 338 | * Op: Sets panel ROIs. |
| 339 | * Arg: uint32_t - Connector ID |
| 340 | * uint32_t - number of ROIs |
| 341 | * DRMRect * - Array of Connector ROIs |
| 342 | */ |
| 343 | CONNECTOR_SET_ROI, |
Sushil Chauhan | e2f89c9 | 2017-08-23 11:30:34 -0700 | [diff] [blame] | 344 | /* |
Saurabh Shah | f363595 | 2017-10-16 17:08:18 -0700 | [diff] [blame] | 345 | * Op: Sets the connector to autorefresh mode. |
| 346 | * Arg: uint32_t - Connector ID |
| 347 | * uint32_t - Enable-1, Disable-0 |
| 348 | */ |
| 349 | CONNECTOR_SET_AUTOREFRESH, |
| 350 | /* |
Sushil Chauhan | e2f89c9 | 2017-08-23 11:30:34 -0700 | [diff] [blame] | 351 | * Op: Set FB secure mode for Writeback connector. |
| 352 | * Arg: uint32_t - Connector ID |
| 353 | * uint32_t - FB Secure mode |
| 354 | */ |
| 355 | CONNECTOR_SET_FB_SECURE_MODE, |
Saurabh Shah | 82b06f4 | 2017-09-06 16:43:49 -0700 | [diff] [blame] | 356 | /* |
| 357 | * Op: Sets a crtc id to this connector |
| 358 | * Arg: uint32_t - Connector ID |
| 359 | * uint32_t - CRTC ID |
| 360 | */ |
| 361 | CONNECTOR_SET_CRTC, |
Srikanth Rajagopalan | 7a09b2e | 2017-06-19 18:41:03 -0700 | [diff] [blame] | 362 | /* |
Gopikrishnaiah Anandan | 739faf9 | 2017-07-21 12:32:00 -0700 | [diff] [blame] | 363 | * Op: Sets PP feature |
| 364 | * Arg: uint32_t - Connector ID |
| 365 | * DRMPPFeatureInfo * - PP feature data pointer |
| 366 | */ |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 367 | CONNECTOR_SET_POST_PROC, |
Gopikrishnaiah Anandan | 739faf9 | 2017-07-21 12:32:00 -0700 | [diff] [blame] | 368 | /* |
Srikanth Rajagopalan | 7a09b2e | 2017-06-19 18:41:03 -0700 | [diff] [blame] | 369 | * Op: Sets connector hdr metadata |
| 370 | * Arg: uint32_t - Connector ID |
| 371 | * drm_msm_ext_hdr_metadata - hdr_metadata |
| 372 | */ |
| 373 | CONNECTOR_SET_HDR_METADATA, |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 374 | /* |
| 375 | * Op: Cache Dpps features. |
| 376 | * Arg: uint32_t - Object ID |
| 377 | uint32_t - Feature ID |
| 378 | * uint64_t - Pointer to feature config data |
| 379 | */ |
| 380 | DPPS_CACHE_FEATURE, |
Xu Yang | da64222 | 2018-06-12 10:32:33 +0800 | [diff] [blame] | 381 | /* |
| 382 | * Op: Commit Dpps features. |
| 383 | * Arg: drmModeAtomicReq - Atomic request |
| 384 | */ |
| 385 | DPPS_COMMIT_FEATURE, |
Sushil Chauhan | 8f514a5 | 2018-02-27 17:35:44 -0800 | [diff] [blame] | 386 | /* |
| 387 | * Op: Sets qsync mode on connector |
| 388 | * Arg: uint32_t - Connector ID |
| 389 | * uint32_t - qsync mode |
| 390 | */ |
| 391 | CONNECTOR_SET_QSYNC_MODE, |
Mathew Joseph Karimpanal | b7f20c6 | 2018-10-09 12:17:20 +0530 | [diff] [blame] | 392 | /* |
| 393 | * Op: Sets topology control on this connector |
| 394 | * Arg: uint32_t - Connector ID |
| 395 | * uint32_t - Topology control bit-mask |
| 396 | */ |
| 397 | CONNECTOR_SET_TOPOLOGY_CONTROL, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 398 | }; |
| 399 | |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 400 | enum struct DRMRotation { |
| 401 | FLIP_H = 0x1, |
| 402 | FLIP_V = 0x2, |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 403 | ROT_180 = FLIP_H | FLIP_V, |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 404 | ROT_90 = 0x4, |
| 405 | }; |
| 406 | |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 407 | enum struct DRMPowerMode { |
| 408 | ON, |
| 409 | DOZE, |
| 410 | DOZE_SUSPEND, |
| 411 | OFF, |
| 412 | }; |
| 413 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 414 | enum struct DRMBlendType { |
| 415 | UNDEFINED = 0, |
| 416 | OPAQUE = 1, |
| 417 | PREMULTIPLIED = 2, |
| 418 | COVERAGE = 3, |
| 419 | }; |
| 420 | |
Prabhanjan Kandula | 585aa65 | 2017-01-26 18:39:11 -0800 | [diff] [blame] | 421 | enum struct DRMSrcConfig { |
| 422 | DEINTERLACE = 0, |
| 423 | }; |
| 424 | |
Ramkumar Radhakrishnan | f985d48 | 2018-07-23 18:10:41 -0700 | [diff] [blame] | 425 | enum struct DRMIdlePCState { |
| 426 | NONE, |
| 427 | ENABLE, |
| 428 | DISABLE, |
| 429 | }; |
| 430 | |
| 431 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 432 | /* Display type to identify a suitable connector */ |
| 433 | enum struct DRMDisplayType { |
| 434 | PERIPHERAL, |
| 435 | TV, |
| 436 | VIRTUAL, |
| 437 | }; |
| 438 | |
| 439 | struct DRMRect { |
| 440 | uint32_t left; // Left-most pixel coordinate. |
| 441 | uint32_t top; // Top-most pixel coordinate. |
| 442 | uint32_t right; // Right-most pixel coordinate. |
| 443 | uint32_t bottom; // Bottom-most pixel coordinate. |
| 444 | }; |
| 445 | |
| 446 | //------------------------------------------------------------------------ |
| 447 | // DRM Info Query Types |
| 448 | //------------------------------------------------------------------------ |
| 449 | |
| 450 | enum struct QSEEDVersion { |
| 451 | V1, |
| 452 | V2, |
| 453 | V3, |
Ramakant Singh | 1ba882f | 2018-06-06 10:23:21 +0530 | [diff] [blame] | 454 | V3LITE, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 455 | }; |
| 456 | |
Rohit Kulkarni | bfa855c | 2017-06-29 17:52:10 -0700 | [diff] [blame] | 457 | /* QSEED3 Step version */ |
| 458 | enum struct QSEEDStepVersion { |
| 459 | V2, |
| 460 | V3, |
| 461 | V4, |
Ramakant Singh | 1ba882f | 2018-06-06 10:23:21 +0530 | [diff] [blame] | 462 | V3LITE_V4, |
| 463 | V3LITE_V5, |
Rohit Kulkarni | bfa855c | 2017-06-29 17:52:10 -0700 | [diff] [blame] | 464 | }; |
| 465 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 466 | enum struct SmartDMARevision { |
| 467 | V1, |
| 468 | V2, |
Mathew Joseph Karimpanal | 1f8a21c | 2017-10-20 20:47:42 +0530 | [diff] [blame] | 469 | V2p5 |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 470 | }; |
| 471 | |
Rohit Kulkarni | 2d7151c | 2017-12-14 22:17:49 -0800 | [diff] [blame] | 472 | /* Inline Rotation version */ |
| 473 | enum struct InlineRotationVersion { |
| 474 | UNKNOWN, |
| 475 | V1, |
| 476 | V1p1, // Rotator FB ID needs to be set |
| 477 | }; |
| 478 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 479 | /* Per CRTC Resource Info*/ |
| 480 | struct DRMCrtcInfo { |
| 481 | bool has_src_split; |
Srikanth Rajagopalan | 4938078 | 2017-07-06 15:23:12 -0700 | [diff] [blame] | 482 | bool has_hdr; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 483 | uint32_t max_blend_stages; |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 484 | uint32_t max_solidfill_stages; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 485 | QSEEDVersion qseed_version; |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 486 | SmartDMARevision smart_dma_rev; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 487 | float ib_fudge_factor; |
| 488 | float clk_fudge_factor; |
| 489 | uint32_t dest_scale_prefill_lines; |
| 490 | uint32_t undersized_prefill_lines; |
| 491 | uint32_t macrotile_prefill_lines; |
| 492 | uint32_t nv12_prefill_lines; |
| 493 | uint32_t linear_prefill_lines; |
| 494 | uint32_t downscale_prefill_lines; |
| 495 | uint32_t extra_prefill_lines; |
| 496 | uint32_t amortized_threshold; |
| 497 | uint64_t max_bandwidth_low; |
| 498 | uint64_t max_bandwidth_high; |
| 499 | uint32_t max_sde_clk; |
| 500 | CompRatioMap comp_ratio_rt_map; |
| 501 | CompRatioMap comp_ratio_nrt_map; |
Gopikrishnaiah Anandan | 7681552 | 2017-06-27 15:18:04 -0700 | [diff] [blame] | 502 | uint32_t hw_version; |
Namit Solanki | 24921ab | 2017-05-23 20:16:25 +0530 | [diff] [blame] | 503 | uint32_t dest_scaler_count = 0; |
| 504 | uint32_t max_dest_scaler_input_width = 0; |
| 505 | uint32_t max_dest_scaler_output_width = 0; |
| 506 | uint32_t max_dest_scale_up = 1; |
Pullakavi Srinivas | 3e2c040 | 2017-12-05 17:50:15 +0530 | [diff] [blame] | 507 | uint32_t min_prefill_lines = 0; |
Ramkumar Radhakrishnan | a38b760 | 2018-03-15 14:49:52 -0700 | [diff] [blame] | 508 | int secure_disp_blend_stage = -1; |
Sushil Chauhan | c75358e | 2018-04-24 14:36:38 -0700 | [diff] [blame] | 509 | bool concurrent_writeback = false; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 510 | }; |
| 511 | |
| 512 | enum struct DRMPlaneType { |
| 513 | // Has CSC and scaling capability |
| 514 | VIG = 0, |
| 515 | // Has scaling capability but no CSC |
| 516 | RGB, |
| 517 | // No scaling support |
| 518 | DMA, |
| 519 | // Supports a small dimension and doesn't use a CRTC stage |
| 520 | CURSOR, |
| 521 | MAX, |
| 522 | }; |
| 523 | |
Arun Kumar K.R | 5d30ab5 | 2017-12-28 09:05:36 +0530 | [diff] [blame] | 524 | enum struct DRMTonemapLutType { |
| 525 | DMA_1D_GC, |
| 526 | DMA_1D_IGC, |
| 527 | VIG_1D_IGC, |
| 528 | VIG_3D_GAMUT, |
| 529 | }; |
| 530 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 531 | struct DRMPlaneTypeInfo { |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 532 | DRMPlaneType type; |
| 533 | uint32_t master_plane_id; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 534 | // FourCC format enum and modifier |
| 535 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 536 | uint32_t max_linewidth; |
Mathew Joseph Karimpanal | 1f8a21c | 2017-10-20 20:47:42 +0530 | [diff] [blame] | 537 | uint32_t max_scaler_linewidth; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 538 | uint32_t max_upscale; |
| 539 | uint32_t max_downscale; |
| 540 | uint32_t max_horizontal_deci; |
| 541 | uint32_t max_vertical_deci; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 542 | uint64_t max_pipe_bandwidth; |
Rohit Kulkarni | 8622e36 | 2017-01-30 18:14:10 -0800 | [diff] [blame] | 543 | uint32_t cache_size; // cache size in bytes for inline rotation support. |
Namit Solanki | 6d0d806 | 2017-11-30 17:29:48 +0530 | [diff] [blame] | 544 | bool has_excl_rect = false; |
Rohit Kulkarni | bfa855c | 2017-06-29 17:52:10 -0700 | [diff] [blame] | 545 | QSEEDStepVersion qseed3_version; |
Ramkumar Radhakrishnan | 0725430 | 2017-11-13 16:18:22 -0800 | [diff] [blame] | 546 | bool multirect_prop_present = false; |
Rohit Kulkarni | 2d7151c | 2017-12-14 22:17:49 -0800 | [diff] [blame] | 547 | InlineRotationVersion inrot_version; // inline rotation version |
Arun Kumar K.R | 5d30ab5 | 2017-12-28 09:05:36 +0530 | [diff] [blame] | 548 | bool inverse_pma = false; |
| 549 | uint32_t dgm_csc_version = 0; // csc used with DMA |
| 550 | std::map<DRMTonemapLutType, uint32_t> tonemap_lut_version_map = {}; |
Ramkumar Radhakrishnan | 4a26975 | 2018-03-08 14:53:15 -0800 | [diff] [blame] | 551 | bool block_sec_ui = false; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 552 | }; |
| 553 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 554 | // All DRM Planes as map<Plane_id , plane_type_info> listed from highest to lowest priority |
| 555 | typedef std::vector<std::pair<uint32_t, DRMPlaneTypeInfo>> DRMPlanesInfo; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 556 | |
| 557 | enum struct DRMTopology { |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 558 | UNKNOWN, // To be compat with driver defs in sde_rm.h |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 559 | SINGLE_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 560 | SINGLE_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 561 | DUAL_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 562 | DUAL_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 563 | DUAL_LM_MERGE, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 564 | DUAL_LM_MERGE_DSC, |
| 565 | DUAL_LM_DSCMERGE, |
| 566 | PPSPLIT, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 567 | }; |
| 568 | |
| 569 | enum struct DRMPanelMode { |
| 570 | VIDEO, |
| 571 | COMMAND, |
| 572 | }; |
| 573 | |
Saurabh Shah | 7e16c93 | 2017-11-03 17:55:36 -0700 | [diff] [blame] | 574 | /* Per mode info */ |
| 575 | struct DRMModeInfo { |
| 576 | drmModeModeInfo mode; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 577 | DRMTopology topology; |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 578 | // Valid only if mode is command |
| 579 | int num_roi; |
| 580 | int xstart; |
| 581 | int ystart; |
| 582 | int walign; |
| 583 | int halign; |
| 584 | int wmin; |
| 585 | int hmin; |
| 586 | bool roi_merge; |
Pullakavi Srinivas | 9189e60 | 2018-12-19 16:58:07 +0530 | [diff] [blame] | 587 | uint64_t bit_clk_rate; |
Mahesh Aia | 25b2271 | 2019-01-04 11:49:46 -0800 | [diff] [blame] | 588 | uint32_t transfer_time_us; |
Saurabh Shah | 7e16c93 | 2017-11-03 17:55:36 -0700 | [diff] [blame] | 589 | }; |
| 590 | |
| 591 | /* Per Connector Info*/ |
| 592 | struct DRMConnectorInfo { |
| 593 | uint32_t mmWidth; |
| 594 | uint32_t mmHeight; |
| 595 | uint32_t type; |
| 596 | std::vector<DRMModeInfo> modes; |
| 597 | std::string panel_name; |
| 598 | DRMPanelMode panel_mode; |
| 599 | bool is_primary; |
| 600 | // Valid only if DRMPanelMode is VIDEO |
| 601 | bool dynamic_fps; |
| 602 | // FourCC format enum and modifier |
| 603 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 604 | // Valid only if type is DRM_MODE_CONNECTOR_VIRTUAL |
| 605 | uint32_t max_linewidth; |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 606 | DRMRotation panel_orientation; |
Sushil Chauhan | 80e5843 | 2017-07-06 11:39:17 -0700 | [diff] [blame] | 607 | drm_panel_hdr_properties panel_hdr_prop; |
Srikanth Rajagopalan | ce0f7cb | 2017-06-12 15:14:26 -0700 | [diff] [blame] | 608 | drm_msm_ext_hdr_properties ext_hdr_prop; |
Sushil Chauhan | 8f514a5 | 2018-02-27 17:35:44 -0800 | [diff] [blame] | 609 | bool qsync_support; |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 610 | // Connection status of this connector |
| 611 | bool is_connected; |
Ramakant Singh | dbe738a | 2018-08-23 23:57:07 +0530 | [diff] [blame] | 612 | bool is_wb_ubwc_supported; |
Mathew Joseph Karimpanal | b7f20c6 | 2018-10-09 12:17:20 +0530 | [diff] [blame] | 613 | uint32_t topology_control; |
Pullakavi Srinivas | 9189e60 | 2018-12-19 16:58:07 +0530 | [diff] [blame] | 614 | bool dyn_bitclk_support; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 615 | }; |
| 616 | |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 617 | // All DRM Connectors as map<Connector_id , connector_info> |
| 618 | typedef std::map<uint32_t, DRMConnectorInfo> DRMConnectorsInfo; |
| 619 | |
| 620 | /* Per Encoder Info */ |
| 621 | struct DRMEncoderInfo { |
| 622 | uint32_t type; |
| 623 | }; |
| 624 | |
| 625 | // All DRM Encoders as map<Encoder_id , encoder_info> |
| 626 | typedef std::map<uint32_t, DRMEncoderInfo> DRMEncodersInfo; |
| 627 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 628 | /* Identifier token for a display */ |
| 629 | struct DRMDisplayToken { |
| 630 | uint32_t conn_id; |
| 631 | uint32_t crtc_id; |
Saurabh Shah | f822671 | 2018-02-05 15:51:53 -0800 | [diff] [blame] | 632 | uint32_t crtc_index; |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 633 | uint32_t encoder_id; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 634 | }; |
| 635 | |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 636 | enum DRMPPFeatureID { |
| 637 | kFeaturePcc, |
| 638 | kFeatureIgc, |
| 639 | kFeaturePgc, |
| 640 | kFeatureMixerGc, |
| 641 | kFeaturePaV2, |
| 642 | kFeatureDither, |
| 643 | kFeatureGamut, |
| 644 | kFeaturePADither, |
Rajesh Yadav | d30b0cc | 2017-09-22 00:26:54 +0530 | [diff] [blame] | 645 | kFeaturePAHsic, |
| 646 | kFeaturePASixZone, |
Rajesh Yadav | 99535ac | 2017-08-28 16:33:04 +0530 | [diff] [blame] | 647 | kFeaturePAMemColSkin, |
| 648 | kFeaturePAMemColSky, |
| 649 | kFeaturePAMemColFoliage, |
| 650 | kFeaturePAMemColProt, |
Rajesh Yadav | c4f67b8 | 2017-11-15 20:37:13 +0530 | [diff] [blame] | 651 | kFeatureDgmIgc, |
| 652 | kFeatureDgmGc, |
| 653 | kFeatureVigIgc, |
| 654 | kFeatureVigGamut, |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 655 | kPPFeaturesMax, |
| 656 | }; |
| 657 | |
| 658 | enum DRMPPPropType { |
| 659 | kPropEnum, |
| 660 | kPropRange, |
| 661 | kPropBlob, |
| 662 | kPropTypeMax, |
| 663 | }; |
| 664 | |
| 665 | struct DRMPPFeatureInfo { |
| 666 | DRMPPFeatureID id; |
| 667 | DRMPPPropType type; |
| 668 | uint32_t version; |
| 669 | uint32_t payload_size; |
| 670 | void *payload; |
Gopikrishnaiah Anandan | 739faf9 | 2017-07-21 12:32:00 -0700 | [diff] [blame] | 671 | uint32_t object_type; |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 672 | }; |
| 673 | |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 674 | enum DRMDPPSFeatureID { |
| 675 | // Ad4 properties |
| 676 | kFeatureAd4Mode, |
| 677 | kFeatureAd4Init, |
| 678 | kFeatureAd4Cfg, |
| 679 | kFeatureAd4Input, |
Yuchao Ma | 577f0f7 | 2018-07-09 11:20:00 +0800 | [diff] [blame] | 680 | kFeatureAd4Roi, |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 681 | kFeatureAd4Backlight, |
| 682 | kFeatureAd4Assertiveness, |
| 683 | kFeatureAd4ManualStrength, |
| 684 | // ABA properties |
| 685 | kFeatureAbaHistCtrl, |
| 686 | kFeatureAbaHistIRQ, |
| 687 | kFeatureAbaLut, |
| 688 | // BL scale properties |
| 689 | kFeatureAd4BlScale, |
| 690 | kFeatureBacklightScale, |
| 691 | // Events |
| 692 | kFeaturePowerEvent, |
| 693 | kFeatureAbaHistEvent, |
| 694 | kFeatureBackLightEvent, |
| 695 | kFeatureAdAttBlEvent, |
| 696 | // Insert features above |
| 697 | kDppsFeaturesMax, |
| 698 | }; |
| 699 | |
Ping Li | 6a74d89 | 2018-05-02 15:54:58 -0700 | [diff] [blame] | 700 | struct DppsFeaturePayload { |
| 701 | uint32_t object_type; |
| 702 | uint32_t feature_id; |
| 703 | uint64_t value; |
| 704 | }; |
| 705 | |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 706 | struct DRMDppsFeatureInfo { |
| 707 | DRMDPPSFeatureID id; |
| 708 | uint32_t version; |
| 709 | }; |
| 710 | |
| 711 | enum AD4Modes { |
| 712 | kAd4Off, |
| 713 | kAd4AutoStrength, |
| 714 | kAd4Calibration, |
| 715 | kAd4Manual, |
| 716 | kAd4ModeMax, |
| 717 | }; |
| 718 | |
| 719 | enum HistModes { |
| 720 | kHistDisabled, |
| 721 | kHistEnabled, |
| 722 | }; |
| 723 | |
| 724 | struct DRMDppsEventInfo { |
| 725 | uint32_t object_type; |
| 726 | uint32_t event_type; |
| 727 | int drm_fd; |
| 728 | bool enable; |
| 729 | }; |
| 730 | |
Ping Li | 8d6dd62 | 2017-07-03 12:05:15 -0700 | [diff] [blame] | 731 | enum DRMCscType { |
| 732 | kCscYuv2Rgb601L, |
| 733 | kCscYuv2Rgb601FR, |
| 734 | kCscYuv2Rgb709L, |
| 735 | kCscYuv2Rgb2020L, |
| 736 | kCscYuv2Rgb2020FR, |
| 737 | kCscTypeMax, |
| 738 | }; |
| 739 | |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 740 | struct DRMScalerLUTInfo { |
| 741 | uint32_t dir_lut_size = 0; |
| 742 | uint32_t cir_lut_size = 0; |
| 743 | uint32_t sep_lut_size = 0; |
| 744 | uint64_t dir_lut = 0; |
| 745 | uint64_t cir_lut = 0; |
| 746 | uint64_t sep_lut = 0; |
| 747 | }; |
| 748 | |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 749 | enum struct DRMSecureMode { |
| 750 | NON_SECURE, |
| 751 | SECURE, |
| 752 | NON_SECURE_DIR_TRANSLATION, |
| 753 | SECURE_DIR_TRANSLATION, |
| 754 | }; |
| 755 | |
| 756 | enum struct DRMSecurityLevel { |
| 757 | SECURE_NON_SECURE, |
| 758 | SECURE_ONLY, |
| 759 | }; |
| 760 | |
Ramkumar Radhakrishnan | 0725430 | 2017-11-13 16:18:22 -0800 | [diff] [blame] | 761 | enum struct DRMMultiRectMode { |
| 762 | NONE = 0, |
| 763 | PARALLEL = 1, |
| 764 | SERIAL = 2, |
| 765 | }; |
| 766 | |
Sushil Chauhan | 741ac31 | 2018-04-02 12:22:16 -0700 | [diff] [blame] | 767 | enum struct DRMCWbCaptureMode { |
| 768 | MIXER_OUT = 0, |
| 769 | DSPP_OUT = 1, |
| 770 | }; |
| 771 | |
Sushil Chauhan | 8f514a5 | 2018-02-27 17:35:44 -0800 | [diff] [blame] | 772 | enum struct DRMQsyncMode { |
| 773 | NONE = 0, |
| 774 | CONTINUOUS, |
| 775 | }; |
| 776 | |
Mathew Joseph Karimpanal | b7f20c6 | 2018-10-09 12:17:20 +0530 | [diff] [blame] | 777 | enum struct DRMTopologyControl { |
| 778 | NONE = 0, |
| 779 | RESERVE_LOCK = 1 << 0, |
| 780 | RESERVE_CLEAR = 1 << 1, |
| 781 | DSPP = 1 << 2, |
| 782 | DEST_SCALER = 1 << 3, |
| 783 | }; |
| 784 | |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 785 | struct DRMSolidfillStage { |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 786 | DRMRect bounding_rect {}; |
| 787 | bool is_exclusion_rect = false; |
| 788 | uint32_t color = 0xff000000; // in 8bit argb |
| 789 | uint32_t red = 0; |
| 790 | uint32_t blue = 0; |
| 791 | uint32_t green = 0; |
| 792 | uint32_t alpha = 0xff; |
| 793 | uint32_t color_bit_depth = 0; |
| 794 | uint32_t z_order = 0; |
| 795 | uint32_t plane_alpha = 0xff; |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 796 | }; |
| 797 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 798 | /* DRM Atomic Request Property Set. |
| 799 | * |
| 800 | * Helper class to create and populate atomic properties of DRM components |
| 801 | * when rendered in DRM atomic mode */ |
| 802 | class DRMAtomicReqInterface { |
| 803 | public: |
| 804 | virtual ~DRMAtomicReqInterface() {} |
| 805 | /* Perform request operation. |
| 806 | * |
| 807 | * [input]: opcode: operation code from DRMOps list. |
Saurabh Shah | 1abcdf6 | 2017-11-21 14:03:22 -0800 | [diff] [blame] | 808 | * obj_id: Relevant crtc, connector, plane id |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 809 | * var_arg: arguments for DRMOps's can differ in number and |
| 810 | * data type. Refer above DRMOps to details. |
| 811 | * [return]: Error code if the API fails, 0 on success. |
| 812 | */ |
Saurabh Shah | 1abcdf6 | 2017-11-21 14:03:22 -0800 | [diff] [blame] | 813 | virtual int Perform(DRMOps opcode, uint32_t obj_id, ...) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 814 | |
| 815 | /* |
| 816 | * Commit the params set via Perform(). Also resets the properties after commit. Needs to be |
| 817 | * called every frame. |
| 818 | * [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] | 819 | * [input]: retain_planes: Retains already staged planes. Useful when not explicitly programming |
| 820 | * planes but still need the previously staged ones to not be unstaged |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 821 | * [return]: Error code if the API fails, 0 on success. |
| 822 | */ |
Saurabh Shah | a917aa7 | 2017-09-15 13:27:24 -0700 | [diff] [blame] | 823 | virtual int Commit(bool synchronous, bool retain_planes) = 0; |
Varun Arora | baa1647 | 2018-08-16 16:19:59 -0700 | [diff] [blame] | 824 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 825 | /* |
| 826 | * Validate the params set via Perform(). |
| 827 | * [return]: Error code if the API fails, 0 on success. |
| 828 | */ |
| 829 | virtual int Validate() = 0; |
| 830 | }; |
| 831 | |
| 832 | class DRMManagerInterface; |
| 833 | |
| 834 | /* Populates a singleton instance of DRMManager */ |
| 835 | typedef int (*GetDRMManager)(int fd, DRMManagerInterface **intf); |
| 836 | |
| 837 | /* Destroy DRMManager instance */ |
Saurabh Shah | ab7807c | 2017-02-08 15:41:08 -0800 | [diff] [blame] | 838 | typedef int (*DestroyDRMManager)(); |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 839 | |
| 840 | /* |
| 841 | * DRM Manager Interface - Any class which plans to implement helper function for vendor |
| 842 | * specific DRM driver implementation must implement the below interface routines to work |
| 843 | * with SDM. |
| 844 | */ |
| 845 | |
| 846 | class DRMManagerInterface { |
| 847 | public: |
| 848 | virtual ~DRMManagerInterface() {} |
| 849 | |
| 850 | /* |
| 851 | * Since SDM completely manages the planes. GetPlanesInfo will provide all |
| 852 | * the plane information. |
| 853 | * [output]: DRMPlanesInfo: Resource Info for planes. |
| 854 | */ |
| 855 | virtual void GetPlanesInfo(DRMPlanesInfo *info) = 0; |
| 856 | |
| 857 | /* |
| 858 | * Will provide all the information of a selected crtc. |
| 859 | * [input]: Use crtc id 0 to obtain system wide info |
| 860 | * [output]: DRMCrtcInfo: Resource Info for the given CRTC id. |
Mathew Joseph Karimpanal | 43c9d69 | 2018-06-14 13:45:27 +0530 | [diff] [blame] | 861 | * [return]: 0 on success, a negative error value otherwise. |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 862 | */ |
Mathew Joseph Karimpanal | 43c9d69 | 2018-06-14 13:45:27 +0530 | [diff] [blame] | 863 | virtual int GetCrtcInfo(uint32_t crtc_id, DRMCrtcInfo *info) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 864 | |
| 865 | /* |
| 866 | * Will provide all the information of a selected connector. |
| 867 | * [output]: DRMConnectorInfo: Resource Info for the given connector id |
Mathew Joseph Karimpanal | 43c9d69 | 2018-06-14 13:45:27 +0530 | [diff] [blame] | 868 | * [return]: 0 on success, a negative error value otherwise. |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 869 | */ |
Mathew Joseph Karimpanal | 43c9d69 | 2018-06-14 13:45:27 +0530 | [diff] [blame] | 870 | virtual int GetConnectorInfo(uint32_t conn_id, DRMConnectorInfo *info) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 871 | |
| 872 | /* |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 873 | * Provides information on all connectors. |
| 874 | * [output]: DRMConnectorsInfo: Resource info for connectors. |
| 875 | * [return]: 0 on success, a negative error value otherwise. |
| 876 | */ |
| 877 | virtual int GetConnectorsInfo(DRMConnectorsInfo *info) = 0; |
| 878 | |
| 879 | /* |
| 880 | * Provides information on a selected encoder. |
| 881 | * [output]: DRMEncoderInfo: Resource info for the given encoder id. |
| 882 | * [return]: 0 on success, a negative error value otherwise. |
| 883 | */ |
| 884 | virtual int GetEncoderInfo(uint32_t encoder_id, DRMEncoderInfo *info) = 0; |
| 885 | |
| 886 | /* |
| 887 | * Provides information on all encoders. |
| 888 | * [output]: DRMEncodersInfo: Resource info for encoders. |
| 889 | * [return]: 0 on success, a negative error value otherwise. |
| 890 | */ |
| 891 | virtual int GetEncodersInfo(DRMEncodersInfo *info) = 0; |
| 892 | |
| 893 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 894 | * Will query post propcessing feature info of a CRTC. |
| 895 | * [output]: DRMPPFeatureInfo: CRTC post processing feature info |
| 896 | */ |
Namit Solanki | 24921ab | 2017-05-23 20:16:25 +0530 | [diff] [blame] | 897 | virtual void GetCrtcPPInfo(uint32_t crtc_id, DRMPPFeatureInfo *info) = 0; |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 898 | |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 899 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 900 | * Register a logical display to receive a token. |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 901 | * Each display pipeline in DRM is identified by its CRTC and Connector(s). On display connect |
| 902 | * (bootup or hotplug), clients should invoke this interface to establish the pipeline for the |
| 903 | * display and should get a DisplayToken populated with crtc, encoder and connnector(s) id's. Here |
| 904 | * onwards, Client should use this token to represent the display for any Perform operations if |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 905 | * needed. |
| 906 | * |
| 907 | * [input]: disp_type - Peripheral / TV / Virtual |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 908 | * [output]: DRMDisplayToken - CRTC and Connector IDs for the display. |
| 909 | * [return]: 0 on success, a negative error value otherwise. |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 910 | */ |
| 911 | virtual int RegisterDisplay(DRMDisplayType disp_type, DRMDisplayToken *tok) = 0; |
| 912 | |
Mathew Joseph Karimpanal | 731bc93 | 2017-11-22 10:04:56 +0530 | [diff] [blame] | 913 | /* |
| 914 | * Register a logical display to receive a token. |
| 915 | * Each display pipeline in DRM is identified by its CRTC and Connector(s). On display connect |
| 916 | * (bootup or hotplug), clients should invoke this interface to establish the pipeline for the |
| 917 | * display and should get a DisplayToken populated with crtc, encoder and connnector(s) id's. Here |
| 918 | * onwards, Client should use this token to represent the display for any Perform operations if |
| 919 | * needed. |
| 920 | * |
| 921 | * [input]: display_id - Connector ID |
| 922 | * [output]: DRMDisplayToken - CRTC and Connector id's for the display. |
| 923 | * [return]: 0 on success, a negative error value otherwise. |
| 924 | */ |
| 925 | virtual int RegisterDisplay(int32_t display_id, DRMDisplayToken *tok) = 0; |
| 926 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 927 | /* Client should invoke this interface on display disconnect. |
| 928 | * [input]: DRMDisplayToken - identifier for the display. |
| 929 | */ |
| 930 | virtual void UnregisterDisplay(const DRMDisplayToken &token) = 0; |
| 931 | |
| 932 | /* |
| 933 | * Creates and returns an instance of DRMAtomicReqInterface corresponding to a display token |
| 934 | * returned as part of RegisterDisplay API. Needs to be called per display. |
| 935 | * [input]: DRMDisplayToken that identifies a display pipeline |
| 936 | * [output]: Pointer to an instance of DRMAtomicReqInterface. |
| 937 | * [return]: Error code if the API fails, 0 on success. |
| 938 | */ |
| 939 | virtual int CreateAtomicReq(const DRMDisplayToken &token, DRMAtomicReqInterface **intf) = 0; |
| 940 | |
| 941 | /* |
| 942 | * Destroys the instance of DRMAtomicReqInterface |
| 943 | * [input]: Pointer to a DRMAtomicReqInterface |
| 944 | * [return]: Error code if the API fails, 0 on success. |
| 945 | */ |
| 946 | virtual int DestroyAtomicReq(DRMAtomicReqInterface *intf) = 0; |
Varun Arora | baa1647 | 2018-08-16 16:19:59 -0700 | [diff] [blame] | 947 | |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 948 | /* |
| 949 | * Sets the global scaler LUT |
| 950 | * [input]: LUT Info |
| 951 | * [return]: Error code if the API fails, 0 on success. |
| 952 | */ |
| 953 | virtual int SetScalerLUT(const DRMScalerLUTInfo &lut_info) = 0; |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 954 | |
| 955 | /* |
Varun Arora | baa1647 | 2018-08-16 16:19:59 -0700 | [diff] [blame] | 956 | * Unsets the global scaler LUT |
| 957 | * [input]: None |
| 958 | * [return]: Error code if the API fails, 0 on success. |
| 959 | */ |
| 960 | virtual int UnsetScalerLUT() = 0; |
| 961 | |
| 962 | /* |
Xu Yang | 32e58c2 | 2017-11-20 09:58:11 +0800 | [diff] [blame] | 963 | * Get the DPPS feature info |
| 964 | * [input]: Dpps feature id, info->id |
| 965 | * [output]: Dpps feature version, info->version |
| 966 | */ |
| 967 | virtual void GetDppsFeatureInfo(DRMDppsFeatureInfo *info) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 968 | }; |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 969 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 970 | } // namespace sde_drm |
| 971 | #endif // __DRM_INTERFACE_H__ |