radv: delete winsys/null/*

The null device works without winsys, and now can be found in
amd/common/ac_null_device.c.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37525>
This commit is contained in:
Daniel Schürmann
2025-09-23 09:59:48 +02:00
committed by Marge Bot
parent 7d6de8b17e
commit 4d68056e83
9 changed files with 0 additions and 501 deletions
-6
View File
@@ -89,12 +89,6 @@ libradv_files = files(
'nir/radv_nir_remap_color_attachment.c',
'nir/radv_nir_rt_common.c',
'nir/radv_nir_rt_shader.c',
'winsys/null/radv_null_bo.c',
'winsys/null/radv_null_bo.h',
'winsys/null/radv_null_cs.c',
'winsys/null/radv_null_cs.h',
'winsys/null/radv_null_winsys.c',
'winsys/null/radv_null_winsys_public.h',
'radv_acceleration_structure.c',
'radv_android.c',
'radv_android.h',
-1
View File
@@ -59,7 +59,6 @@ typedef void *drmDevicePtr;
#include "util/u_atomic.h"
#include "util/u_process.h"
#include "vulkan/vk_icd.h"
#include "winsys/null/radv_null_winsys_public.h"
#include "git_sha1.h"
#include "sid.h"
#include "vk_format.h"
-73
View File
@@ -1,73 +0,0 @@
/*
* Copyright © 2020 Valve Corporation
*
* based on amdgpu winsys.
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* SPDX-License-Identifier: MIT
*/
#include "radv_null_bo.h"
#include "util/u_memory.h"
static VkResult
radv_null_winsys_bo_create(struct radeon_winsys *_ws, uint64_t size, unsigned alignment,
enum radeon_bo_domain initial_domain, enum radeon_bo_flag flags, unsigned priority,
uint64_t address, struct radeon_winsys_bo **out_bo)
{
struct radv_null_winsys_bo *bo;
/* Courtesy for users using NULL to check if they need to destroy the BO. */
*out_bo = NULL;
bo = CALLOC_STRUCT(radv_null_winsys_bo);
if (!bo)
return VK_ERROR_OUT_OF_HOST_MEMORY;
bo->ptr = malloc(size);
if (!bo->ptr)
goto error_ptr_alloc;
*out_bo = (struct radeon_winsys_bo *)bo;
return VK_SUCCESS;
error_ptr_alloc:
FREE(bo);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
static void *
radv_null_winsys_bo_map(struct radeon_winsys *_ws, struct radeon_winsys_bo *_bo, bool use_fixed_addr, void *fixed_addr)
{
struct radv_null_winsys_bo *bo = radv_null_winsys_bo(_bo);
return bo->ptr;
}
static void
radv_null_winsys_bo_unmap(struct radeon_winsys *_ws, struct radeon_winsys_bo *_bo, bool replace)
{
}
static VkResult
radv_null_winsys_bo_make_resident(struct radeon_winsys *_ws, struct radeon_winsys_bo *_bo, bool resident)
{
return VK_SUCCESS;
}
static void
radv_null_winsys_bo_destroy(struct radeon_winsys *_ws, struct radeon_winsys_bo *_bo)
{
struct radv_null_winsys_bo *bo = radv_null_winsys_bo(_bo);
FREE(bo->ptr);
FREE(bo);
}
void
radv_null_bo_init_functions(struct radv_null_winsys *ws)
{
ws->base.buffer_create = radv_null_winsys_bo_create;
ws->base.buffer_destroy = radv_null_winsys_bo_destroy;
ws->base.buffer_map = radv_null_winsys_bo_map;
ws->base.buffer_unmap = radv_null_winsys_bo_unmap;
ws->base.buffer_make_resident = radv_null_winsys_bo_make_resident;
}
-30
View File
@@ -1,30 +0,0 @@
/*
* Copyright © 2020 Valve Corporation
*
* based on amdgpu winsys.
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* SPDX-License-Identifier: MIT
*/
#ifndef RADV_NULL_BO_H
#define RADV_NULL_BO_H
#include "radv_null_winsys.h"
struct radv_null_winsys_bo {
struct radeon_winsys_bo base;
struct radv_null_winsys *ws;
void *ptr;
};
static inline struct radv_null_winsys_bo *
radv_null_winsys_bo(struct radeon_winsys_bo *bo)
{
return (struct radv_null_winsys_bo *)bo;
}
void radv_null_bo_init_functions(struct radv_null_winsys *ws);
#endif /* RADV_NULL_BO_H */
-98
View File
@@ -1,98 +0,0 @@
/*
* Copyright © 2020 Valve Corporation
*
* based on amdgpu winsys.
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* SPDX-License-Identifier: MIT
*/
#include "radv_null_cs.h"
#include "util/u_memory.h"
struct radv_null_cs {
struct ac_cmdbuf base;
struct radv_null_winsys *ws;
};
static inline struct radv_null_cs *
radv_null_cs(struct ac_cmdbuf *base)
{
return (struct radv_null_cs *)base;
}
static VkResult
radv_null_ctx_create(struct radeon_winsys *_ws, enum radeon_ctx_priority priority, struct radeon_winsys_ctx **rctx)
{
struct radv_null_ctx *ctx = CALLOC_STRUCT(radv_null_ctx);
if (!ctx)
return VK_ERROR_OUT_OF_HOST_MEMORY;
*rctx = (struct radeon_winsys_ctx *)ctx;
return VK_SUCCESS;
}
static void
radv_null_ctx_destroy(struct radeon_winsys_ctx *rwctx)
{
struct radv_null_ctx *ctx = (struct radv_null_ctx *)rwctx;
FREE(ctx);
}
static enum radeon_bo_domain
radv_null_cs_domain(const struct radeon_winsys *_ws)
{
return RADEON_DOMAIN_GTT;
}
static struct ac_cmdbuf *
radv_null_cs_create(struct radeon_winsys *ws, enum amd_ip_type ip_type, UNUSED bool is_secondary)
{
struct radv_null_cs *cs = calloc(1, sizeof(struct radv_null_cs));
if (!cs)
return NULL;
cs->ws = radv_null_winsys(ws);
cs->base.buf = malloc(16384);
cs->base.max_dw = 4096;
if (!cs->base.buf) {
FREE(cs);
return NULL;
}
return &cs->base;
}
static void
radv_null_cs_pad(struct ac_cmdbuf *_cs, unsigned leave_dw_space)
{
}
static VkResult
radv_null_cs_finalize(struct ac_cmdbuf *_cs)
{
return VK_SUCCESS;
}
static void
radv_null_cs_destroy(struct ac_cmdbuf *_cs)
{
struct radv_null_cs *cs = radv_null_cs(_cs);
FREE(cs->base.buf);
FREE(cs);
}
void
radv_null_cs_init_functions(struct radv_null_winsys *ws)
{
ws->base.ctx_create = radv_null_ctx_create;
ws->base.ctx_destroy = radv_null_ctx_destroy;
ws->base.cs_domain = radv_null_cs_domain;
ws->base.cs_create = radv_null_cs_create;
ws->base.cs_finalize = radv_null_cs_finalize;
ws->base.cs_destroy = radv_null_cs_destroy;
ws->base.cs_pad = radv_null_cs_pad;
}
-29
View File
@@ -1,29 +0,0 @@
/*
* Copyright © 2020 Valve Corporation
*
* based on amdgpu winsys.
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* SPDX-License-Identifier: MIT
*/
#ifndef RADV_NULL_CS_H
#define RADV_NULL_CS_H
#include "radv_null_winsys.h"
#include "radv_radeon_winsys.h"
struct radv_null_ctx {
struct radv_null_winsys *ws;
};
static inline struct radv_null_ctx *
radv_null_ctx(struct radeon_winsys_ctx *base)
{
return (struct radv_null_ctx *)base;
}
void radv_null_cs_init_functions(struct radv_null_winsys *ws);
#endif /* RADV_NULL_CS_H */
@@ -1,215 +0,0 @@
/*
* Copyright © 2020 Valve Corporation
*
* based on amdgpu winsys.
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* SPDX-License-Identifier: MIT
*/
#include "radv_null_winsys_public.h"
#include "util/u_string.h"
#include "util/u_sync_provider.h"
#include "radv_null_bo.h"
#include "radv_null_cs.h"
#include "vk_sync_dummy.h"
/* Hardcode some GPU info that are needed for the driver or for some tools. */
static const struct {
uint32_t pci_id;
uint32_t num_render_backends;
bool has_dedicated_vram;
} pci_ids[] = {
/* clang-format off */
[CHIP_TAHITI] = {0x6780, 8, true},
[CHIP_PITCAIRN] = {0x6800, 8, true},
[CHIP_VERDE] = {0x6820, 4, true},
[CHIP_OLAND] = {0x6060, 2, true},
[CHIP_HAINAN] = {0x6660, 2, true},
[CHIP_BONAIRE] = {0x6640, 4, true},
[CHIP_KAVERI] = {0x1304, 2, false},
[CHIP_KABINI] = {0x9830, 2, false},
[CHIP_HAWAII] = {0x67A0, 16, true},
[CHIP_TONGA] = {0x6920, 8, true},
[CHIP_ICELAND] = {0x6900, 2, true},
[CHIP_CARRIZO] = {0x9870, 2, false},
[CHIP_FIJI] = {0x7300, 16, true},
[CHIP_STONEY] = {0x98E4, 2, false},
[CHIP_POLARIS10] = {0x67C0, 8, true},
[CHIP_POLARIS11] = {0x67E0, 4, true},
[CHIP_POLARIS12] = {0x6980, 4, true},
[CHIP_VEGAM] = {0x694C, 4, true},
[CHIP_VEGA10] = {0x6860, 16, true},
[CHIP_VEGA12] = {0x69A0, 8, true},
[CHIP_VEGA20] = {0x66A0, 16, true},
[CHIP_RAVEN] = {0x15DD, 2, false},
[CHIP_RENOIR] = {0x1636, 2, false},
[CHIP_MI100] = {0x738C, 2, true},
[CHIP_NAVI10] = {0x7310, 16, true},
[CHIP_NAVI12] = {0x7360, 8, true},
[CHIP_NAVI14] = {0x7340, 8, true},
[CHIP_NAVI21] = {0x73A0, 16, true},
[CHIP_VANGOGH] = {0x163F, 8, false},
[CHIP_NAVI22] = {0x73C0, 8, true},
[CHIP_NAVI23] = {0x73E0, 8, true},
[CHIP_NAVI31] = {0x744C, 24, true},
[CHIP_GFX1201] = {0x7550, 16, true},
/* clang-format on */
};
static void
radv_null_winsys_query_info(struct radeon_winsys *rws, struct radeon_info *gpu_info)
{
const char *family = os_get_option("RADV_FORCE_FAMILY");
unsigned i;
gpu_info->gfx_level = CLASS_UNKNOWN;
gpu_info->family = CHIP_UNKNOWN;
for (i = CHIP_TAHITI; i < CHIP_LAST; i++) {
if (!strcasecmp(family, ac_get_family_name(i))) {
/* Override family and gfx_level. */
gpu_info->family = i;
gpu_info->name = ac_get_family_name(i);
if (gpu_info->family >= CHIP_GFX1200)
gpu_info->gfx_level = GFX12;
else if (gpu_info->family >= CHIP_NAVI31)
gpu_info->gfx_level = GFX11;
else if (i >= CHIP_NAVI21)
gpu_info->gfx_level = GFX10_3;
else if (i >= CHIP_NAVI10)
gpu_info->gfx_level = GFX10;
else if (i >= CHIP_VEGA10)
gpu_info->gfx_level = GFX9;
else if (i >= CHIP_TONGA)
gpu_info->gfx_level = GFX8;
else if (i >= CHIP_BONAIRE)
gpu_info->gfx_level = GFX7;
else
gpu_info->gfx_level = GFX6;
}
}
if (gpu_info->family == CHIP_UNKNOWN) {
fprintf(stderr, "radv: Unknown family: %s\n", family);
abort();
}
gpu_info->pci_id = pci_ids[gpu_info->family].pci_id;
gpu_info->max_se = pci_ids[gpu_info->family].has_dedicated_vram ? 4 : 1;
gpu_info->num_se = gpu_info->max_se;
if (gpu_info->gfx_level >= GFX10_3)
gpu_info->max_waves_per_simd = 16;
else if (gpu_info->gfx_level >= GFX10)
gpu_info->max_waves_per_simd = 20;
else if (gpu_info->family >= CHIP_POLARIS10 && gpu_info->family <= CHIP_VEGAM)
gpu_info->max_waves_per_simd = 8;
else
gpu_info->max_waves_per_simd = 10;
if (gpu_info->gfx_level >= GFX10)
gpu_info->num_physical_sgprs_per_simd = 128 * gpu_info->max_waves_per_simd;
else if (gpu_info->gfx_level >= GFX8)
gpu_info->num_physical_sgprs_per_simd = 800;
else
gpu_info->num_physical_sgprs_per_simd = 512;
gpu_info->has_timeline_syncobj = true;
gpu_info->has_vm_always_valid = true;
gpu_info->has_3d_cube_border_color_mipmap = true;
gpu_info->has_image_opcodes = true;
gpu_info->has_attr_ring = gpu_info->gfx_level >= GFX11;
gpu_info->has_attr_ring_wait_bug = gpu_info->gfx_level == GFX11 || gpu_info->gfx_level == GFX11_5;
gpu_info->has_ngg_fully_culled_bug = gpu_info->gfx_level == GFX10;
gpu_info->has_ngg_passthru_no_msg = gpu_info->family >= CHIP_NAVI23;
if (gpu_info->family == CHIP_NAVI31 || gpu_info->family == CHIP_NAVI32 || gpu_info->gfx_level >= GFX12)
gpu_info->num_physical_wave64_vgprs_per_simd = 768;
else if (gpu_info->gfx_level >= GFX10)
gpu_info->num_physical_wave64_vgprs_per_simd = 512;
else
gpu_info->num_physical_wave64_vgprs_per_simd = 256;
gpu_info->num_simd_per_compute_unit = gpu_info->gfx_level >= GFX10 ? 2 : 4;
gpu_info->lds_size_per_workgroup = gpu_info->gfx_level >= GFX7 ? 64 * 1024 : 32 * 1024;
gpu_info->max_render_backends = pci_ids[gpu_info->family].num_render_backends;
gpu_info->has_dedicated_vram = pci_ids[gpu_info->family].has_dedicated_vram;
gpu_info->has_packed_math_16bit = gpu_info->gfx_level >= GFX9;
gpu_info->has_image_load_dcc_bug = gpu_info->family == CHIP_NAVI23 || gpu_info->family == CHIP_VANGOGH;
gpu_info->has_distributed_tess =
gpu_info->gfx_level >= GFX10 || (gpu_info->gfx_level >= GFX8 && gpu_info->max_se >= 2);
gpu_info->has_accelerated_dot_product =
gpu_info->family == CHIP_VEGA20 ||
(gpu_info->family >= CHIP_MI100 && gpu_info->family != CHIP_NAVI10 && gpu_info->family != CHIP_GFX1013);
gpu_info->has_image_bvh_intersect_ray = gpu_info->gfx_level >= GFX10_3 || gpu_info->family == CHIP_GFX1013;
gpu_info->address32_hi = gpu_info->gfx_level >= GFX9 ? 0xffff8000u : 0x0;
gpu_info->has_rbplus = gpu_info->family == CHIP_STONEY || gpu_info->gfx_level >= GFX9;
gpu_info->rbplus_allowed =
gpu_info->has_rbplus &&
(gpu_info->family == CHIP_STONEY || gpu_info->family == CHIP_VEGA12 || gpu_info->family == CHIP_RAVEN ||
gpu_info->family == CHIP_RAVEN2 || gpu_info->family == CHIP_RENOIR || gpu_info->gfx_level >= GFX10_3);
gpu_info->has_gang_submit = true;
gpu_info->mesh_fast_launch_2 = gpu_info->gfx_level >= GFX11;
gpu_info->hs_offchip_workgroup_dw_size = gpu_info->family == CHIP_HAWAII ? 4096 : 8192;
gpu_info->has_ls_vgpr_init_bug = gpu_info->family == CHIP_VEGA10 || gpu_info->family == CHIP_RAVEN;
gpu_info->has_graphics = true;
gpu_info->ip[AMD_IP_GFX].num_queues = 1;
gpu_info->gart_page_size = 4096;
}
static void
radv_null_winsys_destroy(struct radeon_winsys *rws)
{
FREE(rws);
}
static int
radv_null_winsys_get_fd(struct radeon_winsys *rws)
{
return -1;
}
static const struct vk_sync_type *const *
radv_null_winsys_get_sync_types(struct radeon_winsys *rws)
{
return radv_null_winsys(rws)->sync_types;
}
static struct util_sync_provider *
radv_null_winsys_get_sync_provider(struct radeon_winsys *rws)
{
return radv_null_winsys(rws)->sync_provider;
}
struct radeon_winsys *
radv_null_winsys_create()
{
struct radv_null_winsys *ws;
ws = calloc(1, sizeof(struct radv_null_winsys));
if (!ws)
return NULL;
ws->base.destroy = radv_null_winsys_destroy;
ws->base.query_info = radv_null_winsys_query_info;
ws->base.get_fd = radv_null_winsys_get_fd;
ws->base.get_sync_types = radv_null_winsys_get_sync_types;
ws->base.get_sync_provider = radv_null_winsys_get_sync_provider;
radv_null_bo_init_functions(ws);
radv_null_cs_init_functions(ws);
ws->sync_types[0] = &vk_sync_dummy_type;
ws->sync_types[1] = NULL;
ws->sync_provider = util_sync_provider_drm(-1);
return &ws->base;
}
@@ -1,33 +0,0 @@
/*
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
* based on amdgpu winsys.
* Copyright © 2011 Marek Olšák <maraeo@gmail.com>
* Copyright © 2015 Advanced Micro Devices, Inc.
*
* SPDX-License-Identifier: MIT
*/
#ifndef RADV_NULL_WINSYS_H
#define RADV_NULL_WINSYS_H
#include "util/list.h"
#include "ac_gpu_info.h"
#include "radv_radeon_winsys.h"
struct vk_sync_type;
struct util_sync_provider;
struct radv_null_winsys {
struct radeon_winsys base;
const struct vk_sync_type *sync_types[2];
struct util_sync_provider *sync_provider;
};
static inline struct radv_null_winsys *
radv_null_winsys(struct radeon_winsys *base)
{
return (struct radv_null_winsys *)base;
}
#endif /* RADV_NULL_WINSYS_H */
@@ -1,16 +0,0 @@
/*
* Copyright © 2020 Valve Corporation
*
* based on amdgpu winsys.
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*
* SPDX-License-Identifier: MIT
*/
#ifndef RADV_NULL_WINSYS_PUBLIC_H
#define RADV_NULL_WINSYS_PUBLIC_H
struct radeon_winsys *radv_null_winsys_create(void);
#endif /* RADV_NULL_WINSYS_PUBLIC_H */