* Re: [PATCH 4/5] drm/i915: Add async page flip support for IVB [not found] <CAKMK7uFiL+p48Phwc=jmWtsOgjNOYJzTCWmHe3Bp7-jWMpTtTA@mail.gmail.com> @ 2013-07-25 22:15 ` Keith Packard 2013-07-25 22:15 ` [PATCH 1/2] " Keith Packard 2013-07-25 22:15 ` [PATCH 2/2] drm/i915: Add async page flip support for SNB Keith Packard 0 siblings, 2 replies; 5+ messages in thread From: Keith Packard @ 2013-07-25 22:15 UTC (permalink / raw) To: intel-gfx, Daniel Vetter; +Cc: linux-kernel, dri-devel, Keith Packard > Generally I think checking our current sw state instead of reading hw > registers would be safer, e.g. in case we start to queue up more than > one pageflip. For async pageflips in benchmark mode "flip as fast as > you can queue" would be a sensible mode. Ok, I've moved the tiling checks to the general code and removed the stride checks as those are already present there. These were moved to the general code because the pointer to the previous FB has already been overwritten by the time the queue_flip functions are called. This should be followed by replacements for the last to patches in the series. -keith ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] drm/i915: Add async page flip support for IVB 2013-07-25 22:15 ` [PATCH 4/5] drm/i915: Add async page flip support for IVB Keith Packard @ 2013-07-25 22:15 ` Keith Packard 2013-07-30 16:42 ` Ville Syrjälä 2013-07-25 22:15 ` [PATCH 2/2] drm/i915: Add async page flip support for SNB Keith Packard 1 sibling, 1 reply; 5+ messages in thread From: Keith Packard @ 2013-07-25 22:15 UTC (permalink / raw) To: intel-gfx, Daniel Vetter; +Cc: linux-kernel, dri-devel, Keith Packard This adds the necesary register defines for async page flipping through the command ring, and then hooks those up for Ivybridge (gen7) page flipping. Signed-off-by: Keith Packard <keithp@keithp.com> --- drivers/gpu/drm/i915/i915_reg.h | 6 ++++++ drivers/gpu/drm/i915/intel_display.c | 37 ++++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index dc3d6a7..029cfb0 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -209,6 +209,7 @@ #define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0) #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2) #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1) +#define MI_DISPLAY_FLIP_ASYNC_INDICATOR (1 << 22) #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20) /* IVB has funny definitions for which plane to flip. */ #define MI_DISPLAY_FLIP_IVB_PLANE_A (0 << 19) @@ -217,6 +218,11 @@ #define MI_DISPLAY_FLIP_IVB_SPRITE_B (3 << 19) #define MI_DISPLAY_FLIP_IVB_PLANE_C (4 << 19) #define MI_DISPLAY_FLIP_IVB_SPRITE_C (5 << 19) +/* These go in the bottom of the base address value */ +#define MI_DISPLAY_FLIP_TYPE_SYNC (0 << 0) +#define MI_DISPLAY_FLIP_TYPE_ASYNC (1 << 0) +#define MI_DISPLAY_FLIP_TYPE_STEREO (2 << 0) +#define MI_DISPLAY_FLIP_TYPE_SYNCHRONOUS (0 << 0) #define MI_ARB_ON_OFF MI_INSTR(0x08, 0) #define MI_ARB_ENABLE (1<<0) #define MI_ARB_DISABLE (0<<0) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bdb8854..166aa2c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -1833,8 +1833,10 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, alignment = 64 * 1024; break; case I915_TILING_X: - /* pin() will align the object as required by fence */ - alignment = 0; + /* Async page flipping requires X tiling and 32kB alignment, so just + * make all X tiled frame buffers aligned for that + */ + alignment = 32 * 1024; break; case I915_TILING_Y: /* Despite that we check this in framebuffer_init userspace can @@ -7514,6 +7516,8 @@ static int intel_gen7_queue_flip(struct drm_device *dev, struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; uint32_t plane_bit = 0; + uint32_t cmd; + uint32_t base; int ret; ret = intel_pin_and_fence_fb_obj(dev, obj, ring); @@ -7536,13 +7540,21 @@ static int intel_gen7_queue_flip(struct drm_device *dev, goto err_unpin; } + cmd = MI_DISPLAY_FLIP_I915 | plane_bit; + base = i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset; + + if (flags & DRM_MODE_PAGE_FLIP_ASYNC) { + cmd |= MI_DISPLAY_FLIP_ASYNC_INDICATOR; + base |= MI_DISPLAY_FLIP_TYPE_ASYNC; + } + ret = intel_ring_begin(ring, 4); if (ret) goto err_unpin; - intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); + intel_ring_emit(ring, cmd); intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); - intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); + intel_ring_emit(ring, base); intel_ring_emit(ring, (MI_NOOP)); intel_mark_page_flip_active(intel_crtc); @@ -7591,6 +7603,19 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, fb->pitches[0] != crtc->fb->pitches[0])) return -EINVAL; + /* Check tiling restrictions specific to asynchronous flips + */ + if (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) { + + /* New FB must be X tiled */ + if (obj->tiling_mode != I915_TILING_X) + return -EINVAL; + + /* Current FB must be X tiled */ + if (to_intel_framebuffer(old_fb)->obj->tiling_mode != I915_TILING_X) + return -EINVAL; + } + work = kzalloc(sizeof *work, GFP_KERNEL); if (work == NULL) return -ENOMEM; @@ -9705,6 +9730,10 @@ void intel_modeset_init(struct drm_device *dev) dev->mode_config.max_width = 8192; dev->mode_config.max_height = 8192; } + + if (IS_GEN7(dev)) + dev->mode_config.async_page_flip = true; + dev->mode_config.fb_base = dev_priv->gtt.mappable_base; DRM_DEBUG_KMS("%d display pipe%s available.\n", -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/i915: Add async page flip support for IVB 2013-07-25 22:15 ` [PATCH 1/2] " Keith Packard @ 2013-07-30 16:42 ` Ville Syrjälä 0 siblings, 0 replies; 5+ messages in thread From: Ville Syrjälä @ 2013-07-30 16:42 UTC (permalink / raw) To: Keith Packard; +Cc: Daniel Vetter, intel-gfx, linux-kernel, dri-devel On Thu, Jul 25, 2013 at 03:15:14PM -0700, Keith Packard wrote: > This adds the necesary register defines for async page flipping > through the command ring, and then hooks those up for Ivybridge (gen7) > page flipping. Maybe mention hsw in the patch subject/description too. > > Signed-off-by: Keith Packard <keithp@keithp.com> > --- > drivers/gpu/drm/i915/i915_reg.h | 6 ++++++ > drivers/gpu/drm/i915/intel_display.c | 37 ++++++++++++++++++++++++++++++++---- > 2 files changed, 39 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > index dc3d6a7..029cfb0 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -209,6 +209,7 @@ > #define MI_LOAD_SCAN_LINES_INCL MI_INSTR(0x12, 0) > #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2) > #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1) > +#define MI_DISPLAY_FLIP_ASYNC_INDICATOR (1 << 22) > #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20) > /* IVB has funny definitions for which plane to flip. */ > #define MI_DISPLAY_FLIP_IVB_PLANE_A (0 << 19) > @@ -217,6 +218,11 @@ > #define MI_DISPLAY_FLIP_IVB_SPRITE_B (3 << 19) > #define MI_DISPLAY_FLIP_IVB_PLANE_C (4 << 19) > #define MI_DISPLAY_FLIP_IVB_SPRITE_C (5 << 19) > +/* These go in the bottom of the base address value */ > +#define MI_DISPLAY_FLIP_TYPE_SYNC (0 << 0) > +#define MI_DISPLAY_FLIP_TYPE_ASYNC (1 << 0) > +#define MI_DISPLAY_FLIP_TYPE_STEREO (2 << 0) > +#define MI_DISPLAY_FLIP_TYPE_SYNCHRONOUS (0 << 0) Duplicated bit. > #define MI_ARB_ON_OFF MI_INSTR(0x08, 0) > #define MI_ARB_ENABLE (1<<0) > #define MI_ARB_DISABLE (0<<0) > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index bdb8854..166aa2c 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -1833,8 +1833,10 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, > alignment = 64 * 1024; > break; > case I915_TILING_X: > - /* pin() will align the object as required by fence */ > - alignment = 0; > + /* Async page flipping requires X tiling and 32kB alignment, so just > + * make all X tiled frame buffers aligned for that > + */ > + alignment = 32 * 1024; You could limit this to gens for which you implemented async flips. gen2/3 seem to require a 256KB alignment for async flips. > break; > case I915_TILING_Y: > /* Despite that we check this in framebuffer_init userspace can > @@ -7514,6 +7516,8 @@ static int intel_gen7_queue_flip(struct drm_device *dev, > struct intel_crtc *intel_crtc = to_intel_crtc(crtc); > struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; > uint32_t plane_bit = 0; > + uint32_t cmd; > + uint32_t base; > int ret; > > ret = intel_pin_and_fence_fb_obj(dev, obj, ring); > @@ -7536,13 +7540,21 @@ static int intel_gen7_queue_flip(struct drm_device *dev, > goto err_unpin; > } > > + cmd = MI_DISPLAY_FLIP_I915 | plane_bit; > + base = i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset; > + > + if (flags & DRM_MODE_PAGE_FLIP_ASYNC) { > + cmd |= MI_DISPLAY_FLIP_ASYNC_INDICATOR; > + base |= MI_DISPLAY_FLIP_TYPE_ASYNC; > + } > + > ret = intel_ring_begin(ring, 4); > if (ret) > goto err_unpin; > > - intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); > + intel_ring_emit(ring, cmd); > intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); > - intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); > + intel_ring_emit(ring, base); > intel_ring_emit(ring, (MI_NOOP)); > > intel_mark_page_flip_active(intel_crtc); > @@ -7591,6 +7603,19 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, > fb->pitches[0] != crtc->fb->pitches[0])) > return -EINVAL; > > + /* Check tiling restrictions specific to asynchronous flips > + */ > + if (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) { > + > + /* New FB must be X tiled */ > + if (obj->tiling_mode != I915_TILING_X) > + return -EINVAL; > + > + /* Current FB must be X tiled */ > + if (to_intel_framebuffer(old_fb)->obj->tiling_mode != I915_TILING_X) > + return -EINVAL; > + } > + > work = kzalloc(sizeof *work, GFP_KERNEL); > if (work == NULL) > return -ENOMEM; > @@ -9705,6 +9730,10 @@ void intel_modeset_init(struct drm_device *dev) > dev->mode_config.max_width = 8192; > dev->mode_config.max_height = 8192; > } > + > + if (IS_GEN7(dev)) > + dev->mode_config.async_page_flip = true; > + > dev->mode_config.fb_base = dev_priv->gtt.mappable_base; > > DRM_DEBUG_KMS("%d display pipe%s available.\n", > -- > 1.8.3.2 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrjälä Intel OTC ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/i915: Add async page flip support for SNB 2013-07-25 22:15 ` [PATCH 4/5] drm/i915: Add async page flip support for IVB Keith Packard 2013-07-25 22:15 ` [PATCH 1/2] " Keith Packard @ 2013-07-25 22:15 ` Keith Packard 2013-07-30 16:28 ` [Intel-gfx] " Ville Syrjälä 1 sibling, 1 reply; 5+ messages in thread From: Keith Packard @ 2013-07-25 22:15 UTC (permalink / raw) To: intel-gfx, Daniel Vetter; +Cc: linux-kernel, dri-devel, Keith Packard Just copies the IVB code Signed-off-by: Keith Packard <keithp@keithp.com> --- drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 166aa2c..4a118c3 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -7465,20 +7465,29 @@ static int intel_gen6_queue_flip(struct drm_device *dev, struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; uint32_t pf, pipesrc; + uint32_t cmd; + uint32_t base; int ret; ret = intel_pin_and_fence_fb_obj(dev, obj, ring); if (ret) goto err; + cmd = MI_DISPLAY_FLIP | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane); + base = i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset; + + if (flags & DRM_MODE_PAGE_FLIP_ASYNC) { + cmd |= MI_DISPLAY_FLIP_ASYNC_INDICATOR; + base |= MI_DISPLAY_FLIP_TYPE_ASYNC; + } + ret = intel_ring_begin(ring, 4); if (ret) goto err_unpin; - intel_ring_emit(ring, MI_DISPLAY_FLIP | - MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); + intel_ring_emit(ring, cmd); intel_ring_emit(ring, fb->pitches[0] | obj->tiling_mode); - intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); + intel_ring_emit(ring, base); /* Contrary to the suggestions in the documentation, * "Enable Panel Fitter" does not seem to be required when page @@ -9731,7 +9740,7 @@ void intel_modeset_init(struct drm_device *dev) dev->mode_config.max_height = 8192; } - if (IS_GEN7(dev)) + if (IS_GEN6(dev) || IS_GEN7(dev)) dev->mode_config.async_page_flip = true; dev->mode_config.fb_base = dev_priv->gtt.mappable_base; -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Intel-gfx] [PATCH 2/2] drm/i915: Add async page flip support for SNB 2013-07-25 22:15 ` [PATCH 2/2] drm/i915: Add async page flip support for SNB Keith Packard @ 2013-07-30 16:28 ` Ville Syrjälä 0 siblings, 0 replies; 5+ messages in thread From: Ville Syrjälä @ 2013-07-30 16:28 UTC (permalink / raw) To: Keith Packard; +Cc: Daniel Vetter, intel-gfx, linux-kernel, dri-devel On Thu, Jul 25, 2013 at 03:15:15PM -0700, Keith Packard wrote: > Just copies the IVB code > > Signed-off-by: Keith Packard <keithp@keithp.com> > --- > drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index 166aa2c..4a118c3 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -7465,20 +7465,29 @@ static int intel_gen6_queue_flip(struct drm_device *dev, > struct intel_crtc *intel_crtc = to_intel_crtc(crtc); > struct intel_ring_buffer *ring = &dev_priv->ring[RCS]; > uint32_t pf, pipesrc; > + uint32_t cmd; > + uint32_t base; > int ret; > > ret = intel_pin_and_fence_fb_obj(dev, obj, ring); > if (ret) > goto err; > > + cmd = MI_DISPLAY_FLIP | MI_DISPLAY_FLIP_PLANE(intel_crtc->plane); > + base = i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset; > + > + if (flags & DRM_MODE_PAGE_FLIP_ASYNC) { > + cmd |= MI_DISPLAY_FLIP_ASYNC_INDICATOR; > + base |= MI_DISPLAY_FLIP_TYPE_ASYNC; > + } > + > ret = intel_ring_begin(ring, 4); > if (ret) > goto err_unpin; > > - intel_ring_emit(ring, MI_DISPLAY_FLIP | > - MI_DISPLAY_FLIP_PLANE(intel_crtc->plane)); > + intel_ring_emit(ring, cmd); > intel_ring_emit(ring, fb->pitches[0] | obj->tiling_mode); > - intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); > + intel_ring_emit(ring, base); > > /* Contrary to the suggestions in the documentation, > * "Enable Panel Fitter" does not seem to be required when page This PF flip stuff is a bit of a mystery. I'm not sure it exists on SNB anymore. Some of the docs say that it's MBZ for SNB/IVB. Gen4/5 docs say that DW3 must not be sent w/ async flips, and some SNB+ docs say that it must not be sent with either sync or async flips. Did you test this patch on actual hardware, and if so did it work as expected? :) I guess one would need to perform some empirical testing to figure out what DW3 actually does. > @@ -9731,7 +9740,7 @@ void intel_modeset_init(struct drm_device *dev) > dev->mode_config.max_height = 8192; > } > > - if (IS_GEN7(dev)) > + if (IS_GEN6(dev) || IS_GEN7(dev)) > dev->mode_config.async_page_flip = true; > > dev->mode_config.fb_base = dev_priv->gtt.mappable_base; > -- > 1.8.3.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Ville Syrjälä Intel OTC ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-30 16:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAKMK7uFiL+p48Phwc=jmWtsOgjNOYJzTCWmHe3Bp7-jWMpTtTA@mail.gmail.com>
2013-07-25 22:15 ` [PATCH 4/5] drm/i915: Add async page flip support for IVB Keith Packard
2013-07-25 22:15 ` [PATCH 1/2] " Keith Packard
2013-07-30 16:42 ` Ville Syrjälä
2013-07-25 22:15 ` [PATCH 2/2] drm/i915: Add async page flip support for SNB Keith Packard
2013-07-30 16:28 ` [Intel-gfx] " Ville Syrjälä
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox