virglrenderer: add PIPE_RESOURCE_CREATE in virgl_protocol.h

Bump up host_feature_check_version accordingly.

Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Gurchetan Singh 5 years ago
parent 95ce73010a
commit 0c28415f71
  1. 15
      src/virgl_protocol.h
  2. 1
      src/vrend_debug.c
  3. 26
      src/vrend_decode.c
  4. 18
      src/vrend_renderer.c
  5. 7
      src/vrend_renderer.h

@ -103,6 +103,7 @@ enum virgl_context_cmd {
VIRGL_CCMD_COPY_TRANSFER3D, VIRGL_CCMD_COPY_TRANSFER3D,
VIRGL_CCMD_SET_TWEAKS, VIRGL_CCMD_SET_TWEAKS,
VIRGL_CCMD_CLEAR_TEXTURE, VIRGL_CCMD_CLEAR_TEXTURE,
VIRGL_CCMD_PIPE_RESOURCE_CREATE,
VIRGL_MAX_COMMANDS VIRGL_MAX_COMMANDS
}; };
@ -621,4 +622,18 @@ enum vrend_tweak_type {
#define VIRGL_TEXTURE_ARRAY_C 11 #define VIRGL_TEXTURE_ARRAY_C 11
#define VIRGL_TEXTURE_ARRAY_D 12 #define VIRGL_TEXTURE_ARRAY_D 12
/* virgl create */
#define VIRGL_PIPE_RES_CREATE_SIZE 11
#define VIRGL_PIPE_RES_CREATE_TARGET 1
#define VIRGL_PIPE_RES_CREATE_FORMAT 2
#define VIRGL_PIPE_RES_CREATE_BIND 3
#define VIRGL_PIPE_RES_CREATE_WIDTH 4
#define VIRGL_PIPE_RES_CREATE_HEIGHT 5
#define VIRGL_PIPE_RES_CREATE_DEPTH 6
#define VIRGL_PIPE_RES_CREATE_ARRAY_SIZE 7
#define VIRGL_PIPE_RES_CREATE_LAST_LEVEL 8
#define VIRGL_PIPE_RES_CREATE_NR_SAMPLES 9
#define VIRGL_PIPE_RES_CREATE_FLAGS 10
#define VIRGL_PIPE_RES_CREATE_BLOB_ID 11
#endif #endif

@ -77,6 +77,7 @@ static const char *command_names[VIRGL_MAX_COMMANDS] = {
"COPY_TRANSFER3D", "COPY_TRANSFER3D",
"TWEAK", "TWEAK",
"CLEAR_TEXTURE" "CLEAR_TEXTURE"
"PIPE_RESOURCE_CREATE",
}; };
static const char *object_type_names[VIRGL_MAX_OBJECTS] = { static const char *object_type_names[VIRGL_MAX_OBJECTS] = {

@ -1415,6 +1415,29 @@ static int vrend_decode_copy_transfer3d(struct vrend_decode_ctx *ctx, int length
&info); &info);
} }
static int vrend_decode_pipe_resource_create(struct vrend_decode_ctx *ctx, int length)
{
struct vrend_renderer_resource_create_args args = { 0 };
uint32_t blob_id;
if (length != VIRGL_PIPE_RES_CREATE_SIZE)
return EINVAL;
args.target = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_TARGET);
args.format = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_FORMAT);
args.bind = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_BIND);
args.width = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_WIDTH);
args.height = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_HEIGHT);
args.depth = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_DEPTH);
args.array_size = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_ARRAY_SIZE);
args.last_level = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_LAST_LEVEL);
args.nr_samples = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_NR_SAMPLES);
args.flags = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_FLAGS);
blob_id = get_buf_entry(ctx, VIRGL_PIPE_RES_CREATE_BLOB_ID);
return vrend_renderer_pipe_resource_create(ctx->grctx, blob_id, &args);
}
static void vrend_decode_ctx_init_base(struct vrend_decode_ctx *dctx, static void vrend_decode_ctx_init_base(struct vrend_decode_ctx *dctx,
uint32_t ctx_id); uint32_t ctx_id);
@ -1651,6 +1674,9 @@ static int vrend_decode_ctx_submit_cmd(struct virgl_context *ctx,
case VIRGL_CCMD_SET_TWEAKS: case VIRGL_CCMD_SET_TWEAKS:
ret = vrend_decode_set_tweaks(gdctx, len); ret = vrend_decode_set_tweaks(gdctx, len);
break; break;
case VIRGL_CCMD_PIPE_RESOURCE_CREATE:
ret = vrend_decode_pipe_resource_create(gdctx, len);
break;
default: default:
ret = EINVAL; ret = EINVAL;
} }

