v3dv/bo: add a bo name
This is only used when doing a clif/cle dump, but makes it far easier to understand. Most names are the same that the ones used at v3d (CL, tile_alloc, TDSA), except those that on v3d were labelled as "resource", as right now we don't have a resource uploader that englobes different things. In fact, the good thing of not having that uploader is that individual bos has a more accurate description of their purpose. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
committed by
Marge Bot
parent
55acd9f1ea
commit
b44d4343ca
@@ -30,7 +30,7 @@
|
||||
#include "util/u_memory.h"
|
||||
|
||||
struct v3dv_bo *
|
||||
v3dv_bo_alloc(struct v3dv_device *device, uint32_t size)
|
||||
v3dv_bo_alloc(struct v3dv_device *device, uint32_t size, const char *name)
|
||||
{
|
||||
struct v3dv_bo *bo = vk_alloc(&device->alloc, sizeof(struct v3dv_bo), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
||||
@@ -56,6 +56,7 @@ v3dv_bo_alloc(struct v3dv_device *device, uint32_t size)
|
||||
bo->offset = create.offset;
|
||||
bo->map = NULL;
|
||||
bo->map_size = 0;
|
||||
bo->name = name;
|
||||
|
||||
return bo;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,11 @@ struct v3dv_bo {
|
||||
|
||||
uint32_t map_size;
|
||||
void *map;
|
||||
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct v3dv_bo *v3dv_bo_alloc(struct v3dv_device *device, uint32_t size);
|
||||
struct v3dv_bo *v3dv_bo_alloc(struct v3dv_device *device, uint32_t size, const char *name);
|
||||
|
||||
bool v3dv_bo_free(struct v3dv_device *device, struct v3dv_bo *bo);
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ v3dv_cl_ensure_space(struct v3dv_cl *cl, uint32_t space, uint32_t alignment)
|
||||
return offset;
|
||||
}
|
||||
|
||||
struct v3dv_bo *bo = v3dv_bo_alloc(cl->job->cmd_buffer->device, space);
|
||||
struct v3dv_bo *bo = v3dv_bo_alloc(cl->job->cmd_buffer->device, space, "CL");
|
||||
if (!bo) {
|
||||
fprintf(stderr, "failed to allocate memory for command list");
|
||||
abort();
|
||||
@@ -100,7 +100,7 @@ v3dv_cl_ensure_space_with_branch(struct v3dv_cl *cl, uint32_t space)
|
||||
if (v3dv_cl_offset(cl) + space + cl_packet_length(BRANCH) <= cl->size)
|
||||
return;
|
||||
|
||||
struct v3dv_bo *bo = v3dv_bo_alloc(cl->job->cmd_buffer->device, space);
|
||||
struct v3dv_bo *bo = v3dv_bo_alloc(cl->job->cmd_buffer->device, space, "CL");
|
||||
if (!bo) {
|
||||
fprintf(stderr, "failed to allocate memory for command list");
|
||||
abort();
|
||||
|
||||
@@ -277,7 +277,8 @@ v3dv_cmd_buffer_start_frame(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
*/
|
||||
tile_alloc_size += 512 * 1024;
|
||||
|
||||
job->tile_alloc = v3dv_bo_alloc(cmd_buffer->device, tile_alloc_size);
|
||||
job->tile_alloc = v3dv_bo_alloc(cmd_buffer->device, tile_alloc_size,
|
||||
"tile_alloc");
|
||||
v3dv_job_add_bo(job, job->tile_alloc);
|
||||
|
||||
const uint32_t tsda_per_tile_size = 256;
|
||||
@@ -285,7 +286,7 @@ v3dv_cmd_buffer_start_frame(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
framebuffer->draw_tiles_x *
|
||||
framebuffer->draw_tiles_y *
|
||||
tsda_per_tile_size;
|
||||
job->tile_state = v3dv_bo_alloc(cmd_buffer->device, tile_state_size);
|
||||
job->tile_state = v3dv_bo_alloc(cmd_buffer->device, tile_state_size, "TSDA");
|
||||
v3dv_job_add_bo(job, job->tile_state);
|
||||
|
||||
/* This must go before the binning mode configuration. It is
|
||||
|
||||
@@ -1230,7 +1230,7 @@ device_alloc(struct v3dv_device *device,
|
||||
{
|
||||
/* Our kernel interface is 32-bit */
|
||||
assert((size & 0xffffffff) == size);
|
||||
mem->bo = v3dv_bo_alloc(device, size);
|
||||
mem->bo = v3dv_bo_alloc(device, size, "device_alloc");
|
||||
if (!mem->bo)
|
||||
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
return VK_SUCCESS;
|
||||
|
||||
@@ -551,13 +551,27 @@ upload_assembly(struct v3dv_pipeline_stage *p_stage,
|
||||
const void *data,
|
||||
uint32_t size)
|
||||
{
|
||||
const char *name = NULL;
|
||||
/* We are uploading the assembly just once, so at this point we shouldn't
|
||||
* have any bo
|
||||
*/
|
||||
assert(p_stage->assembly_bo == NULL);
|
||||
struct v3dv_device *device = p_stage->pipeline->device;
|
||||
|
||||
struct v3dv_bo *bo = v3dv_bo_alloc(device, size);
|
||||
switch (p_stage->stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
name = (p_stage->is_coord == true) ? "coord_shader_assembly" :
|
||||
"vertex_shader_assembly";
|
||||
break;
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
name = "fragment_shader_assembly";
|
||||
break;
|
||||
default:
|
||||
unreachable("Stage not supported\n");
|
||||
break;
|
||||
};
|
||||
|
||||
struct v3dv_bo *bo = v3dv_bo_alloc(device, size, name);
|
||||
if (!bo) {
|
||||
fprintf(stderr, "failed to allocate memory for shader\n");
|
||||
abort();
|
||||
@@ -1231,7 +1245,8 @@ create_default_attribute_values(struct v3dv_pipeline *pipeline,
|
||||
uint32_t size = MAX_VERTEX_ATTRIBS * sizeof(float) * 4;
|
||||
|
||||
if (pipeline->default_attribute_values == NULL) {
|
||||
pipeline->default_attribute_values = v3dv_bo_alloc(pipeline->device, size);
|
||||
pipeline->default_attribute_values = v3dv_bo_alloc(pipeline->device, size,
|
||||
"default_vi_attributes");
|
||||
|
||||
if (!pipeline->default_attribute_values) {
|
||||
fprintf(stderr, "failed to allocate memory for the default "
|
||||
|
||||
@@ -44,7 +44,7 @@ v3dv_clif_dump(struct v3dv_device *device,
|
||||
set_foreach(job->bos, entry) {
|
||||
struct v3dv_bo *bo = (void *)entry->key;
|
||||
char *name = ralloc_asprintf(NULL, "%s_0x%x",
|
||||
"" /* bo->name */ , bo->offset);
|
||||
bo->name, bo->offset);
|
||||
|
||||
v3dv_bo_map(device, bo, bo->size);
|
||||
clif_dump_add_bo(clif, name, bo->offset, bo->size, bo->map);
|
||||
|
||||
Reference in New Issue
Block a user