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 v3 09/15] drm: tilcdc: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()
Date: Thu,  9 Jun 2016 02:31:06 +0300	[thread overview]
Message-ID: <1465428672-26411-10-git-send-email-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1465428672-26411-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>
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 23 ++++++++++-------------
 1 file changed, 10 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 79027b1c64d3..d63c7363dabc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -65,15 +65,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]);
 
@@ -132,11 +130,12 @@ static void tilcdc_crtc_destroy(struct drm_crtc *crtc)
 static int tilcdc_verify_fb(struct drm_crtc *crtc, struct drm_framebuffer *fb)
 {
 	struct drm_device *dev = crtc->dev;
-	unsigned int depth, bpp;
+	unsigned int min_pitch;
 
-	drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
+	min_pitch = crtc->mode.hdisplay
+		  * drm_format_plane_cpp(fb->pixel_format, 0);
 
-	if (fb->pitches[0] != crtc->mode.hdisplay * bpp / 8) {
+	if (fb->pitches[0] != min_pitch) {
 		dev_err(dev->dev,
 			"Invalid pitch: fb and crtc widths must be the same");
 		return -EINVAL;
@@ -401,16 +400,14 @@ static int tilcdc_crtc_mode_set(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(crtc->primary->fb->pixel_format, &depth, &bpp);
-		switch (bpp) {
-		case 16:
+		switch (crtc->primary->fb->pixel_format) {
+		case DRM_FORMAT_RGB565:
 			break;
-		case 32:
+		case DRM_FORMAT_XRGB8888:
+		case DRM_FORMAT_ARGB8888:
 			reg |= LCDC_V2_TFT_24BPP_UNPACK;
 			/* fallthrough */
-		case 24:
+		case DRM_FORMAT_RGB888:
 			reg |= LCDC_V2_TFT_24BPP_MODE;
 			break;
 		default:
-- 
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-06-08 23:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 23:30 [PATCH v3 00/15] Centralize format information Laurent Pinchart
2016-06-08 23:30 ` [PATCH v3 01/15] drm: Move format-related helpers to drm_fourcc.c Laurent Pinchart
2016-06-08 23:30 ` [PATCH v3 02/15] drm: Centralize format information Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 03/15] drm: Implement the drm_format_*() helpers as drm_format_info() wrappers Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 04/15] drm: Use drm_format_info() in DRM core code Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 05/15] drm: WARN when calling drm_format_info() for an unsupported format Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 06/15] drm: msm: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 07/15] drm: sti: " Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 08/15] drm: hdlcd: " Laurent Pinchart
2016-06-08 23:31 ` Laurent Pinchart [this message]
2016-06-08 23:31 ` [PATCH v3 10/15] drm: cirrus: " Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 11/15] drm: gma500: Replace drm_fb_get_bpp_depth() with drm_format_info() Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 12/15] drm: amdgpu: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 13/15] drm: radeon: " Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 14/15] drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info() Laurent Pinchart
2016-06-08 23:31 ` [PATCH v3 15/15] drm: Don't export the drm_fb_get_bpp_depth() function Laurent Pinchart
2016-06-08 23:32 [PATCH v3 00/15] Centralize format information Laurent Pinchart
2016-06-08 23:32 ` [PATCH v3 09/15] drm: tilcdc: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-06-10 11:51   ` Tomi Valkeinen
2016-06-10 12:05     ` Ville Syrjälä
2016-06-10 12:08       ` Tomi Valkeinen
2016-06-10 12:23         ` Ville Syrjälä
2016-06-10 12:26           ` Tomi Valkeinen
2016-06-10 12:29             ` Ville Syrjälä
2016-06-10 12:48               ` Tomi Valkeinen
2016-06-10 13:08                 ` Tomi Valkeinen
2016-06-10 13:16                   ` Jyri Sarha
2016-06-10 13:25                     ` Ville Syrjälä
2016-06-10 14:21                       ` Daniel Vetter
2016-06-10 12:07     ` Laurent Pinchart

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=1465428672-26411-10-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.