dri-devel Archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: move ring syncing after bo validation
@ 2012-02-03  9:26 Christian König
  2012-02-03 14:14 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Christian König @ 2012-02-03  9:26 UTC (permalink / raw
  To: dri-devel; +Cc: Christian König

The function radeon_bo_list_validate can cause a
bo to move, resulting in a different sync_obj
and a dependency to wait for this move to finish.

Signed-off-by: Christian König <deathsimple@vodafone.de>
---
 drivers/gpu/drm/radeon/radeon.h    |    1 -
 drivers/gpu/drm/radeon/radeon_cs.c |   21 ++++++++++++++-------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 73e05cb..43f29ad 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -792,7 +792,6 @@ struct radeon_cs_parser {
 	struct radeon_cs_reloc	*relocs;
 	struct radeon_cs_reloc	**relocs_ptr;
 	struct list_head	validated;
-	bool			sync_to_ring[RADEON_NUM_RINGS];
 	/* indices of various chunks */
 	int			chunk_ib_idx;
 	int			chunk_relocs_idx;
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index 435a3d9..7fd0987 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -85,12 +85,6 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
 			radeon_bo_list_add_object(&p->relocs[i].lobj,
 						  &p->validated);
 
-			if (p->relocs[i].robj->tbo.sync_obj && !(r->flags & RADEON_RELOC_DONT_SYNC)) {
-				struct radeon_fence *fence = p->relocs[i].robj->tbo.sync_obj;
-				if (!radeon_fence_signaled(fence)) {
-					p->sync_to_ring[fence->ring] = true;
-				}
-			}
 		} else
 			p->relocs[i].handle = 0;
 	}
@@ -118,11 +112,24 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority
 
 static int radeon_cs_sync_rings(struct radeon_cs_parser *p)
 {
+	bool sync_to_ring[RADEON_NUM_RINGS] = { };
 	int i, r;
 
+	for (i = 0; i < p->nrelocs; i++) {
+		if (!p->relocs[i].robj || !p->relocs[i].robj->tbo.sync_obj)
+			continue;
+
+		if (!(p->relocs[i].flags & RADEON_RELOC_DONT_SYNC)) {
+			struct radeon_fence *fence = p->relocs[i].robj->tbo.sync_obj;
+			if (!radeon_fence_signaled(fence)) {
+				sync_to_ring[fence->ring] = true;
+			}
+		}
+	}
+
 	for (i = 0; i < RADEON_NUM_RINGS; ++i) {
 		/* no need to sync to our own or unused rings */
-		if (i == p->ring || !p->sync_to_ring[i] || !p->rdev->ring[i].ready)
+		if (i == p->ring || !sync_to_ring[i] || !p->rdev->ring[i].ready)
 			continue;
 
 		if (!p->ib->fence->semaphore) {
-- 
1.7.5.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/radeon: move ring syncing after bo validation
  2012-02-03  9:26 [PATCH] drm/radeon: move ring syncing after bo validation Christian König
@ 2012-02-03 14:14 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2012-02-03 14:14 UTC (permalink / raw
  To: Christian König; +Cc: dri-devel

2012/2/3 Christian König <deathsimple@vodafone.de>:
> The function radeon_bo_list_validate can cause a
> bo to move, resulting in a different sync_obj
> and a dependency to wait for this move to finish.
>
> Signed-off-by: Christian König <deathsimple@vodafone.de>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/radeon/radeon.h    |    1 -
>  drivers/gpu/drm/radeon/radeon_cs.c |   21 ++++++++++++++-------
>  2 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 73e05cb..43f29ad 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -792,7 +792,6 @@ struct radeon_cs_parser {
>        struct radeon_cs_reloc  *relocs;
>        struct radeon_cs_reloc  **relocs_ptr;
>        struct list_head        validated;
> -       bool                    sync_to_ring[RADEON_NUM_RINGS];
>        /* indices of various chunks */
>        int                     chunk_ib_idx;
>        int                     chunk_relocs_idx;
> diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
> index 435a3d9..7fd0987 100644
> --- a/drivers/gpu/drm/radeon/radeon_cs.c
> +++ b/drivers/gpu/drm/radeon/radeon_cs.c
> @@ -85,12 +85,6 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
>                        radeon_bo_list_add_object(&p->relocs[i].lobj,
>                                                  &p->validated);
>
> -                       if (p->relocs[i].robj->tbo.sync_obj && !(r->flags & RADEON_RELOC_DONT_SYNC)) {
> -                               struct radeon_fence *fence = p->relocs[i].robj->tbo.sync_obj;
> -                               if (!radeon_fence_signaled(fence)) {
> -                                       p->sync_to_ring[fence->ring] = true;
> -                               }
> -                       }
>                } else
>                        p->relocs[i].handle = 0;
>        }
> @@ -118,11 +112,24 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority
>
>  static int radeon_cs_sync_rings(struct radeon_cs_parser *p)
>  {
> +       bool sync_to_ring[RADEON_NUM_RINGS] = { };
>        int i, r;
>
> +       for (i = 0; i < p->nrelocs; i++) {
> +               if (!p->relocs[i].robj || !p->relocs[i].robj->tbo.sync_obj)
> +                       continue;
> +
> +               if (!(p->relocs[i].flags & RADEON_RELOC_DONT_SYNC)) {
> +                       struct radeon_fence *fence = p->relocs[i].robj->tbo.sync_obj;
> +                       if (!radeon_fence_signaled(fence)) {
> +                               sync_to_ring[fence->ring] = true;
> +                       }
> +               }
> +       }
> +
>        for (i = 0; i < RADEON_NUM_RINGS; ++i) {
>                /* no need to sync to our own or unused rings */
> -               if (i == p->ring || !p->sync_to_ring[i] || !p->rdev->ring[i].ready)
> +               if (i == p->ring || !sync_to_ring[i] || !p->rdev->ring[i].ready)
>                        continue;
>
>                if (!p->ib->fence->semaphore) {
> --
> 1.7.5.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-03 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03  9:26 [PATCH] drm/radeon: move ring syncing after bo validation Christian König
2012-02-03 14:14 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).