mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
nvk: Use the copy engine for NVK_DEBUG=zero_memory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26441>
This commit is contained in:
parent
74b083ef75
commit
85fd85f950
1 changed files with 28 additions and 38 deletions
|
|
@ -17,7 +17,7 @@
|
|||
#include <sys/mman.h>
|
||||
|
||||
#include "nvtypes.h"
|
||||
#include "nvk_cl902d.h"
|
||||
#include "nvk_cl90b5.h"
|
||||
|
||||
/* Supports opaque fd only */
|
||||
const VkExternalMemoryProperties nvk_opaque_fd_mem_props = {
|
||||
|
|
@ -53,46 +53,36 @@ zero_vram(struct nvk_device *dev, struct nouveau_ws_bo *bo)
|
|||
|
||||
uint64_t addr = bo->offset;
|
||||
|
||||
/* can't go higher for whatever reason */
|
||||
uint32_t pitch = 1 << 19;
|
||||
assert((bo->size % 4096) == 0);
|
||||
assert((bo->size / 4096) < (1 << 15));
|
||||
|
||||
P_IMMD(p, NV902D, SET_OPERATION, V_SRCCOPY);
|
||||
P_MTHD(p, NV90B5, OFFSET_OUT_UPPER);
|
||||
P_NV90B5_OFFSET_OUT_UPPER(p, addr >> 32);
|
||||
P_NV90B5_OFFSET_OUT_LOWER(p, addr & 0xffffffff);
|
||||
P_NV90B5_PITCH_IN(p, 4096);
|
||||
P_NV90B5_PITCH_OUT(p, 4096);
|
||||
P_NV90B5_LINE_LENGTH_IN(p, (4096 / 16));
|
||||
P_NV90B5_LINE_COUNT(p, bo->size / 4096);
|
||||
|
||||
P_MTHD(p, NV902D, SET_DST_FORMAT);
|
||||
P_NV902D_SET_DST_FORMAT(p, V_A8B8G8R8);
|
||||
P_NV902D_SET_DST_MEMORY_LAYOUT(p, V_PITCH);
|
||||
P_IMMD(p, NV90B5, SET_REMAP_CONST_A, 0);
|
||||
P_IMMD(p, NV90B5, SET_REMAP_COMPONENTS, {
|
||||
.dst_x = DST_X_CONST_A,
|
||||
.dst_y = DST_Y_CONST_A,
|
||||
.dst_z = DST_Z_CONST_A,
|
||||
.dst_w = DST_W_CONST_A,
|
||||
.component_size = COMPONENT_SIZE_FOUR,
|
||||
.num_src_components = NUM_SRC_COMPONENTS_FOUR,
|
||||
.num_dst_components = NUM_DST_COMPONENTS_FOUR,
|
||||
});
|
||||
|
||||
P_MTHD(p, NV902D, SET_DST_PITCH);
|
||||
P_NV902D_SET_DST_PITCH(p, pitch);
|
||||
|
||||
P_MTHD(p, NV902D, SET_DST_OFFSET_UPPER);
|
||||
P_NV902D_SET_DST_OFFSET_UPPER(p, addr >> 32);
|
||||
P_NV902D_SET_DST_OFFSET_LOWER(p, addr & 0xffffffff);
|
||||
|
||||
P_MTHD(p, NV902D, SET_RENDER_SOLID_PRIM_COLOR_FORMAT);
|
||||
P_NV902D_SET_RENDER_SOLID_PRIM_COLOR_FORMAT(p, V_A8B8G8R8);
|
||||
P_NV902D_SET_RENDER_SOLID_PRIM_COLOR(p, 0);
|
||||
|
||||
uint32_t height = bo->size / pitch;
|
||||
uint32_t extra = bo->size % pitch;
|
||||
|
||||
if (height > 0) {
|
||||
P_IMMD(p, NV902D, RENDER_SOLID_PRIM_MODE, V_RECTS);
|
||||
|
||||
P_MTHD(p, NV902D, RENDER_SOLID_PRIM_POINT_SET_X(0));
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_SET_X(p, 0, 0);
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_Y(p, 0, 0);
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_SET_X(p, 1, pitch / 4);
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_Y(p, 1, height);
|
||||
}
|
||||
|
||||
P_IMMD(p, NV902D, RENDER_SOLID_PRIM_MODE, V_RECTS);
|
||||
|
||||
P_MTHD(p, NV902D, RENDER_SOLID_PRIM_POINT_SET_X(0));
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_SET_X(p, 0, 0);
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_Y(p, 0, height);
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_SET_X(p, 1, extra / 4);
|
||||
P_NV902D_RENDER_SOLID_PRIM_POINT_Y(p, 1, height);
|
||||
P_IMMD(p, NV90B5, LAUNCH_DMA, {
|
||||
.data_transfer_type = DATA_TRANSFER_TYPE_NON_PIPELINED,
|
||||
.multi_line_enable = MULTI_LINE_ENABLE_TRUE,
|
||||
.flush_enable = FLUSH_ENABLE_TRUE,
|
||||
.src_memory_layout = SRC_MEMORY_LAYOUT_PITCH,
|
||||
.dst_memory_layout = DST_MEMORY_LAYOUT_PITCH,
|
||||
.remap_enable = REMAP_ENABLE_TRUE,
|
||||
});
|
||||
|
||||
return nvk_queue_submit_simple(&dev->queue, nv_push_dw_count(&push),
|
||||
push_data, 1, &bo);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue