summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2015-10-28 12:38:35 +0000
committerEmil Velikov <[email protected]>2015-10-30 17:37:09 +0000
commit1ce685f05e798d1b3c0526b5431f8109dd8803fa (patch)
tree8c3fb433513d190e515e6b237791acde71a9d8e2 /src/gallium/winsys
parent78be78b68172f702bb053ecb39105b2550e34454 (diff)
winsys/virgl: throw in some inline wrappers
Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.c10
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.h14
-rw-r--r--src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c10
-rw-r--r--src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h16
4 files changed, 40 insertions, 10 deletions
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
index 2d5bf257d24..31317b906f5 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
@@ -532,7 +532,7 @@ static struct virgl_cmd_buf *virgl_drm_cmd_buf_create(struct virgl_winsys *qws)
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);
@@ -597,7 +597,7 @@ static void virgl_drm_emit_res(struct virgl_winsys *qws,
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)
@@ -620,7 +620,7 @@ static boolean virgl_drm_res_is_ref(struct virgl_winsys *qws,
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;
@@ -690,7 +690,7 @@ static bool virgl_fence_wait(struct virgl_winsys *vws,
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);
@@ -715,7 +715,7 @@ static void virgl_fence_reference(struct virgl_winsys *vws,
{
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));
}
diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
index a5476544997..c83527206f5 100644
--- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
+++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.h
@@ -39,6 +39,8 @@
#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;
@@ -87,10 +89,22 @@ struct virgl_drm_cmd_buf {
};
+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
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
index 24ba7ec116f..1c8df6e469d 100644
--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
@@ -407,7 +407,7 @@ static struct virgl_cmd_buf *virgl_vtest_cmd_buf_create(struct virgl_winsys *vws
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);
@@ -468,7 +468,7 @@ static void virgl_vtest_add_res(struct virgl_vtest_winsys *vtws,
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)
@@ -485,7 +485,7 @@ static int virgl_vtest_winsys_submit_cmd(struct virgl_winsys *vws, struct virgl_
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)
@@ -529,7 +529,7 @@ static bool virgl_fence_wait(struct virgl_winsys *vws,
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);
@@ -554,7 +554,7 @@ static void virgl_fence_reference(struct virgl_winsys *vws,
{
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,
diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
index 6d0e7b0a598..fd8cb7a6368 100644
--- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
+++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
@@ -34,6 +34,9 @@
#include "os/os_thread.h"
#include "vtest_protocol.h"
+
+struct pipe_fence_handle;
+
struct virgl_vtest_winsys {
struct virgl_winsys base;
@@ -83,12 +86,25 @@ struct virgl_vtest_cmd_buf {
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);