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.
This commit is contained in:
Keith Packard 2005-02-08 22:43:54 +00:00
parent 70d3a9192f
commit db2c83551c
12 changed files with 174 additions and 58 deletions

View File

@ -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));

View File

@ -47,7 +47,7 @@ InitInput (int argc, char **argv)
{
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
#ifdef TOUCHSCREEN
KdInitTouchScreen (&TsFuncs);
KdAddMouseDriver (&TsFuncs);
#endif
}

View File

@ -52,7 +52,7 @@ InitInput (int argc, char **argv)
{
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
#ifdef TOUCHSCREEN
KdInitTouchScreen (&TsFuncs);
KdAddMouseDriver (&TsFuncs);
#endif
}

View File

@ -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) \

View File

@ -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);

View File

@ -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

View File

@ -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.

View File

@ -53,7 +53,7 @@ InitInput (int argc, char **argv)
{
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
#ifdef TOUCHSCREEN
KdInitTouchScreen (&TsFuncs);
KdAddMouseDriver (&TsFuncs);
#endif
}

View File

@ -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);

View File

@ -1,5 +1,5 @@
/*
* $RCSId$
* $RCSId: $
*
* Copyright © 2001 Keith Packard
*

View File

@ -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;

View File

@ -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;
}
@ -578,6 +569,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
*