DC Patches Dec 20, 2016
Subsystems (3)
cover DC Patches Dec 20, 2016
* Bunch of cleanups by Dave Airlie
* Some gamma fixes and refactors
* OPP refactor to follow new reg access model
Amy Zhang (1):
drm/amd/display: Framework for degamma and regramma through color
module
Anthony Koo (7):
drm/amd/display: Refactor to move color helper into module drm/amd/display: Refactor output transfer function to stream drm/amd/display: Refactor to move gamma correction to module drm/amd/display: Implement PQ curve based on output transfer function drm/amd/display: Fix distribution of segments for PQ drm/amd/display: Fix programming of gamma end points drm/amd/display: Fix Regamma end point
Dave Airlie (7):
drm/amd/display: remove dc hub - this seems unused. drm/amd/display: remove some unused wrappers drm/amd/display: drop register logger and pid/tgid getters drm/amd/display: drop get platform info drm/amd/display: drop setmode complete notifier drm/amd/display: port to using drm dpcd defines drm/amd/display: assign correct enum for edp revision
Dmytro Laktyushkin (1):
drm/amd/display: define reg helpers to update registers with 8 and 9
fields
Harry Wentland (1):
drm/amd/display: Move dpcd structs into dp_types header
Roman Li (1):
drm/amd/display: fix hotplug regression after code refactor
Tony Cheng (1):
drm/amd/display: 4k split black out due to incorrect cursor
Yongqiang Sun (2):
drm/amd/display: Resolved HDMI assert in dal drm/amd/display: Add debug option to disable dmcu
Zeyu Fan (1):
drm/amd/display: OPP refactor and consolidation for DCE.
.../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c | 34 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 11 + drivers/gpu/drm/amd/display/dc/basics/Makefile | 2 +- .../drm/amd/display/dc/basics/register_logger.c | 197 ---- drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c | 209 ++++- drivers/gpu/drm/amd/display/dc/core/dc.c | 50 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 9 +- drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 146 +-- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 3 +- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 3 + drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 3 - drivers/gpu/drm/amd/display/dc/core/dc_target.c | 83 +- drivers/gpu/drm/amd/display/dc/dc.h | 26 +- drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 359 ++++++++ drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 9 + drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 3 + drivers/gpu/drm/amd/display/dc/dce/dce_opp.c | 996 +++++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dce/dce_opp.h | 418 +++++++++ .../drm/amd/display/dc/dce/dce_stream_encoder.c | 8 +- .../drm/amd/display/dc/dce100/dce100_resource.c | 61 +- drivers/gpu/drm/amd/display/dc/dce110/Makefile | 4 +- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 68 +- drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h | 3 +- .../drm/amd/display/dc/dce110/dce110_ipp_cursor.c | 3 +- .../drm/amd/display/dc/dce110/dce110_mem_input.c | 1 - drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.c | 77 -- drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.h | 149 --- .../gpu/drm/amd/display/dc/dce110/dce110_opp_csc.c | 363 -------- .../drm/amd/display/dc/dce110/dce110_opp_csc_v.c | 2 +- .../amd/display/dc/dce110/dce110_opp_formatter.c | 627 ------------- .../drm/amd/display/dc/dce110/dce110_opp_regamma.c | 537 ----------- .../amd/display/dc/dce110/dce110_opp_regamma_v.c | 2 +- .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c | 2 +- .../drm/amd/display/dc/dce110/dce110_resource.c | 60 +- drivers/gpu/drm/amd/display/dc/dce112/Makefile | 3 +- drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.c | 72 -- drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.h | 48 - .../amd/display/dc/dce112/dce112_opp_formatter.c | 215 ----- .../drm/amd/display/dc/dce112/dce112_resource.c | 70 +- drivers/gpu/drm/amd/display/dc/dce80/Makefile | 5 +- .../gpu/drm/amd/display/dc/dce80/dce80_mem_input.c | 1 - drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.c | 136 --- drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.h | 130 --- .../gpu/drm/amd/display/dc/dce80/dce80_opp_csc.c | 363 -------- .../drm/amd/display/dc/dce80/dce80_opp_formatter.c | 577 ------------ .../drm/amd/display/dc/dce80/dce80_opp_regamma.c | 543 ----------- .../gpu/drm/amd/display/dc/dce80/dce80_resource.c | 45 +- drivers/gpu/drm/amd/display/dc/dm_services.h | 48 - drivers/gpu/drm/amd/display/dc/inc/core_types.h | 3 + drivers/gpu/drm/amd/display/dc/inc/gamma_calcs.h | 3 +- drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h | 3 +- drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 2 - drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 7 +- drivers/gpu/drm/amd/display/dc/inc/reg_helper.h | 25 + .../drm/amd/display/include/dal_register_logger.h | 42 - drivers/gpu/drm/amd/display/include/dpcd_defs.h | 597 +----------- .../drm/amd/display/include/link_service_types.h | 1 - drivers/gpu/drm/amd/display/modules/color/color.c | 652 ++++++++++++-- .../drm/amd/display/modules/color/color_helper.c | 199 ++++ .../drm/amd/display/modules/color/color_helper.h | 50 ++ .../gpu/drm/amd/display/modules/inc/mod_color.h | 123 ++- 63 files changed, 3280 insertions(+), 5215 deletions(-) delete mode 100644 drivers/gpu/drm/amd/display/dc/basics/register_logger.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_csc.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_formatter.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_regamma.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce112/dce112_opp_formatter.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_csc.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_formatter.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_regamma.c delete mode 100644 drivers/gpu/drm/amd/display/include/dal_register_logger.h create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.c create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.h
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/22 drm/amd/display: Resolved HDMI assert in dal
From: Yongqiang Sun <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +3 -3
@@ -94,12 +94,12 @@ static void dce110_update_generic_info_packet(/* poll dig_update_lock is not locked -> asic internal signal * assume otg master lock will unlock it */ -REG_WAIT (AFMT_VBI_PACKET_CONTROL ,AFMT_GENERIC_LOCK_STATUS , -1 ,10 , max_retries); +/* REG_WAIT(AFMT_VBI_PACKET_CONTROL, AFMT_GENERIC_LOCK_STATUS, +0, 10, max_retries);*/ /* check if HW reading GSP memory */ REG_WAIT (AFMT_VBI_PACKET_CONTROL ,AFMT_GENERIC_CONFLICT , -1 ,10 , max_retries); +0 ,10 , max_retries);/* HW does is not reading GSP memory not reading too long -> * something wrong. clear GPS memory access and notify?
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/22 drm/amd/display: Refactor to move color helper into module
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
Refactor part 2 - Moving color helper into color module
The color module will need table defined in the helper in order to calculate the logical regamma curve, and also to fully handle gamut remapping.
--- .../drm/amd/display/modules/color/color_helper.c | 199 +++++++++++++++++++++ .../drm/amd/display/modules/color/color_helper.h | 50 ++++++ .../gpu/drm/amd/display/modules/inc/mod_color.h | 4 +- 3 files changed, 251 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.c create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.h
drivers/gpu/drm/amd/display/modules/color/color_helper.c new file +199 -0
@@ -0,0 +1,199 @@ + +/** +* @file +* @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished) +* +* @brief Helper functions for color gamut calculation +* +* @internal +* All rights reserved. This notice is intended as a precaution against +* inadvertent publication and does not imply publication or any waiver +* of confidentiality. The year included in the foregoing notice is the +* year of creation of the work. +*/ + +#include "dm_services.h" +#include "dc.h" +#include "mod_color.h" +#include "color_helper.h" + +const struct gamut_space_entry predefined_gamuts[] = { +/* x_red y_red x_gr y_gr x_blue y_blue a0 a1 a2 a3 gamma */ + [gamut_type_bt709] = {6400 ,3300 ,3000 ,6000 ,1500 ,600 ,180000 ,4500 ,99 ,99 ,2200 }, + [gamut_type_bt601] = {6400 ,3300 ,2900 ,6000 ,1500 ,600 ,180000 ,4500 ,99 ,99 ,2200 }, + [gamut_type_adobe_rgb] = {6400 ,3300 ,2100 ,7100 ,1500 ,600 ,180000 ,4500 ,99 ,99 ,2200 }, + [gamut_type_srgb] = {6400 ,3300 ,3000 ,6000 ,1500 ,600 ,31308 ,12920 ,55 ,55 ,2400 }, + [gamut_type_bt2020] = {7080 ,2920 ,1700 ,7970 ,1310 ,460 ,180000 ,4500 ,99 ,99 ,2200 } +}; + +const struct white_point_coodinates_entry predefined_white_points[] = { + [white_point_type_5000k_horizon] = {5000 ,3473 ,3561 }, + [white_point_type_6500k_noon] = {6500 ,3127 ,3290 }, + [white_point_type_7500k_north_sky] = {7500 ,3022 ,3129 }, + [white_point_type_9300k] = {9300 ,2866 ,2950 } +}; + +const unsigned int white_point_entries =91 ; + +const struct white_point_coodinates_entry white_point_temps[] = { +/*001*/ {1000 ,6499 ,3474 }, +/*002*/ {1100 ,6361 ,3594 }, +/*003*/ {1200 ,6226 ,3703 }, +/*004*/ {1300 ,6095 ,3801 }, +/*005*/ {1400 ,5966 ,3887 }, +/*006*/ {1500 ,5841 ,3962 }, +/*007*/ {1600 ,5720 ,4025 }, +/*008*/ {1700 ,5601 ,4076 }, +/*009*/ {1800 ,5486 ,4118 }, +/*010*/ {1900 ,5375 ,4150 }, +/*011*/ {2000 ,5267 ,4173 }, +/*012*/ {2100 ,5162 ,4188 }, +/*013*/ {2200 ,5062 ,4196 }, +/*014*/ {2300 ,4965 ,4198 }, +/*015*/ {2400 ,4872 ,4194 }, +/*016*/ {2500 ,4782 ,4186 }, +/*017*/ {2600 ,4696 ,4173 }, +/*018*/ {2700 ,4614 ,4158 }, +/*019*/ {2800 ,4535 ,4139 }, +/*020*/ {2900 ,4460 ,4118 }, +/*021*/ {3000 ,4388 ,4095 }, +/*022*/ {3100 ,4320 ,4070 }, +/*023*/ {3200 ,4254 ,4044 }, +/*024*/ {3300 ,4192 ,4018 }, +/*025*/ {3400 ,4132 ,3990 }, +/*026*/ {3500 ,4075 ,3962 }, +/*027*/ {3600 ,4021 ,3934 }, +/*028*/ {3700 ,3969 ,3905 }, +/*029*/ {3800 ,3919 ,3877 }, +/*030*/ {3900 ,3872 ,3849 }, +/*031*/ {4000 ,3827 ,3820 }, +/*032*/ {4100 ,3784 ,3793 }, +/*033*/ {4200 ,3743 ,3765 }, +/*034*/ {4300 ,3704 ,3738 }, +/*035*/ {4400 ,3666 ,3711 }, +/*036*/ {4500 ,3631 ,3685 }, +/*037*/ {4600 ,3596 ,3659 }, +/*038*/ {4700 ,3563 ,3634 }, +/*039*/ {4800 ,3532 ,3609 }, +/*040*/ {4900 ,3502 ,3585 }, +/*041*/ {5000 ,3473 ,3561 }, +/*042*/ {5100 ,3446 ,3538 }, +/*043*/ {5200 ,3419 ,3516 }, +/*044*/ {5300 ,3394 ,3494 }, +/*045*/ {5400 ,3369 ,3472 }, +/*046*/ {5500 ,3346 ,3451 }, +/*047*/ {5600 ,3323 ,3431 }, +/*048*/ {5700 ,3302 ,3411 }, +/*049*/ {5800 ,3281 ,3392 }, +/*050*/ {5900 ,3261 ,3373 }, +/*051*/ {6000 ,3242 ,3355 }, +/*052*/ {6100 ,3223 ,3337 }, +/*053*/ {6200 ,3205 ,3319 }, +/*054*/ {6300 ,3188 ,3302 }, +/*055*/ {6400 ,3161 ,3296 }, +/*056*/ {6500 ,3127 ,3290 },/* This is the real white point sRGB */ +/*057*/ {6600 ,3126 ,3264 }, +/*058*/ {6700 ,3125 ,3238 }, +/*059*/ {6800 ,3110 ,3224 }, +/*060*/ {6900 ,3097 ,3209 }, +/*061*/ {7000 ,3083 ,3195 }, +/*062*/ {7100 ,3070 ,3181 }, +/*063*/ {7200 ,3058 ,3168 }, +/*064*/ {7300 ,3045 ,3154 }, +/*065*/ {7400 ,3034 ,3142 }, +/*066*/ {7500 ,3022 ,3129 }, +/*067*/ {7600 ,3011 ,3117 }, +/*068*/ {7700 ,3000 ,3105 }, +/*069*/ {7800 ,2990 ,3094 }, +/*070*/ {7900 ,2980 ,3082 }, +/*071*/ {8000 ,2970 ,3071 }, +/*072*/ {8100 ,2961 ,3061 }, +/*073*/ {8200 ,2952 ,3050 }, +/*074*/ {8300 ,2943 ,3040 }, +/*075*/ {8400 ,2934 ,3030 }, +/*076*/ {8500 ,2926 ,3020 }, +/*077*/ {8600 ,2917 ,3011 }, +/*078*/ {8700 ,2910 ,3001 }, +/*079*/ {8800 ,2902 ,2992 }, +/*080*/ {8900 ,2894 ,2983 }, +/*081*/ {9000 ,2887 ,2975 }, +/*082*/ {9100 ,2880 ,2966 }, +/*083*/ {9200 ,2873 ,2958 }, +/*084*/ {9300 ,2866 ,2950 }, +/*085*/ {9400 ,2860 ,2942 }, +/*086*/ {9500 ,2853 ,2934 }, +/*087*/ {9600 ,2847 ,2927 }, +/*088*/ {9700 ,2841 ,2919 }, +/*089*/ {9800 ,2835 ,2912 }, +/*090*/ {9900 ,2829 ,2905 }, +/*091*/ {10000 ,2824 ,2898 } +}; + +bool mod_color_find_predefined_gamut ( +struct gamut_space_coordinates *out_gamut, +enum predefined_gamut_type type) +{ + out_gamut->redX = predefined_gamuts[type].redX; + out_gamut->redY = predefined_gamuts[type].redY; + out_gamut->greenX = predefined_gamuts[type].greenX; + out_gamut->greenY = predefined_gamuts[type].greenY; + out_gamut->blueX = predefined_gamuts[type].blueX; + out_gamut->blueY = predefined_gamuts[type].blueY; + +return true; +} + +bool mod_color_find_predefined_white_point ( +struct white_point_coodinates *out_white_point, +enum predefined_white_point_type type) +{ + out_white_point->whiteX = predefined_white_points[type].whiteX; + out_white_point->whiteY = predefined_white_points[type].whiteY; + +return true; +} + +bool mod_color_find_white_point_from_temperature ( +struct white_point_coodinates *out_white_point, +unsigned int temperature) +{ +int i; +unsigned int found = false; +struct white_point_coodinates_entry temp_white_point = + white_point_temps[55 ]; + +if (temperature <1000 || temperature >10000 ) +return false; + +for (i =0 ; i < white_point_entries; i++) { +if (temperature == white_point_temps[i].temperature) { + temp_white_point = white_point_temps[i]; + found = true; +break ; + } + } + + out_white_point->whiteX = temp_white_point.whiteX; + out_white_point->whiteY = temp_white_point.whiteY; + +return found; +} + +bool mod_color_find_temperature_from_white_point ( +struct white_point_coodinates *in_white_point, +unsigned int *out_temperature) +{ +unsigned int i; + *out_temperature =6500 ; + +for (i =0 ; i < white_point_entries; i++) { +if (in_white_point->whiteX == white_point_temps[i].whiteX && + in_white_point->whiteY == white_point_temps[i].whiteY) { + *out_temperature = white_point_temps[i].temperature; +return true; + } + } + +return false; +} +
drivers/gpu/drm/amd/display/modules/color/color_helper.h new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/amd/display/modules/inc/mod_color.h +2 -2
@@ -28,6 +28,7 @@#define MOD_COLOR_H_ #include "dm_services.h" +#include "color_helper.h" struct mod_color {int dummy;
@@ -54,7 +55,6 @@ struct gamut_space_coordinates { };struct gamut_space_entry { -unsigned int index;unsigned int redX;unsigned int redY;unsigned int greenX;
@@ -75,7 +75,7 @@ struct white_point_coodinates { };struct white_point_coodinates_entry { -unsigned int index; +unsigned int temperature;unsigned int whiteX;unsigned int whiteY; };
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 02/22] drm/amd/display: Refactor to move color helper into module
Hi,
2016-12-21 17:29 GMT+01:00 Harry Wentland <[email protected]>:
Quoted 28 lines
From: Anthony Koo <[email protected]>
Refactor part 2 - Moving color helper into color module
The color module will need table defined in the helper in order to calculate the logical regamma curve, and also to fully handle gamut remapping.
Change-Id I826335cd42a9d5d0a872f9206fae83daeb1c45a6Signed-off-by Anthony Koo <[email protected]>Reviewed-by Aric Cyr <[email protected]>Acked-by Harry Wentland <[email protected]>--- .../drm/amd/display/modules/color/color_helper.c | 199 +++++++++++++++++++++ .../drm/amd/display/modules/color/color_helper.h | 50 ++++++ .../gpu/drm/amd/display/modules/inc/mod_color.h | 4 +- 3 files changed, 251 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.c create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.hdrivers/gpu/drm/amd/display/modules/color/color_helper.c new file +3
-0@@ -0,0 +1,199 @@ + +/** +* @file
drivers/gpu/drm/amd/display/modules/color/color_helper.c line 13
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.c new file +10
-0+* @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished) +* +* @brief Helper functions for color gamut calculation +* +* @internal +* All rights reserved. This notice is intended as a precaution against +* inadvertent publication and does not imply publication or any waiver +* of confidentiality. The year included in the foregoing notice is the +* year of creation of the work. +*/
This copyright header needs to be fixed.
Quoted 8 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.h new file +2
-0@@ -0,0 +1,50 @@ +/** +* @file
drivers/gpu/drm/amd/display/modules/color/color_helper.h line 12
Quoted 10 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.h new file +10
-0+* @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished) +* +* @brief Helper functions for color gamut calculation +* +* @internal +* All rights reserved. This notice is intended as a precaution against +* inadvertent publication and does not imply publication or any waiver +* of confidentiality. The year included in the foregoing notice is the +* year of creation of the work. +*/
same here
Thanks,
Andreas
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CACiKqBc-FNYgbZ1uVyMiaCr8VXHj1XxsdMJEXMSMot9r29sMsA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [PATCH 02/22] drm/amd/display: Refactor to move color helper into module
Hi Andreas,
Quoted 35 lines · Andreas Boll
Hi,
2016-12-21 17:29 GMT+01:00 Harry Wentland <[email protected]>:
Quoted 32 lines
From: Anthony Koo <[email protected]>
Refactor part 2 - Moving color helper into color module
The color module will need table defined in the helper in order to calculate the logical regamma curve, and also to fully handle gamut remapping.
Change-Id I826335cd42a9d5d0a872f9206fae83daeb1c45a6Signed-off-by Anthony Koo <[email protected]>Reviewed-by Aric Cyr <[email protected]>Acked-by Harry Wentland <[email protected]>--- .../drm/amd/display/modules/color/color_helper.c | 199 +++++++++++++++++++++ .../drm/amd/display/modules/color/color_helper.h | 50 ++++++ .../gpu/drm/amd/display/modules/inc/mod_color.h | 4 +- 3 files changed, 251 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.c create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_helper.hdrivers/gpu/drm/amd/display/modules/color/color_helper.c new file +7
-0@@ -0,0 +1,199 @@ + +/** +* @file +* @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished) +* +* @brief Helper functions for color gamut calculation +*
Quoted 8 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.c line 13
Quoted 6 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.c new file +6
-0+* @internal +* All rights reserved. This notice is intended as a precaution against +* inadvertent publication and does not imply publication or any waiver +* of confidentiality. The year included in the foregoing notice is the +* year of creation of the work. +*/ This copyright header needs to be fixed.
Thanks for spotting this.
Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.h new file +6
-0@@ -0,0 +1,50 @@ +/** +* @file +* @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished) +* +* @brief Helper functions for color gamut calculation +*
Quoted 8 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.h line 12
Quoted 6 lines
drivers/gpu/drm/amd/display/modules/color/color_helper.h new file +6
-0+* @internal +* All rights reserved. This notice is intended as a precaution against +* inadvertent publication and does not imply publication or any waiver +* of confidentiality. The year included in the foregoing notice is the +* year of creation of the work. +*/ same here
All fixed in attached patch.
Harry
Quoted 5 lines
Thanks,
AndreasFrom
536192a936450689fceba2b3867afcbdbac5c776Mon Sep 17 00:00:00 2001
From: Harry Wentland <[email protected]>
Date: Thu, 22 Dec 2016 10:25:57 -0500
Subject: [PATCH 10/14] drm/amd/display: Fix licensing header
--- .../drm/amd/display/modules/color/color_helper.c | 31 +++++++++++++++------- .../drm/amd/display/modules/color/color_helper.h | 30 ++++++++++++++------- 2 files changed, 42 insertions(+), 19 deletions(-)
drivers/gpu/drm/amd/display/modules/color/color_helper.c +21 -10
@@ -1,15 +1,26 @@ - -/** -* @file -* @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished) +/* +* Copyright 2016 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. * -* @brief Helper functions for color gamut calculation +* Authors: AMD * -* @internal -* All rights reserved. This notice is intended as a precaution against -* inadvertent publication and does not imply publication or any waiver -* of confidentiality. The year included in the foregoing notice is the -* year of creation of the work. */ #include "dm_services.h"
drivers/gpu/drm/amd/display/modules/color/color_helper.h +21 -9
@@ -1,14 +1,26 @@ -/** -* @file -* @date Copyright (c) 2008 Advanced Micro Devices, Inc. (unpublished) +/* +* Copyright 2016 Advanced Micro Devices, Inc. * -* @brief Helper functions for color gamut calculation +* 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 * -* @internal -* All rights reserved. This notice is intended as a precaution against -* inadvertent publication and does not imply publication or any waiver -* of confidentiality. The year included in the foregoing notice is the -* year of creation of the work. */ #ifndef COLOR_MOD_COLOR_HELPER_H_
Signature · 1 line
2.9.3
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/22 drm/amd/display: Add debug option to disable dmcu
In reply to a message not in the archiveFrom: Yongqiang Sun <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dc.h | 1 + drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
@@ -147,6 +147,7 @@ struct dc_debug {bool disable_dfs_bypass;bool disable_power_gate;bool disable_clock_gate; +bool disable_dmcu; };struct dc {
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +3 -0
@@ -1821,6 +1821,9 @@ void dce110_link_encoder_init_dmcu_backlight_settings(uint32_t s2;uint32_t value; +if (enc->ctx->dc->debug.disable_dmcu) +return ; + bl_pwm_cntl =REG_READ (BL_PWM_CNTL );/* It must not be 0, so we have to restore them
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/22 drm/amd/display: fix hotplug regression after code refactor
In reply to a message not in the archiveFrom: Roman Li <[email protected]>
The condition logic of REG_WAIT in dce110_stream_encoder_dp_blank() got inverted after refactoring.
--- drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +1 -1
@@ -635,7 +635,7 @@ static void dce110_stream_encoder_dp_blank(*/ REG_WAIT (DP_VID_STREAM_CNTL ,DP_VID_STREAM_STATUS , -1 , +0 ,10 , max_retries);ASSERT (retries <= max_retries);
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/22 drm/amd/display: Refactor output transfer function to stream
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
Refactor part 3 - Moving output transfer function from surface to stream
Split HWSS to program degamma and regamma separately. Degamma should be dependent on input transfer function. And Regamma should depend on the desired output transfer function.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 11 ++++ drivers/gpu/drm/amd/display/dc/core/dc.c | 23 +++++--- drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 3 + drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 3 - drivers/gpu/drm/amd/display/dc/dc.h | 7 ++- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 65 ++++++++++++++++++---- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 3 + drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h | 7 ++- 8 files changed, 95 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +11 -0
@@ -511,6 +511,7 @@ static void fill_gamma_from_crtc( {int i;struct dc_gamma *gamma; +struct dc_transfer_func *input_tf;uint16_t *red, *green, *blue;int end = (crtc->gamma_size >NUM_OF_RAW_GAMMA_RAMP_RGB_256 ) ?NUM_OF_RAW_GAMMA_RAMP_RGB_256 : crtc->gamma_size;
@@ -538,6 +539,16 @@ static void fill_gamma_from_crtc( gamma->size =sizeof (gamma->gamma_ramp_rgb256x3x16); dc_surface->gamma_correction = gamma; + + input_tf =dc_create_transfer_func (adev->dm.dc); + +if (input_tf ==NULL ) +return ; + + input_tf->type =TF_TYPE_PREDEFINED ; + input_tf->tf =TRANSFER_FUNCTION_SRGB ; + + dc_surface->in_transfer_func = input_tf; } static void fill_plane_attributes(
drivers/gpu/drm/amd/display/dc/core/dc.c +15 -8
@@ -1394,6 +1394,7 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *updafor (j =0 ; j < context->res_ctx.pool->pipe_count; j++) {struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j]; +struct core_stream *stream = pipe_ctx->stream;if (pipe_ctx->surface != surface)continue ;
@@ -1472,15 +1473,14 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *updaif (updates[i].out_transfer_func && updates[i].out_transfer_func != - surface->public.out_transfer_func) { -if (surface->public.out_transfer_func !=NULL ) + stream->public.out_transfer_func) { +if (stream->public.out_transfer_func !=NULL )dc_transfer_func_release ( - surface->public. + stream->public. out_transfer_func); -dc_transfer_func_retain ( updates[i].out_transfer_func); - surface->public.out_transfer_func = + stream->public.out_transfer_func = updates[i].out_transfer_func; } }
@@ -1517,11 +1517,18 @@ void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *upda }if (is_new_pipe_surface[j] || + updates[i].in_transfer_func) + core_dc->hwss.set_input_transfer_func ( + pipe_ctx, pipe_ctx->surface); + +if (is_new_pipe_surface[j] || updates[i].gamma || - updates[i].in_transfer_func || updates[i].out_transfer_func) - core_dc->hwss.set_gamma_correction ( - pipe_ctx, pipe_ctx->surface); + core_dc->hwss.set_output_transfer_func ( + pipe_ctx, + pipe_ctx->surface, + pipe_ctx->stream); + }if (apply_ctx) { core_dc->hwss.apply_ctx_for_surface (core_dc, surface, context);
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +3 -0
@@ -89,6 +89,9 @@ static bool construct(struct core_stream *stream,static void destruct (struct core_stream *stream) {dc_sink_release (&stream->sink->public); +if (stream->public.out_transfer_func !=NULL ) +dc_transfer_func_release ( + stream->public.out_transfer_func); }void dc_stream_retain (const struct dc_stream *dc_stream)
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +0 -3
@@ -76,9 +76,6 @@ static void destruct(struct surface *surface)if (surface->protected.public.in_transfer_func !=NULL )dc_transfer_func_release ( surface->protected.public.in_transfer_func); -if (surface->protected.public.out_transfer_func !=NULL ) -dc_transfer_func_release ( - surface->protected.public.out_transfer_func); }/*******************************************************************************
drivers/gpu/drm/amd/display/dc/dc.h +4 -3
@@ -254,6 +254,7 @@ struct dc_transfer_func_distributed_points {enum dc_transfer_func_predefined {TRANSFER_FUNCTION_SRGB ,TRANSFER_FUNCTION_BT709 , +TRANSFER_FUNCTION_PQ ,TRANSFER_FUNCTION_LINEAR , };
@@ -287,7 +288,6 @@ struct dc_surface {const struct dc_gamma *gamma_correction;const struct dc_transfer_func *in_transfer_func; -const struct dc_transfer_func *out_transfer_func; };struct dc_plane_info {
@@ -527,10 +527,11 @@ struct dc_stream {struct freesync_context freesync_ctx; -/* TODO: dithering */ -/* TODO: transfer function (CSC/regamma/gamut remap) */ +const struct dc_transfer_func *out_transfer_func;struct colorspace_transform gamut_remap_matrix;struct csc_transform csc_color_matrix; + +/* TODO: dithering */ /* TODO: custom INFO packets */ /* TODO: ABM info (DMCU) */ /* TODO: PSR info */
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +53 -12
91 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/inc/core_types.h +3 -0
@@ -55,6 +55,9 @@ struct core_target {#define DC_GAMMA_TO_CORE (dc_gamma) \ container_of(dc_gamma, struct core_gamma, public) +#define DC_TRANSFER_FUNC_TO_CORE (dc_transfer_func) \ + container_of(dc_transfer_func, struct core_transfer_func, public) +struct core_surface {struct dc_surface public;struct dc_surface_status status;
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +6 -1
@@ -77,10 +77,15 @@ struct hw_sequencer_funcs {void (*update_pending_status)(struct pipe_ctx *pipe_ctx); -bool (*set_gamma_correction)( +bool (*set_input_transfer_func)(struct pipe_ctx *pipe_ctx,const struct core_surface *surface); +bool (*set_output_transfer_func)( +struct pipe_ctx *pipe_ctx, +const struct core_surface *surface, +const struct core_stream *stream); +void (*power_down)(struct core_dc *dc);void (*enable_accelerated_mode)(struct core_dc *dc);
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/22 drm/amd/display: define reg helpers to update registers with 8 and 9 fields
In reply to a message not in the archiveFrom: Dmytro Laktyushkin <[email protected]>
--- drivers/gpu/drm/amd/display/dc/inc/reg_helper.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/display/dc/inc/reg_helper.h +25 -0
@@ -112,6 +112,31 @@ FN(reg, f6), v6,\ FN(reg, f7), v7) +#define REG_SET_8 (reg, init_value, f1, v1, f2, v2, f3, v3, f4, v4, \ + f5, v5, f6, v6, f7, v7, f8, v8) \ + REG_SET_N(reg, 8, init_value, \ + FN(reg, f1), v1,\ + FN(reg, f2), v2,\ + FN(reg, f3), v3,\ + FN(reg, f4), v4,\ + FN(reg, f5), v5,\ + FN(reg, f6), v6,\ + FN(reg, f7), v7,\ + FN(reg, f8), v8) + +#define REG_SET_9 (reg, init_value, f1, v1, f2, v2, f3, v3, f4, v4, f5, \ + v5, f6, v6, f7, v7, f8, v8, f9, v9) \ + REG_SET_N(reg, 9, init_value, \ + FN(reg, f1), v1,\ + FN(reg, f2), v2, \ + FN(reg, f3), v3, \ + FN(reg, f4), v4, \ + FN(reg, f5), v5, \ + FN(reg, f6), v6, \ + FN(reg, f7), v7, \ + FN(reg, f8), v8, \ + FN(reg, f9), v9) +#define REG_SET_10 (reg, init_value, f1, v1, f2, v2, f3, v3, f4, v4, f5, \ v5, f6, v6, f7, v7, f8, v8, f9, v9, f10, v10) \ REG_SET_N(reg, 10, init_value, \
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/22 drm/amd/display: Refactor to move gamma correction to module
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
Refactor part 4 - Moving input gamma correction programming into color module
DM will translate to dc_gamma structure, but programming will be moved into the color module. Later, this will allow gamma correction to be added on top of in/out transfer function curves.
--- drivers/gpu/drm/amd/display/modules/color/color.c | 77 ++++++++++++++++++++++ .../gpu/drm/amd/display/modules/inc/mod_color.h | 4 ++ 2 files changed, 81 insertions(+)
drivers/gpu/drm/amd/display/modules/color/color.c +77 -0
@@ -69,6 +69,7 @@ struct color_state {struct color_range saturation;struct color_range brightness;struct color_range hue; +struct dc_gamma *gamma;enum dc_quantization_range preferred_quantization_range; };
@@ -1265,6 +1266,26 @@ static void calculate_csc_matrix(struct core_color *core_color, } } +static struct dc_surface *dc_stream_to_surface_from_pipe_ctx ( +struct core_color *core_color, +const struct dc_stream *stream) +{ +int i; +struct core_dc *core_dc =DC_TO_CORE (core_color->dc); +struct core_stream *core_stream =DC_STREAM_TO_CORE (stream); +struct dc_surface *out_surface =NULL ; + +for (i =0 ; i <MAX_PIPES ; i++) { +if (core_dc->current_context->res_ctx.pipe_ctx[i].stream + == core_stream) { + out_surface = &core_dc->current_context->res_ctx. + pipe_ctx[i].surface->public; +break ; + } + } +return out_surface; +} +struct mod_color *mod_color_create (struct dc *dc) {int i =0 ;
@@ -1369,6 +1390,10 @@ void mod_color_destroy(struct mod_color *mod_color)struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color); +for (i =0 ; i < core_color->num_sinks; i++) +if (core_color->state[i].gamma) +dc_gamma_release (core_color->state[i].gamma); +dm_free (core_color->state);for (i =0 ; i < core_color->num_sinks; i++)
@@ -1552,6 +1577,9 @@ bool mod_color_remove_sink(struct mod_color *mod_color,for (i =0 ; i < core_color->num_sinks; i++) {if (core_color->caps[i].sink == sink) { +if (core_color->state[i].gamma) +dc_gamma_release (core_color->state[i].gamma); +/* To remove this sink, shift everything after down */ for (j = i; j < core_color->num_sinks -1 ; j++) { core_color->caps[j].sink =
@@ -2184,6 +2212,55 @@ bool mod_color_set_saturation(struct mod_color *mod_color,return true; } +bool mod_color_set_input_gamma_correction (struct mod_color *mod_color, +const struct dc_stream **streams,int num_streams, +struct dc_gamma *gamma) +{ +struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color); +unsigned int stream_index, sink_index; + +for (stream_index =0 ; stream_index < num_streams; stream_index++) { + sink_index =sink_index_from_sink (core_color, + streams[stream_index]->sink); + +struct dc_surface *surface = +dc_stream_to_surface_from_pipe_ctx (core_color, + streams[stream_index]); + +if (surface !=NULL ) { +struct dc_transfer_func *input_tf = +dc_create_transfer_func (core_color->dc); +struct dc_surface_update updates = {0 }; + +if (input_tf !=NULL ) { + input_tf->type =TF_TYPE_PREDEFINED ; + input_tf->tf =TRANSFER_FUNCTION_SRGB ; + } + +if (core_color->state[sink_index].gamma != gamma) { +if (core_color->state[sink_index].gamma) +dc_gamma_release ( + core_color->state[sink_index]. + gamma); + +dc_gamma_retain (gamma); + core_color->state[sink_index].gamma = gamma; + } + + updates.surface = surface; + updates.gamma = gamma; + updates.in_transfer_func = input_tf; +dc_update_surfaces_for_target (core_color->dc, &updates, +1 ,NULL ); + +if (input_tf !=NULL ) +dc_transfer_func_release (input_tf); + } + } + +return true; +} + bool mod_color_persist_user_preferred_quantization_range( struct mod_color *mod_color, const struct dc_sink *sink,
drivers/gpu/drm/amd/display/modules/inc/mod_color.h +4 -0
@@ -168,6 +168,10 @@ bool mod_color_set_saturation(struct mod_color *mod_color, const struct dc_stream **streams, int num_streams, int saturation_value); +bool mod_color_set_input_gamma_correction (struct mod_color *mod_color, +const struct dc_stream **streams,int num_streams, +struct dc_gamma *gamma); + bool mod_color_persist_user_preferred_quantization_range( struct mod_color *mod_color, const struct dc_sink *sink,
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/22 drm/amd/display: Implement PQ curve based on output transfer function
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
Refactor part 5 - Regamma programming should be dependent on Output transfer function type
Program sRGB gamma or PQ transfer function based on output transfer function.
--- drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c | 93 ++++++++++++++++++++-- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 3 +- drivers/gpu/drm/amd/display/dc/inc/gamma_calcs.h | 3 +- 3 files changed, 92 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c +88 -5
@@ -791,6 +791,82 @@ static inline struct fixed31_32 calculate_oem_mapped_value( max_index); } +static void compute_pq (struct fixed31_32 in_x,struct fixed31_32 *out_y) +{ +/* consts for PQ gamma formula. */ +const struct fixed31_32 m1 = +dal_fixed31_32_from_fraction (159301758 ,1000000000 ); +const struct fixed31_32 m2 = +dal_fixed31_32_from_fraction (7884375 ,100000 ); +const struct fixed31_32 c1 = +dal_fixed31_32_from_fraction (8359375 ,10000000 ); +const struct fixed31_32 c2 = +dal_fixed31_32_from_fraction (188515625 ,10000000 ); +const struct fixed31_32 c3 = +dal_fixed31_32_from_fraction (186875 ,10000 ); + +struct fixed31_32 l_pow_m1; +struct fixed31_32 base; + +if (dal_fixed31_32_lt (in_x, dal_fixed31_32_zero)) + in_x = dal_fixed31_32_zero; + + l_pow_m1 =dal_fixed31_32_pow (in_x, m1); + base =dal_fixed31_32_div ( +dal_fixed31_32_add (c1, + (dal_fixed31_32_mul (c2, l_pow_m1))), +dal_fixed31_32_add (dal_fixed31_32_one, + (dal_fixed31_32_mul (c3, l_pow_m1)))); + *out_y =dal_fixed31_32_pow (base, m2); +} + +static void build_regamma_curve_pq (struct pwl_float_data_ex *rgb_regamma, +struct pwl_float_data *rgb_oem, +struct pixel_gamma_point *coeff128_oem, +const struct core_gamma *ramp, +const struct core_surface *surface, +uint32_t hw_points_num, +const struct hw_x_point *coordinate_x, +const struct gamma_pixel *axis_x, +struct dividers dividers) +{ +uint32_t i; + +struct pwl_float_data_ex *rgb = rgb_regamma; +const struct hw_x_point *coord_x = coordinate_x; +struct fixed31_32 x; +struct fixed31_32 output; +struct fixed31_32 scaling_factor = +dal_fixed31_32_from_fraction (8 ,1000 ); + +/* use coord_x to retrieve coordinates chosen base on given user curve +* the x values are exponentially distributed and currently it is hard +* coded, the user curve shape is ignored. Need to recalculate coord_x +* based on input curve, translation from 256/1025 to 128 PWL points. +*/ +for (i =0 ; i <= hw_points_num; i++) { +/* Multiply 0.008 as regamma is 0-1 and FP16 input is 0-125. +* FP 1.0 = 80nits +*/ + x =dal_fixed31_32_mul (coord_x->adjusted_x, scaling_factor); + +compute_pq (x, &output); + +/* should really not happen? */ +if (dal_fixed31_32_lt (output, dal_fixed31_32_zero)) + output = dal_fixed31_32_zero; +else if (dal_fixed31_32_lt (dal_fixed31_32_one, output)) + output = dal_fixed31_32_one; + + rgb->r = output; + rgb->g = output; + rgb->b = output; + + ++coord_x; + ++rgb; + } +} + static void build_regamma_curve(struct pwl_float_data_ex *rgb_regamma, struct pwl_float_data *rgb_oem, struct pixel_gamma_point *coeff128_oem,
@@ -1286,7 +1362,8 @@ static bool convert_to_custom_float(bool calculate_regamma_params (struct pwl_params *params,const struct core_gamma *ramp, -const struct core_surface *surface) +const struct core_surface *surface, +const struct core_stream *stream) {struct gamma_curve *arr_curve_points = params->arr_curve_points;struct curve_points *arr_points = params->arr_points;
@@ -1301,7 +1378,6 @@ bool calculate_regamma_params(struct pwl_params *params,struct pixel_gamma_point *coeff128_oem =NULL ;struct pixel_gamma_point *coeff128 =NULL ; -bool ret = false; coordinates_x =dm_alloc (sizeof (*coordinates_x)*(256 +3 ));
@@ -1341,9 +1417,16 @@ bool calculate_regamma_params(struct pwl_params *params,setup_distribution_points (arr_curve_points, arr_points, ¶ms->hw_points_num, coordinates_x); -build_regamma_curve (rgb_regamma, rgb_oem, coeff128_oem, - ramp, surface, params->hw_points_num, - coordinates_x, axix_x_256, dividers); +if (stream->public.out_transfer_func && + stream->public.out_transfer_func->tf ==TRANSFER_FUNCTION_PQ ) { +build_regamma_curve_pq (rgb_regamma, rgb_oem, coeff128_oem, + ramp, surface, params->hw_points_num, + coordinates_x, axix_x_256, dividers); + }else { +build_regamma_curve (rgb_regamma, rgb_oem, coeff128_oem, + ramp, surface, params->hw_points_num, + coordinates_x, axix_x_256, dividers); + } map_regamma_hw_to_x_user(coeff128, rgb_oem, rgb_resulted, rgb_user, coordinates_x, axix_x_256, &ramp->public, rgb_regamma,
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 -1
@@ -303,7 +303,8 @@ static bool dce110_set_output_transfer_func( opp->funcs->opp_power_on_regamma_lut (opp, true); -if (ramp &&calculate_regamma_params (regamma_params, ramp, surface)) { +if (ramp &&calculate_regamma_params ( + regamma_params, ramp, surface, stream)) { opp->funcs->opp_program_regamma_pwl (opp, regamma_params); opp->funcs->opp_set_regamma_mode (opp,OPP_REGAMMA_USER ); }else {
drivers/gpu/drm/amd/display/dc/inc/gamma_calcs.h +2 -1
@@ -14,6 +14,7 @@bool calculate_regamma_params (struct pwl_params *params,const struct core_gamma *ramp, -const struct core_surface *surface); +const struct core_surface *surface, +const struct core_stream *stream);#endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_GAMMA_CALCS_H_ */
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/22 drm/amd/display: OPP refactor and consolidation for DCE.
In reply to a message not in the archiveFrom: Zeyu Fan <[email protected]>
--- drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dce/dce_opp.c | 996 +++++++++++++++++++++ drivers/gpu/drm/amd/display/dc/dce/dce_opp.h | 418 +++++++++ .../drm/amd/display/dc/dce100/dce100_resource.c | 61 +- drivers/gpu/drm/amd/display/dc/dce110/Makefile | 4 +- drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.c | 77 -- drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.h | 149 --- .../gpu/drm/amd/display/dc/dce110/dce110_opp_csc.c | 363 -------- .../drm/amd/display/dc/dce110/dce110_opp_csc_v.c | 2 +- .../amd/display/dc/dce110/dce110_opp_formatter.c | 627 ------------- .../drm/amd/display/dc/dce110/dce110_opp_regamma.c | 537 ----------- .../amd/display/dc/dce110/dce110_opp_regamma_v.c | 2 +- .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c | 2 +- .../drm/amd/display/dc/dce110/dce110_resource.c | 60 +- drivers/gpu/drm/amd/display/dc/dce112/Makefile | 3 +- drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.c | 72 -- drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.h | 48 - .../amd/display/dc/dce112/dce112_opp_formatter.c | 215 ----- .../drm/amd/display/dc/dce112/dce112_resource.c | 70 +- drivers/gpu/drm/amd/display/dc/dce80/Makefile | 5 +- drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.c | 136 --- drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.h | 130 --- .../gpu/drm/amd/display/dc/dce80/dce80_opp_csc.c | 363 -------- .../drm/amd/display/dc/dce80/dce80_opp_formatter.c | 577 ------------ .../drm/amd/display/dc/dce80/dce80_opp_regamma.c | 543 ----------- .../gpu/drm/amd/display/dc/dce80/dce80_resource.c | 45 +- 26 files changed, 1547 insertions(+), 3960 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_csc.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_formatter.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_regamma.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce112/dce112_opp_formatter.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.h delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_csc.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_formatter.c delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_regamma.c
drivers/gpu/drm/amd/display/dc/dce/Makefile +1 -1
@@ -7,7 +7,7 @@ DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \ dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \ -dce_clocks.o +dce_clocks.o dce_opp.o AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE))
drivers/gpu/drm/amd/display/dc/dce/dce_opp.c new file +996 -0
996 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce/dce_opp.h new file +418 -0
418 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +27 -34
97 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/Makefile +2 -2
@@ -3,8 +3,8 @@ # It provides the control and status of HW CRTC block. DCE110 = dce110_ipp.o dce110_ipp_cursor.o \ -dce110_ipp_gamma.o dce110_opp.o dce110_opp_csc.o \ -dce110_timing_generator.o dce110_opp_formatter.o dce110_opp_regamma.o \ +dce110_ipp_gamma.o \ +dce110_timing_generator.o \ dce110_compressor.o dce110_mem_input.o dce110_hw_sequencer.o \ dce110_resource.o \ dce110_opp_regamma_v.o dce110_opp_csc_v.o dce110_timing_generator_v.o \
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.c deleted +0 -77
77 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp.h deleted +0 -149
149 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_csc.c deleted +0 -363
363 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_csc_v.c +1 -1
@@ -24,7 +24,7 @@*/ #include "dm_services.h" -#include "dce110_opp.h" +#include "dce/dce_opp.h" #include "basics/conversion.h" /* include DCE11 register header files */
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_formatter.c deleted +0 -627
627 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_regamma.c deleted +0 -537
247 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_regamma_v.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +27 -33
60 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce112/Makefile +1 -2
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.c deleted +0 -72
72 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce112/dce112_opp.h deleted +0 -48
48 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce112/dce112_opp_formatter.c deleted +0 -215
215 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +27 -43
70 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce80/Makefile +2 -3
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.c deleted +0 -136
136 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce80/dce80_opp.h deleted +0 -130
130 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_csc.c deleted +0 -363
363 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_formatter.c deleted +0 -577
577 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce80/dce80_opp_regamma.c deleted +0 -543
543 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +43 -2
45 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Part of the diff is not shown here. View the raw message.
PATCH 10/22 drm/amd/display: Fix distribution of segments for PQ
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
For PQ case, redistribution of segments should be done differently for FP16 case in order to handle content above FP16 value of 1.0
--- drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c | 51 ++++++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c +48 -3
@@ -387,6 +387,49 @@ static bool build_hw_curve_configuration(return result; } +static bool setup_distribution_points_pq ( +struct gamma_curve *arr_curve_points, +struct curve_points *arr_points, +uint32_t *hw_points_num, +struct hw_x_point *coordinates_x, +enum surface_pixel_format format) +{ +struct curve_config cfg; + + cfg.offset =0 ; + cfg.segments[0 ] =2 ; + cfg.segments[1 ] =2 ; + cfg.segments[2 ] =2 ; + cfg.segments[3 ] =2 ; + cfg.segments[4 ] =2 ; + cfg.segments[5 ] =2 ; + cfg.segments[6 ] =3 ; + cfg.segments[7 ] =4 ; + cfg.segments[8 ] =4 ; + cfg.segments[9 ] =4 ; + cfg.segments[10 ] =4 ; + cfg.segments[11 ] =5 ; + cfg.segments[12 ] =5 ; + cfg.segments[13 ] =5 ; + cfg.segments[14 ] =5 ; + cfg.segments[15 ] =5 ; + +if (format ==SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F || + format ==SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F ) + cfg.begin =-11 ; +else + cfg.begin =-16 ; + +if (!build_hw_curve_configuration ( + &cfg, arr_curve_points, + arr_points, + coordinates_x, hw_points_num)) { +ASSERT_CRITICAL (false); +return false; + } +return true; +} + static bool setup_distribution_points( struct gamma_curve *arr_curve_points, struct curve_points *arr_points,
@@ -1414,15 +1457,17 @@ bool calculate_regamma_params(struct pwl_params *params,scale_gamma (rgb_user, ramp, dividers); -setup_distribution_points (arr_curve_points, arr_points, - ¶ms->hw_points_num, coordinates_x); -if (stream->public.out_transfer_func && stream->public.out_transfer_func->tf ==TRANSFER_FUNCTION_PQ ) { +setup_distribution_points_pq (arr_curve_points, arr_points, + ¶ms->hw_points_num, coordinates_x, + surface->public.format);build_regamma_curve_pq (rgb_regamma, rgb_oem, coeff128_oem, ramp, surface, params->hw_points_num, coordinates_x, axix_x_256, dividers); }else { +setup_distribution_points (arr_curve_points, arr_points, + ¶ms->hw_points_num, coordinates_x);build_regamma_curve (rgb_regamma, rgb_oem, coeff128_oem, ramp, surface, params->hw_points_num, coordinates_x, axix_x_256, dividers);
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/22 drm/amd/display: Fix programming of gamma end points
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
--- drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c | 51 ++++++++++++---------- 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c +27 -24
@@ -245,6 +245,8 @@ static bool build_hw_curve_configuration(uint32_t segments =0 ;uint32_t max_number; +int8_t num_regions =0 ; +bool result = false;if (!number_of_points) {
@@ -273,6 +275,7 @@ static bool build_hw_curve_configuration(ASSERT (curve_config->segments[i] >=0 ); segments += (1 << curve_config->segments[i]); + ++num_regions; ++i; }
@@ -284,12 +287,14 @@ static bool build_hw_curve_configuration(uint32_t offset =0 ;int8_t begin = curve_config->begin;int32_t region_number =0 ; +struct fixed31_32 magic_number = +dal_fixed31_32_from_fraction (249 ,1000 ); i = begin;while ((index < max_number) && (region_number < max_regions_number) && - (i <=1 )) { + (i < (begin + num_regions))) {int32_t j =0 ; segments = curve_config->segments[region_number];
@@ -345,8 +350,7 @@ static bool build_hw_curve_configuration( divisor); points[index].x = region1; - -round_custom_float_6_12 (points + index); + points[index].adjusted_x = region1; ++index; ++region_number;
@@ -366,9 +370,10 @@ static bool build_hw_curve_configuration( ++i; } - points[index].x = region1; - -round_custom_float_6_12 (points + index); + points[index].x = +dal_fixed31_32_add (region1, magic_number); + points[index].adjusted_x = +dal_fixed31_32_add (region1, magic_number); *number_of_points = index;
@@ -1215,15 +1220,11 @@ static void rebuild_curve_configuration_magic( const struct hw_x_point *coordinates_x, uint32_t hw_points_num) { -const struct fixed31_32 magic_number = -dal_fixed31_32_from_fraction (249 ,1000 ); -struct fixed31_32 y_r;struct fixed31_32 y_g;struct fixed31_32 y_b;struct fixed31_32 y1_min; -struct fixed31_32 y2_max;struct fixed31_32 y3_max; y_r = rgb_resulted[0 ].red;
@@ -1238,29 +1239,31 @@ static void rebuild_curve_configuration_magic( arr_points[0 ].y, arr_points[0].x); - arr_points[1 ].x =dal_fixed31_32_add ( - coordinates_x[hw_points_num -1 ].adjusted_x, - magic_number); - - arr_points[2 ].x = arr_points[1 ].x; - - y_r = rgb_resulted[hw_points_num -1 ].red; - y_g = rgb_resulted[hw_points_num -1 ].green; - y_b = rgb_resulted[hw_points_num -1 ].blue; - - y2_max =dal_fixed31_32_max (y_r,dal_fixed31_32_max (y_g, y_b)); - - arr_points[1 ].y = y2_max; +/* this should be cleaned up as it's confusing my understanding (KK) is +* that REGAMMA_CNTLA_EXP_REGION_END is the X value for the region end +* REGAMMA_CNTLA_EXP_REGION_END_BASE is Y value for the above X +* REGAMMA_CNTLA_EXP_REGION_END_SLOPE is the slope beyond (X,Y) above +* currently when programming REGION_END = m_arrPoints[1].x, +* REGION_END_BASE = m_arrPoints[1].y, REGION_END_SLOPE=1 +* we don't use m_arrPoints[2] at all after this function, +* and its purpose isn't clear to me +*/ + arr_points[1 ].x = coordinates_x[hw_points_num].adjusted_x; + arr_points[2 ].x = coordinates_x[hw_points_num].adjusted_x; y_r = rgb_resulted[hw_points_num].red; y_g = rgb_resulted[hw_points_num].green; y_b = rgb_resulted[hw_points_num].blue; +/* see comment above, m_arrPoints[1].y should be the Y value for the +* region end (m_numOfHwPoints), not last HW point(m_numOfHwPoints - 1) +*/ y3_max =dal_fixed31_32_max (y_r,dal_fixed31_32_max (y_g, y_b)); + arr_points[1 ].y = y3_max; arr_points[2 ].y = y3_max; - arr_points[2 ].slope = dal_fixed31_32_one; + arr_points[2 ].slope = dal_fixed31_32_zero; } static bool convert_to_custom_float_format(
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/22 drm/amd/display: remove dc hub - this seems unused.
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 27 ---------------------- drivers/gpu/drm/amd/display/dc/dc.h | 17 -------------- .../drm/amd/display/dc/dce110/dce110_mem_input.c | 1 - .../gpu/drm/amd/display/dc/dce80/dce80_mem_input.c | 1 - drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h | 2 -- 5 files changed, 48 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -27
@@ -1871,30 +1871,3 @@ const struct dc_stream_status *dc_stream_get_status(return &stream->status; } -bool dc_init_dchub (struct dc *dc,struct dchub_init_data *dh_data) -{ -int i; -struct core_dc *core_dc =DC_TO_CORE (dc); -struct mem_input *mi =NULL ; - -for (i =0 ; i < core_dc->res_pool->pipe_count; i++) { -if (core_dc->res_pool->mis[i] !=NULL ) { - mi = core_dc->res_pool->mis[i]; -break ; - } - } -if (mi ==NULL ) { -dm_error ("no mem_input!\n" ); -return false; - } - -if (mi->funcs->mem_input_update_dchub) - mi->funcs->mem_input_update_dchub (mi, dh_data); -else -ASSERT (mi->funcs->mem_input_update_dchub); - - -return true; - -} -
drivers/gpu/drm/amd/display/dc/dc.h +0 -17
@@ -159,21 +159,6 @@ struct dc {struct dc_debug debug; }; -enum frame_buffer_mode { -FRAME_BUFFER_MODE_LOCAL_ONLY =0 , -FRAME_BUFFER_MODE_ZFB_ONLY , -FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL , -} ; - -struct dchub_init_data { -bool dchub_initialzied; -bool dchub_info_valid; -int64_t zfb_phys_addr_base; -int64_t zfb_mc_base_addr; -uint64_t zfb_size_in_byte; -enum frame_buffer_mode fb_mode; -}; -struct dc_init_data {struct hw_asic_id asic_id;void *driver;/* ctx */
@@ -194,8 +179,6 @@ struct dc *dc_create(const struct dc_init_data *init_params);void dc_destroy (struct dc **dc); -bool dc_init_dchub (struct dc *dc,struct dchub_init_data *dh_data); -/******************************************************************************* * Surface Interfaces ******************************************************************************/
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input.c +0 -1
@@ -409,7 +409,6 @@ static struct mem_input_funcs dce110_mem_input_funcs = { dce_mem_input_program_surface_config, .mem_input_is_flip_pending = dce110_mem_input_is_flip_pending, - .mem_input_update_dchub = NULL };/*****************************************/ /* Constructor, Destructor */
drivers/gpu/drm/amd/display/dc/dce80/dce80_mem_input.c +0 -1
@@ -54,7 +54,6 @@ static struct mem_input_funcs dce80_mem_input_funcs = { dce_mem_input_program_surface_config, .mem_input_is_flip_pending = dce110_mem_input_is_flip_pending, - .mem_input_update_dchub = NULL };/*****************************************/
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +0 -2
@@ -99,8 +99,6 @@ struct mem_input_funcs { bool (*mem_input_is_flip_pending)(struct mem_input *mem_input); -void (*mem_input_update_dchub)(struct mem_input *mem_input, - struct dchub_init_data *dh_data); };#endif
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/22 drm/amd/display: remove some unused wrappers
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c +0 -4
@@ -36,10 +36,6 @@#include "amdgpu_dm_types.h" #include "amdgpu_pm.h" -#define dm_alloc (size) kzalloc(size, GFP_KERNEL) -#define dm_realloc (ptr, size) krealloc(ptr, size, GFP_KERNEL) -#define dm_free (ptr) kfree(ptr) -/****************************************************************************** * IRQ Interfaces. *****************************************************************************/
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/22 drm/amd/display: drop register logger and pid/tgid getters
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
While I'm sure this is useful I think we should bring it back later.
It's usage of pid/tgid is incorrect, you have to get/put pid/tgids not store them away.
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c | 10 -- drivers/gpu/drm/amd/display/dc/basics/Makefile | 2 +- .../drm/amd/display/dc/basics/register_logger.c | 197 --------------------- drivers/gpu/drm/amd/display/dc/dm_services.h | 16 -- .../drm/amd/display/include/dal_register_logger.h | 42 ----- 5 files changed, 1 insertion(+), 266 deletions(-) delete mode 100644 drivers/gpu/drm/amd/display/dc/basics/register_logger.c delete mode 100644 drivers/gpu/drm/amd/display/include/dal_register_logger.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c +0 -10
@@ -447,13 +447,3 @@ void dal_notify_setmode_complete(struct dc_context *ctx,/*TODO*/ }/* End of calls to notification */ - -long dm_get_pid (void ) -{ -return current->pid; -} - -long dm_get_tgid (void ) -{ -return current->tgid; -}
drivers/gpu/drm/amd/display/dc/basics/Makefile +1 -1
@@ -4,7 +4,7 @@ # subcomponents. BASICS = conversion.o fixpt31_32.o fixpt32_32.o grph_object_id.o \ - logger.o log_helpers.o register_logger.o signal_types.o vector.o + logger.o log_helpers.o signal_types.o vector.o AMD_DAL_BASICS = $(addprefix $(AMDDALPATH)/dc/basics/,$(BASICS))
drivers/gpu/drm/amd/display/dc/basics/register_logger.c deleted +0 -197
197 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/dm_services.h +0 -16
@@ -109,12 +109,6 @@ static inline uint32_t dm_read_reg_func( value =cgs_read_register (ctx->cgs_device, address); -#if defined(__DAL_REGISTER_LOGGER__) -if (true ==dal_reg_logger_should_dump_register ()) { -dal_reg_logger_rw_count_increment (); -DRM_INFO ("%s DC_READ_REG: 0x%x 0x%x\n" , func_name, address, value); - } -#endif return value; }
@@ -127,13 +121,6 @@ static inline void dm_write_reg_func( uint32_t value, const char *func_name) { -#if defined(__DAL_REGISTER_LOGGER__) -if (true ==dal_reg_logger_should_dump_register ()) { -dal_reg_logger_rw_count_increment (); -DRM_INFO ("%s DC_WRITE_REG: 0x%x 0x%x\n" , func_name, address, value); - } -#endif -if (address ==0 ) {DC_ERR ("invalid register write. address = 0" );return ;
@@ -418,7 +405,4 @@ bool dm_dmcu_set_pipe(struct dc_context *ctx, unsigned int controller_id);#define dm_log_to_buffer (buffer, size, fmt, args)\ vsnprintf(buffer, size, fmt, args) -long dm_get_pid (void ); -long dm_get_tgid (void ); -#endif /* __DM_SERVICES_H__ */
drivers/gpu/drm/amd/display/include/dal_register_logger.h deleted +0 -42
42 lines not on this page · raw message
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/22 drm/amd/display: drop get platform info
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
--- .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c | 7 ----- drivers/gpu/drm/amd/display/dc/dm_services.h | 32 ---------------------- 2 files changed, 39 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c +0 -7
@@ -77,13 +77,6 @@ void dal_isr_release_lock(struct dc_context *ctx)* End-of-IRQ Interfaces. *****************************************************************************/ -bool dm_get_platform_info (struct dc_context *ctx, -struct platform_info_params *params) -{ -/*TODO*/ -return false; -} - bool dm_write_persistent_data(struct dc_context *ctx, const struct dc_sink *sink, const char *module_name,
drivers/gpu/drm/amd/display/dc/dm_services.h +0 -32
@@ -282,38 +282,6 @@ bool dm_pp_get_static_clocks(/****** end of PP interfaces ******/ -enum platform_method { -PM_GET_AVAILABLE_METHODS =1 <<0 , -PM_GET_LID_STATE =1 <<1 , -PM_GET_EXTENDED_BRIGHNESS_CAPS =1 <<2 -}; - -struct platform_info_params { -enum platform_method method; -void *data; -}; - -struct platform_info_brightness_caps { -uint8_t ac_level_percentage; -uint8_t dc_level_percentage; -}; - -struct platform_info_ext_brightness_caps { -struct platform_info_brightness_caps basic_caps; -struct data_point { -uint8_t luminance; -uint8_t signal_level; - } data_points[99 ]; - -uint8_t data_points_num; -uint8_t min_input_signal; -uint8_t max_input_signal; -}; - -bool dm_get_platform_info ( -struct dc_context *ctx, -struct platform_info_params *params); -struct persistent_data_flag {bool save_per_link;bool save_per_edid;
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/22 drm/amd/display: drop setmode complete notifier
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c +0 -13
@@ -427,16 +427,3 @@ bool dm_pp_get_static_clocks( }/**** end of power component interfaces ****/ - -/* Calls to notification */ - -void dal_notify_setmode_complete (struct dc_context *ctx, -uint32_t h_total, -uint32_t v_total, -uint32_t h_active, -uint32_t v_active, -uint32_t pix_clk_in_khz) -{ -/*TODO*/ -} -/* End of calls to notification */
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/22 drm/amd/display: Move dpcd structs into dp_types header
In reply to a message not in the archive--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 1 + drivers/gpu/drm/amd/display/dc/dc.h | 1 - drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 359 +++++++++++++++++++++ drivers/gpu/drm/amd/display/include/dpcd_defs.h | 358 -------------------- .../drm/amd/display/include/link_service_types.h | 1 - 6 files changed, 361 insertions(+), 360 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -0
@@ -39,6 +39,7 @@#include "resource.h" #include "fixed31_32.h" #include "include/asic_capability_interface.h" +#include "dpcd_defs.h" #include "dce/dce_11_0_d.h" #include "dce/dce_11_0_enum.h"
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +1 -0
@@ -13,6 +13,7 @@#include "dm_helpers.h" #include "dce/dce_link_encoder.h" #include "dce/dce_stream_encoder.h" +#include "dpcd_defs.h" enum dc_status core_link_read_dpcd( struct core_link* link,
drivers/gpu/drm/amd/display/dc/dc.h +0 -1
@@ -27,7 +27,6 @@#define DC_INTERFACE_H_ #include "dc_types.h" -#include "dpcd_defs.h" #include "grph_object_defs.h" #include "logger_types.h" #include "gpio_types.h"
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +359 -0
363 lines not on this page · raw message
drivers/gpu/drm/amd/display/include/dpcd_defs.h +0 -358
362 lines not on this page · raw message
drivers/gpu/drm/amd/display/include/link_service_types.h +0 -1
@@ -27,7 +27,6 @@#define __DAL_LINK_SERVICE_TYPES_H__#include "grph_object_id.h" -#include "dpcd_defs.h" #include "dal_types.h" #include "irq_types.h"
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 18/22 drm/amd/display: port to using drm dpcd defines
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
We only keep one list of these defines in the kernel, so we should use it.
--- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 8 +- drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 144 ++++++------- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 2 +- drivers/gpu/drm/amd/display/include/dpcd_defs.h | 223 +-------------------- 5 files changed, 79 insertions(+), 300 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +4 -4
@@ -1158,7 +1158,7 @@ static void dpcd_configure_panel_mode(/*set edp panel mode in receiver*/ core_link_read_dpcd ( link, -DPCD_ADDRESS_EDP_CONFIG_SET , +DP_EDP_CONFIGURATION_SET , &edp_config_set.raw,sizeof (edp_config_set.raw));
@@ -1170,7 +1170,7 @@ static void dpcd_configure_panel_mode( panel_mode_edp; result =core_link_write_dpcd ( link, -DPCD_ADDRESS_EDP_CONFIG_SET , +DP_EDP_CONFIGURATION_SET , &edp_config_set.raw,sizeof (edp_config_set.raw));
@@ -1191,13 +1191,13 @@ static void enable_stream_features(struct pipe_ctx *pipe_ctx)struct core_link *link = stream->sink->link;union down_spread_ctrl downspread; -core_link_read_dpcd (link,DPCD_ADDRESS_DOWNSPREAD_CNTL , +core_link_read_dpcd (link,DP_DOWNSPREAD_CTRL , &downspread.raw,sizeof (downspread)); downspread.bits.IGNORE_MSA_TIMING_PARAM = (stream->public.ignore_msa_timing_param) ?1 :0 ; -core_link_write_dpcd (link,DPCD_ADDRESS_DOWNSPREAD_CNTL , +core_link_write_dpcd (link,DP_DOWNSPREAD_CTRL , &downspread.raw,sizeof (downspread)); }
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c +1 -1
@@ -872,7 +872,7 @@ void dal_ddc_service_i2c_query_dp_dual_mode_adaptor(enum {DP_SINK_CAP_SIZE = -DPCD_ADDRESS_EDP_CONFIG_CAP -DPCD_ADDRESS_DPCD_REV +1 +DP_EDP_CONFIGURATION_CAP -DP_DPCD_REV +1 }; bool dal_ddc_service_query_ddc_data(
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +72 -72
482 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +1 -1
@@ -49,7 +49,7 @@ void dp_receiver_power_ctrl(struct core_link *link, bool on) state = on ?DP_POWER_STATE_D0 :DP_POWER_STATE_D3 ; -core_link_write_dpcd (link,DPCD_ADDRESS_POWER_STATE , &state, +core_link_write_dpcd (link,DP_SET_POWER , &state,sizeof (state)); }
drivers/gpu/drm/amd/display/include/dpcd_defs.h +1 -222
235 lines not on this page · raw message
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 19/22 drm/amd/display: assign correct enum for edp revision
In reply to a message not in the archiveFrom: Dave Airlie <[email protected]>
There are 2 edp enum revisions, no idea why, drop one, and just assign 1.1 to the default value.
--- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- drivers/gpu/drm/amd/display/include/dpcd_defs.h | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
@@ -2129,7 +2129,7 @@ static void retrieve_link_cap(struct core_link *link) link->dpcd_caps.panel_mode_edp = edp_config_cap.bits.ALT_SCRAMBLER_RESET; - link->edp_revision =DPCD_EDP_REVISION_EDP_UNKNOWN ; + link->edp_revision =EDP_REVISION_11 ; link->public.test_pattern_enabled = false; link->public.compliance_test_state.raw =0 ;
drivers/gpu/drm/amd/display/include/dpcd_defs.h +0 -16
@@ -144,20 +144,4 @@ enum dpcd_psr_sink_states { PSR_SINK_STATE_SINK_INTERNAL_ERROR = 7, }; -/* This enum defines the Panel's eDP revision at DPCD 700h -* 00h = eDP v1.1 or lower -* 01h = eDP v1.2 -* 02h = eDP v1.3 (PSR support starts here) -* 03h = eDP v1.4 -* If unknown revision, treat as eDP v1.1, meaning least functionality set. -* This enum has values matched to eDP spec, thus values should not change. -*/ -enum dpcd_edp_revision { -DPCD_EDP_REVISION_EDP_V1_1 =0 , -DPCD_EDP_REVISION_EDP_V1_2 =1 , -DPCD_EDP_REVISION_EDP_V1_3 =2 , -DPCD_EDP_REVISION_EDP_V1_4 =3 , -DPCD_EDP_REVISION_EDP_UNKNOWN =DPCD_EDP_REVISION_EDP_V1_1 , -}; -#endif /* __DAL_DPCD_DEFS_H__ */
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 20/22 drm/amd/display: Framework for degamma and regramma through color module
In reply to a message not in the archiveFrom: Amy Zhang <[email protected]>
--- drivers/gpu/drm/amd/display/modules/color/color.c | 575 +++++++++++++++++---- .../drm/amd/display/modules/color/color_helper.h | 2 +- .../gpu/drm/amd/display/modules/inc/mod_color.h | 115 ++++- 3 files changed, 598 insertions(+), 94 deletions(-)
drivers/gpu/drm/amd/display/modules/color/color.c +487 -88
@@ -63,14 +63,18 @@ struct gamut_src_dst_matrix {struct color_state {bool user_enable_color_temperature;int custom_color_temperature; -struct color_space_coordinates source_gamut; -struct color_space_coordinates destination_gamut;struct color_range contrast;struct color_range saturation;struct color_range brightness;struct color_range hue;struct dc_gamma *gamma;enum dc_quantization_range preferred_quantization_range; + +struct color_gamut_data source_gamut; +struct color_gamut_data destination_gamut; +enum color_transfer_func input_transfer_function; +enum color_transfer_func output_transfer_function; +struct color_mastering_info mastering_info; };struct core_color {
@@ -79,6 +83,7 @@ struct core_color {int num_sinks;struct sink_caps *caps;struct color_state *state; +struct color_edid_caps *edid_caps; };#define MOD_COLOR_TO_CORE (mod_color)\
@@ -1286,6 +1291,142 @@ static struct dc_surface *dc_stream_to_surface_from_pipe_ctx(return out_surface; } +static enum predefined_gamut_type color_space_to_predefined_gamut_types (enum +color_color_space color_space) +{ +switch (color_space) { +case color_space_bt709: +case color_space_xv_ycc_bt709: +return gamut_type_bt709; +case color_space_bt601: +case color_space_xv_ycc_bt601: +return gamut_type_bt601; +case color_space_adobe: +return gamut_type_adobe_rgb; +case color_space_srgb: +case color_space_sc_rgb_ms_ref: +return gamut_type_srgb; +case color_space_bt2020: +return gamut_type_bt2020; +case color_space_dci_p3:/* TODO */ +default : +return gamut_type_unknown; + } +} + +static enum predefined_white_point_type white_point_to_predefined_white_point + (enum color_white_point_type white_point) +{ +switch (white_point) { +case color_white_point_type_5000k_horizon: +return white_point_type_5000k_horizon; +case color_white_point_type_6500k_noon: +return white_point_type_6500k_noon; +case color_white_point_type_7500k_north_sky: +return white_point_type_7500k_north_sky; +case color_white_point_type_9300k: +return white_point_type_9300k; +default : +return white_point_type_unknown; + } +} + +static bool update_color_gamut_data (struct color_gamut_data *input_data, +struct color_gamut_data *output_data) +{ +bool output_custom_cs = false; +bool output_custom_wp = false; + +if (input_data ==NULL || output_data ==NULL ) +return false; + +if (input_data->color_space == color_space_custom_coordinates) { + output_data->color_space = input_data->color_space; + output_data->gamut.redX = input_data->gamut.redX; + output_data->gamut.redY = input_data->gamut.redY; + output_data->gamut.greenX = input_data->gamut.greenX; + output_data->gamut.greenY = input_data->gamut.greenY; + output_data->gamut.blueX = input_data->gamut.blueX; + output_data->gamut.blueY = input_data->gamut.blueY; + }else { +struct gamut_space_coordinates gamut_coord; +enum predefined_gamut_type gamut_type = +color_space_to_predefined_gamut_types + (input_data->color_space); + +/* fall back to original color space if unknown */ +if (gamut_type == gamut_type_unknown) { +if (output_data->color_space == + color_space_custom_coordinates) { + output_custom_cs = true; + }else { + gamut_type = +color_space_to_predefined_gamut_types + (output_data->color_space); +/* fall back to sRGB if both unknown*/ +if (gamut_type == gamut_type_unknown) { + output_data->color_space = + color_space_srgb; + gamut_type = gamut_type_srgb; + } + } + }else { + output_data->color_space = input_data->color_space; + } + +if (!output_custom_cs) { +mod_color_find_predefined_gamut (&gamut_coord, + gamut_type); + output_data->gamut.redX = gamut_coord.redX; + output_data->gamut.redY = gamut_coord.redY; + output_data->gamut.greenX = gamut_coord.greenX; + output_data->gamut.greenY = gamut_coord.greenY; + output_data->gamut.blueX = gamut_coord.blueX; + output_data->gamut.blueY = gamut_coord.blueY; + } + } + +if (input_data->white_point == color_space_custom_coordinates) { + output_data->white_point = input_data->white_point; + output_data->gamut.whiteX = input_data->gamut.whiteX; + output_data->gamut.whiteY = input_data->gamut.whiteY; + }else { +struct white_point_coodinates white_point_coord; +enum predefined_white_point_type white_type = +white_point_to_predefined_white_point + (input_data->white_point); + +/* fall back to original white point if not found */ +if (white_type == white_point_type_unknown) { +if (output_data->white_point == + color_white_point_type_custom_coordinates) { + output_custom_wp = true; + }else { + white_type = +white_point_to_predefined_white_point + (output_data->white_point); +/* fall back to 6500 if both unknown*/ +if (white_type == white_point_type_unknown) { + output_data->white_point = + color_white_point_type_6500k_noon; + white_type = + white_point_type_6500k_noon; + } + } + }else { + output_data->white_point = input_data->white_point; + } + +if (!output_custom_wp) { +mod_color_find_predefined_white_point ( + &white_point_coord, white_type); + output_data->gamut.whiteX = white_point_coord.whiteX; + output_data->gamut.whiteY = white_point_coord.whiteY; + } + } +return true; +} +struct mod_color *mod_color_create (struct dc *dc) {int i =0 ;
@@ -1311,23 +1452,36 @@ struct mod_color *mod_color_create(struct dc *dc)/*hardcoded to sRGB with 6500 color temperature*/ for (i =0 ; i <MOD_COLOR_MAX_CONCURRENT_SINKS ; i++) { - core_color->state[i].source_gamut.blueX =1500 ; - core_color->state[i].source_gamut.blueY =600 ; - core_color->state[i].source_gamut.greenX =3000 ; - core_color->state[i].source_gamut.greenY =6000 ; - core_color->state[i].source_gamut.redX =6400 ; - core_color->state[i].source_gamut.redY =3300 ; - core_color->state[i].source_gamut.whiteX =3127 ; - core_color->state[i].source_gamut.whiteY =3290 ; - - core_color->state[i].destination_gamut.blueX =1500 ; - core_color->state[i].destination_gamut.blueY =600 ; - core_color->state[i].destination_gamut.greenX =3000 ; - core_color->state[i].destination_gamut.greenY =6000 ; - core_color->state[i].destination_gamut.redX =6400 ; - core_color->state[i].destination_gamut.redY =3300 ; - core_color->state[i].destination_gamut.whiteX =3127 ; - core_color->state[i].destination_gamut.whiteY =3290 ; + core_color->state[i].source_gamut.color_space = + color_space_srgb; + core_color->state[i].source_gamut.white_point = + color_white_point_type_6500k_noon; + core_color->state[i].source_gamut.gamut.blueX =1500 ; + core_color->state[i].source_gamut.gamut.blueY =600 ; + core_color->state[i].source_gamut.gamut.greenX =3000 ; + core_color->state[i].source_gamut.gamut.greenY =6000 ; + core_color->state[i].source_gamut.gamut.redX =6400 ; + core_color->state[i].source_gamut.gamut.redY =3300 ; + core_color->state[i].source_gamut.gamut.whiteX =3127 ; + core_color->state[i].source_gamut.gamut.whiteY =3290 ; + + core_color->state[i].destination_gamut.color_space = + color_space_srgb; + core_color->state[i].destination_gamut.white_point = + color_white_point_type_6500k_noon; + core_color->state[i].destination_gamut.gamut.blueX =1500 ; + core_color->state[i].destination_gamut.gamut.blueY =600 ; + core_color->state[i].destination_gamut.gamut.greenX =3000 ; + core_color->state[i].destination_gamut.gamut.greenY =6000 ; + core_color->state[i].destination_gamut.gamut.redX =6400 ; + core_color->state[i].destination_gamut.gamut.redY =3300 ; + core_color->state[i].destination_gamut.gamut.whiteX =3127 ; + core_color->state[i].destination_gamut.gamut.whiteY =3290 ; + + core_color->state[i].input_transfer_function = + transfer_func_srgb; + core_color->state[i].output_transfer_function = + transfer_func_srgb; core_color->state[i].custom_color_temperature =6500 ;
@@ -1351,6 +1505,12 @@ struct mod_color *mod_color_create(struct dc *dc)if (core_color->state ==NULL ) goto fail_alloc_state; + core_color->edid_caps =dm_alloc (sizeof (struct color_edid_caps ) * +MOD_COLOR_MAX_CONCURRENT_SINKS ); + +if (core_color->edid_caps ==NULL ) + goto fail_alloc_edid_caps; + core_color->num_sinks =0 ;if (dc ==NULL )
@@ -1371,6 +1531,9 @@ struct mod_color *mod_color_create(struct dc *dc)return &core_color->public; fail_construct: +dm_free (core_color->edid_caps); + +fail_alloc_edid_caps:dm_free (core_color->state); fail_alloc_state:
@@ -1390,6 +1553,8 @@ void mod_color_destroy(struct mod_color *mod_color)struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color); +dm_free (core_color->edid_caps); +for (i =0 ; i < core_color->num_sinks; i++)if (core_color->state[i].gamma)dc_gamma_release (core_color->state[i].gamma);
@@ -1405,7 +1570,8 @@ void mod_color_destroy(struct mod_color *mod_color) } } -bool mod_color_add_sink (struct mod_color *mod_color,const struct dc_sink *sink) +bool mod_color_add_sink (struct mod_color *mod_color,const struct dc_sink *sink, +struct color_edid_caps *edid_caps) {struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color);struct core_dc *core_dc =DC_TO_CORE (core_color->dc);
@@ -1426,6 +1592,11 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink) core_color->state[core_color->num_sinks]. user_enable_color_temperature = true; + core_color->edid_caps[core_color->num_sinks].colorimetry_caps = + edid_caps->colorimetry_caps; + core_color->edid_caps[core_color->num_sinks].hdr_caps = + edid_caps->hdr_caps; +/* get persistent data from registry */ flag.save_per_edid = true; flag.save_per_link = false;
@@ -1462,25 +1633,25 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink) sizeof(struct color_space_coordinates), &flag)) { memcpy(&core_color->state[core_color->num_sinks]. - source_gamut, &persistent_source_gamut, + source_gamut.gamut, &persistent_source_gamut, sizeof(struct color_space_coordinates)); } else { core_color->state[core_color->num_sinks]. - source_gamut.blueX =1500 ; + source_gamut.gamut.blueX =1500 ; core_color->state[core_color->num_sinks]. - source_gamut.blueY =600 ; + source_gamut.gamut.blueY =600 ; core_color->state[core_color->num_sinks]. - source_gamut.greenX =3000 ; + source_gamut.gamut.greenX =3000 ; core_color->state[core_color->num_sinks]. - source_gamut.greenY =6000 ; + source_gamut.gamut.greenY =6000 ; core_color->state[core_color->num_sinks]. - source_gamut.redX =6400 ; + source_gamut.gamut.redX =6400 ; core_color->state[core_color->num_sinks]. - source_gamut.redY =3300 ; + source_gamut.gamut.redY =3300 ; core_color->state[core_color->num_sinks]. - source_gamut.whiteX =3127 ; + source_gamut.gamut.whiteX =3127 ; core_color->state[core_color->num_sinks]. - source_gamut.whiteY =3290 ; + source_gamut.gamut.whiteY =3290 ; } if (dm_read_persistent_data(core_dc->ctx, sink, COLOR_REGISTRY_NAME,
@@ -1489,26 +1660,26 @@ bool mod_color_add_sink(struct mod_color *mod_color, const struct dc_sink *sink) sizeof(struct color_space_coordinates), &flag)) { memcpy(&core_color->state[core_color->num_sinks]. - destination_gamut, + destination_gamut.gamut, &persistent_destination_gamut, sizeof(struct color_space_coordinates)); } else { core_color->state[core_color->num_sinks]. - destination_gamut.blueX =1500 ; + destination_gamut.gamut.blueX =1500 ; core_color->state[core_color->num_sinks]. - destination_gamut.blueY =600 ; + destination_gamut.gamut.blueY =600 ; core_color->state[core_color->num_sinks]. - destination_gamut.greenX =3000 ; + destination_gamut.gamut.greenX =3000 ; core_color->state[core_color->num_sinks]. - destination_gamut.greenY =6000 ; + destination_gamut.gamut.greenY =6000 ; core_color->state[core_color->num_sinks]. - destination_gamut.redX =6400 ; + destination_gamut.gamut.redX =6400 ; core_color->state[core_color->num_sinks]. - destination_gamut.redY =3300 ; + destination_gamut.gamut.redY =3300 ; core_color->state[core_color->num_sinks]. - destination_gamut.whiteX =3127 ; + destination_gamut.gamut.whiteX =3127 ; core_color->state[core_color->num_sinks]. - destination_gamut.whiteY =3290 ; + destination_gamut.gamut.whiteY =3290 ; } if (dm_read_persistent_data(core_dc->ctx, sink, COLOR_REGISTRY_NAME,
@@ -1588,6 +1759,10 @@ bool mod_color_remove_sink(struct mod_color *mod_color,memcpy (&core_color->state[j], &core_color->state[j +1 ],sizeof (struct color_state )); + +memcpy (&core_color->edid_caps[j], + &core_color->edid_caps[j +1 ], +sizeof (struct color_edid_caps )); } core_color->num_sinks--;
@@ -1625,7 +1800,7 @@ bool mod_color_update_gamut_to_stream(struct mod_color *mod_color,COLOR_REGISTRY_NAME ,"sourcegamut" , &core_color->state[sink_index]. - source_gamut, + source_gamut.gamut,sizeof (struct color_space_coordinates ), &flag);
@@ -1634,19 +1809,19 @@ bool mod_color_update_gamut_to_stream(struct mod_color *mod_color,COLOR_REGISTRY_NAME ,"destgamut" , &core_color->state[sink_index]. - destination_gamut, + destination_gamut.gamut,sizeof (struct color_space_coordinates ), &flag);if (!build_gamut_remap_matrix - (core_color->state[sink_index].source_gamut, - matrix->rgbCoeffSrc, - matrix->whiteCoeffSrc)) + (core_color->state[sink_index].source_gamut.gamut, + matrix->rgbCoeffSrc, + matrix->whiteCoeffSrc)) goto function_fail;if (!build_gamut_remap_matrix (core_color->state[sink_index]. - destination_gamut, + destination_gamut.gamut, matrix->rgbCoeffDst, matrix->whiteCoeffDst)) goto function_fail;
@@ -1700,8 +1875,7 @@ function_fail:bool mod_color_adjust_source_gamut (struct mod_color *mod_color,const struct dc_stream **streams,int num_streams, -struct gamut_space_coordinates *input_gamut_coordinates, -struct white_point_coodinates *input_white_point_coordinates) +struct color_gamut_data *input_gamut_data) {struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color);
@@ -1711,25 +1885,35 @@ bool mod_color_adjust_source_gamut(struct mod_color *mod_color, sink_index =sink_index_from_sink (core_color, streams[stream_index]->sink); - core_color->state[sink_index].source_gamut.blueX = - input_gamut_coordinates->blueX; - core_color->state[sink_index].source_gamut.blueY = - input_gamut_coordinates->blueY; - core_color->state[sink_index].source_gamut.greenX = - input_gamut_coordinates->greenX; - core_color->state[sink_index].source_gamut.greenY = - input_gamut_coordinates->greenY; - core_color->state[sink_index].source_gamut.redX = - input_gamut_coordinates->redX; - core_color->state[sink_index].source_gamut.redY = - input_gamut_coordinates->redY; - core_color->state[sink_index].source_gamut.whiteX = - input_white_point_coordinates->whiteX; - core_color->state[sink_index].source_gamut.whiteY = - input_white_point_coordinates->whiteY; +update_color_gamut_data (input_gamut_data, + &core_color->state[sink_index].source_gamut); } -if (!mod_color_update_gamut_to_stream (mod_color, streams, num_streams)) +if (!mod_color_update_gamut_info (mod_color, streams, num_streams)) +return false; + +return true; +} + +bool mod_color_adjust_source_gamut_and_tf (struct mod_color *mod_color, +const struct dc_stream **streams,int num_streams, +struct color_gamut_data *input_gamut_data, +enum color_transfer_func input_transfer_func) +{ +struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color); + +unsigned int stream_index, sink_index; + +for (stream_index =0 ; stream_index < num_streams; stream_index++) { + sink_index =sink_index_from_sink (core_color, + streams[stream_index]->sink); +update_color_gamut_data (input_gamut_data, + &core_color->state[sink_index].source_gamut); + core_color->state[sink_index].input_transfer_function = + input_transfer_func; + } + +if (!mod_color_update_gamut_info (mod_color, streams, num_streams))return false;return true;
@@ -1737,8 +1921,7 @@ bool mod_color_adjust_source_gamut(struct mod_color *mod_color,bool mod_color_adjust_destination_gamut (struct mod_color *mod_color,const struct dc_stream **streams,int num_streams, -struct gamut_space_coordinates *input_gamut_coordinates, -struct white_point_coodinates *input_white_point_coordinates) +struct color_gamut_data *input_gamut_data) {struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color);
@@ -1748,22 +1931,8 @@ bool mod_color_adjust_destination_gamut(struct mod_color *mod_color, sink_index =sink_index_from_sink (core_color, streams[stream_index]->sink); - core_color->state[sink_index].destination_gamut.blueX = - input_gamut_coordinates->blueX; - core_color->state[sink_index].destination_gamut.blueY = - input_gamut_coordinates->blueY; - core_color->state[sink_index].destination_gamut.greenX = - input_gamut_coordinates->greenX; - core_color->state[sink_index].destination_gamut.greenY = - input_gamut_coordinates->greenY; - core_color->state[sink_index].destination_gamut.redX = - input_gamut_coordinates->redX; - core_color->state[sink_index].destination_gamut.redY = - input_gamut_coordinates->redY; - core_color->state[sink_index].destination_gamut.whiteX = - input_white_point_coordinates->whiteX; - core_color->state[sink_index].destination_gamut.whiteY = - input_white_point_coordinates->whiteY; +update_color_gamut_data (input_gamut_data, + &core_color->state[sink_index].destination_gamut); }if (!mod_color_update_gamut_to_stream (mod_color, streams, num_streams))
@@ -1784,9 +1953,9 @@ bool mod_color_set_white_point(struct mod_color *mod_color, stream_index++) { sink_index =sink_index_from_sink (core_color, streams[stream_index]->sink); - core_color->state[sink_index].source_gamut.whiteX = + core_color->state[sink_index].source_gamut.gamut.whiteX = white_point->whiteX; - core_color->state[sink_index].source_gamut.whiteY = + core_color->state[sink_index].source_gamut.gamut.whiteY = white_point->whiteY; }
@@ -1796,6 +1965,39 @@ bool mod_color_set_white_point(struct mod_color *mod_color,return true; } + +bool mod_color_set_mastering_info (struct mod_color *mod_color, +const struct dc_stream **streams,int num_streams, +struct color_mastering_info *mastering_info) +{ +struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color); +unsigned int stream_index, sink_index; + +for (stream_index =0 ; stream_index < num_streams; stream_index++) { + sink_index =sink_index_from_sink (core_color, + streams[stream_index]->sink); +memcpy (&core_color->state[sink_index].mastering_info, + mastering_info, +sizeof (struct color_mastering_info )); + } +return true; +} + +bool mod_color_get_mastering_info (struct mod_color *mod_color, +const struct dc_sink *sink, +struct color_mastering_info *mastering_info) +{ +struct core_color *core_color = +MOD_COLOR_TO_CORE (mod_color); + +unsigned int sink_index =sink_index_from_sink (core_color, sink); + +memcpy (mastering_info, &core_color->state[sink_index].mastering_info, +sizeof (struct color_mastering_info )); + +return true; +} +bool mod_color_set_user_enable (struct mod_color *mod_color,const struct dc_stream **streams,int num_streams,bool user_enable)
@@ -1953,7 +2155,7 @@ bool mod_color_get_source_gamut(struct mod_color *mod_color,unsigned int sink_index =sink_index_from_sink (core_color, sink); - *source_gamut = core_color->state[sink_index].source_gamut; + *source_gamut = core_color->state[sink_index].source_gamut.gamut;return true; }
@@ -1973,14 +2175,14 @@ bool mod_color_notify_mode_change(struct mod_color *mod_color, streams[stream_index]->sink);if (!build_gamut_remap_matrix - (core_color->state[sink_index].source_gamut, - matrix->rgbCoeffSrc, - matrix->whiteCoeffSrc)) + (core_color->state[sink_index].source_gamut.gamut, + matrix->rgbCoeffSrc, + matrix->whiteCoeffSrc)) goto function_fail;if (!build_gamut_remap_matrix (core_color->state[sink_index]. - destination_gamut, + destination_gamut.gamut, matrix->rgbCoeffDst, matrix->whiteCoeffDst)) goto function_fail;
@@ -2379,3 +2581,200 @@ bool mod_color_is_rgb_limited_range_supported_for_timing(return result; } + +bool mod_color_set_regamma (struct mod_color *mod_color, +const struct dc_stream **streams,int num_streams) +{ +/*TODO*/ +return true; +} + +bool mod_color_set_degamma (struct mod_color *mod_color, +const struct dc_stream **streams,int num_streams, +enum color_transfer_func transfer_function) +{ +/*TODO*/ +return true; +} + +bool mod_color_update_gamut_info (struct mod_color *mod_color, +const struct dc_stream **streams,int num_streams) +{ +struct core_color *core_color =MOD_COLOR_TO_CORE (mod_color); +unsigned int stream_index, sink_index; +bool should_defer = false; +bool is_hdr = false; +enum color_color_space source_color_space; +enum color_transfer_func input_transfer_function; +struct color_gamut_data new_gamut_source; +struct color_gamut_data new_gamut_destination; + +for (stream_index =0 ; stream_index < num_streams; stream_index++) { + sink_index =sink_index_from_sink (core_color, + streams[stream_index]->sink); + source_color_space = + core_color->state[sink_index].source_gamut.color_space; + input_transfer_function = + core_color->state[sink_index].input_transfer_function; + new_gamut_source.color_space = source_color_space; + new_gamut_destination.color_space = + core_color->state[sink_index]. + destination_gamut.color_space; + +struct dc_surface *surface = +dc_stream_to_surface_from_pipe_ctx (core_color, + streams[stream_index]); +if (surface ==NULL ) +return false; + +if (surface->format ==SURFACE_PIXEL_FORMAT_GRPH_ARGB8888 || + surface->format == +SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010 ) { + +if (input_transfer_function == + transfer_func_pq2084 || + input_transfer_function == + transfer_func_pq2084_interim) { +/* For PQ and PQ interim, we bypass degamma+ +* remap+regamma, application needs to also +* handle gamut remapping +*/ +/* TODO */ + is_hdr = true; + }else if (input_transfer_function == + transfer_func_linear_0_1 || + input_transfer_function == + transfer_func_linear_0_125) { +/* TF not supported in current surface format, +* but may be deferred to a later flip +*/ + should_defer = true; + }else { + new_gamut_destination.color_space = + color_space_srgb; + } + }else if (surface->format == +SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F || + surface->format == +SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F || + surface->format == +SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ) { +if (input_transfer_function == + transfer_func_linear_0_125) { +/* Regamma PQ for HDR supported displays and +* 0-125 source +*/ +if ((core_color->edid_caps[sink_index]. + hdr_caps) & smpte_st2084) + is_hdr = true; + +/* override for BT.2020 whenever PQ */ +if (core_color->state[sink_index]. + destination_gamut.color_space != + color_space_bt2020) { +if (streams[stream_index]->timing. + pixel_encoding == +PIXEL_ENCODING_RGB ) { +if ((core_color-> + edid_caps[sink_index]. + colorimetry_caps) & bt_2020_rgb) + new_gamut_destination. + color_space = + color_space_bt2020; + }else { +if ((core_color-> + edid_caps[sink_index]. + colorimetry_caps) & bt_2020_ycc) + new_gamut_destination. + color_space = + color_space_bt2020; + } + } + }else if (input_transfer_function == + transfer_func_linear_0_1) { + new_gamut_destination.color_space = + color_space_srgb; + }else { +/* TF not supported in current surface format, +* but may be deferred to a later flip +*/ + should_defer = true; + } + } + +/* 0. ---- CHECK DEFERRED ---- */ +if (should_defer) +return true; + +/* 1. ---- SET GAMUT SOURCE ---- */ + new_gamut_source.white_point = core_color->state[sink_index]. + source_gamut.white_point; +update_color_gamut_data (&new_gamut_source, + &core_color->state[sink_index].source_gamut); + +/* 2. ---- SET GAMUT DESTINATION ---- */ + new_gamut_destination.white_point = + core_color->state[sink_index]. + destination_gamut.white_point; +update_color_gamut_data (&new_gamut_destination, + &core_color->state[sink_index].destination_gamut); + +/* 3. ---- SET DEGAMMA ---- */ +struct dc_transfer_func *input_tf =NULL ; + + input_tf =dc_create_transfer_func (core_color->dc); + +if (input_tf !=NULL ) { + input_tf->type =TF_TYPE_PREDEFINED ; + +switch (input_transfer_function) { +case transfer_func_srgb: + input_tf->tf =TRANSFER_FUNCTION_SRGB ; +break ; +case transfer_func_linear_0_1: +case transfer_func_linear_0_125: + input_tf->tf =TRANSFER_FUNCTION_LINEAR ; +break ; +default : +dc_transfer_func_release (input_tf); + input_tf =NULL ; +break ; + } + } + +/* 4. ---- SET REGAMMA ---- */ +struct dc_transfer_func *output_tf =NULL ; + + output_tf =dc_create_transfer_func (core_color->dc); + +if (output_tf !=NULL ) { + output_tf->type =TF_TYPE_PREDEFINED ; +if (is_hdr) + output_tf->tf =TRANSFER_FUNCTION_PQ ; +else + output_tf->tf =TRANSFER_FUNCTION_SRGB ; + } + +/* 5. ---- TODO: UPDATE INFOPACKETS ---- */ + +if (!mod_color_update_gamut_to_stream ( + mod_color, streams, num_streams)) +return false; + +struct dc_surface_update updates[4 ] = {0 }; + + updates[0 ].surface = surface; + updates[0 ].gamma = core_color->state[sink_index].gamma; + updates[0 ].in_transfer_func = input_tf; + updates[0 ].out_transfer_func = output_tf; + +dc_update_surfaces_for_target (core_color->dc, updates,1 ,NULL ); + +if (input_tf !=NULL ) +dc_transfer_func_release (input_tf); + +if (output_tf !=NULL ) +dc_transfer_func_release (output_tf); + } +return true; +}
drivers/gpu/drm/amd/display/modules/color/color_helper.h +1 -1
@@ -37,7 +37,7 @@ bool mod_color_find_predefined_gamut(bool mod_color_find_predefined_white_point (struct white_point_coodinates *out_white_point, -unsigned int index); +enum predefined_white_point_type type); bool mod_color_find_white_point_from_temperature( struct white_point_coodinates *out_white_point,
drivers/gpu/drm/amd/display/modules/inc/mod_color.h +110 -5
150 lines not on this page · raw message
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 21/22 drm/amd/display: Fix Regamma end point
In reply to a message not in the archiveFrom: Anthony Koo <[email protected]>
1. HW register programmed to wrong value
2. End slope for PQ case not calculated correctly
--- drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c | 34 +++++++++++++++------- drivers/gpu/drm/amd/display/dc/dce/dce_opp.c | 4 +-- 2 files changed, 26 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/gamma_calcs.c +24 -10
@@ -287,8 +287,6 @@ static bool build_hw_curve_configuration(uint32_t offset =0 ;int8_t begin = curve_config->begin;int32_t region_number =0 ; -struct fixed31_32 magic_number = -dal_fixed31_32_from_fraction (249 ,1000 ); i = begin;
@@ -370,10 +368,8 @@ static bool build_hw_curve_configuration( ++i; } - points[index].x = -dal_fixed31_32_add (region1, magic_number); - points[index].adjusted_x = -dal_fixed31_32_add (region1, magic_number); + points[index].x = region1; + points[index].adjusted_x = region1; *number_of_points = index;
@@ -1218,7 +1214,8 @@ static void rebuild_curve_configuration_magic(struct curve_points *arr_points, struct pwl_result_data *rgb_resulted, const struct hw_x_point *coordinates_x, - uint32_t hw_points_num) + uint32_t hw_points_num, + enum dc_transfer_func_predefined tf) { struct fixed31_32 y_r;struct fixed31_32 y_g;
@@ -1264,6 +1261,18 @@ static void rebuild_curve_configuration_magic( arr_points[2 ].y = y3_max; arr_points[2 ].slope = dal_fixed31_32_zero; + +/* for PQ, we want to have a straight line from last HW X point, and the +* slope to be such that we hit 1.0 at 10000 nits. +*/ +if (tf ==TRANSFER_FUNCTION_PQ ) { +const struct fixed31_32 end_value = +dal_fixed31_32_from_int (125 ); + + arr_points[2 ].slope =dal_fixed31_32_div ( +dal_fixed31_32_sub (dal_fixed31_32_one, arr_points[1 ].y), +dal_fixed31_32_sub (end_value, arr_points[1 ].x)); + } } static bool convert_to_custom_float_format(
@@ -1424,6 +1433,8 @@ bool calculate_regamma_params(struct pwl_params *params,struct pixel_gamma_point *coeff128_oem =NULL ;struct pixel_gamma_point *coeff128 =NULL ; +enum dc_transfer_func_predefined tf =TRANSFER_FUNCTION_SRGB ; +bool ret = false; coordinates_x =dm_alloc (sizeof (*coordinates_x)*(256 +3 ));
@@ -1452,6 +1463,9 @@ bool calculate_regamma_params(struct pwl_params *params, dividers.divider2 =dal_fixed31_32_from_int (2 ); dividers.divider3 =dal_fixed31_32_from_fraction (5 ,2 ); +if (stream->public.out_transfer_func) + tf = stream->public.out_transfer_func->tf; + build_evenly_distributed_points( axix_x_256, 256,
@@ -1460,8 +1474,7 @@ bool calculate_regamma_params(struct pwl_params *params,scale_gamma (rgb_user, ramp, dividers); -if (stream->public.out_transfer_func && - stream->public.out_transfer_func->tf ==TRANSFER_FUNCTION_PQ ) { +if (tf ==TRANSFER_FUNCTION_PQ ) {setup_distribution_points_pq (arr_curve_points, arr_points, ¶ms->hw_points_num, coordinates_x, surface->public.format);
@@ -1486,7 +1499,8 @@ bool calculate_regamma_params(struct pwl_params *params, arr_points, rgb_resulted, coordinates_x, - params->hw_points_num); + params->hw_points_num, + tf);convert_to_custom_float (rgb_resulted, arr_points, params->hw_points_num);
drivers/gpu/drm/amd/display/dc/dce/dce_opp.c +2 -2
@@ -139,8 +139,8 @@ static void regamma_config_regions_and_segments( } {REG_SET_2 (REGAMMA_CNTLA_END_CNTL2 ,0 , -REGAMMA_CNTLA_EXP_REGION_END_BASE , params->arr_points[2 ].custom_float_slope, -REGAMMA_CNTLA_EXP_REGION_END_SLOPE , params->arr_points[1 ].custom_float_y); +REGAMMA_CNTLA_EXP_REGION_END_BASE , params->arr_points[1 ].custom_float_y, +REGAMMA_CNTLA_EXP_REGION_END_SLOPE , params->arr_points[2 ].custom_float_slope); } curve = params->arr_curve_points;
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 22/22 drm/amd/display: 4k split black out due to incorrect cursor
In reply to a message not in the archiveFrom: Tony Cheng <[email protected]>
- add handling to program both cursor for left and right pipe
- add guard to disable cursor in case where cursor isn't visible to prevent pipe hang
--- drivers/gpu/drm/amd/display/dc/core/dc_target.c | 83 ++++++++++------------ drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 9 +++ drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h | 3 +- .../drm/amd/display/dc/dce110/dce110_ipp_cursor.c | 3 +- drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h | 3 +- 5 files changed, 53 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_target.c +38 -45
@@ -148,56 +148,49 @@ bool dc_target_set_cursor_attributes(struct dc_target *dc_target, const struct dc_cursor_attributes *attributes) { - uint8_t i, j; -struct core_target *target; -struct core_dc *core_dc; -struct resource_context *res_ctx; + int i, j; +struct core_target *target =DC_TARGET_TO_CORE (dc_target); +struct core_dc *core_dc =DC_TO_CORE (target->ctx->dc); +struct resource_context *res_ctx = &core_dc->current_context->res_ctx; +bool ret = false;if (NULL == dc_target) {dm_error ("DC: dc_target is NULL!\n" );return false; - }if (NULL == attributes) {dm_error ("DC: attributes is NULL!\n" );return false; - } - target =DC_TARGET_TO_CORE (dc_target); - core_dc =DC_TO_CORE (target->ctx->dc); - res_ctx = &core_dc->current_context->res_ctx; +for (i =0 ; i < dc_target->stream_count; i++) { +const struct dc_stream *stream = dc_target->streams[i]; -for (i =0 ; i < target->public.stream_count; i++) {for (j =0 ; j <MAX_PIPES ; j++) { -struct input_pixel_processor *ipp = - res_ctx->pipe_ctx[j].ipp; +struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[j]; -if (res_ctx->pipe_ctx[j].stream != -DC_STREAM_TO_CORE (target->public.streams[i])) -continue ; +if (&pipe_ctx->stream->public == stream) { +struct input_pixel_processor *ipp = pipe_ctx->ipp; -/* As of writing of this code cursor is on the top -* plane so we only need to set it on first pipe we -* find. May need to make this code dce specific later. -*/ -if (ipp->funcs->ipp_cursor_set_attributes ( - ipp, attributes)) -return true; +if (ipp->funcs->ipp_cursor_set_attributes ( + ipp, attributes)) + ret = true; + } } } -return false; +return ret; }bool dc_target_set_cursor_position (struct dc_target *dc_target,const struct dc_cursor_position *position) { -uint8_t i, j; -struct core_target *target; -struct core_dc *core_dc; -struct resource_context *res_ctx; +int i, j; +struct core_target *target =DC_TARGET_TO_CORE (dc_target); +struct core_dc *core_dc =DC_TO_CORE (target->ctx->dc); +struct resource_context *res_ctx = &core_dc->current_context->res_ctx; +bool ret = false;if (NULL == dc_target) {dm_error ("DC: dc_target is NULL!\n" );
@@ -209,29 +202,29 @@ bool dc_target_set_cursor_position(return false; } - target =DC_TARGET_TO_CORE (dc_target); - core_dc =DC_TO_CORE (target->ctx->dc); - res_ctx = &core_dc->current_context->res_ctx; +for (i =0 ; i < dc_target->stream_count; i++) { +const struct dc_stream *stream = dc_target->streams[i]; -for (i =0 ; i < target->public.stream_count; i++) {for (j =0 ; j <MAX_PIPES ; j++) { -struct input_pixel_processor *ipp = - res_ctx->pipe_ctx[j].ipp; - -if (res_ctx->pipe_ctx[j].stream != -DC_STREAM_TO_CORE (target->public.streams[i])) -continue ; - -/* As of writing of this code cursor is on the top -* plane so we only need to set it on first pipe we -* find. May need to make this code dce specific later. -*/ - ipp->funcs->ipp_cursor_set_position (ipp, position); -return true; +struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[j]; + +if (&pipe_ctx->stream->public == stream) { +struct input_pixel_processor *ipp = pipe_ctx->ipp; +struct dc_cursor_mi_param param = { + .pixel_clk_khz = stream->timing.pix_clk_khz, + .ref_clk_khz =48000 ,/*todo refclk*/ + .viewport_x_start = pipe_ctx->scl_data.viewport.x, + .viewport_width = pipe_ctx->scl_data.viewport.width, + .h_scale_ratio = pipe_ctx->scl_data.ratios.horz, + }; + + ipp->funcs->ipp_cursor_set_position (ipp, position, ¶m); + ret = true; + } } } -return false; +return ret; }uint32_t dc_target_get_vblank_counter (const struct dc_target *dc_target)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +9 -0
@@ -27,6 +27,7 @@#define DC_HW_TYPES_H #include "os_types.h" +#include "fixed31_32.h" /****************************************************************************** * Data types for Virtual HW Layer of DAL3.
@@ -359,6 +360,14 @@ struct dc_cursor_position {bool hot_spot_enable; }; +struct dc_cursor_mi_param { +unsigned int pixel_clk_khz; +unsigned int ref_clk_khz; +unsigned int viewport_x_start; +unsigned int viewport_width; +struct fixed31_32 h_scale_ratio; +}; +/* IPP related types */ /* Used by both ipp amd opp functions*/
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h +2 -1
@@ -54,7 +54,8 @@ void dce110_ipp_destroy(struct input_pixel_processor **ipp);/* CURSOR RELATED */ void dce110_ipp_cursor_set_position (struct input_pixel_processor *ipp, -const struct dc_cursor_position *position); +const struct dc_cursor_position *position, +const struct dc_cursor_mi_param *param); bool dce110_ipp_cursor_set_attributes( struct input_pixel_processor *ipp,
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c +2 -1
@@ -72,7 +72,8 @@ static void program_address(void dce110_ipp_cursor_set_position (struct input_pixel_processor *ipp, -const struct dc_cursor_position *position) +const struct dc_cursor_position *position, +const struct dc_cursor_mi_param *param) {struct dce110_ipp *ipp110 =TO_DCE110_IPP (ipp);
drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +2 -1
@@ -83,7 +83,8 @@ struct ipp_funcs {/*** cursor ***/ void (*ipp_cursor_set_position)(struct input_pixel_processor *ipp, -const struct dc_cursor_position *position); +const struct dc_cursor_position *position, +const struct dc_cursor_mi_param *param); bool (*ipp_cursor_set_attributes)( struct input_pixel_processor *ipp,
Signature · 6 lines
2.9.3 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx