diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 14 |
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 | ||
93 | int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tiled) | 93 | int 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 | ||
116 | static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj) | 116 | static 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; |