Merge branch 'server-1.5-branch' into xorg-server-1.5-apple

This commit is contained in:
Jeremy Huddleston 2008-06-10 01:45:40 -07:00
commit 33bfb761a7
16 changed files with 177 additions and 76 deletions

View file

@ -1364,6 +1364,7 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
CFLAGS=$PCIACCESS_CFLAGS
LIBS=$PCIACCESS_LIBS
AC_CHECK_FUNCS([pci_system_init_dev_mem])
AC_CHECK_FUNCS([pci_device_enable])
LIBS=$SAVE_LIBS
CFLAGS=$SAVE_CFLAGS
XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS"
@ -1633,8 +1634,8 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINTMODULES], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS"
XPRINT_LIBS="$XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB"
XPRINT_CFLAGS="$XPRINTMODULES_CFLAGS -DXPRINT"
XPRINT_LIBS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS $MIEXT_DAMAGE_LIB $XKB_LIB $XKB_STUB_LIB"
XPRINT_SYS_LIBS="$XPRINTMODULES_LIBS"
xpconfigdir=$libdir/X11/xserver

View file

@ -1,4 +1,10 @@
noinst_LTLIBRARIES = libdix.la libxpstubs.la
standard_dix_libs = libdix.la libxpstubs.la
if XPRINT
noinst_LTLIBRARIES = $(standard_dix_libs) libXpdix.la
else
noinst_LTLIBRARIES = $(standard_dix_libs)
endif
AM_CFLAGS = $(DIX_CFLAGS) \
-DVENDOR_NAME=\""@VENDOR_NAME@"\" \
@ -39,7 +45,11 @@ libdix_la_SOURCES = \
libxpstubs_la_SOURCES = \
xpstubs.c
INCLUDES = -I$(top_srcdir)/Xprint
if XPRINT
libXpdix_la_SOURCES = $(libdix_la_SOURCES)
libXpdix_la_CPPFLAGS = -I$(top_srcdir)/hw/xprint
libXpdix_la_CFLAGS = $(AM_CFLAGS) $(XPRINT_CFLAGS)
endif
EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in

View file

