virgl: Add skeleton to evaluate cap and send tweaks
authorGert Wollny <gert.wollny@collabora.com>
Mon, 27 May 2019 14:02:28 +0000 (16:02 +0200)
committerGert Wollny <gert.wollny@collabora.com>
Thu, 20 Jun 2019 06:50:38 +0000 (08:50 +0200)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
src/gallium/drivers/virgl/virgl_context.c
src/gallium/drivers/virgl/virgl_encode.c
src/gallium/drivers/virgl/virgl_encode.h
src/gallium/drivers/virgl/virgl_hw.h
src/gallium/drivers/virgl/virgl_protocol.h

index 2324878..cd653b7 100644 (file)
@@ -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);
index 95a5bf9..2975e60 100644 (file)
@@ -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,
index 3cbec0f..a46ee21 100644 (file)
@@ -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
index 3104e1b..91e4259 100644 (file)
@@ -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.
index 8a6cdbc..c3ad598 100644 (file)
@@ -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