aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@bootlin.com>2019-05-16 06:31:51 -0400
committerMaxime Ripard <maxime.ripard@bootlin.com>2019-05-20 07:35:40 -0400
commit92f080762c3f45bbcfbe35e2ac610af1ee3bb2b9 (patch)
treed5b8d22ffe1133aa725c5703ad1fcf58769d32df
parentbf39607c16141811d0f5fe67e231364c96a87e09 (diff)
drm: Replace instances of drm_format_info by drm_get_format_info
drm_get_format_info directly calls into drm_format_info, but takes directly a struct drm_mode_fb_cmd2 pointer, instead of the fourcc directly. It's shorter to not dereference it, and we can customise the behaviour at the driver level if we want to, so let's switch to it where it makes sense. Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/5859d68664b8f0804a56e7386937f6db986b9e0f.1558002671.git-series.maxime.ripard@bootlin.com
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c4
-rw-r--r--drivers/gpu/drm/gma500/framebuffer.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 06e73a343724..6edae6458be8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -121,8 +121,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
121 struct drm_mode_fb_cmd2 *mode_cmd, 121 struct drm_mode_fb_cmd2 *mode_cmd,
122 struct drm_gem_object **gobj_p) 122 struct drm_gem_object **gobj_p)
123{ 123{
124 const struct drm_format_info *info = drm_get_format_info(dev, 124 const struct drm_format_info *info;
125 mode_cmd);
126 struct amdgpu_device *adev = rfbdev->adev; 125 struct amdgpu_device *adev = rfbdev->adev;
127 struct drm_gem_object *gobj = NULL; 126 struct drm_gem_object *gobj = NULL;
128 struct amdgpu_bo *abo = NULL; 127 struct amdgpu_bo *abo = NULL;
@@ -133,6 +132,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
133 int height = mode_cmd->height; 132 int height = mode_cmd->height;
134 u32 cpp; 133 u32 cpp;
135 134
135 info = drm_get_format_info(adev->ddev, mode_cmd);
136 cpp = drm_format_info_plane_cpp(info, 0); 136 cpp = drm_format_info_plane_cpp(info, 0);
137 137
138 /* need to align pitch with crtc limits */ 138 /* need to align pitch with crtc limits */
diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index a9d3a4a30ab8..1794ab90b2cc 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -232,7 +232,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
232 * Reject unknown formats, YUV formats, and formats with more than 232 * Reject unknown formats, YUV formats, and formats with more than
233 * 4 bytes per pixel. 233 * 4 bytes per pixel.
234 */ 234 */
235 info = drm_format_info(mode_cmd->pixel_format); 235 info = drm_get_format_info(dev, mode_cmd);
236 if (!info || !info->depth || info->cpp[0] > 4) 236 if (!info || !info->depth || info->cpp[0] > 4)
237 return -EINVAL; 237 return -EINVAL;
238 238
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index cfb641363a32..6557b2d6e16e 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -339,7 +339,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
339 dev, mode_cmd, mode_cmd->width, mode_cmd->height, 339 dev, mode_cmd, mode_cmd->width, mode_cmd->height,
340 (char *)&mode_cmd->pixel_format); 340 (char *)&mode_cmd->pixel_format);
341 341
342 format = drm_format_info(mode_cmd->pixel_format); 342 format = drm_get_format_info(dev, mode_cmd);
343 343
344 for (i = 0; i < ARRAY_SIZE(formats); i++) { 344 for (i = 0; i < ARRAY_SIZE(formats); i++) {
345 if (formats[i] == mode_cmd->pixel_format) 345 if (formats[i] == mode_cmd->pixel_format)