Mesa (master): r300g: replace r300_cs_info with simplier get_cs_free_dwords

Marek Olšák mareko at kemper.freedesktop.org
Sun Jun 13 08:44:22 PDT 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Sat Jun 12 22:07:41 2010 +0200

r300g: replace r300_cs_info with simplier get_cs_free_dwords

---

 src/gallium/drivers/r300/r300_context.c     |    5 +----
 src/gallium/drivers/r300/r300_render.c      |    6 +++---
 src/gallium/drivers/r300/r300_winsys.h      |   12 ++----------
 src/gallium/winsys/radeon/drm/radeon_r300.c |    9 +++------
 4 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index 9425f93..43e567c 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -242,10 +242,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 
 boolean r300_check_cs(struct r300_context *r300, unsigned size)
 {
-    struct r300_cs_info cs_info;
-
-    r300->rws->get_cs_info(r300->rws, &cs_info);
-    return size <= cs_info.free;
+    return size <= r300->rws->get_cs_free_dwords(r300->rws);
 }
 
 void r300_finish(struct r300_context *r300)
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 95a20c1..b97f7be 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -913,7 +913,7 @@ static void r300_render_draw_elements(struct vbuf_render* render,
     unsigned max_index = (r300render->vbo_size - r300render->vbo_offset) /
                          (r300render->r300->vertex_info.size * 4) - 1;
     unsigned short_count;
-    struct r300_cs_info cs_info;
+    unsigned free_dwords;
 
     CS_LOCALS(r300);
 
@@ -926,9 +926,9 @@ static void r300_render_draw_elements(struct vbuf_render* render,
         NULL, 256, 0, 0, &end_cs_dwords);
 
     while (count) {
-        r300->rws->get_cs_info(r300->rws, &cs_info);
+        free_dwords = r300->rws->get_cs_free_dwords(r300->rws);
 
-        short_count = MIN2(count, (cs_info.free - end_cs_dwords - 6) * 2);
+        short_count = MIN2(count, (free_dwords - end_cs_dwords - 6) * 2);
 
         BEGIN_CS(6 + (short_count+1)/2);
         OUT_CS_REG(R300_GA_COLOR_CONTROL,
diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h
index 6ce2189..6ef1c99 100644
--- a/src/gallium/drivers/r300/r300_winsys.h
+++ b/src/gallium/drivers/r300/r300_winsys.h
@@ -47,13 +47,6 @@ enum r300_reference_domain { /* bitfield */
     R300_REF_HW = 2
 };
 
-struct r300_cs_info {
-    /* In DWORDs. */
-    unsigned used;
-    unsigned free;
-    unsigned capacity;
-};
-
 struct r300_winsys_screen {
     void (*destroy)(struct r300_winsys_screen *ws);
     
@@ -109,9 +102,8 @@ struct r300_winsys_screen {
      * Returns TRUE if a flush is required. */
     boolean (*validate)(struct r300_winsys_screen* winsys);
 
-    /* Return current CS info. */
-    void (*get_cs_info)(struct r300_winsys_screen *winsys,
-                        struct r300_cs_info *info);
+    /* Return the number of free dwords in CS. */
+    unsigned (*get_cs_free_dwords)(struct r300_winsys_screen *winsys);
 
     /* Start a command emit. */
     void (*begin_cs)(struct r300_winsys_screen* winsys,
diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c
index 70ae01a..4f620f0 100644
--- a/src/gallium/winsys/radeon/drm/radeon_r300.c
+++ b/src/gallium/winsys/radeon/drm/radeon_r300.c
@@ -192,15 +192,12 @@ static boolean radeon_validate(struct r300_winsys_screen *rws)
     return TRUE;
 }
 
-static void radeon_get_cs_info(struct r300_winsys_screen *rws,
-                               struct r300_cs_info *info)
+static unsigned radeon_get_cs_free_dwords(struct r300_winsys_screen *rws)
 {
     struct radeon_libdrm_winsys *ws = radeon_winsys_screen(rws);
     struct radeon_cs *cs = ws->cs;
 
-    info->capacity = cs->ndw;
-    info->used = cs->cdw;
-    info->free = cs->ndw - cs->cdw;
+    return cs->ndw - cs->cdw;
 }
 
 static void radeon_begin_cs(struct r300_winsys_screen *rws,
@@ -345,7 +342,7 @@ radeon_setup_winsys(int fd, struct radeon_libdrm_winsys* ws)
     ws->base.add_buffer = radeon_add_buffer;
     ws->base.validate = radeon_validate;
     ws->base.destroy = radeon_winsys_destroy;
-    ws->base.get_cs_info = radeon_get_cs_info;
+    ws->base.get_cs_free_dwords = radeon_get_cs_free_dwords;
     ws->base.begin_cs = radeon_begin_cs;
     ws->base.write_cs_dword = radeon_write_cs_dword;
     ws->base.write_cs_table = radeon_write_cs_table;



More information about the mesa-commit mailing list