@ -248,6 +248,19 @@ exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
}
static void
exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
int w, int h, int bpp)
{
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
else
pExaPixmap->fb_pitch = w * bpp / 8;
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
pExaScr->info->pixmapPitchAlign);
}
/**
* exaCreatePixmap() creates a new pixmap.
*
@ -292,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
if (paddedWidth / 4 > 32767 || h > 32767)
return NullPixmap;
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
else
pExaPixmap->fb_pitch = w * bpp / 8;
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
pExaScr->info->pixmapPitchAlign);
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
if (paddedWidth < pExaPixmap->fb_pitch)
paddedWidth = pExaPixmap->fb_pitch;
@ -331,12 +340,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->offscreen = FALSE;
pExaPixmap->fb_ptr = NULL;
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
else
pExaPixmap->fb_pitch = w * bpp / 8;
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
pExaScr->info->pixmapPitchAlign);
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 131071) {
@ -384,10 +388,19 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
pExaPixmap = ExaGetPixmapPriv(pPixmap);
if (pExaPixmap) {
pExaPixmap->sys_ptr = pPixData;
if (pPixData)
pExaPixmap->sys_ptr = pPixData;
exaSetAccelBlock(pExaScr, pExaPixmap,
width, height, bitsPerPixel);
if (devKind > 0)
pExaPixmap->sys_pitch = devKind;
if (width > 0 && height > 0 && bitsPerPixel > 0) {
exaSetFbPitch(pExaScr, pExaPixmap,
width, height, bitsPerPixel);
exaSetAccelBlock(pExaScr, pExaPixmap,
width, height, bitsPerPixel);
}
}
@ -686,6 +699,34 @@ exaBitmapToRegion(PixmapPtr pPix)
return ret;
}
static Bool
exaCreateScreenResources(ScreenPtr pScreen)
{
ExaScreenPriv(pScreen);
PixmapPtr pScreenPixmap;
Bool b;
pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
b = pScreen->CreateScreenResources(pScreen);
pScreen->CreateScreenResources = exaCreateScreenResources;
if (!b)
return FALSE;
pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
if (pScreenPixmap) {
ExaPixmapPriv(pScreenPixmap);
exaSetAccelBlock(pExaScr, pExaPixmap,
pScreenPixmap->drawable.width,
pScreenPixmap->drawable.height,
pScreenPixmap->drawable.bitsPerPixel);
}
return TRUE;
}
/**
* exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's
* screen private, before calling down to the next CloseSccreen.
@ -707,6 +748,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
pScreen->CopyWindow = pExaScr->SavedCopyWindow;
pScreen->ChangeWindowAttributes = pExaScr->SavedChangeWindowAttributes;
pScreen->BitmapToRegion = pExaScr->SavedBitmapToRegion;
pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
#ifdef RENDER
if (ps) {
ps->Composite = pExaScr->SavedComposite;
@ -864,6 +906,9 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr->SavedBitmapToRegion = pScreen->BitmapToRegion;
pScreen->BitmapToRegion = exaBitmapToRegion;
pExaScr->SavedCreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = exaCreateScreenResources;
#ifdef RENDER
if (ps) {
pExaScr->SavedComposite = ps->Composite;

View file

@ -64,6 +64,8 @@ struct _ExaOffscreenArea {
ExaOffscreenState state;
ExaOffscreenArea *next;
unsigned eviction_cost;
};
/**

View file

@ -487,7 +487,8 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
int src_off_x, src_off_y;
int dst_off_x, dst_off_y;
ExaMigrationRec pixmaps[2];
RegionPtr region = NULL;
RegionPtr srcregion = NULL, dstregion = NULL;
xRectangle *rects;
pSrcPixmap = exaGetDrawablePixmap (pSrcDrawable);
pDstPixmap = exaGetDrawablePixmap (pDstDrawable);
@ -495,33 +496,38 @@ exaCopyNtoN (DrawablePtr pSrcDrawable,
exaGetDrawableDeltas (pSrcDrawable, pSrcPixmap, &src_off_x, &src_off_y);
exaGetDrawableDeltas (pDstDrawable, pDstPixmap, &dst_off_x, &dst_off_y);
if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
pGC->fillStyle, pGC->alu)) {
xRectangle *rects = xalloc(nbox * sizeof(xRectangle));
rects = xalloc(nbox * sizeof(xRectangle));
if (rects) {
int i;
if (rects) {
int i;
for (i = 0; i < nbox; i++) {
rects[i].x = pbox[i].x1 + dst_off_x;
rects[i].y = pbox[i].y1 + dst_off_y;
rects[i].width = pbox[i].x2 - pbox[i].x1;
rects[i].height = pbox[i].y2 - pbox[i].y1;
}
for (i = 0; i < nbox; i++) {
rects[i].x = pbox[i].x1 + dx + src_off_x;
rects[i].y = pbox[i].y1 + dy + src_off_y;
rects[i].width = pbox[i].x2 - pbox[i].x1;
rects[i].height = pbox[i].y2 - pbox[i].y1;
}
region = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED);
xfree(rects);
srcregion = RECTS_TO_REGION(pScreen, nbox, rects, CT_YXBANDED);
xfree(rects);
if (!pGC || !exaGCReadsDestination(pDstDrawable, pGC->planemask,
pGC->fillStyle, pGC->alu)) {
dstregion = REGION_CREATE(pScreen, NullBox, 0);
REGION_COPY(pScreen, dstregion, srcregion);
REGION_TRANSLATE(pScreen, dstregion, dst_off_x - dx - src_off_x,
dst_off_y - dy - src_off_y);
}
}
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pDstPixmap;
pixmaps[0].pReg = region;
pixmaps[0].pReg = dstregion;
pixmaps[1].as_dst = FALSE;
pixmaps[1].as_src = TRUE;
pixmaps[1].pPix = pSrcPixmap;
pixmaps[1].pReg = NULL;
pixmaps[1].pReg = srcregion;
pSrcExaPixmap = ExaGetPixmapPriv (pSrcPixmap);
pDstExaPixmap = ExaGetPixmapPriv (pDstPixmap);
@ -574,17 +580,21 @@ fallback:
EXA_FALLBACK(("from %p to %p (%c,%c)\n", pSrcDrawable, pDstDrawable,
exaDrawableLocation(pSrcDrawable),
exaDrawableLocation(pDstDrawable)));
exaPrepareAccessReg (pDstDrawable, EXA_PREPARE_DEST, region);
exaPrepareAccess (pSrcDrawable, EXA_PREPARE_SRC);
exaPrepareAccessReg (pDstDrawable, EXA_PREPARE_DEST, dstregion);
exaPrepareAccessReg (pSrcDrawable, EXA_PREPARE_SRC, srcregion);
fbCopyNtoN (pSrcDrawable, pDstDrawable, pGC, pbox, nbox, dx, dy, reverse,
upsidedown, bitplane, closure);
exaFinishAccess (pSrcDrawable, EXA_PREPARE_SRC);
exaFinishAccess (pDstDrawable, EXA_PREPARE_DEST);
out:
if (region) {
REGION_UNINIT(pScreen, region);
REGION_DESTROY(pScreen, region);
if (dstregion) {
REGION_UNINIT(pScreen, dstregion);
REGION_DESTROY(pScreen, dstregion);
}
if (srcregion) {
REGION_UNINIT(pScreen, srcregion);
REGION_DESTROY(pScreen, srcregion);
}
}
@ -940,10 +950,8 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
int dstBpp;
int dstXoff, dstYoff;
FbBits depthMask;
Bool fallback;
PixmapPtr pPixmap = exaGetDrawablePixmap(pDrawable);
ExaPixmapPriv(pPixmap);
ExaMigrationRec pixmaps[1];
RegionPtr pending_damage = DamagePendingRegion(pExaPixmap->pDamage);
BoxRec extents = *REGION_EXTENTS(pScreen, pending_damage);
int xoff, yoff;
@ -952,16 +960,8 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
return;
depthMask = FbFullMask(pDrawable->depth);
fallback = (pGC->planemask & depthMask) != depthMask;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
pixmaps[0].pPix = pPixmap;
pixmaps[0].pReg = fallback ? NULL : pending_damage;
exaDoMigration(pixmaps, 1, FALSE);
if (fallback)
if ((pGC->planemask & depthMask) != depthMask)
{
ExaCheckImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppciInit, pglyphBase);
return;
@ -984,7 +984,7 @@ exaImageGlyphBlt (DrawablePtr pDrawable,
extents.y1 -= yoff;
extents.y2 -= yoff;
exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pixmaps[0].pReg);
exaPrepareAccessReg (pDrawable, EXA_PREPARE_DEST, pending_damage);
if (TERMINALFONT (pGC->font) && !glyph)
{

View file

@ -116,7 +116,7 @@ exaPixmapShouldBeInFB (PixmapPtr pPix)
* If the pixmap is currently dirty, this copies at least the dirty area from
* FB to system or vice versa. Both areas must be allocated.
*/
static _X_INLINE void
static void
exaCopyDirty(ExaMigrationPtr migrate, RegionPtr pValidDst, RegionPtr pValidSrc,
Bool (*transfer) (PixmapPtr pPix, int x, int y, int w, int h,
char *sys, int sys_pitch), CARD8 *fallback_src,

View file

@ -21,11 +21,9 @@
*/
/** @file
* This allocator allocates blocks of memory by maintaining a list of areas
* and a score for each area. As an area is marked used, its score is
* incremented, and periodically all of the areas have their scores decayed by
* a fraction. When allocating, the contiguous block of areas with the minimum
* score is found and evicted in order to make room for the new allocation.
* This allocator allocates blocks of memory by maintaining a list of areas.
* When allocating, the contiguous block of areas with the minimum eviction
* cost is found and evicted in order to make room for the new allocation.
*/
#include "exa_priv.h"
@ -71,19 +69,36 @@ ExaOffscreenKickOut (ScreenPtr pScreen, ExaOffscreenArea *area)
return exaOffscreenFree (pScreen, area);
}
#define AREA_SCORE(area) (area->size / (double)(pExaScr->offScreenCounter - area->last_use))
static void
exaUpdateEvictionCost(ExaOffscreenArea *area, unsigned offScreenCounter)
{
unsigned age;
if (area->state == ExaOffscreenAvail)
return;
age = offScreenCounter - area->last_use;
/* This is unlikely to happen, but could result in a division by zero... */
if (age > (UINT_MAX / 2)) {
age = UINT_MAX / 2;
area->last_use = offScreenCounter - age;
}
area->eviction_cost = area->size / age;
}
static ExaOffscreenArea *
exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
{
ExaOffscreenArea *begin, *end, *best;
double score, best_score;
unsigned cost, best_cost;
int avail, real_size, tmp;
best_score = UINT_MAX;
best_cost = UINT_MAX;
begin = end = pExaScr->info->offScreenAreas;
avail = 0;
score = 0;
cost = 0;
best = 0;
while (end != NULL)
@ -106,23 +121,24 @@ exaFindAreaToEvict(ExaScreenPrivPtr pExaScr, int size, int align)
if (end->state == ExaOffscreenLocked) {
/* Can't more room here, restart after this locked area */
avail = 0;
score = 0;
cost = 0;
begin = end;
goto restart;
}
avail += end->size;
score += AREA_SCORE(end);
exaUpdateEvictionCost(end, pExaScr->offScreenCounter);
cost += end->eviction_cost;
end = end->next;
}
/* Check the score, update best */
if (avail >= real_size && score < best_score) {
/* Check the cost, update best */
if (avail >= real_size && cost < best_cost) {
best = begin;
best_score = score;
best_cost = cost;
}
avail -= begin->size;
score -= AREA_SCORE(begin);
cost -= begin->eviction_cost;
begin = begin->next;
}
@ -244,6 +260,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
new_area->state = ExaOffscreenAvail;
new_area->save = NULL;
new_area->last_use = 0;
new_area->eviction_cost = 0;
new_area->next = area->next;
area->next = new_area;
area->size = real_size;
@ -409,6 +426,7 @@ exaOffscreenFree (ScreenPtr pScreen, ExaOffscreenArea *area)
area->state = ExaOffscreenAvail;
area->save = NULL;
area->last_use = 0;
area->eviction_cost = 0;
/*
* Find previous area
*/
@ -474,6 +492,7 @@ exaOffscreenInit (ScreenPtr pScreen)
area->save = NULL;
area->next = NULL;
area->last_use = 0;
area->eviction_cost = 0;
/* Add it to the free areas */
pExaScr->info->offScreenAreas = area;

