vctx = CALLOC_STRUCT(virgl_context);
const char *host_debug_flagstring;
- vctx->cbuf = rs->vws->cmd_buf_create(rs->vws);
+ vctx->cbuf = rs->vws->cmd_buf_create(rs->vws, VIRGL_MAX_CMDBUF_DWORDS);
if (!vctx->cbuf) {
FREE(vctx);
return NULL;
struct winsys_handle;
struct virgl_hw_res;
-#define VIRGL_MAX_CMDBUF_DWORDS (64 * 1024)
+#define VIRGL_MAX_TBUF_DWORDS 1024
+#define VIRGL_MAX_CMDBUF_DWORDS ((64 * 1024) + VIRGL_MAX_TBUF_DWORDS)
struct virgl_drm_caps {
union virgl_caps caps;
struct virgl_winsys {
unsigned pci_id;
int supports_fences; /* In/Out fences are supported */
+ int supports_encoded_transfers; /* Encoded transfers are supported */
void (*destroy)(struct virgl_winsys *vws);
uint32_t stride,
struct winsys_handle *whandle);
- struct virgl_cmd_buf *(*cmd_buf_create)(struct virgl_winsys *ws);
+ struct virgl_cmd_buf *(*cmd_buf_create)(struct virgl_winsys *ws, uint32_t size);
void (*cmd_buf_destroy)(struct virgl_cmd_buf *buf);
void (*emit_res)(struct virgl_winsys *vws, struct virgl_cmd_buf *buf, struct virgl_hw_res *res, boolean write_buffer);
goto again;
}
-static struct virgl_cmd_buf *virgl_drm_cmd_buf_create(struct virgl_winsys *qws)
+static struct virgl_cmd_buf *virgl_drm_cmd_buf_create(struct virgl_winsys *qws,
+ uint32_t size)
{
struct virgl_drm_cmd_buf *cbuf;
return NULL;
}
+ cbuf->buf = CALLOC(size, sizeof(uint32_t));
+ if (!cbuf->buf) {
+ FREE(cbuf->res_hlist);
+ FREE(cbuf->res_bo);
+ FREE(cbuf);
+ return NULL;
+ }
+
cbuf->base.buf = cbuf->buf;
cbuf->base.in_fence_fd = -1;
return &cbuf->base;
FREE(cbuf->res_hlist);
FREE(cbuf->res_bo);
+ FREE(cbuf->buf);
FREE(cbuf);
}
qdws->base.fence_server_sync = virgl_fence_server_sync;
qdws->base.fence_get_fd = virgl_fence_get_fd;
qdws->base.supports_fences = drm_version >= VIRGL_DRM_VERSION_FENCE_FD;
+ qdws->base.supports_encoded_transfers = 1;
qdws->base.get_caps = virgl_drm_get_caps;
struct virgl_drm_cmd_buf {
struct virgl_cmd_buf base;
- uint32_t buf[VIRGL_MAX_CMDBUF_DWORDS];
+ uint32_t *buf;
unsigned nres;
unsigned cres;
return res;
}
-static struct virgl_cmd_buf *virgl_vtest_cmd_buf_create(struct virgl_winsys *vws)
+static struct virgl_cmd_buf *virgl_vtest_cmd_buf_create(struct virgl_winsys *vws,
+ uint32_t size)
{
struct virgl_vtest_cmd_buf *cbuf;
vtws->base.fence_wait = virgl_fence_wait;
vtws->base.fence_reference = virgl_fence_reference;
vtws->base.supports_fences = 0;
+ vtws->base.supports_encoded_transfers = 0;
vtws->base.flush_frontbuffer = virgl_vtest_flush_frontbuffer;