<dd>disable memory shaders cache</dd>
<dt><code>nongg</code></dt>
<dd>disable NGG for GFX10+</dd>
- <dt><code>noop</code></dt>
- <dd>do not submit any IBs</dd>
<dt><code>nooutoforder</code></dt>
<dd>disable out-of-order rasterization</dd>
<dt><code>noshaderballot</code></dt>
winsys/amdgpu/radv_amdgpu_winsys.h \
winsys/amdgpu/radv_amdgpu_winsys_public.h
+RADV_WS_NULL_FILES := \
+ 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.h \
+ winsys/null/radv_null_winsys_public.h
+
VULKAN_FILES := \
radv_cmd_buffer.c \
radv_cs.h \
radv_wsi.c \
si_cmd_buffer.c \
vk_format.h \
- $(RADV_WS_AMDGPU_FILES)
+ $(RADV_WS_AMDGPU_FILES) \
+ $(RADV_WS_NULL_FILES)
VULKAN_ANDROID_FILES := \
radv_android.c
'winsys/amdgpu/radv_amdgpu_winsys.c',
'winsys/amdgpu/radv_amdgpu_winsys.h',
'winsys/amdgpu/radv_amdgpu_winsys_public.h',
+ '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_android.c',
'radv_cmd_buffer.c',
'radv_cs.h',
RADV_DEBUG_ALL_ENTRYPOINTS = 0x2000000,
RADV_DEBUG_DUMP_META_SHADERS = 0x4000000,
RADV_DEBUG_NO_MEMORY_CACHE = 0x8000000,
- RADV_DEBUG_NOOP = 0x10000000,
};
enum {
#include <amdgpu.h>
#include <amdgpu_drm.h>
#include "winsys/amdgpu/radv_amdgpu_winsys_public.h"
+#include "winsys/null/radv_null_winsys_public.h"
#include "ac_llvm_util.h"
#include "vk_format.h"
#include "sid.h"
}
}
-static void
-radv_handle_env_var_force_family(struct radv_physical_device *device)
-{
- const char *family = getenv("RADV_FORCE_FAMILY");
- unsigned i;
-
- if (!family)
- return;
-
- for (i = CHIP_TAHITI; i < CHIP_LAST; i++) {
- if (!strcmp(family, ac_get_llvm_processor_name(i))) {
- /* Override family and chip_class. */
- device->rad_info.family = i;
- device->rad_info.name = "OVERRIDDEN";
-
- if (i >= CHIP_NAVI10)
- device->rad_info.chip_class = GFX10;
- else if (i >= CHIP_VEGA10)
- device->rad_info.chip_class = GFX9;
- else if (i >= CHIP_TONGA)
- device->rad_info.chip_class = GFX8;
- else if (i >= CHIP_BONAIRE)
- device->rad_info.chip_class = GFX7;
- else
- device->rad_info.chip_class = GFX6;
-
- /* Don't submit any IBs. */
- device->instance->debug_flags |= RADV_DEBUG_NOOP;
- return;
- }
- }
-
- fprintf(stderr, "radv: Unknown family: %s\n", family);
- exit(1);
-}
-
static VkResult
radv_physical_device_init(struct radv_physical_device *device,
struct radv_instance *instance,
drmDevicePtr drm_device)
{
- const char *path = drm_device->nodes[DRM_NODE_RENDER];
VkResult result;
- drmVersionPtr version;
- int fd;
+ int fd = -1;
int master_fd = -1;
- fd = open(path, O_RDWR | O_CLOEXEC);
- if (fd < 0) {
- if (instance->debug_flags & RADV_DEBUG_STARTUP)
- radv_logi("Could not open device '%s'", path);
+ if (drm_device) {
+ const char *path = drm_device->nodes[DRM_NODE_RENDER];
+ drmVersionPtr version;
- return vk_error(instance, VK_ERROR_INCOMPATIBLE_DRIVER);
- }
+ fd = open(path, O_RDWR | O_CLOEXEC);
+ if (fd < 0) {
+ if (instance->debug_flags & RADV_DEBUG_STARTUP)
+ radv_logi("Could not open device '%s'", path);
- version = drmGetVersion(fd);
- if (!version) {
- close(fd);
+ return vk_error(instance, VK_ERROR_INCOMPATIBLE_DRIVER);
+ }
- if (instance->debug_flags & RADV_DEBUG_STARTUP)
- radv_logi("Could not get the kernel driver version for device '%s'", path);
+ version = drmGetVersion(fd);
+ if (!version) {
+ close(fd);
- return vk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER,
- "failed to get version %s: %m", path);
- }
+ if (instance->debug_flags & RADV_DEBUG_STARTUP)
+ radv_logi("Could not get the kernel driver version for device '%s'", path);
+
+ return vk_errorf(instance, VK_ERROR_INCOMPATIBLE_DRIVER,
+ "failed to get version %s: %m", path);
+ }
+
+ if (strcmp(version->name, "amdgpu")) {
+ drmFreeVersion(version);
+ close(fd);
+
+ if (instance->debug_flags & RADV_DEBUG_STARTUP)
+ radv_logi("Device '%s' is not using the amdgpu kernel driver.", path);
- if (strcmp(version->name, "amdgpu")) {
+ return VK_ERROR_INCOMPATIBLE_DRIVER;
+ }
drmFreeVersion(version);
- close(fd);
if (instance->debug_flags & RADV_DEBUG_STARTUP)
- radv_logi("Device '%s' is not using the amdgpu kernel driver.", path);
-
- return VK_ERROR_INCOMPATIBLE_DRIVER;
+ radv_logi("Found compatible device '%s'.", path);
}
- drmFreeVersion(version);
-
- if (instance->debug_flags & RADV_DEBUG_STARTUP)
- radv_logi("Found compatible device '%s'.", path);
device->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
device->instance = instance;
- device->ws = radv_amdgpu_winsys_create(fd, instance->debug_flags,
- instance->perftest_flags);
+ if (drm_device) {
+ device->ws = radv_amdgpu_winsys_create(fd, instance->debug_flags,
+ instance->perftest_flags);
+ } else {
+ device->ws = radv_null_winsys_create();
+ }
+
if (!device->ws) {
result = vk_error(instance, VK_ERROR_INCOMPATIBLE_DRIVER);
goto fail;
device->local_fd = fd;
device->ws->query_info(device->ws, &device->rad_info);
- radv_handle_env_var_force_family(device);
-
device->use_aco = instance->perftest_flags & RADV_PERFTEST_ACO;
snprintf(device->name, sizeof(device->name),
radv_physical_device_init_mem_types(device);
radv_fill_device_extension_table(device, &device->supported_extensions);
- device->bus_info = *drm_device->businfo.pci;
+ if (drm_device)
+ device->bus_info = *drm_device->businfo.pci;
if ((device->instance->debug_flags & RADV_DEBUG_INFO))
ac_print_gpu_info(&device->rad_info);
{"allentrypoints", RADV_DEBUG_ALL_ENTRYPOINTS},
{"metashaders", RADV_DEBUG_DUMP_META_SHADERS},
{"nomemorycache", RADV_DEBUG_NO_MEMORY_CACHE},
- {"noop", RADV_DEBUG_NOOP},
{NULL, 0}
};
instance->physicalDeviceCount = 0;
+ if (getenv("RADV_FORCE_FAMILY")) {
+ /* When RADV_FORCE_FAMILY is set, the driver creates a nul
+ * device that allows to test the compiler without having an
+ * AMDGPU instance.
+ */
+ result = radv_physical_device_init(instance->physicalDevices +
+ instance->physicalDeviceCount,
+ instance, NULL);
+
+ ++instance->physicalDeviceCount;
+ return VK_SUCCESS;
+ }
+
max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
if (instance->debug_flags & RADV_DEBUG_STARTUP)
struct radv_amdgpu_ctx *ctx = radv_amdgpu_ctx(_ctx);
int ret;
- if (cs->ws->noop)
- abort();
-
assert(sem_info);
if (!cs->ws->use_ib_bos) {
ret = radv_amdgpu_winsys_cs_submit_sysmem(_ctx, queue_idx, sem_info, bo_list, cs_array,
ws->use_local_bos = perftest_flags & RADV_PERFTEST_LOCAL_BOS;
ws->zero_all_vram_allocs = debug_flags & RADV_DEBUG_ZERO_VRAM;
- ws->noop = debug_flags & RADV_DEBUG_NOOP;
list_inithead(&ws->global_bo_list);
pthread_mutex_init(&ws->global_bo_list_lock, NULL);
ws->base.query_info = radv_amdgpu_winsys_query_info;
bool use_ib_bos;
bool zero_all_vram_allocs;
bool use_local_bos;
- bool noop;
unsigned num_buffers;
pthread_mutex_t global_bo_list_lock;
struct radeon_winsys *radv_amdgpu_winsys_create(int fd, uint64_t debug_flags,
uint64_t perftest_flags);
+struct radeon_winsys *radv_dummy_winsys_create(void);
+
#endif /* RADV_AMDGPU_WINSYS_PUBLIC_H */
--- /dev/null
+/*
+ * Copyright © 2020 Valve Corporation
+ *
+ * based on amdgpu winsys.
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ *
+ * 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.
+ */
+
+#include "radv_null_bo.h"
+
+static struct radeon_winsys_bo *
+radv_null_winsys_bo_create(struct radeon_winsys *_ws,
+ uint64_t size,
+ unsigned alignment,
+ enum radeon_bo_domain initial_domain,
+ unsigned flags,
+ unsigned priority)
+{
+ struct radv_null_winsys_bo *bo;
+
+ bo = CALLOC_STRUCT(radv_null_winsys_bo);
+ if (!bo)
+ return NULL;
+
+ bo->ptr = malloc(size);
+ if (!bo->ptr)
+ goto error_ptr_alloc;
+
+ return (struct radeon_winsys_bo *)bo;
+error_ptr_alloc:
+ FREE(bo);
+ return NULL;
+}
+
+static void *
+radv_null_winsys_bo_map(struct radeon_winsys_bo *_bo)
+{
+ struct radv_null_winsys_bo *bo = radv_null_winsys_bo(_bo);
+ return bo->ptr;
+}
+
+static void
+radv_null_winsys_bo_unmap(struct radeon_winsys_bo *_bo)
+{
+}
+
+static void radv_null_winsys_bo_destroy(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;
+}
--- /dev/null
+/*
+ * Copyright © 2020 Valve Corporation
+ *
+ * based on amdgpu winsys.
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ *
+ * 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_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 */
--- /dev/null
+/*
+ * Copyright © 2020 Valve Corporation
+ *
+ * based on amdgpu winsys.
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ *
+ * 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.
+ */
+
+#include "radv_null_cs.h"
+
+struct radv_null_cs {
+ struct radeon_cmdbuf base;
+ struct radv_null_winsys *ws;
+};
+
+static inline struct radv_null_cs *
+radv_null_cs(struct radeon_cmdbuf *base)
+{
+ return (struct radv_null_cs*)base;
+}
+
+static struct radeon_winsys_ctx *radv_null_ctx_create(struct radeon_winsys *_ws,
+ enum radeon_ctx_priority priority)
+{
+ struct radv_null_ctx *ctx = CALLOC_STRUCT(radv_null_ctx);
+
+ if (!ctx)
+ return NULL;
+
+ return (struct radeon_winsys_ctx *)ctx;
+
+}
+
+static void radv_null_ctx_destroy(struct radeon_winsys_ctx *rwctx)
+{
+ struct radv_null_ctx *ctx = (struct radv_null_ctx *)rwctx;
+ FREE(ctx);
+}
+
+static struct radeon_cmdbuf *
+radv_null_cs_create(struct radeon_winsys *ws,
+ enum ring_type ring_type)
+{
+ 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 bool radv_null_cs_finalize(struct radeon_cmdbuf *_cs)
+{
+ return true;
+}
+
+static void radv_null_cs_destroy(struct radeon_cmdbuf *rcs)
+{
+ struct radv_null_cs *cs = radv_null_cs(rcs);
+ 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_create = radv_null_cs_create;
+ ws->base.cs_finalize = radv_null_cs_finalize;
+ ws->base.cs_destroy = radv_null_cs_destroy;
+
+}
--- /dev/null
+/*
+ * Copyright © 2020 Valve Corporation
+ *
+ * based on amdgpu winsys.
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ *
+ * 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_NULL_CS_H
+#define RADV_NULL_CS_H
+
+#include "radv_radeon_winsys.h"
+#include "radv_null_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 */
--- /dev/null
+/*
+ * Copyright © 2020 Valve Corporation
+ *
+ * based on amdgpu winsys.
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ *
+ * 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.
+ */
+#include "radv_null_winsys_public.h"
+
+#include "radv_null_bo.h"
+#include "radv_null_cs.h"
+
+#include "ac_llvm_util.h"
+
+/* Hardcode some PCI IDs to allow external tools to recognize chips. */
+static const struct {
+ enum radeon_family family;
+ uint32_t pci_id;
+} pci_ids[] = {
+ { CHIP_TAHITI, 0x6780 },
+ { CHIP_PITCAIRN, 0x6800 },
+ { CHIP_VERDE, 0x6820 },
+ { CHIP_OLAND, 0x6060 },
+ { CHIP_HAINAN, 0x6660 },
+ { CHIP_BONAIRE, 0x6640 },
+ { CHIP_KAVERI, 0x1304 },
+ { CHIP_KABINI, 0x9830 },
+ { CHIP_HAWAII, 0x67A0 },
+ { CHIP_TONGA, 0x6920 },
+ { CHIP_ICELAND, 0x6900 },
+ { CHIP_CARRIZO, 0x9870 },
+ { CHIP_FIJI, 0x7300 },
+ { CHIP_STONEY, 0x98E4 },
+ { CHIP_POLARIS10, 0x67C0 },
+ { CHIP_POLARIS11, 0x67E0 },
+ { CHIP_POLARIS12, 0x6980 },
+ { CHIP_VEGAM, 0x694C },
+ { CHIP_VEGA12, 0x6860 },
+ { CHIP_VEGA12, 0x69A0 },
+ { CHIP_VEGA20, 0x66A0 },
+ { CHIP_RAVEN, 0x15DD },
+ { CHIP_RENOIR, 0x1636 },
+ { CHIP_ARCTURUS, 0x738C },
+ { CHIP_NAVI10, 0x7310 },
+ { CHIP_NAVI12, 0x7360 },
+ { CHIP_NAVI14, 0x7340 },
+};
+
+static uint32_t
+radv_null_winsys_get_pci_id(enum radeon_family family)
+{
+ for (unsigned i = 0; i < ARRAY_SIZE(pci_ids); i++) {
+ if (pci_ids[i].family == family)
+ return pci_ids[i].pci_id;
+ }
+ return 0;
+}
+
+static void radv_null_winsys_query_info(struct radeon_winsys *rws,
+ struct radeon_info *info)
+{
+ const char *family = getenv("RADV_FORCE_FAMILY");
+ unsigned i;
+
+ info->chip_class = CLASS_UNKNOWN;
+ info->family = CHIP_UNKNOWN;
+
+ for (i = CHIP_TAHITI; i < CHIP_LAST; i++) {
+ if (!strcmp(family, ac_get_llvm_processor_name(i))) {
+ /* Override family and chip_class. */
+ info->family = i;
+ info->name = "OVERRIDDEN";
+
+ if (i >= CHIP_NAVI10)
+ info->chip_class = GFX10;
+ else if (i >= CHIP_VEGA10)
+ info->chip_class = GFX9;
+ else if (i >= CHIP_TONGA)
+ info->chip_class = GFX8;
+ else if (i >= CHIP_BONAIRE)
+ info->chip_class = GFX7;
+ else
+ info->chip_class = GFX6;
+ }
+ }
+
+ if (info->family == CHIP_UNKNOWN) {
+ fprintf(stderr, "radv: Unknown family: %s\n", family);
+ abort();
+ }
+
+ info->pci_id = radv_null_winsys_get_pci_id(info->family);
+ info->max_se = 4;
+ info->max_wave64_per_simd = info->family >= CHIP_POLARIS10 &&
+ info->family <= CHIP_VEGAM ? 8 : 10;
+
+ if (info->chip_class >= GFX10)
+ info->num_physical_sgprs_per_simd = 128 * info->max_wave64_per_simd * 2;
+ else if (info->chip_class >= GFX8)
+ info->num_physical_sgprs_per_simd = 800;
+ else
+ info->num_physical_sgprs_per_simd = 512;
+
+ info->num_physical_wave64_vgprs_per_simd = info->chip_class >= GFX10 ? 512 : 256;
+}
+
+static void radv_null_winsys_destroy(struct radeon_winsys *rws)
+{
+ FREE(rws);
+}
+
+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;
+ radv_null_bo_init_functions(ws);
+ radv_null_cs_init_functions(ws);
+
+ return &ws->base;
+}
--- /dev/null
+/*
+ * 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.
+ *
+ * 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_NULL_WINSYS_H
+#define RADV_NULL_WINSYS_H
+
+#include "radv_radeon_winsys.h"
+#include "ac_gpu_info.h"
+#include "addrlib/inc/addrinterface.h"
+#include "util/list.h"
+#include <pthread.h>
+
+struct radv_null_winsys {
+ struct radeon_winsys base;
+};
+
+static inline struct radv_null_winsys *
+radv_null_winsys(struct radeon_winsys *base)
+{
+ return (struct radv_null_winsys*)base;
+}
+
+#endif /* RADV_NULL_WINSYS_H */
--- /dev/null
+/*
+ * Copyright © 2020 Valve Corporation
+ *
+ * based on amdgpu winsys.
+ * Copyright © 2016 Red Hat.
+ * Copyright © 2016 Bas Nieuwenhuizen
+ *
+ * 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_NULL_WINSYS_PUBLIC_H
+#define RADV_NULL_WINSYS_PUBLIC_H
+
+struct radeon_winsys *radv_null_winsys_create(void);
+
+#endif /* RADV_NULL_WINSYS_PUBLIC_H */