summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-04-06 00:19:57 -0700
committerKenneth Graunke <[email protected]>2019-02-21 10:26:05 -0800
commit1af84d345a2e5c3b416efbf0a80d9d8b31e896a7 (patch)
treec940e884f9802e3a68338e0cafd96ddd7901254b
parent651be7cf3d8887a5bb84ef70fa67719fef2dc548 (diff)
iris: set EXEC_OBJECT_WRITE
-rw-r--r--src/gallium/drivers/iris/iris_batch.c8
-rw-r--r--src/gallium/drivers/iris/iris_batch.h5
-rw-r--r--src/gallium/drivers/iris/iris_state.c10
3 files changed, 14 insertions, 9 deletions
diff --git a/src/gallium/drivers/iris/iris_batch.c b/src/gallium/drivers/iris/iris_batch.c
index 52e44d9bb04..171bc9aa6b5 100644
--- a/src/gallium/drivers/iris/iris_batch.c
+++ b/src/gallium/drivers/iris/iris_batch.c
@@ -571,10 +571,14 @@ iris_batch_references(struct iris_batch *batch, struct iris_bo *bo)
/* This is the only way buffers get added to the validate list.
*/
void
-iris_use_pinned_bo(struct iris_batch *batch, struct iris_bo *bo)
+iris_use_pinned_bo(struct iris_batch *batch,
+ struct iris_bo *bo,
+ bool writable)
{
assert(bo->kflags & EXEC_OBJECT_PINNED);
- add_exec_bo(batch, bo);
+ unsigned index = add_exec_bo(batch, bo);
+ if (writable)
+ batch->validation_list[index].flags |= EXEC_OBJECT_WRITE;
}
static void
diff --git a/src/gallium/drivers/iris/iris_batch.h b/src/gallium/drivers/iris/iris_batch.h
index 771fb48ced1..492d95e7c99 100644
--- a/src/gallium/drivers/iris/iris_batch.h
+++ b/src/gallium/drivers/iris/iris_batch.h
@@ -38,8 +38,8 @@
struct iris_address {
struct iris_bo *bo;
- unsigned reloc_flags;
uint64_t offset;
+ bool write;
};
struct iris_batch_buffer {
@@ -106,6 +106,7 @@ bool iris_batch_references(struct iris_batch *batch, struct iris_bo *bo);
#define RELOC_WRITE EXEC_OBJECT_WRITE
-void iris_use_pinned_bo(struct iris_batch *batch, struct iris_bo *bo);
+void iris_use_pinned_bo(struct iris_batch *batch, struct iris_bo *bo,
+ bool writable);
#endif
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 7042cb0e496..2a76873c91e 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -57,9 +57,8 @@ static uint64_t
__gen_combine_address(struct iris_batch *batch, void *location,
struct iris_address addr, uint32_t delta)
{
- // XXX: reloc flags?
if (addr.bo)
- iris_use_pinned_bo(batch, addr.bo);
+ iris_use_pinned_bo(batch, addr.bo, addr.write);
return addr.offset + delta;
}
@@ -286,7 +285,7 @@ stream_state(struct iris_batch *batch,
void *ptr = NULL;
u_upload_alloc(uploader, 0, size, alignment, out_offset, &res, &ptr);
- iris_use_pinned_bo(batch, ((struct iris_resource *) res)->bo);
+ iris_use_pinned_bo(batch, ((struct iris_resource *) res)->bo, false);
pipe_resource_reference(&res, NULL);
return ptr;
@@ -1973,6 +1972,7 @@ iris_upload_render_state(struct iris_context *ice,
for (unsigned i = 0; i < cso_fb->nr_cbufs; i++) {
struct iris_surface *surf = (void *) cso_fb->cbufs[i];
struct iris_resource *res = (void *) surf->pipe.texture;
+ iris_use_pinned_bo(batch, res->bo, true);
*bt_map++ =
emit_state(batch, ice->state.surface_uploader,
surf->surface_state,
@@ -2051,7 +2051,7 @@ iris_upload_render_state(struct iris_context *ice,
if (shader) {
struct iris_resource *cache = (void *) shader->buffer;
- iris_use_pinned_bo(batch, cache->bo);
+ iris_use_pinned_bo(batch, cache->bo, false);
iris_batch_emit(batch, shader->derived_data,
iris_derived_program_state_size(stage));
} else {
@@ -2221,7 +2221,7 @@ iris_upload_render_state(struct iris_context *ice,
sizeof(uint32_t) * (1 + 4 * cso->num_buffers));
for (unsigned i = 0; i < cso->num_buffers; i++) {
- iris_use_pinned_bo(batch, cso->bos[i].bo);
+ iris_use_pinned_bo(batch, cso->bos[i].bo, false);
*addr = cso->bos[i].offset + *delta;
addr = (void *) addr + 16;
delta = (void *) delta + 16;