File 0015-add-static-and-nv_-prefix-to-copied-drm-legacy-bits.patch of Package x11-video-nvidiaG02
diff -ruN NVIDIA-Linux-x86_64-304.137/kernel/conftest.sh NVIDIA-Linux-x86_64-304.1371/kernel/conftest.sh
--- NVIDIA-Linux-x86_64-304.137/conftest.sh 2022-01-10 21:21:52.000000000 -0300
+++ NVIDIA-Linux-x86_64-304.1371/conftest.sh 2022-01-10 23:50:11.888740725 -0300
@@ -92,6 +92,7 @@
FILES="asm/system.h"
FILES="$FILES drm/drmP.h"
FILES="$FILES drm/drm_gem.h"
+ FILES="$FILES drm/drm_agpsupport.h"
FILES="$FILES generated/autoconf.h"
FILES="$FILES generated/compile.h"
FILES="$FILES generated/utsrelease.h"
diff -ruN NVIDIA-Linux-x86_64-304.137/kernel/nv-drm.c NVIDIA-Linux-x86_64-304.1371/kernel/nv-drm.c
--- NVIDIA-Linux-x86_64-304.137/nv-drm.c 2022-01-10 21:21:00.000000000 -0300
+++ NVIDIA-Linux-x86_64-304.1371/nv-drm.c 2022-01-11 00:00:06.996868670 -0300
@@ -107,6 +107,10 @@
#include <drm/drm_device.h>
#endif
+#if defined(NV_DRM_DRM_AGPSUPPORT_H_PRESENT)
+#include <drm/drm_agpsupport.h>
+#endif
+
#if defined(NV_DRM_DRM_GEM_H_PRESENT)
#include <drm/drm_gem.h>
#endif
@@ -114,7 +118,7 @@
#include <linux/version.h>
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_legacy.h
-struct drm_agp_mem {
+struct nv_drm_agp_mem {
unsigned long handle;
struct agp_memory *memory;
unsigned long bound;
@@ -122,22 +126,24 @@
struct list_head head;
};
+static inline
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_memory.c
/** Wrapper around agp_free_memory() */
-void drm_free_agp(struct agp_memory *handle, int pages)
+void nv_drm_free_agp(struct agp_memory *handle, int pages)
{
agp_free_memory(handle);
}
+static inline
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_memory.c
/** Wrapper around agp_unbind_memory() */
-int drm_unbind_agp(struct agp_memory *handle)
+int nv_drm_unbind_agp(struct agp_memory *handle)
{
return agp_unbind_memory(handle);
}
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_pci.c
-static void drm_pci_agp_init(struct drm_device *dev)
+static void nv_drm_pci_agp_init(struct drm_device *dev)
{
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
if (pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))
@@ -151,6 +157,7 @@
}
}
+static
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_agpsupport.c
/**
* drm_legacy_agp_clear - Clear AGP resource list
@@ -162,9 +169,9 @@
*
* Cleanup is only done for drivers who have DRIVER_LEGACY set.
*/
-void drm_legacy_agp_clear(struct drm_device *dev)
+void nv_drm_legacy_agp_clear(struct drm_device *dev)
{
- struct drm_agp_mem *entry, *tempe;
+ struct nv_drm_agp_mem *entry, *tempe;
if (!dev->agp)
return;
@@ -173,8 +180,8 @@
list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
if (entry->bound)
- drm_unbind_agp(entry->memory);
- drm_free_agp(entry->memory, entry->pages);
+ nv_drm_unbind_agp(entry->memory);
+ nv_drm_free_agp(entry->memory, entry->pages);
kfree(entry);
}
INIT_LIST_HEAD(&dev->agp->memory);
@@ -186,19 +193,20 @@
dev->agp->enabled = 0;
}
+static
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_pci.c
-void drm_pci_agp_destroy(struct drm_device *dev)
+void nv_drm_pci_agp_destroy(struct drm_device *dev)
{
if (dev->agp) {
arch_phys_wc_del(dev->agp->agp_mtrr);
- drm_legacy_agp_clear(dev);
+ nv_drm_legacy_agp_clear(dev);
kfree(dev->agp);
dev->agp = NULL;
}
}
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_pci.c
-static int drm_get_pci_dev(struct pci_dev *pdev,
+static int nv_drm_get_pci_dev(struct pci_dev *pdev,
const struct pci_device_id *ent,
struct drm_driver *driver)
{
@@ -223,7 +231,7 @@
if (drm_core_check_feature(dev, DRIVER_MODESET))
pci_set_drvdata(pdev, dev);
- drm_pci_agp_init(dev);
+ nv_drm_pci_agp_init(dev);
ret = drm_dev_register(dev, ent->driver_data);
if (ret)
@@ -237,13 +245,14 @@
return 0;
err_agp:
- drm_pci_agp_destroy(dev);
+ nv_drm_pci_agp_destroy(dev);
pci_disable_device(pdev);
err_free:
drm_dev_put(dev);
return ret;
}
+static
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_pci.c
/**
* drm_legacy_pci_init - shadow-attach a legacy DRM PCI driver
@@ -254,7 +263,7 @@
*
* Return: 0 on success or a negative error code on failure.
*/
-int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
+int nv_drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
{
struct pci_dev *pdev = NULL;
const struct pci_device_id *pid;
@@ -285,12 +294,13 @@
/* stealth mode requires a manual probe */
pci_dev_get(pdev);
- drm_get_pci_dev(pdev, pid, driver);
+ nv_drm_get_pci_dev(pdev, pid, driver);
}
}
return 0;
}
+static
// copied from src:linux (5.9.11-1) drivers/gpu/drm/drm_pci.c
/**
* drm_legacy_pci_exit - unregister shadow-attach legacy DRM driver
@@ -300,7 +310,7 @@
* Unregister a DRM driver shadow-attached through drm_legacy_pci_init(). This
* is deprecated and only used by dri1 drivers.
*/
-void drm_legacy_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
+void nv_drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)
{
struct drm_device *dev, *tmp;