@ -39,7 +39,6 @@
#include "util/u_dual_blend.h" #include "util/u_dual_blend.h"
#include "os/os_thread.h" #include "os/os_thread.h"
#include "util/u_double_list.h"
#include "util/u_format.h" #include "util/u_format.h"
#include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_parse.h"
@ -637,6 +636,7 @@ struct vrend_context {
char debug_name[64]; char debug_name[64];
struct list_head sub_ctxs; struct list_head sub_ctxs;
struct list_head vrend_resources;
struct vrend_sub_context *sub; struct vrend_sub_context *sub;
struct vrend_sub_context *sub0; struct vrend_sub_context *sub0;
@ -6130,6 +6130,7 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de
grctx->ctx_id = id; grctx->ctx_id = id;
list_inithead(&grctx->sub_ctxs); list_inithead(&grctx->sub_ctxs);
list_inithead(&grctx->vrend_resources);
list_inithead(&grctx->active_nontimer_query_list); list_inithead(&grctx->active_nontimer_query_list);
grctx->res_hash = vrend_ctx_resource_init_table(); grctx->res_hash = vrend_ctx_resource_init_table();
@ -9649,7 +9650,7 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c
* this value to avoid regressions when a guest with a new mesa version is * this value to avoid regressions when a guest with a new mesa version is
* run on an old virgl host. Use it also to indicate non-cap fixes on the * run on an old virgl host. Use it also to indicate non-cap fixes on the
* host that help enable features in the guest. */ * host that help enable features in the guest. */
caps->v2.host_feature_check_version = 3; caps->v2.host_feature_check_version = 4;
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range); glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, range);
caps->v2.min_aliased_point_size = range[0]; caps->v2.min_aliased_point_size = range[0];
@ -10335,3 +10336,16 @@ int vrend_renderer_export_query(struct pipe_resource *pres,
return 0; return 0;
} }
int vrend_renderer_pipe_resource_create(struct vrend_context *ctx, uint32_t blob_id,
struct vrend_renderer_resource_create_args *args)
{
struct vrend_resource *res;
res = (struct vrend_resource *)vrend_renderer_resource_create(args, NULL);
if (!res)
return EINVAL;
res->blob_id = blob_id;
list_addtail(&res->head, &ctx->vrend_resources);
return 0;
}

@ -26,6 +26,7 @@
#define VREND_RENDERER_H #define VREND_RENDERER_H
#include "pipe/p_state.h" #include "pipe/p_state.h"
#include "util/u_double_list.h"
#include "util/u_inlines.h" #include "util/u_inlines.h"
#include "virgl_protocol.h" #include "virgl_protocol.h"
#include "vrend_debug.h" #include "vrend_debug.h"
@ -98,6 +99,9 @@ struct vrend_resource {
uint64_t mipmap_offsets[VR_MAX_TEXTURE_2D_LEVELS]; uint64_t mipmap_offsets[VR_MAX_TEXTURE_2D_LEVELS];
void *gbm_bo, *egl_image; void *gbm_bo, *egl_image;
void *aux_plane_egl_image[VIRGL_GBM_MAX_PLANES]; void *aux_plane_egl_image[VIRGL_GBM_MAX_PLANES];
uint32_t blob_id;
struct list_head head;
}; };
#define VIRGL_TEXTURE_NEED_SWIZZLE (1 << 0) #define VIRGL_TEXTURE_NEED_SWIZZLE (1 << 0)
@ -487,4 +491,7 @@ int vrend_renderer_export_query(struct pipe_resource *pres,
void vrend_sync_make_current(virgl_gl_context); void vrend_sync_make_current(virgl_gl_context);
int
vrend_renderer_pipe_resource_create(struct vrend_context *ctx, uint32_t blob_id,
struct vrend_renderer_resource_create_args *args);
#endif #endif

Loading…
Cancel
Save