Atomic page flip WIP
Subsystems (3)
RFC PATCH 1/1 Atomic page flip WIP
I'm posting this as rather raw just to get a bit more substance to the discussions.
The drm_flip thingy may seem a bit too mid-layerish for people's taste, but at least it is almost completely driven by explicit function calls from the driver (the wq side is the exception naturally).
I originally wrote drm_flip for Medfield, where I used it syncronize the pipe's primary layer and one or two video overlays (gen3 style overlays). So it's a fairly well proven tehnology. I can post a version of the video overlay code too in case someone would be interested in having drm_planes on gen3 hardware.
This set applies on top of my earlier drm_atomic_4 branch:
https://gitorious.org/vsyrjala/linux/commits/drm_atomic_4
RFC PATCH 1/4 drm/i915: Try to commit single pipe in one go
From: Ville Syrjälä <[email protected]>
--- drivers/gpu/drm/i915/intel_atomic.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_atomic.c +12 -11
@@ -907,6 +907,7 @@ static int apply_config(struct drm_device *dev,for (i =0 ; i < dev->mode_config.num_crtc; i++) {struct intel_crtc_state *st = &s->crtc[i];struct intel_crtc *intel_crtc =to_intel_crtc (st->crtc); +int j;if (st->mode_dirty) { ret =crtc_mode_set (st->crtc);
@@ -925,21 +926,21 @@ static int apply_config(struct drm_device *dev, intel_crtc->cursor_height, intel_crtc->cursor_bo, intel_crtc->cursor_addr); - } -for (i =0 ; i < dev->mode_config.num_plane; i++) { -struct intel_plane_state *st = &s->plane[i]; -struct drm_plane *plane = st->plane; +for (j =0 ; j < dev->mode_config.num_plane; j++) { +struct intel_plane_state *pst = &s->plane[j]; +struct drm_plane *plane = pst->plane; -if (!s->plane[i].dirty) -continue ; +if (!pst->dirty) +continue ; -if (!plane->crtc) -continue ; +if (plane->crtc != st->crtc) +continue ; - ret =intel_commit_plane (plane, plane->crtc, plane->fb, &st->coords, false); -if (ret) -return ret; + ret =intel_commit_plane (plane, plane->crtc, plane->fb, &pst->coords, false); +if (ret) +return ret; + } }for (i =0 ; i < dev->mode_config.num_crtc; i++) {
Signature · 6 lines
1.7.8.6 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 2/4 drm: Add drm_flip helper
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The drm_flip mechanism can be used to implement robust page flipping support, and also to synchronize the flips on multiple hardware scanout engines (eg. CRTCs and overlays).
--- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_flip.c | 374 ++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_flip.h | 244 +++++++++++++++++++++++++++++ 3 files changed, 619 insertions(+), 1 deletions(-) create mode 100644 drivers/gpu/drm/drm_flip.c create mode 100644 include/drm/drm_flip.h
drivers/gpu/drm/Makefile +1 -1
@@ -12,7 +12,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ drm_crtc.o drm_modes.o drm_edid.o \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ - drm_trace_points.o drm_global.o drm_prime.o + drm_trace_points.o drm_global.o drm_prime.o drm_flip.o drm-$(CONFIG_COMPAT) += drm_ioc32.o
drivers/gpu/drm/drm_flip.c new file +374 -0
374 lines not on this page · raw message
include/drm/drm_flip.h new file +244 -0
244 lines not on this page · raw message
Signature · 6 lines
1.7.8.6 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 3/4 drm: i915: Pass gem object to intel_finish_fb()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
intel_finish_fb() has no use for the drm_framebuffer metadata, so pass the gem object directly.
--- drivers/gpu/drm/i915/intel_atomic.c | 2 +- drivers/gpu/drm/i915/intel_display.c | 7 +++---- drivers/gpu/drm/i915/intel_drv.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_atomic.c +1 -1
@@ -797,7 +797,7 @@ static void unpin_work_func(struct work_struct *work)intel_wait_for_vblank (dev, pipe); vblank_waited |=1 << pipe; } -intel_finish_fb (fb); +intel_finish_fb (obj);intel_unpin_fb_obj (obj);mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/i915/intel_display.c +3 -4
@@ -2188,9 +2188,8 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, }int -intel_finish_fb (struct drm_framebuffer *old_fb) +intel_finish_fb (struct drm_i915_gem_object *obj) { -struct drm_i915_gem_object *obj =to_intel_framebuffer (old_fb)->obj;struct drm_i915_private *dev_priv = obj->base.dev->dev_private;bool was_interruptible = dev_priv->mm.interruptible;int ret;
@@ -2250,7 +2249,7 @@ _intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, }if (old_fb) -intel_finish_fb (old_fb); +intel_finish_fb (to_intel_framebuffer (old_fb)->obj); ret = dev_priv->display.update_plane (crtc, crtc->fb, x, y);if (ret) {
@@ -2862,7 +2861,7 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)return ;mutex_lock (&dev->struct_mutex); -intel_finish_fb (crtc->fb); +intel_finish_fb (to_intel_framebuffer (crtc->fb)->obj);mutex_unlock (&dev->struct_mutex); }
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -440,7 +440,7 @@ extern int intel_pin_and_fence_fb_obj(struct drm_device *dev,struct drm_i915_gem_object *obj, struct intel_ring_buffer *pipelined);extern void intel_unpin_fb_obj (struct drm_i915_gem_object *obj); -extern int intel_finish_fb (struct drm_framebuffer *fb); +extern int intel_finish_fb (struct drm_i915_gem_object *obj); extern int intel_framebuffer_init(struct drm_device *dev, struct intel_framebuffer *ifb,
Signature · 6 lines
1.7.8.6 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 4/4 drm: i915: Atomic pageflip WIP
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Use the drm_flip helper to implement atomic page flipping.
Work in progress. Ignore the huge mess in intel_sprite.c for now.
--- drivers/gpu/drm/i915/i915_drv.h | 4 + drivers/gpu/drm/i915/i915_irq.c | 10 +- drivers/gpu/drm/i915/intel_atomic.c | 449 +++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_display.c | 171 +++++++++---- drivers/gpu/drm/i915/intel_drv.h | 29 +++ drivers/gpu/drm/i915/intel_sprite.c | 386 ++++++++++++++++++----------- 6 files changed, 841 insertions(+), 208 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -41,6 +41,8 @@#include <linux/intel-iommu.h> #include <linux/kref.h> +#include "drm_flip.h" +/* General customization: */
@@ -845,6 +847,8 @@ typedef struct drm_i915_private {struct work_struct parity_error_work;bool hw_contexts_disabled;uint32_t hw_context_size; + +struct drm_flip_driver flip_driver; } drm_i915_private_t;/* Iterate over initialised rings */
drivers/gpu/drm/i915/i915_irq.c +6 -4
@@ -37,6 +37,8 @@#include "i915_trace.h" #include "intel_drv.h" +void intel_handle_vblank (struct drm_device *dev,int pipe); +/* For display hotplug interrupt */ static void ironlake_enable_display_irq (drm_i915_private_t *dev_priv,u32 mask)
@@ -548,7 +550,7 @@ static irqreturn_t valleyview_irq_handler(DRM_IRQ_ARGS)for_each_pipe (pipe) {if (pipe_stats[pipe] &PIPE_VBLANK_INTERRUPT_STATUS ) -drm_handle_vblank (dev, pipe); +intel_handle_vblank (dev, pipe);if (pipe_stats[pipe] &PLANE_FLIPDONE_INT_STATUS_VLV ) {intel_prepare_page_flip (dev, pipe);
@@ -686,7 +688,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)intel_finish_page_flip_plane (dev, i); }if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i))) -drm_handle_vblank (dev, i); +intel_handle_vblank (dev, i); }/* check event from PCH */
@@ -779,10 +781,10 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS) }if (de_iir &DE_PIPEA_VBLANK ) -drm_handle_vblank (dev,0 ); +intel_handle_vblank (dev,0 );if (de_iir &DE_PIPEB_VBLANK ) -drm_handle_vblank (dev,1 ); +intel_handle_vblank (dev,1 );/* check event from PCH */ if (de_iir &DE_PCH_EVENT ) {
drivers/gpu/drm/i915/intel_atomic.c +441 -8
491 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +119 -52
280 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +29 -0
@@ -31,6 +31,7 @@#include "drm_crtc.h" #include "drm_crtc_helper.h" #include "drm_fb_helper.h" +#include "drm_flip.h" #define _wait_for (COND ,MS ,W ) ({ \ unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \
@@ -162,6 +163,21 @@ struct intel_connector {struct intel_encoder *encoder; }; +struct intel_plane_regs { +u32 cntr; +u32 addr; +u32 linoff; +u32 stride; +u32 pos; +u32 size; +u32 keyval; +u32 keymsk; +u32 surf; +u32 keymaxval; +u32 tileoff; +u32 scale; +}; +struct intel_crtc {struct drm_crtc base;enum pipe pipe;
@@ -191,6 +207,12 @@ struct intel_crtc {/* We can share PLLs across outputs if the timings match */ struct intel_pch_pll *pch_pll; + +struct intel_plane_regs primary_regs; + +struct drm_flip_helper flip_helper; +wait_queue_head_t vbl_wait; +bool vbl_received; };struct intel_plane_coords {
@@ -208,6 +230,7 @@ struct intel_plane {struct drm_i915_gem_object *obj;int max_downscale;u32 lut_r[1024 ], lut_g[1024 ], lut_b[1024 ]; +struct intel_plane_regs regs;void (*update_plane)(struct drm_plane *plane,struct drm_framebuffer *fb,const struct intel_plane_coords *clip);
@@ -216,6 +239,7 @@ struct intel_plane { struct drm_intel_sprite_colorkey *key);void (*get_colorkey)(struct drm_plane *plane,struct drm_intel_sprite_colorkey *key); +struct drm_flip_helper flip_helper; };struct intel_watermark_params {
@@ -525,4 +549,9 @@ extern void intel_crtc_cursor_commit(struct drm_crtc *crtc, uint32_t handle,struct drm_i915_gem_object *obj, uint32_t addr); +extern int intel_calc_primary (struct drm_crtc *crtc, +struct drm_framebuffer *fb,int x,int y); +extern void intel_prepare_primary (struct drm_crtc *crtc); +extern void intel_commit_primary (struct drm_crtc *crtc); +#endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_sprite.c +242 -144
602 lines not on this page · raw message
Signature · 6 lines
1.7.8.6 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
drivers/gpu/drm/i915/intel_atomic.c void intel_atomic_fini(struct drm_device *dev) · line 1589
Quoted 10 lines · On Wed, 12 Sep 2012 18:47:07 +0300, [email protected] wrote:
drivers/gpu/drm/i915/intel_atomic.c +10
-0+static void intel_flip_finish (struct drm_flip *flip) +{ +struct intel_flip *intel_flip = + container_of(flip, struct intel_flip, base); +struct drm_device *dev = intel_flip->crtc->dev; + +if (intel_flip->old_bo) { +mutex_lock (&dev->struct_mutex); + +intel_finish_fb (intel_flip->old_bo);
So if I understand correctly, this code is called after the flip is already complete?
The intel_finish_fb() exists to flush pending batches and flips on the current fb, prior to changing the scanout registers. (There is a hardware dependency such that the GPU may be executing a command that required the current modesetting.) In the case of flip completion, all of those dependencies have already been retired and so the finish should be a no-op. And so it should no be required, nor the changes to intel_finish_fb (which should have included a change in the name to indicate that is now taking the fb_obj).
drivers/gpu/drm/i915/intel_atomic.c void intel_atomic_fini(struct drm_device *dev) · line 1595
Quoted 6 lines
drivers/gpu/drm/i915/intel_atomic.c +6
-0+intel_unpin_fb_obj (intel_flip->old_bo); + +mutex_unlock (&dev->struct_mutex); + } + +}
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
Quoted 14 lines · Chris Wilson
drivers/gpu/drm/i915/intel_atomic.c void intel_atomic_fini(struct drm_device *dev) · line 1589
Quoted 10 lines · On Wed, 12 Sep 2012 18:47:07 +0300, [email protected] wrote:
drivers/gpu/drm/i915/intel_atomic.c +10
-0+static void intel_flip_finish (struct drm_flip *flip) +{ +struct intel_flip *intel_flip = + container_of(flip, struct intel_flip, base); +struct drm_device *dev = intel_flip->crtc->dev; + +if (intel_flip->old_bo) { +mutex_lock (&dev->struct_mutex); + +intel_finish_fb (intel_flip->old_bo);So if I understand correctly, this code is called after the flip is already complete?
Yes.
Quoted 8 lines
The
intel_finish_fb()exists to flush pending batches and flips on the current fb, prior to changing the scanout registers. (There is a hardware dependency such that the GPU may be executing a command that required the current modesetting.) In the case of flip completion, all of those dependencies have already been retired and so the finish should be a no-op. And so it should no be required, nor the changes tointel_finish_fb(which should have included a change in the name to indicate that is now taking thefb_obj).
Actually I'm not quite sure where this intel_finish_fb() call originated. Based on the name it didn't make sense to me, but I left it there for now. Hmm. OK it came from one patch from Imre while I was on vacation. I suppose he got it from intel_pipe_set_base() which does call intel_finish_fb() on the old fb. Why does it do that?
I've not really dug into the GPU synchronization side and pin/fence stuff, so it's no surprise my code is a bit fscked up in those areas.
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
Quoted 27 lines · Ville Syrjälä
Quoted 14 lines · Chris Wilson
drivers/gpu/drm/i915/intel_atomic.c void intel_atomic_fini(struct drm_device *dev) · line 1589
Quoted 10 lines · On Wed, 12 Sep 2012 18:47:07 +0300, [email protected] wrote:
drivers/gpu/drm/i915/intel_atomic.c +10
-0+static void intel_flip_finish (struct drm_flip *flip) +{ +struct intel_flip *intel_flip = + container_of(flip, struct intel_flip, base); +struct drm_device *dev = intel_flip->crtc->dev; + +if (intel_flip->old_bo) { +mutex_lock (&dev->struct_mutex); + +intel_finish_fb (intel_flip->old_bo);So if I understand correctly, this code is called after the flip is already complete?
Yes.
Quoted 8 lines
The
intel_finish_fb()exists to flush pending batches and flips on the current fb, prior to changing the scanout registers. (There is a hardware dependency such that the GPU may be executing a command that required the current modesetting.) In the case of flip completion, all of those dependencies have already been retired and so the finish should be a no-op. And so it should no be required, nor the changes tointel_finish_fb(which should have included a change in the name to indicate that is now taking thefb_obj).
Quoted 5 lines
Actually I'm not quite sure where this
intel_finish_fb()call originated. Based on the name it didn't make sense to me, but I left it there for now. Hmm. OK it came from one patch from Imre while I was on vacation. I suppose he got it fromintel_pipe_set_base()which does callintel_finish_fb()on the old fb. Why does it do that?
It all boils down to the modeset being asynchronous to the GPU processing the command stream. So we may be currently processing a batch that is waiting on the pipe to go past a particular scanline, and if the modesetting were to disable that pipe, or to change its size, then we risk the WAIT_FOR_EVENT never completing - leading to hangcheck detecting the frozen display and an angry user.
The other aspect is to synchronize the modeset with any outstanding pageflips.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
Quoted 34 lines · Chris Wilson
Quoted 27 lines · Ville Syrjälä
Quoted 14 lines · Chris Wilson
drivers/gpu/drm/i915/intel_atomic.c void intel_atomic_fini(struct drm_device *dev) · line 1589
Quoted 10 lines · On Wed, 12 Sep 2012 18:47:07 +0300, [email protected] wrote:
drivers/gpu/drm/i915/intel_atomic.c +10
-0+static void intel_flip_finish (struct drm_flip *flip) +{ +struct intel_flip *intel_flip = + container_of(flip, struct intel_flip, base); +struct drm_device *dev = intel_flip->crtc->dev; + +if (intel_flip->old_bo) { +mutex_lock (&dev->struct_mutex); + +intel_finish_fb (intel_flip->old_bo);So if I understand correctly, this code is called after the flip is already complete?
Yes.
Quoted 8 lines
The
intel_finish_fb()exists to flush pending batches and flips on the current fb, prior to changing the scanout registers. (There is a hardware dependency such that the GPU may be executing a command that required the current modesetting.) In the case of flip completion, all of those dependencies have already been retired and so the finish should be a no-op. And so it should no be required, nor the changes tointel_finish_fb(which should have included a change in the name to indicate that is now taking thefb_obj).Quoted 5 lines
Actually I'm not quite sure where this
intel_finish_fb()call originated. Based on the name it didn't make sense to me, but I left it there for now. Hmm. OK it came from one patch from Imre while I was on vacation. I suppose he got it fromintel_pipe_set_base()which does callintel_finish_fb()on the old fb. Why does it do that?
Quoted 6 lines
It all boils down to the modeset being asynchronous to the GPU processing the command stream. So we may be currently processing a batch that is waiting on the pipe to go past a particular scanline, and if the modesetting were to disable that pipe, or to change its size, then we risk the
WAIT_FOR_EVENTnever completing - leading to hangcheck detecting the frozen display and an angry user.
intel_pipe_set_base() won't disable the pipe or change the size, it'll just flip the primary plane. So that doesn't quite explain why the call is there, as opposed to being called just from the full modeset path.
Also wouldn't any batch buffer with WAIT_FOR_EVENT be in risk of stalling, not just ones related to the old fb?
Quoted 2 lines
The other aspect is to synchronize the modeset with any outstanding pageflips.
Right, that does make sense. But doing it from a function called intel_finish_fb() is a bit confusing, as the condition really shouldn't depend on any specific fb object. But I suppose this is just a result of the "only one outstanding flip" policy.
BTW regarding this WAIT_FOR_EVENT thing. I got the impression that the scanline window wait doesn't work on recent hardware generations any more. Is that true? I was thinking that perhaps I could use it along with the load register command to perform the flips through the command queue.
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
Quoted 4 lines · Ville Syrjälä
intel_pipe_set_base()won't disable the pipe or change the size, it'll just flip the primary plane. So that doesn't quite explain why the call is there, as opposed to being called just from the full modeset path.
intel_pipe_set_base is also called in the modeset case, i.e. when we could potentially change the height of the mode. And if we wait on a large enough scanline which doesn't exist in the new mode this would hang.
The other callsite of finish_fb is from intel_crtc_disable.
btw, some slight digging around with git blame gives you in both cases the commits and comments that explain this all ;-)
Cheers, Daniel
Signature · 2 lines
Daniel Vetter [email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
Quoted 11 lines · Daniel Vetter
Quoted 4 lines · Ville Syrjälä
intel_pipe_set_base()won't disable the pipe or change the size, it'll just flip the primary plane. So that doesn't quite explain why the call is there, as opposed to being called just from the full modeset path.
intel_pipe_set_baseis also called in the modeset case, i.e. when we could potentially change the height of the mode. And if we wait on a large enough scanline which doesn't exist in the new mode this would hang.
Yes, I know it's called in both cases. But my point is that there doesn't seem to be any reason to call it in the pure set_base case.
Quoted 1 line
The other callsite of
finish_fbis fromintel_crtc_disable.
Yep. There it does make sense to me.
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
In reply to Ville SyrjäläQuoted 42 lines · Ville Syrjälä
Quoted 34 lines · Chris Wilson
Quoted 27 lines · Ville Syrjälä
Quoted 14 lines · Chris Wilson
drivers/gpu/drm/i915/intel_atomic.c void intel_atomic_fini(struct drm_device *dev) · line 1589
Quoted 10 lines · On Wed, 12 Sep 2012 18:47:07 +0300, [email protected] wrote:
drivers/gpu/drm/i915/intel_atomic.c +10
-0+static void intel_flip_finish (struct drm_flip *flip) +{ +struct intel_flip *intel_flip = + container_of(flip, struct intel_flip, base); +struct drm_device *dev = intel_flip->crtc->dev; + +if (intel_flip->old_bo) { +mutex_lock (&dev->struct_mutex); + +intel_finish_fb (intel_flip->old_bo);So if I understand correctly, this code is called after the flip is already complete?
Yes.
Quoted 8 lines
The
intel_finish_fb()exists to flush pending batches and flips on the current fb, prior to changing the scanout registers. (There is a hardware dependency such that the GPU may be executing a command that required the current modesetting.) In the case of flip completion, all of those dependencies have already been retired and so the finish should be a no-op. And so it should no be required, nor the changes tointel_finish_fb(which should have included a change in the name to indicate that is now taking thefb_obj).Quoted 5 lines
Actually I'm not quite sure where this
intel_finish_fb()call originated. Based on the name it didn't make sense to me, but I left it there for now. Hmm. OK it came from one patch from Imre while I was on vacation. I suppose he got it fromintel_pipe_set_base()which does callintel_finish_fb()on the old fb. Why does it do that?Quoted 6 lines
It all boils down to the modeset being asynchronous to the GPU processing the command stream. So we may be currently processing a batch that is waiting on the pipe to go past a particular scanline, and if the modesetting were to disable that pipe, or to change its size, then we risk the
WAIT_FOR_EVENTnever completing - leading to hangcheck detecting the frozen display and an angry user.
Quoted 4 lines
intel_pipe_set_base()won't disable the pipe or change the size, it'll just flip the primary plane. So that doesn't quite explain why the call is there, as opposed to being called just from the full modeset path.
Hmm, at the time it was a convenient point. Now, it is clearly called too late in the modeset sequence. Daniel, fix please. :)
Quoted 10 lines
Also wouldn't any batch buffer with
WAIT_FOR_EVENTbe in risk of stalling, not just ones related to the old fb?Quoted 2 lines
The other aspect is to synchronize the modeset with any outstanding pageflips.
Right, that does make sense. But doing it from a function called
intel_finish_fb()is a bit confusing, as the condition really shouldn't depend on any specific fb object. But I suppose this is just a result of the "only one outstanding flip" policy.
Again, a nice convenient point, calling it an intel_crtc_wait_*() would probably help (after fixing the ordering).
Quoted 5 lines
BTW regarding this
WAIT_FOR_EVENTthing. I got the impression that the scanline window wait doesn't work on recent hardware generations any more. Is that true? I was thinking that perhaps I could use it along with the load register command to perform the flips through the command queue.
That impression is pretty accurate. There is a suggestion that some form of scanline wait was restored for IVB, but driving it seems pretty hit and miss. Atomic flipping should all be possible with MI_DISPLAY_FLIP, so presumably you are mostly thinking about atomic modeset? Is the presumption that it will be an infrequent request and so better to keep as simple as possible?
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC][PATCH 4/4] drm: i915: Atomic pageflip WIP
Quoted 71 lines · Chris Wilson
Quoted 42 lines · Ville Syrjälä
Quoted 34 lines · Chris Wilson
Quoted 27 lines · Ville Syrjälä
Quoted 14 lines · Chris Wilson
drivers/gpu/drm/i915/intel_atomic.c void intel_atomic_fini(struct drm_device *dev) · line 1589
Quoted 10 lines · On Wed, 12 Sep 2012 18:47:07 +0300, [email protected] wrote:
drivers/gpu/drm/i915/intel_atomic.c +10
-0+static void intel_flip_finish (struct drm_flip *flip) +{ +struct intel_flip *intel_flip = + container_of(flip, struct intel_flip, base); +struct drm_device *dev = intel_flip->crtc->dev; + +if (intel_flip->old_bo) { +mutex_lock (&dev->struct_mutex); + +intel_finish_fb (intel_flip->old_bo);So if I understand correctly, this code is called after the flip is already complete?
Yes.
Quoted 8 lines
The
intel_finish_fb()exists to flush pending batches and flips on the current fb, prior to changing the scanout registers. (There is a hardware dependency such that the GPU may be executing a command that required the current modesetting.) In the case of flip completion, all of those dependencies have already been retired and so the finish should be a no-op. And so it should no be required, nor the changes tointel_finish_fb(which should have included a change in the name to indicate that is now taking thefb_obj).Quoted 5 lines
Actually I'm not quite sure where this
intel_finish_fb()call originated. Based on the name it didn't make sense to me, but I left it there for now. Hmm. OK it came from one patch from Imre while I was on vacation. I suppose he got it fromintel_pipe_set_base()which does callintel_finish_fb()on the old fb. Why does it do that?Quoted 6 lines
It all boils down to the modeset being asynchronous to the GPU processing the command stream. So we may be currently processing a batch that is waiting on the pipe to go past a particular scanline, and if the modesetting were to disable that pipe, or to change its size, then we risk the
WAIT_FOR_EVENTnever completing - leading to hangcheck detecting the frozen display and an angry user.Quoted 4 lines
intel_pipe_set_base()won't disable the pipe or change the size, it'll just flip the primary plane. So that doesn't quite explain why the call is there, as opposed to being called just from the full modeset path.Hmm, at the time it was a convenient point. Now, it is clearly called too late in the modeset sequence. Daniel, fix please. :)
Quoted 10 lines
Also wouldn't any batch buffer with
WAIT_FOR_EVENTbe in risk of stalling, not just ones related to the old fb?Quoted 2 lines
The other aspect is to synchronize the modeset with any outstanding pageflips.
Right, that does make sense. But doing it from a function called
intel_finish_fb()is a bit confusing, as the condition really shouldn't depend on any specific fb object. But I suppose this is just a result of the "only one outstanding flip" policy.Again, a nice convenient point, calling it an intel_crtc_wait_*() would probably help (after fixing the ordering).
Quoted 5 lines
BTW regarding this
WAIT_FOR_EVENTthing. I got the impression that the scanline window wait doesn't work on recent hardware generations any more. Is that true? I was thinking that perhaps I could use it along with the load register command to perform the flips through the command queue.
Quoted 6 lines
That impression is pretty accurate. There is a suggestion that some form of scanline wait was restored for IVB, but driving it seems pretty hit and miss. Atomic flipping should all be possible with
MI_DISPLAY_FLIP, so presumably you are mostly thinking about atomic modeset? Is the presumption that it will be an infrequent request and so better to keep as simple as possible?
MI_DISPLAY_FLIP is _very_ limited. You can't really do anything interesting with. Sure it's enough to flip the buffers of some game or whatever, but it's practically useless for hardware composition type stuff.
Signature · 2 lines
Ville Syrjälä Intel OTC