Merge branch 'master' into XACE-SELINUX

Conflicts:

	dix/devices.c
	dix/property.c
	include/dix.h
This commit is contained in:
Eamon Walsh 2007-08-02 14:27:03 -04:00 committed by Eamon Walsh
commit e34fcd2bf4
755 changed files with 15820 additions and 5805 deletions

View file

@ -1,4 +1,4 @@
noinst_LTLIBRARIES = libfb.la libwfb.la libfbmmx.la
noinst_LTLIBRARIES = libfb.la libwfb.la
INCLUDES = \
-I$(top_srcdir)/hw/xfree86/os-support \
@ -12,25 +12,8 @@ endif
libfb_la_CFLAGS = $(AM_CFLAGS)
if MMX_CAPABLE
libfb_la_CFLAGS += -DUSE_MMX
libfbmmx_la_CFLAGS = \
$(DIX_CFLAGS) \
-DUSE_MMX \
-mmmx \
-msse \
-Winline \
--param inline-unit-growth=10000 \
--param large-function-growth=10000
endif
libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
libfbmmx_la_SOURCES = \
fbmmx.c \
fbmmx.h
libfb_la_SOURCES = \
fb.h \
fb24_32.c \
@ -73,6 +56,4 @@ libfb_la_SOURCES = \
libwfb_la_SOURCES = $(libfb_la_SOURCES)
libfb_la_LIBADD = libfbmmx.la
EXTRA_DIST = fbcmap.c fbcmap_mi.c

35
fb/fb.h
View file

