nvk: Plumb no_prefetch through to the DRM back-end
Instead of using bit 23 of nvk_cmd_push::range for this, pass it as a separate bool. This lets us use the actual kernel flag with the new UAPI. Reviewed-by: Danilo Krummrich <dakr@redhat.com> Tested-by: Danilo Krummrich <dakr@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24840>
This commit is contained in:

committed by
Marge Bot

parent
458baeee5f
commit
819d359d1d
@@ -157,8 +157,6 @@ nvk_cmd_buffer_new_push(struct nvk_cmd_buffer *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NVC0_IB_ENTRY_1_NO_PREFETCH (1 << (31 - 8))
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nvk_cmd_buffer_push_indirect_buffer(struct nvk_cmd_buffer *cmd,
|
nvk_cmd_buffer_push_indirect_buffer(struct nvk_cmd_buffer *cmd,
|
||||||
struct nvk_buffer *buffer,
|
struct nvk_buffer *buffer,
|
||||||
@@ -167,12 +165,12 @@ nvk_cmd_buffer_push_indirect_buffer(struct nvk_cmd_buffer *cmd,
|
|||||||
nvk_cmd_buffer_flush_push(cmd);
|
nvk_cmd_buffer_flush_push(cmd);
|
||||||
|
|
||||||
uint64_t addr = nvk_buffer_address(buffer, offset);
|
uint64_t addr = nvk_buffer_address(buffer, offset);
|
||||||
assert(range < NVC0_IB_ENTRY_1_NO_PREFETCH);
|
|
||||||
|
|
||||||
#if NVK_NEW_UAPI == 1
|
#if NVK_NEW_UAPI == 1
|
||||||
struct nvk_cmd_push push = {
|
struct nvk_cmd_push push = {
|
||||||
.addr = addr,
|
.addr = addr,
|
||||||
.range = NVC0_IB_ENTRY_1_NO_PREFETCH | range,
|
.range = range,
|
||||||
|
.no_prefetch = true,
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
struct nouveau_ws_bo *bo = buffer->mem->bo;
|
struct nouveau_ws_bo *bo = buffer->mem->bo;
|
||||||
@@ -180,7 +178,8 @@ nvk_cmd_buffer_push_indirect_buffer(struct nvk_cmd_buffer *cmd,
|
|||||||
struct nvk_cmd_push push = {
|
struct nvk_cmd_push push = {
|
||||||
.bo = bo,
|
.bo = bo,
|
||||||
.bo_offset = bo_offset,
|
.bo_offset = bo_offset,
|
||||||
.range = NVC0_IB_ENTRY_1_NO_PREFETCH | range,
|
.range = range,
|
||||||
|
.no_prefetch = true,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -555,7 +554,7 @@ nvk_cmd_buffer_dump(struct nvk_cmd_buffer *cmd, FILE *fp)
|
|||||||
const uint64_t addr = p->bo->offset + p->bo_offset;
|
const uint64_t addr = p->bo->offset + p->bo_offset;
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, "<%u B of INDIRECT DATA at 0x%" PRIx64 ">\n",
|
fprintf(fp, "<%u B of INDIRECT DATA at 0x%" PRIx64 ">\n",
|
||||||
p->range & ~NVC0_IB_ENTRY_1_NO_PREFETCH, addr);
|
p->range, addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -111,6 +111,7 @@ struct nvk_cmd_push {
|
|||||||
uint64_t bo_offset;
|
uint64_t bo_offset;
|
||||||
#endif
|
#endif
|
||||||
uint32_t range;
|
uint32_t range;
|
||||||
|
bool no_prefetch;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nvk_cmd_bo_ref {
|
struct nvk_cmd_bo_ref {
|
||||||
|
@@ -265,24 +265,33 @@ push_add_image_opaque_bind(struct push_builder *pb,
|
|||||||
|
|
||||||
#if NVK_NEW_UAPI == 1
|
#if NVK_NEW_UAPI == 1
|
||||||
static void
|
static void
|
||||||
push_add_push(struct push_builder *pb, uint64_t addr, uint32_t range)
|
push_add_push(struct push_builder *pb, uint64_t addr, uint32_t range,
|
||||||
|
bool no_prefetch)
|
||||||
{
|
{
|
||||||
assert((addr % 4) == 0 && (range % 4) == 0);
|
assert((addr % 4) == 0 && (range % 4) == 0);
|
||||||
|
|
||||||
if (range == 0)
|
if (range == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* This is the hardware limit on all current GPUs */
|
||||||
|
assert(range < (1u << 23));
|
||||||
|
|
||||||
|
uint32_t flags = 0;
|
||||||
|
if (no_prefetch)
|
||||||
|
flags |= DRM_NOUVEAU_EXEC_PUSH_NO_PREFETCH;
|
||||||
|
|
||||||
assert(pb->req.push_count < NVK_PUSH_MAX_PUSH);
|
assert(pb->req.push_count < NVK_PUSH_MAX_PUSH);
|
||||||
pb->req_push[pb->req.push_count++] = (struct drm_nouveau_exec_push) {
|
pb->req_push[pb->req.push_count++] = (struct drm_nouveau_exec_push) {
|
||||||
.va = addr,
|
.va = addr,
|
||||||
.va_len = range,
|
.va_len = range,
|
||||||
|
.flags = flags,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
push_add_push_bo(struct push_builder *pb, struct nouveau_ws_bo *bo,
|
push_add_push_bo(struct push_builder *pb, struct nouveau_ws_bo *bo,
|
||||||
uint32_t offset, uint32_t range)
|
uint32_t offset, uint32_t range, bool no_prefetch)
|
||||||
{
|
{
|
||||||
#if NVK_NEW_UAPI == 0
|
#if NVK_NEW_UAPI == 0
|
||||||
assert((offset % 4) == 0 && (range % 4) == 0);
|
assert((offset % 4) == 0 && (range % 4) == 0);
|
||||||
@@ -290,6 +299,10 @@ push_add_push_bo(struct push_builder *pb, struct nouveau_ws_bo *bo,
|
|||||||
if (range == 0)
|
if (range == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
assert(range < NOUVEAU_GEM_PUSHBUF_NO_PREFETCH);
|
||||||
|
if (no_prefetch)
|
||||||
|
range |= NOUVEAU_GEM_PUSHBUF_NO_PREFETCH;
|
||||||
|
|
||||||
uint32_t bo_index = push_add_bo(pb, bo, NOUVEAU_WS_BO_RD);
|
uint32_t bo_index = push_add_bo(pb, bo, NOUVEAU_WS_BO_RD);
|
||||||
|
|
||||||
pb->req_push[pb->req.nr_push++] = (struct drm_nouveau_gem_pushbuf_push) {
|
pb->req_push[pb->req.nr_push++] = (struct drm_nouveau_gem_pushbuf_push) {
|
||||||
@@ -298,7 +311,7 @@ push_add_push_bo(struct push_builder *pb, struct nouveau_ws_bo *bo,
|
|||||||
.length = range,
|
.length = range,
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
push_add_push(pb, bo->offset + offset, range);
|
push_add_push(pb, bo->offset + offset, range, no_prefetch);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +404,7 @@ nvk_queue_submit_simple_drm_nouveau(struct nvk_queue *queue,
|
|||||||
struct push_builder pb;
|
struct push_builder pb;
|
||||||
push_builder_init(dev, &pb, false);
|
push_builder_init(dev, &pb, false);
|
||||||
|
|
||||||
push_add_push_bo(&pb, push_bo, 0, push_dw_count * 4);
|
push_add_push_bo(&pb, push_bo, 0, push_dw_count * 4, false);
|
||||||
for (uint32_t i = 0; i < extra_bo_count; i++)
|
for (uint32_t i = 0; i < extra_bo_count; i++)
|
||||||
push_add_bo(&pb, extra_bos[i], NOUVEAU_WS_BO_RDWR);
|
push_add_bo(&pb, extra_bos[i], NOUVEAU_WS_BO_RDWR);
|
||||||
|
|
||||||
@@ -408,7 +421,7 @@ push_add_queue_state(struct push_builder *pb, struct nvk_queue_state *qs)
|
|||||||
if (qs->slm.bo)
|
if (qs->slm.bo)
|
||||||
push_add_bo(pb, qs->slm.bo, NOUVEAU_WS_BO_RDWR);
|
push_add_bo(pb, qs->slm.bo, NOUVEAU_WS_BO_RDWR);
|
||||||
if (qs->push.bo)
|
if (qs->push.bo)
|
||||||
push_add_push_bo(pb, qs->push.bo, 0, qs->push.dw_count * 4);
|
push_add_push_bo(pb, qs->push.bo, 0, qs->push.dw_count * 4, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -460,7 +473,7 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
|
|||||||
} else if (submit->command_buffer_count == 0) {
|
} else if (submit->command_buffer_count == 0) {
|
||||||
#if NVK_NEW_UAPI == 0
|
#if NVK_NEW_UAPI == 0
|
||||||
push_add_push_bo(&pb, queue->empty_push, 0,
|
push_add_push_bo(&pb, queue->empty_push, 0,
|
||||||
queue->empty_push_dw_count * 4);
|
queue->empty_push_dw_count * 4, false);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
push_add_queue_state(&pb, &queue->state);
|
push_add_queue_state(&pb, &queue->state);
|
||||||
@@ -483,10 +496,12 @@ nvk_queue_submit_drm_nouveau(struct nvk_queue *queue,
|
|||||||
|
|
||||||
#if NVK_NEW_UAPI == 1
|
#if NVK_NEW_UAPI == 1
|
||||||
util_dynarray_foreach(&cmd->pushes, struct nvk_cmd_push, push)
|
util_dynarray_foreach(&cmd->pushes, struct nvk_cmd_push, push)
|
||||||
push_add_push(&pb, push->addr, push->range);
|
push_add_push(&pb, push->addr, push->range, push->no_prefetch);
|
||||||
#else
|
#else
|
||||||
util_dynarray_foreach(&cmd->pushes, struct nvk_cmd_push, push)
|
util_dynarray_foreach(&cmd->pushes, struct nvk_cmd_push, push) {
|
||||||
push_add_push_bo(&pb, push->bo, push->bo_offset, push->range);
|
push_add_push_bo(&pb, push->bo, push->bo_offset, push->range,
|
||||||
|
push->no_prefetch);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
util_dynarray_foreach(&cmd->bo_refs, struct nvk_cmd_bo_ref, ref)
|
util_dynarray_foreach(&cmd->bo_refs, struct nvk_cmd_bo_ref, ref)
|
||||||
|
Reference in New Issue
Block a user