Skip to contentSkip to conversation

drm/r100/kms: Emit cache flush to the end of command buffer.

PATCH In review Pauli Nieminen 3 participants 5 messages Feb 4, 2010 – Feb 7, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/r100/kms: Emit cache flush to the end of command buffer.

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

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

---
 drivers/gpu/drm/radeon/r100.c       |    6 ++++++
 drivers/gpu/drm/radeon/radeon_reg.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r100.c +6 -0
index 11c9a3f..6f4f7ea 100644
@@ -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 */
drivers/gpu/drm/radeon/radeon_reg.h +2 -0
index 6d0a009..5581dab 100644
@@ -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)
Signature · 10 lines
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
--
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Pauli Nieminen

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.

Quoted 12 lines
---
 drivers/gpu/drm/radeon/r100.c       |    6 ++++++
 drivers/gpu/drm/radeon/radeon_reg.h |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r100.c +0 -0
index 11c9a3f..6f4f7ea 100644

drivers/gpu/drm/radeon/r100.c u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc) · line 365

Quoted 9 lines
drivers/gpu/drm/radeon/r100.c +6 -0
@@ -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

drivers/gpu/drm/radeon/radeon_reg.h line 1582

Quoted 13 lines
drivers/gpu/drm/radeon/r100.c +0 -0
 	/* 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 */
drivers/gpu/drm/radeon/radeon_reg.h +2 -0
index 6d0a009..5581dab 100644
@@ -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.

Quoted 19 lines
drivers/gpu/drm/radeon/radeon_reg.h +0 -0
 #       define RADEON_RB3D_ZC_FLUSH_ALL     0x5
 #define RADEON_RB3D_DSTCACHE_MODE           0x3258
 # define RADEON_RB3D_DC_CACHE_ENABLE            (0)
Signature · 14 lines
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
[email protected]
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
--

#2 lore raw

PATCH 1/1 drm/r100/kms: Emit cache flush to the end of command buffer. (v2)

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.

---
 drivers/gpu/drm/radeon/r100.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/r100.c +8 -2
index 11c9a3f..626e790 100644
@@ -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));
Signature · 10 lines
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
--
#3 lore raw

Re: [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2)

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

[…]

Quoted 1 line

+/* Who ever call radeon_fence_emit should call ring_lock and ask

s/ever call/ever calls/

Quoted 1 line

+ * 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

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

#4 lore raw

Re: [PATCH] drm/r100/kms: Emit cache flush to the end of command buffer. (v2)

Quoted 8 lines · Paul Menzel

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

[…]

Quoted 1 line

+/* 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. :)

Quoted 7 lines
Quoted 1 line

+ * 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 [email protected] are welcome (run checkpatch.pl and cc: airlied)

Quoted 5 lines

Thanks,

Paul

Quoted 13 lines

------------------------------------------------------------------------------
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
[email protected]
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
--