Commit 92f08076 authored by Maxime Ripard's avatar Maxime Ripard

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: default avatarEmil Velikov <emil.velikov@collabora.com>
Reviewed-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/5859d68664b8f0804a56e7386937f6db986b9e0f.1558002671.git-series.maxime.ripard@bootlin.com
parent bf39607c
...@@ -121,8 +121,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, ...@@ -121,8 +121,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
struct drm_mode_fb_cmd2 *mode_cmd, struct drm_mode_fb_cmd2 *mode_cmd,
struct drm_gem_object **gobj_p) struct drm_gem_object **gobj_p)
{ {
const struct drm_format_info *info = drm_get_format_info(dev, const struct drm_format_info *info;
mode_cmd);
struct amdgpu_device *adev = rfbdev->adev; struct amdgpu_device *adev = rfbdev->adev;
struct drm_gem_object *gobj = NULL; struct drm_gem_object *gobj = NULL;
struct amdgpu_bo *abo = NULL; struct amdgpu_bo *abo = NULL;
...@@ -133,6 +132,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, ...@@ -133,6 +132,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
int height = mode_cmd->height; int height = mode_cmd->height;
u32 cpp; u32 cpp;
info = drm_get_format_info(adev->ddev, mode_cmd);
cpp = drm_format_info_plane_cpp(info, 0); cpp = drm_format_info_plane_cpp(info, 0);
/* need to align pitch with crtc limits */ /* need to align pitch with crtc limits */
......
...@@ -232,7 +232,7 @@ static int psb_framebuffer_init(struct drm_device *dev, ...@@ -232,7 +232,7 @@ static int psb_framebuffer_init(struct drm_device *dev,
* Reject unknown formats, YUV formats, and formats with more than * Reject unknown formats, YUV formats, and formats with more than
* 4 bytes per pixel. * 4 bytes per pixel.
*/ */
info = drm_format_info(mode_cmd->pixel_format); info = drm_get_format_info(dev, mode_cmd);
if (!info || !info->depth || info->cpp[0] > 4) if (!info || !info->depth || info->cpp[0] > 4)
return -EINVAL; return -EINVAL;
......
...@@ -339,7 +339,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, ...@@ -339,7 +339,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev,
dev, mode_cmd, mode_cmd->width, mode_cmd->height, dev, mode_cmd, mode_cmd->width, mode_cmd->height,
(char *)&mode_cmd->pixel_format); (char *)&mode_cmd->pixel_format);
format = drm_format_info(mode_cmd->pixel_format); format = drm_get_format_info(dev, mode_cmd);
for (i = 0; i < ARRAY_SIZE(formats); i++) { for (i = 0; i < ARRAY_SIZE(formats); i++) {
if (formats[i] == mode_cmd->pixel_format) if (formats[i] == mode_cmd->pixel_format)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment