summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/virgl/drm
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/virgl/drm
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/virgl/drm')
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.c10
-rw-r--r--src/gallium/winsys/virgl/drm/virgl_drm_winsys.h14
2 files changed, 19 insertions, 5 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