Skip to content

Commit f06cc1b

Browse files
johnharr-inteldanvet
authored andcommitted
drm/i915: Convert 'flip_queued_seqno' into 'flip_queued_request'
Converted the flip_queued_seqno value to be a request structure as part of the on going seqno to request changes. This includes reference counting the request being saved away to ensure it can not be retired and freed while the flip code is still waiting on it. For: VIZ-4377 Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: Thomas Daniel <Thomas.Daniel@intel.com> [danvet: Again get rid of the _irq request unref by simply moving that into the unpin worker. Doesn't matter when we hang onto the request for a bit longer, and in the unpin worker we already grab the dev->struct_mutex anyway.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 9400ae5 commit f06cc1b

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,11 +544,11 @@ static int i915_gem_pageflip_info(struct seq_file *m, void *data)
544544
if (work->flip_queued_ring) {
545545
seq_printf(m, "Flip queued on %s at seqno %u, next seqno %u [current breadcrumb %u], completed? %d\n",
546546
work->flip_queued_ring->name,
547-
work->flip_queued_seqno,
547+
i915_gem_request_get_seqno(work->flip_queued_req),
548548
dev_priv->next_seqno,
549549
work->flip_queued_ring->get_seqno(work->flip_queued_ring, true),
550550
i915_seqno_passed(work->flip_queued_ring->get_seqno(work->flip_queued_ring, true),
551-
work->flip_queued_seqno));
551+
i915_gem_request_get_seqno(work->flip_queued_req)));
552552
} else
553553
seq_printf(m, "Flip not associated with any ring\n");
554554
seq_printf(m, "Flip queued on frame %d, (was ready on frame %d), now %d\n",

drivers/gpu/drm/i915/intel_display.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9128,6 +9128,11 @@ static void intel_unpin_work_fn(struct work_struct *__work)
91289128
drm_gem_object_unreference(&work->old_fb_obj->base);
91299129

91309130
intel_update_fbc(dev);
9131+
9132+
if (work->flip_queued_req)
9133+
i915_gem_request_unreference(work->flip_queued_req);
9134+
work->flip_queued_req = NULL;
9135+
work->flip_queued_ring = NULL;
91319136
mutex_unlock(&dev->struct_mutex);
91329137

91339138
intel_frontbuffer_flip_complete(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
@@ -9736,10 +9741,14 @@ static bool __intel_pageflip_stall_check(struct drm_device *dev,
97369741
return false;
97379742

97389743
if (work->flip_ready_vblank == 0) {
9739-
if (work->flip_queued_ring &&
9740-
!i915_seqno_passed(work->flip_queued_ring->get_seqno(work->flip_queued_ring, true),
9741-
work->flip_queued_seqno))
9742-
return false;
9744+
if (work->flip_queued_ring) {
9745+
uint32_t s1 = work->flip_queued_ring->get_seqno(
9746+
work->flip_queued_ring, true);
9747+
uint32_t s2 = i915_gem_request_get_seqno(
9748+
work->flip_queued_req);
9749+
if (!i915_seqno_passed(s1, s2))
9750+
return false;
9751+
}
97439752

97449753
work->flip_ready_vblank = drm_vblank_count(dev, intel_crtc->pipe);
97459754
}
@@ -9903,17 +9912,17 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
99039912
if (ret)
99049913
goto cleanup_unpin;
99059914

9906-
work->flip_queued_seqno =
9907-
i915_gem_request_get_seqno(obj->last_write_req);
9915+
i915_gem_request_assign(&work->flip_queued_req,
9916+
obj->last_write_req);
99089917
work->flip_queued_ring = obj->ring;
99099918
} else {
99109919
ret = dev_priv->display.queue_flip(dev, crtc, fb, obj, ring,
99119920
page_flip_flags);
99129921
if (ret)
99139922
goto cleanup_unpin;
99149923

9915-
work->flip_queued_seqno =
9916-
i915_gem_request_get_seqno(intel_ring_get_request(ring));
9924+
i915_gem_request_assign(&work->flip_queued_req,
9925+
intel_ring_get_request(ring));
99179926
work->flip_queued_ring = ring;
99189927
}
99199928

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ struct intel_unpin_work {
708708
u32 flip_count;
709709
u32 gtt_offset;
710710
struct intel_engine_cs *flip_queued_ring;
711-
u32 flip_queued_seqno;
711+
struct drm_i915_gem_request *flip_queued_req;
712712
int flip_queued_vblank;
713713
int flip_ready_vblank;
714714
bool enable_stall_check;

0 commit comments

Comments
 (0)