dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [REBASE 5/7] drm/edid: avoid drm_edid_find_extension() internally
Date: Tue, 16 Apr 2024 15:24:34 +0300	[thread overview]
Message-ID: <87jzkxze9p.fsf@intel.com> (raw)
In-Reply-To: <fb57c317-25ec-4001-abb4-cb52b0aff741@suse.de>

On Tue, 16 Apr 2024, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Hi
>
> Am 16.04.24 um 11:19 schrieb Jani Nikula:
>> Prefer the EDID iterators over drm_edid_find_extension() in
>> drm_edid_has_cta_extension(), even if this leads to more code. The key
>> is to use the same patterns as much as possible.
>
> Should this patch go before patch 4? That would limit the impact of the 
> latter.

I can if you want, IMO not a big deal.

> Why is this instance different than the one in 
> drm_find_displayid_extension()? Best regards Thomas

Overall I'd like to get rid of the function altogether, but I'm
undecided what the replacement interface towards drm_displayid.c should
be. Maybe expose the drm_edid_iter_* stuff? But I really don't want
anyone to export and start using them in drivers.

BR,
Jani.

>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>   drivers/gpu/drm/drm_edid.c | 14 ++++++++++++--
>>   1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index c29f31dcc818..4b3ad42a8f95 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -4230,11 +4230,21 @@ static bool drm_edid_has_cta_extension(const struct drm_edid *drm_edid)
>>   {
>>   	const struct displayid_block *block;
>>   	struct displayid_iter iter;
>> -	int ext_index = 0;
>> +	struct drm_edid_iter edid_iter;
>> +	const u8 *ext;
>>   	bool found = false;
>>   
>>   	/* Look for a top level CEA extension block */
>> -	if (drm_edid_find_extension(drm_edid, CEA_EXT, &ext_index))
>> +	drm_edid_iter_begin(drm_edid, &edid_iter);
>> +	drm_edid_iter_for_each(ext, &edid_iter) {
>> +		if (ext[0] == CEA_EXT) {
>> +			found = true;
>> +			break;
>> +		}
>> +	}
>> +	drm_edid_iter_end(&edid_iter);
>> +
>> +	if (found)
>>   		return true;
>>   
>>   	/* CEA blocks can also be found embedded in a DisplayID block */

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-04-16 12:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  9:19 [REBASE 0/7] drm/edid: cleanups, rebase Jani Nikula
2024-04-16  9:19 ` [REBASE 1/7] drm/displayid: move drm_displayid.h to drm_displayd_internal.h Jani Nikula
2024-04-16  9:19 ` [REBASE 2/7] drm/edid: move all internal declarations to drm_crtc_internal.h Jani Nikula
2024-04-16  9:19 ` [REBASE 3/7] drm/edid: group struct drm_edid based declarations together Jani Nikula
2024-04-16  9:19 ` [REBASE 4/7] drm/edid: rename drm_find_edid_extension() to drm_edid_find_extension() Jani Nikula
2024-04-16  9:19 ` [REBASE 5/7] drm/edid: avoid drm_edid_find_extension() internally Jani Nikula
2024-04-16 12:19   ` Thomas Zimmermann
2024-04-16 12:24     ` Jani Nikula [this message]
2024-04-16  9:19 ` [REBASE 6/7] drm/edid: make drm_edid_are_equal() static Jani Nikula
2024-04-16  9:20 ` [REBASE 7/7] drm/edid: make drm_edid_are_equal() more convenient for its single user Jani Nikula
2024-04-16 12:21   ` Thomas Zimmermann
2024-04-16 12:27     ` Jani Nikula
2024-04-16 12:47       ` Thomas Zimmermann
2024-04-17  8:21         ` Jani Nikula
2024-04-17 11:13           ` Thomas Zimmermann
2024-04-17 15:20             ` Jani Nikula

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=87jzkxze9p.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=tzimmermann@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).