blob: 4ecfcbf5c06529e95f3f730b1227853f7764d95d [file] [log] [blame]
Saurabh Shah66c941b2016-07-06 17:34:05 -07001/*
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 Chauhan80e58432017-07-06 11:39:17 -070040#include <drm/msm_drm.h>
Saurabh Shah66c941b2016-07-06 17:34:05 -070041
42namespace sde_drm {
Ramkumar Radhakrishnan9ed1fd82017-03-09 18:46:41 -080043
44typedef std::map<std::pair<uint32_t, uint64_t>, float> CompRatioMap;
45
Saurabh Shah66c941b2016-07-06 17:34:05 -070046/*
47 * Drm Atomic Operation Codes
48 */
49enum 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 Kandula585aa652017-01-26 18:39:11 -080099 * 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 Shah66c941b2016-07-06 17:34:05 -0700105 * 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 Shah0ffee302016-11-22 10:42:11 -0800123 * 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 Kulkarni8622e362017-01-30 18:14:10 -0800129 * 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 Chauhan1021cc02017-05-03 15:11:43 -0700135 * Op: Sets FB Secure mode for this plane.
136 * Arg: uint32_t - Plane ID
137 * uint32_t - Value of the FB Secure mode.
138 */
139 PLANE_SET_FB_SECURE_MODE,
140 /*
Ping Li8d6dd622017-07-03 12:05:15 -0700141 * Op: Sets csc config on this plane.
142 * Arg: uint32_t - Plane ID
143 * uint32_t* - pointer to csc type
144 */
145 PLANE_SET_CSC_CONFIG,
146 /*
Saurabh Shah66c941b2016-07-06 17:34:05 -0700147 * Op: Activate or deactivate a CRTC
148 * Arg: uint32_t - CRTC ID
149 * uint32_t - 1 to enable, 0 to disable
150 */
151 CRTC_SET_ACTIVE,
152 /*
153 * Op: Sets display mode
154 * Arg: uint32_t - CRTC ID
155 * drmModeModeInfo* - Pointer to display mode
156 */
157 CRTC_SET_MODE,
158 /*
159 * Op: Sets an offset indicating when a release fence should be signalled.
160 * Arg: uint32_t - offset
161 * 0: non-speculative, default
162 * 1: speculative
163 */
164 CRTC_SET_OUTPUT_FENCE_OFFSET,
165 /*
Ramkumar Radhakrishnan9ed1fd82017-03-09 18:46:41 -0800166 * Op: Sets overall SDE core clock
167 * Arg: uint32_t - CRTC ID
168 * uint32_t - core_clk
169 */
170 CRTC_SET_CORE_CLK,
Ramkumar Radhakrishnan3c4de112017-05-24 22:38:30 -0700171 /*
172 * Op: Sets MNOC bus average bandwidth
Ramkumar Radhakrishnan9ed1fd82017-03-09 18:46:41 -0800173 * Arg: uint32_t - CRTC ID
174 * uint32_t - core_ab
175 */
176 CRTC_SET_CORE_AB,
177 /*
Ramkumar Radhakrishnan3c4de112017-05-24 22:38:30 -0700178 * Op: Sets MNOC bus instantaneous bandwidth
Ramkumar Radhakrishnan9ed1fd82017-03-09 18:46:41 -0800179 * Arg: uint32_t - CRTC ID
180 * uint32_t - core_ib
181 */
182 CRTC_SET_CORE_IB,
183 /*
Ramkumar Radhakrishnan3c4de112017-05-24 22:38:30 -0700184 * Op: Sets LLCC Bus average bandwidth
185 * Arg: uint32_t - CRTC ID
186 * uint32_t - llcc_ab
187 */
188 CRTC_SET_LLCC_AB,
189 /*
190 * Op: Sets LLCC Bus instantaneous bandwidth
191 * Arg: uint32_t - CRTC ID
192 * uint32_t - llcc_ib
193 */
194 CRTC_SET_LLCC_IB,
195 /*
196 * Op: Sets DRAM bus average bandwidth
197 * Arg: uint32_t - CRTC ID
198 * uint32_t - dram_ab
199 */
200 CRTC_SET_DRAM_AB,
201 /*
202 * Op: Sets DRAM bus instantaneous bandwidth
203 * Arg: uint32_t - CRTC ID
204 * uint32_t - dram_ib
205 */
206 CRTC_SET_DRAM_IB,
207 /*
208 * Op: Sets rotator clock for inline rotation
209 * Arg: uint32_t - CRTC ID
210 * uint32_t - rot_clk
211 */
212 CRTC_SET_ROT_CLK, /*
Saurabh Shah66c941b2016-07-06 17:34:05 -0700213 * Op: Returns release fence for this frame. Should be called after Commit() on
214 * DRMAtomicReqInterface.
215 * Arg: uint32_t - CRTC ID
216 * int * - Pointer to an integer that will hold the returned fence
217 */
218 CRTC_GET_RELEASE_FENCE,
219 /*
Ping Li281f48d2017-01-16 12:45:40 -0800220 * Op: Sets PP feature
221 * Arg: uint32_t - CRTC ID
222 * DRMPPFeatureInfo * - PP feature data pointer
223 */
224 CRTC_SET_POST_PROC,
225 /*
Saurabh Shahe9f55d72017-03-03 15:14:13 -0800226 * Op: Sets CRTC ROIs.
227 * Arg: uint32_t - CRTC ID
228 * uint32_t - number of ROIs
229 * DRMRect * - Array of CRTC ROIs
230 */
231 CRTC_SET_ROI,
232 /*
Sushil Chauhan1021cc02017-05-03 15:11:43 -0700233 * Op: Sets Security level for CRTC.
234 * Arg: uint32_t - CRTC ID
235 * uint32_t - Security level
236 */
237 CRTC_SET_SECURITY_LEVEL,
238 /*
Prabhanjan Kanduladbc8aed2017-03-24 14:43:16 -0700239 * Op: sets solid fill stages
240 * Arg: uint32_t - CRTC ID
241 * Vector of DRMSolidfillStage
242 */
243 CRTC_SET_SOLIDFILL_STAGES,
244 /*
Saurabh Shah66c941b2016-07-06 17:34:05 -0700245 * Op: Returns retire fence for this commit. Should be called after Commit() on
246 * DRMAtomicReqInterface.
247 * Arg: uint32_t - Connector ID
248 * int * - Pointer to an integer that will hold the returned fence
249 */
250 CONNECTOR_GET_RETIRE_FENCE,
251 /*
252 * Op: Sets writeback connector destination rect
253 * Arg: uint32_t - Connector ID
254 * DRMRect - Dst Rectangle
255 */
256 CONNECTOR_SET_OUTPUT_RECT,
257 /*
258 * Op: Sets frame buffer ID for writeback connector.
259 * Arg: uint32_t - Connector ID
260 * uint32_t - Framebuffer ID
261 */
262 CONNECTOR_SET_OUTPUT_FB_ID,
Sushil Chauhan3396e202017-04-14 18:34:22 -0700263 /*
264 * Op: Sets power mode for connector.
265 * Arg: uint32_t - Connector ID
266 * uint32_t - Power Mode
267 */
268 CONNECTOR_SET_POWER_MODE,
Saurabh Shahe9f55d72017-03-03 15:14:13 -0800269 /*
270 * Op: Sets panel ROIs.
271 * Arg: uint32_t - Connector ID
272 * uint32_t - number of ROIs
273 * DRMRect * - Array of Connector ROIs
274 */
275 CONNECTOR_SET_ROI,
Saurabh Shah66c941b2016-07-06 17:34:05 -0700276};
277
Saurabh Shahf9266ee2017-04-19 15:25:46 -0700278enum struct DRMRotation {
279 FLIP_H = 0x1,
280 FLIP_V = 0x2,
Prabhanjan Kandula5bc7f8b2017-05-23 12:24:57 -0700281 ROT_180 = FLIP_H | FLIP_V,
Saurabh Shahf9266ee2017-04-19 15:25:46 -0700282 ROT_90 = 0x4,
283};
284
Sushil Chauhan3396e202017-04-14 18:34:22 -0700285enum struct DRMPowerMode {
286 ON,
287 DOZE,
288 DOZE_SUSPEND,
289 OFF,
290};
291
Saurabh Shah66c941b2016-07-06 17:34:05 -0700292enum struct DRMBlendType {
293 UNDEFINED = 0,
294 OPAQUE = 1,
295 PREMULTIPLIED = 2,
296 COVERAGE = 3,
297};
298
Prabhanjan Kandula585aa652017-01-26 18:39:11 -0800299enum struct DRMSrcConfig {
300 DEINTERLACE = 0,
301};
302
Saurabh Shah66c941b2016-07-06 17:34:05 -0700303/* Display type to identify a suitable connector */
304enum struct DRMDisplayType {
305 PERIPHERAL,
306 TV,
307 VIRTUAL,
308};
309
310struct DRMRect {
311 uint32_t left; // Left-most pixel coordinate.
312 uint32_t top; // Top-most pixel coordinate.
313 uint32_t right; // Right-most pixel coordinate.
314 uint32_t bottom; // Bottom-most pixel coordinate.
315};
316
317//------------------------------------------------------------------------
318// DRM Info Query Types
319//------------------------------------------------------------------------
320
321enum struct QSEEDVersion {
322 V1,
323 V2,
324 V3,
325};
326
Rohit Kulkarnibfa855c2017-06-29 17:52:10 -0700327/* QSEED3 Step version */
328enum struct QSEEDStepVersion {
329 V2,
330 V3,
331 V4,
332};
333
Prabhanjan Kandulae6dfab92017-03-14 11:02:49 -0700334enum struct SmartDMARevision {
335 V1,
336 V2,
337};
338
Saurabh Shah66c941b2016-07-06 17:34:05 -0700339/* Per CRTC Resource Info*/
340struct DRMCrtcInfo {
341 bool has_src_split;
342 uint32_t max_blend_stages;
Prabhanjan Kanduladbc8aed2017-03-24 14:43:16 -0700343 uint32_t max_solidfill_stages;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700344 QSEEDVersion qseed_version;
Prabhanjan Kandulae6dfab92017-03-14 11:02:49 -0700345 SmartDMARevision smart_dma_rev;
Ramkumar Radhakrishnan9ed1fd82017-03-09 18:46:41 -0800346 float ib_fudge_factor;
347 float clk_fudge_factor;
348 uint32_t dest_scale_prefill_lines;
349 uint32_t undersized_prefill_lines;
350 uint32_t macrotile_prefill_lines;
351 uint32_t nv12_prefill_lines;
352 uint32_t linear_prefill_lines;
353 uint32_t downscale_prefill_lines;
354 uint32_t extra_prefill_lines;
355 uint32_t amortized_threshold;
356 uint64_t max_bandwidth_low;
357 uint64_t max_bandwidth_high;
358 uint32_t max_sde_clk;
359 CompRatioMap comp_ratio_rt_map;
360 CompRatioMap comp_ratio_nrt_map;
Gopikrishnaiah Anandan76815522017-06-27 15:18:04 -0700361 uint32_t hw_version;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700362};
363
364enum struct DRMPlaneType {
365 // Has CSC and scaling capability
366 VIG = 0,
367 // Has scaling capability but no CSC
368 RGB,
369 // No scaling support
370 DMA,
371 // Supports a small dimension and doesn't use a CRTC stage
372 CURSOR,
373 MAX,
374};
375
376struct DRMPlaneTypeInfo {
Prabhanjan Kandulae6dfab92017-03-14 11:02:49 -0700377 DRMPlaneType type;
378 uint32_t master_plane_id;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700379 // FourCC format enum and modifier
380 std::vector<std::pair<uint32_t, uint64_t>> formats_supported;
381 uint32_t max_linewidth;
382 uint32_t max_upscale;
383 uint32_t max_downscale;
384 uint32_t max_horizontal_deci;
385 uint32_t max_vertical_deci;
Ramkumar Radhakrishnan9ed1fd82017-03-09 18:46:41 -0800386 uint64_t max_pipe_bandwidth;
Rohit Kulkarni8622e362017-01-30 18:14:10 -0800387 uint32_t cache_size; // cache size in bytes for inline rotation support.
Rohit Kulkarnibfa855c2017-06-29 17:52:10 -0700388 QSEEDStepVersion qseed3_version;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700389};
390
Prabhanjan Kandulae6dfab92017-03-14 11:02:49 -0700391// All DRM Planes as map<Plane_id , plane_type_info> listed from highest to lowest priority
392typedef std::vector<std::pair<uint32_t, DRMPlaneTypeInfo>> DRMPlanesInfo;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700393
394enum struct DRMTopology {
Rohit Kulkarni2faa91c2017-06-05 15:43:48 -0700395 UNKNOWN, // To be compat with driver defs in sde_rm.h
Saurabh Shah66c941b2016-07-06 17:34:05 -0700396 SINGLE_LM,
Rohit Kulkarni2faa91c2017-06-05 15:43:48 -0700397 SINGLE_LM_DSC,
Saurabh Shah66c941b2016-07-06 17:34:05 -0700398 DUAL_LM,
Rohit Kulkarni2faa91c2017-06-05 15:43:48 -0700399 DUAL_LM_DSC,
Saurabh Shah66c941b2016-07-06 17:34:05 -0700400 DUAL_LM_MERGE,
Rohit Kulkarni2faa91c2017-06-05 15:43:48 -0700401 DUAL_LM_MERGE_DSC,
402 DUAL_LM_DSCMERGE,
403 PPSPLIT,
Saurabh Shah66c941b2016-07-06 17:34:05 -0700404};
405
406enum struct DRMPanelMode {
407 VIDEO,
408 COMMAND,
409};
410
411/* Per Connector Info*/
412struct DRMConnectorInfo {
413 uint32_t mmWidth;
414 uint32_t mmHeight;
415 uint32_t type;
Saurabh Shahe618eb02017-07-27 14:32:10 -0700416 std::vector<drmModeModeInfo> modes;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700417 DRMTopology topology;
418 std::string panel_name;
419 DRMPanelMode panel_mode;
420 bool is_primary;
421 // Valid only if DRMPanelMode is VIDEO
422 bool dynamic_fps;
423 // FourCC format enum and modifier
424 std::vector<std::pair<uint32_t, uint64_t>> formats_supported;
425 // Valid only if type is DRM_MODE_CONNECTOR_VIRTUAL
426 uint32_t max_linewidth;
Saurabh Shahe9f55d72017-03-03 15:14:13 -0800427 // Valid only if mode is command
428 int num_roi;
429 int xstart;
430 int ystart;
431 int walign;
432 int halign;
433 int wmin;
434 int hmin;
435 bool roi_merge;
Prabhanjan Kandula5bc7f8b2017-05-23 12:24:57 -0700436 DRMRotation panel_orientation;
Sushil Chauhan80e58432017-07-06 11:39:17 -0700437 drm_panel_hdr_properties panel_hdr_prop;
Ramkumar Radhakrishnan5c94f052017-07-06 11:59:14 -0700438 uint32_t transfer_time_us;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700439};
440
441/* Identifier token for a display */
442struct DRMDisplayToken {
443 uint32_t conn_id;
444 uint32_t crtc_id;
445};
446
Ping Li281f48d2017-01-16 12:45:40 -0800447enum DRMPPFeatureID {
448 kFeaturePcc,
449 kFeatureIgc,
450 kFeaturePgc,
451 kFeatureMixerGc,
452 kFeaturePaV2,
453 kFeatureDither,
454 kFeatureGamut,
455 kFeaturePADither,
456 kPPFeaturesMax,
457};
458
459enum DRMPPPropType {
460 kPropEnum,
461 kPropRange,
462 kPropBlob,
463 kPropTypeMax,
464};
465
466struct DRMPPFeatureInfo {
467 DRMPPFeatureID id;
468 DRMPPPropType type;
469 uint32_t version;
470 uint32_t payload_size;
471 void *payload;
472};
473
Ping Li8d6dd622017-07-03 12:05:15 -0700474enum DRMCscType {
475 kCscYuv2Rgb601L,
476 kCscYuv2Rgb601FR,
477 kCscYuv2Rgb709L,
478 kCscYuv2Rgb2020L,
479 kCscYuv2Rgb2020FR,
480 kCscTypeMax,
481};
482
Saurabh Shah0ffee302016-11-22 10:42:11 -0800483struct DRMScalerLUTInfo {
484 uint32_t dir_lut_size = 0;
485 uint32_t cir_lut_size = 0;
486 uint32_t sep_lut_size = 0;
487 uint64_t dir_lut = 0;
488 uint64_t cir_lut = 0;
489 uint64_t sep_lut = 0;
490};
491
Sushil Chauhan1021cc02017-05-03 15:11:43 -0700492enum struct DRMSecureMode {
493 NON_SECURE,
494 SECURE,
495 NON_SECURE_DIR_TRANSLATION,
496 SECURE_DIR_TRANSLATION,
497};
498
499enum struct DRMSecurityLevel {
500 SECURE_NON_SECURE,
501 SECURE_ONLY,
502};
503
Prabhanjan Kanduladbc8aed2017-03-24 14:43:16 -0700504struct DRMSolidfillStage {
505 DRMRect bounding_rect {};
506 bool is_exclusion_rect = false;
507 uint32_t color = 0xff000000; // in 8bit argb
508 uint32_t z_order = 0;
509 uint32_t plane_alpha = 0xff;
510};
511
Saurabh Shah66c941b2016-07-06 17:34:05 -0700512/* DRM Atomic Request Property Set.
513 *
514 * Helper class to create and populate atomic properties of DRM components
515 * when rendered in DRM atomic mode */
516class DRMAtomicReqInterface {
517 public:
518 virtual ~DRMAtomicReqInterface() {}
519 /* Perform request operation.
520 *
521 * [input]: opcode: operation code from DRMOps list.
522 * var_arg: arguments for DRMOps's can differ in number and
523 * data type. Refer above DRMOps to details.
524 * [return]: Error code if the API fails, 0 on success.
525 */
526 virtual int Perform(DRMOps opcode, ...) = 0;
527
528 /*
529 * Commit the params set via Perform(). Also resets the properties after commit. Needs to be
530 * called every frame.
531 * [input]: synchronous: Determines if the call should block until a h/w flip
532 * [return]: Error code if the API fails, 0 on success.
533 */
534 virtual int Commit(bool synchronous) = 0;
535 /*
536 * Validate the params set via Perform().
537 * [return]: Error code if the API fails, 0 on success.
538 */
539 virtual int Validate() = 0;
540};
541
542class DRMManagerInterface;
543
544/* Populates a singleton instance of DRMManager */
545typedef int (*GetDRMManager)(int fd, DRMManagerInterface **intf);
546
547/* Destroy DRMManager instance */
Saurabh Shahab7807c2017-02-08 15:41:08 -0800548typedef int (*DestroyDRMManager)();
Saurabh Shah66c941b2016-07-06 17:34:05 -0700549
550/*
551 * DRM Manager Interface - Any class which plans to implement helper function for vendor
552 * specific DRM driver implementation must implement the below interface routines to work
553 * with SDM.
554 */
555
556class DRMManagerInterface {
557 public:
558 virtual ~DRMManagerInterface() {}
559
560 /*
561 * Since SDM completely manages the planes. GetPlanesInfo will provide all
562 * the plane information.
563 * [output]: DRMPlanesInfo: Resource Info for planes.
564 */
565 virtual void GetPlanesInfo(DRMPlanesInfo *info) = 0;
566
567 /*
568 * Will provide all the information of a selected crtc.
569 * [input]: Use crtc id 0 to obtain system wide info
570 * [output]: DRMCrtcInfo: Resource Info for the given CRTC id.
571 */
572 virtual void GetCrtcInfo(uint32_t crtc_id, DRMCrtcInfo *info) = 0;
573
574 /*
575 * Will provide all the information of a selected connector.
576 * [output]: DRMConnectorInfo: Resource Info for the given connector id
577 */
578 virtual void GetConnectorInfo(uint32_t conn_id, DRMConnectorInfo *info) = 0;
579
580 /*
Ping Li281f48d2017-01-16 12:45:40 -0800581 * Will query post propcessing feature info of a CRTC.
582 * [output]: DRMPPFeatureInfo: CRTC post processing feature info
583 */
Ramkumar Radhakrishnan9ed1fd82017-03-09 18:46:41 -0800584 virtual void GetCrtcPPInfo(uint32_t crtc_id, DRMPPFeatureInfo &info) = 0;
Ping Li281f48d2017-01-16 12:45:40 -0800585 /*
Saurabh Shah66c941b2016-07-06 17:34:05 -0700586 * Register a logical display to receive a token.
587 * Each display pipeline in DRM is identified by its CRTC and Connector(s).
588 * On display connect(bootup or hotplug), clients should invoke this interface to
589 * establish the pipeline for the display and should get a DisplayToken
590 * populated with crtc and connnector(s) id's. Here onwards, Client should
591 * use this token to represent the display for any Perform operations if
592 * needed.
593 *
594 * [input]: disp_type - Peripheral / TV / Virtual
595 * [output]: DRMDisplayToken - CRTC and Connector id's for the display
596 * [return]: 0 on success, a negative error value otherwise
597 */
598 virtual int RegisterDisplay(DRMDisplayType disp_type, DRMDisplayToken *tok) = 0;
599
600 /* Client should invoke this interface on display disconnect.
601 * [input]: DRMDisplayToken - identifier for the display.
602 */
603 virtual void UnregisterDisplay(const DRMDisplayToken &token) = 0;
604
605 /*
606 * Creates and returns an instance of DRMAtomicReqInterface corresponding to a display token
607 * returned as part of RegisterDisplay API. Needs to be called per display.
608 * [input]: DRMDisplayToken that identifies a display pipeline
609 * [output]: Pointer to an instance of DRMAtomicReqInterface.
610 * [return]: Error code if the API fails, 0 on success.
611 */
612 virtual int CreateAtomicReq(const DRMDisplayToken &token, DRMAtomicReqInterface **intf) = 0;
613
614 /*
615 * Destroys the instance of DRMAtomicReqInterface
616 * [input]: Pointer to a DRMAtomicReqInterface
617 * [return]: Error code if the API fails, 0 on success.
618 */
619 virtual int DestroyAtomicReq(DRMAtomicReqInterface *intf) = 0;
Saurabh Shah0ffee302016-11-22 10:42:11 -0800620 /*
621 * Sets the global scaler LUT
622 * [input]: LUT Info
623 * [return]: Error code if the API fails, 0 on success.
624 */
625 virtual int SetScalerLUT(const DRMScalerLUTInfo &lut_info) = 0;
Saurabh Shah66c941b2016-07-06 17:34:05 -0700626};
Saurabh Shah0ffee302016-11-22 10:42:11 -0800627
Saurabh Shah66c941b2016-07-06 17:34:05 -0700628} // namespace sde_drm
629#endif // __DRM_INTERFACE_H__