[Mesa-dev] [PATCH 03/18] panfrost/midgard: Add perspective division opcode

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Mon Jun 10 22:01:31 UTC 2019


...on the load/store unit, not the ALUs. Looks goofy but hey.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 src/gallium/drivers/panfrost/midgard/midgard.h     | 5 +++++
 src/gallium/drivers/panfrost/midgard/midgard_ops.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/gallium/drivers/panfrost/midgard/midgard.h b/src/gallium/drivers/panfrost/midgard/midgard.h
index 68e969ccf9c..5f7e4862e66 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard.h
@@ -371,6 +371,11 @@ typedef enum {
         /* Used in OpenCL. Probably can ld other things as well */
         midgard_op_ld_global_id = 0x10,
 
+        /* The L/S unit can do perspective division a clock faster than the ALU
+         * if you're lucky. Put the vec4 in r27, and call with 0x24 as the
+         * unknown state; the output will be <x/w, y/w, z/w, 1> */
+        midgard_op_ldst_perspective_division = 0x13,
+
         /* val in r27.y, address embedded, outputs result to argument. Invert val for sub. Let val = +-1 for inc/dec. */
         midgard_op_atomic_add = 0x40,
         midgard_op_atomic_and = 0x44,
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_ops.c b/src/gallium/drivers/panfrost/midgard/midgard_ops.c
index 693fb56124d..b8210a01ecb 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_ops.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_ops.c
@@ -153,6 +153,7 @@ struct mir_op_props alu_opcode_props[256] = {
 const char *load_store_opcode_names[256] = {
         [midgard_op_st_cubemap_coords] = "st_cubemap_coords",
         [midgard_op_ld_global_id] = "ld_global_id",
+        [midgard_op_ldst_perspective_division] = "ldst_perspective_division",
 
         [midgard_op_atomic_add] = "atomic_add",
         [midgard_op_atomic_and] = "atomic_and",
-- 
2.20.1



More information about the mesa-dev mailing list