public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Todd Previte <tprevite@gmail.com>
To: Paulo Zanoni <przanoni@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 08/13] drm/i915: Support EDID compliance tests with the intel_dp_autotest_edid() function
Date: Tue, 14 Apr 2015 10:42:15 -0700	[thread overview]
Message-ID: <552D5177.8050409@gmail.com> (raw)
In-Reply-To: <CA+gsUGTOyXGVDa+RKRrESCjqEbwAGLhgZFm7GDvj=Kt=Uabf5A@mail.gmail.com>



On 4/14/15 6:35 AM, Paulo Zanoni wrote:
> 2015-04-10 14:42 GMT-03:00 Todd Previte <tprevite@gmail.com>:
>> Updates the EDID compliance test function to perform the EDID read as
>> required by the tests. This read needs to take place in the kernel for
>> reasons of speed and efficiency. The results of the EDID read operations
>> are handed off to userspace so that the userspace app can set the display
>> mode appropriately for the test response.
>>
>> The compliance_test_active flag now appears 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.
>>
>> V2:
>> - Addressed mailing list feedback
>> - Removed excess debug messages
>> - Removed extraneous comments
>> - Fixed formatting issues (line length > 80)
>> - Updated the debug message in compute_edid_checksum to output hex values
>>    instead of decimal
>> V3:
>> - Addressed more list feedback
>> - Added the test_active flag to the autotest function
>> - Removed test_active flag from handler
>> - Added failsafe check on the compliance test active flag
>>    at the end of the test handler
>> - Fixed checkpatch.pl issues
>> V4:
>> - Removed the checksum computation function and its use as it has been
>>    rendered superfluous by changes to the core DRM EDID functions
>> - Updated to use the raw header corruption detection mechanism
>> - Moved the declaration of the test_data variable here
>> V5:
>> - Update test active flag variable name to match the change in the
>>    first patch of the series.
>> - Relocated the test active flag declaration and initialization
>>    to this patch
>> V6:
>> - Updated to use the new flag for raw EDID header corruption
>> - Removed the extra EDID read from the autotest function
>> - Added the edid_checksum variable to struct intel_dp so that the
>>    autotest function can write it to the sink device
>> - Moved the update to the hpd_pulse function to another patch
>> - Removed extraneous constants
>> V7:
>> - Fixed erroneous placement of the checksum assignment. In some cases
>>    such as when the EDID read fails and is NULL, this causes a NULL ptr
>>    dereference in the kernel. Bad news. Fixed now.
>>
>> Signed-off-by: Todd Previte <tprevite@gmail.com>
>> ---
>>   drivers/gpu/drm/i915/intel_dp.c  | 46 ++++++++++++++++++++++++++++++++++++++++
>>   drivers/gpu/drm/i915/intel_drv.h |  4 ++++
>>   2 files changed, 50 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
>> index ba2da44..3bfdc40 100644
>> --- a/drivers/gpu/drm/i915/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/intel_dp.c
>> @@ -41,6 +41,12 @@
>>
>>   #define DP_LINK_CHECK_TIMEOUT  (10 * 1000)
>>
>> +/* Compliance test status bits  */
>> +#define INTEL_DP_RESOLUTION_SHIFT_MASK 4
>> +#define INTEL_DP_RESOLUTION_PREFERRED  (1 << INTEL_DP_RESOLUTION_SHIFT_MASK)
>> +#define INTEL_DP_RESOLUTION_STANDARD   (2 << INTEL_DP_RESOLUTION_SHIFT_MASK)
>> +#define INTEL_DP_RESOLUTION_FAILSAFE   (3 << INTEL_DP_RESOLUTION_SHIFT_MASK)
>> +
>>   struct dp_link_dpll {
>>          int link_bw;
>>          struct dpll dpll;
>> @@ -3770,6 +3776,35 @@ 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;
>> +       uint32_t ret = 0;
>> +
>> +       if (intel_dp->compliance_edid_invalid ||
>> +           intel_dp->aux.i2c_defer_count > 6) {
>> +               /* Check for NACKs/DEFERs, use failsafe if detected
>> +                *  (DP CTS 1.2 Core Rev 1.1, 4.2.2.4, 4.2.2.5)
>> +                */
>> +               if (intel_dp->aux.i2c_nack_count > 0 ||
>> +                       intel_dp->aux.i2c_defer_count > 0)
>> +                       DRM_DEBUG_KMS("EDID read had %d NACKs, %d DEFERs\n",
>> +                                     intel_dp->aux.i2c_nack_count,
>> +                                     intel_dp->aux.i2c_defer_count);
>> +               intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_FAILSAFE;
> Since this case is expected to happen, shouldn't we return something
> that's not DP_TEST_NAK here?
The spec does not state whether or not we should ACK or NAK this case. 
This value is written to the sink device as the response, so for 
compliance testing purposes, the test device does not appear to care 
whether it's ACK or NAK.
>
> Also, we should try to write the checksum on this case too, shouldn't we?
>
> I see on 4.2.2.6 that the only happy case involves setting the
> failsafe resolution, and optionally sending the checksum.
>
> (sorry for not catching this earlier... I just didn't spot the problem)
Correct. Writing the bad checksum is optional, so I opted not to. Less 
code, less AUX transactions.
>
>> +       } else {
>> +               ret = drm_dp_dpcd_write(&intel_dp->aux,
>> +                                       DP_TEST_EDID_CHECKSUM,
>> +                                       &intel_dp->compliance_edid_checksum, 1);
>> +               if (ret <= 0)
>> +                       DRM_DEBUG_DRIVER("Failed to write EDID checksum\n");
>> +               else
>> +                       DRM_DEBUG_DRIVER("EDID checksum written to sink\n");
>> +
>> +               test_result = DP_TEST_ACK | DP_TEST_EDID_CHECKSUM_WRITE;
>> +               intel_dp->compliance_test_data = INTEL_DP_RESOLUTION_STANDARD;
>> +       }
>> +
>> +       /* Set test active flag here so userspace doesn't interrupt things */
>> +       intel_dp->compliance_test_active = 1;
>> +
>>          return test_result;
>>   }
>>
>> @@ -3785,7 +3820,10 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
>>          uint8_t rxdata = 0;
>>          int status = 0;
>>
>> +       intel_dp->compliance_test_active = 0;
>>          intel_dp->compliance_test_type = 0;
>> +       intel_dp->compliance_test_data = 0;
>> +
>>          intel_dp->aux.i2c_nack_count = 0;
>>          intel_dp->aux.i2c_defer_count = 0;
>>
>> @@ -3920,11 +3958,19 @@ intel_dp_check_link_status(struct intel_dp *intel_dp)
>>
>>          /* Displayport Link CTS Core 1.2 rev1.1 EDID testing
>>           * 4.2.2.1 - EDID read required for all HPD events
>> +        * Also used for 4.2.2.3, 4.2.2.4 4.2.2.5 and 4.2.2.6
>> +        *   - compliance_edid_invalid flag used for 4.2.2.6
>> +        *   - compliance_edid_checksum used for 4.2.2.3
>>            */
>> +       intel_dp->compliance_edid_invalid = 0;
>>           edid_read = drm_get_edid(connector, adapter);
>>           if (!edid_read || connector->edid_header_corrupt == 1) {
>>                   DRM_DEBUG_DRIVER("Invalid EDID detected\n");
>> +                intel_dp->compliance_edid_invalid = 1;
>> +               intel_dp->compliance_edid_checksum = 0;
>>           }
>> +       else
>> +               intel_dp->compliance_edid_checksum = edid_read->checksum;
>>
>>          /* Try to read the source of the interrupt */
>>          if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11 &&
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index ab811e5..23030a1 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -650,6 +650,10 @@ struct intel_dp {
>>
>>          /* Displayport compliance testing */
>>          unsigned long compliance_test_type;
>> +       unsigned long compliance_test_data;
>> +       bool compliance_test_active;
>> +       bool compliance_edid_invalid;
>> +       uint8_t compliance_edid_checksum;
>>   };
>>
>>   struct intel_digital_port {
>> --
>> 1.9.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-04-14 17:42 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 16:12 [intel-gfx][PATCH V5] Displayport compliance testing V5 Todd Previte
2015-04-10 16:12 ` [PATCH 01/11] drm/i915: Add automated testing support for Displayport compliance testing Todd Previte
2015-04-13 17:30   ` Paulo Zanoni
2015-04-10 16:12 ` [PATCH 02/11] drm/i915: Ignore disconnected Displayport connectors in check_link_status Todd Previte
2015-04-10 16:12 ` [PATCH 03/11] drm/i915: Move the DPCD read further up in intel_dp_check_link_status() Todd Previte
2015-04-14 17:48   ` Todd Previte
2015-04-10 16:12 ` [PATCH 04/11] drm/i915: Add EDID read in intel_dp_check_link_status() for Link CTS 4.2.2.1 Todd Previte
2015-04-13 14:10   ` Paulo Zanoni
2015-04-13 14:57     ` Todd Previte
2015-04-13 14:53   ` [PATCH 04/13] " Todd Previte
2015-04-14 16:53     ` Paulo Zanoni
2015-04-15  8:48       ` Daniel Vetter
2015-04-15 15:37       ` Todd Previte
2015-04-15 17:42         ` Paulo Zanoni
2015-04-16 15:41           ` Todd Previte
2015-04-16 16:31             ` Daniel Vetter
2015-04-16 17:32               ` Todd Previte
2015-04-20  5:10               ` Todd Previte
2015-04-10 16:12 ` [PATCH 05/11] drm/i915: Add a delay in Displayport AUX transactions for compliance testing Todd Previte
2015-04-13 21:05   ` Paulo Zanoni
2015-04-10 16:12 ` [PATCH 06/11] drm/i915: Add supporting structure for Displayport Link CTS test 4.2.2.6 Todd Previte
2015-04-10 17:38   ` [PATCH 06/13] drm: " Todd Previte
2015-04-10 17:45   ` [PATCH 06/11] drm/i915: " Emil Velikov
2015-04-10 17:38     ` Todd Previte
2015-04-13 14:53   ` [PATCH 06/13] drm: " Todd Previte
2015-04-13 22:18     ` Paulo Zanoni
2015-04-15  6:56       ` Todd Previte
2015-04-10 16:12 ` [PATCH 07/11] drm/i915: Update intel_dp_hpd_pulse() for non-MST operation Todd Previte
2015-04-14 11:29   ` Paulo Zanoni
2015-04-14 17:36     ` Todd Previte
2015-04-14 19:00       ` Paulo Zanoni
2015-04-15  2:00         ` Todd Previte
2015-04-10 16:12 ` [PATCH 08/11] drm/i915: Support EDID compliance tests with the intel_dp_autotest_edid() function Todd Previte
2015-04-10 17:42   ` [PATCH 08/13] " Todd Previte
2015-04-14 13:35     ` Paulo Zanoni
2015-04-14 17:42       ` Todd Previte [this message]
2015-04-10 16:12 ` [PATCH 09/11] drm/i915: Fix for DP CTS test 4.2.2.5 - I2C DEFER handling Todd Previte
2015-04-10 17:41   ` [PATCH 09/13] drm: " Todd Previte
2015-04-10 16:12 ` [PATCH 10/11] drm/i915: Add debugfs test control files for Displayport compliance testing Todd Previte
2015-04-10 16:12 ` [PATCH 11/11] drm: Fix the 'native defer' message in drm_dp_i2c_do_msg() Todd Previte
2015-04-10 16:18   ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=552D5177.8050409@gmail.com \
    --to=tprevite@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=przanoni@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox