Re: [PATCH 2/2] drm/i915: Move drm_framebuffer_unreference out of struct_mutex for takeover

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi,

On 02/16/2015 02:31 PM, Chris Wilson wrote:
intel_user_framebuffer_destroy() requires the struct_mutex for its
object bookkeeping, so this means that all calls to
drm_framebuffer_reference must be held without that lock.

Same comment on the commit message as 1/2.

References: https://bugs.freedesktop.org/show_bug.cgi?id=89166
Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
  drivers/gpu/drm/i915/intel_display.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 6e1da7da5cca..aba36662d511 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13672,6 +13672,8 @@ void intel_modeset_gem_init(struct drm_device *dev)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	struct drm_crtc *c;
  	struct drm_i915_gem_object *obj;
+	struct drm_plane *unused[I915_MAX_PIPES];
+	int n_unused = 0;

  	mutex_lock(&dev->struct_mutex);
  	intel_init_gt_powersave(dev);
@@ -13707,13 +13709,18 @@ void intel_modeset_gem_init(struct drm_device *dev)
  					       NULL)) {
  			DRM_ERROR("failed to pin boot fb on pipe %d\n",
  				  to_intel_crtc(c)->pipe);
-			drm_framebuffer_unreference(c->primary->fb);
-			c->primary->fb = NULL;
-			update_state_fb(c->primary);
+			unused[n_unused++] = c->primary;
  		}
  	}
  	mutex_unlock(&dev->struct_mutex);

+	while (n_unused--) {
+		struct drm_plane *p = unused[n_unused];
+		drm_framebuffer_unreference(p->fb);
+		p->fb = NULL;
+		update_state_fb(p);
+	}
+

For this one I am not sure. Should c->primary->fb = NULL remain under the locked loop? If not what is the the mutex protecting then?

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux