[Intel-gfx] [PATCH 05/14] drm/i915: Extract ivb_sprite_ctl()

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 17 21:54:01 UTC 2017


On Fri, Mar 17, 2017 at 11:17:59PM +0200, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Pull the code to calculate the IVB-BDW sprite control register value
> into a separate function. Allows us to pre-compute it in the future.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

> +static void
> +ivb_update_plane(struct drm_plane *plane,
> +		 const struct intel_crtc_state *crtc_state,
> +		 const struct intel_plane_state *plane_state)
> +{
> +	struct drm_device *dev = plane->dev;
> +	struct drm_i915_private *dev_priv = to_i915(dev);
> +	struct intel_plane *intel_plane = to_intel_plane(plane);
> +	struct drm_framebuffer *fb = plane_state->base.fb;
> +	enum pipe pipe = intel_plane->pipe;
> +	u32 sprctl, sprscale = 0;
> +	u32 sprsurf_offset, linear_offset;
> +	unsigned int rotation = plane_state->base.rotation;
> +	const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
> +	int crtc_x = plane_state->base.dst.x1;
> +	int crtc_y = plane_state->base.dst.y1;
> +	uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
> +	uint32_t crtc_h = drm_rect_height(&plane_state->base.dst);
> +	uint32_t x = plane_state->base.src.x1 >> 16;
> +	uint32_t y = plane_state->base.src.y1 >> 16;
> +	uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
> +	uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;

struct crtc_rectangle { int x, y; u32 w, h; } crtc_r = crtc_rectangle(plane_state);
struct source_rectangle { int x, y; u32 w, h; } src_r = source_rectangle(plane_state);

c_rect / s_rect?
crtc_rect / src_rect.

Just idly mentioning the large blocks of repeated code.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list