summaryrefslogtreecommitdiff
path: root/driver/xf86-video-apm/src
diff options
context:
space:
mode:
Diffstat (limited to 'driver/xf86-video-apm/src')
-rw-r--r--driver/xf86-video-apm/src/Makefile.am10
-rw-r--r--driver/xf86-video-apm/src/Makefile.in63
-rw-r--r--driver/xf86-video-apm/src/apm.h11
-rw-r--r--driver/xf86-video-apm/src/apm_driver.c108
-rw-r--r--driver/xf86-video-apm/src/apm_rush.c733
5 files changed, 32 insertions, 893 deletions
diff --git a/driver/xf86-video-apm/src/Makefile.am b/driver/xf86-video-apm/src/Makefile.am
index 8a6779e28..ad26a0c23 100644
--- a/driver/xf86-video-apm/src/Makefile.am
+++ b/driver/xf86-video-apm/src/Makefile.am
@@ -24,6 +24,9 @@
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+
+AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS)
+
apm_drv_la_LTLIBRARIES = apm_drv.la
apm_drv_la_LDFLAGS = -module -avoid-version
apm_drv_ladir = @moduledir@/drivers
@@ -38,11 +41,6 @@ apm_drv_la_SOURCES = \
apm_regs.h \
apm_pcirename.h
-if XF86RUSH
-apm_drv_la_SOURCES += apm_rush.c
-endif
-
EXTRA_DIST = \
apm_funcs.c \
- apm_video.c \
- apm_rush.c
+ apm_video.c
diff --git a/driver/xf86-video-apm/src/Makefile.in b/driver/xf86-video-apm/src/Makefile.in
index 722802462..7304ef7b6 100644
--- a/driver/xf86-video-apm/src/Makefile.in
+++ b/driver/xf86-video-apm/src/Makefile.in
@@ -34,6 +34,12 @@
# 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.
+# this is obnoxious:
+# -module lets us name the module exactly how we want
+# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
+# _ladir passes a dummy rpath to libtool so the thing will actually link
+# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
@@ -56,7 +62,6 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-@XF86RUSH_TRUE@am__append_1 = apm_rush.c
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -76,12 +81,8 @@ am__installdirs = "$(DESTDIR)$(apm_drv_ladir)"
apm_drv_laLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(apm_drv_la_LTLIBRARIES)
apm_drv_la_LIBADD =
-am__apm_drv_la_SOURCES_DIST = apm_accel.c apm_cursor.c apm_dga.c \
- apm_driver.c apm.h apm_i2c.c apm_regs.h apm_pcirename.h \
- apm_rush.c
-@XF86RUSH_TRUE@am__objects_1 = apm_rush.lo
am_apm_drv_la_OBJECTS = apm_accel.lo apm_cursor.lo apm_dga.lo \
- apm_driver.lo apm_i2c.lo $(am__objects_1)
+ apm_driver.lo apm_i2c.lo
apm_drv_la_OBJECTS = $(am_apm_drv_la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@@ -95,7 +96,7 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(apm_drv_la_SOURCES)
-DIST_SOURCES = $(am__apm_drv_la_SOURCES_DIST)
+DIST_SOURCES = $(apm_drv_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -105,6 +106,7 @@ ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
@@ -112,15 +114,13 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@
-BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@
-BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@
-BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
+CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
+CWARNFLAGS = @CWARNFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -145,7 +145,7 @@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
HAVE_XEXTPROTO_71_FALSE = @HAVE_XEXTPROTO_71_FALSE@
HAVE_XEXTPROTO_71_TRUE = @HAVE_XEXTPROTO_71_TRUE@
-INCLUDES = @INCLUDES@
+INSTALL_CMD = @INSTALL_CMD@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -156,17 +156,13 @@ LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
-LINUXDOC = @LINUXDOC@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MAKE_HTML = @MAKE_HTML@
-MAKE_PDF = @MAKE_PDF@
-MAKE_PS = @MAKE_PS@
-MAKE_TEXT = @MAKE_TEXT@
+MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
NMEDIT = @NMEDIT@
@@ -181,7 +177,6 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
PCIACCESS_LIBS = @PCIACCESS_LIBS@
PKG_CONFIG = @PKG_CONFIG@
-PS2PDF = @PS2PDF@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -190,12 +185,9 @@ STRIP = @STRIP@
VERSION = @VERSION@
XEXT_CFLAGS = @XEXT_CFLAGS@
XEXT_LIBS = @XEXT_LIBS@
-XF86RUSH_CFLAGS = @XF86RUSH_CFLAGS@
-XF86RUSH_FALSE = @XF86RUSH_FALSE@
-XF86RUSH_LIBS = @XF86RUSH_LIBS@
-XF86RUSH_TRUE = @XF86RUSH_TRUE@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_LIBS = @XORG_LIBS@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
@@ -244,21 +236,23 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-
-# this is obnoxious:
-# -module lets us name the module exactly how we want
-# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
-# _ladir passes a dummy rpath to libtool so the thing will actually link
-# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
+AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS)
apm_drv_la_LTLIBRARIES = apm_drv.la
apm_drv_la_LDFLAGS = -module -avoid-version
apm_drv_ladir = @moduledir@/drivers
-apm_drv_la_SOURCES = apm_accel.c apm_cursor.c apm_dga.c apm_driver.c \
- apm.h apm_i2c.c apm_regs.h apm_pcirename.h $(am__append_1)
+apm_drv_la_SOURCES = \
+ apm_accel.c \
+ apm_cursor.c \
+ apm_dga.c \
+ apm_driver.c \
+ apm.h \
+ apm_i2c.c \
+ apm_regs.h \
+ apm_pcirename.h
+
EXTRA_DIST = \
apm_funcs.c \
- apm_video.c \
- apm_rush.c
+ apm_video.c
all: all-am
@@ -273,9 +267,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/Makefile
+ $(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -334,7 +328,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_dga.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_driver.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_i2c.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apm_rush.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
diff --git a/driver/xf86-video-apm/src/apm.h b/driver/xf86-video-apm/src/apm.h
index c57e9ba2b..bc6671474 100644
--- a/driver/xf86-video-apm/src/apm.h
+++ b/driver/xf86-video-apm/src/apm.h
@@ -20,20 +20,9 @@
/* All drivers using the vgahw module need this */
#include "vgaHW.h"
-/* Drivers using the mi banking wrapper need this */
-#include "mibank.h"
-
/* All drivers using the mi colormap manipulation need this */
#include "micmap.h"
-/* Needed for the 1 and 4 bpp framebuffers */
-#ifdef HAVE_XF1BPP
-#include "xf1bpp.h"
-#endif
-#ifdef HAVE_XF4BPP
-#include "xf4bpp.h"
-#endif
-
#include "fb.h"
/* Drivers using the XAA interface ... */
diff --git a/driver/xf86-video-apm/src/apm_driver.c b/driver/xf86-video-apm/src/apm_driver.c
index 8dc3b3ef5..f172bab83 100644
--- a/driver/xf86-video-apm/src/apm_driver.c
+++ b/driver/xf86-video-apm/src/apm_driver.c
@@ -89,13 +89,6 @@ static PciChipsets ApmPciChipsets[] = {
{ -1, -1, RES_UNDEFINED }
};
-#ifdef HAVE_ISA
-static IsaChipsets ApmIsaChipsets[] = {
- { PCI_CHIP_AP6422, RES_EXCLUSIVE_VGA},
- {-1, RES_UNDEFINED}
-};
-#endif
-
typedef enum {
OPTION_SET_MCLK,
OPTION_SW_CURSOR,
@@ -236,57 +229,6 @@ ApmAvailableOptions(int chipid, int busid)
return ApmOptions;
}
-#ifdef HAVE_ISA
-static int
-ApmFindIsaDevice(GDevPtr dev)
-{
- char save = rdinx(0x3C4, 0x10);
- int i;
- int apmChip = -1;
-
- /*
- * Start by probing the VGA chipset.
- */
- outw(0x3C4, 0x1210);
- if (rdinx(0x3C4, 0x11) == 'P' && rdinx(0x3C4, 0x12) == 'r' &&
- rdinx(0x3C4, 0x13) == 'o') {
- char id_ap6420[] = "6420";
- char id_ap6422[] = "6422";
- char id_at24[] = "6424";
- char id_at3d[] = "AT3D";
- char idstring[] = " ";
-
- /*
- * Must be an Alliance !!!
- */
- for (i = 0; i < 4; i++)
- idstring[i] = rdinx(0x3C4, 0x14 + i);
- if (!memcmp(id_ap6420, idstring, 4) ||
- !memcmp(id_ap6422, idstring, 4))
- apmChip = AP6422;
- else if (!memcmp(id_at24, idstring, 4))
- apmChip = AT24;
- else if (!memcmp(id_at3d, idstring, 4))
- apmChip = AT3D;
- if (apmChip >= 0) {
- int apm_xbase;
-
- apm_xbase = (rdinx(0x3C4, 0x1F) << 8) | rdinx(0x3C4, 0x1E);
-
- if (!(wrinx(0x3C4, 0x1D, 0xCA >> 2), inb(apm_xbase + 2))) {
- /*
- * TODO Not PCI
- */
- }
-
- }
- }
- wrinx(0x3C4, 0x10, save);
-
- return apmChip;
-}
-#endif
-
static void
ApmAssignFPtr(ScrnInfoPtr pScrn)
{
@@ -357,28 +299,6 @@ ApmProbe(DriverPtr drv, int flags)
}
}
-#ifdef HAVE_ISA
- /* Check for non-PCI cards */
- numUsed = xf86MatchIsaInstances(APM_NAME, ApmChipsets,
- ApmIsaChipsets, drv, ApmFindIsaDevice, DevSections,
- numDevSections, &usedChips);
- if (numUsed > 0) {
- if (flags & PROBE_DETECT)
- foundScreen = TRUE;
- else for (i = 0; i < numUsed; i++) {
- ScrnInfoPtr pScrn = NULL;
- if ((pScrn = xf86ConfigIsaEntity(pScrn, 0, usedChips[i],
- ApmIsaChipsets, NULL, NULL, NULL,
- NULL, NULL))) {
- /*
- * Fill in what we can of the ScrnInfoRec
- */
- ApmAssignFPtr(pScrn);
- foundScreen = TRUE;
- }
- }
- }
-#endif
xfree(DevSections);
return foundScreen;
@@ -1072,18 +992,6 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags)
/* Load bpp-specific modules */
switch (pScrn->bitsPerPixel) {
-#ifdef HAVE_XF1BPP
- case 1:
- mod = "xf1bpp";
- req = "xf1bppScreenInit";
- break;
-#endif
-#ifdef HAVE_XF4BPP
- case 4:
- mod = "xf4bpp";
- req = "xf4bppScreenInit";
- break;
-#endif
case 8:
case 16:
case 24:
@@ -1899,22 +1807,6 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
miSetPixmapDepths();
switch (pScrn->bitsPerPixel) {
-#ifdef HAVE_XF1BPP
- case 1:
- ret = xf1bppScreenInit(pScreen, FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
-#endif
-#ifdef HAVE_XF4BPP
- case 4:
- ret = xf4bppScreenInit(pScreen, FbBase,
- pScrn->virtualX, pScrn->virtualY,
- pScrn->xDpi, pScrn->yDpi,
- pScrn->displayWidth);
- break;
-#endif
case 8:
case 16:
case 24:
diff --git a/driver/xf86-video-apm/src/apm_rush.c b/driver/xf86-video-apm/src/apm_rush.c
deleted file mode 100644
index 47645d616..000000000
--- a/driver/xf86-video-apm/src/apm_rush.c
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * Copyright Loïc Grenié 1999
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "apm.h"
-#include "xaalocal.h"
-
-extern DriverRec APM;
-
-static Bool RushDestroyPixmap(PixmapPtr);
-static __inline__ void __xf86UnlockPixmap(ApmPtr, PixmapLinkPtr);
-static int xf86RushLockPixmap(int, PixmapPtr);
-static void xf86RushUnlockPixmap(int, PixmapPtr);
-static void xf86RushUnlockAllPixmaps(void);
-
-static Bool RushDestroyPixmap(PixmapPtr pPix)
-{
- APMDECL(xf86Screens[pPix->drawable.pScreen->myNum]);
- ApmPixmapPtr pPriv = APM_GET_PIXMAP_PRIVATE(pPix);
-
- if (pPriv->num)
- pApm->RushY[pPriv->num - 1] = 0;
- return (*pApm->DestroyPixmap)(pPix);
-}
-
-static PixmapPtr RushCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
-{
- APMDECL(xf86Screens[pScreen->myNum]);
- PixmapPtr pPix = (*pApm->CreatePixmap)(pScreen, w, h, depth);
- ApmPixmapPtr pPriv = APM_GET_PIXMAP_PRIVATE(pPix);
-
- bzero(pPriv, sizeof(*pPriv));
- return pPix;
-}
-
-static int
-xf86RushLockPixmap(int scrnIndex, PixmapPtr pix)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- APMDECL(pScrn);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- ApmPixmapPtr pApmPriv = APM_GET_PIXMAP_PRIVATE(pix);
- XAAPixmapPtr pXAAPriv = XAA_GET_PIXMAP_PRIVATE(pix);
- FBAreaPtr area = pXAAPriv->offscreenArea;
- int p2, width = (pScrn->displayWidth * pScrn->bitsPerPixel) / 8;
-
- if (pScrn->drv != &APM || pApm->Chipset != AT3D)
- return 0;
- pApm->apmLock = TRUE;
- pApmPriv->num = 0;
- if (area && pApm->pixelStride) {
- if (area->RemoveAreaCallback) {
- (*area->RemoveAreaCallback)(area);
- xf86FreeOffscreenArea(area);
- area = NULL;
- }
- else
- return 0;
- }
- if (area) {
- /*
- * 1) Make it unmovable so that XAA won't know we're playing
- * with the cache.
- * 2) Play musical chairs if needed.
- */
- pApmPriv->MoveAreaCallback = area->MoveAreaCallback;
- area->MoveAreaCallback = NULL;
- pApmPriv->RemoveAreaCallback = area->RemoveAreaCallback;
- area->RemoveAreaCallback = NULL;
- pApmPriv->devPriv = area->devPrivate.ptr;
- }
- else {
- pApmPriv->MoveAreaCallback = NULL;
- pApmPriv->RemoveAreaCallback = NULL;
- pApmPriv->devPriv = NULL;
- }
- if (pApm->pixelStride || !area ||
- (((pix->drawable.x + pScrn->displayWidth * pix->drawable.y) *
- pScrn->bitsPerPixel) & 32767)) {
- int p1, i;
-
- /*
- * Not aligned on a 4KB boundary, need to move it around.
- */
- if (area)
- xf86FreeOffscreenArea(area);
- if (pApm->pixelStride) {
- area = xf86AllocateLinearOffscreenArea(pScrn->pScreen,
- ((pix->drawable.width * pix->drawable.height *
- pix->drawable.depth) / pScrn->bitsPerPixel) +
- 4095,
- pScrn->displayWidth, NULL, NULL, NULL);
- if (!area) {
- xf86PurgeUnlockedOffscreenAreas(pScrn->pScreen);
- area = xf86AllocateLinearOffscreenArea(pScrn->pScreen,
- ((pix->drawable.width * pix->drawable.height *
- pix->drawable.depth) / pScrn->bitsPerPixel) +
- 4095,
- pScrn->displayWidth, NULL, NULL, NULL);
- }
- if (area) {
- if (!pApmPriv->devPriv) {
- PixmapLinkPtr pLink;
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pScreenPix;
-
- pLink = xalloc(sizeof(PixmapLink));
- if (!pLink) {
- xf86FreeOffscreenArea(area);
- return 0;
- }
- pXAAPriv->flags |= OFFSCREEN;
- pix->devKind = pApm->pixelStride;
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
- pix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
- pLink->next = infoRec->OffscreenPixmaps;
- pLink->pPix = pix;
- infoRec->OffscreenPixmaps = pLink;
- }
- for (i = 0; i < 7; i++)
- if (!pApm->RushY[i])
- break;
- pApmPriv->num = i + 1;
- pix->drawable.y = area->box.y1 + (i+1)*pApm->CurrentLayout.Scanlines;
- pApm->RushY[i] = area->box.y1;
- pix->drawable.x = (32768 - (((area->box.x1 + pScrn->displayWidth * area->box.y1) * pScrn->bitsPerPixel) & 32767)) / pApm->CurrentLayout.bitsPerPixel;
- if (pix->drawable.x == 32768 / pApm->CurrentLayout.bitsPerPixel)
- pix->drawable.x = 0;
- }
- }
- else {
- p2 = 1;
- while (!(p2 & width))
- p2 *= 2;
- p1 = 4096 / p2 - 1;
- switch(pScrn->bitsPerPixel) {
- case 16:
- p2 /= 2;
- break;
- case 32:
- p2 /= 4;
- break;
- }
- area = xf86AllocateOffscreenArea(pScrn->pScreen,
- (pix->drawable.width * pix->drawable.bitsPerPixel) /
- pScrn->bitsPerPixel,
- pix->drawable.height + p1,
- p2, NULL, NULL, pApmPriv->devPriv);
- if (!area) {
- xf86PurgeUnlockedOffscreenAreas(pScrn->pScreen);
- area = xf86AllocateOffscreenArea(pScrn->pScreen,
- (pix->drawable.width * pix->drawable.bitsPerPixel) /
- pScrn->bitsPerPixel,
- pix->drawable.height + p1,
- p2, NULL, NULL, pApmPriv->devPriv);
- }
- if (area) {
- int devKind = (pScrn->bitsPerPixel * pScrn->displayWidth) / 8;
- int off = devKind * p1, h;
- int goal = (-area->box.x1 * (pScrn->bitsPerPixel >> 3) - area->box.y1 * devKind) & 4095;
-
- if (!pApmPriv->devPriv) {
- PixmapLinkPtr pLink;
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pScreenPix;
-
- pLink = xalloc(sizeof(PixmapLink));
- if (!pLink) {
- xf86FreeOffscreenArea(area);
- return 0;
- }
- pXAAPriv->flags |= OFFSCREEN;
- pix->devKind = pApm->CurrentLayout.bytesPerScanline;
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
- pix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
- pLink->next = infoRec->OffscreenPixmaps;
- pLink->pPix = pix;
- infoRec->OffscreenPixmaps = pLink;
- }
- pix->drawable.x = area->box.x1;
- for (h = p1; h >= 0; h--, off -= devKind)
- if ((off & 4095) == goal)
- break;
- for (i = 0; i < 7; i++)
- if (!pApm->RushY[i])
- break;
- pApmPriv->num = i + 1;
- pix->drawable.y = area->box.y1 + h + (i+1)*pApm->CurrentLayout.Scanlines;
- pApm->RushY[i] = area->box.y1 + h;
- }
- }
- if (!area && (pXAAPriv->flags & OFFSCREEN)) {
- /*
- * Failed, return the old one
- */
- switch(pScrn->bitsPerPixel) {
- case 24:
- case 8: p2 = 4; break;
- case 16: p2 = 2; break;
- case 32: p2 = 1; break;
- default: p2 = 0; break;
- }
- pXAAPriv->offscreenArea =
- area = xf86AllocateOffscreenArea(pScrn->pScreen,
- pix->drawable.width, pix->drawable.height,
- p2,
- pApmPriv->MoveAreaCallback,
- pApmPriv->RemoveAreaCallback,
- pApmPriv->devPriv);
- /* The allocate can not fail: we just removed the old one. */
- pix->drawable.x = area->box.x1;
- pix->drawable.y = area->box.y1;
- }
- if (!area)
- return 0;
- pXAAPriv->offscreenArea = area;
- }
- return pApm->LinAddress +
- ((pix->drawable.x + pScrn->displayWidth *
- (pix->drawable.y % pApm->CurrentLayout.Scanlines)) * pApm->CurrentLayout.bitsPerPixel) / 8;
-}
-
-static __inline__ void
-__xf86UnlockPixmap(ApmPtr pApm, PixmapLinkPtr pLink)
-{
- PixmapPtr pix = pLink->pPix;
- ApmPixmapPtr pApmPriv = APM_GET_PIXMAP_PRIVATE(pix);
- XAAPixmapPtr pXAAPriv = XAA_GET_PIXMAP_PRIVATE(pix);
- FBAreaPtr area = pXAAPriv->offscreenArea;
- int i;
-
- if (!area)
- area = pLink->area;
- if ((pXAAPriv->flags & OFFSCREEN) && !area->MoveAreaCallback && !area->RemoveAreaCallback) {
- area->MoveAreaCallback = pApmPriv->MoveAreaCallback;
- area->RemoveAreaCallback = pApmPriv->RemoveAreaCallback;
- area->devPrivate.ptr = pApmPriv->devPriv;
- }
- i = pApmPriv->num;
- if (i) {
- pApm->RushY[i - 1] = 0;
- pix->drawable.y %= pApm->CurrentLayout.Scanlines;
- }
-}
-
-static void
-xf86RushUnlockPixmap(int scrnIndex, PixmapPtr pix)
-{
- APMDECL(xf86Screens[scrnIndex]);
- PixmapLinkPtr pLink = GET_XAAINFORECPTR_FROM_SCREEN(xf86Screens[scrnIndex]->pScreen)->OffscreenPixmaps;
-
- if (xf86Screens[scrnIndex]->drv != &APM || pApm->Chipset != AT3D)
- return;
- if (pApm->apmLock) {
- /*
- * This is just an attempt, because Daryll is tampering with MY
- * registers.
- */
- if (!pApm->noLinear) {
- CARD8 db;
-
- db = RDXB(0xDB);
- WRXB(0xDB, (db & 0xF4) | 0x0A);
- ApmWriteSeq(0x1B, 0x20);
- ApmWriteSeq(0x1C, 0x2F);
- }
- else {
- CARD8 db;
-
- db = RDXB_IOP(0xDB);
- WRXB_IOP(0xDB, (db & 0xF4) | 0x0A);
- wrinx(pApm->xport, 0x1B, 0x20);
- wrinx(pApm->xport, 0x1C, 0x2F);
- }
- pApm->apmLock = FALSE;
- }
- while (pLink && pLink->pPix != pix)
- pLink = pLink->next;
- if (pLink)
- __xf86UnlockPixmap(pApm, pLink);
-}
-
-static void
-xf86RushUnlockAllPixmaps()
-{
- int scrnIndex;
-
- for (scrnIndex = 0; scrnIndex < screenInfo.numScreens; scrnIndex++) {
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- APMDECL(pScrn);
- PixmapLinkPtr pLink = GET_XAAINFORECPTR_FROM_SCREEN(pScrn->pScreen)->OffscreenPixmaps;
-
- if (pScrn->drv != &APM || pApm->Chipset != AT3D)
- continue;
- while(pLink) {
- __xf86UnlockPixmap(pApm, pLink);
- pLink = pLink->next;
- }
- }
-}
-
-/*
-
-Copyright (c) 1998 Daryll Strauss
-
-*/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "scrnintstr.h"
-#define _XF86RUSH_SERVER_
-#include <X11/extensions/xf86rushstr.h>
-
-static unsigned char RushReqCode = 0;
-static int RushErrorBase;
-
-static DISPATCH_PROC(ProcXF86RushDispatch);
-static DISPATCH_PROC(ProcXF86RushQueryVersion);
-static DISPATCH_PROC(ProcXF86RushLockPixmap);
-static DISPATCH_PROC(ProcXF86RushUnlockPixmap);
-static DISPATCH_PROC(ProcXF86RushUnlockAllPixmaps);
-static DISPATCH_PROC(ProcXF86RushSetCopyMode);
-#if 0
-static DISPATCH_PROC(ProcXF86RushSetPixelStride);
-#endif
-static DISPATCH_PROC(ProcXF86RushOverlayPixmap);
-static DISPATCH_PROC(ProcXF86RushStatusRegOffset);
-static DISPATCH_PROC(ProcXF86RushAT3DEnableRegs);
-static DISPATCH_PROC(ProcXF86RushAT3DDisableRegs);
-
-static int rush_ext_generation = -1;
-
-static DISPATCH_PROC(SProcXF86RushDispatch);
-
-static void XF86RushResetProc(ExtensionEntry* extEntry);
-
-void
-XFree86RushExtensionInit(ScreenPtr pScreen)
-{
- ExtensionEntry* extEntry;
-
-#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- return;
-#endif
- if (rush_ext_generation == serverGeneration) {
- if (xf86Screens[pScreen->myNum]->drv == &APM &&
- APMPTR(xf86Screens[pScreen->myNum])->Chipset == AT3D) {
- pScreen->CreatePixmap = RushCreatePixmap;
- pScreen->DestroyPixmap = RushDestroyPixmap;
- }
- return;
- }
- rush_ext_generation = serverGeneration;
- if ((extEntry = AddExtension(XF86RUSHNAME,
- XF86RushNumberEvents,
- XF86RushNumberErrors,
- ProcXF86RushDispatch,
- SProcXF86RushDispatch,
- XF86RushResetProc,
- StandardMinorOpcode))) {
- RushReqCode = (unsigned char)extEntry->base;
- RushErrorBase = extEntry->errorBase;
- if (xf86Screens[pScreen->myNum]->drv == &APM &&
- APMPTR(xf86Screens[pScreen->myNum])->Chipset == AT3D) {
- pScreen->CreatePixmap = RushCreatePixmap;
- pScreen->DestroyPixmap = RushDestroyPixmap;
- }
- }
- else {
- pScreen->CreatePixmap = APMPTR(xf86Screens[pScreen->myNum])->CreatePixmap;
- pScreen->DestroyPixmap = APMPTR(xf86Screens[pScreen->myNum])->DestroyPixmap;
- }
-}
-
-/*ARGSUSED*/
-static void
-XF86RushResetProc (ExtensionEntry *extEntry)
-{
-}
-
-static int
-ProcXF86RushQueryVersion(register ClientPtr client)
-{
- xXF86RushQueryVersionReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH(xXF86RushQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XF86RUSH_MAJOR_VERSION;
- rep.minorVersion = XF86RUSH_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length, n);
- }
- WriteToClient(client, sz_xXF86RushQueryVersionReply, (char *)&rep);
- return (client->noClientException);
-}
-
-static int
-ProcXF86RushLockPixmap(register ClientPtr client)
-{
- REQUEST(xXF86RushLockPixmapReq);
- xXF86RushLockPixmapReply rep;
- PixmapPtr pix;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86RushLockPixmapReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- pix = (PixmapPtr)SecurityLookupIDByType(client,
- stuff->pixmap, RT_PIXMAP,
- DixReadAccess);
- rep.addr = xf86RushLockPixmap(stuff->screen, pix);
-
- WriteToClient(client, SIZEOF(xXF86RushLockPixmapReply), (char*)&rep);
- return client->noClientException;
-}
-
-static int
-ProcXF86RushUnlockPixmap(register ClientPtr client)
-{
- REQUEST(xXF86RushUnlockPixmapReq);
- PixmapPtr pix;
-
- if (stuff->screen > screenInfo.numScreens)
- return BadValue;
-
- REQUEST_SIZE_MATCH(xXF86RushUnlockPixmapReq);
- pix = (PixmapPtr)SecurityLookupIDByType(client,
- stuff->pixmap, RT_PIXMAP,
- DixReadAccess);
- xf86RushUnlockPixmap(stuff->screen, pix);
- return client->noClientException;
-}
-
-static int
-ProcXF86RushUnlockAllPixmaps(register ClientPtr client)
-{
-
- REQUEST_SIZE_MATCH(xXF86RushUnlockAllPixmapsReq);
- xf86RushUnlockAllPixmaps();
- return client->noClientException;
-}
-
-static int
-ProcXF86RushSetCopyMode(register ClientPtr client)
-{
- REQUEST(xXF86RushSetCopyModeReq);
-
- REQUEST_SIZE_MATCH(xXF86RushSetCopyModeReq);
- APMPTR(xf86Screens[stuff->screen])->CopyMode = stuff->CopyMode;
- return client->noClientException;
-}
-
-#if 0
-static int
-ProcXF86RushSetPixelStride(register ClientPtr client)
-{
- REQUEST(xXF86RushSetPixelStrideReq);
-
- REQUEST_SIZE_MATCH(xXF86RushSetPixelStrideReq);
- APMPTR(xf86Screens[stuff->screen])->pixelStride = stuff->PixelStride;
- return client->noClientException;
-}
-#endif
-
-int
-ProcXF86RushDispatch (register ClientPtr client)
-{
- REQUEST(xReq);
-
- if (!LocalClient(client))
- return RushErrorBase + XF86RushClientNotLocal;
-
- switch (stuff->data)
- {
- case X_XF86RushQueryVersion:
- return ProcXF86RushQueryVersion(client);
- case X_XF86RushLockPixmap:
- return ProcXF86RushLockPixmap(client);
- case X_XF86RushUnlockPixmap:
- return ProcXF86RushUnlockPixmap(client);
- case X_XF86RushUnlockAllPixmaps:
- return ProcXF86RushUnlockAllPixmaps(client);
- case X_XF86RushSetCopyMode:
- return ProcXF86RushSetCopyMode(client);
-#if 0
- case X_XF86RushSetPixelStride:
- return ProcXF86RushSetPixelStride(client);
-#endif
- case X_XF86RushOverlayPixmap:
- return ProcXF86RushOverlayPixmap(client);
- case X_XF86RushStatusRegOffset:
- return ProcXF86RushStatusRegOffset(client);
- case X_XF86RushAT3DEnableRegs:
- return ProcXF86RushAT3DEnableRegs(client);
- case X_XF86RushAT3DDisableRegs:
- return ProcXF86RushAT3DDisableRegs(client);
- default:
- return BadRequest;
- }
-}
-
-int
-SProcXF86RushDispatch (register ClientPtr client)
-{
- return RushErrorBase + XF86RushClientNotLocal;
-}
-
-#include "xvdix.h"
-/*
- * The one below is just a subtle modification of ProcXvShmPutImage
- */
-
-static int
-ProcXF86RushOverlayPixmap(ClientPtr client)
-{
- DrawablePtr pDraw;
- ScrnInfoPtr pScrn;
- PixmapPtr pPixmap;
- XvPortPtr pPort;
- XvImagePtr pImage = NULL;
- GCPtr pGC;
- int status, i;
- unsigned char *offset;
- ApmPtr pApm;
- ApmPixmapPtr pPriv;
- REQUEST(xXF86RushOverlayPixmapReq);
-
- REQUEST_SIZE_MATCH(xXF86RushOverlayPixmapReq);
-
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
-
- pScrn = xf86Screens[pDraw->pScreen->myNum];
- pApm = APMPTR(pScrn);
- if (pScrn->drv != &APM || pApm->Chipset != AT3D)
- return (_XvBadPort);
-
- if(!(pPort = LOOKUP_PORT(stuff->port, client) )) {
- client->errorValue = stuff->port;
- return (_XvBadPort);
- }
-
- if (pPort->id != stuff->port) {
- if ((status = (*pPort->pAdaptor->ddAllocatePort)(stuff->port, pPort, &pPort)) != Success) {
- client->errorValue = stuff->port;
- return (status);
- }
- }
-
- if (!(pPort->pAdaptor->type & XvImageMask) ||
- !(pPort->pAdaptor->type & XvInputMask)) {
- client->errorValue = stuff->port;
- return (BadMatch);
- }
-
- status = XvdiMatchPort(pPort, pDraw);
- if (status != Success)
- return status;
-
- pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
- stuff->pixmap, RT_PIXMAP,
- DixReadAccess);
- if (!pPixmap) {
- client->errorValue = stuff->pixmap;
- return (BadPixmap);
- }
- status = XvdiMatchPort(pPort, (DrawablePtr)pPixmap);
- if (status != Success)
- return status;
- pPriv = APM_GET_PIXMAP_PRIVATE(pPixmap);
- pApm = APMPTR(pScrn);
- if (pPriv->num == 0) {
- client->errorValue = stuff->pixmap;
- return (BadMatch);
- }
- offset = (unsigned char *)pApm->FbBase +
- pApm->RushY[pPriv->num - 1] * pApm->CurrentLayout.bytesPerScanline +
- pPixmap->drawable.x * pScrn->bitsPerPixel / 8;
-
- for(i = 0; i < pPort->pAdaptor->nImages; i++) {
- if(pPort->pAdaptor->pImages[i].id == stuff->id) {
- pImage = &(pPort->pAdaptor->pImages[i]);
- break;
- }
- }
-
- if(!pImage)
- return BadMatch;
-
- pApm->PutImageStride = pPixmap->devKind;
- status = XvdiPutImage(client, pDraw, pPort, pGC,
- stuff->src_x, stuff->src_y,
- stuff->src_w, stuff->src_h,
- stuff->drw_x, stuff->drw_y,
- stuff->drw_w, stuff->drw_h,
- pImage, offset, TRUE,
- pPixmap->drawable.width,
- pPixmap->drawable.height);
- pApm->PutImageStride = 0;
-
- return status;
-}
-
-static int
-ProcXF86RushStatusRegOffset(ClientPtr client)
-{
- int scrnIndex;
- ScrnInfoPtr pScrn;
- ApmPtr pApm;
- REQUEST(xXF86RushStatusRegOffsetReq);
- xXF86RushStatusRegOffsetReply rep;
- register int n;
-
- REQUEST_SIZE_MATCH(xXF86RushStatusRegOffsetReq);
- scrnIndex = stuff->screen;
- if (scrnIndex < 0 || scrnIndex > screenInfo.numScreens)
- return BadValue;
- pScrn = xf86Screens[scrnIndex];
- pApm = APMPTR(pScrn);
- if (pScrn->drv != &APM || pApm->Chipset != AT3D)
- return BadMatch;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.offset = 0xFFEDF4;
- if (client->swapped) {
- swapl(&rep.offset, n);
- }
- WriteToClient(client, sz_xXF86RushStatusRegOffsetReply, (char *)&rep);
-
- return client->noClientException;
-}
-
-static int
-ProcXF86RushAT3DEnableRegs(ClientPtr client)
-{
- u32 db, tmp;
- int scrnIndex;
- ScrnInfoPtr pScrn;
- ApmPtr pApm;
- REQUEST(xXF86RushAT3DEnableRegsReq);
-
- REQUEST_SIZE_MATCH(xXF86RushAT3DEnableRegsReq);
- scrnIndex = stuff->screen;
- if (scrnIndex < 0 || scrnIndex > screenInfo.numScreens)
- return BadValue;
- pScrn = xf86Screens[scrnIndex];
- pApm = APMPTR(pScrn);
- if (pScrn->drv != &APM || pApm->Chipset != AT3D)
- return BadMatch;
- pApm->Rush = 0x04;
- if (!pApm->noLinear) {
- db = RDXL(0xDB);
- WRXL(0xDB, db | 0x04);
- WRXB(0x110, 0x03);
- tmp = RDXB(0x1F0);
- WRXB(0x1F0, tmp | 0xD0);
- tmp = RDXB(0x1F1);
- WRXB(0x1F1, (tmp & ~0xC0) | 0x10);
- tmp = RDXB(0x1F2);
- WRXB(0x1F2, tmp | 0x10);
- }
- else {
- db = RDXL(0xDB);
- WRXL_IOP(0xDB, db | 0x04);
- WRXB_IOP(0x110, 0x03);
- tmp = RDXB_IOP(0x1F0);
- WRXB_IOP(0x1F0, tmp | 0xD0);
- tmp = RDXB_IOP(0x1F1);
- WRXB_IOP(0x1F1, (tmp & ~0xC0) | 0x10);
- tmp = RDXB_IOP(0x1F2);
- WRXB_IOP(0x1F2, tmp | 0x10);
- }
-
- return client->noClientException;
-}
-
-static int
-ProcXF86RushAT3DDisableRegs(ClientPtr client)
-{
- u32 db, tmp;
- int scrnIndex;
- ScrnInfoPtr pScrn;
- ApmPtr pApm;
- REQUEST(xXF86RushAT3DDisableRegsReq);
-
- REQUEST_SIZE_MATCH(xXF86RushAT3DDisableRegsReq);
- scrnIndex = stuff->screen;
- if (scrnIndex < 0 || scrnIndex > screenInfo.numScreens)
- return BadValue;
- pScrn = xf86Screens[scrnIndex];
- pApm = APMPTR(pScrn);
- if (pScrn->drv != &APM || pApm->Chipset != AT3D)
- return BadMatch;
- if (!pApm->noLinear) {
- tmp = RDXB(0x1F2);
- WRXB(0x1F2, tmp & ~0x10);
- tmp = RDXB(0x1F0);
- WRXB(0x1F0, tmp & ~0xD0);
- WRXB(0x110, 0);
- pApm->Rush = 0x00;
- db = RDXL(0xDB);
- WRXL(0xDB, db & ~0x04);
- }
- else {
- tmp = RDXB_IOP(0x1F2);
- WRXB_IOP(0x1F2, tmp & ~0x10);
- tmp = RDXB_IOP(0x1F0);
- WRXB_IOP(0x1F0, tmp & ~0xD0);
- WRXB_IOP(0x110, 0);
- pApm->Rush = 0x00;
- db = RDXL_IOP(0xDB);
- WRXL_IOP(0xDB, db & ~0x04);
- }
-
- return client->noClientException;
-}