vrend: remove duplicate VREND_TRANSFER_* defines

These already have to be the same as VIRGL_TRANSFER_{TO,FROM}_HOST, as
defined by the protocol. There's no point in having a separate set of
internal names for them.

While we're at it, rewrite tan if as a switch for clarity. This allows
us to detect internal usage of invalid values.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Erik Faye-Lund 6 years ago
parent 990db949e9
commit afb78f123a
  1. 4
      src/virglrenderer.c
  2. 11
      src/vrend_renderer.c
  3. 2
      src/vrend_renderer.h

@ -133,7 +133,7 @@ int virgl_renderer_transfer_write_iov(uint32_t handle,
transfer_info.iovec_cnt = iovec_cnt;
transfer_info.context0 = true;
return vrend_renderer_transfer_iov(&transfer_info, VREND_TRANSFER_WRITE);
return vrend_renderer_transfer_iov(&transfer_info, VIRGL_TRANSFER_TO_HOST);
}
int virgl_renderer_transfer_read_iov(uint32_t handle, uint32_t ctx_id,
@ -156,7 +156,7 @@ int virgl_renderer_transfer_read_iov(uint32_t handle, uint32_t ctx_id,
transfer_info.iovec_cnt = iovec_cnt;
transfer_info.context0 = true;
return vrend_renderer_transfer_iov(&transfer_info, VREND_TRANSFER_READ);
return vrend_renderer_transfer_iov(&transfer_info, VIRGL_TRANSFER_FROM_HOST);
}
int virgl_renderer_resource_attach_iov(int res_handle, struct iovec *iov,

@ -6864,10 +6864,15 @@ int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info,
ctx = NULL;
}
if (transfer_mode == VREND_TRANSFER_WRITE)
switch (transfer_mode) {
case VIRGL_TRANSFER_TO_HOST:
return vrend_renderer_transfer_write_iov(ctx, res, iov, num_iovs, info);
else
case VIRGL_TRANSFER_FROM_HOST:
return vrend_renderer_transfer_send_iov(res, iov, num_iovs, info);
default:
assert(0);
}
}
int vrend_transfer_inline_write(struct vrend_context *ctx,
@ -8810,7 +8815,7 @@ void vrend_renderer_get_rect(int res_handle, struct iovec *iov, unsigned int num
transfer_info.iovec = iov;
transfer_info.iovec_cnt = num_iovs;
transfer_info.context0 = true;
vrend_renderer_transfer_iov(&transfer_info, VREND_TRANSFER_READ);
vrend_renderer_transfer_iov(&transfer_info, VIRGL_TRANSFER_FROM_HOST);
}
void vrend_renderer_resource_set_priv(uint32_t res_handle, void *priv)

@ -266,8 +266,6 @@ void vrend_set_framebuffer_state_no_attach(struct vrend_context *ctx,
uint32_t layers, uint32_t samples);
void vrend_texture_barrier(struct vrend_context *ctx,
unsigned flags);
#define VREND_TRANSFER_WRITE 1
#define VREND_TRANSFER_READ 2
int vrend_renderer_transfer_iov(const struct vrend_transfer_info *info, int transfer_mode);
void vrend_renderer_resource_copy_region(struct vrend_context *ctx,

Loading…
Cancel
Save