2005-04-16 22:20:36 +00:00
|
|
|
/* mga_dma.c -- DMA support for mga g200/g400 -*- linux-c -*-
|
|
|
|
* Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* 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.
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file mga_dma.c
|
|
|
|
* DMA support for MGA G200 / G400.
|
2005-09-25 04:28:13 +00:00
|
|
|
*
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
* \author Rickard E. (Rik) Faith <faith@valinux.com>
|
|
|
|
* \author Jeff Hartmann <jhartmann@valinux.com>
|
|
|
|
* \author Keith Whitwell <keith@tungstengraphics.com>
|
|
|
|
* \author Gareth Hughes <gareth@valinux.com>
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
|
2012-10-02 17:01:07 +00:00
|
|
|
#include <drm/drmP.h>
|
|
|
|
#include <drm/mga_drm.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include "mga_drv.h"
|
|
|
|
|
|
|
|
#define MGA_DEFAULT_USEC_TIMEOUT 10000
|
|
|
|
#define MGA_FREELIST_DEBUG 0
|
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
#define MINIMAL_CLEANUP 0
|
|
|
|
#define FULL_CLEANUP 1
|
2007-07-11 06:09:54 +00:00
|
|
|
static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* Engine control
|
|
|
|
*/
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
int mga_do_wait_for_idle(drm_mga_private_t *dev_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
u32 status = 0;
|
|
|
|
int i;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
for (i = 0; i < dev_priv->usec_timeout; i++) {
|
|
|
|
status = MGA_READ(MGA_STATUS) & MGA_ENGINE_IDLE_MASK;
|
|
|
|
if (status == MGA_ENDPRDMASTS) {
|
|
|
|
MGA_WRITE8(MGA_CRTC_INDEX, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_UDELAY(1);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if MGA_DMA_DEBUG
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_ERROR("failed!\n");
|
|
|
|
DRM_INFO(" status=0x%08x\n", status);
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EBUSY;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_do_dma_reset(drm_mga_private_t *dev_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
drm_mga_primary_buffer_t *primary = &dev_priv->prim;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* The primary DMA stream should look like new right about now.
|
|
|
|
*/
|
|
|
|
primary->tail = 0;
|
|
|
|
primary->space = primary->size;
|
|
|
|
primary->last_flush = 0;
|
|
|
|
|
|
|
|
sarea_priv->last_wrap = 0;
|
|
|
|
|
|
|
|
/* FIXME: Reset counters, buffer ages etc...
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* FIXME: What else do we need to reinitialize? WARP stuff?
|
|
|
|
*/
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* Primary DMA stream
|
|
|
|
*/
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
void mga_do_dma_flush(drm_mga_private_t *dev_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_primary_buffer_t *primary = &dev_priv->prim;
|
|
|
|
u32 head, tail;
|
|
|
|
u32 status = 0;
|
|
|
|
int i;
|
2005-09-25 04:28:13 +00:00
|
|
|
DMA_LOCALS;
|
|
|
|
DRM_DEBUG("\n");
|
|
|
|
|
|
|
|
/* We need to wait so that we can do an safe flush */
|
|
|
|
for (i = 0; i < dev_priv->usec_timeout; i++) {
|
|
|
|
status = MGA_READ(MGA_STATUS) & MGA_ENGINE_IDLE_MASK;
|
|
|
|
if (status == MGA_ENDPRDMASTS)
|
|
|
|
break;
|
|
|
|
DRM_UDELAY(1);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if (primary->tail == primary->last_flush) {
|
|
|
|
DRM_DEBUG(" bailing out...\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
tail = primary->tail + dev_priv->primary->offset;
|
|
|
|
|
|
|
|
/* We need to pad the stream between flushes, as the card
|
|
|
|
* actually (partially?) reads the first of these commands.
|
|
|
|
* See page 4-16 in the G400 manual, middle of the page or so.
|
|
|
|
*/
|
2005-09-25 04:28:13 +00:00
|
|
|
BEGIN_DMA(1);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DMA_BLOCK(MGA_DMAPAD, 0x00000000,
|
|
|
|
MGA_DMAPAD, 0x00000000,
|
|
|
|
MGA_DMAPAD, 0x00000000, MGA_DMAPAD, 0x00000000);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
ADVANCE_DMA();
|
|
|
|
|
|
|
|
primary->last_flush = primary->tail;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
head = MGA_READ(MGA_PRIMADDRESS);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (head <= tail)
|
2005-04-16 22:20:36 +00:00
|
|
|
primary->space = primary->size - primary->tail;
|
2010-07-11 23:46:57 +00:00
|
|
|
else
|
2005-04-16 22:20:36 +00:00
|
|
|
primary->space = head - tail;
|
|
|
|
|
2009-02-02 05:55:47 +00:00
|
|
|
DRM_DEBUG(" head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset));
|
|
|
|
DRM_DEBUG(" tail = 0x%06lx\n", (unsigned long)(tail - dev_priv->primary->offset));
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG(" space = 0x%06x\n", primary->space);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
mga_flush_write_combine();
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
MGA_WRITE(MGA_PRIMEND, tail | dev_priv->dma_access);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("done.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
void mga_do_dma_wrap_start(drm_mga_private_t *dev_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_primary_buffer_t *primary = &dev_priv->prim;
|
|
|
|
u32 head, tail;
|
|
|
|
DMA_LOCALS;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
BEGIN_DMA_WRAP();
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DMA_BLOCK(MGA_DMAPAD, 0x00000000,
|
|
|
|
MGA_DMAPAD, 0x00000000,
|
|
|
|
MGA_DMAPAD, 0x00000000, MGA_DMAPAD, 0x00000000);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
ADVANCE_DMA();
|
|
|
|
|
|
|
|
tail = primary->tail + dev_priv->primary->offset;
|
|
|
|
|
|
|
|
primary->tail = 0;
|
|
|
|
primary->last_flush = 0;
|
|
|
|
primary->last_wrap++;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
head = MGA_READ(MGA_PRIMADDRESS);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (head == dev_priv->primary->offset)
|
2005-04-16 22:20:36 +00:00
|
|
|
primary->space = primary->size;
|
2010-07-11 23:46:57 +00:00
|
|
|
else
|
2005-04-16 22:20:36 +00:00
|
|
|
primary->space = head - dev_priv->primary->offset;
|
|
|
|
|
2009-02-02 05:55:47 +00:00
|
|
|
DRM_DEBUG(" head = 0x%06lx\n", (unsigned long)(head - dev_priv->primary->offset));
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG(" tail = 0x%06x\n", primary->tail);
|
|
|
|
DRM_DEBUG(" wrap = %d\n", primary->last_wrap);
|
|
|
|
DRM_DEBUG(" space = 0x%06x\n", primary->space);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
mga_flush_write_combine();
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
MGA_WRITE(MGA_PRIMEND, tail | dev_priv->dma_access);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
set_bit(0, &primary->wrapped);
|
|
|
|
DRM_DEBUG("done.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
void mga_do_dma_wrap_end(drm_mga_private_t *dev_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_primary_buffer_t *primary = &dev_priv->prim;
|
|
|
|
drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv;
|
|
|
|
u32 head = dev_priv->primary->offset;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
sarea_priv->last_wrap++;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG(" wrap = %d\n", sarea_priv->last_wrap);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
mga_flush_write_combine();
|
2005-09-25 04:28:13 +00:00
|
|
|
MGA_WRITE(MGA_PRIMADDRESS, head | MGA_DMA_GENERAL);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
clear_bit(0, &primary->wrapped);
|
|
|
|
DRM_DEBUG("done.\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* Freelist management
|
|
|
|
*/
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
#define MGA_BUFFER_USED (~0)
|
2005-04-16 22:20:36 +00:00
|
|
|
#define MGA_BUFFER_FREE 0
|
|
|
|
|
|
|
|
#if MGA_FREELIST_DEBUG
|
2010-07-11 23:46:57 +00:00
|
|
|
static void mga_freelist_print(struct drm_device *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mga_freelist_t *entry;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_INFO("\n");
|
|
|
|
DRM_INFO("current dispatch: last=0x%x done=0x%x\n",
|
|
|
|
dev_priv->sarea_priv->last_dispatch,
|
|
|
|
(unsigned int)(MGA_READ(MGA_PRIMADDRESS) -
|
|
|
|
dev_priv->primary->offset));
|
|
|
|
DRM_INFO("current freelist:\n");
|
|
|
|
|
|
|
|
for (entry = dev_priv->head->next; entry; entry = entry->next) {
|
|
|
|
DRM_INFO(" %p idx=%2d age=0x%x 0x%06lx\n",
|
|
|
|
entry, entry->buf->idx, entry->age.head,
|
2009-02-02 05:55:47 +00:00
|
|
|
(unsigned long)(entry->age.head - dev_priv->primary->offset));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_INFO("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_freelist_init(struct drm_device *dev, drm_mga_private_t *dev_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-07-11 06:32:08 +00:00
|
|
|
struct drm_device_dma *dma = dev->dma;
|
2007-07-11 06:17:42 +00:00
|
|
|
struct drm_buf *buf;
|
2005-04-16 22:20:36 +00:00
|
|
|
drm_mga_buf_priv_t *buf_priv;
|
|
|
|
drm_mga_freelist_t *entry;
|
|
|
|
int i;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("count=%d\n", dma->buf_count);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-03-24 19:23:04 +00:00
|
|
|
dev_priv->head = kzalloc(sizeof(drm_mga_freelist_t), GFP_KERNEL);
|
2005-09-25 04:28:13 +00:00
|
|
|
if (dev_priv->head == NULL)
|
2007-08-25 09:22:43 +00:00
|
|
|
return -ENOMEM;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
for (i = 0; i < dma->buf_count; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
buf = dma->buflist[i];
|
2005-09-25 04:28:13 +00:00
|
|
|
buf_priv = buf->dev_private;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2009-03-24 19:23:04 +00:00
|
|
|
entry = kzalloc(sizeof(drm_mga_freelist_t), GFP_KERNEL);
|
2005-09-25 04:28:13 +00:00
|
|
|
if (entry == NULL)
|
2007-08-25 09:22:43 +00:00
|
|
|
return -ENOMEM;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
entry->next = dev_priv->head->next;
|
|
|
|
entry->prev = dev_priv->head;
|
2005-09-25 04:28:13 +00:00
|
|
|
SET_AGE(&entry->age, MGA_BUFFER_FREE, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
entry->buf = buf;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if (dev_priv->head->next != NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
dev_priv->head->next->prev = entry;
|
2005-09-25 04:28:13 +00:00
|
|
|
if (entry->next == NULL)
|
2005-04-16 22:20:36 +00:00
|
|
|
dev_priv->tail = entry;
|
|
|
|
|
|
|
|
buf_priv->list_entry = entry;
|
|
|
|
buf_priv->discard = 0;
|
|
|
|
buf_priv->dispatched = 0;
|
|
|
|
|
|
|
|
dev_priv->head->next = entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
static void mga_freelist_cleanup(struct drm_device *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mga_freelist_t *entry;
|
|
|
|
drm_mga_freelist_t *next;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
entry = dev_priv->head;
|
2005-09-25 04:28:13 +00:00
|
|
|
while (entry) {
|
2005-04-16 22:20:36 +00:00
|
|
|
next = entry->next;
|
2009-03-24 19:23:04 +00:00
|
|
|
kfree(entry);
|
2005-04-16 22:20:36 +00:00
|
|
|
entry = next;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_priv->head = dev_priv->tail = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* FIXME: Still needed?
|
|
|
|
*/
|
2010-07-11 23:46:57 +00:00
|
|
|
static void mga_freelist_reset(struct drm_device *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-07-11 06:32:08 +00:00
|
|
|
struct drm_device_dma *dma = dev->dma;
|
2007-07-11 06:17:42 +00:00
|
|
|
struct drm_buf *buf;
|
2005-04-16 22:20:36 +00:00
|
|
|
drm_mga_buf_priv_t *buf_priv;
|
|
|
|
int i;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
for (i = 0; i < dma->buf_count; i++) {
|
2005-04-16 22:20:36 +00:00
|
|
|
buf = dma->buflist[i];
|
2005-09-25 04:28:13 +00:00
|
|
|
buf_priv = buf->dev_private;
|
|
|
|
SET_AGE(&buf_priv->list_entry->age, MGA_BUFFER_FREE, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-07-11 06:17:42 +00:00
|
|
|
static struct drm_buf *mga_freelist_get(struct drm_device * dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mga_freelist_t *next;
|
|
|
|
drm_mga_freelist_t *prev;
|
|
|
|
drm_mga_freelist_t *tail = dev_priv->tail;
|
|
|
|
u32 head, wrap;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
head = MGA_READ(MGA_PRIMADDRESS);
|
2005-04-16 22:20:36 +00:00
|
|
|
wrap = dev_priv->sarea_priv->last_wrap;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG(" tail=0x%06lx %d\n",
|
|
|
|
tail->age.head ?
|
2009-02-02 05:55:47 +00:00
|
|
|
(unsigned long)(tail->age.head - dev_priv->primary->offset) : 0,
|
2005-09-25 04:28:13 +00:00
|
|
|
tail->age.wrap);
|
|
|
|
DRM_DEBUG(" head=0x%06lx %d\n",
|
2009-02-02 05:55:47 +00:00
|
|
|
(unsigned long)(head - dev_priv->primary->offset), wrap);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if (TEST_AGE(&tail->age, head, wrap)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
prev = dev_priv->tail->prev;
|
|
|
|
next = dev_priv->tail;
|
|
|
|
prev->next = NULL;
|
|
|
|
next->prev = next->next = NULL;
|
|
|
|
dev_priv->tail = prev;
|
2005-09-25 04:28:13 +00:00
|
|
|
SET_AGE(&next->age, MGA_BUFFER_USED, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
return next->buf;
|
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("returning NULL!\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
int mga_freelist_put(struct drm_device *dev, struct drm_buf *buf)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_private_t *dev_priv = dev->dev_private;
|
|
|
|
drm_mga_buf_priv_t *buf_priv = buf->dev_private;
|
|
|
|
drm_mga_freelist_t *head, *entry, *prev;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("age=0x%06lx wrap=%d\n",
|
2009-02-02 05:55:47 +00:00
|
|
|
(unsigned long)(buf_priv->list_entry->age.head -
|
|
|
|
dev_priv->primary->offset),
|
|
|
|
buf_priv->list_entry->age.wrap);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
entry = buf_priv->list_entry;
|
|
|
|
head = dev_priv->head;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if (buf_priv->list_entry->age.head == MGA_BUFFER_USED) {
|
|
|
|
SET_AGE(&entry->age, MGA_BUFFER_FREE, 0);
|
2005-04-16 22:20:36 +00:00
|
|
|
prev = dev_priv->tail;
|
|
|
|
prev->next = entry;
|
|
|
|
entry->prev = prev;
|
|
|
|
entry->next = NULL;
|
|
|
|
} else {
|
|
|
|
prev = head->next;
|
|
|
|
head->next = entry;
|
|
|
|
prev->prev = entry;
|
|
|
|
entry->prev = head;
|
|
|
|
entry->next = prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* DMA initialization, cleanup
|
|
|
|
*/
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
int mga_driver_load(struct drm_device *dev, unsigned long flags)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
{
|
2005-09-25 04:28:13 +00:00
|
|
|
drm_mga_private_t *dev_priv;
|
2008-11-18 17:30:25 +00:00
|
|
|
int ret;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
2009-03-24 19:23:04 +00:00
|
|
|
dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (!dev_priv)
|
2007-08-25 09:22:43 +00:00
|
|
|
return -ENOMEM;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
|
|
|
dev->dev_private = (void *)dev_priv;
|
|
|
|
|
|
|
|
dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT;
|
|
|
|
dev_priv->chipset = flags;
|
|
|
|
|
2011-12-19 11:15:29 +00:00
|
|
|
pci_set_master(dev->pdev);
|
|
|
|
|
2010-05-27 19:40:24 +00:00
|
|
|
dev_priv->mmio_base = pci_resource_start(dev->pdev, 1);
|
|
|
|
dev_priv->mmio_size = pci_resource_len(dev->pdev, 1);
|
2005-11-10 11:16:34 +00:00
|
|
|
|
|
|
|
dev->counters += 3;
|
|
|
|
dev->types[6] = _DRM_STAT_IRQ;
|
|
|
|
dev->types[7] = _DRM_STAT_PRIMARY;
|
|
|
|
dev->types[8] = _DRM_STAT_SECONDARY;
|
|
|
|
|
2008-11-18 17:30:25 +00:00
|
|
|
ret = drm_vblank_init(dev, 1);
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
(void) mga_driver_unload(dev);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-09-05 11:51:30 +00:00
|
|
|
#if __OS_HAS_AGP
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
/**
|
|
|
|
* Bootstrap the driver for AGP DMA.
|
2005-09-25 04:28:13 +00:00
|
|
|
*
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
* \todo
|
2011-03-31 01:57:33 +00:00
|
|
|
* Investigate whether there is any benefit to storing the WARP microcode in
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
* AGP memory. If not, the microcode may as well always be put in PCI
|
|
|
|
* memory.
|
|
|
|
*
|
|
|
|
* \todo
|
|
|
|
* This routine needs to set dma_bs->agp_mode to the mode actually configured
|
|
|
|
* in the hardware. Looking just at the Linux AGP driver code, I don't see
|
|
|
|
* an easy way to determine this.
|
|
|
|
*
|
|
|
|
* \sa mga_do_dma_bootstrap, mga_do_pci_dma_bootstrap
|
|
|
|
*/
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
|
|
|
|
drm_mga_dma_bootstrap_t *dma_bs)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
{
|
2005-09-25 04:28:13 +00:00
|
|
|
drm_mga_private_t *const dev_priv =
|
|
|
|
(drm_mga_private_t *) dev->dev_private;
|
2009-08-23 17:34:25 +00:00
|
|
|
unsigned int warp_size = MGA_WARP_UCODE_SIZE;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
int err;
|
2005-09-25 04:28:13 +00:00
|
|
|
unsigned offset;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
const unsigned secondary_size = dma_bs->secondary_bin_count
|
2005-09-25 04:28:13 +00:00
|
|
|
* dma_bs->secondary_bin_size;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
const unsigned agp_size = (dma_bs->agp_size << 20);
|
2007-07-11 06:09:54 +00:00
|
|
|
struct drm_buf_desc req;
|
|
|
|
struct drm_agp_mode mode;
|
|
|
|
struct drm_agp_info info;
|
|
|
|
struct drm_agp_buffer agp_req;
|
|
|
|
struct drm_agp_binding bind_req;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
|
|
|
/* Acquire AGP. */
|
|
|
|
err = drm_agp_acquire(dev);
|
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to acquire AGP: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = drm_agp_info(dev, &info);
|
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to get AGP info: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
mode.mode = (info.mode & ~0x07) | dma_bs->agp_mode;
|
|
|
|
err = drm_agp_enable(dev, mode);
|
|
|
|
if (err) {
|
|
|
|
DRM_ERROR("Unable to enable AGP (mode = 0x%lx)\n", mode.mode);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In addition to the usual AGP mode configuration, the G200 AGP cards
|
|
|
|
* need to have the AGP mode "manually" set.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (dev_priv->chipset == MGA_CARD_TYPE_G200) {
|
2010-07-11 23:46:57 +00:00
|
|
|
if (mode.mode & 0x02)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
MGA_WRITE(MGA_AGP_PLL, MGA_AGP2XPLL_ENABLE);
|
2010-07-11 23:46:57 +00:00
|
|
|
else
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
MGA_WRITE(MGA_AGP_PLL, MGA_AGP2XPLL_DISABLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate and bind AGP memory. */
|
2005-11-11 12:11:34 +00:00
|
|
|
agp_req.size = agp_size;
|
|
|
|
agp_req.type = 0;
|
|
|
|
err = drm_agp_alloc(dev, &agp_req);
|
|
|
|
if (err) {
|
|
|
|
dev_priv->agp_size = 0;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
DRM_ERROR("Unable to allocate %uMB AGP memory\n",
|
|
|
|
dma_bs->agp_size);
|
2005-11-11 12:11:34 +00:00
|
|
|
return err;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
2007-11-05 02:50:58 +00:00
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
dev_priv->agp_size = agp_size;
|
|
|
|
dev_priv->agp_handle = agp_req.handle;
|
2005-09-25 04:28:13 +00:00
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
bind_req.handle = agp_req.handle;
|
|
|
|
bind_req.offset = 0;
|
|
|
|
err = drm_agp_bind(dev, &bind_req);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to bind AGP memory: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2005-10-20 04:23:51 +00:00
|
|
|
/* Make drm_addbufs happy by not trying to create a mapping for less
|
|
|
|
* than a page.
|
|
|
|
*/
|
|
|
|
if (warp_size < PAGE_SIZE)
|
|
|
|
warp_size = PAGE_SIZE;
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
offset = 0;
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addmap(dev, offset, warp_size,
|
|
|
|
_DRM_AGP, _DRM_READ_ONLY, &dev_priv->warp);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to map WARP microcode: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += warp_size;
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addmap(dev, offset, dma_bs->primary_size,
|
|
|
|
_DRM_AGP, _DRM_READ_ONLY, &dev_priv->primary);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to map primary DMA region: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += dma_bs->primary_size;
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addmap(dev, offset, secondary_size,
|
|
|
|
_DRM_AGP, 0, &dev->agp_buffer_map);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to map secondary DMA region: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
(void)memset(&req, 0, sizeof(req));
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
req.count = dma_bs->secondary_bin_count;
|
|
|
|
req.size = dma_bs->secondary_bin_size;
|
|
|
|
req.flags = _DRM_AGP_BUFFER;
|
|
|
|
req.agp_start = offset;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addbufs_agp(dev, &req);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
{
|
2007-07-11 06:53:40 +00:00
|
|
|
struct drm_map_list *_entry;
|
2005-11-11 12:11:34 +00:00
|
|
|
unsigned long agp_token = 0;
|
2007-11-05 02:50:58 +00:00
|
|
|
|
2007-05-25 19:01:51 +00:00
|
|
|
list_for_each_entry(_entry, &dev->maplist, head) {
|
2005-11-11 12:11:34 +00:00
|
|
|
if (_entry->map == dev->agp_buffer_map)
|
|
|
|
agp_token = _entry->user_token;
|
|
|
|
}
|
|
|
|
if (!agp_token)
|
|
|
|
return -EFAULT;
|
|
|
|
|
|
|
|
dev->agp_buffer_token = agp_token;
|
|
|
|
}
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
offset += secondary_size;
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addmap(dev, offset, agp_size - offset,
|
|
|
|
_DRM_AGP, 0, &dev_priv->agp_textures);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to map AGP texture region %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
drm_core_ioremap(dev_priv->warp, dev);
|
|
|
|
drm_core_ioremap(dev_priv->primary, dev);
|
|
|
|
drm_core_ioremap(dev->agp_buffer_map, dev);
|
|
|
|
|
|
|
|
if (!dev_priv->warp->handle ||
|
|
|
|
!dev_priv->primary->handle || !dev->agp_buffer_map->handle) {
|
|
|
|
DRM_ERROR("failed to ioremap agp regions! (%p, %p, %p)\n",
|
|
|
|
dev_priv->warp->handle, dev_priv->primary->handle,
|
|
|
|
dev->agp_buffer_map->handle);
|
2007-08-25 09:22:43 +00:00
|
|
|
return -ENOMEM;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dev_priv->dma_access = MGA_PAGPXFER;
|
|
|
|
dev_priv->wagp_enable = MGA_WAGP_ENABLE;
|
|
|
|
|
|
|
|
DRM_INFO("Initialized card for AGP DMA.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2005-09-05 11:51:30 +00:00
|
|
|
#else
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_do_agp_dma_bootstrap(struct drm_device *dev,
|
|
|
|
drm_mga_dma_bootstrap_t *dma_bs)
|
2005-09-05 11:51:30 +00:00
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
#endif
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Bootstrap the driver for PCI DMA.
|
2005-09-25 04:28:13 +00:00
|
|
|
*
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
* \todo
|
|
|
|
* The algorithm for decreasing the size of the primary DMA buffer could be
|
|
|
|
* better. The size should be rounded up to the nearest page size, then
|
|
|
|
* decrease the request size by a single page each pass through the loop.
|
|
|
|
*
|
|
|
|
* \todo
|
|
|
|
* Determine whether the maximum address passed to drm_pci_alloc is correct.
|
|
|
|
* The same goes for drm_addbufs_pci.
|
2005-09-25 04:28:13 +00:00
|
|
|
*
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
* \sa mga_do_dma_bootstrap, mga_do_agp_dma_bootstrap
|
|
|
|
*/
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
|
|
|
|
drm_mga_dma_bootstrap_t *dma_bs)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
{
|
2005-09-25 04:28:13 +00:00
|
|
|
drm_mga_private_t *const dev_priv =
|
|
|
|
(drm_mga_private_t *) dev->dev_private;
|
2009-08-23 17:34:25 +00:00
|
|
|
unsigned int warp_size = MGA_WARP_UCODE_SIZE;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
unsigned int primary_size;
|
|
|
|
unsigned int bin_count;
|
|
|
|
int err;
|
2007-07-11 06:09:54 +00:00
|
|
|
struct drm_buf_desc req;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
|
|
|
if (dev->dma == NULL) {
|
|
|
|
DRM_ERROR("dev->dma is NULL\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EFAULT;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
|
2005-10-20 04:23:51 +00:00
|
|
|
/* Make drm_addbufs happy by not trying to create a mapping for less
|
|
|
|
* than a page.
|
|
|
|
*/
|
|
|
|
if (warp_size < PAGE_SIZE)
|
|
|
|
warp_size = PAGE_SIZE;
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
/* The proper alignment is 0x100 for this mapping */
|
|
|
|
err = drm_addmap(dev, 0, warp_size, _DRM_CONSISTENT,
|
|
|
|
_DRM_READ_ONLY, &dev_priv->warp);
|
|
|
|
if (err != 0) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to create mapping for WARP microcode: %d\n",
|
|
|
|
err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Other than the bottom two bits being used to encode other
|
|
|
|
* information, there don't appear to be any restrictions on the
|
|
|
|
* alignment of the primary or secondary DMA buffers.
|
|
|
|
*/
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
for (primary_size = dma_bs->primary_size; primary_size != 0;
|
|
|
|
primary_size >>= 1) {
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
/* The proper alignment for this mapping is 0x04 */
|
|
|
|
err = drm_addmap(dev, 0, primary_size, _DRM_CONSISTENT,
|
|
|
|
_DRM_READ_ONLY, &dev_priv->primary);
|
|
|
|
if (!err)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (err != 0) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to allocate primary DMA region: %d\n", err);
|
2007-08-25 09:22:43 +00:00
|
|
|
return -ENOMEM;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dev_priv->primary->size != dma_bs->primary_size) {
|
|
|
|
DRM_INFO("Primary DMA buffer size reduced from %u to %u.\n",
|
2005-09-25 04:28:13 +00:00
|
|
|
dma_bs->primary_size,
|
|
|
|
(unsigned)dev_priv->primary->size);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
dma_bs->primary_size = dev_priv->primary->size;
|
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
for (bin_count = dma_bs->secondary_bin_count; bin_count > 0;
|
|
|
|
bin_count--) {
|
|
|
|
(void)memset(&req, 0, sizeof(req));
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
req.count = bin_count;
|
|
|
|
req.size = dma_bs->secondary_bin_size;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addbufs_pci(dev, &req);
|
2010-07-11 23:46:57 +00:00
|
|
|
if (!err)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-09-25 04:28:13 +00:00
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (bin_count == 0) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bin_count != dma_bs->secondary_bin_count) {
|
|
|
|
DRM_INFO("Secondary PCI DMA buffer bin count reduced from %u "
|
|
|
|
"to %u.\n", dma_bs->secondary_bin_count, bin_count);
|
|
|
|
|
|
|
|
dma_bs->secondary_bin_count = bin_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_priv->dma_access = 0;
|
|
|
|
dev_priv->wagp_enable = 0;
|
|
|
|
|
|
|
|
dma_bs->agp_mode = 0;
|
|
|
|
|
|
|
|
DRM_INFO("Initialized card for PCI DMA.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_do_dma_bootstrap(struct drm_device *dev,
|
|
|
|
drm_mga_dma_bootstrap_t *dma_bs)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
{
|
2010-12-14 17:16:38 +00:00
|
|
|
const int is_agp = (dma_bs->agp_mode != 0) && drm_pci_device_is_agp(dev);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
int err;
|
2005-09-25 04:28:13 +00:00
|
|
|
drm_mga_private_t *const dev_priv =
|
|
|
|
(drm_mga_private_t *) dev->dev_private;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
|
|
|
dev_priv->used_new_dma_init = 1;
|
|
|
|
|
|
|
|
/* The first steps are the same for both PCI and AGP based DMA. Map
|
|
|
|
* the cards MMIO registers and map a status page.
|
|
|
|
*/
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addmap(dev, dev_priv->mmio_base, dev_priv->mmio_size,
|
|
|
|
_DRM_REGISTERS, _DRM_READ_ONLY, &dev_priv->mmio);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to map MMIO region: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
err = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM,
|
|
|
|
_DRM_READ_ONLY | _DRM_LOCKED | _DRM_KERNEL,
|
|
|
|
&dev_priv->status);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (err) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("Unable to map status region: %d\n", err);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The DMA initialization procedure is slightly different for PCI and
|
|
|
|
* AGP cards. AGP cards just allocate a large block of AGP memory and
|
|
|
|
* carve off portions of it for internal uses. The remaining memory
|
|
|
|
* is returned to user-mode to be used for AGP textures.
|
|
|
|
*/
|
2010-07-11 23:46:57 +00:00
|
|
|
if (is_agp)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
err = mga_do_agp_dma_bootstrap(dev, dma_bs);
|
2005-09-25 04:28:13 +00:00
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
/* If we attempted to initialize the card for AGP DMA but failed,
|
|
|
|
* clean-up any mess that may have been created.
|
|
|
|
*/
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (err)
|
2005-11-11 12:11:34 +00:00
|
|
|
mga_do_cleanup_dma(dev, MINIMAL_CLEANUP);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
|
|
|
/* Not only do we want to try and initialized PCI cards for PCI DMA,
|
|
|
|
* but we also try to initialized AGP cards that could not be
|
|
|
|
* initialized for AGP DMA. This covers the case where we have an AGP
|
|
|
|
* card in a system with an unsupported AGP chipset. In that case the
|
|
|
|
* card will be detected as AGP, but we won't be able to allocate any
|
|
|
|
* AGP memory, etc.
|
|
|
|
*/
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (!is_agp || err)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
err = mga_do_pci_dma_bootstrap(dev, dma_bs);
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
int mga_dma_bootstrap(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
{
|
2007-09-03 02:06:45 +00:00
|
|
|
drm_mga_dma_bootstrap_t *bootstrap = data;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
int err;
|
2005-11-11 12:11:34 +00:00
|
|
|
static const int modes[] = { 0, 1, 2, 2, 4, 4, 4, 4 };
|
|
|
|
const drm_mga_private_t *const dev_priv =
|
|
|
|
(drm_mga_private_t *) dev->dev_private;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
err = mga_do_dma_bootstrap(dev, bootstrap);
|
2005-11-11 12:11:34 +00:00
|
|
|
if (err) {
|
|
|
|
mga_do_cleanup_dma(dev, FULL_CLEANUP);
|
|
|
|
return err;
|
|
|
|
}
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
if (dev_priv->agp_textures != NULL) {
|
2007-09-03 02:06:45 +00:00
|
|
|
bootstrap->texture_handle = dev_priv->agp_textures->offset;
|
|
|
|
bootstrap->texture_size = dev_priv->agp_textures->size;
|
2005-09-25 04:28:13 +00:00
|
|
|
} else {
|
2007-09-03 02:06:45 +00:00
|
|
|
bootstrap->texture_handle = 0;
|
|
|
|
bootstrap->texture_size = 0;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
bootstrap->agp_mode = modes[bootstrap->agp_mode & 0x07];
|
2005-11-11 12:11:34 +00:00
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_do_init_dma(struct drm_device *dev, drm_mga_init_t *init)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_private_t *dev_priv;
|
|
|
|
int ret;
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
dev_priv = dev->dev_private;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (init->sgram)
|
2005-04-16 22:20:36 +00:00
|
|
|
dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK;
|
2010-07-11 23:46:57 +00:00
|
|
|
else
|
2005-04-16 22:20:36 +00:00
|
|
|
dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR;
|
2005-09-25 04:28:13 +00:00
|
|
|
dev_priv->maccess = init->maccess;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
dev_priv->fb_cpp = init->fb_cpp;
|
|
|
|
dev_priv->front_offset = init->front_offset;
|
|
|
|
dev_priv->front_pitch = init->front_pitch;
|
|
|
|
dev_priv->back_offset = init->back_offset;
|
|
|
|
dev_priv->back_pitch = init->back_pitch;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
dev_priv->depth_cpp = init->depth_cpp;
|
|
|
|
dev_priv->depth_offset = init->depth_offset;
|
|
|
|
dev_priv->depth_pitch = init->depth_pitch;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* FIXME: Need to support AGP textures...
|
|
|
|
*/
|
|
|
|
dev_priv->texture_offset = init->texture_offset[0];
|
|
|
|
dev_priv->texture_size = init->texture_size[0];
|
|
|
|
|
2007-05-25 19:04:51 +00:00
|
|
|
dev_priv->sarea = drm_getsarea(dev);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (!dev_priv->sarea) {
|
|
|
|
DRM_ERROR("failed to find sarea!\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if (!dev_priv->used_new_dma_init) {
|
2005-10-20 04:23:51 +00:00
|
|
|
|
|
|
|
dev_priv->dma_access = MGA_PAGPXFER;
|
|
|
|
dev_priv->wagp_enable = MGA_WAGP_ENABLE;
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
dev_priv->status = drm_core_findmap(dev, init->status_offset);
|
|
|
|
if (!dev_priv->status) {
|
|
|
|
DRM_ERROR("failed to find status page!\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset);
|
|
|
|
if (!dev_priv->mmio) {
|
|
|
|
DRM_ERROR("failed to find mmio region!\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
dev_priv->warp = drm_core_findmap(dev, init->warp_offset);
|
|
|
|
if (!dev_priv->warp) {
|
|
|
|
DRM_ERROR("failed to find warp microcode region!\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
dev_priv->primary = drm_core_findmap(dev, init->primary_offset);
|
|
|
|
if (!dev_priv->primary) {
|
|
|
|
DRM_ERROR("failed to find primary dma region!\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
2005-08-05 12:11:22 +00:00
|
|
|
dev->agp_buffer_token = init->buffers_offset;
|
2005-09-25 04:28:13 +00:00
|
|
|
dev->agp_buffer_map =
|
|
|
|
drm_core_findmap(dev, init->buffers_offset);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (!dev->agp_buffer_map) {
|
|
|
|
DRM_ERROR("failed to find dma buffer region!\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
drm_core_ioremap(dev_priv->warp, dev);
|
|
|
|
drm_core_ioremap(dev_priv->primary, dev);
|
|
|
|
drm_core_ioremap(dev->agp_buffer_map, dev);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dev_priv->sarea_priv =
|
2005-09-25 04:28:13 +00:00
|
|
|
(drm_mga_sarea_t *) ((u8 *) dev_priv->sarea->handle +
|
|
|
|
init->sarea_priv_offset);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (!dev_priv->warp->handle ||
|
|
|
|
!dev_priv->primary->handle ||
|
|
|
|
((dev_priv->dma_access != 0) &&
|
|
|
|
((dev->agp_buffer_map == NULL) ||
|
|
|
|
(dev->agp_buffer_map->handle == NULL)))) {
|
|
|
|
DRM_ERROR("failed to ioremap agp regions!\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -ENOMEM;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
ret = mga_warp_install_microcode(dev_priv);
|
|
|
|
if (ret < 0) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("failed to install WARP ucode!: %d\n", ret);
|
2005-04-16 22:20:36 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
ret = mga_warp_init(dev_priv);
|
|
|
|
if (ret < 0) {
|
2005-11-11 12:11:34 +00:00
|
|
|
DRM_ERROR("failed to init WARP engine!: %d\n", ret);
|
2005-04-16 22:20:36 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
dev_priv->prim.status = (u32 *) dev_priv->status->handle;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
mga_do_wait_for_idle(dev_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Init the primary DMA registers.
|
|
|
|
*/
|
2005-09-25 04:28:13 +00:00
|
|
|
MGA_WRITE(MGA_PRIMADDRESS, dev_priv->primary->offset | MGA_DMA_GENERAL);
|
2005-04-16 22:20:36 +00:00
|
|
|
#if 0
|
2005-09-25 04:28:13 +00:00
|
|
|
MGA_WRITE(MGA_PRIMPTR, virt_to_bus((void *)dev_priv->prim.status) | MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */
|
|
|
|
MGA_PRIMPTREN1); /* DWGSYNC */
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
dev_priv->prim.start = (u8 *) dev_priv->primary->handle;
|
|
|
|
dev_priv->prim.end = ((u8 *) dev_priv->primary->handle
|
2005-04-16 22:20:36 +00:00
|
|
|
+ dev_priv->primary->size);
|
|
|
|
dev_priv->prim.size = dev_priv->primary->size;
|
|
|
|
|
|
|
|
dev_priv->prim.tail = 0;
|
|
|
|
dev_priv->prim.space = dev_priv->prim.size;
|
|
|
|
dev_priv->prim.wrapped = 0;
|
|
|
|
|
|
|
|
dev_priv->prim.last_flush = 0;
|
|
|
|
dev_priv->prim.last_wrap = 0;
|
|
|
|
|
|
|
|
dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE;
|
|
|
|
|
|
|
|
dev_priv->prim.status[0] = dev_priv->primary->offset;
|
|
|
|
dev_priv->prim.status[1] = 0;
|
|
|
|
|
|
|
|
dev_priv->sarea_priv->last_wrap = 0;
|
|
|
|
dev_priv->sarea_priv->last_frame.head = 0;
|
|
|
|
dev_priv->sarea_priv->last_frame.wrap = 0;
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (mga_freelist_init(dev, dev_priv) < 0) {
|
|
|
|
DRM_ERROR("could not initialize freelist\n");
|
2007-08-25 09:22:43 +00:00
|
|
|
return -ENOMEM;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-07-11 06:09:54 +00:00
|
|
|
static int mga_do_cleanup_dma(struct drm_device *dev, int full_cleanup)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
int err = 0;
|
|
|
|
DRM_DEBUG("\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Make sure interrupts are disabled here because the uninstall ioctl
|
|
|
|
* may not have been called from userspace and after dev_private
|
|
|
|
* is freed, it's too late.
|
|
|
|
*/
|
2005-09-25 04:28:13 +00:00
|
|
|
if (dev->irq_enabled)
|
|
|
|
drm_irq_uninstall(dev);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if (dev->dev_private) {
|
2005-04-16 22:20:36 +00:00
|
|
|
drm_mga_private_t *dev_priv = dev->dev_private;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if ((dev_priv->warp != NULL)
|
2005-10-20 04:23:51 +00:00
|
|
|
&& (dev_priv->warp->type != _DRM_CONSISTENT))
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
drm_core_ioremapfree(dev_priv->warp, dev);
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if ((dev_priv->primary != NULL)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
&& (dev_priv->primary->type != _DRM_CONSISTENT))
|
|
|
|
drm_core_ioremapfree(dev_priv->primary, dev);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
if (dev->agp_buffer_map != NULL)
|
|
|
|
drm_core_ioremapfree(dev->agp_buffer_map, dev);
|
|
|
|
|
|
|
|
if (dev_priv->used_new_dma_init) {
|
2005-09-05 11:51:30 +00:00
|
|
|
#if __OS_HAS_AGP
|
2005-11-11 12:11:34 +00:00
|
|
|
if (dev_priv->agp_handle != 0) {
|
2007-07-11 06:09:54 +00:00
|
|
|
struct drm_agp_binding unbind_req;
|
|
|
|
struct drm_agp_buffer free_req;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
unbind_req.handle = dev_priv->agp_handle;
|
|
|
|
drm_agp_unbind(dev, &unbind_req);
|
|
|
|
|
|
|
|
free_req.handle = dev_priv->agp_handle;
|
|
|
|
drm_agp_free(dev, &free_req);
|
2007-11-05 02:50:58 +00:00
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
dev_priv->agp_textures = NULL;
|
|
|
|
dev_priv->agp_size = 0;
|
|
|
|
dev_priv->agp_handle = 0;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if ((dev->agp != NULL) && dev->agp->acquired)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
err = drm_agp_release(dev);
|
2005-09-05 11:51:30 +00:00
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
dev_priv->warp = NULL;
|
|
|
|
dev_priv->primary = NULL;
|
|
|
|
dev_priv->sarea = NULL;
|
|
|
|
dev_priv->sarea_priv = NULL;
|
|
|
|
dev->agp_buffer_map = NULL;
|
|
|
|
|
2005-11-11 12:11:34 +00:00
|
|
|
if (full_cleanup) {
|
|
|
|
dev_priv->mmio = NULL;
|
|
|
|
dev_priv->status = NULL;
|
|
|
|
dev_priv->used_new_dma_init = 0;
|
|
|
|
}
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
memset(&dev_priv->prim, 0, sizeof(dev_priv->prim));
|
|
|
|
dev_priv->warp_pipe = 0;
|
2005-09-25 04:28:13 +00:00
|
|
|
memset(dev_priv->warp_pipe_phys, 0,
|
|
|
|
sizeof(dev_priv->warp_pipe_phys));
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (dev_priv->head != NULL)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
mga_freelist_cleanup(dev);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-12-16 23:47:17 +00:00
|
|
|
return err;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
int mga_dma_init(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-09-03 02:06:45 +00:00
|
|
|
drm_mga_init_t *init = data;
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
int err;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-08-25 10:23:09 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
switch (init->func) {
|
2005-04-16 22:20:36 +00:00
|
|
|
case MGA_INIT_DMA:
|
2007-09-03 02:06:45 +00:00
|
|
|
err = mga_do_init_dma(dev, init);
|
2010-07-11 23:46:57 +00:00
|
|
|
if (err)
|
2005-11-11 12:11:34 +00:00
|
|
|
(void)mga_do_cleanup_dma(dev, FULL_CLEANUP);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
return err;
|
2005-04-16 22:20:36 +00:00
|
|
|
case MGA_CLEANUP_DMA:
|
2005-11-11 12:11:34 +00:00
|
|
|
return mga_do_cleanup_dma(dev, FULL_CLEANUP);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* Primary DMA stream management
|
|
|
|
*/
|
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
int mga_dma_flush(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-09-25 04:28:13 +00:00
|
|
|
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
2007-09-03 02:06:45 +00:00
|
|
|
struct drm_lock *lock = data;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-08-25 10:23:09 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_DEBUG("%s%s%s\n",
|
2007-09-03 02:06:45 +00:00
|
|
|
(lock->flags & _DRM_LOCK_FLUSH) ? "flush, " : "",
|
|
|
|
(lock->flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "",
|
|
|
|
(lock->flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "");
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
WRAP_WAIT_WITH_RETURN(dev_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (lock->flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL))
|
2005-09-25 04:28:13 +00:00
|
|
|
mga_do_dma_flush(dev_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
if (lock->flags & _DRM_LOCK_QUIESCENT) {
|
2005-04-16 22:20:36 +00:00
|
|
|
#if MGA_DMA_DEBUG
|
2005-09-25 04:28:13 +00:00
|
|
|
int ret = mga_do_wait_for_idle(dev_priv);
|
|
|
|
if (ret < 0)
|
2008-01-24 05:58:57 +00:00
|
|
|
DRM_INFO("-EBUSY\n");
|
2005-04-16 22:20:36 +00:00
|
|
|
return ret;
|
|
|
|
#else
|
2005-09-25 04:28:13 +00:00
|
|
|
return mga_do_wait_for_idle(dev_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
int mga_dma_reset(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-09-25 04:28:13 +00:00
|
|
|
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-08-25 10:23:09 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
return mga_do_dma_reset(dev_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ================================================================
|
|
|
|
* DMA buffer management
|
|
|
|
*/
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
static int mga_dma_get_buffers(struct drm_device *dev,
|
|
|
|
struct drm_file *file_priv, struct drm_dma *d)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-07-11 06:17:42 +00:00
|
|
|
struct drm_buf *buf;
|
2005-04-16 22:20:36 +00:00
|
|
|
int i;
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
for (i = d->granted_count; i < d->request_count; i++) {
|
|
|
|
buf = mga_freelist_get(dev);
|
|
|
|
if (!buf)
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EAGAIN;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-08-25 10:23:09 +00:00
|
|
|
buf->file_priv = file_priv;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
if (DRM_COPY_TO_USER(&d->request_indices[i],
|
|
|
|
&buf->idx, sizeof(buf->idx)))
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EFAULT;
|
2005-09-25 04:28:13 +00:00
|
|
|
if (DRM_COPY_TO_USER(&d->request_sizes[i],
|
|
|
|
&buf->total, sizeof(buf->total)))
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EFAULT;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
d->granted_count++;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
int mga_dma_buffers(struct drm_device *dev, void *data,
|
|
|
|
struct drm_file *file_priv)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-07-11 06:32:08 +00:00
|
|
|
struct drm_device_dma *dma = dev->dma;
|
2005-09-25 04:28:13 +00:00
|
|
|
drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
|
2007-09-03 02:06:45 +00:00
|
|
|
struct drm_dma *d = data;
|
2005-04-16 22:20:36 +00:00
|
|
|
int ret = 0;
|
|
|
|
|
2007-08-25 10:23:09 +00:00
|
|
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Please don't send us buffers.
|
|
|
|
*/
|
2007-09-03 02:06:45 +00:00
|
|
|
if (d->send_count != 0) {
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
|
2007-09-03 02:06:45 +00:00
|
|
|
DRM_CURRENTPID, d->send_count);
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We'll send you buffers.
|
|
|
|
*/
|
2007-09-03 02:06:45 +00:00
|
|
|
if (d->request_count < 0 || d->request_count > dma->buf_count) {
|
2005-09-25 04:28:13 +00:00
|
|
|
DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
|
2007-09-03 02:06:45 +00:00
|
|
|
DRM_CURRENTPID, d->request_count, dma->buf_count);
|
2007-08-25 09:22:43 +00:00
|
|
|
return -EINVAL;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-09-25 04:28:13 +00:00
|
|
|
WRAP_TEST_WITH_RETURN(dev_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-09-03 02:06:45 +00:00
|
|
|
d->granted_count = 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
if (d->request_count)
|
2007-09-03 02:06:45 +00:00
|
|
|
ret = mga_dma_get_buffers(dev, file_priv, d);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
/**
|
|
|
|
* Called just before the module is unloaded.
|
|
|
|
*/
|
2010-07-11 23:46:57 +00:00
|
|
|
int mga_driver_unload(struct drm_device *dev)
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
{
|
2009-03-24 19:23:04 +00:00
|
|
|
kfree(dev->dev_private);
|
Add support for PCI MGA cards to MGA DRM.
This patch adds serveral new ioctls and a new query to get_param query to
support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this change,
the client-side driver no longer needs to map the primary DMA region or the
MMIO region. Previously, end-of-frame waiting was done by busy waiting in the
client-side driver until one of the MMIO registers (the current DMA pointer)
matched a pointer to the end of primary DMA space. By using interrupts, the
busy waiting and the extra mappings are removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
X-server, moves a *LOT* of code from the X-server into the kernel. This allows
the kernel to do whatever needs to be done to setup DMA buffers. The entire
process and the locations of the buffers are hidden from user-mode.
Additionally, a get_param query was added to differentiate between G4x0 cards
and G550 cards. A gap was left in the numbering sequence so that, if needed,
G450 cards could be distinguished from G400 cards. According to Ville
Syrjälä, the G4x0 cards and the G550 cards handle anisotropic filtering
differently. This seems the most compatible way to let the client-side driver
know which card it's own. Doing this very small change now eliminates the
need to bump the DRM minor version twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
(airlied - this may not work at this point, I think the follow on buffer
cleanup patches will be needed)
From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 08:20:09 +00:00
|
|
|
dev->dev_private = NULL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the last opener of the device is closed.
|
|
|
|
*/
|
2010-07-11 23:46:57 +00:00
|
|
|
void mga_driver_lastclose(struct drm_device *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-11-11 12:11:34 +00:00
|
|
|
mga_do_cleanup_dma(dev, FULL_CLEANUP);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-07-11 23:46:57 +00:00
|
|
|
int mga_driver_dma_quiescent(struct drm_device *dev)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
drm_mga_private_t *dev_priv = dev->dev_private;
|
2005-09-25 04:28:13 +00:00
|
|
|
return mga_do_wait_for_idle(dev_priv);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|