2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
2002-04-27 20:47:57 +00:00
|
|
|
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
|
|
|
|
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Rickard E. (Rik) Faith <faith@valinux.com>
|
|
|
|
* Gareth Hughes <gareth@valinux.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-11-28 23:13:57 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
/** @file drm_ioctl.c
|
|
|
|
* Varios minor DRM ioctls not applicable to other files, such as versioning
|
|
|
|
* information and reporting DRM information to userland.
|
|
|
|
*/
|
|
|
|
|
2002-04-27 20:47:57 +00:00
|
|
|
#include "dev/drm/drmP.h"
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
/*
|
|
|
|
* Beginning in revision 1.1 of the DRM interface, getunique will return
|
|
|
|
* a unique in the form pci:oooo:bb:dd.f (o=domain, b=bus, d=device, f=function)
|
|
|
|
* before setunique has been called. The format for the bus-specific part of
|
|
|
|
* the unique is not defined for any other bus.
|
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_getunique(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_unique_t *u = data;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (u->unique_len >= dev->unique_len) {
|
|
|
|
if (DRM_COPY_TO_USER(u->unique, dev->unique, dev->unique_len))
|
|
|
|
return EFAULT;
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
2008-08-23 20:59:12 +00:00
|
|
|
u->unique_len = dev->unique_len;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
/* Deprecated in DRM version 1.1, and will return EBUSY when setversion has
|
|
|
|
* requested version 1.1 or greater.
|
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_setunique(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_unique_t *u = data;
|
2003-11-12 20:56:30 +00:00
|
|
|
int domain, bus, slot, func, ret;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
char *busid;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
/* Check and copy in the submitted Bus ID */
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!u->unique_len || u->unique_len > 1024)
|
|
|
|
return EINVAL;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
busid = malloc(u->unique_len + 1, M_DRM, M_WAITOK);
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
if (busid == NULL)
|
2008-08-23 20:59:12 +00:00
|
|
|
return ENOMEM;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (DRM_COPY_FROM_USER(busid, u->unique, u->unique_len)) {
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
free(busid, M_DRM);
|
2008-08-23 20:59:12 +00:00
|
|
|
return EFAULT;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
2008-08-23 20:59:12 +00:00
|
|
|
busid[u->unique_len] = '\0';
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-11-12 20:56:30 +00:00
|
|
|
/* Return error if the busid submitted doesn't match the device's actual
|
|
|
|
* busid.
|
|
|
|
*/
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
ret = sscanf(busid, "PCI:%d:%d:%d", &bus, &slot, &func);
|
|
|
|
if (ret != 3) {
|
|
|
|
free(busid, M_DRM);
|
2008-08-23 20:59:12 +00:00
|
|
|
return EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
2003-11-12 20:56:30 +00:00
|
|
|
domain = bus >> 8;
|
|
|
|
bus &= 0xff;
|
|
|
|
|
|
|
|
if ((domain != dev->pci_domain) ||
|
|
|
|
(bus != dev->pci_bus) ||
|
|
|
|
(slot != dev->pci_slot) ||
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
(func != dev->pci_func)) {
|
|
|
|
free(busid, M_DRM);
|
2008-08-23 20:59:12 +00:00
|
|
|
return EINVAL;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Actually set the device's busid now. */
|
|
|
|
DRM_LOCK();
|
|
|
|
if (dev->unique_len || dev->unique) {
|
|
|
|
DRM_UNLOCK();
|
2008-08-23 20:59:12 +00:00
|
|
|
return EBUSY;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
dev->unique_len = u->unique_len;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
dev->unique = busid;
|
|
|
|
DRM_UNLOCK();
|
2003-11-12 20:56:30 +00:00
|
|
|
|
2002-04-27 20:47:57 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
static int
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_set_busid(struct drm_device *dev)
|
2003-10-24 01:48:17 +00:00
|
|
|
{
|
|
|
|
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
DRM_LOCK();
|
|
|
|
|
|
|
|
if (dev->unique != NULL) {
|
|
|
|
DRM_UNLOCK();
|
2003-10-24 01:48:17 +00:00
|
|
|
return EBUSY;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
2003-10-24 01:48:17 +00:00
|
|
|
|
|
|
|
dev->unique_len = 20;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
dev->unique = malloc(dev->unique_len + 1, M_DRM, M_NOWAIT);
|
|
|
|
if (dev->unique == NULL) {
|
|
|
|
DRM_UNLOCK();
|
2003-10-24 01:48:17 +00:00
|
|
|
return ENOMEM;
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
}
|
2003-10-24 01:48:17 +00:00
|
|
|
|
|
|
|
snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%1x",
|
2003-11-12 20:56:30 +00:00
|
|
|
dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func);
|
2003-10-24 01:48:17 +00:00
|
|
|
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
DRM_UNLOCK();
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_getmap(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_map_t *map = data;
|
2003-03-09 02:08:30 +00:00
|
|
|
drm_local_map_t *mapinlist;
|
2002-04-27 20:47:57 +00:00
|
|
|
int idx;
|
|
|
|
int i = 0;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
idx = map->offset;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_LOCK();
|
2003-04-25 01:18:47 +00:00
|
|
|
if (idx < 0) {
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_UNLOCK();
|
2008-08-23 20:59:12 +00:00
|
|
|
return EINVAL;
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
|
|
|
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
TAILQ_FOREACH(mapinlist, &dev->maplist, link) {
|
2002-04-27 20:47:57 +00:00
|
|
|
if (i==idx) {
|
2008-08-23 20:59:12 +00:00
|
|
|
map->offset = mapinlist->offset;
|
|
|
|
map->size = mapinlist->size;
|
|
|
|
map->type = mapinlist->type;
|
|
|
|
map->flags = mapinlist->flags;
|
|
|
|
map->handle = mapinlist->handle;
|
|
|
|
map->mtrr = mapinlist->mtrr;
|
2002-04-27 20:47:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_UNLOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
if (mapinlist == NULL)
|
2002-04-27 20:47:57 +00:00
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_getclient(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_client_t *client = data;
|
2002-04-27 20:47:57 +00:00
|
|
|
drm_file_t *pt;
|
|
|
|
int idx;
|
|
|
|
int i = 0;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
idx = client->idx;
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_LOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
TAILQ_FOREACH(pt, &dev->files, link) {
|
|
|
|
if (i==idx)
|
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
client->auth = pt->authenticated;
|
|
|
|
client->pid = pt->pid;
|
|
|
|
client->uid = pt->uid;
|
|
|
|
client->magic = pt->magic;
|
|
|
|
client->iocs = pt->ioctl_count;
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_UNLOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_UNLOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
return EINVAL;
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_getstats(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_stats_t *stats = data;
|
2002-04-27 20:47:57 +00:00
|
|
|
int i;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
memset(stats, 0, sizeof(drm_stats_t));
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_LOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
|
|
|
|
for (i = 0; i < dev->counters; i++) {
|
|
|
|
if (dev->types[i] == _DRM_STAT_LOCK)
|
2008-08-23 20:59:12 +00:00
|
|
|
stats->data[i].value
|
2002-04-27 20:47:57 +00:00
|
|
|
= (dev->lock.hw_lock
|
|
|
|
? dev->lock.hw_lock->lock : 0);
|
|
|
|
else
|
2008-08-23 20:59:12 +00:00
|
|
|
stats->data[i].value = atomic_read(&dev->counts[i]);
|
|
|
|
stats->data[i].type = dev->types[i];
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
stats->count = dev->counters;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_UNLOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2003-04-25 01:18:47 +00:00
|
|
|
|
2003-11-12 20:56:30 +00:00
|
|
|
#define DRM_IF_MAJOR 1
|
|
|
|
#define DRM_IF_MINOR 2
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_setversion(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2003-10-24 01:48:17 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_set_version_t *sv = data;
|
|
|
|
drm_set_version_t ver;
|
2003-11-12 20:56:30 +00:00
|
|
|
int if_version;
|
2003-10-24 01:48:17 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
/* Save the incoming data, and set the response before continuing
|
|
|
|
* any further.
|
|
|
|
*/
|
|
|
|
ver = *sv;
|
|
|
|
sv->drm_di_major = DRM_IF_MAJOR;
|
|
|
|
sv->drm_di_minor = DRM_IF_MINOR;
|
|
|
|
sv->drm_dd_major = dev->driver.major;
|
|
|
|
sv->drm_dd_minor = dev->driver.minor;
|
|
|
|
|
|
|
|
if (ver.drm_di_major != -1) {
|
|
|
|
if (ver.drm_di_major != DRM_IF_MAJOR ||
|
|
|
|
ver.drm_di_minor < 0 || ver.drm_di_minor > DRM_IF_MINOR) {
|
2003-10-24 01:48:17 +00:00
|
|
|
return EINVAL;
|
2008-08-23 20:59:12 +00:00
|
|
|
}
|
|
|
|
if_version = DRM_IF_VERSION(ver.drm_di_major,
|
|
|
|
ver.drm_dd_minor);
|
2003-11-12 20:56:30 +00:00
|
|
|
dev->if_version = DRM_MAX(if_version, dev->if_version);
|
2008-08-23 20:59:12 +00:00
|
|
|
if (ver.drm_di_minor >= 1) {
|
2003-10-24 01:48:17 +00:00
|
|
|
/*
|
|
|
|
* Version 1.1 includes tying of DRM to specific device
|
|
|
|
*/
|
Update to DRM CVS as of 2005-04-12, bringing many changes:
- Split core DRM routines back into their own module, rather than using the
nasty templated system like before.
- Development-class R300 support in radeon driver (requires userland pieces, of
course).
- Mach64 driver (haven't tested in a while -- my mach64s no longer fit in the
testbox). Covers Rage Pros, Rage Mobility P/M, Rage XL, and some others.
- i915 driver files, which just need to get drm_drv.c fixed to allow attachment
to the drmsub device. Covers i830 through i915 integrated graphics.
- savage driver files, which should require minimal changes to work. Covers the
Savage3D, Savage IX/MX, Savage 4, ProSavage.
- Support for color and texture tiling and HyperZ features of Radeon.
Thanks to: scottl (much p4 handholding)
Jung-uk Kim (helpful prodding)
PR: [1] kern/76879, [2] kern/72548
Submitted by: [1] Alex, lesha at intercaf dot ru
[2] Shaun Jurrens, shaun at shamz dot net
2005-04-16 03:44:47 +00:00
|
|
|
drm_set_busid(dev);
|
2003-10-24 01:48:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (ver.drm_dd_major != -1) {
|
|
|
|
if (ver.drm_dd_major != dev->driver.major ||
|
|
|
|
ver.drm_dd_minor < 0 ||
|
|
|
|
ver.drm_dd_minor > dev->driver.minor)
|
|
|
|
{
|
2003-10-24 01:48:17 +00:00
|
|
|
return EINVAL;
|
2008-08-23 20:59:12 +00:00
|
|
|
}
|
2003-10-24 01:48:17 +00:00
|
|
|
}
|
2008-08-23 20:59:12 +00:00
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_noop(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-04-25 01:18:47 +00:00
|
|
|
{
|
|
|
|
DRM_DEBUG("\n");
|
|
|
|
return 0;
|
|
|
|
}
|