public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Chandra Konduru <chandra.konduru@intel.com>
Cc: daniel.vetter@intel.com, intel-gfx@lists.freedesktop.org,
	ander.conselvan.de.oliveira@intel.com
Subject: Re: [PATCH 14/14] drm/i915: skylake sprite plane scaling using shared scalers
Date: Thu, 9 Apr 2015 17:01:01 -0700	[thread overview]
Message-ID: <20150410000101.GN9016@intel.com> (raw)
In-Reply-To: <1428623012-27845-1-git-send-email-chandra.konduru@intel.com>

On Thu, Apr 09, 2015 at 04:43:32PM -0700, Chandra Konduru wrote:
> This patch enables skylake sprite plane display scaling using shared
> scalers atomic desgin.
> 
> v2:
> -use single copy of scaler limits (Matt)
> 
> v3:
> -detaching scalers moved to crtc commit path (Matt)
> 
> v4:
> -changes to align with updated scaler structures (Matt, me)
> -keep sprite src rect in 16.16 format (Matt, Daniel)
> 
> v5:
> -moved a hunk to #6 to keep src rect in check & commit in tandom (Matt)
> 
> Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_sprite.c |   56 ++++++++++++++++++++++++++++-------
>  1 file changed, 46 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index c346a82..ae503ee 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -33,6 +33,7 @@
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_fourcc.h>
>  #include <drm/drm_rect.h>
> +#include <drm/drm_atomic.h>
>  #include <drm/drm_plane_helper.h>
>  #include "intel_drv.h"
>  #include <drm/i915_drm.h>
> @@ -194,6 +195,8 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
>  	int pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
>  	const struct drm_intel_sprite_colorkey *key = &intel_plane->ckey;
>  	unsigned long surf_addr;
> +	struct intel_crtc_state *crtc_state = to_intel_crtc(crtc)->config;
> +	int scaler_id;
>  
>  	plane_ctl = PLANE_CTL_ENABLE |
>  		PLANE_CTL_PIPE_CSC_ENABLE;
> @@ -264,6 +267,8 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
>  	stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
>  					       fb->pixel_format);
>  
> +	scaler_id = to_intel_plane_state(drm_plane->state)->scaler_id;
> +
>  	/* Sizes are 0 based */
>  	src_w--;
>  	src_h--;
> @@ -283,10 +288,29 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
>  
>  	surf_addr = intel_plane_obj_offset(intel_plane, obj);
>  
> +	/* program plane scaler */
> +	if (scaler_id >= 0) {
> +		uint32_t ps_ctrl = 0;
> +
> +		DRM_DEBUG_KMS("plane = %d PS_PLANE_SEL(plane) = 0x%x\n", plane,
> +			PS_PLANE_SEL(plane));
> +		ps_ctrl = PS_SCALER_EN | PS_PLANE_SEL(plane) |
> +			crtc_state->scaler_state.scalers[scaler_id].mode;
> +		I915_WRITE(SKL_PS_CTRL(pipe, scaler_id), ps_ctrl);
> +		I915_WRITE(SKL_PS_PWR_GATE(pipe, scaler_id), 0);
> +		I915_WRITE(SKL_PS_WIN_POS(pipe, scaler_id), (crtc_x << 16) | crtc_y);
> +		I915_WRITE(SKL_PS_WIN_SZ(pipe, scaler_id),
> +			((crtc_w + 1) << 16)|(crtc_h + 1));
> +
> +		I915_WRITE(PLANE_POS(pipe, plane), 0);
> +		I915_WRITE(PLANE_SIZE(pipe, plane), (src_h << 16) | src_w);
> +	} else {
> +		I915_WRITE(PLANE_POS(pipe, plane), (crtc_y << 16) | crtc_x);
> +		I915_WRITE(PLANE_SIZE(pipe, plane), (crtc_h << 16) | crtc_w);
> +	}
> +
>  	I915_WRITE(PLANE_OFFSET(pipe, plane), (y << 16) | x);
>  	I915_WRITE(PLANE_STRIDE(pipe, plane), fb->pitches[0] / stride_div);
> -	I915_WRITE(PLANE_POS(pipe, plane), (crtc_y << 16) | crtc_x);
> -	I915_WRITE(PLANE_SIZE(pipe, plane), (crtc_h << 16) | crtc_w);
>  	I915_WRITE(PLANE_CTL(pipe, plane), plane_ctl);
>  	I915_WRITE(PLANE_SURF(pipe, plane), surf_addr);
>  	POSTING_READ(PLANE_SURF(pipe, plane));
> @@ -863,7 +887,9 @@ static int
>  intel_check_sprite_plane(struct drm_plane *plane,
>  			 struct intel_plane_state *state)
>  {
> +	struct drm_device *dev = plane->dev;
>  	struct intel_crtc *intel_crtc = to_intel_crtc(state->base.crtc);
> +	struct intel_crtc_state *crtc_state;
>  	struct intel_plane *intel_plane = to_intel_plane(plane);
>  	struct drm_framebuffer *fb = state->base.fb;
>  	int crtc_x, crtc_y;
> @@ -875,8 +901,11 @@ intel_check_sprite_plane(struct drm_plane *plane,
>  	int hscale, vscale;
>  	int max_scale, min_scale;
>  	int pixel_size;
> +	int ret;
>  
>  	intel_crtc = intel_crtc ? intel_crtc : to_intel_crtc(plane->crtc);
> +	crtc_state = state->base.state ?
> +		intel_atomic_get_crtc_state(state->base.state, intel_crtc) : NULL;
>  
>  	if (!fb) {
>  		state->visible = false;
> @@ -903,6 +932,11 @@ intel_check_sprite_plane(struct drm_plane *plane,
>  	max_scale = intel_plane->max_downscale << 16;
>  	min_scale = intel_plane->can_scale ? 1 : (1 << 16);
>  
> +	if (INTEL_INFO(dev)->gen >= 9) {
> +		min_scale = 1;
> +		max_scale = skl_max_scale(intel_crtc, crtc_state);
> +	}
> +
>  	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
>  			state->base.rotation);
>  
> @@ -998,8 +1032,8 @@ intel_check_sprite_plane(struct drm_plane *plane,
>  		width_bytes = ((src_x * pixel_size) & 63) +
>  					src_w * pixel_size;
>  
> -		if (src_w > 2048 || src_h > 2048 ||
> -		    width_bytes > 4096 || fb->pitches[0] > 4096) {
> +		if (INTEL_INFO(dev)->gen < 9 && (src_w > 2048 || src_h > 2048 ||
> +		    width_bytes > 4096 || fb->pitches[0] > 4096)) {
>  			DRM_DEBUG_KMS("Source dimensions exceed hardware limits\n");
>  			return -EINVAL;
>  		}
> @@ -1053,6 +1087,13 @@ finish:
>  		}
>  	}
>  
> +	if (INTEL_INFO(dev)->gen >= 9) {
> +		ret = skl_update_scaler_users(intel_crtc, crtc_state, intel_plane,
> +			state, 0);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return 0;
>  }
>  
> @@ -1264,12 +1305,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
>  		}
>  		break;
>  	case 9:
> -		/*
> -		 * FIXME: Skylake planes can be scaled (with some restrictions),
> -		 * but this is for another time.
> -		 */
> -		intel_plane->can_scale = false;
> -		intel_plane->max_downscale = 1;
> +		intel_plane->can_scale = true;
>  		intel_plane->update_plane = skl_update_plane;
>  		intel_plane->disable_plane = skl_disable_plane;
>  		state->scaler_id = -1;
> -- 
> 1.7.9.5
> 

-- 
Matt Roper
Graphics Software Engineer
IoTG Platform Enabling & Development
Intel Corporation
(916) 356-2795
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-04-10  0:01 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 22:28 [PATCH 00/14] skylake display scalers Chandra Konduru
2015-04-07 22:28 ` [PATCH 01/14] drm: Adding drm helper function drm_plane_from_index() Chandra Konduru
2015-04-10  0:36   ` Chandra Konduru
2015-04-10  6:59     ` Daniel Vetter
2015-04-10 16:30       ` Konduru, Chandra
2015-04-07 22:28 ` [PATCH 02/14] drm/i915: Register definitions for skylake scalers Chandra Konduru
2015-04-07 22:28 ` [PATCH 03/14] drm/i915: skylake scaler structure definitions Chandra Konduru
2015-04-07 22:28 ` [PATCH 04/14] drm/i915: Initialize plane colorkey to NONE Chandra Konduru
2015-04-07 22:28 ` [PATCH 05/14] drm/i915: Initialize skylake scalers Chandra Konduru
2015-04-07 22:28 ` [PATCH 06/14] drm/i915: Keep sprite plane src rect in 16.16 format Chandra Konduru
2015-04-09 21:50   ` Matt Roper
2015-04-09 22:08     ` Konduru, Chandra
2015-04-09 22:22       ` Matt Roper
2015-04-09 22:27         ` Konduru, Chandra
2015-04-09 23:41   ` Chandra Konduru
2015-04-09 23:57     ` Matt Roper
2015-04-07 22:28 ` [PATCH 07/14] drm/i915: Dump scaler_state too as part of dumping crtc_state Chandra Konduru
2015-04-07 22:28 ` [PATCH 08/14] drm/i915: Preserve scaler state when clearing crtc_state Chandra Konduru
2015-04-07 22:28 ` [PATCH 09/14] drm/i915: setup scalers for crtc_compute_config Chandra Konduru
2015-04-09 21:51   ` Matt Roper
2015-04-09 22:07     ` Konduru, Chandra
2015-04-09 23:42   ` Chandra Konduru
2015-04-07 22:28 ` [PATCH 10/14] drm/i915: Ensure setting up scalers into staged crtc_state Chandra Konduru
2015-04-07 22:28 ` [PATCH 11/14] drm/i915: copy staged scaler state from drm state to crtc->config Chandra Konduru
2015-04-07 22:28 ` [PATCH 12/14] drm/i915: skylake panel fitting using shared scalers Chandra Konduru
2015-04-07 22:28 ` [PATCH 13/14] drm/i915: skylake primary plane scaling " Chandra Konduru
2015-04-09 21:51   ` Matt Roper
2015-04-09 22:14     ` Konduru, Chandra
2015-04-13  9:46       ` Daniel Vetter
2015-04-13 18:12   ` Daniel Vetter
2015-04-13 18:18     ` Konduru, Chandra
2015-04-14  7:00   ` Daniel Vetter
2015-04-15 22:14   ` Chandra Konduru
2015-04-15 23:08     ` Konduru, Chandra
2015-04-16  7:36     ` Daniel Vetter
2015-04-16  8:17     ` Jindal, Sonika
2015-04-23 20:20     ` Daniel Vetter
2015-04-27  5:13       ` Konduru, Chandra
2015-05-04  8:16         ` Daniel Vetter
2015-04-27 20:48   ` Chandra Konduru
2015-04-29 12:12     ` Jani Nikula
2015-04-29 16:26       ` Konduru, Chandra
2015-05-01 16:47       ` Matt Roper
2015-04-07 22:28 ` [PATCH 14/14] drm/i915: skylake sprite " Chandra Konduru
2015-04-09 23:43   ` Chandra Konduru
2015-04-10  0:01     ` Matt Roper [this message]
2015-04-15 22:15   ` Chandra Konduru
2015-04-16  7:42     ` Daniel Vetter
2015-04-16  8:18     ` Jindal, Sonika
2015-04-09 21:53 ` [PATCH 00/14] skylake display scalers Matt Roper
2015-04-09 22:12   ` Matt Roper
2015-04-09 22:22     ` Konduru, Chandra
2015-04-10  9:34 ` Daniel Vetter
2015-04-10 16:29   ` Konduru, Chandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150410000101.GN9016@intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=ander.conselvan.de.oliveira@intel.com \
    --cc=chandra.konduru@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox