diff mbox

[v3,07/15] drm: sti: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()

Message ID 1465428739-26529-8-git-send-email-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart June 8, 2016, 11:32 p.m. UTC
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>
---
 drivers/gpu/drm/sti/sti_gdp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>

Comments

Vincent Abriou June 9, 2016, 7:52 a.m. UTC | #1
On 06/09/2016 01:32 AM, 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@ideasonboard.com>
> ---
>   drivers/gpu/drm/sti/sti_gdp.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Cc: Vincent Abriou <vincent.abriou@st.com>
>
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index ff33c38da197..be7e80535083 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -733,7 +733,7 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
>   	u32 dma_updated_top;
>   	u32 dma_updated_btm;
>   	int format;
> -	unsigned int depth, bpp;
> +	unsigned int bpp;
>   	u32 ydo, xdo, yds, xds;
>
>   	if (!crtc || !fb)
> @@ -772,9 +772,9 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
>   			 (unsigned long)cma_obj->paddr);
>
>   	/* pixel memory location */
> -	drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
> +	bpp = drm_format_plane_cpp(fb->pixel_format, 0);

Hi Laurent,

The patch is fine for me but what does "cpp" means in drm_format_plane_cpp?

Vincent

>   	top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
> -	top_field->gam_gdp_pml += src_x * (bpp >> 3);
> +	top_field->gam_gdp_pml += src_x * bpp;
>   	top_field->gam_gdp_pml += src_y * fb->pitches[0];
>
>   	/* output parameters (clamped / cropped) */
>
Laurent Pinchart June 9, 2016, 9:17 a.m. UTC | #2
Hi Vincent,

On Thursday 09 Jun 2016 09:52:05 Vincent ABRIOU wrote:
> On 06/09/2016 01:32 AM, 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@ideasonboard.com>
> > ---
> > 
> >   drivers/gpu/drm/sti/sti_gdp.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> > Cc: Vincent Abriou <vincent.abriou@st.com>
> > 
> > diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> > index ff33c38da197..be7e80535083 100644
> > --- a/drivers/gpu/drm/sti/sti_gdp.c
> > +++ b/drivers/gpu/drm/sti/sti_gdp.c
> > @@ -733,7 +733,7 @@ static void sti_gdp_atomic_update(struct drm_plane
> > *drm_plane,> 
> >   	u32 dma_updated_top;
> >   	u32 dma_updated_btm;
> >   	int format;
> > -	unsigned int depth, bpp;
> > +	unsigned int bpp;
> >   	u32 ydo, xdo, yds, xds;
> >   	
> >   	if (!crtc || !fb)
> > @@ -772,9 +772,9 @@ static void sti_gdp_atomic_update(struct drm_plane
> > *drm_plane,
> >   			 (unsigned long)cma_obj->paddr);
> >   	
> >   	/* pixel memory location */
> > -	drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
> > +	bpp = drm_format_plane_cpp(fb->pixel_format, 0);
> 
> Hi Laurent,
> 
> The patch is fine for me but what does "cpp" means in drm_format_plane_cpp?

As far as I know it stands for character per pixel. It's really unfortunate 
that bit and byte both start with the same letter.

> >   	top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
> > -	top_field->gam_gdp_pml += src_x * (bpp >> 3);
> > +	top_field->gam_gdp_pml += src_x * bpp;
> >   	top_field->gam_gdp_pml += src_y * fb->pitches[0];
> >   	
> >   	/* output parameters (clamped / cropped) */
Vincent Abriou June 9, 2016, 12:10 p.m. UTC | #3
Hi Laurent,

On 06/09/2016 11:17 AM, Laurent Pinchart wrote:
> Hi Vincent,
>
> On Thursday 09 Jun 2016 09:52:05 Vincent ABRIOU wrote:
>> On 06/09/2016 01:32 AM, 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@ideasonboard.com>
>>> ---
>>>
>>>    drivers/gpu/drm/sti/sti_gdp.c | 6 +++---
>>>    1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>>> Cc: Vincent Abriou <vincent.abriou@st.com>
>>>
>>> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
>>> index ff33c38da197..be7e80535083 100644
>>> --- a/drivers/gpu/drm/sti/sti_gdp.c
>>> +++ b/drivers/gpu/drm/sti/sti_gdp.c
>>> @@ -733,7 +733,7 @@ static void sti_gdp_atomic_update(struct drm_plane
>>> *drm_plane,>
>>>    	u32 dma_updated_top;
>>>    	u32 dma_updated_btm;
>>>    	int format;
>>> -	unsigned int depth, bpp;
>>> +	unsigned int bpp;
>>>    	u32 ydo, xdo, yds, xds;
>>>    	
>>>    	if (!crtc || !fb)
>>> @@ -772,9 +772,9 @@ static void sti_gdp_atomic_update(struct drm_plane
>>> *drm_plane,
>>>    			 (unsigned long)cma_obj->paddr);
>>>    	
>>>    	/* pixel memory location */
>>> -	drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
>>> +	bpp = drm_format_plane_cpp(fb->pixel_format, 0);
>>
>> Hi Laurent,
>>
>> The patch is fine for me but what does "cpp" means in drm_format_plane_cpp?
>
> As far as I know it stands for character per pixel. It's really unfortunate
> that bit and byte both start with the same letter.
>

Thanks

Acked-by: Vincent Abriou <vincent.abriou@st.com>

>>>    	top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
>>> -	top_field->gam_gdp_pml += src_x * (bpp >> 3);
>>> +	top_field->gam_gdp_pml += src_x * bpp;
>>>    	top_field->gam_gdp_pml += src_y * fb->pitches[0];
>>>    	
>>>    	/* output parameters (clamped / cropped) */
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index ff33c38da197..be7e80535083 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -733,7 +733,7 @@  static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
 	u32 dma_updated_top;
 	u32 dma_updated_btm;
 	int format;
-	unsigned int depth, bpp;
+	unsigned int bpp;
 	u32 ydo, xdo, yds, xds;
 
 	if (!crtc || !fb)
@@ -772,9 +772,9 @@  static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
 			 (unsigned long)cma_obj->paddr);
 
 	/* pixel memory location */
-	drm_fb_get_bpp_depth(fb->pixel_format, &depth, &bpp);
+	bpp = drm_format_plane_cpp(fb->pixel_format, 0);
 	top_field->gam_gdp_pml = (u32)cma_obj->paddr + fb->offsets[0];
-	top_field->gam_gdp_pml += src_x * (bpp >> 3);
+	top_field->gam_gdp_pml += src_x * bpp;
 	top_field->gam_gdp_pml += src_y * fb->pitches[0];
 
 	/* output parameters (clamped / cropped) */