[27/37] drm/nouveau: Use fb->format rather than drm_format_info()
diff mbox

Message ID 1479498793-31021-28-git-send-email-ville.syrjala@linux.intel.com
State New
Headers show

Commit Message

Ville Syrjälä Nov. 18, 2016, 7:53 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Let's use the pointer to the format information cached under
drm_framebuffer rather than look it up manually.

Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/nouveau/nv50_display.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Daniel Vetter Nov. 30, 2016, 3:59 p.m. UTC | #1
On Fri, Nov 18, 2016 at 09:53:03PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Let's use the pointer to the format information cached under
> drm_framebuffer rather than look it up manually.
> 
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/nouveau/nv50_display.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index a9855a4ec532..d3bd428023ea 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -1418,12 +1418,10 @@ static int
>  nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  		  struct nv50_head_atom *asyh)
>  {
> -	const u32 format = asyw->state.fb->pixel_format;
> -	const struct drm_format_info *info;
> +	const struct drm_framebuffer *fb = asyw->state.fb;
>  	int ret;
>  
> -	info = drm_format_info(format);

Could have done a smaller conversion with info = fb->format. Meh.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> -	if (!info || !info->depth)
> +	if (!fb->format->depth)
>  		return -EINVAL;
>  
>  	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
> @@ -1433,14 +1431,14 @@ nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
>  	if (ret)
>  		return ret;
>  
> -	asyh->base.depth = info->depth;
> -	asyh->base.cpp = info->cpp[0];
> +	asyh->base.depth = fb->format->depth;
> +	asyh->base.cpp = fb->format->cpp[0];
>  	asyh->base.x = asyw->state.src.x1 >> 16;
>  	asyh->base.y = asyw->state.src.y1 >> 16;
>  	asyh->base.w = asyw->state.fb->width;
>  	asyh->base.h = asyw->state.fb->height;
>  
> -	switch (format) {
> +	switch (fb->pixel_format) {
>  	case DRM_FORMAT_C8         : asyw->image.format = 0x1e; break;
>  	case DRM_FORMAT_RGB565     : asyw->image.format = 0xe8; break;
>  	case DRM_FORMAT_XRGB1555   :
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index a9855a4ec532..d3bd428023ea 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1418,12 +1418,10 @@  static int
 nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 		  struct nv50_head_atom *asyh)
 {
-	const u32 format = asyw->state.fb->pixel_format;
-	const struct drm_format_info *info;
+	const struct drm_framebuffer *fb = asyw->state.fb;
 	int ret;
 
-	info = drm_format_info(format);
-	if (!info || !info->depth)
+	if (!fb->format->depth)
 		return -EINVAL;
 
 	ret = drm_plane_helper_check_state(&asyw->state, &asyw->clip,
@@ -1433,14 +1431,14 @@  nv50_base_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (ret)
 		return ret;
 
-	asyh->base.depth = info->depth;
-	asyh->base.cpp = info->cpp[0];
+	asyh->base.depth = fb->format->depth;
+	asyh->base.cpp = fb->format->cpp[0];
 	asyh->base.x = asyw->state.src.x1 >> 16;
 	asyh->base.y = asyw->state.src.y1 >> 16;
 	asyh->base.w = asyw->state.fb->width;
 	asyh->base.h = asyw->state.fb->height;
 
-	switch (format) {
+	switch (fb->pixel_format) {
 	case DRM_FORMAT_C8         : asyw->image.format = 0x1e; break;
 	case DRM_FORMAT_RGB565     : asyw->image.format = 0xe8; break;
 	case DRM_FORMAT_XRGB1555   :