mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
pvr: Add support for PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED stream.
This adds support for PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED type control stream. The main difference is that this is backed by host memory. This is mainly needed for secondary command buffers allocated with VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT. In this case we need to copy secondary command buffer's control stream over to primary stream in vkCmdExecuteCommands. Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com> Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18871>
This commit is contained in:
parent
7494a977a2
commit
1420d196f7
2 changed files with 31 additions and 6 deletions
|
|
@ -82,7 +82,11 @@ void pvr_csb_init(struct pvr_device *device,
|
|||
csb->device = device;
|
||||
csb->stream_type = stream_type;
|
||||
csb->status = VK_SUCCESS;
|
||||
list_inithead(&csb->pvr_bo_list);
|
||||
|
||||
if (stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED)
|
||||
util_dynarray_init(&csb->deferred_cs_mem, NULL);
|
||||
else
|
||||
list_inithead(&csb->pvr_bo_list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -94,9 +98,13 @@ void pvr_csb_init(struct pvr_device *device,
|
|||
*/
|
||||
void pvr_csb_finish(struct pvr_csb *csb)
|
||||
{
|
||||
list_for_each_entry_safe (struct pvr_bo, pvr_bo, &csb->pvr_bo_list, link) {
|
||||
list_del(&pvr_bo->link);
|
||||
pvr_bo_free(csb->device, pvr_bo);
|
||||
if (csb->stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED) {
|
||||
util_dynarray_fini(&csb->deferred_cs_mem);
|
||||
} else {
|
||||
list_for_each_entry_safe (struct pvr_bo, pvr_bo, &csb->pvr_bo_list, link) {
|
||||
list_del(&pvr_bo->link);
|
||||
pvr_bo_free(csb->device, pvr_bo);
|
||||
}
|
||||
}
|
||||
|
||||
/* Leave the csb in a reset state to catch use after destroy instances */
|
||||
|
|
@ -185,17 +193,26 @@ static bool pvr_csb_buffer_extend(struct pvr_csb *csb)
|
|||
void *pvr_csb_alloc_dwords(struct pvr_csb *csb, uint32_t num_dwords)
|
||||
{
|
||||
const uint32_t required_space = num_dwords * 4;
|
||||
void *p;
|
||||
|
||||
if (csb->status != VK_SUCCESS)
|
||||
return NULL;
|
||||
|
||||
if (csb->stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED) {
|
||||
p = util_dynarray_grow_bytes(&csb->deferred_cs_mem, 1, required_space);
|
||||
if (!p)
|
||||
csb->status = vk_error(csb->device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
if (csb->next + required_space > csb->end) {
|
||||
bool ret = pvr_csb_buffer_extend(csb);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *p = csb->next;
|
||||
p = csb->next;
|
||||
|
||||
csb->next += required_space;
|
||||
assert(csb->next <= csb->end);
|
||||
|
|
@ -214,6 +231,9 @@ void *pvr_csb_alloc_dwords(struct pvr_csb *csb, uint32_t num_dwords)
|
|||
*/
|
||||
void pvr_csb_emit_link(struct pvr_csb *csb, pvr_dev_addr_t addr, bool ret)
|
||||
{
|
||||
/* Not supported for deferred control stream. */
|
||||
assert(csb->stream_type != PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED);
|
||||
|
||||
/* Stream return is only supported for graphics control stream. */
|
||||
assert(!ret || csb->stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS);
|
||||
|
||||
|
|
@ -258,7 +278,8 @@ void pvr_csb_emit_link(struct pvr_csb *csb, pvr_dev_addr_t addr, bool ret)
|
|||
VkResult pvr_csb_emit_return(struct pvr_csb *csb)
|
||||
{
|
||||
/* STREAM_RETURN is only supported by graphics control stream. */
|
||||
assert(csb->stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS);
|
||||
assert(csb->stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS ||
|
||||
csb->stream_type == PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED);
|
||||
|
||||
/* clang-format off */
|
||||
pvr_csb_emit(csb, VDMCTRL_STREAM_RETURN, ret);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "pvr_winsys.h"
|
||||
#include "util/list.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/u_dynarray.h"
|
||||
|
||||
#define __pvr_address_type pvr_dev_addr_t
|
||||
#define __pvr_get_address(pvr_dev_addr) (pvr_dev_addr).addr
|
||||
|
|
@ -54,6 +55,7 @@ struct pvr_device;
|
|||
enum pvr_cmd_stream_type {
|
||||
PVR_CMD_STREAM_TYPE_INVALID = 0, /* explicitly treat 0 as invalid */
|
||||
PVR_CMD_STREAM_TYPE_GRAPHICS,
|
||||
PVR_CMD_STREAM_TYPE_GRAPHICS_DEFERRED,
|
||||
PVR_CMD_STREAM_TYPE_COMPUTE,
|
||||
};
|
||||
|
||||
|
|
@ -71,6 +73,8 @@ struct pvr_csb {
|
|||
/* List of csb buffer objects */
|
||||
struct list_head pvr_bo_list;
|
||||
|
||||
struct util_dynarray deferred_cs_mem;
|
||||
|
||||
enum pvr_cmd_stream_type stream_type;
|
||||
|
||||
/* Current error status of the command buffer. Used to track inconsistent
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue