[Intel-gfx] [PATCH] drm/i915: Avoid unnecessary full synchronize for fbdev
Lukas Wunner
lukas at wunner.de
Thu Mar 31 15:12:03 UTC 2016
This should make the code less fragile by synchronizing only up to the
relevant cookie. Otherwise we risk deadlocks particularly during suspend
and resume.
Signed-off-by: Lukas Wunner <lukas at wunner.de>
---
drivers/gpu/drm/i915/intel_drv.h | 1 +
drivers/gpu/drm/i915/intel_fbdev.c | 14 +++++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 6ac46d9..5bc9606 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -158,6 +158,7 @@ struct intel_framebuffer {
struct intel_fbdev {
struct drm_fb_helper helper;
struct intel_framebuffer *fb;
+ async_cookie_t init_cookie;
int preferred_bpp;
};
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 153ea7a..8254ac8d 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -725,7 +725,7 @@ int intel_fbdev_init(struct drm_device *dev)
return 0;
}
-static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
+static void intel_fbdev_initial_config(void *data, async_cookie_t init_cookie)
{
struct drm_i915_private *dev_priv = data;
struct intel_fbdev *ifbdev = dev_priv->fbdev;
@@ -738,7 +738,11 @@ static void intel_fbdev_initial_config(void *data, async_cookie_t cookie)
void intel_fbdev_initial_config_async(struct drm_device *dev)
{
- async_schedule(intel_fbdev_initial_config, to_i915(dev));
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct intel_fbdev *ifbdev = dev_priv->fbdev;
+
+ ifbdev->init_cookie = async_schedule(intel_fbdev_initial_config,
+ dev_priv);
}
void intel_fbdev_fini(struct drm_device *dev)
@@ -750,7 +754,7 @@ void intel_fbdev_fini(struct drm_device *dev)
flush_work(&dev_priv->fbdev_suspend_work);
if (!current_is_async())
- async_synchronize_full();
+ async_synchronize_cookie(dev_priv->fbdev->init_cookie);
intel_fbdev_destroy(dev, dev_priv->fbdev);
kfree(dev_priv->fbdev);
dev_priv->fbdev = NULL;
@@ -809,7 +813,7 @@ void intel_fbdev_output_poll_changed(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
- async_synchronize_full();
+ async_synchronize_cookie(dev_priv->fbdev->init_cookie);
if (dev_priv->fbdev)
drm_fb_helper_hotplug_event(&dev_priv->fbdev->helper);
}
@@ -821,7 +825,7 @@ void intel_fbdev_restore_mode(struct drm_device *dev)
struct intel_fbdev *ifbdev = dev_priv->fbdev;
struct drm_fb_helper *fb_helper;
- async_synchronize_full();
+ async_synchronize_cookie(dev_priv->fbdev->init_cookie);
if (!ifbdev)
return;
--
2.8.0.rc3
More information about the Intel-gfx
mailing list