static void virgl_drm_cmd_buf_destroy(struct virgl_cmd_buf *_cbuf)
{
- struct virgl_drm_cmd_buf *cbuf = (struct virgl_drm_cmd_buf *)_cbuf;
+ struct virgl_drm_cmd_buf *cbuf = virgl_drm_cmd_buf(_cbuf);
FREE(cbuf->res_hlist);
FREE(cbuf->res_bo);
struct virgl_cmd_buf *_cbuf, struct virgl_hw_res *res, boolean write_buf)
{
struct virgl_drm_winsys *qdws = virgl_drm_winsys(qws);
- struct virgl_drm_cmd_buf *cbuf = (struct virgl_drm_cmd_buf *)_cbuf;
+ struct virgl_drm_cmd_buf *cbuf = virgl_drm_cmd_buf(_cbuf);
boolean already_in_list = virgl_drm_lookup_res(cbuf, res);
if (write_buf)
static int virgl_drm_winsys_submit_cmd(struct virgl_winsys *qws, struct virgl_cmd_buf *_cbuf)
{
struct virgl_drm_winsys *qdws = virgl_drm_winsys(qws);
- struct virgl_drm_cmd_buf *cbuf = (struct virgl_drm_cmd_buf *)_cbuf;
+ struct virgl_drm_cmd_buf *cbuf = virgl_drm_cmd_buf(_cbuf);
struct drm_virtgpu_execbuffer eb;
int ret;
uint64_t timeout)
{
struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
- struct virgl_hw_res *res = (struct virgl_hw_res *)fence;
+ struct virgl_hw_res *res = virgl_hw_res(fence);
if (timeout == 0)
return virgl_drm_resource_is_busy(vdws, res);
{
struct virgl_drm_winsys *vdws = virgl_drm_winsys(vws);
virgl_drm_resource_reference(vdws, (struct virgl_hw_res **)dst,
- (struct virgl_hw_res *)src);
+ virgl_hw_res(src));
}
#include "virgl/virgl_hw.h"
#include "virgl/virgl_winsys.h"
+struct pipe_fence_handle;
+
struct virgl_hw_res {
struct pipe_reference reference;
uint32_t res_handle;
};
+static inline struct virgl_hw_res *
+virgl_hw_res(struct pipe_fence_handle *f)
+{
+ return (struct virgl_hw_res *)f;
+}
+
static inline struct virgl_drm_winsys *
virgl_drm_winsys(struct virgl_winsys *iws)
{
return (struct virgl_drm_winsys *)iws;
}
+static inline struct virgl_drm_cmd_buf *
+virgl_drm_cmd_buf(struct virgl_cmd_buf *cbuf)
+{
+ return (struct virgl_drm_cmd_buf *)cbuf;
+}
+
#endif
static void virgl_vtest_cmd_buf_destroy(struct virgl_cmd_buf *_cbuf)
{
- struct virgl_vtest_cmd_buf *cbuf = (struct virgl_vtest_cmd_buf *)_cbuf;
+ struct virgl_vtest_cmd_buf *cbuf = virgl_vtest_cmd_buf(_cbuf);
FREE(cbuf->res_bo);
FREE(cbuf);
static int virgl_vtest_winsys_submit_cmd(struct virgl_winsys *vws, struct virgl_cmd_buf *_cbuf)
{
struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws);
- struct virgl_vtest_cmd_buf *cbuf = (struct virgl_vtest_cmd_buf *)_cbuf;
+ struct virgl_vtest_cmd_buf *cbuf = virgl_vtest_cmd_buf(_cbuf);
int ret;
if (cbuf->base.cdw == 0)
static void virgl_vtest_emit_res(struct virgl_winsys *vws, struct virgl_cmd_buf *_cbuf, struct virgl_hw_res *res, boolean write_buf)
{
struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws);
- struct virgl_vtest_cmd_buf *cbuf = (struct virgl_vtest_cmd_buf *)_cbuf;
+ struct virgl_vtest_cmd_buf *cbuf = virgl_vtest_cmd_buf(_cbuf);
boolean already_in_list = virgl_vtest_lookup_res(cbuf, res);
if (write_buf)
uint64_t timeout)
{
struct virgl_vtest_winsys *vdws = virgl_vtest_winsys(vws);
- struct virgl_hw_res *res = (struct virgl_hw_res *)fence;
+ struct virgl_hw_res *res = virgl_hw_res(fence);
if (timeout == 0)
return virgl_vtest_resource_is_busy(vdws, res);
{
struct virgl_vtest_winsys *vdws = virgl_vtest_winsys(vws);
virgl_vtest_resource_reference(vdws, (struct virgl_hw_res **)dst,
- (struct virgl_hw_res *)src);
+ virgl_hw_res(src));
}
static void virgl_vtest_flush_frontbuffer(struct virgl_winsys *vws,
#include "os/os_thread.h"
#include "vtest_protocol.h"
+
+struct pipe_fence_handle;
+
struct virgl_vtest_winsys {
struct virgl_winsys base;
unsigned reloc_indices_hashlist[512];
};
+static inline struct virgl_hw_res *
+virgl_hw_res(struct pipe_fence_handle *f)
+{
+ return (struct virgl_hw_res *)f;
+}
+
static inline struct virgl_vtest_winsys *
virgl_vtest_winsys(struct virgl_winsys *iws)
{
return (struct virgl_vtest_winsys *)iws;
}
+static inline struct virgl_vtest_cmd_buf *
+virgl_vtest_cmd_buf(struct virgl_cmd_buf *cbuf)
+{
+ return (struct virgl_vtest_cmd_buf *)cbuf;
+}
+
+
int virgl_vtest_connect(struct virgl_vtest_winsys *vws);
int virgl_vtest_send_get_caps(struct virgl_vtest_winsys *vws,
struct virgl_drm_caps *caps);