Mesa (master): lima: fix PLBU_CMD_PRIMITIVE_SETUP command

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Jan 12 08:33:26 UTC 2020


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

Author: Vasily Khoruzhick <anarsoul at gmail.com>
Date:   Fri Jan 10 19:33:21 2020 -0800

lima: fix PLBU_CMD_PRIMITIVE_SETUP command

Apparently it doesn't depend on primitive type, the value
only depends on whether we specify point size via PLBU command --
bit 12 is set in this case

Reviewed-by: Qiang Yu <yuq825 at gmail.com>
Tested-by: Andreas Baierl <ichgeh at imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>

---

 src/gallium/drivers/lima/lima_draw.c   | 22 ++++++++++++++--------
 src/gallium/drivers/lima/lima_parser.c | 15 ++-------------
 2 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index 5690aba3e3a..0a0c60dbb94 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -148,8 +148,9 @@ struct lima_render_state {
 #define PLBU_CMD_VIEWPORT_TOP(v) PLBU_CMD(v, 0x10000106)
 #define PLBU_CMD_ARRAYS_SEMAPHORE_BEGIN() PLBU_CMD(0x00010002, 0x60000000)
 #define PLBU_CMD_ARRAYS_SEMAPHORE_END() PLBU_CMD(0x00010001, 0x60000000)
-#define PLBU_CMD_PRIMITIVE_SETUP(prim, cull, index_size) \
-   PLBU_CMD(0x200 | (prim) | (cull) | ((index_size) << 9), 0x1000010B)
+#define PLBU_CMD_PRIMITIVE_SETUP(force_point_size, cull, index_size) \
+   PLBU_CMD(0x2200 | ((force_point_size) ? 0x1000 : 0) | \
+            (cull) | ((index_size) << 9), 0x1000010B)
 #define PLBU_CMD_RSW_VERTEX_ARRAY(rsw, gl_pos) \
    PLBU_CMD(rsw, 0x80000000 | ((gl_pos) >> 4))
 #define PLBU_CMD_SCISSORS(minx, maxx, miny, maxy) \
@@ -846,6 +847,8 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
    int cf = ctx->rasterizer->base.cull_face;
    int ccw = ctx->rasterizer->base.front_ccw;
    uint32_t cull = 0;
+   bool force_point_size = false;
+
    if (cf != PIPE_FACE_NONE) {
       if (cf & PIPE_FACE_FRONT)
          cull |= ccw ? 0x00040000 : 0x00020000;
@@ -853,12 +856,15 @@ lima_pack_plbu_cmd(struct lima_context *ctx, const struct pipe_draw_info *info)
          cull |= ccw ? 0x00020000 : 0x00040000;
    }
 
-   if (info->mode == PIPE_PRIM_POINTS && ctx->vs->point_size_idx != -1)
-      PLBU_CMD_PRIMITIVE_SETUP(0x0000, cull, info->index_size);
-   else if (info->mode < PIPE_PRIM_TRIANGLES)
-      PLBU_CMD_PRIMITIVE_SETUP(0x3000, cull, info->index_size);
-   else
-      PLBU_CMD_PRIMITIVE_SETUP(0x2000, cull, info->index_size);
+   /* Specify point size with PLBU command if shader doesn't write */
+   if (info->mode == PIPE_PRIM_POINTS && ctx->vs->point_size_idx == -1)
+      force_point_size = true;
+
+   /* Specify line width with PLBU command for lines */
+   if (info->mode > PIPE_PRIM_POINTS && info->mode < PIPE_PRIM_TRIANGLES)
+      force_point_size = true;
+
+   PLBU_CMD_PRIMITIVE_SETUP(force_point_size, cull, info->index_size);
 
    PLBU_CMD_RSW_VERTEX_ARRAY(
       lima_ctx_buff_va(ctx, lima_ctx_buff_pp_plb_rsw, LIMA_CTX_BUFF_SUBMIT_PP),
diff --git a/src/gallium/drivers/lima/lima_parser.c b/src/gallium/drivers/lima/lima_parser.c
index f82ae0a2c2a..ea126e9c247 100644
--- a/src/gallium/drivers/lima/lima_parser.c
+++ b/src/gallium/drivers/lima/lima_parser.c
@@ -257,22 +257,11 @@ parse_plbu_semaphore(FILE *fp, uint32_t *value1, uint32_t *value2)
 static void
 parse_plbu_primitive_setup(FILE *fp, uint32_t *value1, uint32_t *value2)
 {
-   char prim[10];
-
-   if ((*value1 & 0x0000f000) == 0x00000000)
-       strcpy(prim, "POINTS");
-   else if ((*value1 & 0x0000f000) == 0x00003000)
-       strcpy(prim, "LINES");
-   else if ((*value1 & 0x0000f000) == 0x00002000)
-       strcpy(prim, "TRIANGLES");
-   else
-       strcpy(prim, "UNKNOWN");
-
    if (*value1 == 0x00000200)
       fprintf(fp, "\t/* UNKNOWN_2 (PRIMITIVE_SETUP INIT?) */\n");
    else
-      fprintf(fp, "\t/* PRIMITIVE_SETUP: prim: %s, cull: %d (0x%x), index_size: %d */\n",
-              prim,
+      fprintf(fp, "\t/* PRIMITIVE_SETUP: %scull: %d (0x%x), index_size: %d */\n",
+              (*value1 & 0x1000) ? "force point size, " : "",
               (*value1 & 0x000f0000) >> 16, (*value1 & 0x000f0000) >> 16,
               (*value1 & 0x00000e00) >> 9);
 }




More information about the mesa-commit mailing list