@ -610,16 +610,6 @@ extern int fbGetWinPrivateIndex(void);
extern const GCOps fbGCOps;
extern const GCFuncs fbGCFuncs;
#ifdef TEKX11
#define FB_OLD_GC
#define FB_OLD_SCREEN
#endif
#ifdef FB_OLD_SCREEN
# define FB_OLD_MISCREENINIT /* miScreenInit requires 14 args, not 13 */
extern WindowPtr *WindowTable;
#endif
#ifdef FB_24_32BIT
#define FB_SCREEN_PRIVATE
#endif
@ -670,15 +660,6 @@ typedef struct {
/* private field of GC */
typedef struct {
#ifdef FB_OLD_GC
unsigned char pad1;
unsigned char pad2;
unsigned char pad3;
unsigned fExpose:1;
unsigned freeCompClip:1;
PixmapPtr pRotatedPixmap;
RegionPtr pCompositeClip;
#endif
FbBits and, xor; /* reduced rop values */
FbBits bgand, bgxor; /* for stipples */
FbBits fg, bg, pm; /* expanded and filled */
@ -691,17 +672,10 @@ typedef struct {
#define fbGetGCPrivate(pGC) ((FbGCPrivPtr)\
(pGC)->devPrivates[fbGetGCPrivateIndex()].ptr)
#ifdef FB_OLD_GC
#define fbGetCompositeClip(pGC) (fbGetGCPrivate(pGC)->pCompositeClip)
#define fbGetExpose(pGC) (fbGetGCPrivate(pGC)->fExpose)
#define fbGetFreeCompClip(pGC) (fbGetGCPrivate(pGC)->freeCompClip)
#define fbGetRotatedPixmap(pGC) (fbGetGCPrivate(pGC)->pRotatedPixmap)
#else
#define fbGetCompositeClip(pGC) ((pGC)->pCompositeClip)
#define fbGetExpose(pGC) ((pGC)->fExpose)
#define fbGetFreeCompClip(pGC) ((pGC)->freeCompClip)
#define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
#endif
#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
#ifdef FB_NO_WINDOW_PIXMAPS
@ -776,12 +750,6 @@ typedef struct {
((pDrawable)->type == DRAWABLE_PIXMAP ? \
TRUE : fbWindowEnabled((WindowPtr) pDrawable))
#ifdef FB_OLD_SCREEN
#define BitsPerPixel(d) (\
((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
(PixmapWidthPaddingInfo[d].padRoundUp+1)))
#endif
#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0)
/*
* Accelerated tiles are power of 2 width <= FB_UNIT
@ -1791,13 +1759,11 @@ fbQueryBestSize (int class,
unsigned short *width, unsigned short *height,
ScreenPtr pScreen);
#ifndef FB_OLD_SCREEN
PixmapPtr
_fbGetWindowPixmap (WindowPtr pWindow);
void
_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap);
#endif
Bool
fbSetupScreen(ScreenPtr pScreen,
@ -2033,6 +1999,7 @@ fbEvenTile (FbBits *dst,
int height,
FbBits *tile,
FbStride tileStride,
int tileHeight,
int alu,

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fballpriv.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -49,10 +47,6 @@ int fbGetWinPrivateIndex(void)
#endif
int fbGeneration;
#ifdef FB_OLD_SCREEN
#define miAllocateGCPrivateIndex() AllocateGCPrivateIndex()
#endif
Bool
fbAllocatePrivates(ScreenPtr pScreen, int *pGCIndex)
{

View file

@ -1,6 +1,4 @@
/*
* Id: fbarc.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbbits.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbblt.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbbltone.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbbstore.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbcopy.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -29,7 +27,6 @@
#include <stdlib.h>
#include "fb.h"
#include "fbmmx.h"
void
fbCopyNtoN (DrawablePtr pSrcDrawable,

View file

@ -1,6 +1,4 @@
/*
* Id: fbfill.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -27,7 +25,6 @@
#endif
#include "fb.h"
#include "fbmmx.h"
void
fbFill (DrawablePtr pDrawable,
@ -47,22 +44,18 @@ fbFill (DrawablePtr pDrawable,
switch (pGC->fillStyle) {
case FillSolid:
#ifdef USE_MMX
if (!pPriv->and && fbHaveMMX())
{
if (fbFillmmx (dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor))
{
fbFinishAccess (pDrawable);
return;
}
}
#ifndef FB_ACCESS_WRAPPER
if (pPriv->and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
x + dstXoff, y + dstYoff,
width, height,
pPriv->xor))
#endif
fbSolid (dst + (y + dstYoff) * dstStride,
dstStride,
(x + dstXoff) * dstBpp,
dstBpp,
width * dstBpp, height,
pPriv->and, pPriv->xor);
fbSolid (dst + (y + dstYoff) * dstStride,
dstStride,
(x + dstXoff) * dstBpp,
dstBpp,
width * dstBpp, height,
pPriv->and, pPriv->xor);
break;
case FillStippled:
case FillOpaqueStippled: {
@ -218,26 +211,20 @@ fbSolidBoxClipped (DrawablePtr pDrawable,
if (partY2 <= partY1)
continue;
#ifdef USE_MMX
if (!and && fbHaveMMX())
{
if (fbFillmmx (dst, dstStride, dstBpp,
partX1 + dstXoff, partX2 + dstYoff, (partX2 - partX1), (partY2 - partY1),
xor))
{
fbFinishAccess (pDrawable);
return;
}
}
#ifndef FB_ACCESS_WRAPPER
if (and || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
partX1 + dstXoff, partY1 + dstYoff,
(partX2 - partX1), (partY2 - partY1),
xor))
#endif
fbSolid (dst + (partY1 + dstYoff) * dstStride,
dstStride,
(partX1 + dstXoff) * dstBpp,
dstBpp,
(partX2 - partX1) * dstBpp,
(partY2 - partY1),
and, xor);
fbSolid (dst + (partY1 + dstYoff) * dstStride,
dstStride,
(partX1 + dstXoff) * dstBpp,
dstBpp,
(partX2 - partX1) * dstBpp,
(partY2 - partY1),
and, xor);
}
fbFinishAccess (pDrawable);
}

View file

@ -1,6 +1,4 @@
/*
* Id: fbfillrect.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbfillsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbgc.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbgetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbimage.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,341 +0,0 @@
/*
* Copyright © 2004, 2005 Red Hat, Inc.
* Copyright © 2004 Nicholas Miell
* Copyright © 2005 Trolltech AS
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Red Hat not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Søren Sandmann (sandmann@redhat.com)
* Minor Improvements: Nicholas Miell (nmiell@gmail.com)
* MMX code paths for fbcompose.c by Lars Knoll (lars@trolltech.com)
*
* Based on work by Owen Taylor
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef USE_MMX
#if defined(__amd64__) || defined(__x86_64__)
#define USE_SSE
#endif
#include <mmintrin.h>
#ifdef USE_SSE
#include <xmmintrin.h> /* for _mm_shuffle_pi16 and _MM_SHUFFLE */
#endif
#ifdef RENDER
#include "fb.h"
#include "fbmmx.h"
#include "picturestr.h"
#include "mipict.h"
#include "fbpict.h"
#define noVERBOSE
#ifdef VERBOSE
#define CHECKPOINT() ErrorF ("at %s %d\n", __FUNCTION__, __LINE__)
#else
#define CHECKPOINT()
#endif
typedef unsigned long long ullong;
#ifdef __GNUC__
typedef ullong mmxdatafield;
#endif
#ifdef _MSC_VER
typedef unsigned __int64 ullong;
typedef __m64 mmxdatafield;
#endif
Bool
fbFillmmx (FbBits *bits,
FbStride stride,
int bpp,
int x,
int y,
int width,
int height,
FbBits xor)
{
ullong fill;
__m64 vfill;
CARD32 byte_width;
CARD8 *byte_line;
#ifdef __GNUC__
__m64 v1, v2, v3, v4, v5, v6, v7;
#endif
if (bpp == 16 && (xor >> 16 != (xor & 0xffff)))
return FALSE;
if (bpp != 16 && bpp != 32)
return FALSE;
if (bpp == 16)
{
stride = stride * sizeof (FbBits) / 2;
byte_line = (CARD8 *)(((CARD16 *)bits) + stride * y + x);
byte_width = 2 * width;
stride *= 2;
}
else
{
stride = stride * sizeof (FbBits) / 4;
byte_line = (CARD8 *)(((CARD32 *)bits) + stride * y + x);
byte_width = 4 * width;
stride *= 4;
}
fill = ((ullong)xor << 32) | xor;
vfill = (__m64)fill;
#ifdef __GNUC__
__asm__ (
"movq %7, %0\n"
"movq %7, %1\n"
"movq %7, %2\n"
"movq %7, %3\n"
"movq %7, %4\n"
"movq %7, %5\n"
"movq %7, %6\n"
: "=y" (v1), "=y" (v2), "=y" (v3),
"=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7)
: "y" (vfill));
#endif
while (height--)
{
int w;
CARD8 *d = byte_line;
byte_line += stride;
w = byte_width;
while (w >= 2 && ((unsigned long)d & 3))
{
*(CARD16 *)d = xor;
w -= 2;
d += 2;
}
while (w >= 4 && ((unsigned long)d & 7))
{
*(CARD32 *)d = xor;
w -= 4;
d += 4;
}
while (w >= 64)
{
#ifdef __GNUC__
__asm__ (
"movq %1, (%0)\n"
"movq %2, 8(%0)\n"
"movq %3, 16(%0)\n"
"movq %4, 24(%0)\n"
"movq %5, 32(%0)\n"
"movq %6, 40(%0)\n"
"movq %7, 48(%0)\n"
"movq %8, 56(%0)\n"
:
: "r" (d),
"y" (vfill), "y" (v1), "y" (v2), "y" (v3),
"y" (v4), "y" (v5), "y" (v6), "y" (v7)
: "memory");
#else
*(__m64*) (d + 0) = vfill;
*(__m64*) (d + 8) = vfill;
*(__m64*) (d + 16) = vfill;
*(__m64*) (d + 24) = vfill;
*(__m64*) (d + 32) = vfill;
*(__m64*) (d + 40) = vfill;
*(__m64*) (d + 48) = vfill;
*(__m64*) (d + 56) = vfill;
#endif
w -= 64;
d += 64;
}
while (w >= 4)
{
*(CARD32 *)d = xor;
w -= 4;
d += 4;
}
if (w >= 2)
{
*(CARD16 *)d = xor;
w -= 2;
d += 2;
}
}
_mm_empty();
return TRUE;
}
Bool
fbBltmmx (FbBits *src_bits,
FbBits *dst_bits,
FbStride src_stride,
FbStride dst_stride,
int src_bpp,
int dst_bpp,
int src_x, int src_y,
int dst_x, int dst_y,
int width, int height)
{
CARD8 * src_bytes;
CARD8 * dst_bytes;
int byte_width;
if (src_bpp != dst_bpp)
return FALSE;
if (src_bpp == 16)
{
src_stride = src_stride * sizeof (FbBits) / 2;
dst_stride = dst_stride * sizeof (FbBits) / 2;
src_bytes = (CARD8 *)(((CARD16 *)src_bits) + src_stride * (src_y) + (src_x));
dst_bytes = (CARD8 *)(((CARD16 *)dst_bits) + dst_stride * (dst_y) + (dst_x));
byte_width = 2 * width;
src_stride *= 2;
dst_stride *= 2;
} else if (src_bpp == 32) {
src_stride = src_stride * sizeof (FbBits) / 4;
dst_stride = dst_stride * sizeof (FbBits) / 4;
src_bytes = (CARD8 *)(((CARD32 *)src_bits) + src_stride * (src_y) + (src_x));
dst_bytes = (CARD8 *)(((CARD32 *)dst_bits) + dst_stride * (dst_y) + (dst_x));
byte_width = 4 * width;
src_stride *= 4;
dst_stride *= 4;
} else {
return FALSE;
}
while (height--)
{
int w;
CARD8 *s = src_bytes;
CARD8 *d = dst_bytes;
src_bytes += src_stride;
dst_bytes += dst_stride;
w = byte_width;
while (w >= 2 && ((unsigned long)d & 3))
{
*(CARD16 *)d = *(CARD16 *)s;
w -= 2;
s += 2;
d += 2;
}
while (w >= 4 && ((unsigned long)d & 7))
{
*(CARD32 *)d = *(CARD32 *)s;
w -= 4;
s += 4;
d += 4;
}
while (w >= 64)
{
#ifdef __GNUC__
__asm__ (
"movq (%1), %%mm0\n"
"movq 8(%1), %%mm1\n"
"movq 16(%1), %%mm2\n"
"movq 24(%1), %%mm3\n"
"movq 32(%1), %%mm4\n"
"movq 40(%1), %%mm5\n"
"movq 48(%1), %%mm6\n"
"movq 56(%1), %%mm7\n"
"movq %%mm0, (%0)\n"
"movq %%mm1, 8(%0)\n"
"movq %%mm2, 16(%0)\n"
"movq %%mm3, 24(%0)\n"
"movq %%mm4, 32(%0)\n"
"movq %%mm5, 40(%0)\n"
"movq %%mm6, 48(%0)\n"
"movq %%mm7, 56(%0)\n"
:
: "r" (d), "r" (s)
: "memory",
"%mm0", "%mm1", "%mm2", "%mm3",
"%mm4", "%mm5", "%mm6", "%mm7");
#else
__m64 v0 = *(__m64 *)(s + 0);
__m64 v1 = *(__m64 *)(s + 8);
__m64 v2 = *(__m64 *)(s + 16);
__m64 v3 = *(__m64 *)(s + 24);
__m64 v4 = *(__m64 *)(s + 32);
__m64 v5 = *(__m64 *)(s + 40);
__m64 v6 = *(__m64 *)(s + 48);
__m64 v7 = *(__m64 *)(s + 56);
*(__m64 *)(d + 0) = v0;
*(__m64 *)(d + 8) = v1;
*(__m64 *)(d + 16) = v2;
*(__m64 *)(d + 24) = v3;
*(__m64 *)(d + 32) = v4;
*(__m64 *)(d + 40) = v5;
*(__m64 *)(d + 48) = v6;
*(__m64 *)(d + 56) = v7;
#endif
w -= 64;
s += 64;
d += 64;
}
while (w >= 4)
{
*(CARD32 *)d = *(CARD32 *)s;
w -= 4;
s += 4;
d += 4;
}
if (w >= 2)
{
*(CARD16 *)d = *(CARD16 *)s;
w -= 2;
s += 2;
d += 2;
}
}
_mm_empty();
return TRUE;
}
#endif /* RENDER */
#endif /* USE_MMX */

View file

@ -1,64 +0,0 @@
/*
* Copyright © 2004 Red Hat, Inc.
* Copyright © 2005 Trolltech AS
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Red Hat not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. Red Hat makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*
* Author: Søren Sandmann (sandmann@redhat.com)
* Lars Knoll (lars@trolltech.com)
*
* Based on work by Owen Taylor
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef USE_MMX
#if !defined(__amd64__) && !defined(__x86_64__)
Bool fbHaveMMX(void);
#else
#define fbHaveMMX() TRUE
#endif
#else
#define fbHaveMMX() FALSE
#endif
#ifdef USE_MMX
Bool fbBltmmx (FbBits *src_bits,
FbBits *dst_bits,
FbStride src_stride,
FbStride dst_stride,
int src_bpp,
int dst_bpp,
int src_x, int src_y,
int dst_x, int dst_y,
int width, int height);
Bool fbFillmmx (FbBits *bits,
FbStride stride,
int bpp,
int x,
int y,
int width,
int height,
FbBits xor);
#endif /* USE_MMX */

View file

@ -413,11 +413,7 @@ fbOverlayFinishScreenInit(ScreenPtr pScreen,
return FALSE;
if (! miScreenInit(pScreen, 0, xsize, ysize, dpix, dpiy, 0,
depth1, ndepths, depths,
defaultVisual, nvisuals, visuals
#ifdef FB_OLD_MISCREENINIT
, (miBSFuncPtr) 0
#endif
))
defaultVisual, nvisuals, visuals))
return FALSE;
/* MI thinks there's no frame buffer */
#ifdef MITSHM

View file

@ -36,7 +36,6 @@
#include "picturestr.h"
#include "mipict.h"
#include "fbpict.h"
#include "fbmmx.h"
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
@ -211,7 +210,7 @@ fbCompositeGeneral (CARD8 op,
CARD16 width,
CARD16 height)
{
return fbComposite (op, pSrc, pMask, pDst,
fbComposite (op, pSrc, pMask, pDst,
xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height);
}
@ -468,203 +467,3 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
return TRUE;
}
#ifdef USE_MMX
/* The CPU detection code needs to be in a file not compiled with
* "-mmmx -msse", as gcc would generate CMOV instructions otherwise
* that would lead to SIGILL instructions on old CPUs that don't have
* it.
*/
#if !defined(__amd64__) && !defined(__x86_64__)
#ifdef HAVE_GETISAX
#include <sys/auxv.h>
#endif
enum CPUFeatures {
NoFeatures = 0,
MMX = 0x1,
MMX_Extensions = 0x2,
SSE = 0x6,
SSE2 = 0x8,
CMOV = 0x10
};
static unsigned int detectCPUFeatures(void) {
unsigned int features = 0;
unsigned int result = 0;
#ifdef HAVE_GETISAX
if (getisax(&result, 1)) {
if (result & AV_386_CMOV)
features |= CMOV;
if (result & AV_386_MMX)
features |= MMX;
if (result & AV_386_AMD_MMX)
features |= MMX_Extensions;
if (result & AV_386_SSE)
features |= SSE;
if (result & AV_386_SSE2)
features |= SSE2;
}
#else
char vendor[13];
#ifdef _MSC_VER
int vendor0 = 0, vendor1, vendor2;
#endif
vendor[0] = 0;
vendor[12] = 0;
#ifdef __GNUC__
/* see p. 118 of amd64 instruction set manual Vol3 */
/* We need to be careful about the handling of %ebx and
* %esp here. We can't declare either one as clobbered
* since they are special registers (%ebx is the "PIC
* register" holding an offset to global data, %esp the
* stack pointer), so we need to make sure they have their
* original values when we access the output operands.
*/
__asm__ ("pushf\n"
"pop %%eax\n"
"mov %%eax, %%ecx\n"
"xor $0x00200000, %%eax\n"
"push %%eax\n"
"popf\n"
"pushf\n"
"pop %%eax\n"
"mov $0x0, %%edx\n"
"xor %%ecx, %%eax\n"
"jz 1f\n"
"mov $0x00000000, %%eax\n"
"push %%ebx\n"
"cpuid\n"
"mov %%ebx, %%eax\n"
"pop %%ebx\n"
"mov %%eax, %1\n"
"mov %%edx, %2\n"
"mov %%ecx, %3\n"
"mov $0x00000001, %%eax\n"
"push %%ebx\n"
"cpuid\n"
"pop %%ebx\n"
"1:\n"
"mov %%edx, %0\n"
: "=r" (result),
"=m" (vendor[0]),
"=m" (vendor[4]),
"=m" (vendor[8])
:
: "%eax", "%ecx", "%edx"
);
#elif defined (_MSC_VER)
_asm {
pushfd
pop eax
mov ecx, eax
xor eax, 00200000h
push eax
popfd
pushfd
pop eax
mov edx, 0
xor eax, ecx
jz nocpuid
mov eax, 0
push ebx
cpuid
mov eax, ebx
pop ebx
mov vendor0, eax
mov vendor1, edx
mov vendor2, ecx
mov eax, 1
push ebx
cpuid
pop ebx
nocpuid:
mov result, edx
}
memmove (vendor+0, &vendor0, 4);
memmove (vendor+4, &vendor1, 4);
memmove (vendor+8, &vendor2, 4);
#else
# error unsupported compiler
#endif
features = 0;
if (result) {
/* result now contains the standard feature bits */
if (result & (1 << 15))
features |= CMOV;
if (result & (1 << 23))
features |= MMX;
if (result & (1 << 25))
features |= SSE;
if (result & (1 << 26))
features |= SSE2;
if ((features & MMX) && !(features & SSE) &&
(strcmp(vendor, "AuthenticAMD") == 0 ||
strcmp(vendor, "Geode by NSC") == 0)) {
/* check for AMD MMX extensions */
#ifdef __GNUC__
__asm__("push %%ebx\n"
"mov $0x80000000, %%eax\n"
"cpuid\n"
"xor %%edx, %%edx\n"
"cmp $0x1, %%eax\n"
"jge 2f\n"
"mov $0x80000001, %%eax\n"
"cpuid\n"
"2:\n"
"pop %%ebx\n"
"mov %%edx, %0\n"
: "=r" (result)
:
: "%eax", "%ecx", "%edx"
);
#elif defined _MSC_VER
_asm {
push ebx
mov eax, 80000000h
cpuid
xor edx, edx
cmp eax, 1
jge notamd
mov eax, 80000001h
cpuid
notamd:
pop ebx
mov result, edx
}
#endif
if (result & (1<<22))
features |= MMX_Extensions;
}
}
#endif /* HAVE_GETISAX */
return features;
}
Bool
fbHaveMMX (void)
{
static Bool initialized = FALSE;
static Bool mmx_present;
if (!initialized)
{
unsigned int features = detectCPUFeatures();
mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
initialized = TRUE;
}
return mmx_present;
}
#endif /* __amd64__ */
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbpixmap.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbpoint.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbpush.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbrop.h,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -81,7 +81,6 @@ fbQueryBestSize (int class,
}
}
#ifndef FB_OLD_SCREEN
PixmapPtr
_fbGetWindowPixmap (WindowPtr pWindow)
{
@ -97,7 +96,6 @@ _fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
pWindow->devPrivates[fbWinPrivateIndex].ptr = (pointer) pPixmap;
#endif
}
#endif
Bool
fbSetupScreen(ScreenPtr pScreen,
@ -141,7 +139,6 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->ResolveColor = fbResolveColor;
pScreen->BitmapToRegion = fbPixmapToRegion;
#ifndef FB_OLD_SCREEN
pScreen->GetWindowPixmap = _fbGetWindowPixmap;
pScreen->SetWindowPixmap = _fbSetWindowPixmap;
@ -150,7 +147,6 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->BackingStoreFuncs.SetClipmaskRgn = 0;
pScreen->BackingStoreFuncs.GetImagePixmap = 0;
pScreen->BackingStoreFuncs.GetSpansPixmap = 0;
#endif
return TRUE;
}
@ -247,11 +243,7 @@ fbFinishScreenInit(ScreenPtr pScreen,
return FALSE;
if (! miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
rootdepth, ndepths, depths,
defaultVisual, nvisuals, visuals
#ifdef FB_OLD_MISCREENINIT
, (miBSFuncPtr) 0
#endif
))
defaultVisual, nvisuals, visuals))
return FALSE;
/* overwrite miCloseScreen with our own */
pScreen->CloseScreen = fbCloseScreen;
@ -313,26 +305,3 @@ fbScreenInit(ScreenPtr pScreen,
return TRUE;
}
#endif
#ifdef FB_OLD_SCREEN
const miBSFuncRec fbBSFuncRec = {
fbSaveAreas,
fbRestoreAreas,
(void (*)(GCPtr, RegionPtr)) 0,
(PixmapPtr (*)(void)) 0,
(PixmapPtr (*)(void)) 0,
};
#endif
#if 0
void
fbInitializeBackingStore (ScreenPtr pScreen)
{
#ifdef FB_OLD_SCREEN
miInitializeBackingStore (pScreen, (miBSFuncRec *) &fbBSFuncRec);
#else
miInitializeBackingStore (pScreen);
#endif
}
#endif

