Commit e42aeef1 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: Revert async unpin and nonblocking atomic commit

This reverts the following patches:

d55dbd06 drm/i915: Allow nonblocking update of pageflips.
15c86bdb drm/i915: Check for unpin correctness.
95c2ccdc Reapply "drm/i915: Avoid stalling on pending flips for legacy cursor updates"
a6747b73 drm/i915: Make unpin async.
03f476e1 drm/i915: Prepare connectors for nonblocking checks.
2099deff drm/i915: Pass atomic states to fbc update functions.
ee7171af drm/i915: Remove reset_counter from intel_crtc.
2ee004f7 drm/i915: Remove queue_flip pointer.
b8d2afae drm/i915: Remove use_mmio_flip kernel parameter.
8dd634d9 drm/i915: Remove cs based page flip support.
143f73b3 drm/i915: Rework intel_crtc_page_flip to be almost atomic, v3.
84fc494b drm/i915: Add the exclusive fence to plane_state.
6885843a drm/i915: Convert flip_work to a list.
aa420ddd drm/i915: Allow mmio updates on all platforms, v2.
afee4d87 Revert "drm/i915: Avoid stalling on pending flips for legacy cursor updates"

"drm/i915: Allow nonblocking update of pageflips" should have been
split up, misses a proper commit message and seems to cause issues in
the legacy page_flip path as demonstrated by kms_flip.

"drm/i915: Make unpin async" doesn't handle the unthrottled cursor
updates correctly, leading to an apparent pin count leak. This is
caught by the WARN_ON in i915_gem_object_do_pin which screams if we
have more than DRM_I915_GEM_OBJECT_MAX_PIN_COUNT pins.

Unfortuantely we can't just revert these two because this patch series
came with a built-in bisect breakage in the form of temporarily
removing the unthrottled cursor update hack for legacy cursor ioctl.
Therefore there's no other option than to revert the entire pile :(

There's one tiny conflict in intel_drv.h due to other patches, nothing
serious.

Normally I'd wait a bit longer with doing a maintainer revert, but
since the minimal set of patches we need to revert (due to the bisect
breakage) is so big, time is running out fast. And very soon
(especially after a few attempts at fixing issues) it'll be really
hard to revert things cleanly.

Lessons learned:
- Not a good idea to rush the review (done by someone fairly new to
  the area) and not make sure domain experts had a chance to read it.

- Patches should be properly split up. I only looked at the two
  patches that should be reverted in detail, but both look like the
  mix up different things in one patch.

- Patches really should have proper commit messages. Especially when
  doing more than one thing, and especially when touching critical and
  tricky core code.

- Building a patch series and r-b stamping it when it has a built-in
  bisect breakage is not a good idea.

- I also think we need to stop building up technical debt by
  postponing atomic igt testcases even longer. I think it's clear that
  there's enough corner cases in this beast that we really need to
  have the testcases _before_ the next step lands.

