All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH v4 07/14] drm: tilcdc: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()
Date: Thu,  8 Sep 2016 17:44:21 +0300	[thread overview]
Message-ID: <1473345868-25453-8-git-send-email-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1473345868-25453-1-git-send-email-laurent.pinchart@ideasonboard.com>

The driver needs the number of bytes per pixel, not the bpp and depth
info meant for fbdev compatibility. Use the right API.

In the tilcdc_crtc_mode_set() function compute the hardware register
value directly from the pixel format instead of computing the number of
bits per pixels first.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
Changes since v3:

- Removed DRM_FORMAT_ARGB8888 support
- Fixed coding style
- Renamed min_pitch to pitch
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c  | 15 +++++----------
 drivers/gpu/drm/tilcdc/tilcdc_plane.c |  7 ++++---
 2 files changed, 9 insertions(+), 13 deletions(-)

Cc: Jyri Sarha <jsarha@ti.com>

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 25d6b220ee8a..a64718630cdb 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -67,15 +67,13 @@ static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb)
 	struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
 	struct drm_device *dev = crtc->dev;
 	struct drm_gem_cma_object *gem;
-	unsigned int depth, bpp;
 	dma_addr_t start, end;
 
-	drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
 	gem = drm_fb_cma_get_gem_obj(fb, 0);
 
 	start = gem->paddr + fb->offsets[0] +
 		crtc->y * fb->pitches[0] +
-		crtc->x * bpp / 8;
+		crtc->x * drm_format_plane_cpp(fb->pixel_format, 0);
 
 	end = start + (crtc->mode.vdisplay * fb->pitches[0]);
 
@@ -404,16 +402,13 @@ static void tilcdc_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	if (info->tft_alt_mode)
 		reg |= LCDC_TFT_ALT_ENABLE;
 	if (priv->rev == 2) {
-		unsigned int depth, bpp;
-
-		drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
-		switch (bpp) {
-		case 16:
+		switch (fb->pixel_format) {
+		case DRM_FORMAT_RGB565:
 			break;
-		case 32:
+		case DRM_FORMAT_XRGB8888:
 			reg |= LCDC_V2_TFT_24BPP_UNPACK;
 			/* fallthrough */
-		case 24:
+		case DRM_FORMAT_RGB888:
 			reg |= LCDC_V2_TFT_24BPP_MODE;
 			break;
 		default:
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_plane.c b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
index 41911e3110e8..604074089112 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_plane.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_plane.c
@@ -43,7 +43,7 @@ static int tilcdc_plane_atomic_check(struct drm_plane *plane,
 {
 	struct drm_crtc_state *crtc_state;
 	struct drm_plane_state *old_state = plane->state;
-	unsigned int depth, bpp;
+	unsigned int pitch;
 
 	if (!state->crtc)
 		return 0;
@@ -72,8 +72,9 @@ static int tilcdc_plane_atomic_check(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
-	drm_fb_get_bpp_depth(state->fb->pixel_format, &depth, &bpp);
-	if (state->fb->pitches[0] != crtc_state->mode.hdisplay * bpp / 8) {
+	pitch = crtc_state->mode.hdisplay *
+		drm_format_plane_cpp(state->fb->pixel_format, 0);
+	if (state->fb->pitches[0] != pitch) {
 		dev_err(plane->dev->dev,
 			"Invalid pitch: fb and crtc widths must be the same");
 		return -EINVAL;
-- 
Regards,

Laurent Pinchart

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

  parent reply	other threads:[~2016-09-08 14:44 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 14:44 [PATCH v4 00/14] Centralize format information Laurent Pinchart
2016-09-08 14:44 ` [PATCH v4 01/14] drm: " Laurent Pinchart
2016-09-14 11:49   ` Tomi Valkeinen
2016-09-14 22:22     ` Laurent Pinchart
2016-09-15  6:22       ` Tomi Valkeinen
2016-09-15 16:12         ` Eric Engestrom
2016-09-15 23:30           ` Laurent Pinchart
2016-09-16  9:44             ` Tomi Valkeinen
2016-09-16  9:59               ` Laurent Pinchart
2016-09-18 10:17   ` [PATCH v4.1 " Laurent Pinchart
2016-09-21  7:23     ` Daniel Vetter
2016-09-21 11:21       ` Laurent Pinchart
2016-09-21 12:43         ` Daniel Vetter
2016-09-21 13:40     ` Eric Engestrom
2016-09-22  6:37       ` Daniel Vetter
2016-09-08 14:44 ` [PATCH v4 02/14] drm: Implement the drm_format_*() helpers as drm_format_info() wrappers Laurent Pinchart
2016-09-14 11:56   ` Tomi Valkeinen
2016-09-21  7:34   ` Daniel Vetter
2016-09-21 11:29     ` Laurent Pinchart
2016-09-08 14:44 ` [PATCH v4 03/14] drm: Use drm_format_info() in DRM core code Laurent Pinchart
2016-09-14 13:23   ` Tomi Valkeinen
2016-09-14 22:31     ` Laurent Pinchart
2016-09-21  7:26       ` Daniel Vetter
2016-09-08 14:44 ` [PATCH v4 04/14] drm: WARN when calling drm_format_info() for an unsupported format Laurent Pinchart
2016-09-15  9:33   ` Tomi Valkeinen
2016-09-08 14:44 ` [PATCH v4 05/14] drm: sti: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-09-09 12:08   ` Vincent ABRIOU
2016-09-08 14:44 ` [PATCH v4 06/14] drm: hdlcd: " Laurent Pinchart
2016-09-08 14:44 ` Laurent Pinchart [this message]
2016-09-15  9:36   ` [PATCH v4 07/14] drm: tilcdc: " Tomi Valkeinen
2016-09-15  9:49     ` Jyri Sarha
2016-09-15 21:40       ` [PATCH v4.1 " Laurent Pinchart
2016-09-08 14:44 ` [PATCH v4 08/14] drm: cirrus: " Laurent Pinchart
2016-09-21  7:36   ` Daniel Vetter
2016-09-08 14:44 ` [PATCH v4 09/14] drm: gma500: Replace drm_fb_get_bpp_depth() with drm_format_info() Laurent Pinchart
2016-09-21  7:35   ` Daniel Vetter
2016-09-08 14:44 ` [PATCH v4 10/14] drm: amdgpu: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-09-21  7:51   ` Daniel Vetter
2016-09-21 12:39     ` Laurent Pinchart
2016-09-21 12:46       ` Daniel Vetter
2016-09-21 13:59         ` Laurent Pinchart
2016-09-22  5:31           ` Daniel Vetter
2016-09-22  6:33             ` Laurent Pinchart
2016-09-08 14:44 ` [PATCH v4 11/14] drm: radeon: " Laurent Pinchart
2016-09-21  7:52   ` Daniel Vetter
2016-09-08 14:44 ` [PATCH v4 12/14] drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info() Laurent Pinchart
2016-09-21  7:31   ` Daniel Vetter
2016-09-23 12:40     ` Laurent Pinchart
2016-09-23 12:48       ` Daniel Vetter
2016-09-08 14:44 ` [PATCH v4 13/14] drm/arm: mali-dp: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-09-21  7:53   ` Daniel Vetter
2016-09-08 14:44 ` [PATCH v4 14/14] drm: Don't export the drm_fb_get_bpp_depth() function Laurent Pinchart
2016-09-15  9:41   ` Tomi Valkeinen

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=1473345868-25453-8-git-send-email-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ti.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.