dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Sharma, Shashank" <shashank.sharma@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 06/20] drm: add helper to validate YCBCR420 modes
Date: Thu, 13 Jul 2017 11:02:18 +0530	[thread overview]
Message-ID: <d91ce91e-c873-bc0e-2696-ce9263502f8d@intel.com> (raw)
In-Reply-To: <20170712171801.GO12629@intel.com>

Regards

Shashank


On 7/12/2017 10:48 PM, Ville Syrjälä wrote:
> On Mon, Jul 10, 2017 at 04:48:34PM +0530, Shashank Sharma wrote:
>> YCBCR420 modes are supported only on HDMI 2.0 capable sources.
>> This patch adds:
>> - A drm helper to validate YCBCR420-only mode on a particular
>>    connector. This function will help pruning the YCBCR420-only
>>    modes from the connector's modelist.
>> - A bool variable (ycbcr_420_allowed) in the drm connector structure.
>>    While handling the EDID from HDMI 2.0 sinks, its important to know
>>    if the source is capable of handling YCBCR420 output, so that no
>>    YCBCR 420 modes will be listed for sources which can't handle it.
>>    A driver should set this variable if it wants to see YCBCR420 modes
>>    in the modedb.
>>
>> V5: Introduced the patch in series.
>> V5-resend: Squashed two patches (validate YCBCR420 and add YCBCR420
>> 	   identifier)
>>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>   drivers/gpu/drm/drm_edid.c         |  3 ++-
>>   drivers/gpu/drm/drm_modes.c        | 28 ++++++++++++++++++++++++++++
>>   drivers/gpu/drm/drm_probe_helper.c |  4 ++++
>>   include/drm/drm_connector.h        |  9 +++++++++
>>   include/drm/drm_edid.h             |  1 +
>>   include/drm/drm_modes.h            |  5 +++++
>>   6 files changed, 49 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index 10dab62..44be128 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -2950,10 +2950,11 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
>>   }
>>   EXPORT_SYMBOL(drm_match_cea_mode);
>>   
>> -static bool drm_valid_cea_vic(u8 vic)
>> +bool drm_valid_cea_vic(u8 vic)
>>   {
>>   	return vic > 0 && vic < ARRAY_SIZE(edid_cea_modes);
>>   }
>> +EXPORT_SYMBOL(drm_valid_cea_vic);
>>   
>>   /**
>>    * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>> index f2493b9..3b53c8e3 100644
>> --- a/drivers/gpu/drm/drm_modes.c
>> +++ b/drivers/gpu/drm/drm_modes.c
>> @@ -1083,6 +1083,34 @@ drm_mode_validate_size(const struct drm_display_mode *mode,
>>   }
>>   EXPORT_SYMBOL(drm_mode_validate_size);
>>   
>> +/**
>> + * drm_mode_ycbcr420_only - add 'ycbcr420-only' modes only when allowed
>> + * @mode: mode to check
>> + * @connector: drm connector under action
>> + *
>> + * This function is a helper which can be used to filter out any YCBCR420
>> + * only mode, when the source doesn't support it.
>> + *
>> + * Returns:
>> + * The mode status
>> + */
>> +enum drm_mode_status
>> +drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
>> +			   struct drm_connector *connector)
>> +{
>> +	u8 vic = drm_match_cea_mode(mode);
>> +	enum drm_mode_status status = MODE_OK;
>> +	struct drm_hdmi_info *hdmi = &connector->display_info.hdmi;
>> +
>> +	if (drm_valid_cea_vic(vic) && test_bit(vic, hdmi->y420_vdb_modes)) {
> Still think the valid check is pointless.
I still think that we should only pass valid CEA VIC to VDB check, but 
Ok, I will remove that.
>   Skipping that would also avoid
> having to make the function non-static
Ok
> (the EXPORT_SYMBOL there seems
> unnecessary either way).
Why ?
>
>> +		if (!connector->ycbcr_420_allowed)
>> +			status = MODE_NO_420;
>> +	}
>> +
>> +	return status;
>> +}
>> +EXPORT_SYMBOL(drm_mode_validate_ycbcr420);
>> +
>>   #define MODE_STATUS(status) [MODE_ ## status + 3] = #status
>>   
>>   static const char * const drm_mode_status_names[] = {
> ^
> This thing needs to be updated as well.
Oh sorry, good catch.
- Shashank
>> diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
>> index 00e6832..904966c 100644
>> --- a/drivers/gpu/drm/drm_probe_helper.c
>> +++ b/drivers/gpu/drm/drm_probe_helper.c
>> @@ -528,6 +528,10 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>>   		if (mode->status == MODE_OK)
>>   			mode->status = drm_mode_validate_pipeline(mode,
>>   								  connector);
>> +
>> +		if (mode->status == MODE_OK)
>> +			mode->status = drm_mode_validate_ycbcr420(mode,
>> +								  connector);
>>   	}
>>   
>>   prune:
>> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
>> index b3af8e3..225e092 100644
>> --- a/include/drm/drm_connector.h
>> +++ b/include/drm/drm_connector.h
>> @@ -746,6 +746,15 @@ struct drm_connector {
>>   	bool interlace_allowed;
>>   	bool doublescan_allowed;
>>   	bool stereo_allowed;
>> +
>> +	/**
>> +	 * @ycbcr_420_allowed : This bool indicates if this connector is
>> +	 * capable of handling YCBCR 420 output. While parsing the EDID
>> +	 * blocks, its very helpful to know, if the source is capable of
>> +	 * handling YCBCR 420 outputs.
>> +	 */
>> +	bool ycbcr_420_allowed;
>> +
>>   	/**
>>   	 * @registered: Is this connector exposed (registered) with userspace?
>>   	 * Protected by @mutex.
>> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
>> index 89c0062..b55b2a7 100644
>> --- a/include/drm/drm_edid.h
>> +++ b/include/drm/drm_edid.h
>> @@ -477,4 +477,5 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name,
>>   struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
>>   					   int hsize, int vsize, int fresh,
>>   					   bool rb);
>> +bool drm_valid_cea_vic(u8 vic);
>>   #endif /* __DRM_EDID_H__ */
>> diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
>> index 94ac771..f8a1268 100644
>> --- a/include/drm/drm_modes.h
>> +++ b/include/drm/drm_modes.h
>> @@ -80,6 +80,7 @@ struct videomode;
>>    * @MODE_ONE_SIZE: only one resolution is supported
>>    * @MODE_NO_REDUCED: monitor doesn't accept reduced blanking
>>    * @MODE_NO_STEREO: stereo modes not supported
>> + * @MODE_NO_420: ycbcr 420 modes not supported
>>    * @MODE_STALE: mode has become stale
>>    * @MODE_BAD: unspecified reason
>>    * @MODE_ERROR: error condition
>> @@ -124,6 +125,7 @@ enum drm_mode_status {
>>   	MODE_ONE_SIZE,
>>   	MODE_NO_REDUCED,
>>   	MODE_NO_STEREO,
>> +	MODE_NO_420,
>>   	MODE_STALE = -3,
>>   	MODE_BAD = -2,
>>   	MODE_ERROR = -1
>> @@ -496,6 +498,9 @@ bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
>>   enum drm_mode_status drm_mode_validate_basic(const struct drm_display_mode *mode);
>>   enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode,
>>   					    int maxX, int maxY);
>> +enum drm_mode_status
>> +drm_mode_validate_ycbcr420(const struct drm_display_mode *mode,
>> +			   struct drm_connector *connector);
>>   void drm_mode_prune_invalid(struct drm_device *dev,
>>   			    struct list_head *mode_list, bool verbose);
>>   void drm_mode_sort(struct list_head *mode_list);
>> -- 
>> 2.7.4
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-07-13  5:32 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 11:18 [PATCH 00/20] YCBCR 4:2:0 handling for LSPCON Shashank Sharma
2017-07-10 11:18 ` [PATCH 01/20] drm: handle HDMI 2.0 VICs in AVI info-frames Shashank Sharma
2017-07-10 11:18 ` [PATCH 02/20] drm/edid: complete CEA modedb(VIC 1-107) Shashank Sharma
2017-07-12 17:18   ` Ville Syrjälä
2017-07-13  5:38     ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 03/20] drm/edid: parse sink information before CEA blocks Shashank Sharma
2017-07-10 11:18 ` [PATCH 04/20] drm/edid: cleanup patch for CEA extended-tag macro Shashank Sharma
2017-07-10 11:18 ` [PATCH 05/20] drm/edid: parse YCBCR420 videomodes from EDID Shashank Sharma
2017-07-10 11:18 ` [PATCH 06/20] drm: add helper to validate YCBCR420 modes Shashank Sharma
2017-07-12 17:18   ` Ville Syrjälä
2017-07-13  5:32     ` Sharma, Shashank [this message]
2017-07-13 12:31       ` Ville Syrjälä
2017-07-13 12:42         ` Sharma, Shashank
2017-07-13 13:00           ` Ville Syrjälä
2017-07-13 13:12             ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 07/20] drm/edid: parse ycbcr 420 deep color information Shashank Sharma
2017-07-12 17:18   ` Ville Syrjälä
2017-07-13  5:33     ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 08/20] drm: set output colorspace in AVI infoframe Shashank Sharma
2017-07-12 17:17   ` Ville Syrjälä
2017-07-13  5:07     ` Sharma, Shashank
2017-07-13 12:35       ` Ville Syrjälä
2017-07-13 12:49         ` Sharma, Shashank
2017-07-13 13:03           ` Ville Syrjälä
2017-07-13 13:15             ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 09/20] drm: add helper functions for YCBCR420 handling Shashank Sharma
2017-07-12 17:17   ` Ville Syrjälä
2017-07-13  5:27     ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 10/20] drm/i915: add config function for YCBCR420 outputs Shashank Sharma
2017-07-12 17:17   ` Ville Syrjälä
2017-07-13  5:26     ` Sharma, Shashank
2017-07-13 12:53       ` Ville Syrjälä
2017-07-13 13:01         ` Sharma, Shashank
2017-07-13 13:26           ` Ville Syrjälä
2017-07-13 13:35             ` Sharma, Shashank
2017-07-13 14:10               ` Ville Syrjälä
2017-07-13 14:17                 ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 11/20] drm/i915: prepare scaler for YCBCR420 modeset Shashank Sharma
2017-07-12 17:17   ` Ville Syrjälä
2017-07-13  5:21     ` Sharma, Shashank
2017-07-13 12:52       ` [Intel-gfx] " Ville Syrjälä
2017-07-13 12:57         ` Sharma, Shashank
2017-07-13 13:05           ` Ville Syrjälä
2017-07-10 11:18 ` [PATCH 12/20] drm/i915: prepare pipe for YCBCR420 output Shashank Sharma
2017-07-10 11:18 ` [PATCH 13/20] drm/i915: prepare csc unit " Shashank Sharma
2017-07-12 17:17   ` Ville Syrjälä
2017-07-13  5:14     ` Sharma, Shashank
2017-07-13 12:50       ` Ville Syrjälä
2017-07-13 12:53         ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 14/20] drm/i915: set colorspace for YCBCR420 outputs Shashank Sharma
2017-07-10 11:18 ` [PATCH 15/20] drm/i915/glk: set HDMI 2.0 identifier Shashank Sharma
2017-07-10 11:18 ` [PATCH 16/20] drm: add function to read vendor OUI Shashank Sharma
2017-07-12 17:15   ` Ville Syrjälä
2017-07-13  5:04     ` Sharma, Shashank
2017-07-13 12:37       ` Ville Syrjälä
2017-07-13 12:50         ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 17/20] drm/i915: check LSPCON " Shashank Sharma
2017-07-10 11:18 ` [PATCH 18/20] drm/i915: YCBCR 420 support for LSPCON Shashank Sharma
2017-07-12 17:15   ` Ville Syrjälä
2017-07-13  5:02     ` Sharma, Shashank
2017-07-13 13:13       ` Ville Syrjälä
2017-07-13 13:17         ` Sharma, Shashank
2017-07-10 11:18 ` [PATCH 19/20] drm/i915: Move AVI infoframe function to DDI layer Shashank Sharma
2017-07-12 17:15   ` Ville Syrjälä
2017-07-13  4:58     ` Sharma, Shashank
2017-07-13 13:10       ` Ville Syrjälä
2017-07-10 11:18 ` [PATCH 20/20] drm/i915: write AVI infoframes for LSPCON Shashank Sharma
2017-07-12 17:24   ` Ville Syrjälä
2017-07-13  5:41     ` Sharma, Shashank
2017-07-13 12:27       ` Ville Syrjälä
2017-07-13 12:39         ` Sharma, Shashank
2017-07-13 12:55           ` Ville Syrjälä
2017-07-13 13:10             ` Sharma, Shashank
2017-07-13 13:19               ` Ville Syrjälä
2017-07-13 13:21                 ` Sharma, Shashank

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=d91ce91e-c873-bc0e-2696-ce9263502f8d@intel.com \
    --to=shashank.sharma@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.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