/* * Copyright 2012-15 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD *
*/
/* Brightness: in DAL usually -.25 ~ .25. * In MMD is -100 to +100 in 16-235 range; which when scaled to full range is * ~-116 to +116. When normalized this is about 0.4566. * With 100 divider this becomes 46, but we may use another for better precision * The ideal one is 100/219 ((100/255)*(255/219)), * i.e. min/max = +-100, divider = 219 * default 0.0
*/ #define UNDERLAY_BRIGHTNESS_DEFAULT 0 #define UNDERLAY_BRIGHTNESS_MIN -46 /* ~116/255 */ #define UNDERLAY_BRIGHTNESS_MAX 46 #define UNDERLAY_BRIGHTNESS_STEP 1 /* .01 */ #define UNDERLAY_BRIGHTNESS_DIVIDER 100
if (csc_adjust_type == GRAPHICS_CSC_ADJUST_TYPE_SW) { if (config == CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC) returntrue;
switch (color_space) { case COLOR_SPACE_SRGB: /* by pass */
set_reg_field_value(
value,
0,
COL_MAN_OUTPUT_CSC_CONTROL,
OUTPUT_CSC_MODE); break; case COLOR_SPACE_SRGB_LIMITED: /* not supported for underlay on CZ */ returnfalse;
case COLOR_SPACE_YCBCR601_LIMITED: /* YCbCr601 */
set_reg_field_value(
value,
2,
COL_MAN_OUTPUT_CSC_CONTROL,
OUTPUT_CSC_MODE); break; case COLOR_SPACE_YCBCR709: case COLOR_SPACE_YCBCR709_LIMITED: /* YCbCr709 */
set_reg_field_value(
value,
3,
COL_MAN_OUTPUT_CSC_CONTROL,
OUTPUT_CSC_MODE); break; default: returnfalse;
}
} elseif (csc_adjust_type == GRAPHICS_CSC_ADJUST_TYPE_HW) { switch (color_space) { case COLOR_SPACE_SRGB: /* by pass */
set_reg_field_value(
value,
0,
COL_MAN_OUTPUT_CSC_CONTROL,
OUTPUT_CSC_MODE); break; case COLOR_SPACE_SRGB_LIMITED: /* not supported for underlay on CZ */ returnfalse; case COLOR_SPACE_YCBCR601: case COLOR_SPACE_YCBCR601_LIMITED: /* YCbCr601 */
set_reg_field_value(
value,
2,
COL_MAN_OUTPUT_CSC_CONTROL,
OUTPUT_CSC_MODE); break; case COLOR_SPACE_YCBCR709: case COLOR_SPACE_YCBCR709_LIMITED: /* YCbCr709 */
set_reg_field_value(
value,
3,
COL_MAN_OUTPUT_CSC_CONTROL,
OUTPUT_CSC_MODE); break; default: returnfalse;
}
/*TODO: color depth is not correct when this is called*/ staticvoid set_Denormalization(struct transform *xfm, enum dc_color_depth color_depth)
{
uint32_t value = dm_read_reg(xfm->ctx, mmDENORM_CLAMP_CONTROL);
switch (color_depth) { case COLOR_DEPTH_888: /* 255/256 for 8 bit output color depth */
set_reg_field_value(
value,
1,
DENORM_CLAMP_CONTROL,
DENORM_MODE); break; case COLOR_DEPTH_101010: /* 1023/1024 for 10 bit output color depth */
set_reg_field_value(
value,
2,
DENORM_CLAMP_CONTROL,
DENORM_MODE); break; case COLOR_DEPTH_121212: /* 4095/4096 for 12 bit output color depth */
set_reg_field_value(
value,
3,
DENORM_CLAMP_CONTROL,
DENORM_MODE); break; default: /* not valid case */ break;
}
for (i = 0; i < arr_size; i++) if (input_csc_matrix[i].color_space == color_space) {
regval = input_csc_matrix[i].regval; break;
} if (regval == NULL) {
BREAK_TO_DEBUGGER(); return;
}
/* * 1 == set A, the logic is 'if currently we're not using set A, * then use set A, otherwise use set B'
*/
value = dm_read_reg(ctx, mmCOL_MAN_INPUT_CSC_CONTROL);
use_set_a = get_reg_field_value(
value, COL_MAN_INPUT_CSC_CONTROL, INPUT_CSC_MODE) != 1;
if (use_set_a) { /* fixed S2.13 format */
value = 0;
set_reg_field_value(
value, regval[0], INPUT_CSC_C11_C12_A, INPUT_CSC_C11_A);
set_reg_field_value(
value, regval[1], INPUT_CSC_C11_C12_A, INPUT_CSC_C12_A);
dm_write_reg(ctx, mmINPUT_CSC_C11_C12_A, value);
/* KK: leave INPUT_CSC_CONVERSION_MODE at default */
value = 0; /* * select 8.4 input type instead of default 12.0. From the discussion * with HW team, this format depends on the UNP surface format, so for * 8-bit we should select 8.4 (4 bits truncated). For 10 it should be * 10.2. For Carrizo we only support 8-bit surfaces on underlay pipe * so we can always keep this at 8.4 (input_type=2). If the later asics * start supporting 10+ bits, we will have a problem: surface * programming including UNP_GRPH* is being done in DalISR after this, * so either we pass surface format to here, or move this logic to ISR
*/
if (default_adjust->force_hw_default == false) { conststruct out_csc_color_matrix *elm; /* currently parameter not in use */ enum grph_color_adjust_option option;
uint32_t i; /* * HW default false we program locally defined matrix * HW default true we use predefined hw matrix and we * do not need to program matrix * OEM wants the HW default via runtime parameter.
*/
option = GRPH_COLOR_MATRIX_SW;
for (i = 0; i < ARRAY_SIZE(global_color_matrix); ++i) {
elm = &global_color_matrix[i]; if (elm->color_space != default_adjust->out_color_space) continue; /* program the matrix with default values from this * file
*/
program_color_matrix_v(xfm_dce, elm, option);
config = CSC_COLOR_MODE_GRAPHICS_OUTPUT_CSC; break;
}
}
/* configure the what we programmed : * 1. Default values from this file * 2. Use hardware default from ROM_A and we do not need to program * matrix
*/
/* We did everything ,now program DxOUTPUT_CSC_CONTROL */
configure_graphics_mode_v(xfm_dce, config, GRAPHICS_CSC_ADJUST_TYPE_SW,
tbl_entry->color_space);
/*TODO: Check if denormalization is needed*/ /*set_Denormalization(opp, adjust->color_depth);*/
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.2 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.