All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer.
@ 2010-02-04  1:42 Pauli Nieminen
  2010-02-04 16:32 ` Jerome Glisse
  0 siblings, 1 reply; 5+ messages in thread
From: Pauli Nieminen @ 2010-02-04  1:42 UTC (permalink / raw)
  To: dri-devel; +Cc: airlied

Cache flush is required in case CPU is accessing rendered data.

This fixes glean/readPixSanity test case and random rendering
errors in sauerbraten.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
---
 drivers/gpu/drm/radeon/r100.c       |    6 ++++++
 drivers/gpu/drm/radeon/radeon_reg.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 11c9a3f..6f4f7ea 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -357,6 +357,12 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
 void r100_fence_ring_emit(struct radeon_device *rdev,
 			  struct radeon_fence *fence)
 {
+	/* We have to make sure that caches are flushed before
+	 * CPU might read something from VRAM. */
+	radeon_ring_write(rdev, PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0));
+	radeon_ring_write(rdev, RADEON_RB3D_DC_FLUSH_ALL);
+	radeon_ring_write(rdev, PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0));
+	radeon_ring_write(rdev, RADEON_RB3D_ZC_FLUSH_ALL);
 	/* Who ever call radeon_fence_emit should call ring_lock and ask
 	 * for enough space (today caller are ib schedule and buffer move) */
 	/* Wait until IDLE & CLEAN */
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index 6d0a009..5581dab 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -1578,6 +1578,8 @@
 
 #define RADEON_RB3D_ZCACHE_MODE             0x3250
 #define RADEON_RB3D_ZCACHE_CTLSTAT          0x3254
+#       define RADEON_RB3D_ZC_FLUSH         0x1
+#       define RADEON_RB3D_ZC_FREE          0x4
 #       define RADEON_RB3D_ZC_FLUSH_ALL     0x5
 #define RADEON_RB3D_DSTCACHE_MODE           0x3258
 # define RADEON_RB3D_DC_CACHE_ENABLE            (0)
-- 
1.6.3.3


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--

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

* Re: [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer.
  2010-02-04  1:42 [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer Pauli Nieminen
@ 2010-02-04 16:32 ` Jerome Glisse
  2010-02-04 17:49   ` [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2) Pauli Nieminen
  0 siblings, 1 reply; 5+ messages in thread
From: Jerome Glisse @ 2010-02-04 16:32 UTC (permalink / raw)
  To: Pauli Nieminen; +Cc: airlied, dri-devel

On Thu, Feb 04, 2010 at 03:42:26AM +0200, Pauli Nieminen wrote:
> Cache flush is required in case CPU is accessing rendered data.
> 
> This fixes glean/readPixSanity test case and random rendering
> errors in sauerbraten.

Doing this flush are ok, couple of patch style comment below.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>

> 
> Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
> ---
>  drivers/gpu/drm/radeon/r100.c       |    6 ++++++
>  drivers/gpu/drm/radeon/radeon_reg.h |    2 ++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index 11c9a3f..6f4f7ea 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -357,6 +357,12 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
>  void r100_fence_ring_emit(struct radeon_device *rdev,
>  			  struct radeon_fence *fence)
>  {
> +	/* We have to make sure that caches are flushed before
> +	 * CPU might read something from VRAM. */
> +	radeon_ring_write(rdev, PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0));
> +	radeon_ring_write(rdev, RADEON_RB3D_DC_FLUSH_ALL);
> +	radeon_ring_write(rdev, PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0));
> +	radeon_ring_write(rdev, RADEON_RB3D_ZC_FLUSH_ALL);

Move it below the following comment

>  	/* Who ever call radeon_fence_emit should call ring_lock and ask
>  	 * for enough space (today caller are ib schedule and buffer move) */
>  	/* Wait until IDLE & CLEAN */
> diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
> index 6d0a009..5581dab 100644
> --- a/drivers/gpu/drm/radeon/radeon_reg.h
> +++ b/drivers/gpu/drm/radeon/radeon_reg.h
> @@ -1578,6 +1578,8 @@
>  
>  #define RADEON_RB3D_ZCACHE_MODE             0x3250
>  #define RADEON_RB3D_ZCACHE_CTLSTAT          0x3254
> +#       define RADEON_RB3D_ZC_FLUSH         0x1
> +#       define RADEON_RB3D_ZC_FREE          0x4

Useless addition you don't use them.

>  #       define RADEON_RB3D_ZC_FLUSH_ALL     0x5
>  #define RADEON_RB3D_DSTCACHE_MODE           0x3258
>  # define RADEON_RB3D_DC_CACHE_ENABLE            (0)
> -- 
> 1.6.3.3
> 
> 
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> --
> _______________________________________________
> Dri-devel mailing list
> Dri-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dri-devel
> 

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--

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

* [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2)
  2010-02-04 16:32 ` Jerome Glisse
