radv: Move SDMA function and struct declarations to a new header.

Very few parts of RADV actually need the SDMA functions, so
moving them to a separate header makes the driver cleaner and
also improves compilation time when SDMA functions change.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26353>
This commit is contained in:
Timur Kristóf 2023-11-27 22:04:54 +01:00 committed by Marge Bot
parent 2ce0ea8e7c
commit 65dfdd3fff
7 changed files with 77 additions and 35 deletions

View file

@ -129,6 +129,7 @@ libradv_files = files(
'radv_rt_shader.c',
'radv_sampler.c',
'radv_sdma.c',
'radv_sdma.h',
'radv_shader.c',
'radv_shader.h',
'radv_shader_args.c',
@ -292,7 +293,7 @@ if with_tests
cpp_args : [cpp_msvc_compat_args],
gnu_symbol_visibility : 'hidden',
include_directories : [
inc_include,
inc_include,
inc_src,
inc_mapi,
inc_mesa,

View file

@ -1,5 +1,6 @@
#include "nir/nir_builder.h"
#include "radv_meta.h"
#include "radv_sdma.h"
#include "radv_cs.h"
#include "sid.h"

View file

@ -23,6 +23,7 @@
#include "radv_meta.h"
#include "radv_private.h"
#include "radv_sdma.h"
#include "vk_format.h"
static VkFormat

View file

@ -2883,19 +2883,6 @@ void radv_rra_trace_init(struct radv_device *device);
VkResult radv_rra_dump_trace(VkQueue vk_queue, char *filename);
void radv_rra_trace_finish(VkDevice vk_device, struct radv_rra_trace_data *data);
void radv_sdma_copy_buffer_image(const struct radv_device *device, struct radeon_cmdbuf *cs, struct radv_image *image,
struct radv_buffer *buffer, const VkBufferImageCopy2 *region, bool to_image);
bool radv_sdma_use_unaligned_buffer_image_copy(const struct radv_device *device, const struct radv_image *image,
const struct radv_buffer *buffer, const VkBufferImageCopy2 *region);
void radv_sdma_copy_buffer_image_unaligned(const struct radv_device *device, struct radeon_cmdbuf *cs,
struct radv_image *image, struct radv_buffer *buffer,
const VkBufferImageCopy2 *region, struct radeon_winsys_bo *temp_bo,
bool to_image);
void radv_sdma_copy_buffer(const struct radv_device *device, struct radeon_cmdbuf *cs, uint64_t src_va, uint64_t dst_va,
uint64_t size);
void radv_sdma_fill_buffer(const struct radv_device *device, struct radeon_cmdbuf *cs, const uint64_t va,
const uint64_t size, const uint32_t value);
void radv_memory_trace_init(struct radv_device *device);
void radv_rmv_log_bo_allocate(struct radv_device *device, struct radeon_winsys_bo *bo, uint32_t size, bool is_internal);
void radv_rmv_log_bo_destroy(struct radv_device *device, struct radeon_winsys_bo *bo);

View file

@ -24,32 +24,12 @@
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "radv_sdma.h"
#include "util/macros.h"
#include "util/u_memory.h"
#include "radv_cs.h"
#include "radv_private.h"
struct radv_sdma_linear_info {
uint64_t va;
unsigned pitch;
unsigned slice_pitch;
unsigned bpp;
unsigned blk_w;
unsigned blk_h;
};
struct radv_sdma_tiled_info {
VkExtent3D extent;
uint64_t va;
uint64_t meta_va;
uint32_t meta_config;
uint32_t info_dword;
uint32_t header_dword;
unsigned bpp;
unsigned blk_w;
unsigned blk_h;
};
struct radv_sdma_chunked_copy_info {
unsigned bpp;
unsigned blk_w;

View file

@ -0,0 +1,71 @@
/*
* Copyright © 2023 Valve Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef RADV_SDMA_H
#define RADV_SDMA_H
#include "radv_private.h"
#ifdef __cplusplus
extern "C" {
#endif
struct radv_sdma_linear_info {
uint64_t va;
unsigned pitch;
unsigned slice_pitch;
unsigned bpp;
unsigned blk_w;
unsigned blk_h;
};
struct radv_sdma_tiled_info {
VkExtent3D extent;
uint64_t va;
uint64_t meta_va;
uint32_t meta_config;
uint32_t info_dword;
uint32_t header_dword;
unsigned bpp;
unsigned blk_w;
unsigned blk_h;
};
void radv_sdma_copy_buffer_image(const struct radv_device *device, struct radeon_cmdbuf *cs, struct radv_image *image,
struct radv_buffer *buffer, const VkBufferImageCopy2 *region, bool to_image);
bool radv_sdma_use_unaligned_buffer_image_copy(const struct radv_device *device, const struct radv_image *image,
const struct radv_buffer *buffer, const VkBufferImageCopy2 *region);
void radv_sdma_copy_buffer_image_unaligned(const struct radv_device *device, struct radeon_cmdbuf *cs,
struct radv_image *image, struct radv_buffer *buffer,
const VkBufferImageCopy2 *region, struct radeon_winsys_bo *temp_bo,
bool to_image);
void radv_sdma_copy_buffer(const struct radv_device *device, struct radeon_cmdbuf *cs, uint64_t src_va, uint64_t dst_va,
uint64_t size);
void radv_sdma_fill_buffer(const struct radv_device *device, struct radeon_cmdbuf *cs, const uint64_t va,
const uint64_t size, const uint32_t value);
#ifdef __cplusplus
}
#endif
#endif /* RADV_SDMA_H */

View file

@ -39,6 +39,7 @@
#include "radv_cs.h"
#include "radv_debug.h"
#include "radv_private.h"
#include "radv_sdma.h"
#include "radv_shader_args.h"
#include "util/u_debug.h"