Mesa (master): virgl: Add skeleton to evaluate cap and send tweaks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 20 07:18:47 UTC 2019


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Mon May 27 16:02:28 2019 +0200

virgl: Add skeleton to evaluate cap and send tweaks

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>

---

 src/gallium/drivers/virgl/virgl_context.c  |  7 +++++++
 src/gallium/drivers/virgl/virgl_encode.c   |  9 +++++++++
 src/gallium/drivers/virgl/virgl_encode.h   |  4 ++++
 src/gallium/drivers/virgl/virgl_hw.h       |  1 +
 src/gallium/drivers/virgl/virgl_protocol.h | 10 ++++++++++
 5 files changed, 31 insertions(+)

diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 2324878672e..cd653b70ce9 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -1402,6 +1402,10 @@ static void virgl_get_sample_position(struct pipe_context *ctx,
                    index, sample_count, out_value[0], out_value[1]);
 }
 
+static void virgl_send_tweaks(struct virgl_context *vctx, struct virgl_screen *rs)
+{
+}
+
 struct pipe_context *virgl_context_create(struct pipe_screen *pscreen,
                                           void *priv,
                                           unsigned flags)
@@ -1541,6 +1545,9 @@ struct pipe_context *virgl_context_create(struct pipe_screen *pscreen,
          virgl_encode_host_debug_flagstring(vctx, host_debug_flagstring);
    }
 
+   if (rs->caps.caps.v2.capability_bits & VIRGL_CAP_APP_TWEAK_SUPPORT)
+      virgl_send_tweaks(vctx, rs);
+
    return &vctx->base;
 fail:
    virgl_context_destroy(&vctx->base);
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index 95a5bf97c18..2975e6048cf 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -1126,6 +1126,15 @@ int virgl_encode_host_debug_flagstring(struct virgl_context *ctx,
    return 0;
 }
 
+int virgl_encode_tweak(struct virgl_context *ctx, enum vrend_tweak_type tweak, uint32_t value)
+{
+   virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_TWEAKS, 0, VIRGL_SET_TWEAKS_SIZE));
+   virgl_encoder_write_dword(ctx->cbuf, tweak);
+   virgl_encoder_write_dword(ctx->cbuf, value);
+   return 0;
+}
+
+
 int virgl_encode_get_query_result_qbo(struct virgl_context *ctx,
                                       uint32_t handle,
                                       struct virgl_resource *res, boolean wait,
diff --git a/src/gallium/drivers/virgl/virgl_encode.h b/src/gallium/drivers/virgl/virgl_encode.h
index 3cbec0f021c..a46ee216917 100644
--- a/src/gallium/drivers/virgl/virgl_encode.h
+++ b/src/gallium/drivers/virgl/virgl_encode.h
@@ -27,6 +27,7 @@
 #include "pipe/p_state.h"
 
 #include "virgl_winsys.h"
+#include "virgl_protocol.h"
 
 struct tgsi_token;
 
@@ -296,4 +297,7 @@ void virgl_encode_copy_transfer(struct virgl_context *ctx,
                                 struct virgl_transfer *trans);
 
 void virgl_encode_end_transfers(struct virgl_cmd_buf *buf);
+
+int virgl_encode_tweak(struct virgl_context *ctx, enum vrend_tweak_type tweak, uint32_t value);
+
 #endif
diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h
index 3104e1bb1b1..91e4259abe3 100644
--- a/src/gallium/drivers/virgl/virgl_hw.h
+++ b/src/gallium/drivers/virgl/virgl_hw.h
@@ -255,6 +255,7 @@ enum virgl_formats {
 #define VIRGL_CAP_INDIRECT_INPUT_ADDR  (1 << 25)
 #define VIRGL_CAP_COPY_TRANSFER        (1 << 26)
 #define VIRGL_CAP_CLIP_HALFZ           (1 << 27)
+#define VIRGL_CAP_APP_TWEAK_SUPPORT    (1 << 28)
 
 /* virgl bind flags - these are compatible with mesa 10.5 gallium.
  * but are fixed, no other should be passed to virgl either.
diff --git a/src/gallium/drivers/virgl/virgl_protocol.h b/src/gallium/drivers/virgl/virgl_protocol.h
index 8a6cdbca06c..c3ad598601d 100644
--- a/src/gallium/drivers/virgl/virgl_protocol.h
+++ b/src/gallium/drivers/virgl/virgl_protocol.h
@@ -97,6 +97,7 @@ enum virgl_context_cmd {
    VIRGL_CCMD_TRANSFER3D,
    VIRGL_CCMD_END_TRANSFERS,
    VIRGL_CCMD_COPY_TRANSFER3D,
+   VIRGL_CCMD_SET_TWEAKS,
 };
 
 /*
@@ -585,4 +586,13 @@ enum virgl_context_cmd {
 #define VIRGL_COPY_TRANSFER3D_SRC_RES_OFFSET 13
 #define VIRGL_COPY_TRANSFER3D_SYNCHRONIZED 14
 
+/* set tweak flags */
+#define VIRGL_SET_TWEAKS_SIZE 2
+#define VIRGL_SET_TWEAKS_ID 1
+#define VIRGL_SET_TWEAKS_VALUE 2
+
+enum vrend_tweak_type {
+   virgl_tweak_undefined
+};
+
 #endif




More information about the mesa-commit mailing list