tweaks: Add cap and tweak support to the guest-host protocol

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 6 years ago
parent 87fe8206b0
commit 267d486889
  1. 1
      src/virgl_hw.h
  2. 6
      src/virgl_protocol.h
  3. 1
      src/vrend_debug.c
  4. 19
      src/vrend_decode.c
  5. 1
      src/vrend_renderer.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.

@ -101,6 +101,7 @@ enum virgl_context_cmd {
VIRGL_CCMD_TRANSFER3D,
VIRGL_CCMD_END_TRANSFERS,
VIRGL_CCMD_COPY_TRANSFER3D,
VIRGL_CCMD_SET_TWEAKS,
VIRGL_MAX_COMMANDS
};
@ -592,6 +593,11 @@ 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
};

@ -75,6 +75,7 @@ static const char *command_names[VIRGL_MAX_COMMANDS] = {
"TRANSFER3D",
"END_TRANSFERS",
"COPY_TRANSFER3D",
"TWEAK"
};
static const char *object_type_names[VIRGL_MAX_OBJECTS] = {

@ -35,6 +35,7 @@
#include "vrend_object.h"
#include "tgsi/tgsi_text.h"
#include "vrend_debug.h"
#include "vrend_tweaks.h"
/* decode side */
#define DECODE_MAX_TOKENS 8000
@ -1321,6 +1322,21 @@ static int vrend_decode_set_debug_mask(struct vrend_decode_ctx *ctx, int length)
return 0;
}
static int vrend_decode_set_tweaks(struct vrend_decode_ctx *ctx, int length)
{
VREND_DEBUG(dbg_tweak, NULL, "Received TWEAK set command\n");
if (length < VIRGL_SET_TWEAKS_SIZE)
return EINVAL;
uint32_t tweak_id = get_buf_entry(ctx, VIRGL_SET_TWEAKS_ID);
uint32_t tweak_value = get_buf_entry(ctx, VIRGL_SET_TWEAKS_VALUE);
vrend_set_active_tweaks(vrend_get_context_tweaks(ctx->grctx), tweak_id, tweak_value);
return 0;
}
static int vrend_decode_transfer3d(struct vrend_decode_ctx *ctx, int length, uint32_t ctx_id)
{
struct pipe_box box;
@ -1610,6 +1626,9 @@ int vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw)
case VIRGL_CCMD_END_TRANSFERS:
ret = 0;
break;
case VIRGL_CCMD_SET_TWEAKS:
ret = vrend_decode_set_tweaks(gdctx, len);
break;
default:
ret = EINVAL;
}

@ -29,6 +29,7 @@
#include "util/u_inlines.h"
#include "virgl_protocol.h"
#include "vrend_debug.h"
#include "vrend_tweaks.h"
#include "vrend_iov.h"
#include "virgl_hw.h"
#include <epoxy/gl.h>

Loading…
Cancel
Save