diff mbox

[i915,v5,2/2] i915: wait for fence in prepare_plane_fb

Message ID fe54deb449515a0d7dfa428f98e87a8780345832.1448057111.git.agoins@nvidia.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Goins Nov. 20, 2015, 10:09 p.m. UTC
In intel_prepare_plane_fb, if fb is backed by dma-buf, wait for exclusive
fence

v2: First commit
v3: Remove object_name_lock acquire
    Move wait from intel_atomic_commit() to intel_prepare_plane_fb()
v4: Wait only on exclusive fences, interruptible with no timeout
v5: Style tweaks to more closely match rest of file

Signed-off-by: Alex Goins <agoins@nvidia.com>
---
 drivers/gpu/drm/i915/intel_display.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Maarten Lankhorst Nov. 23, 2015, 8:44 a.m. UTC | #1
Op 20-11-15 om 23:09 schreef Alex Goins:
> In intel_prepare_plane_fb, if fb is backed by dma-buf, wait for exclusive
> fence
>
> v2: First commit
> v3: Remove object_name_lock acquire
>     Move wait from intel_atomic_commit() to intel_prepare_plane_fb()
> v4: Wait only on exclusive fences, interruptible with no timeout
> v5: Style tweaks to more closely match rest of file
>
> Signed-off-by: Alex Goins <agoins@nvidia.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index eef3475..f5ab8a7 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13347,6 +13347,12 @@ intel_prepare_plane_fb(struct drm_plane *plane,
>  	if (!obj)
>  		return 0;
>  
> +	/* For framebuffer backed by dmabuf, wait for fence */
> +	if (obj->base.dma_buf)
> +		reservation_object_wait_timeout_rcu(obj->base.dma_buf->resv,
> +						    false, true,
> +						    MAX_SCHEDULE_TIMEOUT);
>
This is missing -ERESTARTSYS handling for interruptible waits here.

Full error handling could be fun with radeon fences, which may return -EDEADLK. Maybe it's best to only warn if an error other than -ERESTARTSYS is returned, and continue.
There's not much recovery we can do if someone else's fence returns an error.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index eef3475..f5ab8a7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13347,6 +13347,12 @@  intel_prepare_plane_fb(struct drm_plane *plane,
 	if (!obj)
 		return 0;
 
+	/* For framebuffer backed by dmabuf, wait for fence */
+	if (obj->base.dma_buf)
+		reservation_object_wait_timeout_rcu(obj->base.dma_buf->resv,
+						    false, true,
+						    MAX_SCHEDULE_TIMEOUT);
+
 	mutex_lock(&dev->struct_mutex);
 
 	if (plane->type == DRM_PLANE_TYPE_CURSOR &&