Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [RFC 03/19] drm/edid: clean up CEA data block tag definitions
Date: Wed, 23 Mar 2022 17:33:18 +0200	[thread overview]
Message-ID: <Yjs9vvhrIhQDbChJ@intel.com> (raw)
In-Reply-To: <657900c5a984a0bd7a830686cb5f919ae16912f8.1647985054.git.jani.nikula@intel.com>

On Tue, Mar 22, 2022 at 11:40:32PM +0200, Jani Nikula wrote:
> Add prefixed names, group, sort, add references.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 59 +++++++++++++++++++++-----------------
>  1 file changed, 32 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index b96906774433..6c188539493e 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3329,15 +3329,20 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,
>  	return closure.modes;
>  }
>  
> -#define AUDIO_BLOCK	0x01
> -#define VIDEO_BLOCK     0x02
> -#define VENDOR_BLOCK    0x03
> -#define SPEAKER_BLOCK	0x04
> -#define HDR_STATIC_METADATA_BLOCK	0x6
> -#define USE_EXTENDED_TAG 0x07
> -#define EXT_VIDEO_CAPABILITY_BLOCK 0x00
> -#define EXT_VIDEO_DATA_BLOCK_420	0x0E
> -#define EXT_VIDEO_CAP_BLOCK_Y420CMDB 0x0F
> +/* CEA-861-F Table 44 CEA Data Block Tag Codes */

Table 55 in CTA-861-G, if we want to use a more recent reference.
Though IIRC someone did say CTA-861-H might already be out as well.

> +#define CEA_DB_AUDIO			1
> +#define CEA_DB_VIDEO			2
> +#define CEA_DB_VENDOR			3
> +#define CEA_DB_SPEAKER			4
> +#define CEA_DB_EXTENDED_TAG		7
> +
> +/* CEA-861-F Table 46 CEA Data Block Tag Codes */

