2003-09-09 00:24:31 +00:00
|
|
|
/* sis_mm.c -- Private header for Direct Rendering Manager -*- linux-c -*-
|
2005-11-28 23:13:57 +00:00
|
|
|
* Created: Mon Jan 4 10:05:05 1999 by sclin@sis.com.tw
|
|
|
|
*
|
2003-09-09 00:24:31 +00:00
|
|
|
* Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
|
|
|
|
* 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:
|
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-09-09 00:24:31 +00:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
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-09-09 00:24:31 +00:00
|
|
|
* 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
|
|
|
|
* PRECISION INSIGHT 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.
|
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-09-09 00:24:31 +00:00
|
|
|
* Authors:
|
|
|
|
* Sung-Ching Lin <sclin@sis.com.tw>
|
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-09-09 00:24:31 +00:00
|
|
|
*/
|
|
|
|
|
2005-11-28 23:13:57 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2003-09-09 00:24:31 +00:00
|
|
|
#if defined(__linux__) && defined(CONFIG_FB_SIS)
|
2004-06-11 03:26:59 +00:00
|
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
|
|
|
|
#include <video/sisfb.h>
|
|
|
|
#else
|
2003-09-09 00:24:31 +00:00
|
|
|
#include <linux/sisfb.h>
|
|
|
|
#endif
|
2004-06-11 03:26:59 +00:00
|
|
|
#endif
|
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/sis_drm.h"
|
|
|
|
#include "dev/drm/sis_drv.h"
|
|
|
|
#include "dev/drm/sis_ds.h"
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
#define MAX_CONTEXT 100
|
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 VIDEO_TYPE 0
|
2003-09-09 00:24:31 +00:00
|
|
|
#define AGP_TYPE 1
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int used;
|
|
|
|
int context;
|
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
|
|
|
set_t *sets[2]; /* 0 for video, 1 for AGP */
|
2003-09-09 00:24:31 +00:00
|
|
|
} sis_context_t;
|
|
|
|
|
|
|
|
static sis_context_t global_ppriv[MAX_CONTEXT];
|
|
|
|
|
|
|
|
static int add_alloc_set(int context, int type, unsigned int val)
|
|
|
|
{
|
|
|
|
int i, retval = 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
|
|
|
|
2003-09-09 00:24:31 +00:00
|
|
|
for (i = 0; i < MAX_CONTEXT; 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
|
|
|
if (global_ppriv[i].used && global_ppriv[i].context == context) {
|
2003-09-09 00:24:31 +00:00
|
|
|
retval = setAdd(global_ppriv[i].sets[type], val);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int del_alloc_set(int context, int type, unsigned int val)
|
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-09-09 00:24:31 +00:00
|
|
|
int i, retval = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_CONTEXT; 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
|
|
|
if (global_ppriv[i].used && global_ppriv[i].context == context) {
|
2003-09-09 00:24:31 +00:00
|
|
|
retval = setDel(global_ppriv[i].sets[type], val);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/* fb management via fb device */
|
2003-09-09 00:24:31 +00:00
|
|
|
#if defined(__linux__) && defined(CONFIG_FB_SIS)
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_fb_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_sis_mem_t *fb = data;
|
2003-09-09 00:24:31 +00:00
|
|
|
struct sis_memreq req;
|
|
|
|
int retval = 0;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
req.size = fb->size;
|
2003-09-09 00:24:31 +00:00
|
|
|
sis_malloc(&req);
|
|
|
|
if (req.offset) {
|
|
|
|
/* TODO */
|
2008-08-23 20:59:12 +00:00
|
|
|
fb->offset = req.offset;
|
|
|
|
fb->free = req.offset;
|
|
|
|
if (!add_alloc_set(fb->context, VIDEO_TYPE, fb->free)) {
|
2003-09-09 00:24:31 +00:00
|
|
|
DRM_DEBUG("adding to allocation set fails\n");
|
|
|
|
sis_free(req.offset);
|
2008-08-23 20:59:12 +00:00
|
|
|
retval = -EINVAL;
|
2003-09-09 00:24:31 +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
|
|
|
} else {
|
2008-08-23 20:59:12 +00:00
|
|
|
fb->offset = 0;
|
|
|
|
fb->size = 0;
|
|
|
|
fb->free = 0;
|
2003-09-09 00:24:31 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("alloc fb, size = %d, offset = %ld\n", fb->size, req.offset);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_fb_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
drm_sis_mem_t fb;
|
|
|
|
int retval = 0;
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!fb->free)
|
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!del_alloc_set(fb->context, VIDEO_TYPE, fb->free))
|
|
|
|
retval = -EINVAL;
|
|
|
|
sis_free(fb->free);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("free fb, offset = 0x%lx\n", fb->free);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* Called by the X Server to initialize the FB heap. Allocations will fail
|
|
|
|
* unless this is called. Offset is the beginning of the heap from the
|
|
|
|
* framebuffer offset (MaxXFBMem in XFree86).
|
|
|
|
*
|
|
|
|
* Memory layout according to Thomas Winischofer:
|
|
|
|
* |------------------|DDDDDDDDDDDDDDDDDDDDDDDDDDDDD|HHHH|CCCCCCCCCCC|
|
|
|
|
*
|
|
|
|
* X driver/sisfb HW- Command-
|
|
|
|
* framebuffer memory DRI heap Cursor queue
|
|
|
|
*/
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
drm_sis_private_t *dev_priv = dev->dev_private;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_sis_fb_t *fb = data;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
if (dev_priv == NULL) {
|
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->dev_private = drm_calloc(1, sizeof(drm_sis_private_t),
|
|
|
|
DRM_MEM_DRIVER);
|
2003-09-09 00:24:31 +00:00
|
|
|
dev_priv = dev->dev_private;
|
|
|
|
if (dev_priv == NULL)
|
|
|
|
return ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dev_priv->FBHeap != NULL)
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
dev_priv->FBHeap = mmInit(fb->offset, fb->size);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("offset = %u, size = %u", fb->offset, fb->size);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_fb_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
drm_sis_private_t *dev_priv = dev->dev_private;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_sis_mem_t *fb = data;
|
2003-09-09 00:24:31 +00:00
|
|
|
PMemBlock block;
|
|
|
|
int retval = 0;
|
|
|
|
|
|
|
|
if (dev_priv == NULL || dev_priv->FBHeap == NULL)
|
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
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
block = mmAllocMem(dev_priv->FBHeap, fb->size, 0, 0);
|
2003-09-09 00:24:31 +00:00
|
|
|
if (block) {
|
|
|
|
/* TODO */
|
2008-08-23 20:59:12 +00:00
|
|
|
fb->offset = block->ofs;
|
|
|
|
fb->free = (unsigned long)block;
|
|
|
|
if (!add_alloc_set(fb->context, VIDEO_TYPE, fb->free)) {
|
2003-09-09 00:24:31 +00:00
|
|
|
DRM_DEBUG("adding to allocation set fails\n");
|
2008-08-23 20:59:12 +00:00
|
|
|
mmFreeMem((PMemBlock) fb->free);
|
|
|
|
retval = -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-08-23 20:59:12 +00:00
|
|
|
fb->offset = 0;
|
|
|
|
fb->size = 0;
|
|
|
|
fb->free = 0;
|
2003-09-09 00:24:31 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb->size, fb->offset);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_fb_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
drm_sis_private_t *dev_priv = dev->dev_private;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_sis_mem_t *fb = data;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
if (dev_priv == NULL || dev_priv->FBHeap == NULL)
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!mmBlockInHeap(dev_priv->FBHeap, (PMemBlock) fb->free))
|
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!del_alloc_set(fb->context, VIDEO_TYPE, fb->free))
|
|
|
|
return -EINVAL;
|
|
|
|
mmFreeMem((PMemBlock) fb->free);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("free fb, free = 0x%lx\n", fb->free);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
/* agp memory management */
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_ioctl_agp_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
drm_sis_private_t *dev_priv = dev->dev_private;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_sis_agp_t *agp = data;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
if (dev_priv == NULL) {
|
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->dev_private = drm_calloc(1, sizeof(drm_sis_private_t),
|
|
|
|
DRM_MEM_DRIVER);
|
2003-09-09 00:24:31 +00:00
|
|
|
dev_priv = dev->dev_private;
|
|
|
|
if (dev_priv == NULL)
|
|
|
|
return ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dev_priv->AGPHeap != NULL)
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
dev_priv->AGPHeap = mmInit(agp->offset, agp->size);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("offset = %u, size = %u", agp->offset, agp->size);
|
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-09-09 00:24:31 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_ioctl_agp_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
drm_sis_private_t *dev_priv = dev->dev_private;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_sis_mem_t *agp = data;
|
2003-09-09 00:24:31 +00:00
|
|
|
PMemBlock block;
|
|
|
|
int retval = 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
|
|
|
|
2003-09-09 00:24:31 +00:00
|
|
|
if (dev_priv == NULL || dev_priv->AGPHeap == NULL)
|
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
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
block = mmAllocMem(dev_priv->AGPHeap, agp->size, 0, 0);
|
2003-09-09 00:24:31 +00:00
|
|
|
if (block) {
|
|
|
|
/* TODO */
|
2008-08-23 20:59:12 +00:00
|
|
|
agp->offset = block->ofs;
|
|
|
|
agp->free = (unsigned long)block;
|
|
|
|
if (!add_alloc_set(agp->context, AGP_TYPE, agp->free)) {
|
2003-09-09 00:24:31 +00:00
|
|
|
DRM_DEBUG("adding to allocation set fails\n");
|
2008-08-23 20:59:12 +00:00
|
|
|
mmFreeMem((PMemBlock) agp->free);
|
2003-09-09 00:24:31 +00:00
|
|
|
retval = -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
|
|
|
} else {
|
2008-08-23 20:59:12 +00:00
|
|
|
agp->offset = 0;
|
|
|
|
agp->size = 0;
|
|
|
|
agp->free = 0;
|
2003-09-09 00:24:31 +00:00
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp->size,
|
|
|
|
agp->offset);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
static int sis_ioctl_agp_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
drm_sis_private_t *dev_priv = dev->dev_private;
|
2008-08-23 20:59:12 +00:00
|
|
|
drm_sis_mem_t *agp = data;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
if (dev_priv == NULL || dev_priv->AGPHeap == NULL)
|
2008-08-23 20:59:12 +00:00
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
if (!mmBlockInHeap(dev_priv->AGPHeap, (PMemBlock) agp->free))
|
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
mmFreeMem((PMemBlock) agp->free);
|
|
|
|
if (!del_alloc_set(agp->context, AGP_TYPE, agp->free))
|
|
|
|
return -EINVAL;
|
2003-09-09 00:24:31 +00:00
|
|
|
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_DEBUG("free agp, free = 0x%lx\n", agp->free);
|
2003-09-09 00:24:31 +00:00
|
|
|
|
|
|
|
return 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
|
|
|
int sis_init_context(struct drm_device *dev, int context)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
int 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
|
|
|
for (i = 0; i < MAX_CONTEXT; i++) {
|
2003-09-09 00:24:31 +00:00
|
|
|
if (global_ppriv[i].used &&
|
|
|
|
(global_ppriv[i].context == context))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i >= MAX_CONTEXT) {
|
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
|
|
|
for (i = 0; i < MAX_CONTEXT; i++) {
|
2003-09-09 00:24:31 +00:00
|
|
|
if (!global_ppriv[i].used) {
|
|
|
|
global_ppriv[i].context = context;
|
|
|
|
global_ppriv[i].used = 1;
|
|
|
|
global_ppriv[i].sets[0] = setInit();
|
|
|
|
global_ppriv[i].sets[1] = setInit();
|
|
|
|
DRM_DEBUG("init allocation set, socket=%d, "
|
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
|
|
|
"context = %d\n", i, context);
|
2003-09-09 00:24:31 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((i >= MAX_CONTEXT) || (global_ppriv[i].sets[0] == NULL) ||
|
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
|
|
|
(global_ppriv[i].sets[1] == NULL)) {
|
2003-09-09 00:24:31 +00:00
|
|
|
return 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
|
|
|
|
2003-09-09 00:24:31 +00:00
|
|
|
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
|
|
|
int sis_final_context(struct drm_device *dev, int context)
|
2003-09-09 00:24:31 +00:00
|
|
|
{
|
|
|
|
int 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
|
|
|
for (i = 0; i < MAX_CONTEXT; i++) {
|
2003-09-09 00:24:31 +00:00
|
|
|
if (global_ppriv[i].used &&
|
|
|
|
(global_ppriv[i].context == context))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i < MAX_CONTEXT) {
|
|
|
|
set_t *set;
|
2004-03-03 06:20:36 +00:00
|
|
|
ITEM_TYPE item;
|
2003-09-09 00:24:31 +00:00
|
|
|
int retval;
|
|
|
|
|
|
|
|
DRM_DEBUG("find socket %d, context = %d\n", i, context);
|
|
|
|
|
|
|
|
/* Video Memory */
|
|
|
|
set = global_ppriv[i].sets[0];
|
|
|
|
retval = setFirst(set, &item);
|
|
|
|
while (retval) {
|
2004-03-03 06:20:36 +00:00
|
|
|
DRM_DEBUG("free video memory 0x%lx\n", item);
|
2003-09-09 00:24:31 +00:00
|
|
|
#if defined(__linux__) && defined(CONFIG_FB_SIS)
|
|
|
|
sis_free(item);
|
|
|
|
#else
|
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
|
|
|
mmFreeMem((PMemBlock) item);
|
2003-09-09 00:24:31 +00:00
|
|
|
#endif
|
|
|
|
retval = setNext(set, &item);
|
|
|
|
}
|
|
|
|
setDestroy(set);
|
|
|
|
|
|
|
|
/* AGP Memory */
|
|
|
|
set = global_ppriv[i].sets[1];
|
|
|
|
retval = setFirst(set, &item);
|
|
|
|
while (retval) {
|
2004-03-03 06:20:36 +00:00
|
|
|
DRM_DEBUG("free agp memory 0x%lx\n", item);
|
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
|
|
|
mmFreeMem((PMemBlock) item);
|
2003-09-09 00:24:31 +00:00
|
|
|
retval = setNext(set, &item);
|
|
|
|
}
|
|
|
|
setDestroy(set);
|
|
|
|
|
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
|
|
|
global_ppriv[i].used = 0;
|
|
|
|
}
|
|
|
|
|
2003-09-09 00:24:31 +00:00
|
|
|
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
|
|
|
|
|
|
|
drm_ioctl_desc_t sis_ioctls[] = {
|
2008-08-23 20:59:12 +00:00
|
|
|
DRM_IOCTL_DEF(DRM_SIS_FB_ALLOC, sis_fb_alloc, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_SIS_FB_FREE, sis_fb_free, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_SIS_AGP_INIT, sis_ioctl_agp_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
|
|
|
|
DRM_IOCTL_DEF(DRM_SIS_AGP_ALLOC, sis_ioctl_agp_alloc, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_SIS_AGP_FREE, sis_ioctl_agp_free, DRM_AUTH),
|
|
|
|
DRM_IOCTL_DEF(DRM_SIS_FB_INIT, sis_fb_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY)
|
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
|
|
|
};
|
|
|
|
|
|
|
|
int sis_max_ioctl = DRM_ARRAY_SIZE(sis_ioctls);
|