nouveau/winsys: Add an info to nouveau_ws_device

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand
2023-01-30 20:12:05 -06:00
committed by Marge Bot
parent 0d25483101
commit 87f946730f
8 changed files with 26 additions and 33 deletions

View File

@@ -84,7 +84,7 @@ mme_tu104_sim_test::SetUp()
if (dev == NULL) if (dev == NULL)
continue; continue;
if (dev->cls_eng3d < TURING_A) { if (dev->info.cls_eng3d < TURING_A) {
nouveau_ws_device_destroy(dev); nouveau_ws_device_destroy(dev);
dev = NULL; dev = NULL;
continue; continue;

View File

@@ -378,7 +378,7 @@ nil_format_supports_texturing(struct nouveau_ws_device *dev,
if (desc->layout == UTIL_FORMAT_LAYOUT_ETC || if (desc->layout == UTIL_FORMAT_LAYOUT_ETC ||
desc->layout == UTIL_FORMAT_LAYOUT_ASTC) { desc->layout == UTIL_FORMAT_LAYOUT_ASTC) {
return dev->device_type == NOUVEAU_WS_DEVICE_TYPE_SOC && return dev->device_type == NOUVEAU_WS_DEVICE_TYPE_SOC &&
dev->cls_eng3d >= KEPLER_C; dev->info.cls_eng3d >= KEPLER_C;
} }
return true; return true;

View File

@@ -368,9 +368,9 @@ nil_choose_pte_kind(struct nouveau_ws_device *dev,
enum pipe_format format, enum pipe_format format,
uint32_t samples, bool compressed) uint32_t samples, bool compressed)
{ {
if (dev->cls_eng3d >= TURING_A) if (dev->info.cls_eng3d >= TURING_A)
return tu102_choose_pte_kind(format, compressed); return tu102_choose_pte_kind(format, compressed);
else if (dev->cls_eng3d >= FERMI_A) else if (dev->info.cls_eng3d >= FERMI_A)
return nvc0_choose_pte_kind(format, samples, compressed); return nvc0_choose_pte_kind(format, samples, compressed);
else else
unreachable("Unsupported 3D engine class"); unreachable("Unsupported 3D engine class");

View File

@@ -499,9 +499,9 @@ nil_image_fill_tic(struct nouveau_ws_device *dev,
uint64_t base_address, uint64_t base_address,
void *desc_out) void *desc_out)
{ {
if (dev->cls_eng3d >= MAXWELL_A) { if (dev->info.cls_eng3d >= MAXWELL_A) {
nvb097_nil_image_fill_tic(dev, image, view, base_address, desc_out); nvb097_nil_image_fill_tic(dev, image, view, base_address, desc_out);
} else if (dev->cls_eng3d >= FERMI_A) { } else if (dev->info.cls_eng3d >= FERMI_A) {
nv9097_nil_image_fill_tic(dev, image, view, base_address, desc_out); nv9097_nil_image_fill_tic(dev, image, view, base_address, desc_out);
} else { } else {
unreachable("Tesla and older not supported"); unreachable("Tesla and older not supported");
@@ -515,9 +515,9 @@ nil_buffer_fill_tic(struct nouveau_ws_device *dev,
uint32_t num_elements, uint32_t num_elements,
void *desc_out) void *desc_out)
{ {
if (dev->cls_eng3d >= MAXWELL_A) { if (dev->info.cls_eng3d >= MAXWELL_A) {
nvb097_nil_buffer_fill_tic(dev, base_address, format, num_elements, desc_out); nvb097_nil_buffer_fill_tic(dev, base_address, format, num_elements, desc_out);
} else if (dev->cls_eng3d >= FERMI_A) { } else if (dev->info.cls_eng3d >= FERMI_A) {
nv9097_nil_buffer_fill_tic(dev, base_address, format, num_elements, desc_out); nv9097_nil_buffer_fill_tic(dev, base_address, format, num_elements, desc_out);
} else { } else {
unreachable("Tesla and older not supported"); unreachable("Tesla and older not supported");

View File

@@ -37,7 +37,7 @@ nvk_get_image_format_features(struct nvk_physical_device *pdevice,
if (nil_format_supports_filtering(pdevice->dev, p_format)) { if (nil_format_supports_filtering(pdevice->dev, p_format)) {
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT; features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
if (pdevice->dev->cls_eng3d >= MAXWELL_B) if (pdevice->info.cls_eng3d >= MAXWELL_B)
features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT; features |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_MINMAX_BIT;
} }

View File

@@ -531,20 +531,7 @@ nvk_physical_device_try_create(struct nvk_instance *instance,
device->instance = instance; device->instance = instance;
device->dev = ndev; device->dev = ndev;
device->info = (struct nv_device_info) { device->info = ndev->info;
.pci_domain = drm_device->businfo.pci->domain,
.pci_bus = drm_device->businfo.pci->bus,
.pci_dev = drm_device->businfo.pci->dev,
.pci_func = drm_device->businfo.pci->func,
.pci_device_id = drm_device->deviceinfo.pci->device_id,
.pci_revision_id = drm_device->deviceinfo.pci->revision_id,
.cls_copy = ndev->cls_copy,
.cls_eng2d = ndev->cls_eng2d,
.cls_eng3d = ndev->cls_eng3d,
.cls_m2mf = ndev->cls_m2mf,
.cls_compute = ndev->cls_compute,
};
device->mem_heaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT; device->mem_heaps[0].flags = VK_MEMORY_HEAP_DEVICE_LOCAL_BIT;
device->mem_types[0].propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; device->mem_types[0].propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;

View File

@@ -204,6 +204,15 @@ nouveau_ws_device_new(drmDevicePtr drm_device)
if (version < 0x01000301) if (version < 0x01000301)
goto out_err; goto out_err;
device->info = (struct nv_device_info) {
.pci_domain = drm_device->businfo.pci->domain,
.pci_bus = drm_device->businfo.pci->bus,
.pci_dev = drm_device->businfo.pci->dev,
.pci_func = drm_device->businfo.pci->func,
.pci_device_id = drm_device->deviceinfo.pci->device_id,
.pci_revision_id = drm_device->deviceinfo.pci->revision_id,
};
if (nouveau_ws_device_alloc(fd, device)) if (nouveau_ws_device_alloc(fd, device))
goto out_err; goto out_err;
@@ -240,11 +249,11 @@ nouveau_ws_device_new(drmDevicePtr drm_device)
if (nouveau_ws_context_create(device, &tmp_ctx)) if (nouveau_ws_context_create(device, &tmp_ctx))
goto out_err; goto out_err;
device->cls_copy = tmp_ctx->copy.cls; device->info.cls_copy = tmp_ctx->copy.cls;
device->cls_eng2d = tmp_ctx->eng2d.cls; device->info.cls_eng2d = tmp_ctx->eng2d.cls;
device->cls_eng3d = tmp_ctx->eng3d.cls; device->info.cls_eng3d = tmp_ctx->eng3d.cls;
device->cls_m2mf = tmp_ctx->m2mf.cls; device->info.cls_m2mf = tmp_ctx->m2mf.cls;
device->cls_compute = tmp_ctx->compute.cls; device->info.cls_compute = tmp_ctx->compute.cls;
nouveau_ws_context_destroy(tmp_ctx); nouveau_ws_context_destroy(tmp_ctx);

View File

@@ -2,6 +2,7 @@
#define NOUVEAU_DEVICE 1 #define NOUVEAU_DEVICE 1
#include "nouveau_private.h" #include "nouveau_private.h"
#include "nv_device_info.h"
#include <stddef.h> #include <stddef.h>
@@ -41,11 +42,7 @@ struct nouveau_ws_device {
enum nouveau_ws_device_type device_type; enum nouveau_ws_device_type device_type;
uint32_t chipset; uint32_t chipset;
uint16_t cls_copy; struct nv_device_info info;
uint16_t cls_eng2d;
uint16_t cls_eng3d;
uint16_t cls_m2mf;
uint16_t cls_compute;
char *chipset_name; char *chipset_name;
char *device_name; char *device_name;