Table 57 in CTA-861-G.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +#define CEA_EXT_DB_VIDEO_CAP		0
> +#define CEA_EXT_DB_VENDOR		1
> +#define CEA_EXT_DB_HDR_STATIC_METADATA	6 /* CEA-861.3 2005 */
> +#define CEA_EXT_DB_420_VIDEO_DATA	14
> +#define CEA_EXT_DB_420_VIDEO_CAP_MAP	15
> +
>  #define EDID_BASIC_AUDIO	(1 << 6)
>  #define EDID_CEA_YCRCB444	(1 << 5)
>  #define EDID_CEA_YCRCB422	(1 << 4)
> @@ -4220,7 +4225,7 @@ cea_db_offsets(const u8 *cea, int *start, int *end)
>  
>  static bool cea_db_is_hdmi_vsdb(const u8 *db)
>  {
> -	if (cea_db_tag(db) != VENDOR_BLOCK)
> +	if (cea_db_tag(db) != CEA_DB_VENDOR)
>  		return false;
>  
>  	if (cea_db_payload_len(db) < 5)
> @@ -4231,7 +4236,7 @@ static bool cea_db_is_hdmi_vsdb(const u8 *db)
>  
>  static bool cea_db_is_hdmi_forum_vsdb(const u8 *db)
>  {
> -	if (cea_db_tag(db) != VENDOR_BLOCK)
> +	if (cea_db_tag(db) != CEA_DB_VENDOR)
>  		return false;
>  
>  	if (cea_db_payload_len(db) < 7)
> @@ -4242,7 +4247,7 @@ static bool cea_db_is_hdmi_forum_vsdb(const u8 *db)
>  
>  static bool cea_db_is_microsoft_vsdb(const u8 *db)
>  {
> -	if (cea_db_tag(db) != VENDOR_BLOCK)
> +	if (cea_db_tag(db) != CEA_DB_VENDOR)
>  		return false;
>  
>  	if (cea_db_payload_len(db) != 21)
> @@ -4253,13 +4258,13 @@ static bool cea_db_is_microsoft_vsdb(const u8 *db)
>  
>  static bool cea_db_is_vcdb(const u8 *db)
>  {
> -	if (cea_db_tag(db) != USE_EXTENDED_TAG)
> +	if (cea_db_tag(db) != CEA_DB_EXTENDED_TAG)
>  		return false;
>  
>  	if (cea_db_payload_len(db) != 2)
>  		return false;
>  
> -	if (cea_db_extended_tag(db) != EXT_VIDEO_CAPABILITY_BLOCK)
> +	if (cea_db_extended_tag(db) != CEA_EXT_DB_VIDEO_CAP)
>  		return false;
>  
>  	return true;
> @@ -4267,13 +4272,13 @@ static bool cea_db_is_vcdb(const u8 *db)
>  
>  static bool cea_db_is_y420cmdb(const u8 *db)
>  {
> -	if (cea_db_tag(db) != USE_EXTENDED_TAG)
> +	if (cea_db_tag(db) != CEA_DB_EXTENDED_TAG)
>  		return false;
>  
>  	if (!cea_db_payload_len(db))
>  		return false;
>  
> -	if (cea_db_extended_tag(db) != EXT_VIDEO_CAP_BLOCK_Y420CMDB)
> +	if (cea_db_extended_tag(db) != CEA_EXT_DB_420_VIDEO_CAP_MAP)
>  		return false;
>  
>  	return true;
> @@ -4281,13 +4286,13 @@ static bool cea_db_is_y420cmdb(const u8 *db)
>  
>  static bool cea_db_is_y420vdb(const u8 *db)
>  {
> -	if (cea_db_tag(db) != USE_EXTENDED_TAG)
> +	if (cea_db_tag(db) != CEA_DB_EXTENDED_TAG)
>  		return false;
>  
>  	if (!cea_db_payload_len(db))
>  		return false;
>  
> -	if (cea_db_extended_tag(db) != EXT_VIDEO_DATA_BLOCK_420)
> +	if (cea_db_extended_tag(db) != CEA_EXT_DB_420_VIDEO_DATA)
>  		return false;
>  
>  	return true;
> @@ -4354,7 +4359,7 @@ add_cea_modes(struct drm_connector *connector, struct edid *edid)
>  			db = &cea[i];
>  			dbl = cea_db_payload_len(db);
>  
> -			if (cea_db_tag(db) == VIDEO_BLOCK) {
> +			if (cea_db_tag(db) == CEA_DB_VIDEO) {
>  				video = db + 1;
>  				video_len = dbl;
>  				modes += do_cea_modes(connector, video, dbl);
> @@ -4428,10 +4433,10 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)
>  
>  static bool cea_db_is_hdmi_hdr_metadata_block(const u8 *db)
>  {
> -	if (cea_db_tag(db) != USE_EXTENDED_TAG)
> +	if (cea_db_tag(db) != CEA_DB_EXTENDED_TAG)
>  		return false;
>  
> -	if (db[1] != HDR_STATIC_METADATA_BLOCK)
> +	if (db[1] != CEA_EXT_DB_HDR_STATIC_METADATA)
>  		return false;
>  
>  	if (cea_db_payload_len(db) < 3)
> @@ -4622,7 +4627,7 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
>  			dbl = cea_db_payload_len(db);
>  
>  			switch (cea_db_tag(db)) {
> -			case AUDIO_BLOCK:
> +			case CEA_DB_AUDIO:
>  				/* Audio Data Block, contains SADs */
>  				sad_count = min(dbl / 3, 15 - total_sad_count);
>  				if (sad_count >= 1)
> @@ -4630,12 +4635,12 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
>  					       &db[1], sad_count * 3);
>  				total_sad_count += sad_count;
>  				break;
> -			case SPEAKER_BLOCK:
> +			case CEA_DB_SPEAKER:
>  				/* Speaker Allocation Data Block */
>  				if (dbl >= 1)
>  					eld[DRM_ELD_SPEAKER] = db[1];
>  				break;
> -			case VENDOR_BLOCK:
> +			case CEA_DB_VENDOR:
>  				/* HDMI Vendor-Specific Data Block */
>  				if (cea_db_is_hdmi_vsdb(db))
>  					drm_parse_hdmi_vsdb_audio(connector, db);
> @@ -4696,7 +4701,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads)
>  	for_each_cea_db(cea, i, start, end) {
>  		const u8 *db = &cea[i];
>  
> -		if (cea_db_tag(db) == AUDIO_BLOCK) {
> +		if (cea_db_tag(db) == CEA_DB_AUDIO) {
>  			int j;
>  
>  			dbl = cea_db_payload_len(db);
> @@ -4758,7 +4763,7 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb)
>  	for_each_cea_db(cea, i, start, end) {
>  		const u8 *db = &cea[i];
>  
> -		if (cea_db_tag(db) == SPEAKER_BLOCK) {
> +		if (cea_db_tag(db) == CEA_DB_SPEAKER) {
>  			dbl = cea_db_payload_len(db);
>  
>  			/* Speaker Allocation Data Block */
> @@ -4888,7 +4893,7 @@ bool drm_detect_monitor_audio(struct edid *edid)
>  		goto end;
>  
>  	for_each_cea_db(edid_ext, i, start_offset, end_offset) {
> -		if (cea_db_tag(&edid_ext[i]) == AUDIO_BLOCK) {
> +		if (cea_db_tag(&edid_ext[i]) == CEA_DB_AUDIO) {
>  			has_audio = true;
>  			for (j = 1; j < cea_db_payload_len(&edid_ext[i]) + 1; j += 3)
>  				DRM_DEBUG_KMS("CEA audio format %d\n",
> -- 
> 2.30.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2022-03-23 15:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 21:40 [Intel-gfx] [RFC 00/19] drm/edid: overhaul CEA data block iteration Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 01/19] drm/edid: add drm_edid_extension_block_count() and drm_edid_size() Jani Nikula
2022-03-23 15:21   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 02/19] drm: use " Jani Nikula
2022-03-23 15:24   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 03/19] drm/edid: clean up CEA data block tag definitions Jani Nikula
2022-03-23 15:33   ` Ville Syrjälä [this message]
2022-03-22 21:40 ` [Intel-gfx] [RFC 04/19] drm/edid: add iterator for EDID base and extension blocks Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 05/19] drm/edid: add iterator for CEA data blocks Jani Nikula
2022-03-23 16:05   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 06/19] drm/edid: clean up cea_db_is_*() functions Jani Nikula
2022-03-23 15:43   ` Ville Syrjälä
2022-03-23 17:26     ` Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 07/19] drm/edid: convert add_cea_modes() to use cea db iter Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 08/19] drm/edid: convert drm_edid_to_speaker_allocation() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 09/19] drm/edid: convert drm_edid_to_sad() " Jani Nikula
2022-03-23 16:18   ` Ville Syrjälä
2022-03-22 21:40 ` [Intel-gfx] [RFC 10/19] drm/edid: convert drm_detect_hdmi_monitor() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 11/19] drm/edid: convert drm_detect_monitor_audio() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 12/19] drm/edid: convert drm_parse_cea_ext() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 13/19] drm/edid: convert drm_edid_to_eld() " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 14/19] drm/edid: sunset the old unused cea data block iterators Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 15/19] drm/edid: restore some type safety to cea_db_*() functions Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 16/19] drm/edid: detect basic audio only on CEA extension Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 17/19] drm/edid: detect color formats and CEA revision " Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 18/19] drm/edid: skip CEA extension scan in drm_edid_to_eld() just for CEA rev Jani Nikula
2022-03-22 21:40 ` [Intel-gfx] [RFC 19/19] drm/edid: sunset drm_find_cea_extension() Jani Nikula
2022-03-23 16:36   ` Ville Syrjälä
2022-03-22 22:07 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: overhaul CEA data block iteration Patchwork
2022-03-22 22:09 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-03-22 22:13 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-03-22 22:37 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-23  7:06 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-03-23 16:38 ` [Intel-gfx] [RFC 00/19] " Ville Syrjälä

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=Yjs9vvhrIhQDbChJ@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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