View file

@ -1,6 +1,4 @@
/*
* Id: fbseg.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbsetsp.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* $XFree86$
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbstipple.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbtile.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -42,6 +40,7 @@ fbEvenTile (FbBits *dst,
int height,
FbBits *tile,
FbStride tileStride,
int tileHeight,
int alu,
@ -68,9 +67,9 @@ fbEvenTile (FbBits *dst,
/*
* Compute tile start scanline and rotation parameters
*/
tileEnd = tile + tileHeight;
tileEnd = tile + tileHeight * tileStride;
modulus (- yRot, tileHeight, tileY);
t = tile + tileY;
t = tile + tileY * tileStride;
modulus (- xRot, FB_UNIT, tileX);
rot = tileX;
@ -80,8 +79,9 @@ fbEvenTile (FbBits *dst,
/*
* Pick up bits for this scanline
*/
bits = READ(t++);
if (t == tileEnd) t = tile;
bits = READ(t);
t += tileStride;
if (t >= tileEnd) t = tile;
bits = FbRotLeft(bits,rot);
and = fbAnd(alu,bits,pm);
xor = fbXor(alu,bits,pm);
@ -194,7 +194,7 @@ fbTile (FbBits *dst,
{
if (FbEvenTile (tileWidth))
fbEvenTile (dst, dstStride, dstX, width, height,
tile, tileHeight,
tile, tileStride, tileHeight,
alu, pm, xRot, yRot);
else
fbOddTile (dst, dstStride, dstX, width, height,

View file

@ -1,6 +1,4 @@
/*
* $Id$
*
* Copyright © 2004 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbutil.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its

View file

@ -1,6 +1,4 @@
/*
* Id: fbwindow.c,v 1.1 1999/11/02 03:54:45 keithp Exp $
*
* Copyright © 1998 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -30,10 +28,6 @@
#include "fb.h"
#ifdef USE_MMX
#include "fbmmx.h"
#endif
Bool
fbCreateWindow(WindowPtr pWin)
{
@ -222,22 +216,22 @@ fbFillRegionSolid (DrawablePtr pDrawable,
int n = REGION_NUM_RECTS(pRegion);
BoxPtr pbox = REGION_RECTS(pRegion);
#ifdef USE_MMX
int has_mmx = 0;
if (!and && fbHaveMMX())
has_mmx = 1;
#ifndef FB_ACCESS_WRAPPER
int try_mmx = 0;
if (!and)
try_mmx = 1;
#endif
fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
while (n--)
{
#ifdef USE_MMX
if (!has_mmx || !fbFillmmx (dst, dstStride, dstBpp,
pbox->x1 + dstXoff, pbox->y1 + dstYoff,
(pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1),
xor))
#ifndef FB_ACCESS_WRAPPER
if (!try_mmx || !pixman_fill (dst, dstStride, dstBpp,
pbox->x1 + dstXoff, pbox->y1 + dstYoff,
(pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1),
xor))
{
#endif
fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
@ -247,7 +241,7 @@ fbFillRegionSolid (DrawablePtr pDrawable,
(pbox->x2 - pbox->x1) * dstBpp,
pbox->y2 - pbox->y1,
and, xor);
#ifdef USE_MMX
#ifndef FB_ACCESS_WRAPPER
}
#endif
fbValidateDrawable (pDrawable);