Fix FBC for real
Subsystems (2)
cover Fix FBC for real
From: Ville Syrjälä <[email protected]>
This series rewrites the FBC code to actually work. It utilizes the hardware tracking/nuking as much as possible, eg. relying on hardware nuke on flip when possible.
I also introduce the generic ring and vblank notifier gizmos which could be used for various other things. I already included a patch to convert the IPS enable to be asynchronous by using the vblank notifier. Other users for thse could be mmio flips, watermark programming, atomic gamma/color correction (single buffered registers all) updates from vblank interrupt, etc.
There's also a rather big behavioural change that FBC now stays enabled even when multiple pipes are active. FBC just automatially migrates to the primary plane where it's deemed most beneficial. We do that determination by looking at the rate at which the plane is pulling data (pixel rate * cpp). That seems like a reasonable choice all else being equal. Eventually we might want to adjust the FBC score based on nuke/invalidate frequency as well.
The locking now has a new fbc.mutex. I had to split the page flip code apart a bit to accomondate. I'm not entirely sure if it wouldn't be better to just keep struct_mutex locked all through there, but then I'd need rework the locking in the fbc code to not take struct_mutex when called from the page flip code. And then I'd have to start questioning whether fbc.mutex has any point existing.
I pushed the lot here:git://gitorious.org/vsyrjala/linux.git fbc_update_thing_14
Ville Syrjälä (25):
drm/i915: Add ring_notify mechanism
drm/i915: Add vblank notify mechanism
drm/i915: Name the IPS bits
drm/i915: Use vblank notifier for IPS
drm/i915: Reogranize page flip code for fbc
drm/i915: Move ilk_pipe_pixel_rate() earlier to avoid forward
declaration
drm/i915: Reorganize intel_update_fbc()
drm/i915: Check panel fitting state before enabling fbc drm/i915: Reject fbc on g4x when sprites are enabled drm/i915: Check pixel format for fbc
drm/i915: Remove dblscan flag from fbc1 check
drm/i915: Don't claim fbc as possible if the obj size exceeds stolen
size
drm/i915: Use low level funciton to disable fbc at init/resume drm/i915: Move fbc function prototypes got intel_drv.h drm/i915: Move fbc state into dev_priv.fbc
drm/i915: Rewrite fbc
drm/i915: Reduce dmesg spam from FBC enable
drm/i915: Add i915_fbc_info debugfs file
drm/i915: Implement LRI based FBC tracking
drm/i915: Use LRI based FBC render tracking for ILK drm/i915: Reorder i915_gem_execbuffer_move_to_gpu() and
i915_switch_context()
drm/i915: Flush caches for scanout during cpu->gtt move drm/i915: Nuke FBC from SW_FINISH ioctl drm/i915: Pimp fbc render/blitter tracking drm/i915: Enable fbc for ilk+ by default
drivers/gpu/drm/i915/i915_debugfs.c | 60 +- drivers/gpu/drm/i915/i915_drv.c | 3 + drivers/gpu/drm/i915/i915_drv.h | 44 +- drivers/gpu/drm/i915/i915_gem.c | 23 +- drivers/gpu/drm/i915/i915_gem_context.c | 14 + drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 +- drivers/gpu/drm/i915/i915_irq.c | 12 + drivers/gpu/drm/i915/i915_reg.h | 3 +- drivers/gpu/drm/i915/i915_suspend.c | 5 +- drivers/gpu/drm/i915/intel_display.c | 399 ++++++++-- drivers/gpu/drm/i915/intel_drv.h | 30 +- drivers/gpu/drm/i915/intel_pm.c | 1099 +++++++++++++++++++--------- drivers/gpu/drm/i915/intel_ringbuffer.c | 154 +++- drivers/gpu/drm/i915/intel_ringbuffer.h | 26 +- drivers/gpu/drm/i915/intel_sprite.c | 15 +- 15 files changed, 1483 insertions(+), 444 deletions(-)
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/25 drm/i915: Add ring_notify mechanism
From: Ville Syrjälä <[email protected]>
Proveide a ring notify mechanism where you can ask for a callback when a specific seqno has been passed.
Can be used for FBC and mmio flips at least.
--- drivers/gpu/drm/i915/i915_gem.c | 10 ++++ drivers/gpu/drm/i915/i915_irq.c | 4 ++ drivers/gpu/drm/i915/intel_ringbuffer.c | 89 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 17 +++++++ 4 files changed, 120 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +10 -0
@@ -2521,6 +2521,8 @@ static void i915_gem_reset_ring_status(struct drm_i915_private *dev_priv,static void i915_gem_reset_ring_cleanup (struct drm_i915_private *dev_priv,struct intel_engine_cs *ring) { +struct intel_ring_notify *notify, *next; +while (!list_empty (&ring->active_list)) {struct drm_i915_gem_object *obj;
@@ -2552,6 +2554,14 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,kfree (ring->preallocated_lazy_request); ring->preallocated_lazy_request =NULL ; ring->outstanding_lazy_seqno =0 ; + +spin_lock_irq (&ring->lock); +list_for_each_entry_safe (notify, next, &ring->notify_list, list) { +intel_ring_notify_complete (notify); +/* FIXME should we notify at reset? */ + notify->notify (notify); + } +spin_unlock_irq (&ring->lock); }void i915_gem_restore_fences (struct drm_device *dev)
drivers/gpu/drm/i915/i915_irq.c +4 -0
@@ -1221,6 +1221,10 @@ static void notify_ring(struct drm_device *dev,if (drm_core_check_feature (dev,DRIVER_MODESET ))intel_notify_mmio_flip (ring); +spin_lock (&ring->lock); +intel_ring_notify_check (ring); +spin_unlock (&ring->lock); +wake_up_all (&ring->irq_queue);i915_queue_hangcheck (dev); }
drivers/gpu/drm/i915/intel_ringbuffer.c +89 -0
98 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +17 -0
@@ -79,6 +79,13 @@ struct intel_ringbuffer {u32 last_retired_head; }; +struct intel_ring_notify { +void (*notify)(struct intel_ring_notify *notify); +struct intel_engine_cs *ring; +struct list_head list; +u32 seqno; +}; + struct intel_engine_cs { const char *name; enum intel_ring_id {
@@ -217,6 +224,9 @@ struct intel_engine_cs {* to encode the command length in the header). */ u32 (*get_cmd_length_mask)(u32 cmd_header); + +struct list_head notify_list; +spinlock_t lock; }; static inline bool
@@ -335,6 +345,13 @@ static inline void i915_trace_irq_get(struct intel_engine_cs *ring, u32 seqno) ring->trace_irq_seqno = seqno; } +void intel_ring_notify_complete (struct intel_ring_notify *notify); +void intel_ring_notify_check (struct intel_engine_cs *ring); +int __must_check intel_ring_notify_add (struct intel_engine_cs *ring, +struct intel_ring_notify *notify); +bool intel_ring_notify_pending (struct intel_ring_notify *notify); +void intel_ring_notify_cancel (struct intel_ring_notify *notify); +/* DRI warts */ int intel_render_ring_init_dri (struct drm_device *dev,u64 start,u32 size);
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 01/25] drm/i915: Add ring_notify mechanism
Quoted 8 lines · On Wed, Jun 18, 2014 at 08:58:34PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Proveide a ring notify mechanism where you can ask for a callback when a specific seqno has been passed.
Can be used for FBC and mmio flips at least.
Signed-off-by Ville Syrjälä <[email protected]>
Hm, most of the callbacks I can image need some process context anyway due to at least grabbing a mutex or something similar. And we support lockless seqno waits. So with that I'd lean towards offloading this into work items and just doing a lockless wait in the overall sequence since doing full callback-based programming is hard. But I haven't looked at the users at all here tbh.
-Daniel
Quoted 203 lines
--- drivers/gpu/drm/i915/i915_gem.c | 10 ++++ drivers/gpu/drm/i915/i915_irq.c | 4 ++ drivers/gpu/drm/i915/intel_ringbuffer.c | 89 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_ringbuffer.h | 17 +++++++ 4 files changed, 120 insertions(+)drivers/gpu/drm/i915/i915_gem.c +10
-0@@ -2521,6 +2521,8 @@ static void i915_gem_reset_ring_status(struct drm_i915_private *dev_priv,static void i915_gem_reset_ring_cleanup (struct drm_i915_private *dev_priv,struct intel_engine_cs *ring) { +struct intel_ring_notify *notify, *next; +while (!list_empty (&ring->active_list)) {struct drm_i915_gem_object *obj;@@ -2552,6 +2554,14 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv,kfree (ring->preallocated_lazy_request); ring->preallocated_lazy_request =NULL ; ring->outstanding_lazy_seqno =0 ; + +spin_lock_irq (&ring->lock); +list_for_each_entry_safe (notify, next, &ring->notify_list, list) { +intel_ring_notify_complete (notify); +/* FIXME should we notify at reset? */ + notify->notify (notify); + } +spin_unlock_irq (&ring->lock); }void i915_gem_restore_fences (struct drm_device *dev)drivers/gpu/drm/i915/i915_irq.c +4
-0@@ -1221,6 +1221,10 @@ static void notify_ring(struct drm_device *dev,if (drm_core_check_feature (dev,DRIVER_MODESET ))intel_notify_mmio_flip (ring); +spin_lock (&ring->lock); +intel_ring_notify_check (ring); +spin_unlock (&ring->lock); +wake_up_all (&ring->irq_queue);i915_queue_hangcheck (dev); }drivers/gpu/drm/i915/intel_ringbuffer.c +89
-0@@ -1447,6 +1447,9 @@ static int intel_init_ring_buffer(struct drm_device *dev,init_waitqueue_head (&ring->irq_queue); +INIT_LIST_HEAD (&ring->notify_list); +spin_lock_init (&ring->lock); +if (I915_NEED_GFX_HWS (dev)) { ret =init_status_page (ring);if (ret)@@ -2407,3 +2410,89 @@ intel_stop_ring_buffer(struct intel_engine_cs *ring)stop_ring (ring); } + +void intel_ring_notify_complete (struct intel_ring_notify *notify) +{ +struct intel_engine_cs *ring = notify->ring; + + ring->irq_put (ring); +list_del (¬ify->list); + notify->ring =NULL ; +} + +void intel_ring_notify_check (struct intel_engine_cs *ring) +{ +struct intel_ring_notify *notify, *next; +u32 seqno; + +assert_spin_locked (&ring->lock); + +if (list_empty (&ring->notify_list)) +return ; + + seqno = ring->get_seqno (ring, false); + +list_for_each_entry_safe (notify, next, &ring->notify_list, list) { +if (i915_seqno_passed (seqno, notify->seqno)) { +intel_ring_notify_complete (notify); + notify->notify (notify); + } + } +} + +int intel_ring_notify_add (struct intel_engine_cs *ring, +struct intel_ring_notify *notify) +{ +unsigned long irqflags; +int ret; + +lockdep_assert_held (&ring->dev->struct_mutex); + +if (WARN_ON (notify->ring !=NULL || notify->seqno ==0 )) +return -EINVAL ; + +if (i915_seqno_passed (ring->get_seqno (ring, true), notify->seqno)) + goto notify_immediately; + + ret =i915_gem_check_olr (ring, notify->seqno); +if (ret) +return ret; + +if (WARN_ON (!ring->irq_get (ring))) + goto notify_immediately; + +spin_lock_irqsave (&ring->lock, irqflags); + notify->ring = ring; +list_add_tail (¬ify->list, &ring->notify_list); +/* check again in case we just missed it */ +intel_ring_notify_check (ring); +spin_unlock_irqrestore (&ring->lock, irqflags); + +return 0 ; + + notify_immediately: +spin_lock_irqsave (&ring->lock, irqflags); + notify->notify (notify); +spin_unlock_irqrestore (&ring->lock, irqflags); + +return 0 ; +} + +bool intel_ring_notify_pending (struct intel_ring_notify *notify) +{ +return notify->ring !=NULL ; +} + +void intel_ring_notify_cancel (struct intel_ring_notify *notify) +{ +struct intel_engine_cs *ring =ACCESS_ONCE (notify->ring); +unsigned long irqflags; + +if (!ring) +return ; + +spin_lock_irqsave (&ring->lock, irqflags); +if (notify->ring) +intel_ring_notify_complete (notify); +spin_unlock_irqrestore (&ring->lock, irqflags); +}drivers/gpu/drm/i915/intel_ringbuffer.h +17
-0@@ -79,6 +79,13 @@ struct intel_ringbuffer {u32 last_retired_head; }; +struct intel_ring_notify { +void (*notify)(struct intel_ring_notify *notify); +struct intel_engine_cs *ring; +struct list_head list; +u32 seqno; +}; + struct intel_engine_cs { const char *name; enum intel_ring_id {@@ -217,6 +224,9 @@ struct intel_engine_cs {* to encode the command length in the header). */ u32 (*get_cmd_length_mask)(u32 cmd_header); + +struct list_head notify_list; +spinlock_t lock; }; static inline bool@@ -335,6 +345,13 @@ static inline void i915_trace_irq_get(struct intel_engine_cs *ring, u32 seqno) ring->trace_irq_seqno = seqno; } +void intel_ring_notify_complete (struct intel_ring_notify *notify); +void intel_ring_notify_check (struct intel_engine_cs *ring); +int __must_check intel_ring_notify_add (struct intel_engine_cs *ring, +struct intel_ring_notify *notify); +bool intel_ring_notify_pending (struct intel_ring_notify *notify); +void intel_ring_notify_cancel (struct intel_ring_notify *notify); +/* DRI warts */ int intel_render_ring_init_dri (struct drm_device *dev,u64 start,u32 size);Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 2/25 drm/i915: Add vblank notify mechanism
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add a vblank notify mechanism where you can ask for a callback when a specific frame counter value has been passed.
This could be used for various things like FBC, IPS, watermarks, and updating single buffered display registers from the interrupt handler (eg. gamma).
As gen2 doesn't have a hardware frame counter we use the software vblank counter drm core procvides. This is rather racy, but for something like FBC it doesn't matter too much. For gen2 we could just scheudle the FBC enable happen a frame later than on other gens. That should paper over the races sufficiently.
--- drivers/gpu/drm/i915/i915_irq.c | 8 +++ drivers/gpu/drm/i915/intel_display.c | 132 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 16 +++++ 3 files changed, 156 insertions(+)
drivers/gpu/drm/i915/i915_irq.c +8 -0
@@ -1736,7 +1736,15 @@ static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)if (!drm_handle_vblank (dev, pipe))return false; +if (!drm_core_check_feature (dev,DRIVER_MODESET )) +return true; + crtc =to_intel_crtc (intel_get_crtc_for_pipe (dev, pipe)); + +spin_lock (&crtc->lock); +intel_vblank_notify_check (crtc); +spin_unlock (&crtc->lock); +wake_up (&crtc->vbl_wait);return true;
drivers/gpu/drm/i915/intel_display.c +132 -0
141 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +16 -0
@@ -358,6 +358,13 @@ struct intel_pipe_wm {bool sprites_scaled; }; +struct intel_vblank_notify { +void (*notify)(struct intel_vblank_notify *notify); +struct intel_crtc *crtc; +struct list_head list; +u32 vbl_count; +}; +struct intel_mmio_flip {u32 seqno;u32 ring_id;
@@ -417,6 +424,9 @@ struct intel_crtc {int scanline_offset;struct intel_mmio_flip mmio_flip; + +struct list_head vblank_notify_list; +spinlock_t lock; };struct intel_plane_wm_parameters {
@@ -811,6 +821,12 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode, struct intel_crtc_config *pipe_config);int intel_format_to_fourcc (int format);void intel_crtc_wait_for_pending_flips (struct drm_crtc *crtc); +int intel_vblank_notify_add (struct intel_crtc *crtc, +struct intel_vblank_notify *notify); +void intel_vblank_notify_cancel (struct intel_vblank_notify *notify); +bool intel_vblank_notify_pending (struct intel_vblank_notify *notify); +void intel_vblank_notify_check (struct intel_crtc *crtc); +u32 intel_crtc_vbl_count_rel_to_abs (struct intel_crtc *crtc,u32 rel);/* intel_dp.c */
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 02/25] drm/i915: Add vblank notify mechanism
Quoted 9 lines · On Wed, Jun 18, 2014 at 08:58:35PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Add a vblank notify mechanism where you can ask for a callback when a specific frame counter value has been passed.
This could be used for various things like FBC, IPS, watermarks, and updating single buffered display registers from the interrupt handler (eg. gamma).
Quoted 7 lines
As gen2 doesn't have a hardware frame counter we use the software vblank counter drm core procvides. This is rather racy, but for something like FBC it doesn't matter too much. For gen2 we could just scheudle the FBC enable happen a frame later than on other gens. That should paper over the races sufficiently.
Signed-off-by Ville Syrjälä <[email protected]>
Chris submitted a very similar patch for vblank work items, same review still applies: This should be moved into drm_irq.c
-Daniel
Quoted 221 lines
--- drivers/gpu/drm/i915/i915_irq.c | 8 +++ drivers/gpu/drm/i915/intel_display.c | 132 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 16 +++++ 3 files changed, 156 insertions(+)drivers/gpu/drm/i915/i915_irq.c +8
-0@@ -1736,7 +1736,15 @@ static bool intel_pipe_handle_vblank(struct drm_device *dev, enum pipe pipe)if (!drm_handle_vblank (dev, pipe))return false; +if (!drm_core_check_feature (dev,DRIVER_MODESET )) +return true; + crtc =to_intel_crtc (intel_get_crtc_for_pipe (dev, pipe)); + +spin_lock (&crtc->lock); +intel_vblank_notify_check (crtc); +spin_unlock (&crtc->lock); +wake_up (&crtc->vbl_wait);return true;drivers/gpu/drm/i915/intel_display.c +132
-0@@ -11499,6 +11499,9 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)init_waitqueue_head (&intel_crtc->vbl_wait); +spin_lock_init (&intel_crtc->lock); +INIT_LIST_HEAD (&intel_crtc->vblank_notify_list); +BUG_ON (pipe >=ARRAY_SIZE (dev_priv->plane_to_crtc_mapping) || dev_priv->plane_to_crtc_mapping[intel_crtc->plane] !=NULL ); dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base;@@ -13051,3 +13054,132 @@ intel_display_print_error_state(struct drm_i915_error_state_buf *m,err_printf (m," VSYNC: %08x\n" , error->transcoder[i].vsync); } } + +/* is a after b? */ +static bool vbl_count_after_eq (struct drm_device *dev,u32 a,u32 b) +{ +u32 mask = dev->max_vblank_count; + +/* now hardware counter on gen2 */ +if (mask ==0 ) + mask =-1 ; + + mask &= (mask >>1 ); + +return !((a - b) & mask); +} + +static void intel_vblank_notify_complete (struct intel_vblank_notify *notify) +{ +struct intel_crtc *crtc = notify->crtc; +struct drm_device *dev = crtc->base.dev; + +assert_spin_locked (&crtc->lock); + +drm_vblank_put (dev, crtc->pipe); +list_del (¬ify->list); + notify->crtc =NULL ; +} + +void intel_vblank_notify_check (struct intel_crtc *crtc) +{ +struct drm_device *dev = crtc->base.dev; +struct drm_vblank_crtc *vblank = + &dev->vblank[drm_crtc_index (&crtc->base)]; +struct intel_vblank_notify *notify, *next; +u32 vbl_count; + +assert_spin_locked (&crtc->lock); + +if (list_empty (&crtc->vblank_notify_list)) +return ; + +/* no hardware frame counter on gen2 */ +if (dev->max_vblank_count ==0 ) + vbl_count =atomic_read (&vblank->count); +else + vbl_count = dev->driver->get_vblank_counter (dev, crtc->pipe); + +list_for_each_entry_safe (notify, next, &crtc->vblank_notify_list, list) { +if (!vbl_count_after_eq (dev, vbl_count, notify->vbl_count)) +continue ; + +intel_vblank_notify_complete (notify); + notify->notify (notify); + } +} + +int intel_vblank_notify_add (struct intel_crtc *crtc, +struct intel_vblank_notify *notify) +{ +struct drm_device *dev = crtc->base.dev; +unsigned long irqflags; +u32 vbl_count; +int ret; + +if (WARN_ON (notify->crtc)) +return -EINVAL ; + + ret =drm_vblank_get (dev, crtc->pipe); +if (ret) +return ret; + +spin_lock_irqsave (&crtc->lock, irqflags); + + notify->crtc = crtc; +list_add (¬ify->list, &crtc->vblank_notify_list); + +/* no hardware frame counter on gen2 */ +if (dev->max_vblank_count ==0 ) { +struct drm_vblank_crtc *vblank = + &dev->vblank[drm_crtc_index (&crtc->base)]; + + vbl_count =atomic_read (&vblank->count); + }else { + vbl_count = dev->driver->get_vblank_counter (dev, crtc->pipe); + } + +if (vbl_count_after_eq (dev, vbl_count, notify->vbl_count)) { +intel_vblank_notify_complete (notify); + notify->notify (notify); + } + +spin_unlock_irqrestore (&crtc->lock, irqflags); + +return 0 ; +} + +bool intel_vblank_notify_pending (struct intel_vblank_notify *notify) +{ +return notify->crtc !=NULL ; +} + +void intel_vblank_notify_cancel (struct intel_vblank_notify *notify) +{ +struct intel_crtc *crtc =ACCESS_ONCE (notify->crtc); +unsigned long irqflags; + +if (!crtc) +return ; + +spin_lock_irqsave (&crtc->lock, irqflags); +if (notify->crtc) +intel_vblank_notify_complete (notify); +spin_unlock_irqrestore (&crtc->lock, irqflags); +} + +u32 intel_crtc_vbl_count_rel_to_abs (struct intel_crtc *crtc,u32 rel) +{ +struct drm_device *dev = crtc->base.dev; + +/* now hardware counter on gen2 */ +if (dev->max_vblank_count ==0 ) { +struct drm_vblank_crtc *vblank = + &dev->vblank[drm_crtc_index (&crtc->base)]; + +return atomic_read (&vblank->count) + rel; + } + +return (dev->driver->get_vblank_counter (dev, crtc->pipe) + rel) & + dev->max_vblank_count; +}drivers/gpu/drm/i915/intel_drv.h +16
-0@@ -358,6 +358,13 @@ struct intel_pipe_wm {bool sprites_scaled; }; +struct intel_vblank_notify { +void (*notify)(struct intel_vblank_notify *notify); +struct intel_crtc *crtc; +struct list_head list; +u32 vbl_count; +}; +struct intel_mmio_flip {u32 seqno;u32 ring_id;@@ -417,6 +424,9 @@ struct intel_crtc {int scanline_offset;struct intel_mmio_flip mmio_flip; + +struct list_head vblank_notify_list; +spinlock_t lock; };struct intel_plane_wm_parameters {@@ -811,6 +821,12 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode, struct intel_crtc_config *pipe_config);int intel_format_to_fourcc (int format);void intel_crtc_wait_for_pending_flips (struct drm_crtc *crtc); +int intel_vblank_notify_add (struct intel_crtc *crtc, +struct intel_vblank_notify *notify); +void intel_vblank_notify_cancel (struct intel_vblank_notify *notify); +bool intel_vblank_notify_pending (struct intel_vblank_notify *notify); +void intel_vblank_notify_check (struct intel_crtc *crtc); +u32 intel_crtc_vbl_count_rel_to_abs (struct intel_crtc *crtc,u32 rel);/* intel_dp.c */ Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 3/25 drm/i915: Name the IPS bits
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Kill the magic numbers from the IPS code and give a name to the IPS pcode control bit.
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_display.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -5551,6 +5551,7 @@ enum punit_power_well {#define GEN6_ENCODE_RC6_VID (mv) (((mv) - 245) / 5)#define GEN6_DECODE_RC6_VID (vids) (((vids) * 5) + 245)#define DISPLAY_IPS_CONTROL 0x19 +#define IPS_PCODE_CONTROL (1<<30)#define GEN6_PCODE_DATA 0x138128#define GEN6_PCODE_FREQ_IA_RATIO_SHIFT 8#define GEN6_PCODE_FREQ_RING_RATIO_SHIFT 16
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -3788,7 +3788,8 @@ void hsw_enable_ips(struct intel_crtc *crtc)assert_plane_enabled (dev_priv, crtc->plane);if (IS_BROADWELL (dev)) {mutex_lock (&dev_priv->rps.hw_lock); -WARN_ON (sandybridge_pcode_write (dev_priv,DISPLAY_IPS_CONTROL ,0xc0000000 )); +WARN_ON (sandybridge_pcode_write (dev_priv,DISPLAY_IPS_CONTROL , +IPS_ENABLE |IPS_PCODE_CONTROL ));mutex_unlock (&dev_priv->rps.hw_lock);/* Quoting Art Runyan: "its not safe to expect any particular * value in IPS_CTL bit 31 after enabling IPS through the
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/25 drm/i915: Use vblank notifier for IPS
In reply to [email protected]From: Ville Syrjälä <[email protected]>
IPS enable must be delayed one frame after the planes have been enabled. Currently there's a blocking vblank wait in the path. Replace that with a vblank notify so that it can be done asynchronously. The disable path must remain synchronous.
TODO: see if the ips state checking can be fixed, for now it's disabled
--- drivers/gpu/drm/i915/i915_drv.c | 2 + drivers/gpu/drm/i915/i915_drv.h | 12 ++++ drivers/gpu/drm/i915/intel_display.c | 110 +++++++++++++++++++++++++---------- drivers/gpu/drm/i915/intel_drv.h | 8 +-- 4 files changed, 94 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -537,6 +537,8 @@ static int i915_drm_freeze(struct drm_device *dev) }drm_modeset_unlock_all (dev); +intel_ips_cleanup (dev); +intel_modeset_suspend_hw (dev); }
drivers/gpu/drm/i915/i915_drv.h +12 -0
@@ -1331,6 +1331,13 @@ struct intel_pipe_crc {wait_queue_head_t wq; }; +struct intel_vblank_notify { +void (*notify)(struct intel_vblank_notify *notify); +struct intel_crtc *crtc; +struct list_head list; +u32 vbl_count; +}; +struct drm_i915_private {struct drm_device *dev;struct kmem_cache *slab;
@@ -1405,6 +1412,11 @@ struct drm_i915_private {u32 hpd_event_bits;struct timer_list hotplug_reenable_timer; +struct { +struct intel_crtc *crtc; +struct work_struct work; +struct intel_vblank_notify notify; + } hsw_ips;struct i915_fbc fbc;struct i915_drrs drrs;struct intel_opregion opregion;
drivers/gpu/drm/i915/intel_display.c +79 -31
164 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +1 -7
@@ -358,13 +358,6 @@ struct intel_pipe_wm {bool sprites_scaled; }; -struct intel_vblank_notify { -void (*notify)(struct intel_vblank_notify *notify); -struct intel_crtc *crtc; -struct list_head list; -u32 vbl_count; -}; -struct intel_mmio_flip {u32 seqno;u32 ring_id;
@@ -813,6 +806,7 @@ ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config,bool intel_crtc_active (struct drm_crtc *crtc);void hsw_enable_ips (struct intel_crtc *crtc);void hsw_disable_ips (struct intel_crtc *crtc); +void intel_ips_cleanup (struct drm_device *dev);void intel_display_set_init_power (struct drm_i915_private *dev,bool enable);enum intel_display_power_domain intel_display_port_power_domain (struct intel_encoder *intel_encoder);
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/25 drm/i915: Reogranize page flip code for fbc
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The locking needs to be adjusted to accomodate the upcoming fbc.mutex, so shuffle around the prep steps before actally issuing the flip.
--- drivers/gpu/drm/i915/intel_display.c | 47 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_display.c +24 -23
@@ -9515,22 +9515,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,if (ret) goto cleanup; -/* Reference the objects for the scheduled work. */ -drm_gem_object_reference (&work->old_fb_obj->base); -drm_gem_object_reference (&obj->base); - - crtc->primary->fb = fb; - - work->pending_flip_obj = obj; - - work->enable_stall_check = true; - -atomic_inc (&intel_crtc->unpin_work_count); - intel_crtc->reset_counter =atomic_read (&dev_priv->gpu_error.reset_counter); - -if (INTEL_INFO (dev)->gen >=5 ||IS_G4X (dev)) - work->flip_count =I915_READ (PIPE_FLIPCOUNT_GM45 (intel_crtc->pipe)) +1 ; -if (IS_VALLEYVIEW (dev)) { ring = &dev_priv->ring[BCS ]; }else if (INTEL_INFO (dev)->gen >=7 ) {
@@ -9543,7 +9527,24 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret) - goto cleanup_pending; + goto cleanup_unlock; + +atomic_inc (&intel_crtc->unpin_work_count); + + crtc->primary->fb = fb; + +/* Reference the objects for the scheduled work. */ +drm_gem_object_reference (&work->old_fb_obj->base); +drm_gem_object_reference (&obj->base); + + work->pending_flip_obj = obj; + + work->enable_stall_check = true; + + intel_crtc->reset_counter =atomic_read (&dev_priv->gpu_error.reset_counter); + +if (INTEL_INFO (dev)->gen >=5 ||IS_G4X (dev)) + work->flip_count =I915_READ (PIPE_FLIPCOUNT_GM45 (intel_crtc->pipe)) +1 ; work->gtt_offset =i915_gem_obj_ggtt_offset (obj) + intel_crtc->dspaddr_offset;
@@ -9555,7 +9556,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ret = dev_priv->display.queue_flip (dev, crtc, fb, obj, ring, page_flip_flags);if (ret) - goto cleanup_unpin; + goto cleanup_all;intel_disable_fbc (dev);intel_mark_fb_busy (obj,NULL );
@@ -9565,13 +9566,13 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,return 0 ; -cleanup_unpin: -intel_unpin_fb_obj (obj); -cleanup_pending: -atomic_dec (&intel_crtc->unpin_work_count); - crtc->primary->fb = old_fb; +cleanup_all:drm_gem_object_unreference (&work->old_fb_obj->base);drm_gem_object_unreference (&obj->base); + crtc->primary->fb = old_fb; +atomic_dec (&intel_crtc->unpin_work_count); +intel_unpin_fb_obj (obj); +cleanup_unlock:mutex_unlock (&dev->struct_mutex); cleanup:
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/25 drm/i915: Move ilk_pipe_pixel_rate() earlier to avoid forward declaration
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Just shuffle code around, no functional change.
--- drivers/gpu/drm/i915/intel_pm.c | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +31 -31
@@ -437,6 +437,37 @@ static bool set_no_fbc_reason(struct drm_i915_private *dev_priv,return true; } +static uint32_t ilk_pipe_pixel_rate (struct drm_device *dev, +struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +uint32_t pixel_rate; + + pixel_rate = intel_crtc->config.adjusted_mode.crtc_clock; + +/* We only use IF-ID interlacing. If we ever use PF-ID we'll need to +* adjust the pixel_rate here. */ + +if (intel_crtc->config.pch_pfit.enabled) { +uint64_t pipe_w, pipe_h, pfit_w, pfit_h; +uint32_t pfit_size = intel_crtc->config.pch_pfit.size; + + pipe_w = intel_crtc->config.pipe_src_w; + pipe_h = intel_crtc->config.pipe_src_h; + pfit_w = (pfit_size >>16 ) &0xFFFF ; + pfit_h = pfit_size &0xFFFF ; +if (pipe_w < pfit_w) + pipe_w = pfit_w; +if (pipe_h < pfit_h) + pipe_h = pfit_h; + + pixel_rate =div_u64 ((uint64_t ) pixel_rate * pipe_w * pipe_h, + pfit_w * pfit_h); + } + +return pixel_rate; +} +/** * intel_update_fbc - enable/disable FBC as needed * @dev: the drm_device
@@ -1651,37 +1682,6 @@ static void i845_update_wm(struct drm_crtc *unused_crtc)I915_WRITE (FW_BLC , fwater_lo); } -static uint32_t ilk_pipe_pixel_rate (struct drm_device *dev, -struct drm_crtc *crtc) -{ -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -uint32_t pixel_rate; - - pixel_rate = intel_crtc->config.adjusted_mode.crtc_clock; - -/* We only use IF-ID interlacing. If we ever use PF-ID we'll need to -* adjust the pixel_rate here. */ - -if (intel_crtc->config.pch_pfit.enabled) { -uint64_t pipe_w, pipe_h, pfit_w, pfit_h; -uint32_t pfit_size = intel_crtc->config.pch_pfit.size; - - pipe_w = intel_crtc->config.pipe_src_w; - pipe_h = intel_crtc->config.pipe_src_h; - pfit_w = (pfit_size >>16 ) &0xFFFF ; - pfit_h = pfit_size &0xFFFF ; -if (pipe_w < pfit_w) - pipe_w = pfit_w; -if (pipe_h < pfit_h) - pipe_h = pfit_h; - - pixel_rate =div_u64 ((uint64_t ) pixel_rate * pipe_w * pipe_h, - pfit_w * pfit_h); - } - -return pixel_rate; -} -/* latency must be in 0.1us units. */ static uint32_t ilk_wm_method1 (uint32_t pixel_rate,uint8_t bytes_per_pixel,uint32_t latency)
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/25 drm/i915: Reorganize intel_update_fbc()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
FBC1 and FBC2 behave a bit differently when it comes to multiple pipes. FBC1 supposedly must be disabled when multiple pipes are enabled, but FBC2 can be enabled. To make this more easier to read simply split the code along the FBC1 vs. FBC2 lines.
On FBC2 we get to pick one of the primary planes for compression if multiple are enabled. For now just pick the one with highest pixel rate.
Since this also means that many of no_fbc_reason values no longer makes sense since we track that on a per-device basic, but the reasons are actually per-CRTC. Simply replace all the per-CRTC no_fbc_reason values with a single new FBC_UNSUPPORTED_CONFIG reason. In case someone still wants more debug information, all the per-CRTC reasons for disabling FBC will now print a DRM_DEBUG() message.
--- drivers/gpu/drm/i915/i915_debugfs.c | 16 +-- drivers/gpu/drm/i915/i915_drv.h | 6 +- drivers/gpu/drm/i915/intel_pm.c | 265 +++++++++++++++++++++++++----------- 3 files changed, 189 insertions(+), 98 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -14
@@ -1468,24 +1468,12 @@ static int i915_fbc_status(struct seq_file *m, void *unused)case FBC_UNSUPPORTED :seq_puts (m,"unsupported by this chipset" );break ; -case FBC_NO_OUTPUT : -seq_puts (m,"no outputs" ); +case FBC_UNSUPPORTED_CONFIG : +seq_puts (m,"unsupported pipe/plane config" );break ;case FBC_STOLEN_TOO_SMALL :seq_puts (m,"not enough stolen memory" );break ; -case FBC_UNSUPPORTED_MODE : -seq_puts (m,"mode not supported" ); -break ; -case FBC_MODE_TOO_LARGE : -seq_puts (m,"mode too large" ); -break ; -case FBC_BAD_PLANE : -seq_puts (m,"FBC unsupported on plane" ); -break ; -case FBC_NOT_TILED : -seq_puts (m,"scanout buffer not tiled" ); -break ;case FBC_MULTIPLE_PIPES :seq_puts (m,"multiple pipes are enabled" );break ;
drivers/gpu/drm/i915/i915_drv.h +1 -5
@@ -617,12 +617,8 @@ struct i915_fbc {enum no_fbc_reason {FBC_OK ,/* FBC is enabled */ FBC_UNSUPPORTED ,/* FBC is not supported by this chipset */ -FBC_NO_OUTPUT ,/* no outputs enabled to compress */ +FBC_UNSUPPORTED_CONFIG ,/* pipe/plane config not suitable for FBC */ FBC_STOLEN_TOO_SMALL ,/* not enough space for buffers */ -FBC_UNSUPPORTED_MODE ,/* interlace or doublescanned mode */ -FBC_MODE_TOO_LARGE ,/* mode too large for compression */ -FBC_BAD_PLANE ,/* fbc not supported on plane */ -FBC_NOT_TILED ,/* buffer not tiled */ FBC_MULTIPLE_PIPES ,/* more than one pipe active */ FBC_MODULE_PARAM ,FBC_CHIP_DEFAULT ,/* disabled by default on this chip */
drivers/gpu/drm/i915/intel_pm.c +186 -79
312 lines not on this page · raw message
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/25 drm/i915: Check panel fitting state before enabling fbc
In reply to [email protected]From: Ville Syrjälä <[email protected]>
WaFbcOnlyForNativeModeOnLFP:ctg says we need to disable fbc when panel fitting is enabled on g4x.
On ilk we need to disable fbc if panel fitter is downscaling. Upscaling is apparently OK.
--- drivers/gpu/drm/i915/intel_pm.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +26 -0
@@ -556,6 +556,32 @@ static bool intel_fbc2_possible(struct intel_crtc *crtc)return false; } +if (IS_G4X (dev)) { +/* WaFbcOnlyForNativeModeOnLFP:ctg */ +if (crtc->config.gmch_pfit.control) { +DRM_DEBUG ("FBC pipe %c, plane %c: panel fitter enabled\n" , +pipe_name (crtc->pipe),plane_name (crtc->plane)); +return false; + } + } + +if (IS_GEN5 (dev) && crtc->config.pch_pfit.enabled) { +uint32_t pfit_w, pfit_h; + + pfit_w = crtc->config.pch_pfit.size >>16 ; + pfit_h = crtc->config.pch_pfit.size &0xFFFF ; + +/* FBC not allowed with panel fitter downscaling */ +if (crtc->config.pipe_src_w > pfit_w || + crtc->config.pipe_src_h > pfit_h) { +DRM_DEBUG ("FBC pipe %c, plane %c: panel fitter downscaling\n" , +pipe_name (crtc->pipe),plane_name (crtc->plane)); +return false; + } + +/* TODO: PF-ID is also disallowed */ + } +if (!crtc->primary_enabled) {DRM_DEBUG ("FBC pipe %c, plane %c: primary plane disabled\n" ,pipe_name (crtc->pipe),plane_name (crtc->plane));
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/25 drm/i915: Reject fbc on g4x when sprites are enabled
In reply to [email protected]From: Ville Syrjälä <[email protected]>
WaFbcDisabledForOverlaySprite:ctg says we need to disallow fbc when sprites are enabled.
We don't currently expose the sprites on g4x, but maybe we will later. Add the appropriate check to fbc2_possible(). We will also need to adjust the sprite code to turn off fbc prior to enabling the sprite, but let's leave that until we actually get g4x sprite support.
--- drivers/gpu/drm/i915/intel_pm.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +9 -0
@@ -523,6 +523,7 @@ static bool intel_fbc1_possible(struct intel_crtc *crtc)static bool intel_fbc2_possible (struct intel_crtc *crtc) {struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private;struct drm_framebuffer *fb = crtc->base.primary->fb;struct drm_i915_gem_object *obj;int max_width, max_height;
@@ -563,6 +564,14 @@ static bool intel_fbc2_possible(struct intel_crtc *crtc) pipe_name(crtc->pipe), plane_name(crtc->plane));return false; } + +/* WaFbcDisabledForOverlaySprite:ctg */ +/* FIXME need to figure this out nicer */ +if (I915_READ (DVSCNTR (crtc->pipe)) &DVS_ENABLE ) { +DRM_DEBUG ("FBC pipe %c, plane %c: video sprite enabled\n" , +pipe_name (crtc->pipe),plane_name (crtc->plane)); +return false; + } }if (IS_GEN5 (dev) && crtc->config.pch_pfit.enabled) {
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/25 drm/i915: Check pixel format for fbc
In reply to [email protected]From: Ville Syrjälä <[email protected]>
fbc is only possible with certain pixel formats. Check for those before enabling fbc.
--- drivers/gpu/drm/i915/intel_pm.c | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +50 -0
@@ -508,6 +508,32 @@ static bool intel_fbc1_possible(struct intel_crtc *crtc)return false; } +/* +* Planes A & B don't support alpha, so +* the "A" formats and "X" formats are +* one and the same. +*/ +switch (fb->pixel_format) { +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ABGR8888 : +break ; +case DRM_FORMAT_XRGB1555 : +case DRM_FORMAT_ARGB1555 : +case DRM_FORMAT_RGB565 : +/* 16bpp not supported on gen2 */ +if (!IS_GEN2 (dev)) +break ; + +/* fall through */ +default : +DRM_DEBUG ("FBC pipe %c, plane %c: framebuffer format (%s) unsupported\n" , +pipe_name (crtc->pipe),plane_name (crtc->plane), +drm_get_format_name (fb->pixel_format)); +return false; + } + obj =to_intel_framebuffer (fb)->obj; if (obj->tiling_mode != I915_TILING_X ||
@@ -597,6 +623,30 @@ static bool intel_fbc2_possible(struct intel_crtc *crtc)return false; } +/* +* Primary planes don't support alpha, so +* the "A" formats and "X" formats are +* one and the same. +*/ +switch (fb->pixel_format) { +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ABGR8888 : +break ; +case DRM_FORMAT_RGB565 : +/* WaFbcOnly1to1Ratio:ctg */ +if (!IS_G4X (dev)) +break ; + +/* fall through */ +default : +DRM_DEBUG ("FBC pipe %c, plane %c: framebuffer format (%s) unsupported\n" , +pipe_name (crtc->pipe),plane_name (crtc->plane), +drm_get_format_name (fb->pixel_format)); +return false; + } + obj =to_intel_framebuffer (fb)->obj; if (obj->tiling_mode != I915_TILING_X ||
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/25 drm/i915: Remove dblscan flag from fbc1 check
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We don't do double scan anyway so don't bother checking it in the fbc code.
--- drivers/gpu/drm/i915/intel_pm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -2
@@ -494,8 +494,7 @@ static bool intel_fbc1_possible(struct intel_crtc *crtc)return false; } -if (crtc->config.adjusted_mode.flags & (DRM_MODE_FLAG_INTERLACE | -DRM_MODE_FLAG_DBLSCAN ) || +if (crtc->config.adjusted_mode.flags &DRM_MODE_FLAG_INTERLACE || crtc->config.double_wide) {DRM_DEBUG ("FBC pipe %c, plane %c: mode incompatible\n" ,pipe_name (crtc->pipe),plane_name (crtc->plane));
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/25 drm/i915: Don't claim fbc as possible if the obj size exceeds stolen size
In reply to [email protected]From: Ville Syrjälä <[email protected]>
If the scanout object exceeds the size of the stolen memory, there's no way we can ever enable fbc with it. Just say no.
--- drivers/gpu/drm/i915/intel_pm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +13 -0
@@ -471,6 +471,7 @@ static uint32_t ilk_pipe_pixel_rate(struct drm_device *dev,static bool intel_fbc1_possible (struct intel_crtc *crtc) {struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private;struct drm_framebuffer *fb = crtc->base.primary->fb;struct drm_i915_gem_object *obj;
@@ -535,6 +536,12 @@ static bool intel_fbc1_possible(struct intel_crtc *crtc) obj =to_intel_framebuffer (fb)->obj; +if (obj->base.size > dev_priv->gtt.stolen_size) { +DRM_DEBUG ("FBC pipe %c, plane %c: framebuffer too big for stolen\n" , +pipe_name (crtc->pipe),plane_name (crtc->plane)); +return false; + } +if (obj->tiling_mode !=I915_TILING_X || obj->fence_reg ==I915_FENCE_REG_NONE ) { DRM_DEBUG("FBC pipe %c, plane %c: framebuffer not tiled or fenced\n",
@@ -648,6 +655,12 @@ static bool intel_fbc2_possible(struct intel_crtc *crtc) obj =to_intel_framebuffer (fb)->obj; +if (obj->base.size > dev_priv->gtt.stolen_size) { +DRM_DEBUG ("FBC pipe %c, plane %c: framebuffer too big for stolen\n" , +pipe_name (crtc->pipe),plane_name (crtc->plane)); +return false; + } +if (obj->tiling_mode !=I915_TILING_X || obj->fence_reg ==I915_FENCE_REG_NONE ) { DRM_DEBUG("FBC pipe %c, plane %c: framebuffer not tiled or fenced\n",
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/25 drm/i915: Use low level funciton to disable fbc at init/resume
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The hardware state might not match the software state here, so just call the low level fbc disable hook to disable it in case the BIOS left it enabled.
--- drivers/gpu/drm/i915/i915_suspend.c | 5 +++-- drivers/gpu/drm/i915/intel_display.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +3 -2
@@ -288,8 +288,9 @@ static void i915_restore_display(struct drm_device *dev)I915_WRITE (PP_CONTROL , dev_priv->regfile.savePP_CONTROL); } -/* only restore FBC info on the platform that supports FBC*/ -intel_disable_fbc (dev); +/* disable FBC in case someone left it on */ +if (dev_priv->display.disable_fbc) + dev_priv->display.disable_fbc (dev);/* restore FBC interval */ if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <=4 && !IS_G4X (dev))
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -12342,7 +12342,8 @@ void intel_modeset_init(struct drm_device *dev)intel_setup_outputs (dev);/* Just in case the BIOS is doing something questionable. */ -intel_disable_fbc (dev); +if (dev_priv->display.disable_fbc) + dev_priv->display.disable_fbc (dev);drm_modeset_lock_all (dev);intel_modeset_setup_hw_state (dev, false);
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/25 drm/i915: Move fbc function prototypes got intel_drv.h
In reply to [email protected]From: Ville Syrjälä <[email protected]>
fbc function prototypes are spread around in to headers. Collect them to a single place.
--- drivers/gpu/drm/i915/i915_drv.h | 2 -- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
@@ -2605,8 +2605,6 @@ extern void intel_modeset_setup_hw_state(struct drm_device *dev, bool force_restore);extern void i915_redisable_vga (struct drm_device *dev);extern void i915_redisable_vga_power_on (struct drm_device *dev); -extern bool intel_fbc_enabled (struct drm_device *dev); -extern void intel_disable_fbc (struct drm_device *dev);extern bool ironlake_set_drps (struct drm_device *dev,u8 val);extern void intel_init_pch_refclk (struct drm_device *dev);extern void gen6_set_rps (struct drm_device *dev,u8 val);
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -959,6 +959,7 @@ void intel_update_sprite_watermarks(struct drm_plane *plane,void intel_init_pm (struct drm_device *dev);void intel_pm_setup (struct drm_device *dev);bool intel_fbc_enabled (struct drm_device *dev); +void intel_disable_fbc (struct drm_device *dev);void intel_update_fbc (struct drm_device *dev);void intel_gpu_ips_init (struct drm_i915_private *dev_priv);void intel_gpu_ips_teardown (void );
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 15/25 drm/i915: Move fbc state into dev_priv.fbc
In reply to [email protected]From: Ville Syrjälä <[email protected]>
--- drivers/gpu/drm/i915/i915_drv.h | 10 +-- drivers/gpu/drm/i915/intel_display.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 130 +++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_sprite.c | 2 +- 5 files changed, 81 insertions(+), 65 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +6 -4
@@ -410,7 +410,7 @@ struct dpll;struct drm_i915_display_funcs {bool (*fbc_enabled)(struct drm_device *dev); -void (*enable_fbc)(struct drm_crtc *crtc); +void (*enable_fbc)(struct drm_device *dev);void (*disable_fbc)(struct drm_device *dev);int (*get_display_clock_speed)(struct drm_device *dev);int (*get_fifo_size)(struct drm_device *dev,int plane);
@@ -600,14 +600,16 @@ struct intel_context { };struct i915_fbc { +struct intel_crtc *crtc;unsigned long size; -unsigned int fb_id; -enum plane plane; -int y; +uint32_t pixel_format; +int fence_reg, pitch, y;struct drm_mm_node *compressed_fb;struct drm_mm_node *compressed_llb; +struct drm_i915_gem_object *obj; +struct intel_fbc_work {struct delayed_work work;struct drm_crtc *crtc;
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -4010,7 +4010,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)intel_crtc_wait_for_pending_flips (crtc); -if (dev_priv->fbc.plane == plane) +if (dev_priv->fbc.crtc == intel_crtc)intel_disable_fbc (dev);hsw_disable_ips (intel_crtc);
@@ -12320,6 +12320,7 @@ void intel_modeset_init(struct drm_device *dev) INTEL_INFO(dev)->num_pipes > 1 ? "s" : "");intel_ips_init (dev); +intel_fbc_init (dev);for_each_pipe (pipe) {intel_crtc_init (dev, pipe);
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -961,6 +961,7 @@ void intel_pm_setup(struct drm_device *dev);bool intel_fbc_enabled (struct drm_device *dev);void intel_disable_fbc (struct drm_device *dev);void intel_update_fbc (struct drm_device *dev); +void intel_fbc_init (struct drm_device *dev);void intel_gpu_ips_init (struct drm_i915_private *dev_priv);void intel_gpu_ips_teardown (void );int intel_power_domains_init (struct drm_i915_private *);
drivers/gpu/drm/i915/intel_pm.c +71 -59
260 lines not on this page · raw message
drivers/gpu/drm/i915/intel_sprite.c +1 -1
@@ -711,7 +711,7 @@ intel_pre_disable_primary(struct drm_crtc *crtc)struct intel_crtc *intel_crtc =to_intel_crtc (crtc);mutex_lock (&dev->struct_mutex); -if (dev_priv->fbc.plane == intel_crtc->plane) +if (dev_priv->fbc.crtc == intel_crtc)intel_disable_fbc (dev);mutex_unlock (&dev->struct_mutex);
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 19/25 drm/i915: Implement LRI based FBC tracking
In reply to [email protected]From: Ville Syrjälä <[email protected]>
As per the SNB and HSW PM guides, we should enable FBC render/blitter tracking only during batches targetting the front buffer.
On SNB we must also update the FBC render tracking address whenever it changes. And since the register in question is stored in the context, we need to make sure we reload it with correct data after context switches.
On IVB/HSW we use the render nuke mechanism, so no render tracking address updates are needed. Hoever on the blitter side we need to enable the blitter tracking like on SNB, and in addition we need to issue the cache clean messages, which we already did.
v2: Introduce intel_fb_obj_has_fbc()
Fix crtc locking around crtc->fb access
Drop a hunk that was included by accident in v1
Set fbc_address_dirty=false not true after emitting the LRI
v3: Now that fbc hangs on to the fb intel_fb_obj_has_fbc() doesn't
need to upset lockdep anymore
v4: Use |= instead of = to update fbc_address_dirty
v5: |= for fbc_dirty too, kill fbc_obj variable, pack the
intel_ringbuffer dirty bits using bitfields, skip ILK_FBC_RT_BASE write on SNB+, kill sandybridge_blit_fbc_update(), reorganize code to make future ILK FBC RT LRI support easier
v6: Rework based on new fbc.obj handling
--- drivers/gpu/drm/i915/i915_gem_context.c | 7 ++++ drivers/gpu/drm/i915/i915_gem_execbuffer.c | 29 +++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 - drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 33 ++--------------- drivers/gpu/drm/i915/intel_ringbuffer.c | 59 +++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_ringbuffer.h | 6 ++- 7 files changed, 102 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +7 -0
@@ -588,6 +588,13 @@ mi_set_context(struct intel_engine_cs *ring,intel_ring_advance (ring); +/* +* FBC RT address is stored in the context, so we may have just +* restored it to an old value. Make sure we emit a new LRI +* to update the address. +*/ + ring->fbc_address_dirty = true; +return ret; }
drivers/gpu/drm/i915/i915_gem_execbuffer.c +29 -0
@@ -955,6 +955,33 @@ i915_gem_validate_context(struct drm_device *dev, struct drm_file *file, }static void +i915_gem_execbuffer_mark_fbc_dirty (struct intel_engine_cs *ring, +struct list_head *vmas) +{ +struct drm_i915_private *dev_priv = ring->dev->dev_private; +struct i915_vma *vma; +u32 fbc_address =-1 ; + +list_for_each_entry (vma, vmas, exec_list) { +struct drm_i915_gem_object *obj = vma->obj; + +if (obj->base.pending_write_domain && + obj == dev_priv->fbc.obj) { +WARN_ON (fbc_address !=-1 && + fbc_address !=i915_gem_obj_ggtt_offset (obj)); + fbc_address =i915_gem_obj_ggtt_offset (obj); + } + } + +/* need to nuke/cache_clean on IVB+? */ + ring->fbc_dirty |= fbc_address !=-1 ; + +/* need to update FBC tracking? */ + ring->fbc_address_dirty |= fbc_address != ring->fbc_address; + ring->fbc_address = fbc_address; +} + +static void i915_gem_execbuffer_move_to_active (struct list_head *vmas,struct intel_engine_cs *ring) {
@@ -1322,6 +1349,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,else exec_start +=i915_gem_obj_offset (batch_obj, vm); +i915_gem_execbuffer_mark_fbc_dirty (ring, &eb->vmas); + ret =i915_gem_execbuffer_move_to_gpu (ring, &eb->vmas);if (ret) goto err;
drivers/gpu/drm/i915/intel_display.c +0 -2
@@ -8923,8 +8923,6 @@ void intel_mark_fb_busy(struct drm_i915_gem_object *obj,continue ;intel_increase_pllclock (crtc); -if (ring &&intel_fbc_enabled (dev)) - ring->fbc_dirty = true; } }
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -732,6 +732,7 @@ bool intel_has_pending_fb_unpin(struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);int valleyview_cur_cdclk (struct drm_i915_private *dev_priv);void intel_mark_busy (struct drm_device *dev); +bool intel_fb_obj_has_fbc (struct drm_i915_gem_object *obj);void intel_mark_fb_busy (struct drm_i915_gem_object *obj,struct intel_engine_cs *ring);void intel_mark_idle (struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +3 -30
@@ -185,31 +185,6 @@ static bool g4x_fbc_enabled(struct drm_device *dev)return I915_READ (DPFC_CONTROL ) &DPFC_CTL_EN ; } -static void sandybridge_blit_fbc_update (struct drm_device *dev) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -u32 blt_ecoskpd; - -/* Make sure blitter notifies FBC of writes */ - -/* Blitter is part of Media powerwell on VLV. No impact of -* his param in other platforms for now */ -gen6_gt_force_wake_get (dev_priv,FORCEWAKE_MEDIA ); - - blt_ecoskpd =I915_READ (GEN6_BLITTER_ECOSKPD ); - blt_ecoskpd |=GEN6_BLITTER_FBC_NOTIFY << -GEN6_BLITTER_LOCK_SHIFT ; -I915_WRITE (GEN6_BLITTER_ECOSKPD , blt_ecoskpd); - blt_ecoskpd |=GEN6_BLITTER_FBC_NOTIFY ; -I915_WRITE (GEN6_BLITTER_ECOSKPD , blt_ecoskpd); - blt_ecoskpd &= ~(GEN6_BLITTER_FBC_NOTIFY << -GEN6_BLITTER_LOCK_SHIFT ); -I915_WRITE (GEN6_BLITTER_ECOSKPD , blt_ecoskpd); -POSTING_READ (GEN6_BLITTER_ECOSKPD ); - -gen6_gt_force_wake_put (dev_priv,FORCEWAKE_MEDIA ); -} -static void ironlake_enable_fbc (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -229,8 +204,9 @@ static void ironlake_enable_fbc(struct drm_device *dev) dpfc_ctl |= dev_priv->fbc.fence_reg;I915_WRITE (ILK_DPFC_FENCE_YOFF , dev_priv->fbc.y); -I915_WRITE (ILK_FBC_RT_BASE ,i915_gem_obj_ggtt_offset (dev_priv->fbc.obj) | -ILK_FBC_RT_VALID ); +if (IS_GEN5 (dev)) +I915_WRITE (ILK_FBC_RT_BASE ,i915_gem_obj_ggtt_offset (dev_priv->fbc.obj) | +ILK_FBC_RT_VALID );/* enable it... */ I915_WRITE (ILK_DPFC_CONTROL , dpfc_ctl |DPFC_CTL_EN );
@@ -238,7 +214,6 @@ static void ironlake_enable_fbc(struct drm_device *dev)I915_WRITE (SNB_DPFC_CTL_SA ,SNB_CPU_FENCE_ENABLE | dev_priv->fbc.fence_reg);I915_WRITE (DPFC_CPU_FENCE_OFFSET , dev_priv->fbc.y); -sandybridge_blit_fbc_update (dev); } }
@@ -297,8 +272,6 @@ static void gen7_enable_fbc(struct drm_device *dev)I915_WRITE (SNB_DPFC_CTL_SA ,SNB_CPU_FENCE_ENABLE | dev_priv->fbc.fence_reg);I915_WRITE (DPFC_CPU_FENCE_OFFSET , dev_priv->fbc.y); - -sandybridge_blit_fbc_update (dev); }bool intel_fbc_enabled (struct drm_device *dev)
drivers/gpu/drm/i915/intel_ringbuffer.c +58 -1
83 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +4 -2
@@ -176,8 +176,10 @@ struct intel_engine_cs {*/ struct drm_i915_gem_request *preallocated_lazy_request;u32 outstanding_lazy_seqno; -bool gpu_caches_dirty; -bool fbc_dirty; +u32 fbc_address; + bool gpu_caches_dirty:1; + bool fbc_dirty:1; + bool fbc_address_dirty:1;wait_queue_head_t irq_queue;
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 16/25 drm/i915: Rewrite fbc
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Redesign the fbc code to deal with multiple pipes better, fix the locking problems, and in general try to utilize the hardware front buffer tracking features to their full extent.
For each crtc we will compute a pending fbc score as (pixel_rate * cpp). At appropriate times (after a flip, on the next vblank after set_base, etc.) the pending score will get promoted to and active score. Based on the active score of all crtcs we then pick which crtc is best candidate for fbc.
Note that this now allows FBC to be enabled when multiple pipes are active. That seems have been always intended as supported on FBC2, but the FBC1 docs are a bit more conservative about this. But that might be just an oversight in the docs. The code now allows FBC with multiple active pipes even on FBC1, and thus far I've not seen any ill effects from this on my 855.
The locking is now handled by a new fbc.mutex which protects most of dev_priv->fbc and the hardware state. dev_priv->fbc.obj is used to track the front buffer for render/blitter tracking so it's protected by struct_mutex.
--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 13 +- drivers/gpu/drm/i915/intel_display.c | 105 +++++- drivers/gpu/drm/i915/intel_drv.h | 18 +- drivers/gpu/drm/i915/intel_pm.c | 665 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_sprite.c | 15 +- 6 files changed, 569 insertions(+), 248 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -538,6 +538,7 @@ static int i915_drm_freeze(struct drm_device *dev)drm_modeset_unlock_all (dev);intel_ips_cleanup (dev); +intel_fbc_cleanup (dev);intel_modeset_suspend_hw (dev); }
drivers/gpu/drm/i915/i915_drv.h +8 -5
@@ -600,21 +600,24 @@ struct intel_context { };struct i915_fbc { +/* protects most fbc state */ +struct mutex mutex; +struct intel_crtc *crtc;unsigned long size;uint32_t pixel_format; +unsigned int score;int fence_reg, pitch, y;struct drm_mm_node *compressed_fb;struct drm_mm_node *compressed_llb; +/* for render tracking, protected by struct_mutex */ struct drm_i915_gem_object *obj; -struct intel_fbc_work { -struct delayed_work work; -struct drm_crtc *crtc; -struct drm_framebuffer *fb; - } *fbc_work; +struct intel_ring_notify notify; + +struct work_struct enable_work, update_work;enum no_fbc_reason {FBC_OK ,/* FBC is enabled */
drivers/gpu/drm/i915/intel_display.c +91 -14
210 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +16 -2
@@ -420,6 +420,11 @@ struct intel_crtc {struct list_head vblank_notify_list;spinlock_t lock; + +struct { +struct intel_vblank_notify notify; +unsigned int score, pending_score; + } fbc; };struct intel_plane_wm_parameters {
@@ -959,9 +964,18 @@ void intel_update_sprite_watermarks(struct drm_plane *plane,void intel_init_pm (struct drm_device *dev);void intel_pm_setup (struct drm_device *dev);bool intel_fbc_enabled (struct drm_device *dev); -void intel_disable_fbc (struct drm_device *dev); -void intel_update_fbc (struct drm_device *dev);void intel_fbc_init (struct drm_device *dev); +void intel_fbc_crtc_init (struct intel_crtc *crtc); +void intel_fbc_cleanup (struct drm_device *dev); +void intel_fbc_pre_page_flip (struct intel_crtc *crtc); +void intel_fbc_post_page_flip (struct intel_crtc *crtc,bool use_vblank_notify); +void intel_fbc_finish_page_flip (struct intel_crtc *crtc); +void intel_fbc_update_object (struct drm_device *dev, +struct drm_i915_gem_object *obj); +void intel_fbc_post_plane_enable (struct intel_crtc *crtc); +void intel_fbc_disable (struct intel_crtc *crtc); +void intel_fbc_schedule_update (struct drm_device *dev); +struct intel_crtc *intel_fbc_best_crtc (struct drm_device *dev);void intel_gpu_ips_init (struct drm_i915_private *dev_priv);void intel_gpu_ips_teardown (void );int intel_power_domains_init (struct drm_i915_private *);
drivers/gpu/drm/i915/intel_pm.c +445 -220
775 lines not on this page · raw message
drivers/gpu/drm/i915/intel_sprite.c +8 -7
@@ -688,6 +688,7 @@ static void intel_post_enable_primary(struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; +struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc);/*
@@ -698,9 +699,9 @@ intel_post_enable_primary(struct drm_crtc *crtc)*/ hsw_enable_ips (intel_crtc); -mutex_lock (&dev->struct_mutex); -intel_update_fbc (dev); -mutex_unlock (&dev->struct_mutex); +mutex_lock (&dev_priv->fbc.mutex); +intel_fbc_post_plane_enable (intel_crtc); +mutex_unlock (&dev_priv->fbc.mutex); } static void
@@ -710,10 +711,10 @@ intel_pre_disable_primary(struct drm_crtc *crtc)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -mutex_lock (&dev->struct_mutex); -if (dev_priv->fbc.crtc == intel_crtc) -intel_disable_fbc (dev); -mutex_unlock (&dev->struct_mutex); +mutex_lock (&dev_priv->fbc.mutex); +intel_fbc_disable (intel_crtc); +intel_fbc_schedule_update (dev); +mutex_unlock (&dev_priv->fbc.mutex);/* * FIXME IPS should be fine as long as one plane is
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 17/25 drm/i915: Reduce dmesg spam from FBC enable
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Only print the FBC enabled debug message when FBC wasn't already enabled. Now we call the .enable_fbc() function every time we need to update the CPU fence during page flips, so dmesg gets considerable amounts of pointless spam.
Also unify the format of the message across all gens.
--- drivers/gpu/drm/i915/intel_pm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +12 -9
@@ -96,6 +96,9 @@ static void i8xx_enable_fbc(struct drm_device *dev)int i;u32 fbc_ctl; +if ((I915_READ (FBC_CONTROL ) &FBC_CTL_EN ) ==0 ) +DRM_DEBUG_KMS ("enabling FBC on plane %c\n" ,plane_name (crtc->plane)); + cfb_pitch = dev_priv->fbc.size /FBC_LL_SIZE ;if (dev_priv->fbc.pitch < cfb_pitch) cfb_pitch = dev_priv->fbc.pitch;
@@ -129,9 +132,6 @@ static void i8xx_enable_fbc(struct drm_device *dev) fbc_ctl |= (cfb_pitch &0xff ) <<FBC_CTL_STRIDE_SHIFT ; fbc_ctl |= dev_priv->fbc.fence_reg;I915_WRITE (FBC_CONTROL , fbc_ctl); - -DRM_DEBUG_KMS ("enabled FBC, pitch %d, yoff %d, plane %c\n" , - cfb_pitch, dev_priv->fbc.y,plane_name (crtc->plane)); }static bool i8xx_fbc_enabled (struct drm_device *dev)
@@ -147,6 +147,9 @@ static void g4x_enable_fbc(struct drm_device *dev)struct intel_crtc *crtc = dev_priv->fbc.crtc;u32 dpfc_ctl; +if ((I915_READ (DPFC_CONTROL ) &DPFC_CTL_EN ) ==0 ) +DRM_DEBUG_KMS ("enabling FBC on plane %c\n" ,plane_name (crtc->plane)); + dpfc_ctl =DPFC_CTL_PLANE (crtc->plane) |DPFC_SR_EN ;if (drm_format_plane_cpp (dev_priv->fbc.pixel_format,0 ) ==2 ) dpfc_ctl |=DPFC_CTL_LIMIT_2X ;
@@ -158,8 +161,6 @@ static void g4x_enable_fbc(struct drm_device *dev)/* enable it... */ I915_WRITE (DPFC_CONTROL , dpfc_ctl |DPFC_CTL_EN ); - -DRM_DEBUG_KMS ("enabled fbc on plane %c\n" ,plane_name (crtc->plane)); }static void g4x_disable_fbc (struct drm_device *dev)
@@ -215,6 +216,9 @@ static void ironlake_enable_fbc(struct drm_device *dev)struct intel_crtc *crtc = dev_priv->fbc.crtc;u32 dpfc_ctl; +if ((I915_READ (ILK_DPFC_CONTROL ) &DPFC_CTL_EN ) ==0 ) +DRM_DEBUG_KMS ("enabling FBC on plane %c\n" ,plane_name (crtc->plane)); + dpfc_ctl =DPFC_CTL_PLANE (crtc->plane);if (drm_format_plane_cpp (dev_priv->fbc.pixel_format,0 ) ==2 ) dpfc_ctl |=DPFC_CTL_LIMIT_2X ;
@@ -236,8 +240,6 @@ static void ironlake_enable_fbc(struct drm_device *dev)I915_WRITE (DPFC_CPU_FENCE_OFFSET , dev_priv->fbc.y);sandybridge_blit_fbc_update (dev); } - -DRM_DEBUG_KMS ("enabled fbc on plane %c\n" ,plane_name (crtc->plane)); }static void ironlake_disable_fbc (struct drm_device *dev)
@@ -268,6 +270,9 @@ static void gen7_enable_fbc(struct drm_device *dev)struct intel_crtc *crtc = dev_priv->fbc.crtc;u32 dpfc_ctl; +if ((I915_READ (ILK_DPFC_CONTROL ) &DPFC_CTL_EN ) ==0 ) +DRM_DEBUG_KMS ("enabling fbc on plane %c\n" ,plane_name (crtc->plane)); + dpfc_ctl =IVB_DPFC_CTL_PLANE (crtc->plane);if (drm_format_plane_cpp (dev_priv->fbc.pixel_format,0 ) ==2 ) dpfc_ctl |=DPFC_CTL_LIMIT_2X ;
@@ -294,8 +299,6 @@ static void gen7_enable_fbc(struct drm_device *dev)I915_WRITE (DPFC_CPU_FENCE_OFFSET , dev_priv->fbc.y);sandybridge_blit_fbc_update (dev); - -DRM_DEBUG_KMS ("enabled fbc on plane %c\n" ,plane_name (crtc->plane)); }bool intel_fbc_enabled (struct drm_device *dev)
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 18/25 drm/i915: Add i915_fbc_info debugfs file
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add a debugfs file which shows the fbc state in all its glory.
--- drivers/gpu/drm/i915/i915_debugfs.c | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +44 -0
@@ -1444,6 +1444,49 @@ static int i915_drpc_info(struct seq_file *m, void *unused)return ironlake_drpc_info (m); } +static int i915_fbc_info (struct seq_file *m,void *unused) +{ +struct drm_info_node *node = m->private; +struct drm_device *dev = node->minor->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *crtc; + +intel_runtime_pm_get (dev_priv); + +mutex_lock (&dev_priv->fbc.mutex); + +seq_printf (m,"FBC state:\n" +"supported = %d\n" +"enabled in hardware = %d\n" +"compressed buffer size = %lu\n" +"score = %d\n" +"plane = %c\n" +"pixel_format = %s\n" +"pitch = %d\n" +"fence_reg = %d\n" +"y = %d\n" +"obj = %p\n" , +HAS_FBC (dev),intel_fbc_enabled (dev), + dev_priv->fbc.size, dev_priv->fbc.score, + dev_priv->fbc.crtc ? +plane_name (dev_priv->fbc.crtc->plane) :'?' , + dev_priv->fbc.pixel_format ? +drm_get_format_name (dev_priv->fbc.pixel_format) :"?" , + dev_priv->fbc.pitch, dev_priv->fbc.fence_reg, + dev_priv->fbc.y, dev_priv->fbc.obj); + +for_each_intel_crtc (dev, crtc) +seq_printf (m,"plane %c: score = %d, pending_score = %d\n" , +plane_name (crtc->plane), crtc->fbc.score, + crtc->fbc.pending_score); + +mutex_unlock (&dev_priv->fbc.mutex); + +intel_runtime_pm_put (dev_priv); + +return 0 ; +} +static int i915_fbc_status (struct seq_file *m,void *unused) {struct drm_info_node *node = m->private;
@@ -3807,6 +3850,7 @@ static const struct drm_info_list i915_debugfs_list[] = { {"i915_emon_status", i915_emon_status, 0}, {"i915_ring_freq_table", i915_ring_freq_table, 0}, {"i915_gfxec", i915_gfxec, 0}, + {"i915_fbc_info", i915_fbc_info, 0}, {"i915_fbc_status", i915_fbc_status, 0}, {"i915_ips_status", i915_ips_status, 0}, {"i915_sr_status", i915_sr_status, 0},
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 22/25 drm/i915: Flush caches for scanout during cpu->gtt move
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Flush the caches when moving a scanout buffer from CPU to GTT domain. This allows us to move a scanout buffer to CPU write domain, do some writes, and move it back to the GTT read domain. The display will then see the correct data. In addition we still need to do the dirtyfb ioctl to nuke FBC if that's enabled.
--- drivers/gpu/drm/i915/i915_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -3613,7 +3613,7 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)return ret;i915_gem_object_retire (obj); -i915_gem_object_flush_cpu_write_domain (obj, false); +i915_gem_object_flush_cpu_write_domain (obj, obj->pin_display);/* Serialise direct access to this object with the barriers for * coherent writes from the GPU, by effectively invalidating the
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 23/25 drm/i915: Nuke FBC from SW_FINISH ioctl
In reply to [email protected]From: Ville Syrjälä <[email protected]>
FBC host modification tracking only works through GTT mmaps, so any direct CPU access needs to manually nuke the compressed framebuffer on modifications. Do the nuking from the SW_FINISH ioctl.
v2: nuke from SW_FINISH insted of DIRTYFB ioctl
v3: Call intel_fbc_nuke() only when pin_display is true
v4: Don't oops if dev_priv->fbc.fb is NULL
v5: Rework based on fbc.mutex and fbc.obj
--- drivers/gpu/drm/i915/i915_gem.c | 8 ++++++++ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+)
drivers/gpu/drm/i915/i915_gem.c +8 -0
@@ -1434,6 +1434,7 @@ int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { + struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_gem_sw_finish *args = data;struct drm_i915_gem_object *obj;int ret =0 ;
@@ -1457,6 +1458,13 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,drm_gem_object_unreference (&obj->base); unlock:mutex_unlock (&dev->struct_mutex); + +if (ret ==0 ) { +mutex_lock (&dev_priv->fbc.mutex); +intel_fbc_nuke (obj); +mutex_unlock (&dev_priv->fbc.mutex); + } +return ret; }
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -977,6 +977,7 @@ void intel_fbc_post_plane_enable(struct intel_crtc *crtc);void intel_fbc_disable (struct intel_crtc *crtc);void intel_fbc_schedule_update (struct drm_device *dev);struct intel_crtc *intel_fbc_best_crtc (struct drm_device *dev); +void intel_fbc_nuke (struct drm_i915_gem_object *obj);void intel_gpu_ips_init (struct drm_i915_private *dev_priv);void intel_gpu_ips_teardown (void );int intel_power_domains_init (struct drm_i915_private *);
drivers/gpu/drm/i915/intel_pm.c +31 -0
@@ -362,6 +362,37 @@ void intel_fbc_disable(struct intel_crtc *crtc)__intel_fbc_disable (crtc); } +void intel_fbc_nuke (struct drm_i915_gem_object *obj) +{ +struct drm_device *dev = obj->base.dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *crtc = dev_priv->fbc.crtc; +unsigned int pending_score; +int ret; + +lockdep_assert_held (&dev_priv->fbc.mutex); + +if (dev_priv->fbc.obj != obj) +return ; + +if (!crtc) +return ; + +WARN_ON (crtc->fbc.pending_score ==0 ); + + pending_score = crtc->fbc.pending_score; +intel_fbc_disable (crtc); + crtc->fbc.pending_score = pending_score; + +/* +* Must wait until the next vblank before re-enabling +* otherwise the nuking won't actually happen. +*/ + crtc->fbc.notify.vbl_count =intel_crtc_vbl_count_rel_to_abs (crtc,1 ); + ret =intel_vblank_notify_add (crtc, &crtc->fbc.notify); +WARN_ON (ret !=0 ); +} +static bool set_no_fbc_reason (struct drm_i915_private *dev_priv,enum no_fbc_reason reason) {
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 21/25 drm/i915: Reorder i915_gem_execbuffer_move_to_gpu() and i915_switch_context()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The FBC RT address is stored in the context, and thus needs to be rewritten after a context switch before any batches are run. We emit the LRI to update the FBC RT address when we call the ring ->flush function to invalidate the caches.
When a context switch is being performed we currently do the invalidate before the context switch, which means we're not updating the FBC RT address correctly. Move the i915_gem_execbuffer_move_to_gpu() call to happen after i915_switch_context() to make the LRI happen after the MI_SET_CONTEXT.
v2: Rebased
--- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -2
@@ -1351,11 +1351,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,i915_gem_execbuffer_mark_fbc_dirty (ring, &eb->vmas); - ret =i915_gem_execbuffer_move_to_gpu (ring, &eb->vmas); + ret =i915_switch_context (ring, ctx);if (ret) goto err; - ret =i915_switch_context (ring, ctx); + ret =i915_gem_execbuffer_move_to_gpu (ring, &eb->vmas);if (ret) goto err;
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 20/25 drm/i915: Use LRI based FBC render tracking for ILK
In reply to [email protected]From: Ville Syrjälä <[email protected]>
ILK should work pretty much the same as SNB, except it doesn't have the blitter, so we only care about render tracking.
v2: Rebased against earlier changes
v3: Rebased due to fbc.obj changes
--- drivers/gpu/drm/i915/i915_reg.h | 2 +- drivers/gpu/drm/i915/intel_pm.c | 3 --- drivers/gpu/drm/i915/intel_ringbuffer.c | 5 ++++- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -1503,7 +1503,7 @@ enum punit_power_well {#define ILK_DPFC_CHICKEN 0x43224#define ILK_FBC_RT_BASE 0x2128#define ILK_FBC_RT_VALID (1<<0) -#define SNB_FBC_FRONT_BUFFER (1<<1) +#define ILK_FBC_FRONT_BUFFER (1<<1)#define ILK_DISPLAY_CHICKEN1 0x42000#define ILK_FBCQ_DIS (1<<22)
drivers/gpu/drm/i915/intel_pm.c +0 -3
@@ -204,9 +204,6 @@ static void ironlake_enable_fbc(struct drm_device *dev) dpfc_ctl |= dev_priv->fbc.fence_reg;I915_WRITE (ILK_DPFC_FENCE_YOFF , dev_priv->fbc.y); -if (IS_GEN5 (dev)) -I915_WRITE (ILK_FBC_RT_BASE ,i915_gem_obj_ggtt_offset (dev_priv->fbc.obj) | -ILK_FBC_RT_VALID );/* enable it... */ I915_WRITE (ILK_DPFC_CONTROL , dpfc_ctl |DPFC_CTL_EN );
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -1
@@ -85,7 +85,7 @@ static int gen5_render_fbc_tracking(struct intel_engine_cs *ring)intel_ring_emit (ring,ILK_FBC_RT_BASE );if (ring->fbc_address !=-1 )intel_ring_emit (ring, ring->fbc_address | -SNB_FBC_FRONT_BUFFER |ILK_FBC_RT_VALID ); +ILK_FBC_FRONT_BUFFER |ILK_FBC_RT_VALID );else intel_ring_emit (ring,0 );intel_ring_advance (ring);
@@ -201,6 +201,9 @@ gen4_render_ring_flush(struct intel_engine_cs *ring,intel_ring_emit (ring,MI_NOOP );intel_ring_advance (ring); +if (invalidate_domains &&IS_GEN5 (dev)) +return gen5_render_fbc_tracking (ring); +return 0 ; }
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 24/25 drm/i915: Pimp fbc render/blitter tracking
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The FBC RT address is saved as part of the context, so track it the same way in the driver to skip pointless LRIs. Also try make sure we re-emit the render/blitter tracking stuff on driver load and gpu reset.
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem.c | 3 +++ drivers/gpu/drm/i915/i915_gem_context.c | 21 ++++++++++++++------- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 27 +++++++++++++++++---------- drivers/gpu/drm/i915/intel_ringbuffer.c | 17 ++++++++++------- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 +++++-- 6 files changed, 50 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -587,6 +587,7 @@ struct i915_ctx_hang_stats {#define DEFAULT_CONTEXT_ID 0struct intel_context {struct kref ref; +unsigned long fbc_address;int id;bool is_initialized;uint8_t remap_slice;
drivers/gpu/drm/i915/i915_gem.c +3 -0
@@ -2563,6 +2563,9 @@ static void i915_gem_reset_ring_cleanup(struct drm_i915_private *dev_priv, ring->preallocated_lazy_request =NULL ; ring->outstanding_lazy_seqno =0 ; +/* current state unknown so force a FBC RT address update */ + ring->fbc_address =I915_FBC_RT_RESET ; +spin_lock_irq (&ring->lock);list_for_each_entry_safe (notify, next, &ring->notify_list, list) {intel_ring_notify_complete (notify);
drivers/gpu/drm/i915/i915_gem_context.c +14 -7
@@ -273,6 +273,9 @@ __create_hw_context(struct drm_device *dev,* is no remap info, it will be a NOP. */ ctx->remap_slice = (1 <<NUM_L3_SLICES (dev)) -1 ; +/* force a re-emit FBC RT address on first use */ + ctx->fbc_address =I915_FBC_RT_RESET ; +return ctx; err_out:
@@ -359,6 +362,7 @@ err_destroy:void i915_gem_context_reset (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_context *ctx;int i;/* Prevent the hardware from restoring the last context (which hung) on
@@ -386,6 +390,13 @@ void i915_gem_context_reset(struct drm_device *dev)i915_gem_context_reference (dctx); ring->last_context = dctx; } + +/* +* FBC RT address update(s) may have been lost, +* just have everyone re-emit them. +*/ +list_for_each_entry (ctx, &dev_priv->context_list, link) + ctx->fbc_address =I915_FBC_RT_RESET ; }int i915_gem_context_init (struct drm_device *dev)
@@ -588,13 +599,6 @@ mi_set_context(struct intel_engine_cs *ring,intel_ring_advance (ring); -/* -* FBC RT address is stored in the context, so we may have just -* restored it to an old value. Make sure we emit a new LRI -* to update the address. -*/ - ring->fbc_address_dirty = true; -return ret; }
@@ -667,6 +671,9 @@ static int do_switch(struct intel_engine_cs *ring,if (ret) goto unpin_out; +if ((hw_flags &MI_RESTORE_INHIBIT ) ==0 ) + ring->fbc_address = to->fbc_address; +for (i =0 ; i <MAX_L3_SLICES ; i++) {if (!(to->remap_slice & (1 <<i)))continue ;
drivers/gpu/drm/i915/i915_gem_execbuffer.c +17 -10
@@ -956,29 +956,33 @@ i915_gem_validate_context(struct drm_device *dev, struct drm_file *file,static void i915_gem_execbuffer_mark_fbc_dirty (struct intel_engine_cs *ring, +struct intel_context *ctx,struct list_head *vmas) {struct drm_i915_private *dev_priv = ring->dev->dev_private;struct i915_vma *vma; -u32 fbc_address =-1 ; +unsigned long fbc_address =I915_FBC_RT_NONE ;list_for_each_entry (vma, vmas, exec_list) {struct drm_i915_gem_object *obj = vma->obj;if (obj->base.pending_write_domain && obj == dev_priv->fbc.obj) { -WARN_ON (fbc_address !=-1 && - fbc_address !=i915_gem_obj_ggtt_offset (obj)); - fbc_address =i915_gem_obj_ggtt_offset (obj); +WARN_ON (fbc_address !=I915_FBC_RT_NONE && + fbc_address != vma->node.start); + fbc_address = vma->node.start; } } -/* need to nuke/cache_clean on IVB+? */ - ring->fbc_dirty |= fbc_address !=-1 ; -/* need to update FBC tracking? */ - ring->fbc_address_dirty |= fbc_address != ring->fbc_address; - ring->fbc_address = fbc_address; + +/* simple yes/no is sufficient for !RCS */ +if (ring->id !=RCS && fbc_address !=I915_FBC_RT_NONE ) + ring->pending_fbc_address =0 ; +else + ring->pending_fbc_address = fbc_address; + + ring->fbc_dirty |= fbc_address !=I915_FBC_RT_NONE ; } static void
@@ -1349,7 +1353,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,else exec_start +=i915_gem_obj_offset (batch_obj, vm); -i915_gem_execbuffer_mark_fbc_dirty (ring, &eb->vmas); +i915_gem_execbuffer_mark_fbc_dirty (ring, ctx, &eb->vmas); ret =i915_switch_context (ring, ctx);if (ret)
@@ -1359,6 +1363,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,if (ret) goto err; +if (HAS_HW_CONTEXTS (dev) && ring->id ==RCS ) + ctx->fbc_address = ring->fbc_address; +if (ring == &dev_priv->ring[RCS ] && mode != dev_priv->relative_constants_mode) { ret =intel_ring_begin (ring,4 );
drivers/gpu/drm/i915/intel_ringbuffer.c +10 -7
@@ -73,7 +73,7 @@ static int gen5_render_fbc_tracking(struct intel_engine_cs *ring) {int ret; -if (!ring->fbc_address_dirty) +if (ring->fbc_address == ring->pending_fbc_address)return 0 ; ret =intel_ring_begin (ring,4 );
@@ -83,14 +83,14 @@ static int gen5_render_fbc_tracking(struct intel_engine_cs *ring)intel_ring_emit (ring,MI_NOOP );intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 ));intel_ring_emit (ring,ILK_FBC_RT_BASE ); -if (ring->fbc_address !=-1 ) -intel_ring_emit (ring, ring->fbc_address | +if (ring->pending_fbc_address !=I915_FBC_RT_NONE ) +intel_ring_emit (ring, ring->pending_fbc_address |ILK_FBC_FRONT_BUFFER |ILK_FBC_RT_VALID );else intel_ring_emit (ring,0 );intel_ring_advance (ring); - ring->fbc_address_dirty = false; + ring->fbc_address = ring->pending_fbc_address;return 0 ; }
@@ -99,7 +99,7 @@ static int gen6_blt_fbc_tracking(struct intel_engine_cs *ring) {int ret; -if (!ring->fbc_address_dirty) +if (ring->fbc_address == ring->pending_fbc_address)return 0 ; ret =intel_ring_begin (ring,4 );
@@ -109,13 +109,13 @@ static int gen6_blt_fbc_tracking(struct intel_engine_cs *ring)intel_ring_emit (ring,MI_NOOP );intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 ));intel_ring_emit (ring,GEN6_BLITTER_ECOSKPD ); -if (ring->fbc_address !=-1 ) +if (ring->pending_fbc_address !=I915_FBC_RT_NONE )intel_ring_emit (ring,_MASKED_BIT_ENABLE (GEN6_BLITTER_FBC_NOTIFY ));else intel_ring_emit (ring,_MASKED_BIT_DISABLE (GEN6_BLITTER_FBC_NOTIFY ));intel_ring_advance (ring); - ring->fbc_address_dirty = false; + ring->fbc_address = ring->pending_fbc_address;return 0 ; }
@@ -1505,6 +1505,9 @@ static int intel_init_ring_buffer(struct drm_device *dev,init_waitqueue_head (&ring->irq_queue); +/* current state unknown so force a FBC RT address update */ + ring->fbc_address =I915_FBC_RT_RESET ; +INIT_LIST_HEAD (&ring->notify_list);spin_lock_init (&ring->lock);
drivers/gpu/drm/i915/intel_ringbuffer.h +5 -2
@@ -175,11 +175,14 @@ struct intel_engine_cs {* Do we have some not yet emitted requests outstanding? */ struct drm_i915_gem_request *preallocated_lazy_request; + +#define I915_FBC_RT_NONE 1/* FBC RT disabled */ +#define I915_FBC_RT_RESET 2/* force re-emit of FBC RT */ +unsigned long fbc_address, pending_fbc_address; +u32 outstanding_lazy_seqno; -u32 fbc_address; bool gpu_caches_dirty:1; bool fbc_dirty:1; - bool fbc_address_dirty:1;wait_queue_head_t irq_queue;
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 25/25 drm/i915: Enable fbc for ilk+ by default
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Things should work just fine now for FBC2 platforms. However on g4x we don't have any code to set up the FBC watermarks so I'm hesitant to enable it there by default. FBC1 platforms could use more testing, and also my 855 seems to experience some GPU+system hangs occasionally when FBC is enabled. So FBC1 seems to need further investigations.
--- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -776,7 +776,7 @@ struct intel_crtc *intel_fbc_best_crtc(struct drm_device *dev)return NULL ; } -if (i915.enable_fbc <0 ) { +if (i915.enable_fbc <0 &&INTEL_INFO (dev)->gen <5 ) {if (set_no_fbc_reason (dev_priv,FBC_CHIP_DEFAULT ))DRM_DEBUG_KMS ("fbc disabled per chip default\n" );return NULL ;
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 28 lines · On Wed, Jun 18, 2014 at 08:58:33PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
This series rewrites the FBC code to actually work. It utilizes the hardware tracking/nuking as much as possible, eg. relying on hardware nuke on flip when possible.
I also introduce the generic ring and vblank notifier gizmos which could be used for various other things. I already included a patch to convert the IPS enable to be asynchronous by using the vblank notifier. Other users for thse could be mmio flips, watermark programming, atomic gamma/color correction (single buffered registers all) updates from vblank interrupt, etc.
There's also a rather big behavioural change that FBC now stays enabled even when multiple pipes are active. FBC just automatially migrates to the primary plane where it's deemed most beneficial. We do that determination by looking at the rate at which the plane is pulling data (pixel rate * cpp). That seems like a reasonable choice all else being equal. Eventually we might want to adjust the FBC score based on nuke/invalidate frequency as well.
The locking now has a new fbc.mutex. I had to split the page flip code apart a bit to accomondate. I'm not entirely sure if it wouldn't be better to just keep
struct_mutexlocked all through there, but then I'd need rework the locking in the fbc code to not takestruct_mutexwhen called from the page flip code. And then I'd have to start questioning whether fbc.mutex has any point existing.
Quoted 2 lines
I pushed the lot here:
git://gitorious.org/vsyrjala/linux.gitfbc_update_thing_14
Just very cursory look at it, but this conflicts badly (well the integration with the driver) with my frontbuffer tracking stuff. My idea was to essentially hide all the fbc integration points we have sprinkled all over behind that one and maybe even switch to manual invalidation for gt rendering with a cpu register write and ditch all the complexity we have with injecting cmds into rings right now.
Other integration points would be an fbc enable called from crtc_enable to check the basics (like screen size to allocate the fbc backing buffers). And then an additional function called every time we update the primary buffer to check for e.g. pixel depth and stuff like that. Post-flip updates would exclusively happen through the frontbuffer tracking scheme.
Just dumping my high-level thoughts.
-Daniel
Quoted 55 lines
Ville Syrjälä (25):
drm/i915: Addring_notifymechanism
drm/i915: Add vblank notify mechanism
drm/i915: Name the IPS bits
drm/i915: Use vblank notifier for IPS
drm/i915: Reogranize page flip code for fbc
drm/i915: Moveilk_pipe_pixel_rate()earlier to avoid forward
declaration
drm/i915: Reorganizeintel_update_fbc()
drm/i915: Check panel fitting state before enabling fbc drm/i915: Reject fbc on g4x when sprites are enabled drm/i915: Check pixel format for fbc
drm/i915: Remove dblscan flag from fbc1 check
drm/i915: Don't claim fbc as possible if the obj size exceeds stolen
size
drm/i915: Use low level funciton to disable fbc at init/resume drm/i915: Move fbc function prototypes gotintel_drv.hdrm/i915: Move fbc state into dev_priv.fbc
drm/i915: Rewrite fbc
drm/i915: Reduce dmesg spam from FBC enable
drm/i915: Addi915_fbc_infodebugfs file
drm/i915: Implement LRI based FBC tracking
drm/i915: Use LRI based FBC render tracking for ILK drm/i915: Reorderi915_gem_execbuffer_move_to_gpu()andi915_switch_context()drm/i915: Flush caches for scanout during
cpu->gttmove drm/i915: Nuke FBC fromSW_FINISHioctl drm/i915: Pimp fbc render/blitter tracking drm/i915: Enable fbc for ilk+ by defaultdrivers/gpu/drm/i915/i915_debugfs.c | 60 +- drivers/gpu/drm/i915/i915_drv.c | 3 + drivers/gpu/drm/i915/i915_drv.h | 44 +- drivers/gpu/drm/i915/i915_gem.c | 23 +- drivers/gpu/drm/i915/i915_gem_context.c | 14 + drivers/gpu/drm/i915/i915_gem_execbuffer.c | 40 +- drivers/gpu/drm/i915/i915_irq.c | 12 + drivers/gpu/drm/i915/i915_reg.h | 3 +- drivers/gpu/drm/i915/i915_suspend.c | 5 +- drivers/gpu/drm/i915/intel_display.c | 399 ++++++++-- drivers/gpu/drm/i915/intel_drv.h | 30 +- drivers/gpu/drm/i915/intel_pm.c | 1099 +++++++++++++++++++--------- drivers/gpu/drm/i915/intel_ringbuffer.c | 154 +++- drivers/gpu/drm/i915/intel_ringbuffer.h | 26 +- drivers/gpu/drm/i915/intel_sprite.c | 15 +- 15 files changed, 1483 insertions(+), 444 deletions(-)Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Quoted 6 lines · Daniel Vetter
Just very cursory look at it, but this conflicts badly (well the integration with the driver) with my frontbuffer tracking stuff. My idea was to essentially hide all the fbc integration points we have sprinkled all over behind that one and maybe even switch to manual invalidation for gt rendering with a cpu register write and ditch all the complexity we have with injecting cmds into rings right now.
I'm inclined to agree. I think it would be (on the GEM side) much simpler and be a much better base to build upon.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 32 lines · Daniel Vetter
Quoted 28 lines · On Wed, Jun 18, 2014 at 08:58:33PM +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
This series rewrites the FBC code to actually work. It utilizes the hardware tracking/nuking as much as possible, eg. relying on hardware nuke on flip when possible.
I also introduce the generic ring and vblank notifier gizmos which could be used for various other things. I already included a patch to convert the IPS enable to be asynchronous by using the vblank notifier. Other users for thse could be mmio flips, watermark programming, atomic gamma/color correction (single buffered registers all) updates from vblank interrupt, etc.
There's also a rather big behavioural change that FBC now stays enabled even when multiple pipes are active. FBC just automatially migrates to the primary plane where it's deemed most beneficial. We do that determination by looking at the rate at which the plane is pulling data (pixel rate * cpp). That seems like a reasonable choice all else being equal. Eventually we might want to adjust the FBC score based on nuke/invalidate frequency as well.
The locking now has a new fbc.mutex. I had to split the page flip code apart a bit to accomondate. I'm not entirely sure if it wouldn't be better to just keep
struct_mutexlocked all through there, but then I'd need rework the locking in the fbc code to not takestruct_mutexwhen called from the page flip code. And then I'd have to start questioning whether fbc.mutex has any point existing.Quoted 2 lines
I pushed the lot here:
git://gitorious.org/vsyrjala/linux.gitfbc_update_thing_14
Quoted 6 lines
Just very cursory look at it, but this conflicts badly (well the integration with the driver) with my frontbuffer tracking stuff. My idea was to essentially hide all the fbc integration points we have sprinkled all over behind that one and maybe even switch to manual invalidation for gt rendering with a cpu register write and ditch all the complexity we have with injecting cmds into rings right now.
Well yeah if you want to kill the hardware tracking entirely the end result ought to have less code, especially since psr needs the software tracking anyway. Although on certain (older) platforms you can't really turn off the hardware tracking, so the software tracking is somewhat pointless.
Anyways, I think you're going to have to find another sucker to do that work if you want to go that way. I don't think I'll have time for major redesigns until maybe next year.
Signature · 2 lines
Ville Syrjälä Intel OTC