radv: add radv_buffer.h

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28510>
This commit is contained in:
Samuel Pitoiset 2024-04-01 15:52:30 +02:00 committed by Marge Bot
parent 4ba5ba8017
commit c925f03712
20 changed files with 81 additions and 23 deletions

View file

@ -106,6 +106,7 @@ libradv_files = files(
'radv_acceleration_structure.c',
'radv_android.c',
'radv_buffer.c',
'radv_buffer.h',
'radv_buffer_view.c',
'radv_buffer_view.h',
'radv_cmd_buffer.c',

View file

@ -26,6 +26,7 @@
#ifndef RADV_META_H
#define RADV_META_H
#include "radv_buffer.h"
#include "radv_buffer_view.h"
#include "radv_private.h"
#include "radv_shader.h"

View file

@ -21,6 +21,7 @@
* IN THE SOFTWARE.
*/
#include "radv_buffer.h"
#include "radv_private.h"
#if DETECT_OS_ANDROID

View file

@ -25,9 +25,9 @@
* IN THE SOFTWARE.
*/
#include "radv_buffer.h"
#include "radv_private.h"
#include "vk_buffer.h"
#include "vk_common_entrypoints.h"
void

View file

@ -0,0 +1,63 @@
/*
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* based in part on anv driver which is:
* Copyright © 2015 Intel 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_BUFFER_H
#define RADV_BUFFER_H
#include "radv_radeon_winsys.h"
#include "vk_buffer.h"
struct radv_device;
struct radv_buffer {
struct vk_buffer vk;
/* Set when bound */
struct radeon_winsys_bo *bo;
VkDeviceSize offset;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(radv_buffer, vk.base, VkBuffer, VK_OBJECT_TYPE_BUFFER)
void radv_buffer_init(struct radv_buffer *buffer, struct radv_device *device, struct radeon_winsys_bo *bo,
uint64_t size, uint64_t offset);
void radv_buffer_finish(struct radv_buffer *buffer);
VkResult radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer, bool is_internal);
VkResult radv_bo_create(struct radv_device *device, uint64_t size, unsigned alignment, enum radeon_bo_domain domain,
enum radeon_bo_flag flags, unsigned priority, uint64_t address, bool is_internal,
struct radeon_winsys_bo **out_bo);
VkResult radv_bo_virtual_bind(struct radv_device *device, struct radeon_winsys_bo *parent, uint64_t offset,
uint64_t size, struct radeon_winsys_bo *bo, uint64_t bo_offset);
void radv_bo_destroy(struct radv_device *device, struct radeon_winsys_bo *bo);
#endif /* RADV_BUFFER_H */

View file

@ -27,6 +27,7 @@
#include "gfx10_format_table.h"
#include "radv_buffer.h"
#include "radv_buffer_view.h"
#include "radv_formats.h"
#include "radv_private.h"

View file

@ -23,6 +23,7 @@
*/
#include "ac_shadowed_regs.h"
#include "radv_buffer.h"
#include "radv_cs.h"
#include "radv_debug.h"
#include "radv_private.h"

View file

@ -35,6 +35,7 @@
#include "util/mesa-sha1.h"
#include "util/os_time.h"
#include "ac_debug.h"
#include "radv_buffer.h"
#include "radv_debug.h"
#include "radv_shader.h"
#include "sid.h"

View file

@ -27,6 +27,7 @@
#include <string.h>
#include "util/mesa-sha1.h"
#include "radv_buffer.h"
#include "radv_buffer_view.h"
#include "radv_private.h"
#include "radv_sampler.h"

View file

@ -25,6 +25,7 @@
* IN THE SOFTWARE.
*/
#include "radv_buffer.h"
#include "radv_private.h"
void

View file

@ -25,6 +25,7 @@
* IN THE SOFTWARE.
*/
#include "radv_buffer.h"
#include "radv_event.h"
#include "radv_private.h"

View file

@ -28,6 +28,7 @@
#include "util/u_atomic.h"
#include "util/u_debug.h"
#include "ac_drm_fourcc.h"
#include "radv_buffer.h"
#include "radv_buffer_view.h"
#include "radv_debug.h"
#include "radv_formats.h"

View file

@ -55,7 +55,6 @@
#include "util/rwlock.h"
#include "util/xmlconfig.h"
#include "vk_alloc.h"
#include "vk_buffer.h"
#include "vk_command_buffer.h"
#include "vk_command_pool.h"
#include "vk_debug_report.h"
@ -1310,24 +1309,6 @@ struct radv_device_memory {
void radv_device_memory_init(struct radv_device_memory *mem, struct radv_device *device, struct radeon_winsys_bo *bo);
void radv_device_memory_finish(struct radv_device_memory *mem);
struct radv_buffer {
struct vk_buffer vk;
/* Set when bound */
struct radeon_winsys_bo *bo;
VkDeviceSize offset;
};
void radv_buffer_init(struct radv_buffer *buffer, struct radv_device *device, struct radeon_winsys_bo *bo,
uint64_t size, uint64_t offset);
void radv_buffer_finish(struct radv_buffer *buffer);
VkResult radv_bo_create(struct radv_device *device, uint64_t size, unsigned alignment, enum radeon_bo_domain domain,
enum radeon_bo_flag flags, unsigned priority, uint64_t address, bool is_internal,
struct radeon_winsys_bo **out_bo);
VkResult radv_bo_virtual_bind(struct radv_device *device, struct radeon_winsys_bo *parent, uint64_t offset,
uint64_t size, struct radeon_winsys_bo *bo, uint64_t bo_offset);
void radv_bo_destroy(struct radv_device *device, struct radeon_winsys_bo *bo);
enum radv_dynamic_state_bits {
RADV_DYNAMIC_VIEWPORT = 1ull << 0,
@ -3210,8 +3191,6 @@ void radv_rmv_fill_device_info(const struct radv_physical_device *pdev, struct v
void radv_rmv_collect_trace_events(struct radv_device *device);
void radv_memory_trace_finish(struct radv_device *device);
VkResult radv_create_buffer(struct radv_device *device, const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer, bool is_internal);
VkResult radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAllocateInfo,
const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMem, bool is_internal);
@ -3820,7 +3799,6 @@ VK_DEFINE_HANDLE_CASTS(radv_device, vk.base, VkDevice, VK_OBJECT_TYPE_DEVICE)
VK_DEFINE_HANDLE_CASTS(radv_instance, vk.base, VkInstance, VK_OBJECT_TYPE_INSTANCE)
VK_DEFINE_HANDLE_CASTS(radv_physical_device, vk.base, VkPhysicalDevice, VK_OBJECT_TYPE_PHYSICAL_DEVICE)
VK_DEFINE_HANDLE_CASTS(radv_queue, vk.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
VK_DEFINE_NONDISP_HANDLE_CASTS(radv_buffer, vk.base, VkBuffer, VK_OBJECT_TYPE_BUFFER)
VK_DEFINE_NONDISP_HANDLE_CASTS(radv_device_memory, base, VkDeviceMemory, VK_OBJECT_TYPE_DEVICE_MEMORY)
VK_DEFINE_NONDISP_HANDLE_CASTS(radv_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE)
VK_DEFINE_NONDISP_HANDLE_CASTS(radv_image_view, vk.base, VkImageView, VK_OBJECT_TYPE_IMAGE_VIEW);

View file

@ -25,6 +25,7 @@
* IN THE SOFTWARE.
*/
#include "radv_buffer.h"
#include "radv_cs.h"
#include "radv_debug.h"
#include "radv_private.h"

View file

@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "ac_gpu_info.h"
#include "radv_buffer.h"
#include "radv_event.h"
#include "radv_private.h"

View file

@ -27,6 +27,7 @@
#include "radv_sdma.h"
#include "util/macros.h"
#include "util/u_memory.h"
#include "radv_buffer.h"
#include "radv_cs.h"
#include "radv_formats.h"
#include "radv_private.h"

View file

@ -23,6 +23,7 @@
#include <inttypes.h>
#include "radv_buffer.h"
#include "radv_cs.h"
#include "radv_private.h"
#include "sid.h"

View file

@ -23,6 +23,7 @@
#include <inttypes.h>
#include "radv_buffer.h"
#include "radv_cs.h"
#include "radv_debug.h"
#include "radv_private.h"

View file

@ -37,6 +37,7 @@
#include "ac_vcn_av1_default.h"
#include "ac_vcn_dec.h"
#include "radv_buffer.h"
#include "radv_cs.h"
#include "radv_debug.h"

View file

@ -27,6 +27,7 @@
/* command buffer handling for AMD GCN */
#include "radv_buffer.h"
#include "radv_cs.h"
#include "radv_debug.h"
#include "radv_private.h"