turnip: update tu_cs.h
(cherry picked from commit 51d416a7e4
)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17877>
This commit is contained in:
@@ -116,7 +116,10 @@
|
||||
struct tu_device;
|
||||
struct tu_instance;
|
||||
|
||||
struct breadcrumbs_context;
|
||||
struct tu_bo;
|
||||
struct tu_cs;
|
||||
struct tu_cs_entry;
|
||||
struct tu_suballoc_bo;
|
||||
struct tu_suballocator;
|
||||
|
||||
|
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "tu_cs.h"
|
||||
|
||||
#include "tu_suballoc.h"
|
||||
|
||||
/**
|
||||
* Initialize a command stream.
|
||||
*/
|
||||
|
@@ -20,18 +20,111 @@
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef TU_CS_H
|
||||
#define TU_CS_H
|
||||
|
||||
#include "tu_private.h"
|
||||
#include "tu_common.h"
|
||||
|
||||
#include "freedreno_pm4.h"
|
||||
|
||||
#include "tu_drm.h"
|
||||
|
||||
/* For breadcrumbs we may open a network socket based on the envvar,
|
||||
* it's not something that should be enabled by default.
|
||||
*/
|
||||
#define TU_BREADCRUMBS_ENABLED 0
|
||||
|
||||
enum tu_cs_mode
|
||||
{
|
||||
|
||||
/*
|
||||
* A command stream in TU_CS_MODE_GROW mode grows automatically whenever it
|
||||
* is full. tu_cs_begin must be called before command packet emission and
|
||||
* tu_cs_end must be called after.
|
||||
*
|
||||
* This mode may create multiple entries internally. The entries must be
|
||||
* submitted together.
|
||||
*/
|
||||
TU_CS_MODE_GROW,
|
||||
|
||||
/*
|
||||
* A command stream in TU_CS_MODE_EXTERNAL mode wraps an external,
|
||||
* fixed-size buffer. tu_cs_begin and tu_cs_end are optional and have no
|
||||
* effect on it.
|
||||
*
|
||||
* This mode does not create any entry or any BO.
|
||||
*/
|
||||
TU_CS_MODE_EXTERNAL,
|
||||
|
||||
/*
|
||||
* A command stream in TU_CS_MODE_SUB_STREAM mode does not support direct
|
||||
* command packet emission. tu_cs_begin_sub_stream must be called to get a
|
||||
* sub-stream to emit comamnd packets to. When done with the sub-stream,
|
||||
* tu_cs_end_sub_stream must be called.
|
||||
*
|
||||
* This mode does not create any entry internally.
|
||||
*/
|
||||
TU_CS_MODE_SUB_STREAM,
|
||||
};
|
||||
|
||||
struct tu_cs_entry
|
||||
{
|
||||
/* No ownership */
|
||||
const struct tu_bo *bo;
|
||||
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
struct tu_cs_memory {
|
||||
uint32_t *map;
|
||||
uint64_t iova;
|
||||
};
|
||||
|
||||
struct tu_draw_state {
|
||||
uint64_t iova : 48;
|
||||
uint32_t size : 16;
|
||||
};
|
||||
|
||||
#define TU_COND_EXEC_STACK_SIZE 4
|
||||
|
||||
struct tu_cs
|
||||
{
|
||||
uint32_t *start;
|
||||
uint32_t *cur;
|
||||
uint32_t *reserved_end;
|
||||
uint32_t *end;
|
||||
|
||||
struct tu_device *device;
|
||||
enum tu_cs_mode mode;
|
||||
uint32_t next_bo_size;
|
||||
|
||||
struct tu_cs_entry *entries;
|
||||
uint32_t entry_count;
|
||||
uint32_t entry_capacity;
|
||||
|
||||
struct tu_bo **bos;
|
||||
uint32_t bo_count;
|
||||
uint32_t bo_capacity;
|
||||
|
||||
/* Optional BO that this CS is sub-allocated from for TU_CS_MODE_SUB_STREAM */
|
||||
struct tu_bo *refcount_bo;
|
||||
|
||||
/* state for cond_exec_start/cond_exec_end */
|
||||
uint32_t cond_stack_depth;
|
||||
uint32_t cond_flags[TU_COND_EXEC_STACK_SIZE];
|
||||
uint32_t *cond_dwords[TU_COND_EXEC_STACK_SIZE];
|
||||
|
||||
uint32_t breadcrumb_emit_after;
|
||||
};
|
||||
|
||||
void
|
||||
tu_breadcrumbs_init(struct tu_device *device);
|
||||
|
||||
void
|
||||
tu_breadcrumbs_finish(struct tu_device *device);
|
||||
|
||||
void
|
||||
tu_cs_init(struct tu_cs *cs,
|
||||
struct tu_device *device,
|
||||
@@ -336,6 +429,19 @@ tu_cond_exec_end(struct tu_cs *cs)
|
||||
cs->cur - cs->cond_dwords[cs->cond_stack_depth] - 1;
|
||||
}
|
||||
|
||||
/* Temporary struct for tracking a register state to be written, used by
|
||||
* a6xx-pack.h and tu_cs_emit_regs()
|
||||
*/
|
||||
struct tu_reg_value {
|
||||
uint32_t reg;
|
||||
uint64_t value;
|
||||
bool is_address;
|
||||
struct tu_bo *bo;
|
||||
bool bo_write;
|
||||
uint32_t bo_offset;
|
||||
uint32_t bo_shift;
|
||||
};
|
||||
|
||||
#define fd_reg_pair tu_reg_value
|
||||
#define __bo_type struct tu_bo *
|
||||
|
||||
|
@@ -21,12 +21,13 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "tu_cs.h"
|
||||
#include "tu_private.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "tu_cs.h"
|
||||
|
||||
/* A simple implementations of breadcrumbs tracking of GPU progress
|
||||
* intended to be a last resort when debugging unrecoverable hangs.
|
||||
* For best results use Vulkan traces to have a predictable place of hang.
|
||||
@@ -276,4 +277,4 @@ tu_cs_emit_sync_breadcrumb(struct tu_cs *cs, uint8_t opcode, uint16_t cnt)
|
||||
|
||||
if (before_packet)
|
||||
cs->breadcrumb_emit_after = cnt;
|
||||
}
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "tu_common.h"
|
||||
#include "tu_autotune.h"
|
||||
#include "tu_cs.h"
|
||||
#include "tu_descriptor_set.h"
|
||||
#include "tu_drm.h"
|
||||
#include "tu_perfetto.h"
|
||||
@@ -48,8 +49,6 @@ typedef uint32_t xcb_window_t;
|
||||
* propagating errors. Might be useful to plug in a stack trace here.
|
||||
*/
|
||||
|
||||
struct breadcrumbs_context;
|
||||
|
||||
VkResult
|
||||
__vk_startup_errorf(struct tu_instance *instance,
|
||||
VkResult error,
|
||||
@@ -481,25 +480,6 @@ tu_device_lookup_bo(struct tu_device *device, uint32_t handle)
|
||||
VkResult
|
||||
tu_get_scratch_bo(struct tu_device *dev, uint64_t size, struct tu_bo **bo);
|
||||
|
||||
struct tu_cs_entry
|
||||
{
|
||||
/* No ownership */
|
||||
const struct tu_bo *bo;
|
||||
|
||||
uint32_t size;
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
struct tu_cs_memory {
|
||||
uint32_t *map;
|
||||
uint64_t iova;
|
||||
};
|
||||
|
||||
struct tu_draw_state {
|
||||
uint64_t iova : 48;
|
||||
uint32_t size : 16;
|
||||
};
|
||||
|
||||
enum tu_dynamic_state
|
||||
{
|
||||
/* re-use VK_DYNAMIC_STATE_ enums for non-extended dynamic states */
|
||||
@@ -543,71 +523,6 @@ enum tu_draw_state_group_id
|
||||
TU_DRAW_STATE_COUNT = TU_DRAW_STATE_DYNAMIC + TU_DYNAMIC_STATE_COUNT,
|
||||
};
|
||||
|
||||
enum tu_cs_mode
|
||||
{
|
||||
|
||||
/*
|
||||
* A command stream in TU_CS_MODE_GROW mode grows automatically whenever it
|
||||
* is full. tu_cs_begin must be called before command packet emission and
|
||||
* tu_cs_end must be called after.
|
||||
*
|
||||
* This mode may create multiple entries internally. The entries must be
|
||||
* submitted together.
|
||||
*/
|
||||
TU_CS_MODE_GROW,
|
||||
|
||||
/*
|
||||
* A command stream in TU_CS_MODE_EXTERNAL mode wraps an external,
|
||||
* fixed-size buffer. tu_cs_begin and tu_cs_end are optional and have no
|
||||
* effect on it.
|
||||
*
|
||||
* This mode does not create any entry or any BO.
|
||||
*/
|
||||
TU_CS_MODE_EXTERNAL,
|
||||
|
||||
/*
|
||||
* A command stream in TU_CS_MODE_SUB_STREAM mode does not support direct
|
||||
* command packet emission. tu_cs_begin_sub_stream must be called to get a
|
||||
* sub-stream to emit comamnd packets to. When done with the sub-stream,
|
||||
* tu_cs_end_sub_stream must be called.
|
||||
*
|
||||
* This mode does not create any entry internally.
|
||||
*/
|
||||
TU_CS_MODE_SUB_STREAM,
|
||||
};
|
||||
|
||||
#define TU_COND_EXEC_STACK_SIZE 4
|
||||
|
||||
struct tu_cs
|
||||
{
|
||||
uint32_t *start;
|
||||
uint32_t *cur;
|
||||
uint32_t *reserved_end;
|
||||
uint32_t *end;
|
||||
|
||||
struct tu_device *device;
|
||||
enum tu_cs_mode mode;
|
||||
uint32_t next_bo_size;
|
||||
|
||||
struct tu_cs_entry *entries;
|
||||
uint32_t entry_count;
|
||||
uint32_t entry_capacity;
|
||||
|
||||
struct tu_bo **bos;
|
||||
uint32_t bo_count;
|
||||
uint32_t bo_capacity;
|
||||
|
||||
/* Optional BO that this CS is sub-allocated from for TU_CS_MODE_SUB_STREAM */
|
||||
struct tu_bo *refcount_bo;
|
||||
|
||||
/* state for cond_exec_start/cond_exec_end */
|
||||
uint32_t cond_stack_depth;
|
||||
uint32_t cond_flags[TU_COND_EXEC_STACK_SIZE];
|
||||
uint32_t *cond_dwords[TU_COND_EXEC_STACK_SIZE];
|
||||
|
||||
uint32_t breadcrumb_emit_after;
|
||||
};
|
||||
|
||||
struct tu_device_memory
|
||||
{
|
||||
struct vk_object_base base;
|
||||
@@ -1466,19 +1381,6 @@ tu_attachment_gmem_offset_stencil(struct tu_cmd_buffer *cmd,
|
||||
return att->gmem_offset_stencil[cmd->state.gmem_layout];
|
||||
}
|
||||
|
||||
/* Temporary struct for tracking a register state to be written, used by
|
||||
* a6xx-pack.h and tu_cs_emit_regs()
|
||||
*/
|
||||
struct tu_reg_value {
|
||||
uint32_t reg;
|
||||
uint64_t value;
|
||||
bool is_address;
|
||||
struct tu_bo *bo;
|
||||
bool bo_write;
|
||||
uint32_t bo_offset;
|
||||
uint32_t bo_shift;
|
||||
};
|
||||
|
||||
VkResult tu_cmd_buffer_begin(struct tu_cmd_buffer *cmd_buffer,
|
||||
VkCommandBufferUsageFlags usage_flags);
|
||||
|
||||
@@ -2119,12 +2021,6 @@ tu_u_trace_submission_data_finish(
|
||||
struct tu_device *device,
|
||||
struct tu_u_trace_submission_data *submission_data);
|
||||
|
||||
void
|
||||
tu_breadcrumbs_init(struct tu_device *device);
|
||||
|
||||
void
|
||||
tu_breadcrumbs_finish(struct tu_device *device);
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(tu_cmd_buffer, vk.base, VkCommandBuffer,
|
||||
VK_OBJECT_TYPE_COMMAND_BUFFER)
|
||||
VK_DEFINE_HANDLE_CASTS(tu_device, vk.base, VkDevice, VK_OBJECT_TYPE_DEVICE)
|
||||
|
Reference in New Issue
Block a user