@ 2010-02-04 17:49   ` Pauli Nieminen
  2010-02-05 23:54     ` Paul Menzel
  0 siblings, 1 reply; 5+ messages in thread
From: Pauli Nieminen @ 2010-02-04 17:49 UTC (permalink / raw)
  To: dri-devel

Cache flush is required in case CPU is accessing rendered data.

This fixes glean/readPixSanity test case and random rendering
errors in sauerbraten and warzone2100.

v2 Fix comment ordering in r100_fence_ring_emit and remove extra
   defines added in first version.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
---
 drivers/gpu/drm/radeon/r100.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 11c9a3f..626e790 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -354,11 +354,17 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
 		return RREG32(RADEON_CRTC2_CRNT_FRAME);
 }
 
+/* Who ever call radeon_fence_emit should call ring_lock and ask
+ * for enough space (today caller are ib schedule and buffer move) */
 void r100_fence_ring_emit(struct radeon_device *rdev,
 			  struct radeon_fence *fence)
 {
-	/* Who ever call radeon_fence_emit should call ring_lock and ask
-	 * for enough space (today caller are ib schedule and buffer move) */
+	/* We have to make sure that caches are flushed before
+	 * CPU might read something from VRAM. */
+	radeon_ring_write(rdev, PACKET0(RADEON_RB3D_DSTCACHE_CTLSTAT, 0));
+	radeon_ring_write(rdev, RADEON_RB3D_DC_FLUSH_ALL);
+	radeon_ring_write(rdev, PACKET0(RADEON_RB3D_ZCACHE_CTLSTAT, 0));
+	radeon_ring_write(rdev, RADEON_RB3D_ZC_FLUSH_ALL);
 	/* Wait until IDLE & CLEAN */
 	radeon_ring_write(rdev, PACKET0(0x1720, 0));
 	radeon_ring_write(rdev, (1 << 16) | (1 << 17));
-- 
1.6.3.3


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--

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

* Re: [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2)
  2010-02-04 17:49   ` [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2) Pauli Nieminen
@ 2010-02-05 23:54     ` Paul Menzel
  2010-02-07 12:30       ` Pauli Nieminen
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2010-02-05 23:54 UTC (permalink / raw)
  To: dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 410 bytes --]

Am Donnerstag, den 04.02.2010, 19:49 +0200 schrieb Pauli Nieminen:

[…]
 
> +/* Who ever call radeon_fence_emit should call ring_lock and ask

s/ever call/ever calls/

> + * for enough space (today caller are ib schedule and buffer move) */

s/caller/callers/

It would be nice to fix those typos while you are moving the comment. Or
whatever other procedure is preferred.


Thanks,

Paul

[-- Attachment #1.2: Dies ist ein digital signierter Nachrichtenteil --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 408 bytes --]

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

[-- Attachment #3: Type: text/plain, Size: 161 bytes --]

--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

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

* Re: [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2)
  2010-02-05 23:54     ` Paul Menzel
@ 2010-02-07 12:30       ` Pauli Nieminen
  0 siblings, 0 replies; 5+ messages in thread
From: Pauli Nieminen @ 2010-02-07 12:30 UTC (permalink / raw)
  To: Paul Menzel; +Cc: dri-devel

On Sat, Feb 6, 2010 at 1:54 AM, Paul Menzel
<paulepanter@users.sourceforge.net> wrote:
> Am Donnerstag, den 04.02.2010, 19:49 +0200 schrieb Pauli Nieminen:
>
> […]
>
>> +/* Who ever call radeon_fence_emit should call ring_lock and ask
>
> s/ever call/ever calls/
>

Too bad you are asking too much from me. I'm probably at the top of
list when it comes to spelling error numbers.  :)

>> + * for enough space (today caller are ib schedule and buffer move) */
>
> s/caller/callers/
>
> It would be nice to fix those typos while you are moving the comment. Or
> whatever other procedure is preferred.
>

Patches to dri-devel@lists.sourceforge.net are welcome (run
checkpatch.pl and cc: airlied)

>
> Thanks,
>
> Paul
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> --
> _______________________________________________
> Dri-devel mailing list
> Dri-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dri-devel
>
>

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--

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

end of thread, other threads:[~2010-02-07 12:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-04  1:42 [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer Pauli Nieminen
2010-02-04 16:32 ` Jerome Glisse
2010-02-04 17:49   ` [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2) Pauli Nieminen
2010-02-05 23:54     ` Paul Menzel
2010-02-07 12:30       ` Pauli Nieminen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.