diff mbox

[1/3] drm/scheduler: fix a corner case in dependency optimization

Message ID 20180525044548.21014-1-nayan26deshmukh@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Nayan Deshmukh May 25, 2018, 4:45 a.m. UTC
When checking for a dependency fence for belonging to the same entity
compare it with scheduled as well finished fence. Earlier we were only
comparing it with the scheduled fence.

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
---
 drivers/gpu/drm/scheduler/gpu_scheduler.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Christian König May 25, 2018, 12:01 p.m. UTC | #1
Am 25.05.2018 um 06:45 schrieb Nayan Deshmukh:
> When checking for a dependency fence for belonging to the same entity
> compare it with scheduled as well finished fence. Earlier we were only
> comparing it with the scheduled fence.
>
> Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>

Reviewed and pushed this patch into our internal repository.

Now going to take a look at the rest,
Christian.

> ---
>   drivers/gpu/drm/scheduler/gpu_scheduler.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
> index df1578d6f42e..44d480768dfe 100644
> --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
> @@ -349,8 +349,13 @@ static bool drm_sched_entity_add_dependency_cb(struct drm_sched_entity *entity)
>   	struct dma_fence * fence = entity->dependency;
>   	struct drm_sched_fence *s_fence;
>   
> -	if (fence->context == entity->fence_context) {
> -		/* We can ignore fences from ourself */
> +	if (fence->context == entity->fence_context ||
> +            fence->context == entity->fence_context + 1) {
> +                /*
> +                 * Fence is a scheduled/finished fence from a job
> +                 * which belongs to the same entity, we can ignore
> +                 * fences from ourself
> +                 */
>   		dma_fence_put(entity->dependency);
>   		return false;
>   	}
diff mbox

Patch

diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
index df1578d6f42e..44d480768dfe 100644
--- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
@@ -349,8 +349,13 @@  static bool drm_sched_entity_add_dependency_cb(struct drm_sched_entity *entity)
 	struct dma_fence * fence = entity->dependency;
 	struct drm_sched_fence *s_fence;
 
-	if (fence->context == entity->fence_context) {
-		/* We can ignore fences from ourself */
+	if (fence->context == entity->fence_context ||
+            fence->context == entity->fence_context + 1) {
+                /*
+                 * Fence is a scheduled/finished fence from a job
+                 * which belongs to the same entity, we can ignore
+                 * fences from ourself
+                 */
 		dma_fence_put(entity->dependency);
 		return false;
 	}