View file

@ -107,6 +107,7 @@ typedef struct {
CopyWindowProcPtr SavedCopyWindow;
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
BitmapToRegionProcPtr SavedBitmapToRegion;
CreateScreenResourcesProcPtr SavedCreateScreenResources;
ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
#ifdef RENDER
CompositeProcPtr SavedComposite;

View file

@ -359,6 +359,7 @@ ExaCheckComposite (CARD8 op,
CARD32
exaGetPixmapFirstPixel (PixmapPtr pPixmap)
{
ExaScreenPriv(pPixmap->drawable.pScreen);
CARD32 pixel;
void *fb;
Bool need_finish = FALSE;
@ -373,7 +374,8 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap)
fb = pExaPixmap->sys_ptr;
/* Try to avoid framebuffer readbacks */
if ((!offscreen && !sys_valid && !damaged) ||
if (pExaScr->info->CreatePixmap ||
(!offscreen && !sys_valid && !damaged) ||
(offscreen && (!sys_valid || damaged)))
{
box.x1 = 0;

View file

@ -150,10 +150,14 @@ VidModeGetCurrentModeline(int scrnIndex, pointer *mode, int *dotClock)
return FALSE;
pScrn = xf86Screens[scrnIndex];
*mode = (pointer)(pScrn->currentMode);
*dotClock = pScrn->currentMode->Clock;
return TRUE;
if (pScrn->currentMode) {
*mode = (pointer)(pScrn->currentMode);
*dotClock = pScrn->currentMode->Clock;
return TRUE;
}
return FALSE;
}
_X_EXPORT int

View file

@ -278,6 +278,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
struct pci_device *rom_device =
xf86GetPciInfoForEntity(pInt->entityIndex);
#if HAVE_PCI_DEVICE_ENABLE
pci_device_enable(rom_device);
#endif
err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS));
if (err) {
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n",

View file

@ -3,7 +3,7 @@ SUBDIRS = doc pcl pcl-mono raster ps etc config
bin_PROGRAMS = Xprt
Xprt_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ \
-DXPRINT -DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
-DPRINT_ONLY_SERVER -D_XP_PRINT_SERVER_ \
-DXPRINTDIR=\"$(libdir)/X11/xserver\" \
-DXPRASTERDDX -DXPPCLDDX -DXPMONOPCLDDX -DXPPSDDX \
-DXFree86Server
@ -17,6 +17,7 @@ XPRINT_LIBS = \
pcl-mono/libpcl.la \
$(top_builddir)/fb/libfb.la \
$(top_builddir)/render/librender.la \
$(top_builddir)/dix/libXpdix.la \
$(XSERVER_LIBS) \
$(top_builddir)/Xext/libXext.la \
$(top_builddir)/xkb/libxkb.la \

View file

@ -291,6 +291,12 @@ ddxProcessArgument (
#include "XIstubs.h"
#include "exglobals.h"
/* Place dummy config functions here instead of config/config.c,
since Xprint does not use D-BUS */
void config_init() { }
void config_fini() { }
int
ChangePointerDevice (
DeviceIntPtr old_dev,

View file

@ -50,10 +50,12 @@ sdk_HEADERS = \
validate.h \
window.h \
windowstr.h \
xkbsrv.h \
xkbstr.h \
xorg-server.h
endif
AM_CFLAGS = $(DIX_CFLAGS)
EXTRA_DIST = $(sdk_HEADERS) do-not-use-config.h dix-config.h xorg-config.h \
xkb-config.h xkbfile.h xkbsrv.h xkbstr.h
xkb-config.h xkbfile.h

View file

@ -118,6 +118,9 @@
/* Have pci_system_init_dev_mem() */
#undef HAVE_PCI_SYSTEM_INIT_DEV_MEM
/* Have pci_enable_device */
#undef HAVE_PCI_DEVICE_ENABLE
/* Path to text files containing PCI IDs */
#undef PCI_TXT_IDS_PATH

View file

@ -413,8 +413,9 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
(ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
} else {
VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
if (!CreateColormap(FakeClientID (0), pScreen, pVisual,
&format->index.pColormap, AllocNone, 0))
if (CreateColormap(FakeClientID (0), pScreen, pVisual,
&format->index.pColormap, AllocNone, 0)
!= Success)
return FALSE;
}
if (!ps->InitIndexed(pScreen, format))