All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH v5 11/13] drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info()
Date: Tue, 18 Oct 2016 01:41:19 +0300	[thread overview]
Message-ID: <1476744081-24485-12-git-send-email-laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1476744081-24485-1-git-send-email-laurent.pinchart@ideasonboard.com>

The driver is the last users of the drm_fb_get_bpp_depth() function. It
should ideally be converted to use struct drm_mode_fb_cmd2 instead of
the legacy struct drm_mode_fb_cmd internally, but that will require
broad changes across the code base. As a first step, replace
drm_fb_get_bpp_depth() with drm_format_info() in order to stop exporting
the function to drivers.

The new DRM_ERROR() message comes from the vmw_create_dmabuf_proxy(),
vmw_kms_new_framebuffer_surface() and vmw_kms_new_framebuffer_dmabuf()
functions that currently print an error if the pixel format is
unsupported.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index bf28ccc150df..c965514b82be 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -980,14 +980,22 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 	struct vmw_dma_buffer *bo = NULL;
 	struct ttm_base_object *user_obj;
 	struct drm_mode_fb_cmd mode_cmd;
+	const struct drm_format_info *info;
 	int ret;
 
+	info = drm_format_info(mode_cmd2->pixel_format);
+	if (!info || !info->depth) {
+		DRM_ERROR("Unsupported framebuffer format %s\n",
+			  drm_get_format_name(mode_cmd2->pixel_format));
+		return ERR_PTR(-EINVAL);
+	}
+
 	mode_cmd.width = mode_cmd2->width;
 	mode_cmd.height = mode_cmd2->height;
 	mode_cmd.pitch = mode_cmd2->pitches[0];
 	mode_cmd.handle = mode_cmd2->handles[0];
-	drm_fb_get_bpp_depth(mode_cmd2->pixel_format, &mode_cmd.depth,
-				    &mode_cmd.bpp);
+	mode_cmd.depth = info->depth;
+	mode_cmd.bpp = info->cpp[0] * 8;
 
 	/**
 	 * This code should be conditioned on Screen Objects not being used.
-- 
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-10-17 22:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 22:41 [PATCH v5 00/13] Centralize format information Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 01/13] drm: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 02/13] drm: Implement the drm_format_*() helpers as drm_format_info() wrappers Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 03/13] drm: Use drm_format_info() in DRM core code Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 04/13] drm: WARN when calling drm_format_info() for an unsupported format Laurent Pinchart
2016-10-18 15:14   ` Eric Engestrom
2016-10-17 22:41 ` [PATCH v5 05/13] drm: hdlcd: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 06/13] drm: tilcdc: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 07/13] drm: cirrus: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 08/13] drm: gma500: Replace drm_fb_get_bpp_depth() with drm_format_info() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 09/13] drm: amdgpu: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 10/13] drm: radeon: " Laurent Pinchart
2016-10-17 22:41 ` Laurent Pinchart [this message]
2016-10-17 22:41 ` [PATCH v5 12/13] drm/arm: mali-dp: " Laurent Pinchart
2016-10-17 22:41 ` [PATCH v5 13/13] drm: Don't export the drm_fb_get_bpp_depth() function Laurent Pinchart
2016-10-18 15:14   ` Eric Engestrom
2016-10-18 10:33 ` [PATCH v5 00/13] Centralize format information Archit Taneja
2016-10-18 11:43 ` Ville Syrjälä
2016-10-18 12:33   ` Laurent Pinchart
2016-10-18 12:45     ` Ville Syrjälä
2016-10-18 12:49       ` 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=1476744081-24485-12-git-send-email-laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.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.