[PATCH v3 12/15] drm: amdgpu: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Jun 9 09:18:44 UTC 2016


Hi Michel,

On Thursday 09 Jun 2016 10:42:54 Michel Dänzer wrote:
> 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.

Thanks for the review, I'll fix that in both drivers.

-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list