Commit 802aaf76 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Archit Taneja

drm: radeon: 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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1476744081-24485-11-git-send-email-laurent.pinchart@ideasonboard.com
parent 8e911ab7
...@@ -89,13 +89,13 @@ static struct fb_ops radeonfb_ops = { ...@@ -89,13 +89,13 @@ static struct fb_ops radeonfb_ops = {
}; };
int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled) int radeon_align_pitch(struct radeon_device *rdev, int width, int cpp, bool tiled)
{ {
int aligned = width; int aligned = width;
int align_large = (ASIC_IS_AVIVO(rdev)) || tiled; int align_large = (ASIC_IS_AVIVO(rdev)) || tiled;
int pitch_mask = 0; int pitch_mask = 0;
switch (bpp / 8) { switch (cpp) {
case 1: case 1:
pitch_mask = align_large ? 255 : 127; pitch_mask = align_large ? 255 : 127;
break; break;
...@@ -110,7 +110,7 @@ int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tile ...@@ -110,7 +110,7 @@ int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tile
aligned += pitch_mask; aligned += pitch_mask;
aligned &= ~pitch_mask; aligned &= ~pitch_mask;
return aligned; return aligned * cpp;
} }
static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj) static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj)
...@@ -139,13 +139,13 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev, ...@@ -139,13 +139,13 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
int ret; int ret;
int aligned_size, size; int aligned_size, size;
int height = mode_cmd->height; int height = mode_cmd->height;
u32 bpp, depth; u32 cpp;
drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); cpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0);
/* need to align pitch with crtc limits */ /* need to align pitch with crtc limits */
mode_cmd->pitches[0] = radeon_align_pitch(rdev, mode_cmd->width, bpp, mode_cmd->pitches[0] = radeon_align_pitch(rdev, mode_cmd->width, cpp,
fb_tiled) * ((bpp + 1) / 8); fb_tiled);
if (rdev->family >= CHIP_R600) if (rdev->family >= CHIP_R600)
height = ALIGN(mode_cmd->height, 8); height = ALIGN(mode_cmd->height, 8);
...@@ -165,11 +165,11 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev, ...@@ -165,11 +165,11 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
tiling_flags = RADEON_TILING_MACRO; tiling_flags = RADEON_TILING_MACRO;
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
switch (bpp) { switch (cpp) {
case 32: case 4:
tiling_flags |= RADEON_TILING_SWAP_32BIT; tiling_flags |= RADEON_TILING_SWAP_32BIT;
break; break;
case 16: case 2:
tiling_flags |= RADEON_TILING_SWAP_16BIT; tiling_flags |= RADEON_TILING_SWAP_16BIT;
default: default:
break; break;
......
...@@ -745,7 +745,8 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, ...@@ -745,7 +745,8 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
uint32_t handle; uint32_t handle;
int r; int r;
args->pitch = radeon_align_pitch(rdev, args->width, args->bpp, 0) * ((args->bpp + 1) / 8); args->pitch = radeon_align_pitch(rdev, args->width,
DIV_ROUND_UP(args->bpp, 8), 0);
args->size = args->pitch * args->height; args->size = args->pitch * args->height;
args->size = ALIGN(args->size, PAGE_SIZE); args->size = ALIGN(args->size, PAGE_SIZE);
......
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