2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
2003-10-24 01:48:17 +00:00
|
|
|
* Copyright 2003 Eric Anholt
|
|
|
|
* 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
|
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
|
|
|
* ERIC ANHOLT 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.
|
2002-04-27 20:47:57 +00:00
|
|
|
*/
|
2003-03-09 02:08:30 +00:00
|
|
|
|
2005-11-28 23:13:57 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
/** @file drm_sysctl.c
|
|
|
|
* Implementation of various sysctls for controlling DRM behavior and reporting
|
|
|
|
* debug information.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
#include "dev/drm/drmP.h"
|
|
|
|
#include "dev/drm/drm.h"
|
2003-03-09 02:08:30 +00:00
|
|
|
|
2002-04-27 20:47:57 +00:00
|
|
|
#include <sys/sysctl.h>
|
|
|
|
|
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
|
|
|
static int drm_name_info DRM_SYSCTL_HANDLER_ARGS;
|
|
|
|
static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS;
|
|
|
|
static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS;
|
|
|
|
static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS;
|
2009-06-23 20:19:02 +00:00
|
|
|
static int drm_vblank_info DRM_SYSCTL_HANDLER_ARGS;
|
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
|
|
|
struct drm_sysctl_list {
|
2002-04-27 20:47:57 +00:00
|
|
|
const char *name;
|
|
|
|
int (*f) DRM_SYSCTL_HANDLER_ARGS;
|
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_sysctl_list[] = {
|
|
|
|
{"name", drm_name_info},
|
|
|
|
{"vm", drm_vm_info},
|
|
|
|
{"clients", drm_clients_info},
|
|
|
|
{"bufs", drm_bufs_info},
|
2009-06-23 20:19:02 +00:00
|
|
|
{"vblank", drm_vblank_info},
|
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
|
|
|
#define DRM_SYSCTL_ENTRIES (sizeof(drm_sysctl_list)/sizeof(drm_sysctl_list[0]))
|
2002-04-27 20:47:57 +00:00
|
|
|
|
|
|
|
struct drm_sysctl_info {
|
|
|
|
struct sysctl_ctx_list ctx;
|
|
|
|
char name[2];
|
|
|
|
};
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_sysctl_init(struct drm_device *dev)
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
|
|
|
struct drm_sysctl_info *info;
|
|
|
|
struct sysctl_oid *oid;
|
|
|
|
struct sysctl_oid *top, *drioid;
|
|
|
|
int i;
|
|
|
|
|
2008-10-13 18:03:27 +00:00
|
|
|
info = malloc(sizeof *info, DRM_MEM_DRIVER, M_WAITOK | M_ZERO);
|
2002-04-27 20:47:57 +00:00
|
|
|
if ( !info )
|
|
|
|
return 1;
|
|
|
|
dev->sysctl = info;
|
|
|
|
|
|
|
|
/* Add the sysctl node for DRI if it doesn't already exist */
|
2014-06-28 03:56:17 +00:00
|
|
|
drioid = SYSCTL_ADD_NODE(&info->ctx, SYSCTL_CHILDREN(&sysctl___hw), OID_AUTO, "dri", CTLFLAG_RW, NULL, "DRI Graphics");
|
2002-04-27 20:47:57 +00:00
|
|
|
if (!drioid)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Find the next free slot under hw.dri */
|
|
|
|
i = 0;
|
|
|
|
SLIST_FOREACH(oid, SYSCTL_CHILDREN(drioid), oid_link) {
|
|
|
|
if (i <= oid->oid_arg2)
|
|
|
|
i = oid->oid_arg2 + 1;
|
|
|
|
}
|
|
|
|
if (i>9)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Add the hw.dri.x for our device */
|
|
|
|
info->name[0] = '0' + i;
|
|
|
|
info->name[1] = 0;
|
|
|
|
top = SYSCTL_ADD_NODE( &info->ctx, SYSCTL_CHILDREN(drioid), OID_AUTO, info->name, CTLFLAG_RW, NULL, NULL);
|
|
|
|
if (!top)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
for (i = 0; i < DRM_SYSCTL_ENTRIES; i++) {
|
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
|
|
|
oid = SYSCTL_ADD_OID(&info->ctx,
|
2002-04-27 20:47:57 +00:00
|
|
|
SYSCTL_CHILDREN(top),
|
|
|
|
OID_AUTO,
|
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_sysctl_list[i].name,
|
2011-04-23 23:11:44 +00:00
|
|
|
CTLTYPE_STRING | CTLFLAG_RD,
|
2002-04-27 20:47:57 +00:00
|
|
|
dev,
|
|
|
|
0,
|
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_sysctl_list[i].f,
|
2002-04-27 20:47:57 +00:00
|
|
|
"A",
|
|
|
|
NULL);
|
|
|
|
if (!oid)
|
|
|
|
return 1;
|
|
|
|
}
|
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
|
|
|
SYSCTL_ADD_INT(&info->ctx, SYSCTL_CHILDREN(top), OID_AUTO, "debug",
|
|
|
|
CTLFLAG_RW, &drm_debug_flag, sizeof(drm_debug_flag),
|
|
|
|
"Enable debugging output");
|
|
|
|
|
2002-04-27 20:47:57 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
int drm_sysctl_cleanup(struct drm_device *dev)
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
|
|
|
int error;
|
|
|
|
error = sysctl_ctx_free( &dev->sysctl->ctx );
|
|
|
|
|
2008-10-13 18:03:27 +00:00
|
|
|
free(dev->sysctl, DRM_MEM_DRIVER);
|
2002-04-27 20:47:57 +00:00
|
|
|
dev->sysctl = NULL;
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
#define DRM_SYSCTL_PRINT(fmt, arg...) \
|
|
|
|
do { \
|
|
|
|
snprintf(buf, sizeof(buf), fmt, ##arg); \
|
|
|
|
retcode = SYSCTL_OUT(req, buf, strlen(buf)); \
|
|
|
|
if (retcode) \
|
|
|
|
goto done; \
|
|
|
|
} while (0)
|
|
|
|
|
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
|
|
|
static int drm_name_info DRM_SYSCTL_HANDLER_ARGS
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_device *dev = arg1;
|
2002-04-27 20:47:57 +00:00
|
|
|
char buf[128];
|
2003-10-24 01:48:17 +00:00
|
|
|
int retcode;
|
|
|
|
int hasunique = 0;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2014-12-17 07:27:19 +00:00
|
|
|
DRM_SYSCTL_PRINT("%s 0x%jx", dev->driver->name,
|
|
|
|
(uintmax_t)dev2udev(dev->devnode));
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_LOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
if (dev->unique) {
|
2003-10-24 01:48:17 +00:00
|
|
|
snprintf(buf, sizeof(buf), " %s", dev->unique);
|
|
|
|
hasunique = 1;
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_UNLOCK();
|
|
|
|
|
|
|
|
if (hasunique)
|
|
|
|
SYSCTL_OUT(req, buf, strlen(buf));
|
2002-04-27 20:47:57 +00:00
|
|
|
|
|
|
|
SYSCTL_OUT(req, "", 1);
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
done:
|
|
|
|
return retcode;
|
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
|
|
|
static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_device *dev = arg1;
|
2003-10-24 01:48:17 +00:00
|
|
|
drm_local_map_t *map, *tempmaps;
|
2003-08-19 02:57:31 +00:00
|
|
|
const char *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
|
2003-10-24 01:48:17 +00:00
|
|
|
const char *type, *yesno;
|
|
|
|
int i, mapcount;
|
|
|
|
char buf[128];
|
|
|
|
int retcode;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
/* We can't hold the lock while doing SYSCTL_OUTs, so allocate a
|
|
|
|
* temporary copy of all the map entries and then SYSCTL_OUT that.
|
|
|
|
*/
|
|
|
|
DRM_LOCK();
|
|
|
|
|
|
|
|
mapcount = 0;
|
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(map, &dev->maplist, link)
|
2003-10-24 01:48:17 +00:00
|
|
|
mapcount++;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2008-10-13 18:03:27 +00:00
|
|
|
tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, DRM_MEM_DRIVER,
|
|
|
|
M_NOWAIT);
|
2003-10-24 01:48:17 +00:00
|
|
|
if (tempmaps == NULL) {
|
|
|
|
DRM_UNLOCK();
|
|
|
|
return ENOMEM;
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
i = 0;
|
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(map, &dev->maplist, link)
|
|
|
|
tempmaps[i++] = *map;
|
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
|
|
|
|
2009-03-09 07:50:27 +00:00
|
|
|
DRM_SYSCTL_PRINT("\nslot offset size "
|
2010-04-22 18:21:25 +00:00
|
|
|
"type flags address handle mtrr\n");
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
for (i = 0; i < mapcount; i++) {
|
|
|
|
map = &tempmaps[i];
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2014-09-03 09:58:59 +00:00
|
|
|
if (map->type > 4)
|
2003-10-24 01:48:17 +00:00
|
|
|
type = "??";
|
|
|
|
else
|
|
|
|
type = types[map->type];
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2004-01-06 04:34:53 +00:00
|
|
|
if (!map->mtrr)
|
2003-10-24 01:48:17 +00:00
|
|
|
yesno = "no";
|
|
|
|
else
|
|
|
|
yesno = "yes";
|
|
|
|
|
|
|
|
DRM_SYSCTL_PRINT(
|
2010-04-22 18:21:25 +00:00
|
|
|
"%4d 0x%016lx 0x%08lx %4.4s 0x%02x 0x%016lx %6d %s\n",
|
|
|
|
i, map->offset, map->size, type, map->flags,
|
|
|
|
(unsigned long)map->virtual,
|
|
|
|
(unsigned int)((unsigned long)map->handle >>
|
|
|
|
DRM_MAP_HANDLE_SHIFT), yesno);
|
2003-10-24 01:48:17 +00:00
|
|
|
}
|
|
|
|
SYSCTL_OUT(req, "", 1);
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
done:
|
2008-10-13 18:03:27 +00:00
|
|
|
free(tempmaps, DRM_MEM_DRIVER);
|
2003-10-24 01:48:17 +00:00
|
|
|
return retcode;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_device *dev = arg1;
|
2002-04-27 20:47:57 +00:00
|
|
|
drm_device_dma_t *dma = dev->dma;
|
2003-10-24 01:48:17 +00:00
|
|
|
drm_device_dma_t tempdma;
|
|
|
|
int *templists;
|
|
|
|
int i;
|
|
|
|
char buf[128];
|
|
|
|
int retcode;
|
|
|
|
|
|
|
|
/* We can't hold the locks around DRM_SYSCTL_PRINT, so make a temporary
|
|
|
|
* copy of the whole structure and the relevant data from buflist.
|
|
|
|
*/
|
|
|
|
DRM_LOCK();
|
|
|
|
if (dma == NULL) {
|
|
|
|
DRM_UNLOCK();
|
|
|
|
return 0;
|
|
|
|
}
|
2003-10-24 21:45:21 +00:00
|
|
|
DRM_SPINLOCK(&dev->dma_lock);
|
2003-10-24 01:48:17 +00:00
|
|
|
tempdma = *dma;
|
2008-10-13 18:03:27 +00:00
|
|
|
templists = malloc(sizeof(int) * dma->buf_count, DRM_MEM_DRIVER,
|
|
|
|
M_NOWAIT);
|
2003-10-24 01:48:17 +00:00
|
|
|
for (i = 0; i < dma->buf_count; i++)
|
|
|
|
templists[i] = dma->buflist[i]->list;
|
|
|
|
dma = &tempdma;
|
|
|
|
DRM_SPINUNLOCK(&dev->dma_lock);
|
|
|
|
DRM_UNLOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2003-08-19 02:57:31 +00:00
|
|
|
DRM_SYSCTL_PRINT("\n o size count free segs pages kB\n");
|
2002-04-27 20:47:57 +00:00
|
|
|
for (i = 0; i <= DRM_MAX_ORDER; i++) {
|
|
|
|
if (dma->bufs[i].buf_count)
|
2003-03-09 02:08:30 +00:00
|
|
|
DRM_SYSCTL_PRINT("%2d %8d %5d %5d %5d %5d %5d\n",
|
2002-04-27 20:47:57 +00:00
|
|
|
i,
|
|
|
|
dma->bufs[i].buf_size,
|
|
|
|
dma->bufs[i].buf_count,
|
|
|
|
atomic_read(&dma->bufs[i]
|
|
|
|
.freelist.count),
|
|
|
|
dma->bufs[i].seg_count,
|
|
|
|
dma->bufs[i].seg_count
|
|
|
|
*(1 << dma->bufs[i].page_order),
|
|
|
|
(dma->bufs[i].seg_count
|
|
|
|
* (1 << dma->bufs[i].page_order))
|
2010-11-16 03:43:06 +00:00
|
|
|
* (int)PAGE_SIZE / 1024);
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
|
|
|
DRM_SYSCTL_PRINT("\n");
|
|
|
|
for (i = 0; i < dma->buf_count; i++) {
|
|
|
|
if (i && !(i%32)) DRM_SYSCTL_PRINT("\n");
|
2003-10-24 01:48:17 +00:00
|
|
|
DRM_SYSCTL_PRINT(" %d", templists[i]);
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
|
|
|
DRM_SYSCTL_PRINT("\n");
|
|
|
|
|
|
|
|
SYSCTL_OUT(req, "", 1);
|
2003-10-24 01:48:17 +00:00
|
|
|
done:
|
2008-10-13 18:03:27 +00:00
|
|
|
free(templists, DRM_MEM_DRIVER);
|
2003-10-24 01:48:17 +00:00
|
|
|
return retcode;
|
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
|
|
|
static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS
|
2002-04-27 20:47:57 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
struct drm_device *dev = arg1;
|
2008-10-03 16:59:11 +00:00
|
|
|
struct drm_file *priv, *tempprivs;
|
2003-10-24 01:48:17 +00:00
|
|
|
char buf[128];
|
|
|
|
int retcode;
|
|
|
|
int privcount, i;
|
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
|
|
|
|
2003-10-24 01:48:17 +00:00
|
|
|
privcount = 0;
|
|
|
|
TAILQ_FOREACH(priv, &dev->files, link)
|
|
|
|
privcount++;
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2008-10-13 18:03:27 +00:00
|
|
|
tempprivs = malloc(sizeof(struct drm_file) * privcount, DRM_MEM_DRIVER,
|
|
|
|
M_NOWAIT);
|
2003-10-24 01:48:17 +00:00
|
|
|
if (tempprivs == NULL) {
|
|
|
|
DRM_UNLOCK();
|
|
|
|
return ENOMEM;
|
|
|
|
}
|
|
|
|
i = 0;
|
|
|
|
TAILQ_FOREACH(priv, &dev->files, link)
|
|
|
|
tempprivs[i++] = *priv;
|
|
|
|
|
|
|
|
DRM_UNLOCK();
|
2002-04-27 20:47:57 +00:00
|
|
|
|
2009-08-23 14:31:20 +00:00
|
|
|
DRM_SYSCTL_PRINT(
|
|
|
|
"\na dev pid uid magic ioctls\n");
|
2003-10-24 01:48:17 +00:00
|
|
|
for (i = 0; i < privcount; i++) {
|
|
|
|
priv = &tempprivs[i];
|
2009-08-23 14:31:20 +00:00
|
|
|
DRM_SYSCTL_PRINT("%c %-12s %5d %5d %10u %10lu\n",
|
2002-04-27 20:47:57 +00:00
|
|
|
priv->authenticated ? 'y' : 'n',
|
2009-08-23 14:31:20 +00:00
|
|
|
devtoname(priv->dev->devnode),
|
2002-04-27 20:47:57 +00:00
|
|
|
priv->pid,
|
|
|
|
priv->uid,
|
|
|
|
priv->magic,
|
|
|
|
priv->ioctl_count);
|
|
|
|
}
|
|
|
|
|
|
|
|
SYSCTL_OUT(req, "", 1);
|
2003-10-24 01:48:17 +00:00
|
|
|
done:
|
2008-10-13 18:03:27 +00:00
|
|
|
free(tempprivs, DRM_MEM_DRIVER);
|
2003-10-24 01:48:17 +00:00
|
|
|
return retcode;
|
2002-04-27 20:47:57 +00:00
|
|
|
}
|
2009-06-23 20:19:02 +00:00
|
|
|
|
|
|
|
static int drm_vblank_info DRM_SYSCTL_HANDLER_ARGS
|
|
|
|
{
|
|
|
|
struct drm_device *dev = arg1;
|
|
|
|
char buf[128];
|
|
|
|
int retcode;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
DRM_SYSCTL_PRINT("\ncrtc ref count last enabled inmodeset\n");
|
|
|
|
for(i = 0 ; i < dev->num_crtcs ; i++) {
|
|
|
|
DRM_SYSCTL_PRINT(" %02d %02d %08d %08d %02d %02d\n",
|
|
|
|
i, atomic_load_acq_32(&dev->vblank[i].refcount),
|
|
|
|
atomic_load_acq_32(&dev->vblank[i].count),
|
|
|
|
atomic_load_acq_32(&dev->vblank[i].last),
|
|
|
|
atomic_load_acq_int(&dev->vblank[i].enabled),
|
|
|
|
atomic_load_acq_int(&dev->vblank[i].inmodeset));
|
|
|
|
}
|
|
|
|
|
|
|
|
SYSCTL_OUT(req, "", -1);
|
|
|
|
done:
|
|
|
|
return retcode;
|
|
|
|
}
|