On 09.06.2016 08:32, Laurent Pinchart wrote:
> 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 at ideasonboard.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c  | 10 +++++-----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |  3 ++-
>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: "Christian König" <christian.koenig at amd.com>
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> index 919146780a15..306f626d3e80 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> @@ -68,7 +68,7 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int 
> width, int bpp, bool tile
>       int aligned = width;
>       int pitch_mask = 0;
>  
> -     switch (bpp / 8) {
> +     switch (bpp) {
>       case 1:
>               pitch_mask = 255;
>               break;
> @@ -83,7 +83,7 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int 
> width, int bpp, bool tile
>  
>       aligned += pitch_mask;
>       aligned &= ~pitch_mask;
> -     return aligned;
> +     return aligned * bpp;
>  }
>  
>  static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
> @@ -112,13 +112,13 @@ static int amdgpufb_create_pinned_object(struct 
> amdgpu_fbdev *rfbdev,
>       int ret;
>       int aligned_size, size;
>       int height = mode_cmd->height;
> -     u32 bpp, depth;
> +     u32 bpp;
>  
> -     drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp);
> +     bpp = drm_format_plane_cpp(mode_cmd->pixel_format, 0);

I think renaming bpp (for "bits per pixel") to cpp (for "chars (bytes)
per pixel") in these two functions would avoid confusion.

Same comment for the radeon patch.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

Reply via email to