All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH] drm/i915: fixup fb bpp computation in pipe_config_set_bpp
Date: Thu, 28 Mar 2013 16:38:08 +0100	[thread overview]
Message-ID: <1364485088-12684-1-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20130328151303.GO4469@intel.com>

Ville pointed out that my assumption that no unsupported pixel format
can get past the pipe config computation stage to the platform
update_plane callbacks is wrong. The reason is that this function
still checks the old fb->depth value instead of the new pixel_format.

While checking with all the other places that use this I've noticed
that intel_framebuffer_init already has all the platform checks we
need, so replace those checks with a WARN_ON.

Since fb->depth isn't set for YUV pixel formats and since we already
can't create an fb with an rgb layout not support on the running
platform I /think/ this patch doesn't fix any bug.

But it surely looks better!

v2: BGR formats are also only gen4+, so add the corresponding WARN_ON,
too (Ville).

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_display.c |   31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3f3a3dc..5e8b91f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7394,23 +7394,34 @@ pipe_config_set_bpp(struct drm_crtc *crtc,
 	struct drm_connector *connector;
 	int bpp;
 
-	switch (fb->depth) {
-	case 8:
+	switch (fb->pixel_format) {
+	case DRM_FORMAT_C8:
 		bpp = 8*3; /* since we go through a colormap */
 		break;
-	case 15:
-	case 16:
+	case DRM_FORMAT_XRGB1555:
+	case DRM_FORMAT_ARGB1555:
+		/* checked in intel_framebuffer_init already */
+		if (WARN_ON(INTEL_INFO(dev)->gen > 3))
+			return -EINVAL;
+	case DRM_FORMAT_RGB565:
 		bpp = 6*3; /* min is 18bpp */
 		break;
-	case 24:
+	case DRM_FORMAT_XBGR8888:
+	case DRM_FORMAT_ABGR8888:
+		/* checked in intel_framebuffer_init already */
+		if (WARN_ON(INTEL_INFO(dev)->gen < 4))
+			return -EINVAL;
+	case DRM_FORMAT_XRGB8888:
+	case DRM_FORMAT_ARGB8888:
 		bpp = 8*3;
 		break;
-	case 30:
-		if (INTEL_INFO(dev)->gen < 4) {
-			DRM_DEBUG_KMS("10 bpc not supported on gen2/3\n");
+	case DRM_FORMAT_XRGB2101010:
+	case DRM_FORMAT_ARGB2101010:
+	case DRM_FORMAT_XBGR2101010:
+	case DRM_FORMAT_ABGR2101010:
+		/* checked in intel_framebuffer_init already */
+		if (WARN_ON(INTEL_INFO(dev)->gen < 4))
 			return -EINVAL;
-		}
-
 		bpp = 10*3;
 		break;
 	/* TODO: gen4+ supports 16 bpc floating point, too. */
-- 
1.7.10.4

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

  parent reply	other threads:[~2013-03-28 15:35 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26 23:44 [PATCH 00/13] pipe_config basic infrastructure Daniel Vetter
2013-03-26 23:44 ` [PATCH 01/13] drm/i915: introduce struct intel_crtc_config Daniel Vetter
2013-03-27 16:43   ` Jesse Barnes
2013-03-26 23:44 ` [PATCH 02/13] drm/i915: compute pipe_config earlier Daniel Vetter
2013-03-27 16:45   ` Jesse Barnes
2013-03-26 23:44 ` [PATCH 03/13] drm/i915: add pipe_config->timings_set Daniel Vetter
2013-03-27 16:49   ` Jesse Barnes
2013-03-27 16:59     ` Daniel Vetter
2013-03-27 17:00     ` Daniel Vetter
2013-03-27 16:59   ` Jesse Barnes
2013-03-27 17:06     ` Daniel Vetter
2013-03-27 17:15       ` Jesse Barnes
2013-03-26 23:44 ` [PATCH 04/13] drm/i915: add pipe_config->pixel_multiplier Daniel Vetter
2013-03-27 16:54   ` Jesse Barnes
2013-03-27 17:03     ` Daniel Vetter
2013-03-26 23:44 ` [PATCH 05/13] drm/i915: drop helper vtable for sdvo encoder Daniel Vetter
2013-03-27 16:55   ` Jesse Barnes
2013-03-26 23:44 ` [PATCH 06/13] drm/i915: add pipe_config->has_pch_encoder Daniel Vetter
2013-03-27 17:06   ` Jesse Barnes
2013-03-27 17:11     ` Daniel Vetter
2013-03-26 23:44 ` [PATCH 07/13] drm/i915: add pipe_config->limited_color_range Daniel Vetter
2013-03-27 17:09   ` Jesse Barnes
2013-03-26 23:44 ` [PATCH 08/13] drm/i915: introduce pipe_config->dither|pipe_bpp Daniel Vetter
2013-03-27 17:11   ` Jesse Barnes
2013-03-26 23:44 ` [PATCH 09/13] drm/i915: precompute pipe bpp before touching the hw Daniel Vetter
2013-03-27 17:24   ` Jesse Barnes
2013-03-27 18:58     ` Daniel Vetter
2013-03-26 23:44 ` [PATCH 10/13] drm/i915: convert DP autodither code to new infrastructure Daniel Vetter
2013-03-27 21:13   ` Jesse Barnes
2013-03-26 23:45 ` [PATCH 11/13] drm/i915: clean up plane bpp confusion Daniel Vetter
2013-03-27 21:15   ` Jesse Barnes
2013-03-28 11:26   ` Ville Syrjälä
2013-03-28 11:46     ` Daniel Vetter
2013-03-28 11:59       ` Ville Syrjälä
2013-03-28 12:49         ` [PATCH 1/2] drm/i915: check fb->pixel_format instead of bits_per_pixel Daniel Vetter
2013-03-28 12:49           ` [PATCH 2/2] drm/i915: fixup fb bpp computation in pipe_config_set_bpp Daniel Vetter
2013-03-28 15:13             ` Ville Syrjälä
2013-03-28 15:36               ` [PATCH] drm/i915: remove "inline" keyword from ironlake_disable_display_irq Daniel Vetter
2013-03-28 15:38               ` Daniel Vetter [this message]
2013-03-28 15:45                 ` [PATCH] drm/i915: fixup fb bpp computation in pipe_config_set_bpp Ville Syrjälä
2013-03-28 15:55                   ` Daniel Vetter
2013-03-28 14:42           ` [PATCH 1/2] drm/i915: check fb->pixel_format instead of bits_per_pixel Ville Syrjälä
2013-03-28 15:01             ` [PATCH] " Daniel Vetter
2013-03-28 15:16               ` Ville Syrjälä
2013-03-28 12:51         ` [PATCH 11/13] drm/i915: clean up plane bpp confusion Daniel Vetter
2013-03-26 23:45 ` [PATCH 12/13] drm/i915: clean up pipe " Daniel Vetter
2013-03-27 21:28   ` Jesse Barnes
2013-03-27 22:41     ` Daniel Vetter
2013-03-27 23:13       ` Jesse Barnes
2013-03-27 23:50         ` Daniel Vetter
2013-03-26 23:45 ` [PATCH 13/13] drm/i915: clear up the fdi/dp set_m_n confusion Daniel Vetter
2013-03-27  0:14   ` Daniel Vetter

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=1364485088-12684-1-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.