Add Automation support for DP compliance testing
Subsystems (3)
cover Add Automation support for DP compliance testing
DP 1.2 compliance testing can be acheived using DPR-120's CTS suite. This compliance unit sends a short pulse to initiate link training and video pattern generation compliance tests and sends a long pulse to initate EDID compliance tests. It also sets the AUTOMATED TEST REQUEST bit in Device IRQ to 1. These patches add support in the kernel to respond to these test requests sent by DPR-120. The test handler has been added for Link training/EDID and Video pattern compliance tests that gets invoked on short/long pulse sent by DPR-120. The test handler for each of the tests reads the corresponding DPCD registers to read the test parameters.
These tests need to be run with the IGT DP compliance automation tool. Link Training Tests (4.3.1.1 - 4.3.2.3):
It reads the DPCD registers to get the link rate and lane count requested by test and sends a hotplug uevent for the userspace to redo a modeset in order to train the link at the requested test parameters.
EDID Tests (4.2.2.3 - 4.2.2.6):
It reads the EDID set by the DPR-120, if EDID read succeeds, it sets the video mode to PREFERRED and sets the test_active flag. This flag wakes up the IGT compliance tool that then fills the framebuffers and triggers a modeset.
Video Pattern Tests (4.3.3.1):
It reads the DPCD registers to set the requested video pattern parameters. It then sets the test active flag that wakes up the IGT tool, userspace reads the video pattern values from corresponding debugfs files and fills the framebuffers and triggers a modeset.
Jim Bride (1):
Add support for forcing 6 bpc on DP pipes.
Manasi Navare (4):
drm/i915: Add support for DP link training compliance drm/i915: Fixes to support DP Compliance EDID tests
drm: Add definitions for DP compliance Video pattern tests drm/i915: Add support for DP Video pattern compliance tests
drivers/gpu/drm/i915/i915_debugfs.c | 14 +++- drivers/gpu/drm/i915/intel_display.c | 4 +- drivers/gpu/drm/i915/intel_dp.c | 155 +++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/intel_dp_mst.c | 11 ++- drivers/gpu/drm/i915/intel_drv.h | 12 +++ include/drm/drm_dp_helper.h | 16 +++- 6 files changed, 199 insertions(+), 13 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/5 drm/i915: Add support for DP link training compliance
This patch adds support to handle automated DP compliance link training test requests. This patch has been tested with Unigraf DPR-120 DP Compliance device for testing Link Training Compliance.
After we get a short pulse Compliance test request, test request values are read and hotplug uevent is sent in order to trigger another modeset during which the pipe is configured and link is retrained and enabled for link parameters requested by the test.
--- drivers/gpu/drm/i915/intel_dp.c | 73 ++++++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 69 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +67 -6
@@ -288,6 +288,21 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp, common_rates); } +static int intel_dp_link_rate_index (struct intel_dp *intel_dp, +int *common_rates,int link_rate) +{ +int common_len; +int index; + + common_len =intel_dp_common_rates (intel_dp, common_rates); +for (index =0 ; index < common_len; index++) { +if (link_rate == common_rates[common_len - index -1 ]) +return common_len - index -1 ; + } + +return -1 ; +} +static enum drm_mode_status intel_dp_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode)
@@ -1554,6 +1569,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,/* Conveniently, the link BW constants become indices with a shift...*/ int min_clock =0 ;int max_clock; +int link_rate_index;int bpp, mode_rate;int link_avail, link_clock;int common_rates[DP_MAX_SUPPORTED_RATES ] = {};
@@ -1595,6 +1611,16 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK )return false; +/* Use values requested by Compliance Test Request */ +if (intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) { + link_rate_index =intel_dp_link_rate_index (intel_dp, + common_rates, +drm_dp_bw_code_to_link_rate (intel_dp->compliance_test_link_rate)); +if (link_rate_index >=0 ) + min_clock = max_clock = link_rate_index; + min_lane_count = max_lane_count = intel_dp->compliance_test_lane_count; + } + DRM_DEBUG_KMS("DP link computation with max lane count %i " "max bw %d pixel clock %iKHz\n", max_lane_count, common_rates[max_clock],
@@ -1642,6 +1668,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp, } } } + }return false;
@@ -3804,6 +3831,29 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)static uint8_t intel_dp_autotest_link_training (struct intel_dp *intel_dp) {uint8_t test_result =DP_TEST_ACK ; +int status =0 ; +/* (DP CTS 1.2) +* 4.3.1.11 +*/ +/* Read the TEST_LANE_COUNT and TEST_LINK_RTAE fields (DP CTS 3.1.4) */ + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LANE_COUNT , + &intel_dp->compliance_test_lane_count); + +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test lane count from " +"reference sink\n" ); +return 0 ; + } + intel_dp->compliance_test_lane_count &=DP_MAX_LANE_COUNT_MASK ; + + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LINK_RATE , + &intel_dp->compliance_test_link_rate); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test link rate from " +"refernce sink\n" ); +return 0 ; + } +return test_result; }
@@ -3908,7 +3958,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_TEST_RESPONSE , &response, 1);if (status <=0 ) -DRM_DEBUG_KMS ("Could not write test response to sink\n" ); +DRM_DEBUG_KMS ("Could not write test response " +"to sink\n" ); } static int
@@ -4018,9 +4069,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)if (WARN_ON_ONCE (!intel_dp->lane_count))return ; -/* if link training is requested we should perform it always */ -if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) || - (!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) { +/* Retrain if Channel EQ or CR not ok */ +if ((!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) {DRM_DEBUG_KMS ("%s: channel EQ not ok, retraining\n" , intel_encoder->base.name);
@@ -4045,6 +4095,7 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp_short_pulse(struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct intel_encoder *intel_encoder = &dp_to_dig_port (intel_dp)->base;u8 sink_irq_vector =0 ;u8 old_sink_count = intel_dp->sink_count;bool ret;
@@ -4056,6 +4107,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;/* * Now read the DPCD to see if it's actually running
@@ -4079,8 +4132,9 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_DEVICE_SERVICE_IRQ_VECTOR , sink_irq_vector); -if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) -DRM_DEBUG_DRIVER ("Test request in short pulse not handled\n" ); +if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) { +intel_dp_handle_test_request (intel_dp); + }if (sink_irq_vector & (DP_CP_IRQ |DP_SINK_SPECIFIC_IRQ ))DRM_DEBUG_DRIVER ("CP or sink specific irq unhandled\n" ); }
@@ -4088,6 +4142,11 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );intel_dp_check_link_status (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING )) { +DRM_DEBUG_KMS ("Link Training Compliance Test requested\n" ); +/* Send a Hotplug Uevent to userspace to start modeset */ +drm_kms_helper_hotplug_event (intel_encoder->base.dev); + }return true; }
@@ -4375,6 +4434,8 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;if (intel_dp->is_mst) { DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -958,6 +958,8 @@ struct intel_dp {unsigned long compliance_test_type;unsigned long compliance_test_data;bool compliance_test_active; +u8 compliance_test_lane_count; +u8 compliance_test_link_rate; };struct intel_lspcon {
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [PATCH 1/5] drm/i915: Add support for DP link training compliance
Quoted 55 lines · Manasi Navare
This patch adds support to handle automated DP compliance link training test requests. This patch has been tested with Unigraf DPR-120 DP Compliance device for testing Link Training Compliance.
After we get a short pulse Compliance test request, test request values are read and hotplug uevent is sent in order to trigger another modeset during which the pipe is configured and link is retrained and enabled for link parameters requested by the test.Signed-off-by Manasi Navare <[email protected]>Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjala <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 73 ++++++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 69 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +16
-0@@ -288,6 +288,21 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp, common_rates); } +static int intel_dp_link_rate_index (struct intel_dp *intel_dp, +int *common_rates,int link_rate) +{ +int common_len; +int index; + + common_len =intel_dp_common_rates (intel_dp, common_rates); +for (index =0 ; index < common_len; index++) { +if (link_rate == common_rates[common_len - index -1 ]) +return common_len - index -1 ; + } + +return -1 ; +} +static enum drm_mode_status intel_dp_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode)@@ -1554,6 +1569,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,/* Conveniently, the link BW constants become indices with a shift...*/ int min_clock =0 ;int max_clock; +int link_rate_index;int bpp, mode_rate;int link_avail, link_clock;int common_rates[DP_MAX_SUPPORTED_RATES ] = {};@@ -1595,6 +1611,16 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK )
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1621
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0return false; +/* Use values requested by Compliance Test Request */ +if (intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) { + link_rate_index =intel_dp_link_rate_index (intel_dp, + common_rates, +drm_dp_bw_code_to_link_rate (intel_dp->compliance_test_link_rate)); +if (link_rate_index >=0 ) + min_clock = max_clock = link_rate_index; + min_lane_count = max_lane_count = intel_dp->compliance_test_lane_count;
You need to be more strict about validating compliance_test_lane_count. You do mask it with DP_MAX_LANE_COUNT_MASK, but that's 0x1f, quite a few more lanes than we have...
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1671
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ } + DRM_DEBUG_KMS("DP link computation with max lane count %i " "max bw %d pixel clock %iKHz\n", max_lane_count, common_rates[max_clock],@@ -1642,6 +1668,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp, } } } +
Please pay attention to not making unrelated changes.
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0}return false;@@ -3804,6 +3831,29 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)static uint8_t intel_dp_autotest_link_training (struct intel_dp *intel_dp) {uint8_t test_result =DP_TEST_ACK ; +int status =0 ;
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3844
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+/* (DP CTS 1.2) +* 4.3.1.11 +*/ +/* Read the TEST_LANE_COUNT and TEST_LINK_RTAE fields (DP CTS 3.1.4) */ + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LANE_COUNT , + &intel_dp->compliance_test_lane_count); + +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test lane count from " +"reference sink\n" );
No need to be so verbose, DRM_DEBUG_KMS will include the function name, so a simple "Lane count read failed" or something will suffice.
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3845
Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1
-0+return 0 ;
Should these return DP_TEST_NAK on errors or what?
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3853
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+ } + intel_dp->compliance_test_lane_count &=DP_MAX_LANE_COUNT_MASK ; + + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LINK_RATE , + &intel_dp->compliance_test_link_rate); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test link rate from " +"refernce sink\n" );
Ditto.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 3962
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +5
-1+return 0 ; + } +return test_result; }@@ -3908,7 +3958,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_TEST_RESPONSE , &response, 1);if (status <=0 ) -DRM_DEBUG_KMS ("Could not write test response to sink\n" ); +DRM_DEBUG_KMS ("Could not write test response " +"to sink\n" );
Unrelated change, and one we don't want.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4073
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3} static int@@ -4018,9 +4069,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)if (WARN_ON_ONCE (!intel_dp->lane_count))return ; -/* if link training is requested we should perform it always */ -if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) || - (!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) { +/* Retrain if Channel EQ or CR not ok */ +if ((!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) {
Too many braces.
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0DRM_DEBUG_KMS ("%s: channel EQ not ok, retraining\n" , intel_encoder->base.name);@@ -4045,6 +4095,7 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp_short_pulse(struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct intel_encoder *intel_encoder = &dp_to_dig_port (intel_dp)->base;u8 sink_irq_vector =0 ;u8 old_sink_count = intel_dp->sink_count;bool ret;
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4111
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -4056,6 +4107,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;
Looks like compliance stuff should be a sub struct in intel_dp, and you could just memset it to 0.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4137
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +3
-2/* * Now read the DPCD to see if it's actually running @@ -4079,8 +4132,9 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_DEVICE_SERVICE_IRQ_VECTOR , sink_irq_vector); -if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) -DRM_DEBUG_DRIVER ("Test request in short pulse not handled\n" ); +if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) { +intel_dp_handle_test_request (intel_dp); + }
Unnecessary curly braces.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4145
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0if (sink_irq_vector & (DP_CP_IRQ |DP_SINK_SPECIFIC_IRQ ))DRM_DEBUG_DRIVER ("CP or sink specific irq unhandled\n" ); }@@ -4088,6 +4142,11 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );intel_dp_check_link_status (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING )) {
Too many braces.
drivers/gpu/drm/i915/intel_dp.c static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, · line 4438
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +6
-0+DRM_DEBUG_KMS ("Link Training Compliance Test requested\n" ); +/* Send a Hotplug Uevent to userspace to start modeset */ +drm_kms_helper_hotplug_event (intel_encoder->base.dev); + }return true; }@@ -4375,6 +4434,8 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;
Same thing about making compliance sub struct.
Quoted 16 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0if (intel_dp->is_mst) { DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -958,6 +958,8 @@ struct intel_dp {unsigned long compliance_test_type;unsigned long compliance_test_data;bool compliance_test_active; +u8 compliance_test_lane_count; +u8 compliance_test_link_rate; };struct intel_lspcon {
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/5] drm/i915: Add support for DP link training compliance
Quoted 58 lines · Jani Nikula
Quoted 57 lines · Manasi Navare
This patch adds support to handle automated DP compliance link training test requests. This patch has been tested with Unigraf DPR-120 DP Compliance device for testing Link Training Compliance.
After we get a short pulse Compliance test request, test request values are read and hotplug uevent is sent in order to trigger another modeset during which the pipe is configured and link is retrained and enabled for link parameters requested by the test.Signed-off-by Manasi Navare <[email protected]>Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjala <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 73 ++++++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 69 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +16
-0@@ -288,6 +288,21 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp, common_rates); } +static int intel_dp_link_rate_index (struct intel_dp *intel_dp, +int *common_rates,int link_rate) +{ +int common_len; +int index; + + common_len =intel_dp_common_rates (intel_dp, common_rates); +for (index =0 ; index < common_len; index++) { +if (link_rate == common_rates[common_len - index -1 ]) +return common_len - index -1 ; + } + +return -1 ; +} +static enum drm_mode_status intel_dp_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode)@@ -1554,6 +1569,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,/* Conveniently, the link BW constants become indices with a shift...*/ int min_clock =0 ;int max_clock; +int link_rate_index;int bpp, mode_rate;int link_avail, link_clock;int common_rates[DP_MAX_SUPPORTED_RATES ] = {};@@ -1595,6 +1611,16 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK )return false;
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1621
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+/* Use values requested by Compliance Test Request */ +if (intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) { + link_rate_index =intel_dp_link_rate_index (intel_dp, + common_rates, +drm_dp_bw_code_to_link_rate (intel_dp->compliance_test_link_rate)); +if (link_rate_index >=0 ) + min_clock = max_clock = link_rate_index; + min_lane_count = max_lane_count = intel_dp->compliance_test_lane_count;You need to be more strict about validating
compliance_test_lane_count. You do mask it withDP_MAX_LANE_COUNT_MASK, but that's0x1f, quite a few more lanes than we have...
So the reason I didnt add validation here is because we enter the DUT capabilities into DPR-120 before starting the test, so the test lane count its gonna request will not exceed the DUT max lane count.
But we can still take safe approach and take the min between the compliance_lane_count and max source lane count.
Quoted 35 lines
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1671
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ } + DRM_DEBUG_KMS("DP link computation with max lane count %i " "max bw %d pixel clock %iKHz\n", max_lane_count, common_rates[max_clock],@@ -1642,6 +1668,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp, } } } +Please pay attention to not making unrelated changes.
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0}return false;@@ -3804,6 +3831,29 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)static uint8_t intel_dp_autotest_link_training (struct intel_dp *intel_dp) {uint8_t test_result =DP_TEST_ACK ; +int status =0 ;drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3844
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+/* (DP CTS 1.2) +* 4.3.1.11 +*/ +/* Read the TEST_LANE_COUNT and TEST_LINK_RTAE fields (DP CTS 3.1.4) */ + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LANE_COUNT , + &intel_dp->compliance_test_lane_count); + +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test lane count from " +"reference sink\n" );No need to be so verbose,
DRM_DEBUG_KMSwill include the function name, so a simple "Lane count read failed" or something will suffice.
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3845
Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1
-0+return 0 ;Should these return
DP_TEST_NAKon errors or what?
No in this case it should just return which will not send any test response and the test will timeout after 5 retries and stop. TEST_NAK is usually if the test is not supported.
Quoted 54 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3853
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+ } + intel_dp->compliance_test_lane_count &=DP_MAX_LANE_COUNT_MASK ; + + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LINK_RATE , + &intel_dp->compliance_test_link_rate); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test link rate from " +"refernce sink\n" );Ditto.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 3962
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +5
-1+return 0 ; + } +return test_result; }@@ -3908,7 +3958,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_TEST_RESPONSE , &response, 1);if (status <=0 ) -DRM_DEBUG_KMS ("Could not write test response to sink\n" ); +DRM_DEBUG_KMS ("Could not write test response " +"to sink\n" );Unrelated change, and one we don't want.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4073
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3} static int@@ -4018,9 +4069,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)if (WARN_ON_ONCE (!intel_dp->lane_count))return ; -/* if link training is requested we should perform it always */ -if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) || - (!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) { +/* Retrain if Channel EQ or CR not ok */ +if ((!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) {Too many braces.
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0DRM_DEBUG_KMS ("%s: channel EQ not ok, retraining\n" , intel_encoder->base.name);@@ -4045,6 +4095,7 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp_short_pulse(struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct intel_encoder *intel_encoder = &dp_to_dig_port (intel_dp)->base;u8 sink_irq_vector =0 ;u8 old_sink_count = intel_dp->sink_count;bool ret;@@ -4056,6 +4107,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4111
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2
-0intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;Looks like compliance stuff should be a sub struct in
intel_dp, and you could just memset it to 0.
Yes I can add a struct for this.
Quoted 57 lines
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4137
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +3
-2/* * Now read the DPCD to see if it's actually running @@ -4079,8 +4132,9 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_DEVICE_SERVICE_IRQ_VECTOR , sink_irq_vector); -if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) -DRM_DEBUG_DRIVER ("Test request in short pulse not handled\n" ); +if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) { +intel_dp_handle_test_request (intel_dp); + }Unnecessary curly braces.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4145
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0if (sink_irq_vector & (DP_CP_IRQ |DP_SINK_SPECIFIC_IRQ ))DRM_DEBUG_DRIVER ("CP or sink specific irq unhandled\n" ); }@@ -4088,6 +4142,11 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );intel_dp_check_link_status (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING )) {Too many braces.
drivers/gpu/drm/i915/intel_dp.c static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, · line 4438
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +6
-0+DRM_DEBUG_KMS ("Link Training Compliance Test requested\n" ); +/* Send a Hotplug Uevent to userspace to start modeset */ +drm_kms_helper_hotplug_event (intel_encoder->base.dev); + }return true; }@@ -4375,6 +4434,8 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;Same thing about making compliance sub struct.
Quoted 15 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0if (intel_dp->is_mst) { DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -958,6 +958,8 @@ struct intel_dp {unsigned long compliance_test_type;unsigned long compliance_test_data;bool compliance_test_active; +u8 compliance_test_lane_count; +u8 compliance_test_link_rate; };
Quoted 4 lines
Quoted 1 line
drivers/gpu/drm/i915/intel_drv.h +0
-0struct intel_lspcon {Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 1/5] drm/i915: Add support for DP link training compliance
Quoted 73 lines · Manasi Navare
Quoted 58 lines · Jani Nikula
Quoted 57 lines · Manasi Navare
This patch adds support to handle automated DP compliance link training test requests. This patch has been tested with Unigraf DPR-120 DP Compliance device for testing Link Training Compliance.
After we get a short pulse Compliance test request, test request values are read and hotplug uevent is sent in order to trigger another modeset during which the pipe is configured and link is retrained and enabled for link parameters requested by the test.Signed-off-by Manasi Navare <[email protected]>Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjala <[email protected]>--- drivers/gpu/drm/i915/intel_dp.c | 73 ++++++++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 69 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dp.c +16
-0@@ -288,6 +288,21 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp, common_rates); } +static int intel_dp_link_rate_index (struct intel_dp *intel_dp, +int *common_rates,int link_rate) +{ +int common_len; +int index; + + common_len =intel_dp_common_rates (intel_dp, common_rates); +for (index =0 ; index < common_len; index++) { +if (link_rate == common_rates[common_len - index -1 ]) +return common_len - index -1 ; + } + +return -1 ; +} +static enum drm_mode_status intel_dp_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode)@@ -1554,6 +1569,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,/* Conveniently, the link BW constants become indices with a shift...*/ int min_clock =0 ;int max_clock; +int link_rate_index;int bpp, mode_rate;int link_avail, link_clock;int common_rates[DP_MAX_SUPPORTED_RATES ] = {};@@ -1595,6 +1611,16 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,if (adjusted_mode->flags &DRM_MODE_FLAG_DBLCLK )return false;Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1621
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+/* Use values requested by Compliance Test Request */ +if (intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) { + link_rate_index =intel_dp_link_rate_index (intel_dp, + common_rates, +drm_dp_bw_code_to_link_rate (intel_dp->compliance_test_link_rate)); +if (link_rate_index >=0 ) + min_clock = max_clock = link_rate_index; + min_lane_count = max_lane_count = intel_dp->compliance_test_lane_count;You need to be more strict about validating
compliance_test_lane_count. You do mask it withDP_MAX_LANE_COUNT_MASK, but that's0x1f, quite a few more lanes than we have...
Quoted 5 lines
So the reason I didnt add validation here is because we enter the DUT capabilities into DPR-120 before starting the test, so the test lane count its gonna request will not exceed the DUT max lane count. But we can still take safe approach and take the min between the
compliance_lane_countand max source lane count.
The kernel must validate any and all input whether it comes from userspace or from other devices.
Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1671
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3
-0+ } + DRM_DEBUG_KMS("DP link computation with max lane count %i " "max bw %d pixel clock %iKHz\n", max_lane_count, common_rates[max_clock],@@ -1642,6 +1668,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp, } } } +Please pay attention to not making unrelated changes.
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0}return false;@@ -3804,6 +3831,29 @@ int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc)static uint8_t intel_dp_autotest_link_training (struct intel_dp *intel_dp) {uint8_t test_result =DP_TEST_ACK ; +int status =0 ;drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3844
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +10
-0+/* (DP CTS 1.2) +* 4.3.1.11 +*/ +/* Read the TEST_LANE_COUNT and TEST_LINK_RTAE fields (DP CTS 3.1.4) */ + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LANE_COUNT , + &intel_dp->compliance_test_lane_count); + +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test lane count from " +"reference sink\n" );No need to be so verbose,
DRM_DEBUG_KMSwill include the function name, so a simple "Lane count read failed" or something will suffice.
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3845
Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1
-0+return 0 ;Should these return
DP_TEST_NAKon errors or what?No in this case it should just return which will not send any test response and the test will timeout after 5 retries and stop.
TEST_NAKis usually if the test is not supported.
Ok.
Quoted 129 lines
Quoted 56 lines
drivers/gpu/drm/i915/intel_dp.c int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc) · line 3853
Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +8
-0+ } + intel_dp->compliance_test_lane_count &=DP_MAX_LANE_COUNT_MASK ; + + status =drm_dp_dpcd_readb (&intel_dp->aux,DP_TEST_LINK_RATE , + &intel_dp->compliance_test_link_rate); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test link rate from " +"refernce sink\n" );Ditto.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 3962
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +5
-1+return 0 ; + } +return test_result; }@@ -3908,7 +3958,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_TEST_RESPONSE , &response, 1);if (status <=0 ) -DRM_DEBUG_KMS ("Could not write test response to sink\n" ); +DRM_DEBUG_KMS ("Could not write test response " +"to sink\n" );Unrelated change, and one we don't want.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4073
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +2
-3} static int@@ -4018,9 +4069,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)if (WARN_ON_ONCE (!intel_dp->lane_count))return ; -/* if link training is requested we should perform it always */ -if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING ) || - (!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) { +/* Retrain if Channel EQ or CR not ok */ +if ((!drm_dp_channel_eq_ok (link_status, intel_dp->lane_count))) {Too many braces.
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0DRM_DEBUG_KMS ("%s: channel EQ not ok, retraining\n" , intel_encoder->base.name);@@ -4045,6 +4095,7 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp_short_pulse(struct intel_dp *intel_dp) {struct drm_device *dev =intel_dp_to_dev (intel_dp); +struct intel_encoder *intel_encoder = &dp_to_dig_port (intel_dp)->base;u8 sink_irq_vector =0 ;u8 old_sink_count = intel_dp->sink_count;bool ret;@@ -4056,6 +4107,8 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)Quoted 9 lines
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4111
Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2
-0intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;Looks like compliance stuff should be a sub struct in
intel_dp, and you could just memset it to 0.Yes I can add a struct for this.
Quoted 61 lines
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4137
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +3
-2/* * Now read the DPCD to see if it's actually running @@ -4079,8 +4132,9 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)DP_DEVICE_SERVICE_IRQ_VECTOR , sink_irq_vector); -if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) -DRM_DEBUG_DRIVER ("Test request in short pulse not handled\n" ); +if (sink_irq_vector &DP_AUTOMATED_TEST_REQUEST ) { +intel_dp_handle_test_request (intel_dp); + }Unnecessary curly braces.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4145
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0if (sink_irq_vector & (DP_CP_IRQ |DP_SINK_SPECIFIC_IRQ ))DRM_DEBUG_DRIVER ("CP or sink specific irq unhandled\n" ); }@@ -4088,6 +4142,11 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)drm_modeset_lock (&dev->mode_config.connection_mutex,NULL );intel_dp_check_link_status (intel_dp);drm_modeset_unlock (&dev->mode_config.connection_mutex); +if ((intel_dp->compliance_test_type ==DP_TEST_LINK_TRAINING )) {Too many braces.
drivers/gpu/drm/i915/intel_dp.c static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, · line 4438
Quoted 13 lines
drivers/gpu/drm/i915/intel_dp.c +6
-0+DRM_DEBUG_KMS ("Link Training Compliance Test requested\n" ); +/* Send a Hotplug Uevent to userspace to start modeset */ +drm_kms_helper_hotplug_event (intel_encoder->base.dev); + }return true; }@@ -4375,6 +4434,8 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_test_lane_count =0 ; + intel_dp->compliance_test_link_rate =0 ;Same thing about making compliance sub struct.
Quoted 16 lines
drivers/gpu/drm/i915/intel_dp.c +0
-0if (intel_dp->is_mst) { DRM_DEBUG_KMS("MST device may have disappeared %d vs %d\n",drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -958,6 +958,8 @@ struct intel_dp {unsigned long compliance_test_type;unsigned long compliance_test_data;bool compliance_test_active; +u8 compliance_test_lane_count; +u8 compliance_test_link_rate; };struct intel_lspcon {Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm/i915: Fixes to support DP Compliance EDID tests
In reply to Manasi NavareThis patch addresses a few issues from the original patch for DP Compliance EDID test support submitted by
Todd Previte<[email protected]>
Video Mode requested in the EDID test handler for the EDID Read test (CTS 4.2.2.3) should be set to PREFERRED as per the CTS spec.
--- drivers/gpu/drm/i915/intel_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -3865,7 +3865,7 @@ static uint8_t intel_dp_autotest_video_pattern(struct intel_dp *intel_dp)static uint8_t intel_dp_autotest_edid (struct intel_dp *intel_dp) { -uint8_t test_result =DP_TEST_NAK ; +uint8_t test_result =DP_TEST_ACK ;struct intel_connector *intel_connector = intel_dp->attached_connector;struct drm_connector *connector = &intel_connector->base;
@@ -3900,7 +3900,7 @@ static uint8_t intel_dp_autotest_edid(struct intel_dp *intel_dp)DRM_DEBUG_KMS ("Failed to write EDID checksum\n" ); test_result =DP_TEST_ACK |DP_TEST_EDID_CHECKSUM_WRITE ; - intel_dp->compliance_test_data =INTEL_DP_RESOLUTION_STANDARD ; + intel_dp->compliance_test_data =INTEL_DP_RESOLUTION_PREFERRED ; }/* Set test active flag here so userspace doesn't interrupt things */
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 Add support for forcing 6 bpc on DP pipes.
In reply to Manasi NavareFrom: Jim Bride <[email protected]>
For DP compliance we need to be able to control the output color type for the pipe associated with the DP port. When a specific DP compliance test is requested with specific BPC value, we read the BPC value from the DPCD register and store it in the intel_dp structure. If this BPC value in intel_dp structure has a non-zero value and we're on a display port connector, then we use the value to calculate the bpp for the pipe. For cases where we are not on DP or there has not been an overridden value then we behave as normal.
--- drivers/gpu/drm/i915/intel_display.c | 4 +++- drivers/gpu/drm/i915/intel_dp.c | 10 ++++++++++ drivers/gpu/drm/i915/intel_dp_mst.c | 11 +++++++++-- drivers/gpu/drm/i915/intel_drv.h | 1 + 4 files changed, 23 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -1
@@ -12694,11 +12694,13 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)/* Clamp display bpp to EDID value */ for_each_connector_in_state (state, connector, connector_state, i) { +if (connector_state->crtc != &crtc->base)continue ;connected_sink_compute_bpp (to_intel_connector (connector), - pipe_config); + pipe_config); + }return bpp;
drivers/gpu/drm/i915/intel_dp.c +10 -0
@@ -1549,6 +1549,13 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,if (bpc >0 ) bpp =min (bpp,3 *bpc); +/* For DP Compliance we override the computed bpp for the pipe */ +if (intel_dp->compliance_force_bpc !=0 ) { + pipe_config->pipe_bpp = intel_dp->compliance_force_bpc*3 ; +DRM_DEBUG_KMS ("Setting pipe_bpp to %d\n" , + pipe_config->pipe_bpp); + } +return bpp; }
@@ -1629,6 +1636,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,/* Walk through all bpp values. Luckily they're all nicely spaced with 2 * bpc in between. */ bpp =intel_dp_compute_bpp (intel_dp, pipe_config); +if (is_edp (intel_dp)) {/* Get bpp from vbt only for panels that dont have bpp in edid */
@@ -4109,6 +4117,7 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp->compliance_test_data =0 ; intel_dp->compliance_test_lane_count =0 ; intel_dp->compliance_test_link_rate =0 ; + intel_dp->compliance_force_bpc =0 ;/* * Now read the DPCD to see if it's actually running
@@ -4434,6 +4443,7 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_force_bpc =0 ; intel_dp->compliance_test_lane_count =0 ; intel_dp->compliance_test_link_rate =0 ;
drivers/gpu/drm/i915/intel_dp_mst.c +9 -2
@@ -45,6 +45,14 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, pipe_config->has_pch_encoder = false; bpp =24 ; +/* For DP Compliance we need to ensurethat we can override +* the computed bpp for the pipe +*/ +if (intel_dp->compliance_force_bpc) { + bpp = intel_dp->compliance_force_bpc *3 ; +DRM_DEBUG_KMS ("Setting pipe bpp to %d\n" , + bpp); + }/* * for MST we always configure max link bw - the spec doesn't * seem to suggest we should do otherwise.
@@ -52,8 +60,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, lane_count =drm_dp_max_lane_count (intel_dp->dpcd); pipe_config->lane_count = lane_count; - - pipe_config->pipe_bpp =24 ; + pipe_config->pipe_bpp = bpp; pipe_config->port_clock =intel_dp_max_link_rate (intel_dp); state = pipe_config->base.state;
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -960,6 +960,7 @@ struct intel_dp {bool compliance_test_active;u8 compliance_test_lane_count;u8 compliance_test_link_rate; +unsigned long compliance_force_bpc;/* 0 for default or bpc to use */ };struct intel_lspcon {
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [PATCH 3/5] Add support for forcing 6 bpc on DP pipes.
Quoted 29 lines · Manasi Navare
From: Jim Bride <[email protected]>
For DP compliance we need to be able to control the output color type for the pipe associated with the DP port. When a specific DP compliance test is requested with specific BPC value, we read the BPC value from the DPCD register and store it in the
intel_dpstructure. If this BPC value inintel_dpstructure has a non-zero value and we're on a display port connector, then we use the value to calculate the bpp for the pipe. For cases where we are not on DP or there has not been an overridden value then we behave as normal.Signed-off-by Jim Bride <[email protected]>Signed-off-by Manasi Navare <[email protected]>Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjala <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 4 +++- drivers/gpu/drm/i915/intel_dp.c | 10 ++++++++++ drivers/gpu/drm/i915/intel_dp_mst.c | 11 +++++++++-- drivers/gpu/drm/i915/intel_drv.h | 1 + 4 files changed, 23 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c static void intel_modeset_update_connector_atomic_state(struct drm_device *dev) · line 12697
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -12694,11 +12694,13 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)/* Clamp display bpp to EDID value */ for_each_connector_in_state (state, connector, connector_state, i) { +
Unrelated change, and one we don't want.
drivers/gpu/drm/i915/intel_display.c static void intel_modeset_update_connector_atomic_state(struct drm_device *dev) · line 12703
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +2
-1if (connector_state->crtc != &crtc->base)continue ;connected_sink_compute_bpp (to_intel_connector (connector), - pipe_config); + pipe_config); +
Unrelated change, and one we don't want.
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1553
Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c +0
-0}return bpp;drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -1549,6 +1549,13 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,if (bpc >0 ) bpp =min (bpp,3 *bpc); +/* For DP Compliance we override the computed bpp for the pipe */ +if (intel_dp->compliance_force_bpc !=0 ) {
You don't actually *set* compliance_force_bpc in this patch, making all of this a complicated nop. We don't want this kind of changes, because if this regresses, it'll regress in the patch actually *using* the code, i.e. the patch setting compliance_force_bpc, not this one.
The rationale is the same as for adding unused functions as prep patches.
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1554
Quoted 1 line
drivers/gpu/drm/i915/intel_dp.c +1
-0+ pipe_config->pipe_bpp = intel_dp->compliance_force_bpc*3 ;
How about making that compliance_force_bpp and setting it to * 3 directly in one place instead of sprinkling the * 3 all over the place?
drivers/gpu/drm/i915/intel_dp.c static int intel_dp_compute_bpp(struct intel_dp *intel_dp, · line 1639
Quoted 12 lines
drivers/gpu/drm/i915/intel_dp.c +5
-0+DRM_DEBUG_KMS ("Setting pipe_bpp to %d\n" , + pipe_config->pipe_bpp); + } +return bpp; }@@ -1629,6 +1636,7 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,/* Walk through all bpp values. Luckily they're all nicely spaced with 2 * bpc in between. */ bpp =intel_dp_compute_bpp (intel_dp, pipe_config); +
Unrelated change. Please pay attention to these.
drivers/gpu/drm/i915/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 4120
Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0if (is_edp (intel_dp)) {/* Get bpp from vbt only for panels that dont have bpp in edid */ @@ -4109,6 +4117,7 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp) intel_dp->compliance_test_data =0 ; intel_dp->compliance_test_lane_count =0 ; intel_dp->compliance_test_link_rate =0 ; + intel_dp->compliance_force_bpc =0 ;
Again, benefits from having a sub struct.
Quoted 16 lines
drivers/gpu/drm/i915/intel_dp.c +1
-0/* * Now read the DPCD to see if it's actually running @@ -4434,6 +4443,7 @@ static bool intel_digital_port_connected(struct drm_i915_private *dev_priv, intel_dp->compliance_test_active =0 ; intel_dp->compliance_test_type =0 ; intel_dp->compliance_test_data =0 ; + intel_dp->compliance_force_bpc =0 ; intel_dp->compliance_test_lane_count =0 ; intel_dp->compliance_test_link_rate =0 ;drivers/gpu/drm/i915/intel_dp_mst.c +0
-0
drivers/gpu/drm/i915/intel_dp_mst.c static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, · line 50
Quoted 6 lines
drivers/gpu/drm/i915/intel_dp_mst.c +3
-0@@ -45,6 +45,14 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, pipe_config->has_pch_encoder = false; bpp =24 ; +/* For DP Compliance we need to ensurethat we can override +* the computed bpp for the pipe +*/
Unnecessary comment.
Quoted 23 lines
drivers/gpu/drm/i915/intel_dp_mst.c +6
-2+if (intel_dp->compliance_force_bpc) { + bpp = intel_dp->compliance_force_bpc *3 ; +DRM_DEBUG_KMS ("Setting pipe bpp to %d\n" , + bpp); + }/* * for MST we always configure max link bw - the spec doesn't * seem to suggest we should do otherwise. @@ -52,8 +60,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, lane_count =drm_dp_max_lane_count (intel_dp->dpcd); pipe_config->lane_count = lane_count; - - pipe_config->pipe_bpp =24 ; + pipe_config->pipe_bpp = bpp; pipe_config->port_clock =intel_dp_max_link_rate (intel_dp); state = pipe_config->base.state;drivers/gpu/drm/i915/intel_drv.h +0
-0
drivers/gpu/drm/i915/intel_drv.h struct intel_dp { · line 963
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -960,6 +960,7 @@ struct intel_dp {bool compliance_test_active;u8 compliance_test_lane_count;u8 compliance_test_link_rate; +unsigned long compliance_force_bpc;/* 0 for default or bpc to use */
unsigned long? How about plain int?
Quoted 3 lines
drivers/gpu/drm/i915/intel_drv.h +0
-0};struct intel_lspcon {
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm: Add definitions for DP compliance Video pattern tests
In reply to Manasi Navare--- include/drm/drm_dp_helper.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
include/drm/drm_dp_helper.h +15 -1
@@ -415,7 +415,21 @@#define DP_TEST_LANE_COUNT 0x220 -#define DP_TEST_PATTERN 0x221 +#define DP_TEST_PATTERN 0x221 +#define DP_COLOR_RAMP (1 << 0) +#define DP_TEST_H_WIDTH 0x22E +#define DP_TEST_V_HEIGHT 0x230 +#define DP_TEST_MISC 0x232 +#define DP_VIDEO_PATTERN_RGB_FORMAT 0 +#define DP_TEST_COLOR_FORMAT_MASK 0x6 +#define DP_TEST_DYNAMIC_RANGE_MASK (1 << 3) +#define DP_VIDEO_PATTERN_VESA 0 +#define DP_TEST_BIT_DEPTH_MASK 0x00E0 +#define DP_TEST_BIT_DEPTH_6 0 +#define DP_TEST_BIT_DEPTH_8 1 +#define DP_TEST_MISC_BIT_1 1 +#define DP_TEST_MISC_BIT_3 3 +#define DP_TEST_MISC_BIT_5 5#define DP_TEST_CRC_R_CR 0x240#define DP_TEST_CRC_G_Y 0x242
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 4/5] drm: Add definitions for DP compliance Video pattern tests
Quoted 14 lines · Manasi Navare
Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjala <[email protected]>Signed-off-by Manasi Navare <[email protected]>--- include/drm/drm_dp_helper.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)include/drm/drm_dp_helper.h +0
-0
include/drm/drm_dp_helper.h line 418
Quoted 5 lines
include/drm/drm_dp_helper.h +1
-1@@ -415,7 +415,21 @@#define DP_TEST_LANE_COUNT 0x220 -#define DP_TEST_PATTERN 0x221 +#define DP_TEST_PATTERN 0x221
Unnecessary indentation change. Please observe the code around you. It may not have the best indentation style, but stick with what's there for all the other DPCD address definitions.
include/drm/drm_dp_helper.h line 419
Quoted 1 line
include/drm/drm_dp_helper.h +1
-0+#define DP_COLOR_RAMP (1 << 0)
See how all the other address *content* definitions have a space between "#" and "define". I'm not saying I like it, but it's uniform in the file.
While at it, why not add all of the defines for TEST_PATTERN. And observe how they are not bit patterns, so (1 << 0) should be just 1.
DP_NO_TEST_PATTERNDP_COLOR_RAMPSDP_BLACK_AND_WHITE_VERTICAL_LINESDP_COLOR_SQUARE
include/drm/drm_dp_helper.h line 420
Quoted 1 line
include/drm/drm_dp_helper.h +1
-0+#define DP_TEST_H_WIDTH 0x22E
Note that across the file, almost all addrses defines have a blank line between them, to separate content definitions from other addresses.
include/drm/drm_dp_helper.h line 421
Quoted 1 line
include/drm/drm_dp_helper.h +1
-0+#define DP_TEST_V_HEIGHT 0x230
I guess I'd do
#define DP_TEST_V_HEIGHT_HI 0x230
#define DP_TEST_V_HEIGHT_LO 0x231
You don't actually have to *use* both definitions if you can write both in one go, but this saves the trouble of checking the DP spec when it's documented as #defines here.
include/drm/drm_dp_helper.h line 423
Quoted 2 lines
include/drm/drm_dp_helper.h +2
-0+#define DP_TEST_MISC 0x232 +#define DP_VIDEO_PATTERN_RGB_FORMAT 0
The convention is to shift the 0 too so it's obvious where it fits. _MASK goes before the values. Please add all the values.
include/drm/drm_dp_helper.h line 425
Quoted 2 lines
include/drm/drm_dp_helper.h +2
-0+#define DP_TEST_COLOR_FORMAT_MASK 0x6 +#define DP_TEST_DYNAMIC_RANGE_MASK (1 << 3)
And the values?
include/drm/drm_dp_helper.h
Quoted 5 lines
include/drm/drm_dp_helper.h +4
-0+#define DP_VIDEO_PATTERN_VESA 0 +#define DP_TEST_BIT_DEPTH_MASK 0x00E0 +#define DP_TEST_BIT_DEPTH_6 0 +#define DP_TEST_BIT_DEPTH_8 1
Just add all of the values at once.
Quoted 6 lines
include/drm/drm_dp_helper.h +3
-0+#define DP_TEST_MISC_BIT_1 1 +#define DP_TEST_MISC_BIT_3 3 +#define DP_TEST_MISC_BIT_5 5#define DP_TEST_CRC_R_CR 0x240#define
DP_TEST_CRC_G_Y0x242
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/i915: Add support for DP Video pattern compliance tests
In reply to Manasi NavareThe intel_dp_autotest_video_pattern() function gets invoked through the compliance test handler on a HPD short pulse if the test type is set to DP_TEST_VIDEO_PATTERN. This performs the DPCD registers reads to read the requested test pattern, video pattern resolution, frame rate and bits per color value. The results of this analysis are handed off to userspace so that the userspace app can set the video pattern mode appropriately for the test result/response.
The compliance_test_active flag is set at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag.
--- drivers/gpu/drm/i915/i915_debugfs.c | 14 +++++++- drivers/gpu/drm/i915/intel_dp.c | 68 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 9 +++++ 3 files changed, 90 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +13 -1
@@ -4545,7 +4545,19 @@ static int i915_displayport_test_data_show(struct seq_file *m, void *data)if (connector->status == connector_status_connected && connector->encoder !=NULL ) { intel_dp =enc_to_intel_dp (connector->encoder); -seq_printf (m,"%lx" , intel_dp->compliance_test_data); +if (intel_dp->compliance_test_type == +DP_TEST_LINK_EDID_READ ) +seq_printf (m,"%lx" , + intel_dp->compliance_test_data); +else if (intel_dp->compliance_test_type == +DP_TEST_LINK_VIDEO_PATTERN ) { +seq_printf (m,"hdisplay: %d\n" , + intel_dp->test_data.hdisplay); +seq_printf (m,"vdisplay: %d\n" , + intel_dp->test_data.vdisplay); +seq_printf (m,"bpc: %u\n" , + intel_dp->test_data.bpc); + } }else seq_puts (m,"0" ); }
drivers/gpu/drm/i915/intel_dp.c +68 -0
83 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +9 -0
@@ -880,6 +880,12 @@ struct intel_dp_desc {u8 sw_minor_rev; } __packed; +struct compliance_test_data { +uint8_t video_pattern; +uint16_t hdisplay, vdisplay; +uint8_t bpc; +}; +struct intel_dp {i915_reg_t output_reg;i915_reg_t aux_ch_ctl_reg;
@@ -961,6 +967,9 @@ struct intel_dp {u8 compliance_test_lane_count;u8 compliance_test_link_rate;unsigned long compliance_force_bpc;/* 0 for default or bpc to use */ +struct compliance_test_data test_data;/* a structure to hold all dp +* compliance test data +*/ };struct intel_lspcon {
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 5/5] drm/i915: Add support for DP Video pattern compliance tests
Quoted 155 lines · Manasi Navare
The
intel_dp_autotest_video_pattern()function gets invoked through the compliance test handler on a HPD short pulse if the test type is set toDP_TEST_VIDEO_PATTERN. This performs the DPCD registers reads to read the requested test pattern, video pattern resolution, frame rate and bits per color value. The results of this analysis are handed off to userspace so that the userspace app can set the video pattern mode appropriately for the test result/response.The
compliance_test_activeflag is set at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag.Signed-off-by Manasi Navare <[email protected]>Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjala <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 14 +++++++- drivers/gpu/drm/i915/intel_dp.c | 68 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 9 +++++ 3 files changed, 90 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +13
-1@@ -4545,7 +4545,19 @@ static int i915_displayport_test_data_show(struct seq_file *m, void *data)if (connector->status == connector_status_connected && connector->encoder !=NULL ) { intel_dp =enc_to_intel_dp (connector->encoder); -seq_printf (m,"%lx" , intel_dp->compliance_test_data); +if (intel_dp->compliance_test_type == +DP_TEST_LINK_EDID_READ ) +seq_printf (m,"%lx" , + intel_dp->compliance_test_data); +else if (intel_dp->compliance_test_type == +DP_TEST_LINK_VIDEO_PATTERN ) { +seq_printf (m,"hdisplay: %d\n" , + intel_dp->test_data.hdisplay); +seq_printf (m,"vdisplay: %d\n" , + intel_dp->test_data.vdisplay); +seq_printf (m,"bpc: %u\n" , + intel_dp->test_data.bpc); + } }else seq_puts (m,"0" ); }drivers/gpu/drm/i915/intel_dp.c +68
-0@@ -28,8 +28,10 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/types.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <asm/byteorder.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> @@ -3868,7 +3870,73 @@ static uint8_t intel_dp_autotest_link_training(struct intel_dp *intel_dp)static uint8_t intel_dp_autotest_video_pattern (struct intel_dp *intel_dp) {uint8_t test_result =DP_TEST_NAK ; +uint8_t test_pattern; +uint16_t test_misc; +__be16 h_width, v_height; +int status =0 ; + +/* Read the TEST_PATTERN (DP CTS 3.1.5) */ + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_PATTERN , + &test_pattern,1 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test pattern from " +"reference sink\n" ); +return 0 ; + } +if (test_pattern !=DP_COLOR_RAMP ) +return test_result; + intel_dp->test_data.video_pattern = test_pattern; + + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_H_WIDTH , + &h_width,2 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read H Width from " +"reference sink\n" ); +return 0 ; + } + intel_dp->test_data.hdisplay =be16_to_cpu (h_width); + + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_V_HEIGHT , + &v_height,2 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read V Height from " +"reference sink\n" ); +return 0 ; + } + intel_dp->test_data.vdisplay =be16_to_cpu (v_height); + + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_MISC , + &test_misc,1 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read TEST MISC from " +"reference sink\n" ); +return 0 ; + } +if (((test_misc &DP_TEST_COLOR_FORMAT_MASK ) >>DP_TEST_MISC_BIT_1 ) != +DP_VIDEO_PATTERN_RGB_FORMAT ) +return test_result; +if (((test_misc &DP_TEST_DYNAMIC_RANGE_MASK ) >>DP_TEST_MISC_BIT_3 ) != +DP_VIDEO_PATTERN_VESA ) +return test_result; +switch ((test_misc &DP_TEST_BIT_DEPTH_MASK ) >>DP_TEST_MISC_BIT_5 ) { +case 0 : + intel_dp->compliance_force_bpc =6 ; + intel_dp->test_data.bpc =6 ; +break ; +case 1 : + intel_dp->compliance_force_bpc =8 ; + intel_dp->test_data.bpc =8 ; +break ; +default : +return test_result; + } +/* Set test active flag here so userspace doesn't interrupt things */ + intel_dp->compliance_test_active =1 ; + + test_result =DP_TEST_ACK ; +return test_result; + }static uint8_t intel_dp_autotest_edid (struct intel_dp *intel_dp)drivers/gpu/drm/i915/intel_drv.h +6
-0@@ -880,6 +880,12 @@ struct intel_dp_desc {u8 sw_minor_rev; } __packed; +struct compliance_test_data { +uint8_t video_pattern; +uint16_t hdisplay, vdisplay; +uint8_t bpc; +}; +struct intel_dp {i915_reg_t output_reg;i915_reg_t aux_ch_ctl_reg;
drivers/gpu/drm/i915/intel_drv.h struct intel_dp { · line 972
Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h +3
-0@@ -961,6 +967,9 @@ struct intel_dp {u8 compliance_test_lane_count;u8 compliance_test_link_rate;unsigned long compliance_force_bpc;/* 0 for default or bpc to use */ +struct compliance_test_data test_data;/* a structure to hold all dp +* compliance test data +*/
I like this idea of tying all the compliance test data into a sub-struct, but please refactor the existing code (and the force_bpc you're adding in this series) to also use that. Consistency wins over pretty imo.
Otherwise seems all reasonable, but this isn't a detailed review. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [PATCH 5/5] drm/i915: Add support for DP Video pattern compliance tests
In reply to Manasi NavareQuoted 8 lines · Manasi Navare
The
intel_dp_autotest_video_pattern()function gets invoked through the compliance test handler on a HPD short pulse if the test type is set toDP_TEST_VIDEO_PATTERN. This performs the DPCD registers reads to read the requested test pattern, video pattern resolution, frame rate and bits per color value. The results of this analysis are handed off to userspace so that the userspace app can set the video pattern mode appropriately for the test result/response.
Quoted 4 lines
The
compliance_test_activeflag is set at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag.
I've brought this up before, but I think for this stuff the way to go is to have the userspace read the DPCD directly. We have the dev node for it.
With the approach in this patch, we'll just end up reading a bunch of stuff from DPCD in kernel, doing error handling for that, decoding and sanity checking the values, putting them in debugfs for the userspace to read, having userspace code read debugfs, doing error handling for that, decoding and sanity checking the data, finally doing something based on the data.
You'll also get a *much* faster turnaround for getting your userspace code done than getting all of this in kernel first, then tweaking your userspace, having to update both of those in lockstep, etc. When this is based on reading DPCD directly, you can just add new stuff quickly in userspace, with no kernel dependency.
The easiest way would be to have an indication in debugfs for userspace that there's something interesting in DPCD. Just a simple thing.
BR,
Jani.
Quoted 152 lines
Signed-off-by Manasi Navare <[email protected]>Cc Jani Nikula <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ville Syrjala <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 14 +++++++- drivers/gpu/drm/i915/intel_dp.c | 68 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 9 +++++ 3 files changed, 90 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_debugfs.c +13
-1@@ -4545,7 +4545,19 @@ static int i915_displayport_test_data_show(struct seq_file *m, void *data)if (connector->status == connector_status_connected && connector->encoder !=NULL ) { intel_dp =enc_to_intel_dp (connector->encoder); -seq_printf (m,"%lx" , intel_dp->compliance_test_data); +if (intel_dp->compliance_test_type == +DP_TEST_LINK_EDID_READ ) +seq_printf (m,"%lx" , + intel_dp->compliance_test_data); +else if (intel_dp->compliance_test_type == +DP_TEST_LINK_VIDEO_PATTERN ) { +seq_printf (m,"hdisplay: %d\n" , + intel_dp->test_data.hdisplay); +seq_printf (m,"vdisplay: %d\n" , + intel_dp->test_data.vdisplay); +seq_printf (m,"bpc: %u\n" , + intel_dp->test_data.bpc); + } }else seq_puts (m,"0" ); }drivers/gpu/drm/i915/intel_dp.c +68
-0@@ -28,8 +28,10 @@#include <linux/i2c.h> #include <linux/slab.h> #include <linux/export.h> +#include <linux/types.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <asm/byteorder.h> #include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> @@ -3868,7 +3870,73 @@ static uint8_t intel_dp_autotest_link_training(struct intel_dp *intel_dp)static uint8_t intel_dp_autotest_video_pattern (struct intel_dp *intel_dp) {uint8_t test_result =DP_TEST_NAK ; +uint8_t test_pattern; +uint16_t test_misc; +__be16 h_width, v_height; +int status =0 ; + +/* Read the TEST_PATTERN (DP CTS 3.1.5) */ + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_PATTERN , + &test_pattern,1 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read test pattern from " +"reference sink\n" ); +return 0 ; + } +if (test_pattern !=DP_COLOR_RAMP ) +return test_result; + intel_dp->test_data.video_pattern = test_pattern; + + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_H_WIDTH , + &h_width,2 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read H Width from " +"reference sink\n" ); +return 0 ; + } + intel_dp->test_data.hdisplay =be16_to_cpu (h_width); + + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_V_HEIGHT , + &v_height,2 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read V Height from " +"reference sink\n" ); +return 0 ; + } + intel_dp->test_data.vdisplay =be16_to_cpu (v_height); + + status =drm_dp_dpcd_read (&intel_dp->aux,DP_TEST_MISC , + &test_misc,1 ); +if (status <=0 ) { +DRM_DEBUG_KMS ("Could not read TEST MISC from " +"reference sink\n" ); +return 0 ; + } +if (((test_misc &DP_TEST_COLOR_FORMAT_MASK ) >>DP_TEST_MISC_BIT_1 ) != +DP_VIDEO_PATTERN_RGB_FORMAT ) +return test_result; +if (((test_misc &DP_TEST_DYNAMIC_RANGE_MASK ) >>DP_TEST_MISC_BIT_3 ) != +DP_VIDEO_PATTERN_VESA ) +return test_result; +switch ((test_misc &DP_TEST_BIT_DEPTH_MASK ) >>DP_TEST_MISC_BIT_5 ) { +case 0 : + intel_dp->compliance_force_bpc =6 ; + intel_dp->test_data.bpc =6 ; +break ; +case 1 : + intel_dp->compliance_force_bpc =8 ; + intel_dp->test_data.bpc =8 ; +break ; +default : +return test_result; + } +/* Set test active flag here so userspace doesn't interrupt things */ + intel_dp->compliance_test_active =1 ; + + test_result =DP_TEST_ACK ; +return test_result; + }static uint8_t intel_dp_autotest_edid (struct intel_dp *intel_dp)drivers/gpu/drm/i915/intel_drv.h +9
-0@@ -880,6 +880,12 @@ struct intel_dp_desc {u8 sw_minor_rev; } __packed; +struct compliance_test_data { +uint8_t video_pattern; +uint16_t hdisplay, vdisplay; +uint8_t bpc; +}; +struct intel_dp {i915_reg_t output_reg;i915_reg_t aux_ch_ctl_reg;@@ -961,6 +967,9 @@ struct intel_dp {u8 compliance_test_lane_count;u8 compliance_test_link_rate;unsigned long compliance_force_bpc;/* 0 for default or bpc to use */ +struct compliance_test_data test_data;/* a structure to hold all dp +* compliance test data +*/ };struct intel_lspcon {
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Add support for DP Video pattern compliance tests
Quoted 25 lines · Jani Nikula
Quoted 8 lines · Manasi Navare
The
intel_dp_autotest_video_pattern()function gets invoked through the compliance test handler on a HPD short pulse if the test type is set toDP_TEST_VIDEO_PATTERN. This performs the DPCD registers reads to read the requested test pattern, video pattern resolution, frame rate and bits per color value. The results of this analysis are handed off to userspace so that the userspace app can set the video pattern mode appropriately for the test result/response.Quoted 4 lines
The
compliance_test_activeflag is set at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag.I've brought this up before, but I think for this stuff the way to go is to have the userspace read the DPCD directly. We have the dev node for it.
With the approach in this patch, we'll just end up reading a bunch of stuff from DPCD in kernel, doing error handling for that, decoding and sanity checking the values, putting them in debugfs for the userspace to read, having userspace code read debugfs, doing error handling for that, decoding and sanity checking the data, finally doing something based on the data.
Quoted 8 lines
You'll also get a *much* faster turnaround for getting your userspace code done than getting all of this in kernel first, then tweaking your userspace, having to update both of those in lockstep, etc. When this is based on reading DPCD directly, you can just add new stuff quickly in userspace, with no kernel dependency.
The easiest way would be to have an indication in debugfs for userspace that there's something interesting in DPCD. Just a simple thing.
Or just have the kernel fire off an uevent...
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 5/5] drm/i915: Add support for DP Video pattern compliance tests
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Jani Nikula
Quoted 8 lines · Manasi Navare
The
intel_dp_autotest_video_pattern()function gets invoked through the compliance test handler on a HPD short pulse if the test type is set toDP_TEST_VIDEO_PATTERN. This performs the DPCD registers reads to read the requested test pattern, video pattern resolution, frame rate and bits per color value. The results of this analysis are handed off to userspace so that the userspace app can set the video pattern mode appropriately for the test result/response.Quoted 4 lines
The
compliance_test_activeflag is set at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag.I've brought this up before, but I think for this stuff the way to go is to have the userspace read the DPCD directly. We have the dev node for it.
With the approach in this patch, we'll just end up reading a bunch of stuff from DPCD in kernel, doing error handling for that, decoding and sanity checking the values, putting them in debugfs for the userspace to read, having userspace code read debugfs, doing error handling for that, decoding and sanity checking the data, finally doing something based on the data.
You'll also get a *much* faster turnaround for getting your userspace code done than getting all of this in kernel first, then tweaking your userspace, having to update both of those in lockstep, etc. When this is based on reading DPCD directly, you can just add new stuff quickly in userspace, with no kernel dependency.
Quoted 4 lines
Quoted 2 lines
The easiest way would be to have an indication in debugfs for userspace that there's something interesting in DPCD. Just a simple thing.
Or just have the kernel fire off an uevent...
I know, I know, I had that written in my mail already, but swallowed it not to add another dependency on another new UABI... we can do that later.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Add support for DP Video pattern compliance tests
Quoted 33 lines · Jani Nikula
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Jani Nikula
Quoted 8 lines · Manasi Navare
The
intel_dp_autotest_video_pattern()function gets invoked through the compliance test handler on a HPD short pulse if the test type is set toDP_TEST_VIDEO_PATTERN. This performs the DPCD registers reads to read the requested test pattern, video pattern resolution, frame rate and bits per color value. The results of this analysis are handed off to userspace so that the userspace app can set the video pattern mode appropriately for the test result/response.Quoted 4 lines
The
compliance_test_activeflag is set at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag.I've brought this up before, but I think for this stuff the way to go is to have the userspace read the DPCD directly. We have the dev node for it.
With the approach in this patch, we'll just end up reading a bunch of stuff from DPCD in kernel, doing error handling for that, decoding and sanity checking the values, putting them in debugfs for the userspace to read, having userspace code read debugfs, doing error handling for that, decoding and sanity checking the data, finally doing something based on the data.
You'll also get a *much* faster turnaround for getting your userspace code done than getting all of this in kernel first, then tweaking your userspace, having to update both of those in lockstep, etc. When this is based on reading DPCD directly, you can just add new stuff quickly in userspace, with no kernel dependency.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The easiest way would be to have an indication in debugfs for userspace that there's something interesting in DPCD. Just a simple thing.
Or just have the kernel fire off an uevent...
I know, I know, I had that written in my mail already, but swallowed it not to add another dependency on another new UABI... we can do that later.
In principle I'd agree, but the trouble with dp compliance is that the CTS expects us to do stupid shit sometimes, like that test pattern forced as 6bpc. So if we decode&handle everything in userspace then the question is how to feed all those special cases back into the kernel, which means more debugfs interfaces. Just going in the other direction.
Given that it's a bit a toss-up unfortunately, and the current approach seems reasonable.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/i915: Add support for DP Video pattern compliance tests
Quoted 43 lines · Daniel Vetter
Quoted 33 lines · Jani Nikula
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Jani Nikula
Quoted 8 lines · Manasi Navare
The
intel_dp_autotest_video_pattern()function gets invoked through the compliance test handler on a HPD short pulse if the test type is set toDP_TEST_VIDEO_PATTERN. This performs the DPCD registers reads to read the requested test pattern, video pattern resolution, frame rate and bits per color value. The results of this analysis are handed off to userspace so that the userspace app can set the video pattern mode appropriately for the test result/response.Quoted 4 lines
The
compliance_test_activeflag is set at the end of the individual test handling functions. This is so that the kernel-side operations can be completed without the risk of interruption from the userspace app that is polling on that flag.I've brought this up before, but I think for this stuff the way to go is to have the userspace read the DPCD directly. We have the dev node for it.
With the approach in this patch, we'll just end up reading a bunch of stuff from DPCD in kernel, doing error handling for that, decoding and sanity checking the values, putting them in debugfs for the userspace to read, having userspace code read debugfs, doing error handling for that, decoding and sanity checking the data, finally doing something based on the data.
You'll also get a *much* faster turnaround for getting your userspace code done than getting all of this in kernel first, then tweaking your userspace, having to update both of those in lockstep, etc. When this is based on reading DPCD directly, you can just add new stuff quickly in userspace, with no kernel dependency.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The easiest way would be to have an indication in debugfs for userspace that there's something interesting in DPCD. Just a simple thing.
Or just have the kernel fire off an uevent...
I know, I know, I had that written in my mail already, but swallowed it not to add another dependency on another new UABI... we can do that later.
Quoted 8 lines
In principle I'd agree, but the trouble with dp compliance is that the CTS expects us to do stupid shit sometimes, like that test pattern forced as 6bpc. So if we decode&handle everything in userspace then the question is how to feed all those special cases back into the kernel, which means more debugfs interfaces. Just going in the other direction.
Given that it's a bit a toss-up unfortunately, and the current approach seems reasonable.
The kernel could of course parse whatever is needed from the test request as well, but leave it up to userspace to initiate the actual test and ack/nack the test request. So I don't see a real need for a debugfs interface in either direction.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Add Automation support for DP compliance testing
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: Add Automation support for DP compliance testing
URL : https://patchwork.freedesktop.org/series/15771/
State : success
== Summary ==
Series 15771v1 Add Automation support for DP compliance testing
https://patchwork.freedesktop.org/api/1.0/series/15771/revisions/1/mbox/
Test drv_module_reload_basic:
dmesg-warn -> PASS (fi-skl-6770hq)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a:
dmesg-warn -> PASS (fi-ilk-650)fi-bdw-5557u total:244 pass:229 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:244 pass:204 dwarn:0 dfail:0 fail:0 skip:40 fi-bxt-t5700 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-j1900 total:244 pass:216 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:244 pass:224 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:244 pass:191 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7200u total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:244 pass:223 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:244 pass:222 dwarn:1 dfail:0 fail:0 skip:21 fi-skl-6770hq total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:244 pass:212 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:244 pass:211 dwarn:0 dfail:0 fail:0 skip:33
b34f27e00c9a21d2078062da760e24fd4a620391 drm-intel-nightly: 2016y-11m-22d-17h-42m-39s UTC integration manifest 22114a2 drm/i915: Add support for DP Video pattern compliance tests
a2621e2 drm: Add definitions for DP compliance Video pattern tests
9309922 Add support for forcing 6 bpc on DP pipes.
69f7478 drm/i915: Fixes to support DP Compliance EDID tests
b8ca49e drm/i915: Add support for DP link training compliance
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3086/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx