Commit f9407ae1 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Use i9xx_check_plane_surface() for sprite planes as well

All the pre-SKL sprite planes compute the x/y/tile offsets in a
similar way. There are a couple of minor differences but the primary
planes have those as well. Thus i9xx_check_plane_surface()
already does what we need, so let's use it.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170323192712.30682-7-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 3ba35e53
...@@ -3026,7 +3026,7 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -3026,7 +3026,7 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
return dspcntr; return dspcntr;
} }
static int i9xx_check_plane_surface(struct intel_plane_state *plane_state) int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->base.plane->dev);
......
...@@ -1453,6 +1453,7 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -1453,6 +1453,7 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane, u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
unsigned int rotation); unsigned int rotation);
int skl_check_plane_surface(struct intel_plane_state *plane_state); int skl_check_plane_surface(struct intel_plane_state *plane_state);
int i9xx_check_plane_surface(struct intel_plane_state *plane_state);
/* intel_csr.c */ /* intel_csr.c */
void intel_csr_ucode_init(struct drm_i915_private *); void intel_csr_ucode_init(struct drm_i915_private *);
......
...@@ -419,35 +419,21 @@ vlv_update_plane(struct drm_plane *dplane, ...@@ -419,35 +419,21 @@ vlv_update_plane(struct drm_plane *dplane,
enum pipe pipe = intel_plane->pipe; enum pipe pipe = intel_plane->pipe;
enum plane_id plane_id = intel_plane->id; enum plane_id plane_id = intel_plane->id;
u32 sprctl = plane_state->ctl; u32 sprctl = plane_state->ctl;
u32 sprsurf_offset, linear_offset; u32 sprsurf_offset = plane_state->main.offset;
unsigned int rotation = plane_state->base.rotation; u32 linear_offset;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->base.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->base.dst.y1;
uint32_t crtc_w = drm_rect_width(&plane_state->base.dst); uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
uint32_t crtc_h = drm_rect_height(&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 x = plane_state->main.x;
uint32_t y = plane_state->base.src.y1 >> 16; uint32_t y = plane_state->main.y;
uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
unsigned long irqflags; unsigned long irqflags;
/* Sizes are 0 based */ /* Sizes are 0 based */
src_w--;
src_h--;
crtc_w--; crtc_w--;
crtc_h--; crtc_h--;
intel_add_fb_offsets(&x, &y, plane_state, 0);
sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
if (rotation & DRM_ROTATE_180) {
x += src_w;
y += src_h;
} else if (rotation & DRM_REFLECT_X) {
x += src_w;
}
linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -566,15 +552,15 @@ ivb_update_plane(struct drm_plane *plane, ...@@ -566,15 +552,15 @@ ivb_update_plane(struct drm_plane *plane,
struct drm_framebuffer *fb = plane_state->base.fb; struct drm_framebuffer *fb = plane_state->base.fb;
enum pipe pipe = intel_plane->pipe; enum pipe pipe = intel_plane->pipe;
u32 sprctl = plane_state->ctl, sprscale = 0; u32 sprctl = plane_state->ctl, sprscale = 0;
u32 sprsurf_offset, linear_offset; u32 sprsurf_offset = plane_state->main.offset;
unsigned int rotation = plane_state->base.rotation; u32 linear_offset;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->base.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->base.dst.y1;
uint32_t crtc_w = drm_rect_width(&plane_state->base.dst); uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
uint32_t crtc_h = drm_rect_height(&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 x = plane_state->main.x;
uint32_t y = plane_state->base.src.y1 >> 16; uint32_t y = plane_state->main.y;
uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 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; uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
unsigned long irqflags; unsigned long irqflags;
...@@ -588,16 +574,6 @@ ivb_update_plane(struct drm_plane *plane, ...@@ -588,16 +574,6 @@ ivb_update_plane(struct drm_plane *plane,
if (crtc_w != src_w || crtc_h != src_h) if (crtc_w != src_w || crtc_h != src_h)
sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h; sprscale = SPRITE_SCALE_ENABLE | (src_w << 16) | src_h;
intel_add_fb_offsets(&x, &y, plane_state, 0);
sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
/* HSW+ does this automagically in hardware */
if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv) &&
rotation & DRM_ROTATE_180) {
x += src_w;
y += src_h;
}
linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -716,16 +692,16 @@ ilk_update_plane(struct drm_plane *plane, ...@@ -716,16 +692,16 @@ ilk_update_plane(struct drm_plane *plane,
struct intel_plane *intel_plane = to_intel_plane(plane); struct intel_plane *intel_plane = to_intel_plane(plane);
struct drm_framebuffer *fb = plane_state->base.fb; struct drm_framebuffer *fb = plane_state->base.fb;
int pipe = intel_plane->pipe; int pipe = intel_plane->pipe;
u32 dvscntr = plane_state->ctl, dvsscale; u32 dvscntr = plane_state->ctl, dvsscale = 0;
u32 dvssurf_offset, linear_offset; u32 dvssurf_offset = plane_state->main.offset;
unsigned int rotation = plane_state->base.rotation; u32 linear_offset;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->base.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->base.dst.y1;
uint32_t crtc_w = drm_rect_width(&plane_state->base.dst); uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
uint32_t crtc_h = drm_rect_height(&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 x = plane_state->main.x;
uint32_t y = plane_state->base.src.y1 >> 16; uint32_t y = plane_state->main.y;
uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 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; uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
unsigned long irqflags; unsigned long irqflags;
...@@ -736,18 +712,9 @@ ilk_update_plane(struct drm_plane *plane, ...@@ -736,18 +712,9 @@ ilk_update_plane(struct drm_plane *plane,
crtc_w--; crtc_w--;
crtc_h--; crtc_h--;
dvsscale = 0;
if (crtc_w != src_w || crtc_h != src_h) if (crtc_w != src_w || crtc_h != src_h)
dvsscale = DVS_SCALE_ENABLE | (src_w << 16) | src_h; dvsscale = DVS_SCALE_ENABLE | (src_w << 16) | src_h;
intel_add_fb_offsets(&x, &y, plane_state, 0);
dvssurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
if (rotation & DRM_ROTATE_180) {
x += src_w;
y += src_h;
}
linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -981,10 +948,22 @@ intel_check_sprite_plane(struct drm_plane *plane, ...@@ -981,10 +948,22 @@ intel_check_sprite_plane(struct drm_plane *plane,
state->ctl = skl_plane_ctl(crtc_state, state); state->ctl = skl_plane_ctl(crtc_state, state);
} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { } else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
ret = i9xx_check_plane_surface(state);
if (ret)
return ret;
state->ctl = vlv_sprite_ctl(crtc_state, state); state->ctl = vlv_sprite_ctl(crtc_state, state);
} else if (INTEL_GEN(dev_priv) >= 7) { } else if (INTEL_GEN(dev_priv) >= 7) {
ret = i9xx_check_plane_surface(state);
if (ret)
return ret;
state->ctl = ivb_sprite_ctl(crtc_state, state); state->ctl = ivb_sprite_ctl(crtc_state, state);
} else { } else {
ret = i9xx_check_plane_surface(state);
if (ret)
return ret;
state->ctl = ilk_sprite_ctl(crtc_state, state); state->ctl = ilk_sprite_ctl(crtc_state, state);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment