Commit 282dbf9b authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Pass intel_plane and intel_crtc to plane hooks

Streamline things by passing intel_plane and intel_crtc instead of
the drm types to our plane hooks.

v2: s/ilk/g4x/ in sprite code
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170327185546.2977-3-ville.syrjala@linux.intel.com
parent d509e28b
...@@ -185,7 +185,7 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state, ...@@ -185,7 +185,7 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
} }
intel_state->base.visible = false; intel_state->base.visible = false;
ret = intel_plane->check_plane(plane, crtc_state, intel_state); ret = intel_plane->check_plane(intel_plane, crtc_state, intel_state);
if (ret) if (ret)
return ret; return ret;
...@@ -235,14 +235,14 @@ static void intel_plane_atomic_update(struct drm_plane *plane, ...@@ -235,14 +235,14 @@ static void intel_plane_atomic_update(struct drm_plane *plane,
trace_intel_update_plane(plane, trace_intel_update_plane(plane,
to_intel_crtc(crtc)); to_intel_crtc(crtc));
intel_plane->update_plane(plane, intel_plane->update_plane(intel_plane,
to_intel_crtc_state(crtc->state), to_intel_crtc_state(crtc->state),
intel_state); intel_state);
} else { } else {
trace_intel_disable_plane(plane, trace_intel_disable_plane(plane,
to_intel_crtc(crtc)); to_intel_crtc(crtc));
intel_plane->disable_plane(plane, crtc); intel_plane->disable_plane(intel_plane, to_intel_crtc(crtc));
} }
} }
......
...@@ -2750,7 +2750,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, ...@@ -2750,7 +2750,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
false); false);
intel_pre_disable_primary_noatomic(&intel_crtc->base); intel_pre_disable_primary_noatomic(&intel_crtc->base);
trace_intel_disable_plane(primary, intel_crtc); trace_intel_disable_plane(primary, intel_crtc);
intel_plane->disable_plane(primary, &intel_crtc->base); intel_plane->disable_plane(intel_plane, intel_crtc);
return; return;
...@@ -3061,14 +3061,14 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state) ...@@ -3061,14 +3061,14 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
return 0; return 0;
} }
static void i9xx_update_primary_plane(struct drm_plane *primary, static void i9xx_update_primary_plane(struct intel_plane *primary,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = to_i915(primary->dev); struct drm_i915_private *dev_priv = to_i915(primary->base.dev);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
struct drm_framebuffer *fb = plane_state->base.fb; const struct drm_framebuffer *fb = plane_state->base.fb;
int plane = intel_crtc->plane; enum plane plane = primary->plane;
u32 linear_offset; u32 linear_offset;
u32 dspcntr = plane_state->ctl; u32 dspcntr = plane_state->ctl;
i915_reg_t reg = DSPCNTR(plane); i915_reg_t reg = DSPCNTR(plane);
...@@ -3079,12 +3079,12 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, ...@@ -3079,12 +3079,12 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
if (INTEL_GEN(dev_priv) >= 4) if (INTEL_GEN(dev_priv) >= 4)
intel_crtc->dspaddr_offset = plane_state->main.offset; crtc->dspaddr_offset = plane_state->main.offset;
else else
intel_crtc->dspaddr_offset = linear_offset; crtc->dspaddr_offset = linear_offset;
intel_crtc->adjusted_x = x; crtc->adjusted_x = x;
intel_crtc->adjusted_y = y; crtc->adjusted_y = y;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -3110,31 +3110,29 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, ...@@ -3110,31 +3110,29 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
I915_WRITE_FW(DSPSURF(plane), I915_WRITE_FW(DSPSURF(plane),
intel_plane_ggtt_offset(plane_state) + intel_plane_ggtt_offset(plane_state) +
intel_crtc->dspaddr_offset); crtc->dspaddr_offset);
I915_WRITE_FW(DSPOFFSET(plane), (y << 16) | x); I915_WRITE_FW(DSPOFFSET(plane), (y << 16) | x);
} else if (INTEL_GEN(dev_priv) >= 4) { } else if (INTEL_GEN(dev_priv) >= 4) {
I915_WRITE_FW(DSPSURF(plane), I915_WRITE_FW(DSPSURF(plane),
intel_plane_ggtt_offset(plane_state) + intel_plane_ggtt_offset(plane_state) +
intel_crtc->dspaddr_offset); crtc->dspaddr_offset);
I915_WRITE_FW(DSPTILEOFF(plane), (y << 16) | x); I915_WRITE_FW(DSPTILEOFF(plane), (y << 16) | x);
I915_WRITE_FW(DSPLINOFF(plane), linear_offset); I915_WRITE_FW(DSPLINOFF(plane), linear_offset);
} else { } else {
I915_WRITE_FW(DSPADDR(plane), I915_WRITE_FW(DSPADDR(plane),
intel_plane_ggtt_offset(plane_state) + intel_plane_ggtt_offset(plane_state) +
intel_crtc->dspaddr_offset); crtc->dspaddr_offset);
} }
POSTING_READ_FW(reg); POSTING_READ_FW(reg);
spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
} }
static void i9xx_disable_primary_plane(struct drm_plane *primary, static void i9xx_disable_primary_plane(struct intel_plane *primary,
struct drm_crtc *crtc) struct intel_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = to_i915(primary->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); enum plane plane = primary->plane;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int plane = intel_crtc->plane;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -3319,16 +3317,15 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -3319,16 +3317,15 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
return plane_ctl; return plane_ctl;
} }
static void skylake_update_primary_plane(struct drm_plane *plane, static void skylake_update_primary_plane(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_device *dev = plane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc); const struct drm_framebuffer *fb = plane_state->base.fb;
struct drm_framebuffer *fb = plane_state->base.fb; enum plane_id plane_id = plane->id;
enum plane_id plane_id = to_intel_plane(plane)->id; enum pipe pipe = plane->pipe;
enum pipe pipe = to_intel_plane(plane)->pipe;
u32 plane_ctl = plane_state->ctl; u32 plane_ctl = plane_state->ctl;
unsigned int rotation = plane_state->base.rotation; unsigned int rotation = plane_state->base.rotation;
u32 stride = skl_plane_stride(fb, 0, rotation); u32 stride = skl_plane_stride(fb, 0, rotation);
...@@ -3350,10 +3347,10 @@ static void skylake_update_primary_plane(struct drm_plane *plane, ...@@ -3350,10 +3347,10 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
dst_w--; dst_w--;
dst_h--; dst_h--;
intel_crtc->dspaddr_offset = surf_addr; crtc->dspaddr_offset = surf_addr;
intel_crtc->adjusted_x = src_x; crtc->adjusted_x = src_x;
intel_crtc->adjusted_y = src_y; crtc->adjusted_y = src_y;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -3392,13 +3389,12 @@ static void skylake_update_primary_plane(struct drm_plane *plane, ...@@ -3392,13 +3389,12 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
} }
static void skylake_disable_primary_plane(struct drm_plane *primary, static void skylake_disable_primary_plane(struct intel_plane *primary,
struct drm_crtc *crtc) struct intel_crtc *crtc)
{ {
struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = to_i915(primary->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); enum plane_id plane_id = primary->id;
enum plane_id plane_id = to_intel_plane(primary)->id; enum pipe pipe = primary->pipe;
enum pipe pipe = to_intel_plane(primary)->pipe;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -3431,7 +3427,7 @@ static void intel_update_primary_planes(struct drm_device *dev) ...@@ -3431,7 +3427,7 @@ static void intel_update_primary_planes(struct drm_device *dev)
trace_intel_update_plane(&plane->base, trace_intel_update_plane(&plane->base,
to_intel_crtc(crtc)); to_intel_crtc(crtc));
plane->update_plane(&plane->base, plane->update_plane(plane,
to_intel_crtc_state(crtc->state), to_intel_crtc_state(crtc->state),
plane_state); plane_state);
} }
...@@ -5081,7 +5077,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned plane_mask ...@@ -5081,7 +5077,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned plane_mask
intel_crtc_dpms_overlay_disable(intel_crtc); intel_crtc_dpms_overlay_disable(intel_crtc);
drm_for_each_plane_mask(p, dev, plane_mask) drm_for_each_plane_mask(p, dev, plane_mask)
to_intel_plane(p)->disable_plane(p, crtc); to_intel_plane(p)->disable_plane(to_intel_plane(p), intel_crtc);
/* /*
* FIXME: Once we grow proper nuclear flip support out of this we need * FIXME: Once we grow proper nuclear flip support out of this we need
...@@ -13279,11 +13275,11 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state ...@@ -13279,11 +13275,11 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state
} }
static int static int
intel_check_primary_plane(struct drm_plane *plane, intel_check_primary_plane(struct intel_plane *plane,
struct intel_crtc_state *crtc_state, struct intel_crtc_state *crtc_state,
struct intel_plane_state *state) struct intel_plane_state *state)
{ {
struct drm_i915_private *dev_priv = to_i915(plane->dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_crtc *crtc = state->base.crtc; struct drm_crtc *crtc = state->base.crtc;
int min_scale = DRM_PLANE_HELPER_NO_SCALING; int min_scale = DRM_PLANE_HELPER_NO_SCALING;
int max_scale = DRM_PLANE_HELPER_NO_SCALING; int max_scale = DRM_PLANE_HELPER_NO_SCALING;
...@@ -13498,12 +13494,12 @@ intel_legacy_cursor_update(struct drm_plane *plane, ...@@ -13498,12 +13494,12 @@ intel_legacy_cursor_update(struct drm_plane *plane,
if (plane->state->visible) { if (plane->state->visible) {
trace_intel_update_plane(plane, to_intel_crtc(crtc)); trace_intel_update_plane(plane, to_intel_crtc(crtc));
intel_plane->update_plane(plane, intel_plane->update_plane(intel_plane,
to_intel_crtc_state(crtc->state), to_intel_crtc_state(crtc->state),
to_intel_plane_state(plane->state)); to_intel_plane_state(plane->state));
} else { } else {
trace_intel_disable_plane(plane, to_intel_crtc(crtc)); trace_intel_disable_plane(plane, to_intel_crtc(crtc));
intel_plane->disable_plane(plane, crtc); intel_plane->disable_plane(intel_plane, to_intel_crtc(crtc));
} }
intel_cleanup_plane_fb(plane, new_plane_state); intel_cleanup_plane_fb(plane, new_plane_state);
...@@ -13647,14 +13643,14 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) ...@@ -13647,14 +13643,14 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
} }
static int static int
intel_check_cursor_plane(struct drm_plane *plane, intel_check_cursor_plane(struct intel_plane *plane,
struct intel_crtc_state *crtc_state, struct intel_crtc_state *crtc_state,
struct intel_plane_state *state) struct intel_plane_state *state)
{ {
struct drm_i915_private *dev_priv = to_i915(plane->dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_framebuffer *fb = state->base.fb; const struct drm_framebuffer *fb = state->base.fb;
struct drm_i915_gem_object *obj = intel_fb_obj(fb); struct drm_i915_gem_object *obj = intel_fb_obj(fb);
enum pipe pipe = to_intel_plane(plane)->pipe; enum pipe pipe = plane->pipe;
unsigned stride; unsigned stride;
int ret; int ret;
...@@ -13714,23 +13710,20 @@ intel_check_cursor_plane(struct drm_plane *plane, ...@@ -13714,23 +13710,20 @@ intel_check_cursor_plane(struct drm_plane *plane,
} }
static void static void
intel_disable_cursor_plane(struct drm_plane *plane, intel_disable_cursor_plane(struct intel_plane *plane,
struct drm_crtc *crtc) struct intel_crtc *crtc)
{ {
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); crtc->cursor_addr = 0;
intel_crtc_update_cursor(&crtc->base, NULL);
intel_crtc->cursor_addr = 0;
intel_crtc_update_cursor(crtc, NULL);
} }
static void static void
intel_update_cursor_plane(struct drm_plane *plane, intel_update_cursor_plane(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *state) const struct intel_plane_state *state)
{ {
struct drm_crtc *crtc = crtc_state->base.crtc; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
struct drm_i915_private *dev_priv = to_i915(plane->dev);
struct drm_i915_gem_object *obj = intel_fb_obj(state->base.fb); struct drm_i915_gem_object *obj = intel_fb_obj(state->base.fb);
uint32_t addr; uint32_t addr;
...@@ -13741,8 +13734,8 @@ intel_update_cursor_plane(struct drm_plane *plane, ...@@ -13741,8 +13734,8 @@ intel_update_cursor_plane(struct drm_plane *plane,
else else
addr = obj->phys_handle->busaddr; addr = obj->phys_handle->busaddr;
intel_crtc->cursor_addr = addr; crtc->cursor_addr = addr;
intel_crtc_update_cursor(crtc, state); intel_crtc_update_cursor(&crtc->base, state);
} }
static struct intel_plane * static struct intel_plane *
...@@ -15160,7 +15153,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) ...@@ -15160,7 +15153,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
continue; continue;
trace_intel_disable_plane(&plane->base, crtc); trace_intel_disable_plane(&plane->base, crtc);
plane->disable_plane(&plane->base, &crtc->base); plane->disable_plane(plane, crtc);
} }
} }
......
...@@ -851,12 +851,12 @@ struct intel_plane { ...@@ -851,12 +851,12 @@ struct intel_plane {
* the intel_plane_state structure and accessed via plane_state. * the intel_plane_state structure and accessed via plane_state.
*/ */
void (*update_plane)(struct drm_plane *plane, void (*update_plane)(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state); const struct intel_plane_state *plane_state);
void (*disable_plane)(struct drm_plane *plane, void (*disable_plane)(struct intel_plane *plane,
struct drm_crtc *crtc); struct intel_crtc *crtc);
int (*check_plane)(struct drm_plane *plane, int (*check_plane)(struct intel_plane *plane,
struct intel_crtc_state *crtc_state, struct intel_crtc_state *crtc_state,
struct intel_plane_state *state); struct intel_plane_state *state);
}; };
......
...@@ -207,16 +207,14 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct intel_flip_work *work ...@@ -207,16 +207,14 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct intel_flip_work *work
} }
static void static void
skl_update_plane(struct drm_plane *drm_plane, skl_update_plane(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_device *dev = drm_plane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); const struct drm_framebuffer *fb = plane_state->base.fb;
struct intel_plane *intel_plane = to_intel_plane(drm_plane); enum plane_id plane_id = plane->id;
struct drm_framebuffer *fb = plane_state->base.fb; enum pipe pipe = plane->pipe;
enum plane_id plane_id = intel_plane->id;
enum pipe pipe = intel_plane->pipe;
u32 plane_ctl = plane_state->ctl; u32 plane_ctl = plane_state->ctl;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
u32 surf_addr = plane_state->main.offset; u32 surf_addr = plane_state->main.offset;
...@@ -285,13 +283,11 @@ skl_update_plane(struct drm_plane *drm_plane, ...@@ -285,13 +283,11 @@ skl_update_plane(struct drm_plane *drm_plane,
} }
static void static void
skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) skl_disable_plane(struct intel_plane *plane, struct intel_crtc *crtc)
{ {
struct drm_device *dev = dplane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); enum plane_id plane_id = plane->id;
struct intel_plane *intel_plane = to_intel_plane(dplane); enum pipe pipe = plane->pipe;
enum plane_id plane_id = intel_plane->id;
enum pipe pipe = intel_plane->pipe;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -305,10 +301,10 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) ...@@ -305,10 +301,10 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
} }
static void static void
chv_update_csc(struct intel_plane *intel_plane, uint32_t format) chv_update_csc(struct intel_plane *plane, uint32_t format)
{ {
struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
enum plane_id plane_id = intel_plane->id; enum plane_id plane_id = plane->id;
/* Seems RGB data bypasses the CSC always */ /* Seems RGB data bypasses the CSC always */
if (!format_is_yuv(format)) if (!format_is_yuv(format))
...@@ -408,16 +404,14 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state, ...@@ -408,16 +404,14 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state,
} }
static void static void
vlv_update_plane(struct drm_plane *dplane, vlv_update_plane(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_device *dev = dplane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); const struct drm_framebuffer *fb = plane_state->base.fb;
struct intel_plane *intel_plane = to_intel_plane(dplane); enum pipe pipe = plane->pipe;
struct drm_framebuffer *fb = plane_state->base.fb; enum plane_id plane_id = plane->id;
enum pipe pipe = intel_plane->pipe;
enum plane_id plane_id = intel_plane->id;
u32 sprctl = plane_state->ctl; u32 sprctl = plane_state->ctl;
u32 sprsurf_offset = plane_state->main.offset; u32 sprsurf_offset = plane_state->main.offset;
u32 linear_offset; u32 linear_offset;
...@@ -439,7 +433,7 @@ vlv_update_plane(struct drm_plane *dplane, ...@@ -439,7 +433,7 @@ vlv_update_plane(struct drm_plane *dplane,
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B)
chv_update_csc(intel_plane, fb->format->format); chv_update_csc(plane, fb->format->format);
if (key->flags) { if (key->flags) {
I915_WRITE_FW(SPKEYMINVAL(pipe, plane_id), key->min_value); I915_WRITE_FW(SPKEYMINVAL(pipe, plane_id), key->min_value);
...@@ -466,13 +460,11 @@ vlv_update_plane(struct drm_plane *dplane, ...@@ -466,13 +460,11 @@ vlv_update_plane(struct drm_plane *dplane,
} }
static void static void
vlv_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) vlv_disable_plane(struct intel_plane *plane, struct intel_crtc *crtc)
{ {
struct drm_device *dev = dplane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); enum pipe pipe = plane->pipe;
struct intel_plane *intel_plane = to_intel_plane(dplane); enum plane_id plane_id = plane->id;
enum pipe pipe = intel_plane->pipe;
enum plane_id plane_id = intel_plane->id;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -542,15 +534,13 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state, ...@@ -542,15 +534,13 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state,
} }
static void static void
ivb_update_plane(struct drm_plane *plane, ivb_update_plane(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_device *dev = plane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); const struct drm_framebuffer *fb = plane_state->base.fb;
struct intel_plane *intel_plane = to_intel_plane(plane); enum pipe pipe = plane->pipe;
struct drm_framebuffer *fb = plane_state->base.fb;
enum pipe pipe = intel_plane->pipe;
u32 sprctl = plane_state->ctl, sprscale = 0; u32 sprctl = plane_state->ctl, sprscale = 0;
u32 sprsurf_offset = plane_state->main.offset; u32 sprsurf_offset = plane_state->main.offset;
u32 linear_offset; u32 linear_offset;
...@@ -597,7 +587,7 @@ ivb_update_plane(struct drm_plane *plane, ...@@ -597,7 +587,7 @@ ivb_update_plane(struct drm_plane *plane,
I915_WRITE_FW(SPRLINOFF(pipe), linear_offset); I915_WRITE_FW(SPRLINOFF(pipe), linear_offset);
I915_WRITE_FW(SPRSIZE(pipe), (crtc_h << 16) | crtc_w); I915_WRITE_FW(SPRSIZE(pipe), (crtc_h << 16) | crtc_w);
if (intel_plane->can_scale) if (plane->can_scale)
I915_WRITE_FW(SPRSCALE(pipe), sprscale); I915_WRITE_FW(SPRSCALE(pipe), sprscale);
I915_WRITE_FW(SPRCTL(pipe), sprctl); I915_WRITE_FW(SPRCTL(pipe), sprctl);
I915_WRITE_FW(SPRSURF(pipe), I915_WRITE_FW(SPRSURF(pipe),
...@@ -608,19 +598,17 @@ ivb_update_plane(struct drm_plane *plane, ...@@ -608,19 +598,17 @@ ivb_update_plane(struct drm_plane *plane,
} }
static void static void
ivb_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc) ivb_disable_plane(struct intel_plane *plane, struct intel_crtc *crtc)
{ {
struct drm_device *dev = plane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); enum pipe pipe = plane->pipe;
struct intel_plane *intel_plane = to_intel_plane(plane);
int pipe = intel_plane->pipe;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
I915_WRITE_FW(SPRCTL(pipe), 0); I915_WRITE_FW(SPRCTL(pipe), 0);
/* Can't leave the scaler enabled... */ /* Can't leave the scaler enabled... */
if (intel_plane->can_scale) if (plane->can_scale)
I915_WRITE_FW(SPRSCALE(pipe), 0); I915_WRITE_FW(SPRSCALE(pipe), 0);
I915_WRITE_FW(SPRSURF(pipe), 0); I915_WRITE_FW(SPRSURF(pipe), 0);
...@@ -683,15 +671,13 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state, ...@@ -683,15 +671,13 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state,
} }
static void static void
g4x_update_plane(struct drm_plane *plane, g4x_update_plane(struct intel_plane *plane,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_device *dev = plane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); const struct drm_framebuffer *fb = plane_state->base.fb;
struct intel_plane *intel_plane = to_intel_plane(plane); enum pipe pipe = plane->pipe;
struct drm_framebuffer *fb = plane_state->base.fb;
int pipe = intel_plane->pipe;
u32 dvscntr = plane_state->ctl, dvsscale = 0; u32 dvscntr = plane_state->ctl, dvsscale = 0;
u32 dvssurf_offset = plane_state->main.offset; u32 dvssurf_offset = plane_state->main.offset;
u32 linear_offset; u32 linear_offset;
...@@ -744,12 +730,10 @@ g4x_update_plane(struct drm_plane *plane, ...@@ -744,12 +730,10 @@ g4x_update_plane(struct drm_plane *plane,
} }
static void static void
g4x_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc) g4x_disable_plane(struct intel_plane *plane, struct intel_crtc *crtc)
{ {
struct drm_device *dev = plane->dev; struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_i915_private *dev_priv = to_i915(dev); enum pipe pipe = plane->pipe;
struct intel_plane *intel_plane = to_intel_plane(plane);
int pipe = intel_plane->pipe;
unsigned long irqflags; unsigned long irqflags;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -765,14 +749,12 @@ g4x_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc) ...@@ -765,14 +749,12 @@ g4x_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc)
} }
static int static int
intel_check_sprite_plane(struct drm_plane *plane, intel_check_sprite_plane(struct intel_plane *plane,
struct intel_crtc_state *crtc_state, struct intel_crtc_state *crtc_state,
struct intel_plane_state *state) struct intel_plane_state *state)
{ {
struct drm_i915_private *dev_priv = to_i915(plane->dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_crtc *crtc = state->base.crtc; struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_plane *intel_plane = to_intel_plane(plane);
struct drm_framebuffer *fb = state->base.fb; struct drm_framebuffer *fb = state->base.fb;
int crtc_x, crtc_y; int crtc_x, crtc_y;
unsigned int crtc_w, crtc_h; unsigned int crtc_w, crtc_h;
...@@ -794,7 +776,7 @@ intel_check_sprite_plane(struct drm_plane *plane, ...@@ -794,7 +776,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
} }
/* Don't modify another pipe's plane */ /* Don't modify another pipe's plane */
if (intel_plane->pipe != intel_crtc->pipe) { if (plane->pipe != crtc->pipe) {
DRM_DEBUG_KMS("Wrong plane <-> crtc mapping\n"); DRM_DEBUG_KMS("Wrong plane <-> crtc mapping\n");
return -EINVAL; return -EINVAL;
} }
...@@ -811,16 +793,16 @@ intel_check_sprite_plane(struct drm_plane *plane, ...@@ -811,16 +793,16 @@ intel_check_sprite_plane(struct drm_plane *plane,
if (state->ckey.flags == I915_SET_COLORKEY_NONE) { if (state->ckey.flags == I915_SET_COLORKEY_NONE) {
can_scale = 1; can_scale = 1;
min_scale = 1; min_scale = 1;
max_scale = skl_max_scale(intel_crtc, crtc_state); max_scale = skl_max_scale(crtc, crtc_state);
} else { } else {
can_scale = 0; can_scale = 0;
min_scale = DRM_PLANE_HELPER_NO_SCALING; min_scale = DRM_PLANE_HELPER_NO_SCALING;
max_scale = DRM_PLANE_HELPER_NO_SCALING; max_scale = DRM_PLANE_HELPER_NO_SCALING;
} }
} else { } else {
can_scale = intel_plane->can_scale; can_scale = plane->can_scale;
max_scale = intel_plane->max_downscale << 16; max_scale = plane->max_downscale << 16;
min_scale = intel_plane->can_scale ? 1 : (1 << 16); min_scale = plane->can_scale ? 1 : (1 << 16);
} }
/* /*
......
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