2 * Copyright 2016 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
30 #include "fixed31_32.h"
31 #include "signal_types.h"
33 /******************************************************************************
34 * Data types for Virtual HW Layer of DAL3.
35 * (see DAL3 design documents for HW Layer definition)
37 * The intended uses are:
38 * 1. Generation pseudocode sequences for HW programming.
39 * 2. Implementation of real HW programming by HW Sequencer of DAL3.
41 * Note: do *not* add any types which are *not* used for HW programming - this
42 * will ensure separation of Logic layer from HW layer.
43 ******************************************************************************/
59 #define PHYSICAL_ADDRESS_LOC union large_integer
61 enum dc_plane_addr_type
{
62 PLN_ADDR_TYPE_GRAPHICS
= 0,
63 PLN_ADDR_TYPE_GRPH_STEREO
,
64 PLN_ADDR_TYPE_VIDEO_PROGRESSIVE
,
67 struct dc_plane_address
{
68 enum dc_plane_addr_type type
;
71 PHYSICAL_ADDRESS_LOC addr
;
72 PHYSICAL_ADDRESS_LOC meta_addr
;
73 union large_integer dcc_const_color
;
78 PHYSICAL_ADDRESS_LOC left_addr
;
79 PHYSICAL_ADDRESS_LOC left_meta_addr
;
80 union large_integer left_dcc_const_color
;
82 PHYSICAL_ADDRESS_LOC right_addr
;
83 PHYSICAL_ADDRESS_LOC right_meta_addr
;
84 union large_integer right_dcc_const_color
;
90 PHYSICAL_ADDRESS_LOC luma_addr
;
91 PHYSICAL_ADDRESS_LOC luma_meta_addr
;
92 union large_integer luma_dcc_const_color
;
94 PHYSICAL_ADDRESS_LOC chroma_addr
;
95 PHYSICAL_ADDRESS_LOC chroma_meta_addr
;
96 union large_integer chroma_dcc_const_color
;
114 /* Grph or Video will be selected
115 * based on format above:
116 * Use Video structure if
117 * format >= DalPixelFormat_VideoBegin
118 * else use Grph structure
121 struct rect surface_size
;
122 /* Graphic surface pitch in pixels.
123 * In LINEAR_GENERAL mode, pitch
124 * is 32 pixel aligned.
126 uint32_t surface_pitch
;
130 struct rect luma_size
;
131 /* Graphic surface pitch in pixels.
132 * In LINEAR_GENERAL mode, pitch is
137 struct rect chroma_size
;
138 /* Graphic surface pitch in pixels.
139 * In LINEAR_GENERAL mode, pitch is
142 uint32_t chroma_pitch
;
146 struct dc_plane_dcc_param
{
152 bool independent_64b_blks
;
156 uint32_t meta_pitch_l
;
157 bool independent_64b_blks_l
;
159 uint32_t meta_pitch_c
;
160 bool independent_64b_blks_c
;
165 /*Displayable pixel format in fb*/
166 enum surface_pixel_format
{
167 SURFACE_PIXEL_FORMAT_GRPH_BEGIN
= 0,
168 /*TOBE REMOVED paletta 256 colors*/
169 SURFACE_PIXEL_FORMAT_GRPH_PALETA_256_COLORS
=
170 SURFACE_PIXEL_FORMAT_GRPH_BEGIN
,
172 SURFACE_PIXEL_FORMAT_GRPH_ARGB1555
,
174 SURFACE_PIXEL_FORMAT_GRPH_RGB565
,
176 SURFACE_PIXEL_FORMAT_GRPH_ARGB8888
,
178 SURFACE_PIXEL_FORMAT_GRPH_ABGR8888
,
180 SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010
,
182 SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010
,
183 /*TOBE REMOVED swaped, XR_BIAS has no differance
184 * for pixel layout than previous and we can
185 * delete this after discusion*/
186 SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010_XR_BIAS
,
188 SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616
,
190 SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F
,
192 SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F
,
193 /*grow graphics here if necessary */
195 SURFACE_PIXEL_FORMAT_VIDEO_BEGIN
,
196 SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr
=
197 SURFACE_PIXEL_FORMAT_VIDEO_BEGIN
,
198 SURFACE_PIXEL_FORMAT_VIDEO_420_YCrCb
,
199 SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCbCr
,
200 SURFACE_PIXEL_FORMAT_VIDEO_420_10bpc_YCrCb
,
201 SURFACE_PIXEL_FORMAT_INVALID
203 /*grow 444 video here if necessary */
209 PIXEL_FORMAT_UNINITIALIZED
,
212 PIXEL_FORMAT_ARGB8888
,
213 PIXEL_FORMAT_ARGB2101010
,
214 PIXEL_FORMAT_ARGB2101010_XRBIAS
,
217 PIXEL_FORMAT_420BPP12
,
218 PIXEL_FORMAT_420BPP15
,
219 /*end of pixel format definition*/
220 PIXEL_FORMAT_INVALID
,
222 PIXEL_FORMAT_GRPH_BEGIN
= PIXEL_FORMAT_INDEX8
,
223 PIXEL_FORMAT_GRPH_END
= PIXEL_FORMAT_FP16
,
224 PIXEL_FORMAT_VIDEO_BEGIN
= PIXEL_FORMAT_420BPP12
,
225 PIXEL_FORMAT_VIDEO_END
= PIXEL_FORMAT_420BPP15
,
229 enum tile_split_values
{
230 DC_DISPLAY_MICRO_TILING
= 0x0,
231 DC_THIN_MICRO_TILING
= 0x1,
232 DC_DEPTH_MICRO_TILING
= 0x2,
233 DC_ROTATED_MICRO_TILING
= 0x3,
236 /* TODO: These values come from hardware spec. We need to readdress this
237 * if they ever change.
239 enum array_mode_values
{
240 DC_ARRAY_LINEAR_GENERAL
= 0,
241 DC_ARRAY_LINEAR_ALLIGNED
,
242 DC_ARRAY_1D_TILED_THIN1
,
243 DC_ARRAY_1D_TILED_THICK
,
244 DC_ARRAY_2D_TILED_THIN1
,
245 DC_ARRAY_PRT_TILED_THIN1
,
246 DC_ARRAY_PRT_2D_TILED_THIN1
,
247 DC_ARRAY_2D_TILED_THICK
,
248 DC_ARRAY_2D_TILED_X_THICK
,
249 DC_ARRAY_PRT_TILED_THICK
,
250 DC_ARRAY_PRT_2D_TILED_THICK
,
251 DC_ARRAY_PRT_3D_TILED_THIN1
,
252 DC_ARRAY_3D_TILED_THIN1
,
253 DC_ARRAY_3D_TILED_THICK
,
254 DC_ARRAY_3D_TILED_X_THICK
,
255 DC_ARRAY_PRT_3D_TILED_THICK
,
258 enum tile_mode_values
{
259 DC_ADDR_SURF_MICRO_TILING_DISPLAY
= 0x0,
260 DC_ADDR_SURF_MICRO_TILING_NON_DISPLAY
= 0x1,
263 enum swizzle_mode_values
{
291 union dc_tiling_info
{
294 /* Specifies the number of memory banks for tiling
296 * Only applies to 2D and 3D tiling modes.
297 * POSSIBLE VALUES: 2,4,8,16
299 unsigned int num_banks
;
300 /* Specifies the number of tiles in the x direction
301 * to be incorporated into the same bank.
302 * Only applies to 2D and 3D tiling modes.
303 * POSSIBLE VALUES: 1,2,4,8
305 unsigned int bank_width
;
306 unsigned int bank_width_c
;
307 /* Specifies the number of tiles in the y direction to
308 * be incorporated into the same bank.
309 * Only applies to 2D and 3D tiling modes.
310 * POSSIBLE VALUES: 1,2,4,8
312 unsigned int bank_height
;
313 unsigned int bank_height_c
;
314 /* Specifies the macro tile aspect ratio. Only applies
315 * to 2D and 3D tiling modes.
317 unsigned int tile_aspect
;
318 unsigned int tile_aspect_c
;
319 /* Specifies the number of bytes that will be stored
320 * contiguously for each tile.
321 * If the tile data requires more storage than this
322 * amount, it is split into multiple slices.
323 * This field must not be larger than
324 * GB_ADDR_CONFIG.DRAM_ROW_SIZE.
325 * Only applies to 2D and 3D tiling modes.
326 * For color render targets, TILE_SPLIT >= 256B.
328 enum tile_split_values tile_split
;
329 enum tile_split_values tile_split_c
;
330 /* Specifies the addressing within a tile.
331 * 0x0 - DISPLAY_MICRO_TILING
332 * 0x1 - THIN_MICRO_TILING
333 * 0x2 - DEPTH_MICRO_TILING
334 * 0x3 - ROTATED_MICRO_TILING
336 enum tile_mode_values tile_mode
;
337 enum tile_mode_values tile_mode_c
;
338 /* Specifies the number of pipes and how they are
339 * interleaved in the surface.
340 * Refer to memory addressing document for complete
341 * details and constraints.
343 unsigned int pipe_config
;
344 /* Specifies the tiling mode of the surface.
345 * THIN tiles use an 8x8x1 tile size.
346 * THICK tiles use an 8x8x4 tile size.
347 * 2D tiling modes rotate banks for successive Z slices
348 * 3D tiling modes rotate pipes and banks for Z slices
349 * Refer to memory addressing document for complete
350 * details and constraints.
352 enum array_mode_values array_mode
;
356 unsigned int num_pipes
;
357 unsigned int num_banks
;
358 unsigned int pipe_interleave
;
359 unsigned int num_shader_engines
;
360 unsigned int num_rb_per_se
;
361 unsigned int max_compressed_frags
;
364 enum swizzle_mode_values swizzle
;
372 enum dc_rotation_angle
{
373 ROTATION_ANGLE_0
= 0,
380 enum dc_scan_direction
{
381 SCAN_DIRECTION_UNKNOWN
= 0,
382 SCAN_DIRECTION_HORIZONTAL
= 1, /* 0, 180 rotation */
383 SCAN_DIRECTION_VERTICAL
= 2, /* 90, 270 rotation */
386 struct dc_cursor_position
{
394 * This parameter indicates whether HW cursor should be enabled
399 * This parameter indicates whether cursor hot spot should be
402 bool hot_spot_enable
;
405 struct dc_cursor_mi_param
{
406 unsigned int pixel_clk_khz
;
407 unsigned int ref_clk_khz
;
408 unsigned int viewport_x_start
;
409 unsigned int viewport_width
;
410 struct fixed31_32 h_scale_ratio
;
413 /* IPP related types */
416 INPUT_LUT_ENTRIES
= 256
420 uint16_t red
[INPUT_LUT_ENTRIES
];
421 uint16_t green
[INPUT_LUT_ENTRIES
];
422 uint16_t blue
[INPUT_LUT_ENTRIES
];
425 /* Used by both ipp amd opp functions*/
426 /* TODO: to be consolidated with enum color_space */
429 * This enum is for programming CURSOR_MODE register field. What this register
430 * should be programmed to depends on OS requested cursor shape flags and what
431 * we stored in the cursor surface.
433 enum dc_cursor_color_format
{
435 CURSOR_MODE_COLOR_1BIT_AND
,
436 CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA
,
437 CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA
441 * This is all the parameters required by DAL in order to update the cursor
442 * attributes, including the new cursor image surface address, size, hotspot
443 * location, color format, etc.
446 union dc_cursor_attribute_flags
{
448 uint32_t ENABLE_MAGNIFICATION
:1;
449 uint32_t INVERSE_TRANSPARENT_CLAMPING
:1;
450 uint32_t HORIZONTAL_MIRROR
:1;
451 uint32_t VERTICAL_MIRROR
:1;
452 uint32_t INVERT_PIXEL_DATA
:1;
453 uint32_t ZERO_EXPANSION
:1;
454 uint32_t MIN_MAX_INVERT
:1;
455 uint32_t RESERVED
:25;
460 struct dc_cursor_attributes
{
461 PHYSICAL_ADDRESS_LOC address
;
464 /* Width and height should correspond to cursor surface width x heigh */
470 enum dc_cursor_color_format color_format
;
472 /* In case we support HW Cursor rotation in the future */
473 enum dc_rotation_angle rotation_angle
;
475 union dc_cursor_attribute_flags attribute_flags
;
480 enum dc_color_space
{
483 COLOR_SPACE_SRGB_LIMITED
,
484 COLOR_SPACE_YCBCR601
,
485 COLOR_SPACE_YCBCR709
,
486 COLOR_SPACE_YCBCR601_LIMITED
,
487 COLOR_SPACE_YCBCR709_LIMITED
,
488 COLOR_SPACE_2020_RGB_FULLRANGE
,
489 COLOR_SPACE_2020_RGB_LIMITEDRANGE
,
490 COLOR_SPACE_2020_YCBCR
,
491 COLOR_SPACE_ADOBERGB
,
494 enum dc_quantization_range
{
495 QUANTIZATION_RANGE_UNKNOWN
,
496 QUANTIZATION_RANGE_FULL
,
497 QUANTIZATION_RANGE_LIMITED
502 /* used in struct dc_surface */
503 struct scaling_taps
{
510 enum dc_timing_standard
{
511 TIMING_STANDARD_UNDEFINED
,
515 TIMING_STANDARD_CVT_RB
,
516 TIMING_STANDARD_CEA770
,
517 TIMING_STANDARD_CEA861
,
518 TIMING_STANDARD_HDMI
,
519 TIMING_STANDARD_TV_NTSC
,
520 TIMING_STANDARD_TV_NTSC_J
,
521 TIMING_STANDARD_TV_PAL
,
522 TIMING_STANDARD_TV_PAL_M
,
523 TIMING_STANDARD_TV_PAL_CN
,
524 TIMING_STANDARD_TV_SECAM
,
525 TIMING_STANDARD_EXPLICIT
,
526 /*!< For explicit timings from EDID, VBIOS, etc.*/
527 TIMING_STANDARD_USER_OVERRIDE
,
528 /*!< For mode timing override by user*/
532 enum dc_timing_3d_format
{
533 TIMING_3D_FORMAT_NONE
,
534 TIMING_3D_FORMAT_FRAME_ALTERNATE
, /* No stereosync at all*/
535 TIMING_3D_FORMAT_INBAND_FA
, /* Inband Frame Alternate (DVI/DP)*/
536 TIMING_3D_FORMAT_DP_HDMI_INBAND_FA
, /* Inband FA to HDMI Frame Pack*/
537 /* for active DP-HDMI dongle*/
538 TIMING_3D_FORMAT_SIDEBAND_FA
, /* Sideband Frame Alternate (eDP)*/
539 TIMING_3D_FORMAT_HW_FRAME_PACKING
,
540 TIMING_3D_FORMAT_SW_FRAME_PACKING
,
541 TIMING_3D_FORMAT_ROW_INTERLEAVE
,
542 TIMING_3D_FORMAT_COLUMN_INTERLEAVE
,
543 TIMING_3D_FORMAT_PIXEL_INTERLEAVE
,
544 TIMING_3D_FORMAT_SIDE_BY_SIDE
,
545 TIMING_3D_FORMAT_TOP_AND_BOTTOM
,
546 TIMING_3D_FORMAT_SBS_SW_PACKED
,
547 /* Side-by-side, packed by application/driver into 2D frame*/
548 TIMING_3D_FORMAT_TB_SW_PACKED
,
549 /* Top-and-bottom, packed by application/driver into 2D frame*/
551 TIMING_3D_FORMAT_MAX
,
554 enum dc_color_depth
{
555 COLOR_DEPTH_UNDEFINED
,
565 enum dc_pixel_encoding
{
566 PIXEL_ENCODING_UNDEFINED
,
568 PIXEL_ENCODING_YCBCR422
,
569 PIXEL_ENCODING_YCBCR444
,
570 PIXEL_ENCODING_YCBCR420
,
574 enum dc_aspect_ratio
{
575 ASPECT_RATIO_NO_DATA
,
579 ASPECT_RATIO_256_135
,
584 SCANNING_TYPE_NODATA
= 0,
585 SCANNING_TYPE_OVERSCAN
,
586 SCANNING_TYPE_UNDERSCAN
,
587 SCANNING_TYPE_FUTURE
,
588 SCANNING_TYPE_UNDEFINED
591 struct dc_crtc_timing_flags
{
592 uint32_t INTERLACE
:1;
593 uint32_t HSYNC_POSITIVE_POLARITY
:1; /* when set to 1,
594 it is positive polarity --reversed with dal1 or video bios define*/
595 uint32_t VSYNC_POSITIVE_POLARITY
:1; /* when set to 1,
596 it is positive polarity --reversed with dal1 or video bios define*/
598 uint32_t HORZ_COUNT_BY_TWO
:1;
600 uint32_t EXCLUSIVE_3D
:1; /* if this bit set,
601 timing can be driven in 3D format only
602 and there is no corresponding 2D timing*/
603 uint32_t RIGHT_EYE_3D_POLARITY
:1; /* 1 - means right eye polarity
604 (right eye = '1', left eye = '0') */
605 uint32_t SUB_SAMPLE_3D
:1; /* 1 - means left/right images subsampled
606 when mixed into 3D image. 0 - means summation (3D timing is doubled)*/
607 uint32_t USE_IN_3D_VIEW_ONLY
:1; /* Do not use this timing in 2D View,
608 because corresponding 2D timing also present in the list*/
609 uint32_t STEREO_3D_PREFERENCE
:1; /* Means this is 2D timing
610 and we want to match priority of corresponding 3D timing*/
613 uint32_t YCBCR420
:1; /* TODO: shouldn't need this flag, should be a separate pixel format */
614 uint32_t DTD_COUNTER
:5; /* values 1 to 16 */
616 /* HDMI 2.0 - Support scrambling for TMDS character
617 * rates less than or equal to 340Mcsc */
618 uint32_t LTE_340MCSC_SCRAMBLE
:1;
622 struct dc_crtc_timing
{
625 uint32_t h_border_left
;
626 uint32_t h_addressable
;
627 uint32_t h_border_right
;
628 uint32_t h_front_porch
;
629 uint32_t h_sync_width
;
632 uint32_t v_border_top
;
633 uint32_t v_addressable
;
634 uint32_t v_border_bottom
;
635 uint32_t v_front_porch
;
636 uint32_t v_sync_width
;
638 uint32_t pix_clk_khz
;
642 enum dc_timing_3d_format timing_3d_format
;
643 enum dc_color_depth display_color_depth
;
644 enum dc_pixel_encoding pixel_encoding
;
645 enum dc_aspect_ratio aspect_ratio
;
646 enum scanning_type scan_type
;
648 struct dc_crtc_timing_flags flags
;
651 struct _dlg_otg_param
{
656 enum signal_type signal
;
659 #endif /* DC_HW_TYPES_H */