(cherry picked from commit 5a21b665
from drm-intel-next-queeud)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: default avatarDave Airlie <airlied@redhat.com>
Acked-by: default avatarJani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
parent 9cce4431
...@@ -592,52 +592,6 @@ static int i915_gem_gtt_info(struct seq_file *m, void *data) ...@@ -592,52 +592,6 @@ static int i915_gem_gtt_info(struct seq_file *m, void *data)
return 0; return 0;
} }
static void i915_dump_pageflip(struct seq_file *m,
struct drm_i915_private *dev_priv,
struct intel_crtc *crtc,
struct intel_flip_work *work)
{
const char pipe = pipe_name(crtc->pipe);
u32 pending;
int i;
pending = atomic_read(&work->pending);
if (pending) {
seq_printf(m, "Flip ioctl preparing on pipe %c (plane %c)\n",
pipe, plane_name(crtc->plane));
} else {
seq_printf(m, "Flip pending (waiting for vsync) on pipe %c (plane %c)\n",
pipe, plane_name(crtc->plane));
}
for (i = 0; i < work->num_planes; i++) {
struct intel_plane_state *old_plane_state = work->old_plane_state[i];
struct drm_plane *plane = old_plane_state->base.plane;
struct drm_i915_gem_request *req = old_plane_state->wait_req;
struct intel_engine_cs *engine;
seq_printf(m, "[PLANE:%i] part of flip.\n", plane->base.id);
if (!req) {
seq_printf(m, "Plane not associated with any engine\n");
continue;
}
engine = i915_gem_request_get_engine(req);
seq_printf(m, "Plane blocked on %s at seqno %x, next seqno %x [current breadcrumb %x], completed? %d\n",
engine->name,
i915_gem_request_get_seqno(req),
dev_priv->next_seqno,
engine->get_seqno(engine),
i915_gem_request_completed(req, true));
}
seq_printf(m, "Flip queued on frame %d, now %d\n",
pending ? work->flip_queued_vblank : -1,
intel_crtc_get_vblank_counter(crtc));
}
static int i915_gem_pageflip_info(struct seq_file *m, void *data) static int i915_gem_pageflip_info(struct seq_file *m, void *data)
{ {
struct drm_info_node *node = m->private; struct drm_info_node *node = m->private;
...@@ -656,13 +610,48 @@ static int i915_gem_pageflip_info(struct seq_file *m, void *data) ...@@ -656,13 +610,48 @@ static int i915_gem_pageflip_info(struct seq_file *m, void *data)
struct intel_flip_work *work; struct intel_flip_work *work;
spin_lock_irq(&dev->event_lock); spin_lock_irq(&dev->event_lock);
if (list_empty(&crtc->flip_work)) { work = crtc->flip_work;
if (work == NULL) {
seq_printf(m, "No flip due on pipe %c (plane %c)\n", seq_printf(m, "No flip due on pipe %c (plane %c)\n",
pipe, plane); pipe, plane);
} else { } else {
list_for_each_entry(work, &crtc->flip_work, head) { u32 pending;
i915_dump_pageflip(m, dev_priv, crtc, work); u32 addr;
seq_puts(m, "\n");
pending = atomic_read(&work->pending);
if (pending) {
seq_printf(m, "Flip ioctl preparing on pipe %c (plane %c)\n",
pipe, plane);
} else {
seq_printf(m, "Flip pending (waiting for vsync) on pipe %c (plane %c)\n",
pipe, plane);
}
if (work->flip_queued_req) {
struct intel_engine_cs *engine = i915_gem_request_get_engine(work->flip_queued_req);
seq_printf(m, "Flip queued on %s at seqno %x, next seqno %x [current breadcrumb %x], completed? %d\n",
engine->name,
i915_gem_request_get_seqno(work->flip_queued_req),
dev_priv->next_seqno,
engine->get_seqno(engine),
i915_gem_request_completed(work->flip_queued_req, true));
} else
seq_printf(m, "Flip not associated with any ring\n");
seq_printf(m, "Flip queued on frame %d, (was ready on frame %d), now %d\n",
work->flip_queued_vblank,
work->flip_ready_vblank,
intel_crtc_get_vblank_counter(crtc));
seq_printf(m, "%d prepares\n", atomic_read(&work->pending));
if (INTEL_INFO(dev)->gen >= 4)
addr = I915_HI_DISPBASE(I915_READ(DSPSURF(crtc->plane)));
else
addr = I915_READ(DSPADDR(crtc->plane));
seq_printf(m, "Current scanout address 0x%08x\n", addr);
if (work->pending_flip_obj) {
seq_printf(m, "New framebuffer address 0x%08lx\n", (long)work->gtt_offset);
seq_printf(m, "MMIO update completed? %d\n", addr == work->gtt_offset);
} }
} }
spin_unlock_irq(&dev->event_lock); spin_unlock_irq(&dev->event_lock);
......
...@@ -618,6 +618,11 @@ struct drm_i915_display_funcs { ...@@ -618,6 +618,11 @@ struct drm_i915_display_funcs {
void (*audio_codec_disable)(struct intel_encoder *encoder); void (*audio_codec_disable)(struct intel_encoder *encoder);
void (*fdi_link_train)(struct drm_crtc *crtc); void (*fdi_link_train)(struct drm_crtc *crtc);
void (*init_clock_gating)(struct drm_device *dev); void (*init_clock_gating)(struct drm_device *dev);
int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_i915_gem_object *obj,
struct drm_i915_gem_request *req,
uint32_t flags);
void (*hpd_irq_setup)(struct drm_i915_private *dev_priv); void (*hpd_irq_setup)(struct drm_i915_private *dev_priv);
/* clock updates for mode set */ /* clock updates for mode set */
/* cursor updates */ /* cursor updates */
......
...@@ -136,12 +136,6 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = { ...@@ -136,12 +136,6 @@ static const u32 hpd_bxt[HPD_NUM_PINS] = {
POSTING_READ(type##IIR); \ POSTING_READ(type##IIR); \
} while (0) } while (0)
static void
intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, unsigned pipe)
{
DRM_DEBUG_KMS("Finished page flip\n");
}
/* /*
* We should clear IMR at preinstall/uninstall, and just check at postinstall. * We should clear IMR at preinstall/uninstall, and just check at postinstall.
*/ */
...@@ -1637,11 +1631,16 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir) ...@@ -1637,11 +1631,16 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
} }
} }
static void intel_pipe_handle_vblank(struct drm_i915_private *dev_priv, static bool intel_pipe_handle_vblank(struct drm_i915_private *dev_priv,
enum pipe pipe) enum pipe pipe)
{ {
if (drm_handle_vblank(dev_priv->dev, pipe)) bool ret;
ret = drm_handle_vblank(dev_priv->dev, pipe);
if (ret)
intel_finish_page_flip_mmio(dev_priv, pipe); intel_finish_page_flip_mmio(dev_priv, pipe);
return ret;
} }
static void valleyview_pipestat_irq_ack(struct drm_i915_private *dev_priv, static void valleyview_pipestat_irq_ack(struct drm_i915_private *dev_priv,
...@@ -1708,8 +1707,9 @@ static void valleyview_pipestat_irq_handler(struct drm_i915_private *dev_priv, ...@@ -1708,8 +1707,9 @@ static void valleyview_pipestat_irq_handler(struct drm_i915_private *dev_priv,
enum pipe pipe; enum pipe pipe;
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS) if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS &&
intel_pipe_handle_vblank(dev_priv, pipe); intel_pipe_handle_vblank(dev_priv, pipe))
intel_check_page_flip(dev_priv, pipe);
if (pipe_stats[pipe] & PLANE_FLIP_DONE_INT_STATUS_VLV) if (pipe_stats[pipe] & PLANE_FLIP_DONE_INT_STATUS_VLV)
intel_finish_page_flip_cs(dev_priv, pipe); intel_finish_page_flip_cs(dev_priv, pipe);
...@@ -2155,8 +2155,9 @@ static void ilk_display_irq_handler(struct drm_i915_private *dev_priv, ...@@ -2155,8 +2155,9 @@ static void ilk_display_irq_handler(struct drm_i915_private *dev_priv,
DRM_ERROR("Poison interrupt\n"); DRM_ERROR("Poison interrupt\n");
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
if (de_iir & DE_PIPE_VBLANK(pipe)) if (de_iir & DE_PIPE_VBLANK(pipe) &&
intel_pipe_handle_vblank(dev_priv, pipe); intel_pipe_handle_vblank(dev_priv, pipe))
intel_check_page_flip(dev_priv, pipe);
if (de_iir & DE_PIPE_FIFO_UNDERRUN(pipe)) if (de_iir & DE_PIPE_FIFO_UNDERRUN(pipe))
intel_cpu_fifo_underrun_irq_handler(dev_priv, pipe); intel_cpu_fifo_underrun_irq_handler(dev_priv, pipe);
...@@ -2205,8 +2206,9 @@ static void ivb_display_irq_handler(struct drm_i915_private *dev_priv, ...@@ -2205,8 +2206,9 @@ static void ivb_display_irq_handler(struct drm_i915_private *dev_priv,
intel_opregion_asle_intr(dev_priv); intel_opregion_asle_intr(dev_priv);
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
if (de_iir & (DE_PIPE_VBLANK_IVB(pipe))) if (de_iir & (DE_PIPE_VBLANK_IVB(pipe)) &&
intel_pipe_handle_vblank(dev_priv, pipe); intel_pipe_handle_vblank(dev_priv, pipe))
intel_check_page_flip(dev_priv, pipe);
/* plane/pipes map 1:1 on ilk+ */ /* plane/pipes map 1:1 on ilk+ */
if (de_iir & DE_PLANE_FLIP_DONE_IVB(pipe)) if (de_iir & DE_PLANE_FLIP_DONE_IVB(pipe))
...@@ -2405,8 +2407,9 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl) ...@@ -2405,8 +2407,9 @@ gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
I915_WRITE(GEN8_DE_PIPE_IIR(pipe), iir); I915_WRITE(GEN8_DE_PIPE_IIR(pipe), iir);
if (iir & GEN8_PIPE_VBLANK) if (iir & GEN8_PIPE_VBLANK &&
intel_pipe_handle_vblank(dev_priv, pipe); intel_pipe_handle_vblank(dev_priv, pipe))
intel_check_page_flip(dev_priv, pipe);
flip_done = iir; flip_done = iir;
if (INTEL_INFO(dev_priv)->gen >= 9) if (INTEL_INFO(dev_priv)->gen >= 9)
...@@ -3970,6 +3973,37 @@ static int i8xx_irq_postinstall(struct drm_device *dev) ...@@ -3970,6 +3973,37 @@ static int i8xx_irq_postinstall(struct drm_device *dev)
return 0; return 0;
} }
/*
* Returns true when a page flip has completed.
*/
static bool i8xx_handle_vblank(struct drm_i915_private *dev_priv,
int plane, int pipe, u32 iir)
{
u16 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane);
if (!intel_pipe_handle_vblank(dev_priv, pipe))
return false;
if ((iir & flip_pending) == 0)
goto check_page_flip;
/* We detect FlipDone by looking for the change in PendingFlip from '1'
* to '0' on the following vblank, i.e. IIR has the Pendingflip
* asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence
* the flip is completed (no longer pending). Since this doesn't raise
* an interrupt per se, we watch for the change at vblank.
*/
if (I915_READ16(ISR) & flip_pending)
goto check_page_flip;
intel_finish_page_flip_cs(dev_priv, pipe);
return true;
check_page_flip:
intel_check_page_flip(dev_priv, pipe);
return false;
}
static irqreturn_t i8xx_irq_handler(int irq, void *arg) static irqreturn_t i8xx_irq_handler(int irq, void *arg)
{ {
struct drm_device *dev = arg; struct drm_device *dev = arg;
...@@ -4022,8 +4056,13 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg) ...@@ -4022,8 +4056,13 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
notify_ring(&dev_priv->engine[RCS]); notify_ring(&dev_priv->engine[RCS]);
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS) int plane = pipe;
intel_pipe_handle_vblank(dev_priv, pipe); if (HAS_FBC(dev_priv))
plane = !plane;
if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS &&
i8xx_handle_vblank(dev_priv, plane, pipe, iir))
flip_mask &= ~DISPLAY_PLANE_FLIP_PENDING(plane);
if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS) if (pipe_stats[pipe] & PIPE_CRC_DONE_INTERRUPT_STATUS)
i9xx_pipe_crc_irq_handler(dev_priv, pipe); i9xx_pipe_crc_irq_handler(dev_priv, pipe);
...@@ -4123,6 +4162,37 @@ static int i915_irq_postinstall(struct drm_device *dev) ...@@ -4123,6 +4162,37 @@ static int i915_irq_postinstall(struct drm_device *dev)
return 0; return 0;
} }
/*
* Returns true when a page flip has completed.
*/
static bool i915_handle_vblank(struct drm_i915_private *dev_priv,
int plane, int pipe, u32 iir)
{
u32 flip_pending = DISPLAY_PLANE_FLIP_PENDING(plane);
if (!intel_pipe_handle_vblank(dev_priv, pipe))
return false;
if ((iir & flip_pending) == 0)
goto check_page_flip;
/* We detect FlipDone by looking for the change in PendingFlip from '1'
* to '0' on the following vblank, i.e. IIR has the Pendingflip
* asserted following the MI_DISPLAY_FLIP, but ISR is deasserted, hence
* the flip is completed (no longer pending). Since this doesn't raise
* an interrupt per se, we watch for the change at vblank.
*/
if (I915_READ(ISR) & flip_pending)
goto check_page_flip;
intel_finish_page_flip_cs(dev_priv, pipe);
return true;
check_page_flip:
intel_check_page_flip(dev_priv, pipe);
return false;
}
static irqreturn_t i915_irq_handler(int irq, void *arg) static irqreturn_t i915_irq_handler(int irq, void *arg)
{ {
struct drm_device *dev = arg; struct drm_device *dev = arg;
...@@ -4183,8 +4253,13 @@ static irqreturn_t i915_irq_handler(int irq, void *arg) ...@@ -4183,8 +4253,13 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
notify_ring(&dev_priv->engine[RCS]); notify_ring(&dev_priv->engine[RCS]);
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS) int plane = pipe;
intel_pipe_handle_vblank(dev_priv, pipe); if (HAS_FBC(dev_priv))
plane = !plane;
if (pipe_stats[pipe] & PIPE_VBLANK_INTERRUPT_STATUS &&
i915_handle_vblank(dev_priv, plane, pipe, iir))
flip_mask &= ~DISPLAY_PLANE_FLIP_PENDING(plane);
if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS) if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS)
blc_event = true; blc_event = true;
...@@ -4412,8 +4487,9 @@ static irqreturn_t i965_irq_handler(int irq, void *arg) ...@@ -4412,8 +4487,9 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
notify_ring(&dev_priv->engine[VCS]); notify_ring(&dev_priv->engine[VCS]);
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS) if (pipe_stats[pipe] & PIPE_START_VBLANK_INTERRUPT_STATUS &&
intel_pipe_handle_vblank(dev_priv, pipe); i915_handle_vblank(dev_priv, pipe, pipe, iir))
flip_mask &= ~DISPLAY_PLANE_FLIP_PENDING(pipe);
if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS) if (pipe_stats[pipe] & PIPE_LEGACY_BLC_EVENT_STATUS)
blc_event = true; blc_event = true;
......
...@@ -49,6 +49,7 @@ struct i915_params i915 __read_mostly = { ...@@ -49,6 +49,7 @@ struct i915_params i915 __read_mostly = {
.invert_brightness = 0, .invert_brightness = 0,
.disable_display = 0, .disable_display = 0,
.enable_cmd_parser = 1, .enable_cmd_parser = 1,
.use_mmio_flip = 0,
.mmio_debug = 0, .mmio_debug = 0,
.verbose_state_checks = 1, .verbose_state_checks = 1,
.nuclear_pageflip = 0, .nuclear_pageflip = 0,
...@@ -173,6 +174,10 @@ module_param_named_unsafe(enable_cmd_parser, i915.enable_cmd_parser, int, 0600); ...@@ -173,6 +174,10 @@ module_param_named_unsafe(enable_cmd_parser, i915.enable_cmd_parser, int, 0600);
MODULE_PARM_DESC(enable_cmd_parser, MODULE_PARM_DESC(enable_cmd_parser,
"Enable command parsing (1=enabled [default], 0=disabled)"); "Enable command parsing (1=enabled [default], 0=disabled)");
module_param_named_unsafe(use_mmio_flip, i915.use_mmio_flip, int, 0600);
MODULE_PARM_DESC(use_mmio_flip,
"use MMIO flips (-1=never, 0=driver discretion [default], 1=always)");
module_param_named(mmio_debug, i915.mmio_debug, int, 0600); module_param_named(mmio_debug, i915.mmio_debug, int, 0600);
MODULE_PARM_DESC(mmio_debug, MODULE_PARM_DESC(mmio_debug,
"Enable the MMIO debug code for the first N failures (default: off). " "Enable the MMIO debug code for the first N failures (default: off). "
......
...@@ -46,6 +46,7 @@ struct i915_params { ...@@ -46,6 +46,7 @@ struct i915_params {
int invert_brightness; int invert_brightness;
int enable_cmd_parser; int enable_cmd_parser;
int guc_log_level; int guc_log_level;
int use_mmio_flip;
int mmio_debug; int mmio_debug;
int edp_vswing; int edp_vswing;
unsigned int inject_load_failure; unsigned int inject_load_failure;
......
...@@ -311,17 +311,6 @@ intel_atomic_state_alloc(struct drm_device *dev) ...@@ -311,17 +311,6 @@ intel_atomic_state_alloc(struct drm_device *dev)
void intel_atomic_state_clear(struct drm_atomic_state *s) void intel_atomic_state_clear(struct drm_atomic_state *s)
{ {
struct intel_atomic_state *state = to_intel_atomic_state(s); struct intel_atomic_state *state = to_intel_atomic_state(s);
int i;
for (i = 0; i < ARRAY_SIZE(state->work); i++) {
struct intel_flip_work *work = state->work[i];
if (work)
intel_free_flip_work(work);
state->work[i] = NULL;
}
drm_atomic_state_default_clear(&state->base); drm_atomic_state_default_clear(&state->base);
state->dpll_set = state->modeset = false; state->dpll_set = state->modeset = false;
} }
...@@ -102,7 +102,6 @@ intel_plane_destroy_state(struct drm_plane *plane, ...@@ -102,7 +102,6 @@ intel_plane_destroy_state(struct drm_plane *plane,
struct drm_plane_state *state) struct drm_plane_state *state)
{ {
WARN_ON(state && to_intel_plane_state(state)->wait_req); WARN_ON(state && to_intel_plane_state(state)->wait_req);
WARN_ON(state && state->fence);
drm_atomic_helper_plane_destroy_state(plane, state); drm_atomic_helper_plane_destroy_state(plane, state);
} }
......
This diff is collapsed.
...@@ -304,8 +304,6 @@ struct intel_atomic_state { ...@@ -304,8 +304,6 @@ struct intel_atomic_state {
unsigned int active_crtcs; unsigned int active_crtcs;
unsigned int min_pixclk[I915_MAX_PIPES]; unsigned int min_pixclk[I915_MAX_PIPES];
struct intel_flip_work *work[I915_MAX_PIPES];
struct intel_shared_dpll_config shared_dpll[I915_NUM_PLLS]; struct intel_shared_dpll_config shared_dpll[I915_NUM_PLLS];
/* /*
...@@ -643,7 +641,7 @@ struct intel_crtc { ...@@ -643,7 +641,7 @@ struct intel_crtc {
unsigned long enabled_power_domains; unsigned long enabled_power_domains;
bool lowfreq_avail; bool lowfreq_avail;
struct intel_overlay *overlay; struct intel_overlay *overlay;
struct list_head flip_work; struct intel_flip_work *flip_work;
atomic_t unpin_work_count; atomic_t unpin_work_count;
...@@ -661,6 +659,9 @@ struct intel_crtc { ...@@ -661,6 +659,9 @@ struct intel_crtc {
struct intel_crtc_state *config; struct intel_crtc_state *config;
/* reset counter value when the last flip was submitted */
unsigned int reset_counter;
/* Access to these should be protected by dev_priv->irq_lock. */ /* Access to these should be protected by dev_priv->irq_lock. */
bool cpu_fifo_underrun_disabled; bool cpu_fifo_underrun_disabled;
bool pch_fifo_underrun_disabled; bool pch_fifo_underrun_disabled;
...@@ -969,28 +970,20 @@ intel_get_crtc_for_plane(struct drm_device *dev, int plane) ...@@ -969,28 +970,20 @@ intel_get_crtc_for_plane(struct drm_device *dev, int plane)
} }
struct intel_flip_work { struct intel_flip_work {
struct list_head head;
struct work_struct unpin_work; struct work_struct unpin_work;
struct work_struct mmio_work; struct work_struct mmio_work;
struct drm_crtc *crtc;
struct drm_framebuffer *old_fb;
struct drm_i915_gem_object *pending_flip_obj;
struct drm_pending_vblank_event *event; struct drm_pending_vblank_event *event;
atomic_t pending; atomic_t pending;
u32 flip_count;
u32 gtt_offset;
struct drm_i915_gem_request *flip_queued_req;
u32 flip_queued_vblank; u32 flip_queued_vblank;
u32 flip_ready_vblank;
unsigned put_power_domains; unsigned int rotation;
unsigned num_planes;
bool can_async_unpin, free_new_crtc_state;
unsigned fb_bits;
unsigned num_old_connectors, num_new_connectors;
struct drm_connector_state **old_connector_state;
struct drm_connector_state **new_connector_state;
struct intel_crtc_state *old_crtc_state, *new_crtc_state;
struct intel_plane_state *old_plane_state[I915_MAX_PLANES + 1];
struct intel_plane_state *new_plane_state[I915_MAX_PLANES + 1];
}; };
struct intel_load_detect_pipe { struct intel_load_detect_pipe {
...@@ -1149,7 +1142,6 @@ unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info ...@@ -1149,7 +1142,6 @@ unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info
bool intel_has_pending_fb_unpin(struct drm_device *dev); bool intel_has_pending_fb_unpin(struct drm_device *dev);
void intel_mark_busy(struct drm_i915_private *dev_priv); void intel_mark_busy(struct drm_i915_private *dev_priv);
void intel_mark_idle(struct drm_i915_private *dev_priv); void intel_mark_idle(struct drm_i915_private *dev_priv);
void intel_free_flip_work(struct intel_flip_work *work);
void intel_crtc_restore_mode(struct drm_crtc *crtc); void intel_crtc_restore_mode(struct drm_crtc *crtc);
int intel_display_suspend(struct drm_device *dev); int intel_display_suspend(struct drm_device *dev);
void intel_encoder_destroy(struct drm_encoder *encoder); void intel_encoder_destroy(struct drm_encoder *encoder);
...@@ -1202,8 +1194,9 @@ struct drm_framebuffer * ...@@ -1202,8 +1194,9 @@ struct drm_framebuffer *
__intel_framebuffer_create(struct drm_device *dev, __intel_framebuffer_create(struct drm_device *dev,
struct drm_mode_fb_cmd2 *mode_cmd, struct drm_mode_fb_cmd2 *mode_cmd,
struct drm_i915_gem_object *obj); struct drm_i915_gem_object *obj);
void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe);
void intel_finish_page_flip_mmio(struct drm_i915_private *dev_priv, int pipe); void intel_finish_page_flip_mmio(struct drm_i915_private *dev_priv, int pipe);
void intel_check_page_flip(struct drm_i915_private *dev_priv, int pipe);
int intel_prepare_plane_fb(struct drm_plane *plane, int intel_prepare_plane_fb(struct drm_plane *plane,
const struct drm_plane_state *new_state); const struct drm_plane_state *new_state);
void intel_cleanup_plane_fb(struct drm_plane *plane, void intel_cleanup_plane_fb(struct drm_plane *plane,
...@@ -1427,15 +1420,11 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev) ...@@ -1427,15 +1420,11 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev)
void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
struct drm_atomic_state *state); struct drm_atomic_state *state);
bool intel_fbc_is_active(struct drm_i915_private *dev_priv); bool intel_fbc_is_active(struct drm_i915_private *dev_priv);
void intel_fbc_pre_update(struct intel_crtc *crtc, void intel_fbc_pre_update(struct intel_crtc *crtc);
struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state);
void intel_fbc_post_update(struct intel_crtc *crtc); void intel_fbc_post_update(struct intel_crtc *crtc);
void intel_fbc_init(struct drm_i915_private *dev_priv); void intel_fbc_init(struct drm_i915_private *dev_priv);
void intel_fbc_init_pipe_state(struct drm_i915_private *dev_priv); void intel_fbc_init_pipe_state(struct drm_i915_private *dev_priv);
void intel_fbc_enable(struct intel_crtc *crtc, void intel_fbc_enable(struct intel_crtc *crtc);
struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state);
void intel_fbc_disable(struct intel_crtc *crtc); void intel_fbc_disable(struct intel_crtc *crtc);
void intel_fbc_global_disable(struct drm_i915_private *dev_priv); void intel_fbc_global_disable(struct drm_i915_private *dev_priv);
void intel_fbc_invalidate(struct drm_i915_private *dev_priv, void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
......
...@@ -480,10 +480,10 @@ static void intel_fbc_deactivate(struct drm_i915_private *dev_priv) ...@@ -480,10 +480,10 @@ static void intel_fbc_deactivate(struct drm_i915_private *dev_priv)
intel_fbc_hw_deactivate(dev_priv); intel_fbc_hw_deactivate(dev_priv);
} }
static bool multiple_pipes_ok(struct intel_crtc *crtc, static bool multiple_pipes_ok(struct intel_crtc *crtc)
struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
struct drm_plane *primary = crtc->base.primary;
struct intel_fbc *fbc = &dev_priv->fbc; struct intel_fbc *fbc = &dev_priv->fbc;
enum pipe pipe = crtc->pipe; enum pipe pipe = crtc->pipe;
...@@ -491,7 +491,9 @@ static bool multiple_pipes_ok(struct intel_crtc *crtc, ...@@ -491,7 +491,9 @@ static bool multiple_pipes_ok(struct intel_crtc *crtc,
if (!no_fbc_on_multiple_pipes(dev_priv)) if (!no_fbc_on_multiple_pipes(dev_priv))
return true; return true;
if (plane_state->visible) WARN_ON(!drm_modeset_is_locked(&primary->mutex));
if (to_intel_plane_state(primary->state)->visible)
fbc->visible_pipes_mask |= (1 << pipe); fbc->visible_pipes_mask |= (1 << pipe);
else else
fbc->visible_pipes_mask &= ~(1 << pipe); fbc->visible_pipes_mask &= ~(1 << pipe);
...@@ -706,16 +708,21 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc) ...@@ -706,16 +708,21 @@ static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc *crtc)
return effective_w <= max_w && effective_h <= max_h; return effective_w <= max_w && effective_h <= max_h;
} }
static void intel_fbc_update_state_cache(struct intel_crtc *crtc, static void intel_fbc_update_state_cache(struct intel_crtc *crtc)
struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
struct intel_fbc *fbc = &dev_priv->fbc; struct intel_fbc *fbc = &dev_priv->fbc;
struct intel_fbc_state_cache *cache = &fbc->state_cache; struct intel_fbc_state_cache *cache = &fbc->state_cache;
struct intel_crtc_state *crtc_state =
to_intel_crtc_state(crtc->base.state);
struct intel_plane_state *plane_state =
to_intel_plane_state(crtc->base.primary->state);
struct drm_framebuffer *fb = plane_state->base.fb; struct drm_framebuffer *fb = plane_state->base.fb;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
WARN_ON(!drm_modeset_is_locked(&crtc->base.mutex));
WARN_ON(!drm_modeset_is_locked(&crtc->base.primary->mutex));
cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags; cache->crtc.mode_flags = crtc_state->base.adjusted_mode.flags;
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
cache->crtc.hsw_bdw_pixel_rate = cache->crtc.hsw_bdw_pixel_rate =
...@@ -880,9 +887,7 @@ static bool intel_fbc_reg_params_equal(struct intel_fbc_reg_params *params1, ...@@ -880,9 +887,7 @@ static bool intel_fbc_reg_params_equal(struct intel_fbc_reg_params *params1,
return memcmp(params1, params2, sizeof(*params1)) == 0; return memcmp(params1, params2, sizeof(*params1)) == 0;
} }
void intel_fbc_pre_update(struct intel_crtc *crtc, void intel_fbc_pre_update(struct intel_crtc *crtc)
struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
struct intel_fbc *fbc = &dev_priv->fbc; struct intel_fbc *fbc = &dev_priv->fbc;
...@@ -892,7 +897,7 @@ void intel_fbc_pre_update(struct intel_crtc *crtc, ...@@ -892,7 +897,7 @@ void intel_fbc_pre_update(struct intel_crtc *crtc,
mutex_lock(&fbc->lock); mutex_lock(&fbc->lock);
if (!multiple_pipes_ok(crtc, plane_state)) { if (!multiple_pipes_ok(crtc)) {
fbc->no_fbc_reason = "more than one pipe active"; fbc->no_fbc_reason = "more than one pipe active";
goto deactivate; goto deactivate;
} }
...@@ -900,7 +905,7 @@ void intel_fbc_pre_update(struct intel_crtc *crtc, ...@@ -900,7 +905,7 @@ void intel_fbc_pre_update(struct intel_crtc *crtc,
if (!fbc->enabled || fbc->crtc != crtc) if (!fbc->enabled || fbc->crtc != crtc)
goto unlock; goto unlock;
intel_fbc_update_state_cache(crtc, crtc_state, plane_state); intel_fbc_update_state_cache(crtc);
deactivate: deactivate:
intel_fbc_deactivate(dev_priv); intel_fbc_deactivate(dev_priv);
...@@ -1084,9 +1089,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, ...@@ -1084,9 +1089,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
* intel_fbc_enable multiple times for the same pipe without an * intel_fbc_enable multiple times for the same pipe without an
* intel_fbc_disable in the middle, as long as it is deactivated. * intel_fbc_disable in the middle, as long as it is deactivated.
*/ */
void intel_fbc_enable(struct intel_crtc *crtc, void intel_fbc_enable(struct intel_crtc *crtc)
struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = crtc->base.dev->dev_private; struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;
struct intel_fbc *fbc = &dev_priv->fbc; struct intel_fbc *fbc = &dev_priv->fbc;
...@@ -1099,19 +1102,19 @@ void intel_fbc_enable(struct intel_crtc *crtc, ...@@ -1099,19 +1102,19 @@ void intel_fbc_enable(struct intel_crtc *crtc,
if (fbc->enabled) { if (fbc->enabled) {
WARN_ON(fbc->crtc == NULL); WARN_ON(fbc->crtc == NULL);
if (fbc->crtc == crtc) { if (fbc->crtc == crtc) {
WARN_ON(!crtc_state->enable_fbc); WARN_ON(!crtc->config->enable_fbc);
WARN_ON(fbc->active); WARN_ON(fbc->active);
} }
goto out; goto out;
} }
if (!crtc_state->enable_fbc) if (!crtc->config->enable_fbc)
goto out; goto out;
WARN_ON(fbc->active); WARN_ON(fbc->active);
WARN_ON(fbc->crtc != NULL); WARN_ON(fbc->crtc != NULL);
intel_fbc_update_state_cache(crtc, crtc_state, plane_state); intel_fbc_update_state_cache(crtc);
if (intel_fbc_alloc_cfb(crtc)) { if (intel_fbc_alloc_cfb(crtc)) {
fbc->no_fbc_reason = "not enough stolen memory"; fbc->no_fbc_reason = "not enough stolen memory";
goto out; goto out;
......
...@@ -260,7 +260,9 @@ int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv, int enabl ...@@ -260,7 +260,9 @@ int intel_sanitize_enable_execlists(struct drm_i915_private *dev_priv, int enabl
if (enable_execlists == 0) if (enable_execlists == 0)
return 0; return 0;
if (HAS_LOGICAL_RING_CONTEXTS(dev_priv) && USES_PPGTT(dev_priv)) if (HAS_LOGICAL_RING_CONTEXTS(dev_priv) &&
USES_PPGTT(dev_priv) &&
i915.use_mmio_flip >= 0)
return 1; return 1;
return 0; return 0;
......
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