Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/riastradh-drm2]: src/sys/external/bsd/drm2/dist/drm Hack up drm_agpsuppo...



details:   https://anonhg.NetBSD.org/src/rev/d61cad16f63c
branches:  riastradh-drm2
changeset: 788049:d61cad16f63c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jul 24 02:00:07 2013 +0000

description:
Hack up drm_agpsupport.c.

It's a miserable bastard hybrid of NetBSD's and Linux's AGP KPIs, but
it's good enough to make drm_agpsupport.o the first successfully
compiled file in this drm2 mess!

diffstat:

 sys/external/bsd/drm2/dist/drm/drm_agpsupport.c |  37 +++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diffs (92 lines):

diff -r efd7bcc03ea1 -r d61cad16f63c sys/external/bsd/drm2/dist/drm/drm_agpsupport.c
--- a/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c   Wed Jul 24 01:59:52 2013 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_agpsupport.c   Wed Jul 24 02:00:07 2013 +0000
@@ -61,6 +61,17 @@
                return -EINVAL;
 
        kern = &dev->agp->agp_info;
+#if __NetBSD__
+       info->agp_version_major = 1;
+       info->agp_version_minor = 0;
+       info->mode = kern->ai_mode;
+       info->aperture_base = kern->ai_aperture_base;
+       info->aperture_size = kern->ai_aperture_size;
+       info->memory_allowed = kern->ai_memory_allowed;
+       info->memory_used = kern->ai_memory_used;
+       info->id_vendor = PCI_VENDOR(kern->ai_devid);
+       info->id_device = PCI_PRODUCT(kern->ai_devid);
+#else
        info->agp_version_major = kern->version.major;
        info->agp_version_minor = kern->version.minor;
        info->mode = kern->mode;
@@ -70,6 +81,7 @@
        info->memory_used = kern->current_memory << PAGE_SHIFT;
        info->id_vendor = kern->device->vendor;
        info->id_device = kern->device->device;
+#endif
 
        return 0;
 }
@@ -218,14 +230,27 @@
                return -ENOMEM;
        }
 
+#ifdef __NetBSD__
+       /* I presume the `+ 1' is there to avoid an id of 0 or something.  */
+       entry->handle = (unsigned long)memory->am_id + 1;
+#else
        entry->handle = (unsigned long)memory->key + 1;
+#endif
        entry->memory = memory;
        entry->bound = 0;
        entry->pages = pages;
        list_add(&entry->head, &dev->agp->memory);
 
        request->handle = entry->handle;
+#ifdef __NetBSD__
+       {
+               struct agp_memory_info info;
+               agp_memory_info(dev->agp->bridge, memory, &info);
+               request->physical = info.ami_physical;
+       }
+#else
        request->physical = memory->physical;
+#endif
 
        return 0;
 }
@@ -414,17 +439,27 @@
        } else {
                agp_copy_info(head->bridge, &head->agp_info);
        }
+#ifndef __NetBSD__
+       /* Why would anything even attach in this case?  */
        if (head->agp_info.chipset == NOT_SUPPORTED) {
                kfree(head);
                return NULL;
        }
+#endif
        INIT_LIST_HEAD(&head->memory);
+#ifdef __NetBSD__
+       /* Not sure what the other fields are used for...  */
+       head->base = head->agp_info.ai_aperture_base;
+#else
        head->cant_use_aperture = head->agp_info.cant_use_aperture;
        head->page_mask = head->agp_info.page_mask;
        head->base = head->agp_info.aper_base;
+#endif
        return head;
 }
 
+#ifndef __NetBSD__
+
 /**
  * Binds a collection of pages into AGP memory at the given offset, returning
  * the AGP memory structure containing them.
@@ -468,4 +503,6 @@
 }
 EXPORT_SYMBOL(drm_agp_bind_pages);
 
+#endif /* __NetBSD__ */
+
 #endif /* __OS_HAS_AGP */



Home | Main Index | Thread Index | Old Index