mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 04:30:10 +01:00
nouveau: Put PCI info in a pci substruct in nv_device_info
We separate out device_id because even non-PCI devices have one. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
parent
b232e42532
commit
9846c4e13e
4 changed files with 33 additions and 24 deletions
|
|
@ -1,22 +1,30 @@
|
|||
#ifndef NV_DEVINFO_H
|
||||
#define NV_DEVINFO_H
|
||||
|
||||
enum nv_device_type {
|
||||
#include "util/macros.h"
|
||||
|
||||
#define NVIDIA_VENDOR_ID 0x10de
|
||||
|
||||
enum PACKED nv_device_type {
|
||||
NV_DEVICE_TYPE_IGP,
|
||||
NV_DEVICE_TYPE_DIS,
|
||||
NV_DEVICE_TYPE_SOC,
|
||||
};
|
||||
|
||||
struct nv_device_info {
|
||||
uint16_t pci_domain;
|
||||
uint8_t pci_bus;
|
||||
uint8_t pci_dev;
|
||||
uint8_t pci_func;
|
||||
uint16_t pci_device_id;
|
||||
uint8_t pci_revision_id;
|
||||
|
||||
enum nv_device_type type;
|
||||
|
||||
uint16_t device_id;
|
||||
|
||||
/* Populated if type == NV_DEVICE_TYPE_DIS */
|
||||
struct {
|
||||
uint16_t domain;
|
||||
uint8_t bus;
|
||||
uint8_t dev;
|
||||
uint8_t func;
|
||||
uint8_t revision_id;
|
||||
} pci;
|
||||
|
||||
uint16_t cls_copy;
|
||||
uint16_t cls_eng2d;
|
||||
uint16_t cls_eng3d;
|
||||
|
|
|
|||
|
|
@ -252,10 +252,10 @@ nvk_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
|
|||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT: {
|
||||
VkPhysicalDevicePCIBusInfoPropertiesEXT *p = (void *)ext;
|
||||
assert(pdev->info.type == NV_DEVICE_TYPE_DIS);
|
||||
p->pciDomain = pdev->info.pci_domain;
|
||||
p->pciBus = pdev->info.pci_bus;
|
||||
p->pciDevice = pdev->info.pci_dev;
|
||||
p->pciFunction = pdev->info.pci_func;
|
||||
p->pciDomain = pdev->info.pci.domain;
|
||||
p->pciBus = pdev->info.pci.bus;
|
||||
p->pciDevice = pdev->info.pci.dev;
|
||||
p->pciFunction = pdev->info.pci.func;
|
||||
break;
|
||||
}
|
||||
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT: {
|
||||
|
|
@ -658,7 +658,7 @@ nvk_create_drm_physical_device(struct vk_instance *_instance,
|
|||
uint8_t pad[12];
|
||||
} dev_uuid = {
|
||||
.vendor_id = NVIDIA_VENDOR_ID,
|
||||
.device_id = pdev->info.pci_device_id,
|
||||
.device_id = pdev->info.device_id,
|
||||
};
|
||||
STATIC_ASSERT(sizeof(dev_uuid) == VK_UUID_SIZE);
|
||||
memcpy(pdev->device_uuid, &dev_uuid, VK_UUID_SIZE);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
#define NVIDIA_VENDOR_ID 0x10de
|
||||
|
||||
#define NVK_MAX_SETS 8
|
||||
#define NVK_MAX_PUSH_SIZE 128
|
||||
#define NVK_MAX_DYNAMIC_BUFFERS 64
|
||||
|
|
|
|||
|
|
@ -217,15 +217,6 @@ nouveau_ws_device_new(drmDevicePtr drm_device)
|
|||
if (version < 0x01000301)
|
||||
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))
|
||||
goto out_err;
|
||||
|
||||
|
|
@ -236,6 +227,18 @@ nouveau_ws_device_new(drmDevicePtr drm_device)
|
|||
goto out_err;
|
||||
device->device_id = value;
|
||||
|
||||
device->info.device_id = value;
|
||||
if (drm_device->bustype == DRM_BUS_PCI) {
|
||||
assert(device->info.type == NV_DEVICE_TYPE_DIS);
|
||||
assert(device->info.device_id == drm_device->deviceinfo.pci->device_id);
|
||||
|
||||
device->info.pci.domain = drm_device->businfo.pci->domain;
|
||||
device->info.pci.bus = drm_device->businfo.pci->bus;
|
||||
device->info.pci.dev = drm_device->businfo.pci->dev;
|
||||
device->info.pci.func = drm_device->businfo.pci->func;
|
||||
device->info.pci.revision_id = drm_device->deviceinfo.pci->revision_id;
|
||||
};
|
||||
|
||||
if (nouveau_ws_param(fd, NOUVEAU_GETPARAM_AGP_SIZE, &value))
|
||||
goto out_err;
|
||||
os_get_available_system_memory(&device->gart_size);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue