[Intel-gfx] [PATCH 2/3] drm/i915: Add waitq/wakeups for our per fd requests
Ben Widawsky
ben at bwidawsk.net
Sat Oct 29 07:55:28 CEST 2011
With the previous patch we got counts of outstanding requests per i915
client. It's trivial now to add a waitqueue, and wakeup events for
arbitrary thresholds.
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
drivers/gpu/drm/i915/i915_dma.c | 1 +
drivers/gpu/drm/i915/i915_drv.c | 3 +++
drivers/gpu/drm/i915/i915_drv.h | 3 +++
drivers/gpu/drm/i915/i915_gem.c | 5 +++++
4 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 2eac955..92be278 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -2204,6 +2204,7 @@ int i915_driver_open(struct drm_device *dev, struct drm_file *file)
spin_lock_init(&file_priv->mm.lock);
INIT_LIST_HEAD(&file_priv->mm.request_list);
+ init_waitqueue_head(&file_priv->mm.request_waitq);
return 0;
}
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 4c8d681..34289ab 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -102,6 +102,9 @@ MODULE_PARM_DESC(enable_hangcheck,
"WARNING: Disabling this can cause system wide hangs. "
"(default: true)");
+/* Default sched options to off */
+unsigned int i915_sched_hog_threshold __read_mostly = -1;
+unsigned int i915_sched_low_watermark __read_mostly = -1;
static struct drm_driver driver;
extern int intel_agp_enabled;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index a251d22..a063dc5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -920,6 +920,7 @@ struct drm_i915_file_private {
struct spinlock lock;
struct list_head request_list;
atomic_t outstanding_requests;
+ wait_queue_head_t request_waitq;
} mm;
};
@@ -1005,6 +1006,8 @@ extern int i915_vbt_sdvo_panel_type __read_mostly;
extern unsigned int i915_enable_rc6 __read_mostly;
extern unsigned int i915_enable_fbc __read_mostly;
extern bool i915_enable_hangcheck __read_mostly;
+extern unsigned int i915_sched_hog_threshold __read_mostly;
+extern unsigned int i915_sched_low_watermark __read_mostly;
extern int i915_suspend(struct drm_device *dev, pm_message_t state);
extern int i915_resume(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 20d8a41..26b4b81 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1711,6 +1711,10 @@ i915_gem_request_remove_from_client(struct drm_i915_gem_request *request)
if (WARN_ON(atomic_read(&file_priv->mm.outstanding_requests) < 0)) {
atomic_set(&file_priv->mm.outstanding_requests, 0);
}
+ if (atomic_read(&file_priv->mm.outstanding_requests) <
+ i915_sched_low_watermark) {
+ wake_up_all(&file_priv->mm.request_waitq);
+ }
list_del(&request->client_list);
request->file_priv = NULL;
}
@@ -4117,6 +4121,7 @@ void i915_gem_release(struct drm_device *dev, struct drm_file *file)
* file_priv.
*/
spin_lock(&file_priv->mm.lock);
+ wake_up_all(&file_priv->mm.request_waitq);
while (!list_empty(&file_priv->mm.request_list)) {
struct drm_i915_gem_request *request;
--
1.7.7.1
More information about the Intel-gfx
mailing list