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