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 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 141 | * Op: Activate or deactivate a CRTC |
| 142 | * Arg: uint32_t - CRTC ID |
| 143 | * uint32_t - 1 to enable, 0 to disable |
| 144 | */ |
| 145 | CRTC_SET_ACTIVE, |
| 146 | /* |
| 147 | * Op: Sets display mode |
| 148 | * Arg: uint32_t - CRTC ID |
| 149 | * drmModeModeInfo* - Pointer to display mode |
| 150 | */ |
| 151 | CRTC_SET_MODE, |
| 152 | /* |
| 153 | * Op: Sets an offset indicating when a release fence should be signalled. |
| 154 | * Arg: uint32_t - offset |
| 155 | * 0: non-speculative, default |
| 156 | * 1: speculative |
| 157 | */ |
| 158 | CRTC_SET_OUTPUT_FENCE_OFFSET, |
| 159 | /* |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 160 | * Op: Sets overall SDE core clock |
| 161 | * Arg: uint32_t - CRTC ID |
| 162 | * uint32_t - core_clk |
| 163 | */ |
| 164 | CRTC_SET_CORE_CLK, |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 165 | /* |
| 166 | * Op: Sets MNOC bus average bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 167 | * Arg: uint32_t - CRTC ID |
| 168 | * uint32_t - core_ab |
| 169 | */ |
| 170 | CRTC_SET_CORE_AB, |
| 171 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 172 | * Op: Sets MNOC bus instantaneous bandwidth |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 173 | * Arg: uint32_t - CRTC ID |
| 174 | * uint32_t - core_ib |
| 175 | */ |
| 176 | CRTC_SET_CORE_IB, |
| 177 | /* |
Ramkumar Radhakrishnan | 3c4de11 | 2017-05-24 22:38:30 -0700 | [diff] [blame] | 178 | * Op: Sets LLCC Bus average bandwidth |
| 179 | * Arg: uint32_t - CRTC ID |
| 180 | * uint32_t - llcc_ab |
| 181 | */ |
| 182 | CRTC_SET_LLCC_AB, |
| 183 | /* |
| 184 | * Op: Sets LLCC Bus instantaneous bandwidth |
| 185 | * Arg: uint32_t - CRTC ID |
| 186 | * uint32_t - llcc_ib |
| 187 | */ |
| 188 | CRTC_SET_LLCC_IB, |
| 189 | /* |
| 190 | * Op: Sets DRAM bus average bandwidth |
| 191 | * Arg: uint32_t - CRTC ID |
| 192 | * uint32_t - dram_ab |
| 193 | */ |
| 194 | CRTC_SET_DRAM_AB, |
| 195 | /* |
| 196 | * Op: Sets DRAM bus instantaneous bandwidth |
| 197 | * Arg: uint32_t - CRTC ID |
| 198 | * uint32_t - dram_ib |
| 199 | */ |
| 200 | CRTC_SET_DRAM_IB, |
| 201 | /* |
| 202 | * Op: Sets rotator clock for inline rotation |
| 203 | * Arg: uint32_t - CRTC ID |
| 204 | * uint32_t - rot_clk |
| 205 | */ |
| 206 | CRTC_SET_ROT_CLK, /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 207 | * Op: Returns release fence for this frame. Should be called after Commit() on |
| 208 | * DRMAtomicReqInterface. |
| 209 | * Arg: uint32_t - CRTC ID |
| 210 | * int * - Pointer to an integer that will hold the returned fence |
| 211 | */ |
| 212 | CRTC_GET_RELEASE_FENCE, |
| 213 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 214 | * Op: Sets PP feature |
| 215 | * Arg: uint32_t - CRTC ID |
| 216 | * DRMPPFeatureInfo * - PP feature data pointer |
| 217 | */ |
| 218 | CRTC_SET_POST_PROC, |
| 219 | /* |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 220 | * Op: Sets CRTC ROIs. |
| 221 | * Arg: uint32_t - CRTC ID |
| 222 | * uint32_t - number of ROIs |
| 223 | * DRMRect * - Array of CRTC ROIs |
| 224 | */ |
| 225 | CRTC_SET_ROI, |
| 226 | /* |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 227 | * Op: Sets Security level for CRTC. |
| 228 | * Arg: uint32_t - CRTC ID |
| 229 | * uint32_t - Security level |
| 230 | */ |
| 231 | CRTC_SET_SECURITY_LEVEL, |
| 232 | /* |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 233 | * Op: sets solid fill stages |
| 234 | * Arg: uint32_t - CRTC ID |
| 235 | * Vector of DRMSolidfillStage |
| 236 | */ |
| 237 | CRTC_SET_SOLIDFILL_STAGES, |
| 238 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 239 | * Op: Returns retire fence for this commit. Should be called after Commit() on |
| 240 | * DRMAtomicReqInterface. |
| 241 | * Arg: uint32_t - Connector ID |
| 242 | * int * - Pointer to an integer that will hold the returned fence |
| 243 | */ |
| 244 | CONNECTOR_GET_RETIRE_FENCE, |
| 245 | /* |
| 246 | * Op: Sets writeback connector destination rect |
| 247 | * Arg: uint32_t - Connector ID |
| 248 | * DRMRect - Dst Rectangle |
| 249 | */ |
| 250 | CONNECTOR_SET_OUTPUT_RECT, |
| 251 | /* |
| 252 | * Op: Sets frame buffer ID for writeback connector. |
| 253 | * Arg: uint32_t - Connector ID |
| 254 | * uint32_t - Framebuffer ID |
| 255 | */ |
| 256 | CONNECTOR_SET_OUTPUT_FB_ID, |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 257 | /* |
| 258 | * Op: Sets power mode for connector. |
| 259 | * Arg: uint32_t - Connector ID |
| 260 | * uint32_t - Power Mode |
| 261 | */ |
| 262 | CONNECTOR_SET_POWER_MODE, |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 263 | /* |
| 264 | * Op: Sets panel ROIs. |
| 265 | * Arg: uint32_t - Connector ID |
| 266 | * uint32_t - number of ROIs |
| 267 | * DRMRect * - Array of Connector ROIs |
| 268 | */ |
| 269 | CONNECTOR_SET_ROI, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 270 | }; |
| 271 | |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 272 | enum struct DRMRotation { |
| 273 | FLIP_H = 0x1, |
| 274 | FLIP_V = 0x2, |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 275 | ROT_180 = FLIP_H | FLIP_V, |
Saurabh Shah | f9266ee | 2017-04-19 15:25:46 -0700 | [diff] [blame] | 276 | ROT_90 = 0x4, |
| 277 | }; |
| 278 | |
Sushil Chauhan | 3396e20 | 2017-04-14 18:34:22 -0700 | [diff] [blame] | 279 | enum struct DRMPowerMode { |
| 280 | ON, |
| 281 | DOZE, |
| 282 | DOZE_SUSPEND, |
| 283 | OFF, |
| 284 | }; |
| 285 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 286 | enum struct DRMBlendType { |
| 287 | UNDEFINED = 0, |
| 288 | OPAQUE = 1, |
| 289 | PREMULTIPLIED = 2, |
| 290 | COVERAGE = 3, |
| 291 | }; |
| 292 | |
Prabhanjan Kandula | 585aa65 | 2017-01-26 18:39:11 -0800 | [diff] [blame] | 293 | enum struct DRMSrcConfig { |
| 294 | DEINTERLACE = 0, |
| 295 | }; |
| 296 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 297 | /* Display type to identify a suitable connector */ |
| 298 | enum struct DRMDisplayType { |
| 299 | PERIPHERAL, |
| 300 | TV, |
| 301 | VIRTUAL, |
| 302 | }; |
| 303 | |
| 304 | struct DRMRect { |
| 305 | uint32_t left; // Left-most pixel coordinate. |
| 306 | uint32_t top; // Top-most pixel coordinate. |
| 307 | uint32_t right; // Right-most pixel coordinate. |
| 308 | uint32_t bottom; // Bottom-most pixel coordinate. |
| 309 | }; |
| 310 | |
| 311 | //------------------------------------------------------------------------ |
| 312 | // DRM Info Query Types |
| 313 | //------------------------------------------------------------------------ |
| 314 | |
| 315 | enum struct QSEEDVersion { |
| 316 | V1, |
| 317 | V2, |
| 318 | V3, |
| 319 | }; |
| 320 | |
Rohit Kulkarni | bfa855c | 2017-06-29 17:52:10 -0700 | [diff] [blame] | 321 | /* QSEED3 Step version */ |
| 322 | enum struct QSEEDStepVersion { |
| 323 | V2, |
| 324 | V3, |
| 325 | V4, |
| 326 | }; |
| 327 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 328 | enum struct SmartDMARevision { |
| 329 | V1, |
| 330 | V2, |
| 331 | }; |
| 332 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 333 | /* Per CRTC Resource Info*/ |
| 334 | struct DRMCrtcInfo { |
| 335 | bool has_src_split; |
| 336 | uint32_t max_blend_stages; |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 337 | uint32_t max_solidfill_stages; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 338 | QSEEDVersion qseed_version; |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 339 | SmartDMARevision smart_dma_rev; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 340 | float ib_fudge_factor; |
| 341 | float clk_fudge_factor; |
| 342 | uint32_t dest_scale_prefill_lines; |
| 343 | uint32_t undersized_prefill_lines; |
| 344 | uint32_t macrotile_prefill_lines; |
| 345 | uint32_t nv12_prefill_lines; |
| 346 | uint32_t linear_prefill_lines; |
| 347 | uint32_t downscale_prefill_lines; |
| 348 | uint32_t extra_prefill_lines; |
| 349 | uint32_t amortized_threshold; |
| 350 | uint64_t max_bandwidth_low; |
| 351 | uint64_t max_bandwidth_high; |
| 352 | uint32_t max_sde_clk; |
| 353 | CompRatioMap comp_ratio_rt_map; |
| 354 | CompRatioMap comp_ratio_nrt_map; |
Gopikrishnaiah Anandan | 7681552 | 2017-06-27 15:18:04 -0700 | [diff] [blame] | 355 | uint32_t hw_version; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 356 | }; |
| 357 | |
| 358 | enum struct DRMPlaneType { |
| 359 | // Has CSC and scaling capability |
| 360 | VIG = 0, |
| 361 | // Has scaling capability but no CSC |
| 362 | RGB, |
| 363 | // No scaling support |
| 364 | DMA, |
| 365 | // Supports a small dimension and doesn't use a CRTC stage |
| 366 | CURSOR, |
| 367 | MAX, |
| 368 | }; |
| 369 | |
| 370 | struct DRMPlaneTypeInfo { |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 371 | DRMPlaneType type; |
| 372 | uint32_t master_plane_id; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 373 | // FourCC format enum and modifier |
| 374 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 375 | uint32_t max_linewidth; |
| 376 | uint32_t max_upscale; |
| 377 | uint32_t max_downscale; |
| 378 | uint32_t max_horizontal_deci; |
| 379 | uint32_t max_vertical_deci; |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 380 | uint64_t max_pipe_bandwidth; |
Rohit Kulkarni | 8622e36 | 2017-01-30 18:14:10 -0800 | [diff] [blame] | 381 | uint32_t cache_size; // cache size in bytes for inline rotation support. |
Rohit Kulkarni | bfa855c | 2017-06-29 17:52:10 -0700 | [diff] [blame] | 382 | QSEEDStepVersion qseed3_version; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 383 | }; |
| 384 | |
Prabhanjan Kandula | e6dfab9 | 2017-03-14 11:02:49 -0700 | [diff] [blame] | 385 | // All DRM Planes as map<Plane_id , plane_type_info> listed from highest to lowest priority |
| 386 | typedef std::vector<std::pair<uint32_t, DRMPlaneTypeInfo>> DRMPlanesInfo; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 387 | |
| 388 | enum struct DRMTopology { |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 389 | UNKNOWN, // To be compat with driver defs in sde_rm.h |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 390 | SINGLE_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 391 | SINGLE_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 392 | DUAL_LM, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 393 | DUAL_LM_DSC, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 394 | DUAL_LM_MERGE, |
Rohit Kulkarni | 2faa91c | 2017-06-05 15:43:48 -0700 | [diff] [blame] | 395 | DUAL_LM_MERGE_DSC, |
| 396 | DUAL_LM_DSCMERGE, |
| 397 | PPSPLIT, |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 398 | }; |
| 399 | |
| 400 | enum struct DRMPanelMode { |
| 401 | VIDEO, |
| 402 | COMMAND, |
| 403 | }; |
| 404 | |
| 405 | /* Per Connector Info*/ |
| 406 | struct DRMConnectorInfo { |
| 407 | uint32_t mmWidth; |
| 408 | uint32_t mmHeight; |
| 409 | uint32_t type; |
Saurabh Shah | e618eb0 | 2017-07-27 14:32:10 -0700 | [diff] [blame] | 410 | std::vector<drmModeModeInfo> modes; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 411 | DRMTopology topology; |
| 412 | std::string panel_name; |
| 413 | DRMPanelMode panel_mode; |
| 414 | bool is_primary; |
| 415 | // Valid only if DRMPanelMode is VIDEO |
| 416 | bool dynamic_fps; |
| 417 | // FourCC format enum and modifier |
| 418 | std::vector<std::pair<uint32_t, uint64_t>> formats_supported; |
| 419 | // Valid only if type is DRM_MODE_CONNECTOR_VIRTUAL |
| 420 | uint32_t max_linewidth; |
Saurabh Shah | e9f55d7 | 2017-03-03 15:14:13 -0800 | [diff] [blame] | 421 | // Valid only if mode is command |
| 422 | int num_roi; |
| 423 | int xstart; |
| 424 | int ystart; |
| 425 | int walign; |
| 426 | int halign; |
| 427 | int wmin; |
| 428 | int hmin; |
| 429 | bool roi_merge; |
Prabhanjan Kandula | 5bc7f8b | 2017-05-23 12:24:57 -0700 | [diff] [blame] | 430 | DRMRotation panel_orientation; |
Sushil Chauhan | 80e5843 | 2017-07-06 11:39:17 -0700 | [diff] [blame] | 431 | drm_panel_hdr_properties panel_hdr_prop; |
Ramkumar Radhakrishnan | 5c94f05 | 2017-07-06 11:59:14 -0700 | [diff] [blame] | 432 | uint32_t transfer_time_us; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 433 | }; |
| 434 | |
| 435 | /* Identifier token for a display */ |
| 436 | struct DRMDisplayToken { |
| 437 | uint32_t conn_id; |
| 438 | uint32_t crtc_id; |
| 439 | }; |
| 440 | |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 441 | enum DRMPPFeatureID { |
| 442 | kFeaturePcc, |
| 443 | kFeatureIgc, |
| 444 | kFeaturePgc, |
| 445 | kFeatureMixerGc, |
| 446 | kFeaturePaV2, |
| 447 | kFeatureDither, |
| 448 | kFeatureGamut, |
| 449 | kFeaturePADither, |
| 450 | kPPFeaturesMax, |
| 451 | }; |
| 452 | |
| 453 | enum DRMPPPropType { |
| 454 | kPropEnum, |
| 455 | kPropRange, |
| 456 | kPropBlob, |
| 457 | kPropTypeMax, |
| 458 | }; |
| 459 | |
| 460 | struct DRMPPFeatureInfo { |
| 461 | DRMPPFeatureID id; |
| 462 | DRMPPPropType type; |
| 463 | uint32_t version; |
| 464 | uint32_t payload_size; |
| 465 | void *payload; |
| 466 | }; |
| 467 | |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 468 | struct DRMScalerLUTInfo { |
| 469 | uint32_t dir_lut_size = 0; |
| 470 | uint32_t cir_lut_size = 0; |
| 471 | uint32_t sep_lut_size = 0; |
| 472 | uint64_t dir_lut = 0; |
| 473 | uint64_t cir_lut = 0; |
| 474 | uint64_t sep_lut = 0; |
| 475 | }; |
| 476 | |
Sushil Chauhan | 1021cc0 | 2017-05-03 15:11:43 -0700 | [diff] [blame] | 477 | enum struct DRMSecureMode { |
| 478 | NON_SECURE, |
| 479 | SECURE, |
| 480 | NON_SECURE_DIR_TRANSLATION, |
| 481 | SECURE_DIR_TRANSLATION, |
| 482 | }; |
| 483 | |
| 484 | enum struct DRMSecurityLevel { |
| 485 | SECURE_NON_SECURE, |
| 486 | SECURE_ONLY, |
| 487 | }; |
| 488 | |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 489 | struct DRMSolidfillStage { |
| 490 | DRMRect bounding_rect {}; |
| 491 | bool is_exclusion_rect = false; |
| 492 | uint32_t color = 0xff000000; // in 8bit argb |
Gopikrishnaiah Anandan | cc12306 | 2017-07-31 17:21:03 -0700 | [diff] [blame^] | 493 | uint32_t red = 0; |
| 494 | uint32_t blue = 0; |
| 495 | uint32_t green = 0; |
| 496 | uint32_t alpha = 0xff; |
| 497 | uint32_t color_bit_depth = 0; |
Prabhanjan Kandula | dbc8aed | 2017-03-24 14:43:16 -0700 | [diff] [blame] | 498 | uint32_t z_order = 0; |
| 499 | uint32_t plane_alpha = 0xff; |
| 500 | }; |
| 501 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 502 | /* DRM Atomic Request Property Set. |
| 503 | * |
| 504 | * Helper class to create and populate atomic properties of DRM components |
| 505 | * when rendered in DRM atomic mode */ |
| 506 | class DRMAtomicReqInterface { |
| 507 | public: |
| 508 | virtual ~DRMAtomicReqInterface() {} |
| 509 | /* Perform request operation. |
| 510 | * |
| 511 | * [input]: opcode: operation code from DRMOps list. |
| 512 | * var_arg: arguments for DRMOps's can differ in number and |
| 513 | * data type. Refer above DRMOps to details. |
| 514 | * [return]: Error code if the API fails, 0 on success. |
| 515 | */ |
| 516 | virtual int Perform(DRMOps opcode, ...) = 0; |
| 517 | |
| 518 | /* |
| 519 | * Commit the params set via Perform(). Also resets the properties after commit. Needs to be |
| 520 | * called every frame. |
| 521 | * [input]: synchronous: Determines if the call should block until a h/w flip |
| 522 | * [return]: Error code if the API fails, 0 on success. |
| 523 | */ |
| 524 | virtual int Commit(bool synchronous) = 0; |
| 525 | /* |
| 526 | * Validate the params set via Perform(). |
| 527 | * [return]: Error code if the API fails, 0 on success. |
| 528 | */ |
| 529 | virtual int Validate() = 0; |
| 530 | }; |
| 531 | |
| 532 | class DRMManagerInterface; |
| 533 | |
| 534 | /* Populates a singleton instance of DRMManager */ |
| 535 | typedef int (*GetDRMManager)(int fd, DRMManagerInterface **intf); |
| 536 | |
| 537 | /* Destroy DRMManager instance */ |
Saurabh Shah | ab7807c | 2017-02-08 15:41:08 -0800 | [diff] [blame] | 538 | typedef int (*DestroyDRMManager)(); |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 539 | |
| 540 | /* |
| 541 | * DRM Manager Interface - Any class which plans to implement helper function for vendor |
| 542 | * specific DRM driver implementation must implement the below interface routines to work |
| 543 | * with SDM. |
| 544 | */ |
| 545 | |
| 546 | class DRMManagerInterface { |
| 547 | public: |
| 548 | virtual ~DRMManagerInterface() {} |
| 549 | |
| 550 | /* |
| 551 | * Since SDM completely manages the planes. GetPlanesInfo will provide all |
| 552 | * the plane information. |
| 553 | * [output]: DRMPlanesInfo: Resource Info for planes. |
| 554 | */ |
| 555 | virtual void GetPlanesInfo(DRMPlanesInfo *info) = 0; |
| 556 | |
| 557 | /* |
| 558 | * Will provide all the information of a selected crtc. |
| 559 | * [input]: Use crtc id 0 to obtain system wide info |
| 560 | * [output]: DRMCrtcInfo: Resource Info for the given CRTC id. |
| 561 | */ |
| 562 | virtual void GetCrtcInfo(uint32_t crtc_id, DRMCrtcInfo *info) = 0; |
| 563 | |
| 564 | /* |
| 565 | * Will provide all the information of a selected connector. |
| 566 | * [output]: DRMConnectorInfo: Resource Info for the given connector id |
| 567 | */ |
| 568 | virtual void GetConnectorInfo(uint32_t conn_id, DRMConnectorInfo *info) = 0; |
| 569 | |
| 570 | /* |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 571 | * Will query post propcessing feature info of a CRTC. |
| 572 | * [output]: DRMPPFeatureInfo: CRTC post processing feature info |
| 573 | */ |
Ramkumar Radhakrishnan | 9ed1fd8 | 2017-03-09 18:46:41 -0800 | [diff] [blame] | 574 | virtual void GetCrtcPPInfo(uint32_t crtc_id, DRMPPFeatureInfo &info) = 0; |
Ping Li | 281f48d | 2017-01-16 12:45:40 -0800 | [diff] [blame] | 575 | /* |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 576 | * Register a logical display to receive a token. |
| 577 | * Each display pipeline in DRM is identified by its CRTC and Connector(s). |
| 578 | * On display connect(bootup or hotplug), clients should invoke this interface to |
| 579 | * establish the pipeline for the display and should get a DisplayToken |
| 580 | * populated with crtc and connnector(s) id's. Here onwards, Client should |
| 581 | * use this token to represent the display for any Perform operations if |
| 582 | * needed. |
| 583 | * |
| 584 | * [input]: disp_type - Peripheral / TV / Virtual |
| 585 | * [output]: DRMDisplayToken - CRTC and Connector id's for the display |
| 586 | * [return]: 0 on success, a negative error value otherwise |
| 587 | */ |
| 588 | virtual int RegisterDisplay(DRMDisplayType disp_type, DRMDisplayToken *tok) = 0; |
| 589 | |
| 590 | /* Client should invoke this interface on display disconnect. |
| 591 | * [input]: DRMDisplayToken - identifier for the display. |
| 592 | */ |
| 593 | virtual void UnregisterDisplay(const DRMDisplayToken &token) = 0; |
| 594 | |
| 595 | /* |
| 596 | * Creates and returns an instance of DRMAtomicReqInterface corresponding to a display token |
| 597 | * returned as part of RegisterDisplay API. Needs to be called per display. |
| 598 | * [input]: DRMDisplayToken that identifies a display pipeline |
| 599 | * [output]: Pointer to an instance of DRMAtomicReqInterface. |
| 600 | * [return]: Error code if the API fails, 0 on success. |
| 601 | */ |
| 602 | virtual int CreateAtomicReq(const DRMDisplayToken &token, DRMAtomicReqInterface **intf) = 0; |
| 603 | |
| 604 | /* |
| 605 | * Destroys the instance of DRMAtomicReqInterface |
| 606 | * [input]: Pointer to a DRMAtomicReqInterface |
| 607 | * [return]: Error code if the API fails, 0 on success. |
| 608 | */ |
| 609 | virtual int DestroyAtomicReq(DRMAtomicReqInterface *intf) = 0; |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 610 | /* |
| 611 | * Sets the global scaler LUT |
| 612 | * [input]: LUT Info |
| 613 | * [return]: Error code if the API fails, 0 on success. |
| 614 | */ |
| 615 | virtual int SetScalerLUT(const DRMScalerLUTInfo &lut_info) = 0; |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 616 | }; |
Saurabh Shah | 0ffee30 | 2016-11-22 10:42:11 -0800 | [diff] [blame] | 617 | |
Saurabh Shah | 66c941b | 2016-07-06 17:34:05 -0700 | [diff] [blame] | 618 | } // namespace sde_drm |
| 619 | #endif // __DRM_INTERFACE_H__ |