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: [PATCH 07/15] drm/edid: split drm_edid block count helper
Date: Wed, 19 Oct 2022 22:44:50 +0300 [thread overview]
Message-ID: <Y1BTst482oWCWuaj@intel.com> (raw)
In-Reply-To: <d573b83a4a55f3da6949b2e89c001a74d1932d96.1665496046.git.jani.nikula@intel.com>
On Tue, Oct 11, 2022 at 04:49:41PM +0300, Jani Nikula wrote:
> Split the drm_edid block count helper to a base version that reports the
> block count indicated by EDID contents, and another on top that limits
> the block count based on size allocated for the EDID.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/drm_edid.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 8baa46dc2537..616c1cdc7507 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1613,7 +1613,8 @@ static const void *edid_extension_block_data(const struct edid *edid, int index)
> return edid_block_data(edid, index + 1);
> }
>
> -static int drm_edid_block_count(const struct drm_edid *drm_edid)
> +/* EDID block count indicated in EDID, may exceed allocated size */
> +static int __drm_edid_block_count(const struct drm_edid *drm_edid)
> {
> int num_blocks;
>
> @@ -1633,12 +1634,18 @@ static int drm_edid_block_count(const struct drm_edid *drm_edid)
> num_blocks = eeodb;
> }
>
> - /* Limit by allocated size */
> - num_blocks = min(num_blocks, (int)drm_edid->size / EDID_LENGTH);
> -
> return num_blocks;
> }
>
> +/* EDID block count, limited by allocated size */
> +static int drm_edid_block_count(const struct drm_edid *drm_edid)
> +{
> + /* Limit by allocated size */
> + return min(__drm_edid_block_count(drm_edid),
> + (int)drm_edid->size / EDID_LENGTH);
> +}
> +
> +/* EDID extension block count, limited by allocated size */
> static int drm_edid_extension_block_count(const struct drm_edid *drm_edid)
> {
> return drm_edid_block_count(drm_edid) - 1;
> --
> 2.34.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2022-10-19 19:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 13:49 [PATCH 00/15] drm/edid: EDID override refactoring and fixes Jani Nikula
2022-10-11 13:49 ` [PATCH 01/15] drm/i915/hdmi: do dual mode detect only if connected Jani Nikula
2022-10-13 18:41 ` Ville Syrjälä
2022-10-13 19:24 ` Ville Syrjälä
2022-10-14 8:14 ` Jani Nikula
2022-10-19 18:56 ` Ville Syrjälä
2022-10-19 19:23 ` [Intel-gfx] " Ville Syrjälä
2022-10-20 8:57 ` Jani Nikula
2022-10-20 9:25 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 02/15] drm/i915/hdmi: stop using connector->override_edid Jani Nikula
2022-10-19 19:36 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 03/15] drm/amd/display: " Jani Nikula
2022-10-11 14:07 ` Harry Wentland
2022-10-11 14:11 ` Jani Nikula
2022-10-11 14:19 ` Alex Deucher
2022-10-11 13:49 ` [PATCH 04/15] drm/edid: debug log EDID override set/reset Jani Nikula
2022-10-19 19:36 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 05/15] drm/edid: abstract debugfs override EDID show better Jani Nikula
2022-10-19 19:37 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 06/15] drm/edid: rename drm_add_override_edid_modes() to drm_edid_override_connector_update() Jani Nikula
2022-10-19 20:04 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 07/15] drm/edid: split drm_edid block count helper Jani Nikula
2022-10-19 19:44 ` Ville Syrjälä [this message]
2022-10-11 13:49 ` [PATCH 08/15] drm/edid: add function for checking drm_edid validity Jani Nikula
2022-10-19 19:46 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 09/15] drm/edid: detach debugfs EDID override from EDID property update Jani Nikula
2022-10-19 20:07 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 10/15] drm/edid/firmware: drop redundant connector_name variable/parameter Jani Nikula
2022-10-19 19:52 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 11/15] drm/edid/firmware: rename drm_load_edid_firmware() to drm_edid_load_firmware() Jani Nikula
2022-10-19 20:07 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 12/15] drm/edid: use struct drm_edid for override/firmware EDID Jani Nikula
2022-10-19 20:01 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 13/15] drm/edid: move edid load declarations to internal header Jani Nikula
2022-10-19 20:08 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 14/15] drm/edid/firmware: convert to drm device specific logging Jani Nikula
2022-10-19 20:10 ` Ville Syrjälä
2022-10-11 13:49 ` [PATCH 15/15] drm/edid: convert to " Jani Nikula
2022-10-19 20:12 ` 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=Y1BTst482oWCWuaj@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