diff options
author | Keith Packard <keithp@keithp.com> | 2005-02-08 22:43:54 +0000 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2005-02-08 22:43:54 +0000 |
commit | db2c83551cd3516800b88784c461fb33ee15aacf (patch) | |
tree | de3e28f129911c4de73eeb5dfff325d7fb9b6994 /hw/kdrive | |
parent | 70d3a9192feefd54be93ea71231574c3ed815bf2 (diff) |
hw/kdrive/ati/radeon_composite.c Support linear filtering
Change how touch screens work -- make them just another 'mouse' device. Add
unfinished (and unused) code to accelerate tiled fills.
Diffstat (limited to 'hw/kdrive')
-rw-r--r-- | hw/kdrive/ati/radeon_composite.c | 20 | ||||
-rw-r--r-- | hw/kdrive/fbdev/fbinit.c | 2 | ||||
-rw-r--r-- | hw/kdrive/ipaq/ipaq.c | 2 | ||||
-rw-r--r-- | hw/kdrive/linux/Makefile.am | 2 | ||||
-rw-r--r-- | hw/kdrive/linux/linux.c | 43 | ||||
-rw-r--r-- | hw/kdrive/mach64/mach64stub.c | 2 | ||||
-rw-r--r-- | hw/kdrive/neomagic/ChangeLog | 34 | ||||
-rw-r--r-- | hw/kdrive/neomagic/neomagicstub.c | 2 | ||||
-rw-r--r-- | hw/kdrive/src/kaa.c | 71 | ||||
-rw-r--r-- | hw/kdrive/src/kaa.h | 2 | ||||
-rw-r--r-- | hw/kdrive/src/kdrive.h | 9 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 43 |
12 files changed, 174 insertions, 58 deletions
diff --git a/hw/kdrive/ati/radeon_composite.c b/hw/kdrive/ati/radeon_composite.c index 19b2d25ff..cec1d8c96 100644 --- a/hw/kdrive/ati/radeon_composite.c +++ b/hw/kdrive/ati/radeon_composite.c @@ -164,7 +164,7 @@ R100TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit) { ATIScreenInfo *atis = accel_atis; KdScreenPriv(pPix->drawable.pScreen); - CARD32 txformat, txoffset, txpitch; + CARD32 txfilter, txformat, txoffset, txpitch; int w = pPict->pDrawable->width; int h = pPict->pDrawable->height; int i; @@ -196,10 +196,24 @@ R100TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit) if ((txpitch & 0x1f) != 0) ATI_FALLBACK(("Bad texture pitch 0x%x\n", txpitch)); + switch (pPict->filter) { + case PictFilterNearest: + txfilter = (RADEON_MAG_FILTER_NEAREST | + RADEON_MIN_FILTER_NEAREST); + break; + case PictFilterBilinear: + txfilter = (RADEON_MAG_FILTER_LINEAR | + RADEON_MIN_FILTER_LINEAR); + break; + default: + ATI_FALLBACK (("Bad filter 0x%x\n", pPict->filter)); + break; + } + BEGIN_DMA(7); if (unit == 0) { OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_0, 3)); - OUT_RING_REG(RADEON_REG_PP_TXFILTER_0, 0); + OUT_RING_REG(RADEON_REG_PP_TXFILTER_0, txfilter); OUT_RING_REG(RADEON_REG_PP_TXFORMAT_0, txformat); OUT_RING_REG(RADEON_REG_PP_TXOFFSET_0, txoffset); OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_0, 2)); @@ -209,7 +223,7 @@ R100TextureSetup(PicturePtr pPict, PixmapPtr pPix, int unit) OUT_RING_REG(RADEON_REG_PP_TEX_PITCH_0, txpitch - 32); } else { OUT_RING(DMA_PACKET0(RADEON_REG_PP_TXFILTER_1, 3)); - OUT_RING_REG(RADEON_REG_PP_TXFILTER_1, 0); + OUT_RING_REG(RADEON_REG_PP_TXFILTER_1, txfilter); OUT_RING_REG(RADEON_REG_PP_TXFORMAT_1, txformat); OUT_RING_REG(RADEON_REG_PP_TXOFFSET_1, txoffset); OUT_RING(DMA_PACKET0(RADEON_REG_PP_TEX_SIZE_1, 2)); diff --git a/hw/kdrive/fbdev/fbinit.c b/hw/kdrive/fbdev/fbinit.c index 097f77fe6..616b7d9e1 100644 --- a/hw/kdrive/fbdev/fbinit.c +++ b/hw/kdrive/fbdev/fbinit.c @@ -47,7 +47,7 @@ InitInput (int argc, char **argv) { KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); #ifdef TOUCHSCREEN - KdInitTouchScreen (&TsFuncs); + KdAddMouseDriver (&TsFuncs); #endif } diff --git a/hw/kdrive/ipaq/ipaq.c b/hw/kdrive/ipaq/ipaq.c index 0a2a37caa..f94b32121 100644 --- a/hw/kdrive/ipaq/ipaq.c +++ b/hw/kdrive/ipaq/ipaq.c @@ -52,7 +52,7 @@ InitInput (int argc, char **argv) { KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); #ifdef TOUCHSCREEN - KdInitTouchScreen (&TsFuncs); + KdAddMouseDriver (&TsFuncs); #endif } diff --git a/hw/kdrive/linux/Makefile.am b/hw/kdrive/linux/Makefile.am index 1edd7713f..c12adc29d 100644 --- a/hw/kdrive/linux/Makefile.am +++ b/hw/kdrive/linux/Makefile.am @@ -21,6 +21,7 @@ liblinux_a_SOURCES = \ klinux.h \ linux.c \ mouse.c \ + evdev.c \ ms.c \ ps2.c \ $(TSLIB_C) \ @@ -32,6 +33,7 @@ liblinux_a_DEPENDENCIES = \ keyboard.c \ linux.c \ mouse.c \ + evdev.c \ ms.c \ ps2.c \ $(TSLIB_C) \ diff --git a/hw/kdrive/linux/linux.c b/hw/kdrive/linux/linux.c index 23ae50452..9c06c8008 100644 --- a/hw/kdrive/linux/linux.c +++ b/hw/kdrive/linux/linux.c @@ -429,28 +429,31 @@ LinuxFini (void) } memset (&vts, '\0', sizeof (vts)); /* valgrind */ ioctl (LinuxConsoleFd, VT_GETSTATE, &vts); - /* - * Find a legal VT to switch to, either the one we started from - * or the lowest active one that isn't ours - */ - if (activeVT < 0 || - activeVT == vts.v_active || - !(vts.v_state & (1 << activeVT))) + if (vtno == vts.v_active) { - for (activeVT = 1; activeVT < 16; activeVT++) - if (activeVT != vtno && (vts.v_state & (1 << activeVT))) - break; - if (activeVT == 16) + /* + * Find a legal VT to switch to, either the one we started from + * or the lowest active one that isn't ours + */ + if (activeVT < 0 || + activeVT == vts.v_active || + !(vts.v_state & (1 << activeVT))) + { + for (activeVT = 1; activeVT < 16; activeVT++) + if (activeVT != vtno && (vts.v_state & (1 << activeVT))) + break; + if (activeVT == 16) + activeVT = -1; + } + /* + * Perform a switch back to the active VT when we were started + */ + if (activeVT >= -1) + { + ioctl (LinuxConsoleFd, VT_ACTIVATE, activeVT); + ioctl (LinuxConsoleFd, VT_WAITACTIVE, activeVT); activeVT = -1; - } - /* - * Perform a switch back to the active VT when we were started - */ - if (activeVT >= -1) - { - ioctl (LinuxConsoleFd, VT_ACTIVATE, activeVT); - ioctl (LinuxConsoleFd, VT_WAITACTIVE, activeVT); - activeVT = -1; + } } close(LinuxConsoleFd); /* make the vt-manager happy */ fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0); diff --git a/hw/kdrive/mach64/mach64stub.c b/hw/kdrive/mach64/mach64stub.c index 03d47608d..c98044ec4 100644 --- a/hw/kdrive/mach64/mach64stub.c +++ b/hw/kdrive/mach64/mach64stub.c @@ -41,6 +41,8 @@ InitCard (char *name) KdCardInfoAdd (&mach64Funcs, &attr, 0); else if (LinuxFindPci (0x1002, 0x4c46, 0, &attr)) KdCardInfoAdd (&mach64Funcs, &attr, 0); + else if (LinuxFindPci (0x1002, 0x4c42, 0, &attr)) + KdCardInfoAdd (&mach64Funcs, &attr, 0); } void diff --git a/hw/kdrive/neomagic/ChangeLog b/hw/kdrive/neomagic/ChangeLog index 2889d90f3..77d8839d8 100644 --- a/hw/kdrive/neomagic/ChangeLog +++ b/hw/kdrive/neomagic/ChangeLog @@ -1,3 +1,37 @@ +2005-02-08 Keith Packard <keithp@keithp.com> + + reviewed by: <delete if not using a buddy> + + * ChangeLog: + * neomagicstub.c: (InitInput): + +2005-02-08 Keith Packard <keithp@keithp.com> + + reviewed by: <delete if not using a buddy> + + * ChangeLog: + * neomagicstub.c: (InitInput): + +2005-02-08 Keith Packard <keithp@keithp.com> + + reviewed by: <delete if not using a buddy> + + * ChangeLog: + * neomagicstub.c: (InitInput): + +2005-02-08 Keith Packard <keithp@keithp.com> + + reviewed by: <delete if not using a buddy> + + * ChangeLog: + * neomagicstub.c: (InitInput): + +2005-02-08 Keith Packard <keithp@keithp.com> + + reviewed by: <delete if not using a buddy> + + * neomagicstub.c: (InitInput): + 2004-07-21 Phil Blundell <pb@nexus.co.uk> * Makefile.am (Xneomagic_LDADD): Include -lts if appropriate. diff --git a/hw/kdrive/neomagic/neomagicstub.c b/hw/kdrive/neomagic/neomagicstub.c index 561f04a4a..9a283afed 100644 --- a/hw/kdrive/neomagic/neomagicstub.c +++ b/hw/kdrive/neomagic/neomagicstub.c @@ -53,7 +53,7 @@ InitInput (int argc, char **argv) { KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs); #ifdef TOUCHSCREEN - KdInitTouchScreen (&TsFuncs); + KdAddMouseDriver (&TsFuncs); #endif } diff --git a/hw/kdrive/src/kaa.c b/hw/kdrive/src/kaa.c index 0aa1c19ee..6fa1d7ed0 100644 --- a/hw/kdrive/src/kaa.c +++ b/hw/kdrive/src/kaa.c @@ -384,6 +384,53 @@ kaaDrawableIsOffscreen (DrawablePtr pDrawable) return kaaPixmapIsOffscreen (pPixmap); } +#if 0 +static void +kaaFillTiled(int dst_x, + int dst_y, + int width, + int height, + int src_x, + int src_y, + int src_width, + int src_height, + void (*Copy) (int srcX, + int srcY, + int dstX, + int dstY, + int width, + int height)) +{ + modulus (src_x, src_width, src_x); + modulus (src_y, src_height, src_y); + + while (height) + { + int dst_x_tmp = dst_x; + int src_x_tmp = src_x; + int width_tmp = width; + int height_left = src_height - src_y; + int height_this = min (height, height_left); + + while (width_tmp) + { + int width_left = src_width - src_x_tmp; + int width_this = min (width_tmp, width_left); + + (*Copy) (src_x_tmp, src_y, + dst_x_tmp, dst_y, + width_this, height_this); + + width_tmp -= width_this; + dst_x_tmp += width_this; + } + height -= height_this; + dst_y += height_this; + src_y = 0; + } +} +#endif + static void kaaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n, DDXPointPtr ppt, int *pwidth, int fSorted) @@ -956,6 +1003,18 @@ kaaFillRegionSolid (DrawablePtr pDrawable, kaaDrawableDirty (pDrawable); } +#if 0 +static void +kaaFillRegionTiled (DrawablePtr pDrawable, + RegionPtr pRegion, + Pixmap pTile) +{ + else + { + KdCheckSync +} +#endif + static void kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { @@ -977,6 +1036,11 @@ kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) case BackgroundPixel: kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->background.pixel); return; +#if 0 + case BackgroundPixmap: + kaaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->background.pixmap); + return; +#endif } break; case PW_BORDER: @@ -985,6 +1049,13 @@ kaaPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) kaaFillRegionSolid((DrawablePtr)pWin, pRegion, pWin->border.pixel); return; } +#if 0 + else + { + kaaFillRegionTiled((DrawablePtr)pWin, pRegion, pWin->border.pixmap); + return; + } +#endif break; } KdCheckPaintWindow (pWin, pRegion, what); diff --git a/hw/kdrive/src/kaa.h b/hw/kdrive/src/kaa.h index cba8fb3d1..27f991742 100644 --- a/hw/kdrive/src/kaa.h +++ b/hw/kdrive/src/kaa.h @@ -1,5 +1,5 @@ /* - * $RCSId$ + * $RCSId: $ * * Copyright © 2001 Keith Packard * diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index bf542a41a..5289ae0bd 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -708,6 +708,9 @@ KdScreenInfoDispose (KdScreenInfo *si); void KdInitInput(KdMouseFuncs *, KdKeyboardFuncs *); +void +KdAddMouseDriver(KdMouseFuncs *); + int KdAllocInputType (void); @@ -722,11 +725,6 @@ KdRegisterFdEnableDisable (int fd, void KdUnregisterFds (int type, Bool do_close); -#ifdef TOUCHSCREEN -void -KdInitTouchScreen(KdMouseFuncs *pTsFuncs); -#endif - void KdEnqueueKeyboardEvent(unsigned char scan_code, unsigned char is_up); @@ -778,6 +776,7 @@ void ProcessInputEvents (void); extern KdMouseFuncs LinuxMouseFuncs; +extern KdMouseFuncs LinuxEvdevFuncs; extern KdMouseFuncs Ps2MouseFuncs; extern KdMouseFuncs BusMouseFuncs; extern KdMouseFuncs MsMouseFuncs; diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 7e49ca44c..1fc6e71d1 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -45,7 +45,10 @@ static DeviceIntPtr pKdKeyboard, pKdPointer; -static KdMouseFuncs *kdMouseFuncs; +#define MAX_MOUSE_DRIVERS 4 + +static KdMouseFuncs *kdMouseFuncs[MAX_MOUSE_DRIVERS]; +static int kdNMouseFuncs; static KdKeyboardFuncs *kdKeyboardFuncs; static int kdBellPitch; static int kdBellDuration; @@ -58,10 +61,6 @@ static KdMouseMatrix kdMouseMatrix = { { 0, 1, 0 } } }; -#ifdef TOUCHSCREEN -static KdMouseFuncs *kdTsFuncs; -#endif - int kdMouseButtonCount; int kdMinScanCode; int kdMaxScanCode; @@ -327,12 +326,8 @@ KdMouseProc(DeviceIntPtr pDevice, int onoff) case DEVICE_ON: pDev->on = TRUE; pKdPointer = pDevice; -#ifdef TOUCHSCREEN - if (kdTsFuncs) - (*kdTsFuncs->Init) (); -#endif - if (kdMouseFuncs) - (*kdMouseFuncs->Init) (); + for (i = 0; i < kdNMouseFuncs; i++) + (*kdMouseFuncs[i]->Init)(); break; case DEVICE_OFF: case DEVICE_CLOSE: @@ -340,12 +335,8 @@ KdMouseProc(DeviceIntPtr pDevice, int onoff) { pDev->on = FALSE; pKdPointer = 0; - if (kdMouseFuncs) - (*kdMouseFuncs->Fini) (); -#ifdef TOUCHSCREEN - if (kdTsFuncs) - (*kdTsFuncs->Fini) (); -#endif + for (i = 0; i < kdNMouseFuncs; i++) + (*kdMouseFuncs[i]->Fini) (); } break; } @@ -579,6 +570,13 @@ KdInitModMap (void) } void +KdAddMouseDriver(KdMouseFuncs *pMouseFuncs) +{ + if (kdNMouseFuncs < MAX_MOUSE_DRIVERS) + kdMouseFuncs[kdNMouseFuncs++] = pMouseFuncs; +} + +void KdInitInput(KdMouseFuncs *pMouseFuncs, KdKeyboardFuncs *pKeyboardFuncs) { @@ -594,7 +592,8 @@ KdInitInput(KdMouseFuncs *pMouseFuncs, kdMouseButtonCount = mi->nbutton; } - kdMouseFuncs = pMouseFuncs; + kdNMouseFuncs = 0; + KdAddMouseDriver (pMouseFuncs); kdKeyboardFuncs = pKeyboardFuncs; memset (kdKeyState, '\0', sizeof (kdKeyState)); if (kdKeyboardFuncs) @@ -629,14 +628,6 @@ KdInitInput(KdMouseFuncs *pMouseFuncs, #endif } -#ifdef TOUCHSCREEN -void -KdInitTouchScreen(KdMouseFuncs *pTsFuncs) -{ - kdTsFuncs = pTsFuncs; -} -#endif - /* * Middle button emulation state machine * |