mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
anv: Execute RCS init batch on companion RCS context/engine
Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23661>
This commit is contained in:
parent
103512ef3b
commit
a63277ec36
9 changed files with 57 additions and 31 deletions
|
|
@ -1412,7 +1412,8 @@ anv_queue_submit(struct vk_queue *vk_queue,
|
|||
|
||||
VkResult
|
||||
anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
struct anv_batch *batch)
|
||||
struct anv_batch *batch,
|
||||
bool is_companion_rcs_batch)
|
||||
{
|
||||
struct anv_device *device = queue->device;
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
|
@ -1440,14 +1441,18 @@ anv_queue_submit_simple_batch(struct anv_queue *queue,
|
|||
|
||||
if (INTEL_DEBUG(DEBUG_BATCH) &&
|
||||
intel_debug_batch_in_range(device->debug_frame_desc->frame_id)) {
|
||||
intel_print_batch(queue->decoder,
|
||||
batch_bo->map,
|
||||
batch_bo->size,
|
||||
batch_bo->offset, false);
|
||||
int render_queue_idx =
|
||||
anv_get_first_render_queue_index(device->physical);
|
||||
struct intel_batch_decode_ctx *ctx = is_companion_rcs_batch ?
|
||||
&device->decoder[render_queue_idx] :
|
||||
queue->decoder;
|
||||
intel_print_batch(ctx, batch_bo->map, batch_bo->size, batch_bo->offset,
|
||||
false);
|
||||
}
|
||||
|
||||
result = device->kmd_backend->execute_simple_batch(queue, batch_bo,
|
||||
batch_size);
|
||||
batch_size,
|
||||
is_companion_rcs_batch);
|
||||
|
||||
anv_bo_pool_free(&device->batch_bo_pool, batch_bo);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,9 +59,8 @@ stub_gem_mmap(struct anv_device *device, struct anv_bo *bo, uint64_t offset,
|
|||
}
|
||||
|
||||
static VkResult
|
||||
stub_execute_simple_batch(struct anv_queue *queue,
|
||||
struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size)
|
||||
stub_execute_simple_batch(struct anv_queue *queue, struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size, bool is_companion_rcs_batch)
|
||||
{
|
||||
return VK_ERROR_UNKNOWN;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ struct anv_kmd_backend {
|
|||
int (*gem_vm_unbind)(struct anv_device *device, struct anv_bo *bo);
|
||||
VkResult (*execute_simple_batch)(struct anv_queue *queue,
|
||||
struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size);
|
||||
uint32_t batch_bo_size,
|
||||
bool is_companion_rcs_batch);
|
||||
VkResult (*queue_exec_locked)(struct anv_queue *queue,
|
||||
uint32_t wait_count,
|
||||
const struct vk_sync_wait *waits,
|
||||
|
|
|
|||
|
|
@ -1752,7 +1752,8 @@ void anv_queue_finish(struct anv_queue *queue);
|
|||
VkResult anv_queue_submit(struct vk_queue *queue,
|
||||
struct vk_queue_submit *submit);
|
||||
VkResult anv_queue_submit_simple_batch(struct anv_queue *queue,
|
||||
struct anv_batch *batch);
|
||||
struct anv_batch *batch,
|
||||
bool is_companion_rcs_batch);
|
||||
|
||||
void anv_queue_trace(struct anv_queue *queue, const char *label,
|
||||
bool frame, bool begin);
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ init_common_queue_state(struct anv_queue *queue, struct anv_batch *batch)
|
|||
}
|
||||
|
||||
static VkResult
|
||||
init_render_queue_state(struct anv_queue *queue)
|
||||
init_render_queue_state(struct anv_queue *queue, bool is_companion_rcs_batch)
|
||||
{
|
||||
struct anv_device *device = queue->device;
|
||||
UNUSED const struct intel_device_info *devinfo = queue->device->info;
|
||||
|
|
@ -589,7 +589,7 @@ init_render_queue_state(struct anv_queue *queue)
|
|||
|
||||
assert(batch.next <= batch.end);
|
||||
|
||||
return anv_queue_submit_simple_batch(queue, &batch);
|
||||
return anv_queue_submit_simple_batch(queue, &batch, is_companion_rcs_batch);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
@ -653,7 +653,8 @@ init_compute_queue_state(struct anv_queue *queue)
|
|||
|
||||
assert(batch.next <= batch.end);
|
||||
|
||||
return anv_queue_submit_simple_batch(queue, &batch);
|
||||
return anv_queue_submit_simple_batch(queue, &batch,
|
||||
false /* is_companion_rcs_batch */);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -678,11 +679,20 @@ genX(init_device_state)(struct anv_device *device)
|
|||
struct anv_queue *queue = &device->queues[i];
|
||||
switch (queue->family->engine_class) {
|
||||
case INTEL_ENGINE_CLASS_RENDER:
|
||||
res = init_render_queue_state(queue);
|
||||
res = init_render_queue_state(queue, false /* is_companion_rcs_batch */);
|
||||
break;
|
||||
case INTEL_ENGINE_CLASS_COMPUTE:
|
||||
case INTEL_ENGINE_CLASS_COMPUTE: {
|
||||
res = init_compute_queue_state(queue);
|
||||
if (res != VK_SUCCESS)
|
||||
return res;
|
||||
|
||||
/**
|
||||
* Execute RCS init batch by default on the companion RCS command buffer in
|
||||
* order to support MSAA copy/clear operations on compute queue.
|
||||
*/
|
||||
res = init_render_queue_state(queue, true /* is_companion_rcs_batch */);
|
||||
break;
|
||||
}
|
||||
case INTEL_ENGINE_CLASS_VIDEO:
|
||||
res = VK_SUCCESS;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -320,17 +320,22 @@ pin_state_pool(struct anv_device *device,
|
|||
|
||||
static void
|
||||
get_context_and_exec_flags(struct anv_queue *queue,
|
||||
bool is_companion_rcs_batch,
|
||||
uint64_t *exec_flags,
|
||||
uint32_t *context_id)
|
||||
{
|
||||
assert(queue != NULL);
|
||||
|
||||
struct anv_device *device = queue->device;
|
||||
/* Submit to index 0 which is the main (CCS/BCS etc) virtual engine. */
|
||||
|
||||
/** Submit batch to index 0 which is the main virtual engine */
|
||||
*exec_flags = device->physical->has_vm_control ? 0 : queue->exec_flags;
|
||||
|
||||
*context_id = device->physical->has_vm_control ? queue->context_id :
|
||||
device->context_id;
|
||||
*context_id = device->physical->has_vm_control ?
|
||||
is_companion_rcs_batch ?
|
||||
queue->companion_rcs_id :
|
||||
queue->context_id :
|
||||
device->context_id;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
@ -444,7 +449,7 @@ setup_execbuf_for_cmd_buffers(struct anv_execbuf *execbuf,
|
|||
|
||||
uint64_t exec_flags = 0;
|
||||
uint32_t context_id;
|
||||
get_context_and_exec_flags(queue, &exec_flags, &context_id);
|
||||
get_context_and_exec_flags(queue, false, &exec_flags, &context_id);
|
||||
|
||||
execbuf->execbuf = (struct drm_i915_gem_execbuffer2) {
|
||||
.buffers_ptr = (uintptr_t) execbuf->objects,
|
||||
|
|
@ -478,7 +483,7 @@ setup_empty_execbuf(struct anv_execbuf *execbuf, struct anv_queue *queue)
|
|||
|
||||
uint64_t exec_flags = 0;
|
||||
uint32_t context_id;
|
||||
get_context_and_exec_flags(queue, &exec_flags, &context_id);
|
||||
get_context_and_exec_flags(queue, false, &exec_flags, &context_id);
|
||||
|
||||
execbuf->execbuf = (struct drm_i915_gem_execbuffer2) {
|
||||
.buffers_ptr = (uintptr_t) execbuf->objects,
|
||||
|
|
@ -542,7 +547,7 @@ setup_utrace_execbuf(struct anv_execbuf *execbuf, struct anv_queue *queue,
|
|||
|
||||
uint64_t exec_flags = 0;
|
||||
uint32_t context_id;
|
||||
get_context_and_exec_flags(queue, &exec_flags, &context_id);
|
||||
get_context_and_exec_flags(queue, false, &exec_flags, &context_id);
|
||||
|
||||
execbuf->execbuf = (struct drm_i915_gem_execbuffer2) {
|
||||
.buffers_ptr = (uintptr_t) execbuf->objects,
|
||||
|
|
@ -770,7 +775,7 @@ i915_queue_exec_locked(struct anv_queue *queue,
|
|||
|
||||
uint64_t exec_flags = 0;
|
||||
uint32_t context_id;
|
||||
get_context_and_exec_flags(queue, &exec_flags, &context_id);
|
||||
get_context_and_exec_flags(queue, false, &exec_flags, &context_id);
|
||||
|
||||
struct drm_i915_gem_execbuffer2 query_pass_execbuf = {
|
||||
.buffers_ptr = (uintptr_t) &query_pass_object,
|
||||
|
|
@ -812,7 +817,7 @@ i915_queue_exec_locked(struct anv_queue *queue,
|
|||
|
||||
VkResult
|
||||
i915_execute_simple_batch(struct anv_queue *queue, struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size)
|
||||
uint32_t batch_bo_size, bool is_companion_rcs_batch)
|
||||
{
|
||||
struct anv_device *device = queue->device;
|
||||
struct anv_execbuf execbuf = {
|
||||
|
|
@ -826,7 +831,8 @@ i915_execute_simple_batch(struct anv_queue *queue, struct anv_bo *batch_bo,
|
|||
|
||||
uint64_t exec_flags = 0;
|
||||
uint32_t context_id;
|
||||
get_context_and_exec_flags(queue, &exec_flags, &context_id);
|
||||
get_context_and_exec_flags(queue, is_companion_rcs_batch, &exec_flags,
|
||||
&context_id);
|
||||
|
||||
execbuf.execbuf = (struct drm_i915_gem_execbuffer2) {
|
||||
.buffers_ptr = (uintptr_t) execbuf.objects,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ i915_queue_exec_trace(struct anv_queue *queue,
|
|||
struct anv_utrace_submit *submit);
|
||||
VkResult
|
||||
i915_execute_simple_batch(struct anv_queue *queue, struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size);
|
||||
uint32_t batch_bo_size, bool is_companion_rcs_batch);
|
||||
VkResult
|
||||
i915_queue_exec_locked(struct anv_queue *queue,
|
||||
uint32_t wait_count,
|
||||
|
|
|
|||
|
|
@ -30,13 +30,17 @@
|
|||
#include "drm-uapi/xe_drm.h"
|
||||
|
||||
VkResult
|
||||
xe_execute_simple_batch(struct anv_queue *queue, struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size)
|
||||
xe_execute_simple_batch(struct anv_queue *queue,
|
||||
struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size,
|
||||
bool is_companion_rcs_batch)
|
||||
{
|
||||
struct anv_device *device = queue->device;
|
||||
VkResult result = VK_SUCCESS;
|
||||
uint32_t syncobj_handle;
|
||||
|
||||
uint32_t exec_queue_id = is_companion_rcs_batch ?
|
||||
queue->companion_rcs_id :
|
||||
queue->exec_queue_id;
|
||||
if (drmSyncobjCreate(device->fd, 0, &syncobj_handle))
|
||||
return vk_errorf(device, VK_ERROR_UNKNOWN, "Unable to create sync obj");
|
||||
|
||||
|
|
@ -45,7 +49,7 @@ xe_execute_simple_batch(struct anv_queue *queue, struct anv_bo *batch_bo,
|
|||
.handle = syncobj_handle,
|
||||
};
|
||||
struct drm_xe_exec exec = {
|
||||
.exec_queue_id = queue->exec_queue_id,
|
||||
.exec_queue_id = exec_queue_id,
|
||||
.num_batch_buffer = 1,
|
||||
.address = batch_bo->offset,
|
||||
.num_syncs = 1,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ struct anv_utrace_submit;
|
|||
|
||||
VkResult
|
||||
xe_execute_simple_batch(struct anv_queue *queue, struct anv_bo *batch_bo,
|
||||
uint32_t batch_bo_size);
|
||||
uint32_t batch_bo_size, bool is_companion_rcs_batch);
|
||||
VkResult
|
||||
xe_queue_exec_locked(struct anv_queue *queue,
|
||||
uint32_t wait_count,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue