diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2016-10-17 18:41:19 -0400 |
---|---|---|
committer | Archit Taneja <architt@codeaurora.org> | 2016-10-18 05:53:53 -0400 |
commit | 6c5d064a2dd9ecda0716f66b0586349179036ca4 (patch) | |
tree | 602f87c180df88b0a01666cc2eee6a0e83478c1f | |
parent | 802aaf7642f57aa2eadbff8ee38dbd976e8bd0f4 (diff) |
drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info()
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>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1476744081-24485-12-git-send-email-laurent.pinchart@ideasonboard.com
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 12 |
1 files 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, | |||
980 | struct vmw_dma_buffer *bo = NULL; | 980 | struct vmw_dma_buffer *bo = NULL; |
981 | struct ttm_base_object *user_obj; | 981 | struct ttm_base_object *user_obj; |
982 | struct drm_mode_fb_cmd mode_cmd; | 982 | struct drm_mode_fb_cmd mode_cmd; |
983 | const struct drm_format_info *info; | ||
983 | int ret; | 984 | int ret; |
984 | 985 | ||
986 | info = drm_format_info(mode_cmd2->pixel_format); | ||
987 | if (!info || !info->depth) { | ||
988 | DRM_ERROR("Unsupported framebuffer format %s\n", | ||
989 | drm_get_format_name(mode_cmd2->pixel_format)); | ||
990 | return ERR_PTR(-EINVAL); | ||
991 | } | ||
992 | |||
985 | mode_cmd.width = mode_cmd2->width; | 993 | mode_cmd.width = mode_cmd2->width; |
986 | mode_cmd.height = mode_cmd2->height; | 994 | mode_cmd.height = mode_cmd2->height; |
987 | mode_cmd.pitch = mode_cmd2->pitches[0]; | 995 | mode_cmd.pitch = mode_cmd2->pitches[0]; |
988 | mode_cmd.handle = mode_cmd2->handles[0]; | 996 | mode_cmd.handle = mode_cmd2->handles[0]; |
989 | drm_fb_get_bpp_depth(mode_cmd2->pixel_format, &mode_cmd.depth, | 997 | mode_cmd.depth = info->depth; |
990 | &mode_cmd.bpp); | 998 | mode_cmd.bpp = info->cpp[0] * 8; |
991 | 999 | ||
992 | /** | 1000 | /** |
993 | * This code should be conditioned on Screen Objects not being used. | 1001 | * This code should be conditioned on Screen Objects not being used. |