Module: Mesa
Branch: main
Commit: c9a0e91d4cde7a7d671ec87ac91cbea273066e26
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9a0e91d4cde7a7d671ec87ac91cbea273066e26

Author: Pavel Ondračka <[email protected]>
Date:   Thu Jul 20 10:40:09 2023 +0200

r300: fix cycles calculation

There might be more texture semaphores per begin tex block, just do the
cycles calculation on the first one.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24250>

---

 src/gallium/drivers/r300/compiler/radeon_compiler.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.c 
b/src/gallium/drivers/r300/compiler/radeon_compiler.c
index 6f33bbe6275..fddc23702f7 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.c
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.c
@@ -358,7 +358,7 @@ void rc_get_stats(struct radeon_compiler *c, struct 
rc_program_stats *s)
        struct rc_instruction * tmp;
        memset(s, 0, sizeof(*s));
        unsigned ip = 0;
-       unsigned last_begintex = 0;
+       int last_begintex = -1;
 
        for(tmp = c->Program.Instructions.Next; tmp != &c->Program.Instructions;
                                                        tmp = tmp->Next, ip++){
@@ -399,8 +399,10 @@ void rc_get_stats(struct radeon_compiler *c, struct 
rc_program_stats *s)
                        /* SemWait has effect only on R500, the more 
instructions we can put
                         * between the tex block and the first texture 
semaphore, the better.
                         */
-                       if (tmp->U.P.SemWait && c->is_r500)
-                               s->num_cycles -= ip - last_begintex;
+                       if (tmp->U.P.SemWait && c->is_r500 && last_begintex != 
-1) {
+                               s->num_cycles -= MIN2(30, ip - last_begintex);
+                               last_begintex = -1;
+                       }
                        info = rc_get_opcode_info(tmp->U.P.RGB.Opcode);
                }
                if (info->IsFlowControl) {

Reply via email to