All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Hans Verkuil <hansverk@cisco.com>,
	Manasi Navare <manasi.d.navare@intel.com>,
	intel-gfx@lists.freedesktop.org,
	Thomas Anderson <thomasanderson@google.com>
Subject: [PATCH v4 4/4] drm/edid: Make sure the CEA mode arrays have the correct amount of modes
Date: Fri, 13 Dec 2019 19:43:48 +0200	[thread overview]
Message-ID: <20191213174348.27261-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20191213174348.27261-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We depend on a specific relationship between the VIC number and the
index in the CEA mode arrays. Assert that the arrays have the expected
size to make sure we've not accidentally left holes in them.

v2: Pimp the BUILD_BUG_ON()s
v3: Fix typos (Manasi)

Cc: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Reviewed-by: Thomas Anderson <thomasanderson@google.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_edid.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 8bc69da53c2e..ec5b88120428 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3213,6 +3213,9 @@ static u8 *drm_find_cea_extension(const struct edid *edid)
 
 static const struct drm_display_mode *cea_mode_for_vic(u8 vic)
 {
+	BUILD_BUG_ON(1 + ARRAY_SIZE(edid_cea_modes_1) - 1 != 127);
+	BUILD_BUG_ON(193 + ARRAY_SIZE(edid_cea_modes_193) - 1 != 219);
+
 	if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1))
 		return &edid_cea_modes_1[vic - 1];
 	if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193))
-- 
2.23.0

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

WARNING: multiple messages have this Message-ID (diff)
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Hans Verkuil <hansverk@cisco.com>,
	intel-gfx@lists.freedesktop.org,
	Thomas Anderson <thomasanderson@google.com>
Subject: [Intel-gfx] [PATCH v4 4/4] drm/edid: Make sure the CEA mode arrays have the correct amount of modes
Date: Fri, 13 Dec 2019 19:43:48 +0200	[thread overview]
Message-ID: <20191213174348.27261-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20191213174348.27261-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We depend on a specific relationship between the VIC number and the
index in the CEA mode arrays. Assert that the arrays have the expected
size to make sure we've not accidentally left holes in them.

v2: Pimp the BUILD_BUG_ON()s
v3: Fix typos (Manasi)

Cc: Hans Verkuil <hansverk@cisco.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Reviewed-by: Thomas Anderson <thomasanderson@google.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_edid.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 8bc69da53c2e..ec5b88120428 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3213,6 +3213,9 @@ static u8 *drm_find_cea_extension(const struct edid *edid)
 
 static const struct drm_display_mode *cea_mode_for_vic(u8 vic)
 {
+	BUILD_BUG_ON(1 + ARRAY_SIZE(edid_cea_modes_1) - 1 != 127);
+	BUILD_BUG_ON(193 + ARRAY_SIZE(edid_cea_modes_193) - 1 != 219);
+
 	if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1))
 		return &edid_cea_modes_1[vic - 1];
 	if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193))
-- 
2.23.0

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

  parent reply	other threads:[~2019-12-13 20:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13 17:43 [PATCH v4 0/4] drm/edid: Add new modes from CTA-861-G Ville Syrjala
2019-12-13 17:43 ` [Intel-gfx] " Ville Syrjala
2019-12-13 17:43 ` [PATCH v4 1/4] drm/edid: Abstract away cea_edid_modes[] Ville Syrjala
2019-12-13 17:43   ` [Intel-gfx] " Ville Syrjala
2019-12-13 21:03   ` Tom Anderson
2019-12-13 21:03     ` [Intel-gfx] " Tom Anderson
2019-12-16 15:23     ` Ville Syrjälä
2019-12-16 15:23       ` [Intel-gfx] " Ville Syrjälä
2019-12-13 17:43 ` [PATCH v4 2/4] drm/edid: Add CTA-861-G modes with VIC >= 193 Ville Syrjala
2019-12-13 17:43   ` [Intel-gfx] " Ville Syrjala
2019-12-13 17:43 ` [PATCH v4 3/4] drm/edid: Throw away the dummy VIC 0 cea mode Ville Syrjala
2019-12-13 17:43   ` [Intel-gfx] " Ville Syrjala
2019-12-13 21:05   ` Tom Anderson
2019-12-13 21:05     ` [Intel-gfx] " Tom Anderson
2019-12-13 17:43 ` Ville Syrjala [this message]
2019-12-13 17:43   ` [Intel-gfx] [PATCH v4 4/4] drm/edid: Make sure the CEA mode arrays have the correct amount of modes Ville Syrjala
2019-12-14  0:29 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: Add new modes from CTA-861-G (rev3) Patchwork
2019-12-14  1:04 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2019-12-15  0:13 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

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=20191213174348.27261-5-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hansverk@cisco.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=manasi.d.navare@intel.com \
    --cc=thomasanderson@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.