nouveau: use nv_devince_info and fill in PCI and type information

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30455>
(cherry picked from commit 9c15875d4d)
This commit is contained in:
Karol Herbst 2024-07-31 23:55:03 +02:00 committed by Eric Engestrom
parent aba755d758
commit 1aad77d7ea
4 changed files with 47 additions and 3 deletions

View file

@ -714,7 +714,7 @@
"description": "nouveau: use nv_devince_info and fill in PCI and type information",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -169,7 +169,14 @@ libnouveau = static_library(
],
gnu_symbol_visibility : 'hidden',
link_with : [libnouveauwinsys],
dependencies : [dep_libdrm, idep_libnouveauwinsys, idep_nouveau_codegen, idep_mesautil, idep_nir_headers],
dependencies : [
dep_libdrm,
idep_libnouveauwinsys,
idep_mesautil,
idep_nir_headers,
idep_nouveau_codegen,
idep_nvidia_headers,
],
)
driver_nouveau = declare_dependency(

View file

@ -13,7 +13,6 @@
#include "nvif/ioctl.h"
#include "nv_push.h"
#include "nv_device_info.h"
#include "util/bitscan.h"
#include "util/list.h"
@ -412,6 +411,39 @@ nouveau_device_new(struct nouveau_object *parent, struct nouveau_device **pdev)
goto done;
nvdev->base.chipset = info.chipset;
nvdev->base.info.chipset = info.chipset;
switch (info.platform) {
case NV_DEVICE_INFO_V0_PCI:
case NV_DEVICE_INFO_V0_AGP:
case NV_DEVICE_INFO_V0_PCIE:
nvdev->base.info.type = NV_DEVICE_TYPE_DIS;
break;
case NV_DEVICE_INFO_V0_IGP:
nvdev->base.info.type = NV_DEVICE_TYPE_IGP;
break;
case NV_DEVICE_INFO_V0_SOC:
nvdev->base.info.type = NV_DEVICE_TYPE_SOC;
break;
default:
unreachable("unhandled nvidia device type");
break;
}
drmDevicePtr drm_device;
ret = drmGetDevice2(drm->fd, 0, &drm_device);
if (ret)
goto done;
if (drm_device->bustype == DRM_BUS_PCI) {
nvdev->base.info.pci.domain = drm_device->businfo.pci->domain;
nvdev->base.info.pci.bus = drm_device->businfo.pci->bus;
nvdev->base.info.pci.dev = drm_device->businfo.pci->dev;
nvdev->base.info.pci.func = drm_device->businfo.pci->func;
nvdev->base.info.pci.revision_id = drm_device->deviceinfo.pci->revision_id;
nvdev->base.info.device_id = drm_device->deviceinfo.pci->device_id;
}
drmFreeDevice(&drm_device);
ret = nouveau_getparam(dev, NOUVEAU_GETPARAM_FB_SIZE, &v);
if (ret)

View file

@ -7,6 +7,7 @@
#include "util/list.h"
#include "drm-uapi/nouveau_drm.h"
#include "nv_device_info.h"
#define NOUVEAU_FIFO_CHANNEL_CLASS 0x80000001
#define NOUVEAU_NOTIFIER_CLASS 0x80000002
@ -50,6 +51,10 @@ struct nouveau_device {
uint64_t gart_size;
uint64_t vram_limit;
uint64_t gart_limit;
/* only pci info and device type are set */
struct nv_device_info info;
/* classes for common push buf dumping */
uint32_t cls_eng3d;
uint32_t cls_compute;