summaryrefslogtreecommitdiffstats
path: root/sys/dev/drm/drm_agpsupport.c
diff options
context:
space:
mode:
authorrnoland <rnoland@FreeBSD.org>2008-10-03 16:59:11 +0000
committerrnoland <rnoland@FreeBSD.org>2008-10-03 16:59:11 +0000
commitbbc754f502e8dc966e5d05fc4fd4d91d4c136d83 (patch)
tree2d4185c3ec896efd0d1b2735041e6ddeb6a750f1 /sys/dev/drm/drm_agpsupport.c
parentbbe0e181656adf606748968f5803bb8cbc7d83c8 (diff)
downloadFreeBSD-src-bbc754f502e8dc966e5d05fc4fd4d91d4c136d83.zip
FreeBSD-src-bbc754f502e8dc966e5d05fc4fd4d91d4c136d83.tar.gz
resync to git master
This reverts a private patch which is causing issues with many Intel chipsets. I will review that patch and see what we need to do to fix it up later, but for the time being, we will just get these chips working again. This update contains a lot of code cleanup and is post gem merge (no, we don't have gem support). It should prove much easier to read the code now. A lot of thanks goes to vehemens for that work. I have adapted the code to use cdevpriv for tracking per open file data. That alleviates the old ugly hack that we used to try and accomplish the task and helped to clean up the open / close behavior a good bit. This also replaces the hack that was put in place a year or so ago to prevent radeons from locking up with AIGLX enabled. I have had a couple of radeon testers report that it still works as expected, though I no longer have radeon hardware to test with myself. Other various fixes from the linux crew and Intel, many of which are muddled in with the gem merge. Approved by: jhb (mentor) Obtained from: mesa/drm git master MFC after: 2 weeks
Diffstat (limited to 'sys/dev/drm/drm_agpsupport.c')
-rw-r--r--sys/dev/drm/drm_agpsupport.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/sys/dev/drm/drm_agpsupport.c b/sys/dev/drm/drm_agpsupport.c
index 1614c21..37ef21b 100644
--- a/sys/dev/drm/drm_agpsupport.c
+++ b/sys/dev/drm/drm_agpsupport.c
@@ -38,20 +38,17 @@ __FBSDID("$FreeBSD$");
#include "dev/drm/drmP.h"
-#ifdef __FreeBSD__
#if __FreeBSD_version >= 800004
#include <dev/agp/agpreg.h>
#else /* __FreeBSD_version >= 800004 */
#include <pci/agpreg.h>
#endif /* __FreeBSD_version >= 800004 */
#include <dev/pci/pcireg.h>
-#endif
/* Returns 1 if AGP or 0 if not. */
static int
drm_device_find_capability(struct drm_device *dev, int cap)
{
-#ifdef __FreeBSD__
#if __FreeBSD_version >= 602102
return (pci_find_extcap(dev->device, cap, NULL) == 0);
@@ -85,21 +82,17 @@ drm_device_find_capability(struct drm_device *dev, int cap)
return 0;
#endif
-#else
- /* XXX: fill me in for non-FreeBSD */
- return 1;
-#endif
}
int drm_device_is_agp(struct drm_device *dev)
{
- if (dev->driver.device_is_agp != NULL) {
+ if (dev->driver->device_is_agp != NULL) {
int ret;
/* device_is_agp returns a tristate, 0 = not AGP, 1 = definitely
* AGP, 2 = fall back to PCI capability
*/
- ret = (*dev->driver.device_is_agp)(dev);
+ ret = (*dev->driver->device_is_agp)(dev);
if (ret != DRM_MIGHT_BE_AGP)
return ret;
}
@@ -112,7 +105,7 @@ int drm_device_is_pcie(struct drm_device *dev)
return (drm_device_find_capability(dev, PCIY_EXPRESS));
}
-int drm_agp_info(struct drm_device * dev, drm_agp_info_t *info)
+int drm_agp_info(struct drm_device * dev, struct drm_agp_info *info)
{
struct agp_info *kern;
@@ -138,13 +131,13 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
int err;
- drm_agp_info_t info;
+ struct drm_agp_info info;
err = drm_agp_info(dev, &info);
if (err != 0)
return err;
- *(drm_agp_info_t *) data = info;
+ *(struct drm_agp_info *) data = info;
return 0;
}
@@ -186,7 +179,7 @@ int drm_agp_release(struct drm_device * dev)
return 0;
}
-int drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode)
+int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode)
{
if (!dev->agp || !dev->agp->acquired)
@@ -201,14 +194,14 @@ int drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode)
int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
- drm_agp_mode_t mode;
+ struct drm_agp_mode mode;
- mode = *(drm_agp_mode_t *) data;
+ mode = *(struct drm_agp_mode *) data;
return drm_agp_enable(dev, mode);
}
-int drm_agp_alloc(struct drm_device *dev, drm_agp_buffer_t *request)
+int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
{
drm_agp_mem_t *entry;
void *handle;
@@ -254,16 +247,16 @@ int drm_agp_alloc(struct drm_device *dev, drm_agp_buffer_t *request)
int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
- drm_agp_buffer_t request;
+ struct drm_agp_buffer request;
int retcode;
- request = *(drm_agp_buffer_t *) data;
+ request = *(struct drm_agp_buffer *) data;
DRM_LOCK();
retcode = drm_agp_alloc(dev, &request);
DRM_UNLOCK();
- *(drm_agp_buffer_t *) data = request;
+ *(struct drm_agp_buffer *) data = request;
return retcode;
}
@@ -279,7 +272,7 @@ static drm_agp_mem_t * drm_agp_lookup_entry(struct drm_device *dev,
return NULL;
}
-int drm_agp_unbind(struct drm_device *dev, drm_agp_binding_t *request)
+int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
{
drm_agp_mem_t *entry;
int retcode;
@@ -304,10 +297,10 @@ int drm_agp_unbind(struct drm_device *dev, drm_agp_binding_t *request)
int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
- drm_agp_binding_t request;
+ struct drm_agp_binding request;
int retcode;
- request = *(drm_agp_binding_t *) data;
+ request = *(struct drm_agp_binding *) data;
DRM_LOCK();
retcode = drm_agp_unbind(dev, &request);
@@ -316,7 +309,7 @@ int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
return retcode;
}
-int drm_agp_bind(struct drm_device *dev, drm_agp_binding_t *request)
+int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
{
drm_agp_mem_t *entry;
int retcode;
@@ -345,10 +338,10 @@ int drm_agp_bind(struct drm_device *dev, drm_agp_binding_t *request)
int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
- drm_agp_binding_t request;
+ struct drm_agp_binding request;
int retcode;
- request = *(drm_agp_binding_t *) data;
+ request = *(struct drm_agp_binding *) data;
DRM_LOCK();
retcode = drm_agp_bind(dev, &request);
@@ -357,7 +350,7 @@ int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
return retcode;
}
-int drm_agp_free(struct drm_device *dev, drm_agp_buffer_t *request)
+int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
{
drm_agp_mem_t *entry;
@@ -390,10 +383,10 @@ int drm_agp_free(struct drm_device *dev, drm_agp_buffer_t *request)
int drm_agp_free_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
- drm_agp_buffer_t request;
+ struct drm_agp_buffer request;
int retcode;
- request = *(drm_agp_buffer_t *) data;
+ request = *(struct drm_agp_buffer *) data;
DRM_LOCK();
retcode = drm_agp_free(dev, &request);
OpenPOWER on IntegriCloud