aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-10-17 18:41:16 -0400
committerArchit Taneja <architt@codeaurora.org>2016-10-18 05:52:38 -0400
commite0f9a4ab49a107c011f3bda401f747fbb5f29e7a (patch)
tree6780b5d01eb048f101166ef43a6e1cd323910a4d /drivers/gpu
parentb7f9745cda2f905403cf0c8ce326e70ee9f8b633 (diff)
drm: gma500: Replace drm_fb_get_bpp_depth() with drm_format_info()
The driver uses drm_fb_get_bpp_depth() to check whether it can support the format requested by userspace when creating a framebuffer. This isn't the right API, as it doesn't differentiate between RGB formats other than on a depth and bpp basis. Fixing this requires non trivial changes to the drivers internals. As a first step, replace usage of the drm_fb_get_bpp_depth() function with an equivalent check based on drm_format_info(). This is part of a wider effort to remove usage of the drm_fb_get_bpp_depth() function in drivers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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-9-git-send-email-laurent.pinchart@ideasonboard.com
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index aee2f9733457..97daf23f3fef 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -236,22 +236,20 @@ static int psb_framebuffer_init(struct drm_device *dev,
236 const struct drm_mode_fb_cmd2 *mode_cmd, 236 const struct drm_mode_fb_cmd2 *mode_cmd,
237 struct gtt_range *gt) 237 struct gtt_range *gt)
238{ 238{
239 u32 bpp, depth; 239 const struct drm_format_info *info;
240 int ret; 240 int ret;
241 241
242 drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); 242 /*
243 * Reject unknown formats, YUV formats, and formats with more than
244 * 4 bytes per pixel.
245 */
246 info = drm_format_info(mode_cmd->pixel_format);
247 if (!info || !info->depth || info->cpp[0] > 4)
248 return -EINVAL;
243 249
244 if (mode_cmd->pitches[0] & 63) 250 if (mode_cmd->pitches[0] & 63)
245 return -EINVAL; 251 return -EINVAL;
246 switch (bpp) { 252
247 case 8:
248 case 16:
249 case 24:
250 case 32:
251 break;
252 default:
253 return -EINVAL;
254 }
255 drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd); 253 drm_helper_mode_fill_fb_struct(&fb->base, mode_cmd);
256 fb->gtt = gt; 254 fb->gtt = gt;
257 ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs); 255 ret = drm_framebuffer_init(dev, &fb->base, &psb_fb_funcs);