aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2016-10-17 18:41:17 -0400
committerArchit Taneja <architt@codeaurora.org>2016-10-18 05:52:49 -0400
commit8e911ab770f7bbc8bb5fab0ce6ebd8d1a7188998 (patch)
treea5608219c509814a9343bb7b9086f78e7c831f4b /drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
parente0f9a4ab49a107c011f3bda401f747fbb5f29e7a (diff)
drm: amdgpu: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()
The driver needs the number of bytes per pixel, not the bpp and depth info meant for fbdev compatibility. Use the right API. 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-10-git-send-email-laurent.pinchart@ideasonboard.com
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 9fb8aa4d6bae..8d01aa24d68a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -90,12 +90,12 @@ static struct fb_ops amdgpufb_ops = {
90}; 90};
91 91
92 92
93int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tiled) 93int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int cpp, bool tiled)
94{ 94{
95 int aligned = width; 95 int aligned = width;
96 int pitch_mask = 0; 96 int pitch_mask = 0;
97 97
98 switch (bpp / 8) { 98 switch (cpp) {
99 case 1: 99 case 1:
100 pitch_mask = 255; 100 pitch_mask = 255;
101 break; 101 break;
@@ -110,7 +110,7 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tile
110 110
111 aligned += pitch_mask; 111 aligned += pitch_mask;
112 aligned &= ~pitch_mask; 112 aligned &= ~pitch_mask;
113 return aligned; 113 return aligned * cpp;
114} 114}
115 115
116static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj) 116static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
@@ -139,13 +139,13 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
139 int ret; 139 int ret;
140 int aligned_size, size; 140 int aligned_size, size;
141 int height = mode_cmd->height; 141 int height = mode_cmd->height;
142 u32 bpp, depth; 142 u32 cpp;
143 143
144 drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); 144 cpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0);
145 145
146 /* need to align pitch with crtc limits */ 146 /* need to align pitch with crtc limits */
147 mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, bpp, 147 mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp,
148 fb_tiled) * ((bpp + 1) / 8); 148 fb_tiled);
149 149
150 height = ALIGN(mode_cmd->height, 8); 150 height = ALIGN(mode_cmd->height, 8);
151 size = mode_cmd->pitches[0] * height; 151 size = mode_cmd->pitches[0] * height;