[Mesa-dev] [PATCH] svga: remove pre-SVGA3D_HWVERSION_WS8_B1 code

Charmaine Lee charmainel at vmware.com
Thu Apr 6 19:29:30 UTC 2017


Looks good to me.

Reviewed-by: Charmaine Lee <charmainel at vmware.com>
________________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Thursday, April 6, 2017 11:49 AM
To: mesa-dev at lists.freedesktop.org
Cc: Jose Fonseca; Charmaine Lee; Neha Bhende
Subject: [PATCH] svga: remove pre-SVGA3D_HWVERSION_WS8_B1 code

3D wasn't officially supported before virtual HW version 8 so we can
remove this old code.
---
 src/gallium/drivers/svga/svga_state_constants.c | 76 ++-----------------------
 1 file changed, 5 insertions(+), 71 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c
index 8d6b46a..31e4be0 100644
--- a/src/gallium/drivers/svga/svga_state_constants.c
+++ b/src/gallium/drivers/svga/svga_state_constants.c
@@ -264,50 +264,6 @@ svga_get_extra_gs_constants(struct svga_context *svga, float *dest)
    return count;
 }

-/**
- * Check and emit one shader constant register.
- * \param shader  PIPE_SHADER_FRAGMENT or PIPE_SHADER_VERTEX
- * \param i  which float[4] constant to change
- * \param value  the new float[4] value
- */
-static enum pipe_error
-emit_const(struct svga_context *svga, enum pipe_shader_type shader, unsigned i,
-           const float *value)
-{
-   enum pipe_error ret = PIPE_OK;
-
-   assert(shader < PIPE_SHADER_TYPES);
-   assert(i < SVGA3D_CONSTREG_MAX);
-   assert(!svga_have_vgpu10(svga));
-
-   if (memcmp(svga->state.hw_draw.cb[shader][i], value,
-              4 * sizeof(float)) != 0) {
-      if (SVGA_DEBUG & DEBUG_CONSTS)
-         debug_printf("%s %s %u: %f %f %f %f\n",
-                      __FUNCTION__,
-                      shader == PIPE_SHADER_VERTEX ? "VERT" : "FRAG",
-                      i,
-                      value[0],
-                      value[1],
-                      value[2],
-                      value[3]);
-
-      ret = SVGA3D_SetShaderConst( svga->swc,
-                                   i,
-                                   svga_shader_type(shader),
-                                   SVGA3D_CONST_TYPE_FLOAT,
-                                   value );
-      if (ret != PIPE_OK)
-         return ret;
-
-      memcpy(svga->state.hw_draw.cb[shader][i], value, 4 * sizeof(float));
-
-      svga->hud.num_const_updates++;
-   }
-
-   return ret;
-}
-

 /*
  * Check and emit a range of shader constant registers, trying to coalesce
@@ -442,11 +398,9 @@ static enum pipe_error
 emit_consts_vgpu9(struct svga_context *svga, enum pipe_shader_type shader)
 {
    const struct pipe_constant_buffer *cbuf;
-   struct svga_screen *ss = svga_screen(svga->pipe.screen);
    struct pipe_transfer *transfer = NULL;
    unsigned count;
    const float (*data)[4] = NULL;
-   unsigned i;
    enum pipe_error ret = PIPE_OK;
    const unsigned offset = 0;

@@ -469,24 +423,13 @@ emit_consts_vgpu9(struct svga_context *svga, enum pipe_shader_type shader)
       }

       /* sanity check */
-      assert(cbuf->buffer->width0 >=
-             cbuf->buffer_size);
+      assert(cbuf->buffer->width0 >= cbuf->buffer_size);

       /* Use/apply the constant buffer size and offsets here */
       count = cbuf->buffer_size / (4 * sizeof(float));
       data += cbuf->buffer_offset / (4 * sizeof(float));

-      if (ss->hw_version >= SVGA3D_HWVERSION_WS8_B1) {
-         ret = emit_const_range( svga, shader, offset, count, data );
-      }
-      else {
-         for (i = 0; i < count; i++) {
-            ret = emit_const( svga, shader, offset + i, data[i] );
-            if (ret != PIPE_OK) {
-               break;
-            }
-         }
-      }
+      ret = emit_const_range( svga, shader, offset, count, data );

       pipe_buffer_unmap(&svga->pipe, transfer);

@@ -500,7 +443,7 @@ emit_consts_vgpu9(struct svga_context *svga, enum pipe_shader_type shader)
       const struct svga_shader_variant *variant = NULL;
       unsigned offset;
       float extras[MAX_EXTRA_CONSTS][4];
-      unsigned count, i;
+      unsigned count;

       switch (shader) {
       case PIPE_SHADER_VERTEX:
@@ -521,17 +464,8 @@ emit_consts_vgpu9(struct svga_context *svga, enum pipe_shader_type shader)
       assert(count <= ARRAY_SIZE(extras));

       if (count > 0) {
-         if (ss->hw_version >= SVGA3D_HWVERSION_WS8_B1) {
-            ret = emit_const_range(svga, shader, offset, count,
-                                   (const float (*) [4])extras);
-         }
-         else {
-            for (i = 0; i < count; i++) {
-               ret = emit_const(svga, shader, offset + i, extras[i]);
-               if (ret != PIPE_OK)
-                  return ret;
-            }
-         }
+         ret = emit_const_range(svga, shader, offset, count,
+                                (const float (*) [4])extras);
       }
    }

--
1.9.1



More information about the mesa-dev mailing list