Re: [Mesa-dev] [PATCH 06/10] radeonsi: update si_ce_needed_cs_space

2017-05-18 Thread Nicolai Hähnle

On 17.05.2017 21:38, Marek Olšák wrote:

From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_hw_context.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 5e97d56..3c59f1b 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -26,34 +26,35 @@

 #include "si_pipe.h"
 #include "radeon/r600_cs.h"

 static unsigned si_descriptor_list_cs_space(unsigned count, unsigned 
element_size)
 {
/* Ensure we have enough space to start a new range in a hole */
assert(element_size >= 3);

/* 5 dwords for possible load to reinitialize when we have no preamble
-* IB + 5 dwords for write to L2 + 3 bytes for every range written to
-* CE RAM.
+* IB + 5 dwords for write to L2 + 3 bytes for the packet header of
+* every disjoint range written to CE RAM.
 */
-   return 5 + 5 + 3 + count * element_size;
+   return 5 + (3 * count / 2) + count * element_size;


The possible load to reinitialize doesn't exist anymore since the 
previous patch, so the comment needs to be updated. With that fixed, 
patches 2-6:


Reviewed-by: Nicolai Hähnle 

Cheers,
Nicolai



 }

 static unsigned si_ce_needed_cs_space(void)
 {
unsigned space = 0;

-   space += si_descriptor_list_cs_space(SI_NUM_CONST_BUFFERS, 4);
-   space += si_descriptor_list_cs_space(SI_NUM_SHADER_BUFFERS, 4);
-   space += si_descriptor_list_cs_space(SI_NUM_SAMPLERS, 16);
-   space += si_descriptor_list_cs_space(SI_NUM_IMAGES, 8);
+   space += si_descriptor_list_cs_space(SI_NUM_SHADER_BUFFERS +
+SI_NUM_CONST_BUFFERS, 4);
+   /* two 8-byte images share one 16-byte slot */
+   space += si_descriptor_list_cs_space(SI_NUM_IMAGES / 2 +
+SI_NUM_SAMPLERS, 16);
space *= SI_NUM_SHADERS;

space += si_descriptor_list_cs_space(SI_NUM_RW_BUFFERS, 4);

/* Increment CE counter packet */
space += 2;

return space;
 }





--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 06/10] radeonsi: update si_ce_needed_cs_space

2017-05-17 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_hw_context.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 5e97d56..3c59f1b 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -26,34 +26,35 @@
 
 #include "si_pipe.h"
 #include "radeon/r600_cs.h"
 
 static unsigned si_descriptor_list_cs_space(unsigned count, unsigned 
element_size)
 {
/* Ensure we have enough space to start a new range in a hole */
assert(element_size >= 3);
 
/* 5 dwords for possible load to reinitialize when we have no preamble
-* IB + 5 dwords for write to L2 + 3 bytes for every range written to
-* CE RAM.
+* IB + 5 dwords for write to L2 + 3 bytes for the packet header of
+* every disjoint range written to CE RAM.
 */
-   return 5 + 5 + 3 + count * element_size;
+   return 5 + (3 * count / 2) + count * element_size;
 }
 
 static unsigned si_ce_needed_cs_space(void)
 {
unsigned space = 0;
 
-   space += si_descriptor_list_cs_space(SI_NUM_CONST_BUFFERS, 4);
-   space += si_descriptor_list_cs_space(SI_NUM_SHADER_BUFFERS, 4);
-   space += si_descriptor_list_cs_space(SI_NUM_SAMPLERS, 16);
-   space += si_descriptor_list_cs_space(SI_NUM_IMAGES, 8);
+   space += si_descriptor_list_cs_space(SI_NUM_SHADER_BUFFERS +
+SI_NUM_CONST_BUFFERS, 4);
+   /* two 8-byte images share one 16-byte slot */
+   space += si_descriptor_list_cs_space(SI_NUM_IMAGES / 2 +
+SI_NUM_SAMPLERS, 16);
space *= SI_NUM_SHADERS;
 
space += si_descriptor_list_cs_space(SI_NUM_RW_BUFFERS, 4);
 
/* Increment CE counter packet */
space += 2;
 
return space;
 }
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev