server: use the real hw res handle as res_id

The same res_id is also used for later resource attach of the same.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Yiwei Zhang 3 years ago
parent 106179de5b
commit 66869fb0d1
  1. 13
      server/render_context.c
  2. 1
      server/render_protocol.h
  3. 3
      src/proxy/proxy_context.c

@ -14,13 +14,6 @@
#include "render_virgl.h"
/* XXX we need a unique res_id to export a blob
*
* virglrenderer.h does not have the right APIs for us. We should use vkr
* (and vrend, if that makes sense) directly.
*/
#define BLOB_RES_ID (~0u)
static int
render_context_import_blob(uint32_t res_id,
enum virgl_resource_fd_type fd_type,
@ -105,7 +98,7 @@ render_context_export_blob(struct render_context *ctx,
uint32_t *out_map_info,
int *out_res_fd)
{
const uint32_t res_id = BLOB_RES_ID;
const uint32_t res_id = req->res_id;
const struct virgl_renderer_resource_create_blob_args blob_args = {
.res_handle = res_id,
.ctx_id = ctx->ctx_id,
@ -253,10 +246,6 @@ render_context_dispatch_attach_resource(struct render_context *ctx,
const enum virgl_resource_fd_type fd_type = req->attach_resource.fd_type;
const uint64_t size = req->attach_resource.size;
if (res_id == BLOB_RES_ID) {
render_log("XXX res_id is %u, which is reserved for blob export", res_id);
return false;
}
if (fd_type == VIRGL_RESOURCE_FD_INVALID || !size || fd_count != 1) {
render_log("failed to attach invalid resource %d", res_id);
return false;

@ -158,6 +158,7 @@ struct render_context_op_detach_resource_request {
*/
struct render_context_op_get_blob_request {
struct render_context_op_header header;
uint32_t res_id;
uint64_t blob_id;
uint64_t blob_size;
uint32_t blob_flags; /* VIRGL_RENDERER_BLOB_FLAG_* */

@ -295,7 +295,7 @@ fail:
static int
proxy_context_get_blob(struct virgl_context *base,
UNUSED uint32_t res_id,
uint32_t res_id,
uint64_t blob_id,
uint64_t blob_size,
uint32_t blob_flags,
@ -317,6 +317,7 @@ proxy_context_get_blob(struct virgl_context *base,
const struct render_context_op_get_blob_request req = {
.header.op = RENDER_CONTEXT_OP_GET_BLOB,
.res_id = res_id,
.blob_id = blob_id,
.blob_size = blob_size,
.blob_flags = blob_flags,

Loading…
Cancel
Save