aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGurchetan Singh <[email protected]>2019-01-11 17:29:49 -0800
committerGert Wollny <[email protected]>2019-02-15 11:19:04 +0100
commit5b6a2ae987d6d6895d80ce61292e2025cacb5125 (patch)
treeb2cbf9c3caa8bdc2eef751c1a77fcb1466500beb
parent1d294ad264dc85e716bec5b6d0286cc3e10ce224 (diff)
virgl: use virgl_resource_dirty helper
Reviewed-by: Gert Wollny <[email protected]>
-rw-r--r--src/gallium/drivers/virgl/virgl_context.c8
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.c14
-rw-r--r--src/gallium/drivers/virgl/virgl_query.c2
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.c6
-rw-r--r--src/gallium/drivers/virgl/virgl_resource.h3
-rw-r--r--src/gallium/drivers/virgl/virgl_streamout.c2
6 files changed, 19 insertions, 16 deletions
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 0e4fd5b2ea4..d1348f17719 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -234,7 +234,7 @@ static struct pipe_surface *virgl_create_surface(struct pipe_context *ctx,
(util_format_is_srgb(templ->format) ==
util_format_is_srgb(resource->format)));
- res->clean[0] = FALSE;
+ virgl_resource_dirty(res, 0);
handle = virgl_object_assign_handle();
pipe_reference_init(&surf->base.reference, 1);
pipe_resource_reference(&surf->base.texture, resource);
@@ -521,7 +521,7 @@ void virgl_transfer_inline_write(struct pipe_context *ctx,
struct virgl_screen *vs = virgl_screen(ctx->screen);
struct virgl_resource *grres = virgl_resource(res);
- grres->clean[0] = FALSE;
+ virgl_resource_dirty(grres, 0);
if (virgl_res_needs_flush_wait(vctx, grres, usage)) {
ctx->flush(ctx, NULL, 0);
@@ -975,7 +975,7 @@ static void virgl_resource_copy_region(struct pipe_context *ctx,
struct virgl_resource *dres = virgl_resource(dst);
struct virgl_resource *sres = virgl_resource(src);
- dres->clean[0] = FALSE;
+ virgl_resource_dirty(dres, 0);
virgl_encode_resource_copy_region(vctx, dres,
dst_level, dstx, dsty, dstz,
sres, src_level,
@@ -1000,7 +1000,7 @@ static void virgl_blit(struct pipe_context *ctx,
(util_format_is_srgb(blit->dst.resource->format) ==
util_format_is_srgb(blit->dst.format)));
- dres->clean[0] = FALSE;
+ virgl_resource_dirty(dres, 0);
virgl_encode_blit(vctx, dres, sres,
blit);
}
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index b7fa31737c8..6fbefc5933b 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -61,12 +61,6 @@ static void virgl_encoder_write_res(struct virgl_context *ctx,
}
}
-static void virgl_dirty_res(struct virgl_resource *res)
-{
- if (res)
- res->clean[0] = FALSE;
-}
-
int virgl_encode_bind_object(struct virgl_context *ctx,
uint32_t handle, uint32_t object)
{
@@ -621,7 +615,7 @@ int virgl_encode_sampler_view(struct virgl_context *ctx,
if (res->u.b.target == PIPE_BUFFER) {
virgl_encoder_write_dword(ctx->cbuf, state->u.buf.offset / elem_size);
virgl_encoder_write_dword(ctx->cbuf, (state->u.buf.offset + state->u.buf.size) / elem_size - 1);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_layer | state->u.tex.last_layer << 16);
virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_level | state->u.tex.last_level << 8);
@@ -956,7 +950,7 @@ int virgl_encode_set_shader_buffers(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_size);
virgl_encoder_write_res(ctx, res);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, 0);
@@ -980,7 +974,7 @@ int virgl_encode_set_hw_atomic_buffers(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_size);
virgl_encoder_write_res(ctx, res);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, 0);
@@ -1008,7 +1002,7 @@ int virgl_encode_set_shader_images(struct virgl_context *ctx,
virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.offset);
virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.size);
virgl_encoder_write_res(ctx, res);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, 0);
diff --git a/src/gallium/drivers/virgl/virgl_query.c b/src/gallium/drivers/virgl/virgl_query.c
index 0085cc5e7a3..4fc5dd8a8c2 100644
--- a/src/gallium/drivers/virgl/virgl_query.c
+++ b/src/gallium/drivers/virgl/virgl_query.c
@@ -137,7 +137,7 @@ static boolean virgl_begin_query(struct pipe_context *ctx,
struct virgl_context *vctx = virgl_context(ctx);
struct virgl_query *query = virgl_query(q);
- query->buf->clean[0] = FALSE;
+ virgl_resource_dirty(query->buf, 0);
virgl_encoder_begin_query(vctx, query->handle);
return true;
}
diff --git a/src/gallium/drivers/virgl/virgl_resource.c b/src/gallium/drivers/virgl/virgl_resource.c
index b7dfcacf619..883dad0e386 100644
--- a/src/gallium/drivers/virgl/virgl_resource.c
+++ b/src/gallium/drivers/virgl/virgl_resource.c
@@ -278,3 +278,9 @@ boolean virgl_resource_get_handle(struct pipe_screen *screen,
res->metadata.stride[0],
whandle);
}
+
+void virgl_resource_dirty(struct virgl_resource *res, uint32_t level)
+{
+ if (res)
+ res->clean[0] = FALSE;
+}
diff --git a/src/gallium/drivers/virgl/virgl_resource.h b/src/gallium/drivers/virgl/virgl_resource.h
index fee630bca17..33411959678 100644
--- a/src/gallium/drivers/virgl/virgl_resource.h
+++ b/src/gallium/drivers/virgl/virgl_resource.h
@@ -137,4 +137,7 @@ void virgl_resource_destroy(struct pipe_screen *screen,
boolean virgl_resource_get_handle(struct pipe_screen *screen,
struct pipe_resource *resource,
struct winsys_handle *whandle);
+
+void virgl_resource_dirty(struct virgl_resource *res, uint32_t level);
+
#endif
diff --git a/src/gallium/drivers/virgl/virgl_streamout.c b/src/gallium/drivers/virgl/virgl_streamout.c
index a3465e53233..a467a6a3d02 100644
--- a/src/gallium/drivers/virgl/virgl_streamout.c
+++ b/src/gallium/drivers/virgl/virgl_streamout.c
@@ -48,7 +48,7 @@ static struct pipe_stream_output_target *virgl_create_so_target(
t->base.buffer_offset = buffer_offset;
t->base.buffer_size = buffer_size;
t->handle = handle;
- res->clean[0] = FALSE;
+ virgl_resource_dirty(res, 0);
virgl_encoder_create_so_target(vctx, handle, res, buffer_offset, buffer_size);
return &t->base;
}