Merge branch 'master' into XACE-SELINUX

Conflicts:

	include/miscstruct.h
	mi/mibstore.c
	mi/midispcur.c
	os/Makefile.am
This commit is contained in:
Eamon Walsh 2007-08-28 07:25:21 -04:00 committed by Eamon Walsh
commit 8554707326
187 changed files with 2613 additions and 179865 deletions

View File

@ -374,17 +374,25 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
{
RegionPtr pRegion = NULL;
PixmapPtr pixmap;
int bpp, override = 0;
int bpp, override = 0, texname;
GLenum format, type;
ScreenPtr pScreen = glxPixmap->pScreen;
__GLXDRIscreen * const screen =
(__GLXDRIscreen *) __glXgetActiveScreen(pScreen->myNum);
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
GL_TEXTURE_BINDING_2D :
GL_TEXTURE_BINDING_RECTANGLE_NV,
&texname));
if (!texname)
return __glXError(GLXBadContextState);
pixmap = (PixmapPtr) glxPixmap->pDraw;
if (screen->texOffsetStart && screen->driScreen.setTexOffset) {
__GLXpixmap **texOffsetOverride = screen->texOffsetOverride;
int i, firstEmpty = 16, texname;
int i, firstEmpty = 16;
for (i = 0; i < 16; i++) {
if (texOffsetOverride[i] == glxPixmap)
@ -409,11 +417,6 @@ alreadyin:
glxPixmap->pDRICtx = &((__GLXDRIcontext*)baseContext)->driContext;
CALL_GetIntegerv(GET_DISPATCH(), (glxPixmap->target == GL_TEXTURE_2D ?
GL_TEXTURE_BINDING_2D :
GL_TEXTURE_BINDING_RECTANGLE_NV,
&texname));
if (texname == glxPixmap->texname)
return Success;

View File

@ -296,7 +296,7 @@ static void init_screen_visuals(__GLXMESAscreen *screen)
__GLcontextModes *modes;
XMesaVisual *pXMesaVisual;
int *used;
int i, j, size;
int num_vis, j, size;
/* Alloc space for the list of XMesa visuals */
size = screen->base.numVisuals * sizeof(XMesaVisual);
@ -312,7 +312,7 @@ static void init_screen_visuals(__GLXMESAscreen *screen)
used = (int *) xalloc(pScreen->numVisuals * sizeof(int));
memset(used, 0, pScreen->numVisuals * sizeof(int));
i = 0;
num_vis = 0;
for ( modes = screen->base.modes; modes != NULL; modes = modes->next ) {
const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
const int nplanes = (modes->rgbBits - modes->alphaBits);
@ -327,7 +327,8 @@ static void init_screen_visuals(__GLXMESAscreen *screen)
!used[j]) {
/* Create the XMesa visual */
pXMesaVisual[i] =
assert(num_vis < screen->base.numVisuals);
pXMesaVisual[num_vis] =
XMesaCreateVisual(pScreen,
&pVis[j],
modes->rgbMode,
@ -364,13 +365,15 @@ static void init_screen_visuals(__GLXMESAscreen *screen)
FatalError( "Matching visual found, but visualID still -1!\n" );
}
i++;
num_vis++;
}
xfree(used);
screen->num_vis = pScreen->numVisuals;
screen->num_vis = num_vis;
screen->xm_vis = pXMesaVisual;
assert(screen->num_vis <= screen->base.numVisuals);
}
static __GLXscreen *

View File

@ -329,10 +329,6 @@ bufCreateBuffer(pScreen, pWin, bufferNum)
pBuffer->firstChild = NULL;
pBuffer->lastChild = NULL;
/* XXX - Worry about backingstore later */
pBuffer->backStorage = NULL;
pBuffer->backingStore = NotUseful;
/* XXX - Need to call pScreen->CreateWindow for tile/stipples
* or should I just copy the devPrivates?
*/
@ -505,18 +501,6 @@ bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures)
pScreen = pBuffer->drawable.pScreen;
REGION_INIT(pScreen, &reg, &box, 1);
if (pBuffer->backStorage)
{
/*
* If the window has backing-store on, call through the
* ClearToBackground vector to handle the special semantics
* (i.e. things backing store is to be cleared out and
* an Expose event is to be generated for those areas in backing
* store if generateExposures is TRUE).
*/
pBSReg = (* pScreen->ClearBackingStore)(pBuffer, x, y, w, h,
generateExposures);
}
REGION_INTERSECT(pScreen, &reg, &reg, &pBuffer->clipList);
if (pBuffer->backgroundState != None)

View File

@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
#include "gcstruct.h"
#include "extnsionst.h"
#include "servermd.h"
#include "shmint.h"
#define _XSHM_SERVER_
#include <X11/extensions/shmstr.h>
#include <X11/Xfuncproto.h>
@ -78,7 +79,6 @@ typedef struct _ShmDesc {
} ShmDescRec, *ShmDescPtr;
static void miShmPutImage(XSHM_PUT_IMAGE_ARGS);
static void fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
static int ShmDetachSegment(
pointer /* value */,
@ -154,7 +154,7 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
}
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
#include <sys/signal.h>
static Bool badSysCall = FALSE;
@ -510,7 +510,7 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
(*pmap->drawable.pScreen->DestroyPixmap)(pmap);
}
static void
_X_EXPORT void
fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
DrawablePtr dst;
GCPtr pGC;

View File

@ -36,6 +36,9 @@ ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
void
ShmSetPixmapFormat(ScreenPtr pScreen, int format);
void
fbShmPutImage(XSHM_PUT_IMAGE_ARGS);
void
ShmRegisterFbFuncs(ScreenPtr pScreen);

View File

@ -2592,8 +2592,9 @@ IdleTimeWakeupHandler (pointer env,
IdleTimeQueryValue (NULL, &idle);
if ((pIdleTimeValueGreater &&
XSyncValueGreaterThan (idle, *pIdleTimeValueGreater)) ||
(pIdleTimeValueLess && XSyncValueLessThan (idle, *pIdleTimeValueLess)))
XSyncValueGreaterOrEqual (idle, *pIdleTimeValueGreater)) ||
(pIdleTimeValueLess &&
XSyncValueLessOrEqual (idle, *pIdleTimeValueLess)))
{
SyncChangeCounter (IdleTimeCounter, idle);
}

View File

@ -104,7 +104,7 @@ static unsigned int pagesize;
static Bool badSysCall = FALSE;
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__)
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
#include <sys/signal.h>

View File

@ -10,7 +10,7 @@ libafb_la_SOURCES = afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpntwin.c afbpi
afbimage.c afbline.c afbbres.c afbhrzvert.c afbbresd.c afbpushpxl.c afbply1rct.c \
afbzerarc.c afbfillarc.c afbfillsp.c afbsetsp.c afbscrinit.c afbplygblt.c \
afbclip.c afbgetsp.c afbpolypnt.c afbbitblt.c afbcmap.c afbimggblt.c afbpntarea.c \
afbmisc.c afbbstore.c afbtegblt.c $(libafb_gen_sources)
afbmisc.c afbtegblt.c $(libafb_gen_sources)
INCLUDES = -I$(top_srcdir)/mfb -I$(top_srcdir)/hw/xfree86/os-support

View File

@ -183,23 +183,7 @@ extern void afbBresD(
unsigned char * /*rrops*/,
unsigned char * /*bgrrops*/
);
/* afbbstore.c */
extern void afbSaveAreas(
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnSave*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
);
extern void afbRestoreAreas(
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnRestore*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
);
/* afbclip.c */
extern RegionPtr afbPixmapToRegion(

View File

@ -1,154 +0,0 @@
/* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */
/*
Copyright (c) 1987 X Consortium
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER 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.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "afb.h"
#include <X11/X.h>
#include "mibstore.h"
#include "regionstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
/*-
*-----------------------------------------------------------------------
* afbSaveAreas --
* Function called by miSaveAreas to actually fetch the areas to be
* saved into the backing pixmap. This is very simple to do, since
* afbDoBitblt is designed for this very thing. The region to save is
* already destination-relative and we're given the offset to the
* window origin, so we have only to create an array of points of the
* u.l. corners of the boxes in the region translated to the screen
* coordinate system and fetch the screen pixmap out of its devPrivate
* field....
*
* Results:
* None.
*
* Side Effects:
* Data are copied from the screen into the pixmap.
*
*-----------------------------------------------------------------------
*/
void
afbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
PixmapPtr pPixmap; /* Backing pixmap */
RegionPtr prgnSave; /* Region to save (pixmap-relative) */
int xorg; /* X origin of region */
int yorg; /* Y origin of region */
WindowPtr pWin;
{
register DDXPointPtr pPt;
DDXPointPtr pPtsInit;
register BoxPtr pBox;
register int numRects;
numRects = REGION_NUM_RECTS(prgnSave);
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects * sizeof(DDXPointRec));
if (!pPtsInit)
return;
pBox = REGION_RECTS(prgnSave);
pPt = pPtsInit;
while (numRects--) {
pPt->x = pBox->x1 + xorg;
pPt->y = pBox->y1 + yorg;
pPt++;
pBox++;
}
afbDoBitblt((DrawablePtr)pPixmap->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr,
(DrawablePtr)pPixmap,
GXcopy,
prgnSave,
pPtsInit, wBackingBitPlanes (pWin));
DEALLOCATE_LOCAL(pPtsInit);
}
/*-
*-----------------------------------------------------------------------
* afbRestoreAreas --
* Function called by miRestoreAreas to actually fetch the areas to be
* restored from the backing pixmap. This is very simple to do, since
* afbDoBitblt is designed for this very thing. The region to restore is
* already destination-relative and we're given the offset to the
* window origin, so we have only to create an array of points of the
* u.l. corners of the boxes in the region translated to the pixmap
* coordinate system and fetch the screen pixmap out of its devPrivate
* field....
*
* Results:
* None.
*
* Side Effects:
* Data are copied from the pixmap into the screen.
*
*-----------------------------------------------------------------------
*/
void
afbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
PixmapPtr pPixmap; /* Backing pixmap */
RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
int xorg; /* X origin of window */
int yorg; /* Y origin of window */
WindowPtr pWin;
{
register DDXPointPtr pPt;
DDXPointPtr pPtsInit;
register BoxPtr pBox;
register int numRects;
numRects = REGION_NUM_RECTS(prgnRestore);
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(numRects*sizeof(DDXPointRec));
if (!pPtsInit)
return;
pBox = REGION_RECTS(prgnRestore);
pPt = pPtsInit;
while (numRects--) {
pPt->x = pBox->x1 - xorg;
pPt->y = pBox->y1 - yorg;
pPt++;
pBox++;
}
afbDoBitblt((DrawablePtr)pPixmap,
(DrawablePtr)pPixmap->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr,
GXcopy,
prgnRestore,
pPtsInit, wBackingBitPlanes (pWin));
DEALLOCATE_LOCAL(pPtsInit);
}

View File

@ -77,14 +77,6 @@ int afbScreenPrivateIndex;
static unsigned long afbGeneration = 0;
static BSFuncRec afbBSFuncRec = {
afbSaveAreas,
afbRestoreAreas,
(BackingStoreSetClipmaskRgnProcPtr) 0,
(BackingStoreGetImagePixmapProcPtr) 0,
(BackingStoreGetSpansPixmapProcPtr) 0,
};
static Bool
afbCloseScreen(int index, ScreenPtr pScreen)
{
@ -231,7 +223,6 @@ afbScreenInit(register ScreenPtr pScreen, pointer pbits, int xsize, int ysize, i
pScreen->CloseScreen = afbCloseScreen;
pScreen->CreateScreenResources = afbCreateScreenResources;
pScreen->BackingStoreFuncs = afbBSFuncRec;
pScreen->devPrivates[afbScreenPrivateIndex].ptr = pScreen->devPrivate;
pScreen->devPrivate = oldDevPrivate;

View File

@ -15,7 +15,7 @@ libcfb_common_sources = $(top_srcdir)/cfb/cfbgc.c $(top_srcdir)/cfb/cfbrrop.c \
$(top_srcdir)/cfb/cfballpriv.c $(top_srcdir)/cfb/cfbgetsp.c \
$(top_srcdir)/cfb/cfbfillrct.c $(top_srcdir)/cfb/cfbigblt8.c \
$(top_srcdir)/cfb/cfbglblt8.c $(top_srcdir)/cfb/cfbtegblt.c \
$(top_srcdir)/cfb/cfbbstore.c $(top_srcdir)/cfb/cfbpolypnt.c \
$(top_srcdir)/cfb/cfbpolypnt.c \
$(top_srcdir)/cfb/cfbbres.c $(top_srcdir)/cfb/cfbline.c \
$(top_srcdir)/cfb/cfbhrzvert.c $(top_srcdir)/cfb/cfbbresd.c \
$(top_srcdir)/cfb/cfbimage.c $(top_srcdir)/cfb/cfbcppl.c \

View File

@ -487,23 +487,7 @@ extern void cfbBresD(
int /*e2*/,
int /*len*/
);
/* cfbbstore.c */
extern void cfbSaveAreas(
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnSave*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
);
extern void cfbRestoreAreas(
PixmapPtr /*pPixmap*/,
RegionPtr /*prgnRestore*/,
int /*xorg*/,
int /*yorg*/,
WindowPtr /*pWin*/
);
/* cfbcmap.c */
#ifndef CFB_PROTOTYPES_ONLY

View File

@ -1,143 +0,0 @@
/*-
* cfbbstore.c --
* Functions required by the backing-store implementation in MI.
*
* Copyright (c) 1987 by the Regents of the University of California
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "cfb.h"
#include <X11/X.h>
#include "mibstore.h"
#include "regionstr.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
/*-
*-----------------------------------------------------------------------
* cfbSaveAreas --
* Function called by miSaveAreas to actually fetch the areas to be
* saved into the backing pixmap. This is very simple to do, since
* cfbDoBitblt is designed for this very thing. The region to save is
* already destination-relative and we're given the offset to the
* window origin, so we have only to create an array of points of the
* u.l. corners of the boxes in the region translated to the screen
* coordinate system and fetch the screen pixmap out of its devPrivate
* field....
*
* Results:
* None.
*
* Side Effects:
* Data are copied from the screen into the pixmap.
*
*-----------------------------------------------------------------------
*/
void
cfbSaveAreas(pPixmap, prgnSave, xorg, yorg, pWin)
PixmapPtr pPixmap; /* Backing pixmap */
RegionPtr prgnSave; /* Region to save (pixmap-relative) */
int xorg; /* X origin of region */
int yorg; /* Y origin of region */
WindowPtr pWin;
{
register DDXPointPtr pPt;
DDXPointPtr pPtsInit;
register BoxPtr pBox;
register int i;
ScreenPtr pScreen = pPixmap->drawable.pScreen;
PixmapPtr pScrPix;
i = REGION_NUM_RECTS(prgnSave);
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec));
if (!pPtsInit)
return;
pBox = REGION_RECTS(prgnSave);
pPt = pPtsInit;
while (--i >= 0) {
pPt->x = pBox->x1 + xorg;
pPt->y = pBox->y1 + yorg;
pPt++;
pBox++;
}
pScrPix = (*pScreen->GetWindowPixmap)(pWin);
cfbDoBitbltCopy((DrawablePtr) pScrPix, (DrawablePtr)pPixmap,
GXcopy, prgnSave, pPtsInit, ~0L);
DEALLOCATE_LOCAL (pPtsInit);
}
/*-
*-----------------------------------------------------------------------
* cfbRestoreAreas --
* Function called by miRestoreAreas to actually fetch the areas to be
* restored from the backing pixmap. This is very simple to do, since
* cfbDoBitblt is designed for this very thing. The region to restore is
* already destination-relative and we're given the offset to the
* window origin, so we have only to create an array of points of the
* u.l. corners of the boxes in the region translated to the pixmap
* coordinate system and fetch the screen pixmap out of its devPrivate
* field....
*
* Results:
* None.
*
* Side Effects:
* Data are copied from the pixmap into the screen.
*
*-----------------------------------------------------------------------
*/
void
cfbRestoreAreas(pPixmap, prgnRestore, xorg, yorg, pWin)
PixmapPtr pPixmap; /* Backing pixmap */
RegionPtr prgnRestore; /* Region to restore (screen-relative)*/
int xorg; /* X origin of window */
int yorg; /* Y origin of window */
WindowPtr pWin;
{
register DDXPointPtr pPt;
DDXPointPtr pPtsInit;
register BoxPtr pBox;
register int i;
ScreenPtr pScreen = pPixmap->drawable.pScreen;
PixmapPtr pScrPix;
i = REGION_NUM_RECTS(prgnRestore);
pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec));
if (!pPtsInit)
return;
pBox = REGION_RECTS(prgnRestore);
pPt = pPtsInit;
while (--i >= 0) {
pPt->x = pBox->x1 - xorg;
pPt->y = pBox->y1 - yorg;
pPt++;
pBox++;
}
pScrPix = (*pScreen->GetWindowPixmap)(pWin);
cfbDoBitbltCopy((DrawablePtr)pPixmap, (DrawablePtr) pScrPix,
GXcopy, prgnRestore, pPtsInit, ~0L);
DEALLOCATE_LOCAL (pPtsInit);
}

View File

@ -46,14 +46,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "cfbmskbits.h"
#include "mibstore.h"
BSFuncRec cfbBSFuncRec = {
cfbSaveAreas,
cfbRestoreAreas,
(BackingStoreSetClipmaskRgnProcPtr) 0,
(BackingStoreGetImagePixmapProcPtr) 0,
(BackingStoreGetSpansPixmapProcPtr) 0,
};
Bool
cfbCloseScreen (index, pScreen)
int index;
@ -184,7 +176,6 @@ cfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width)
pScreen->devPrivates[cfbScreenPrivateIndex].ptr = pScreen->devPrivate;
pScreen->devPrivate = oldDevPrivate;
#endif
pScreen->BackingStoreFuncs = cfbBSFuncRec;
pScreen->GetScreenPixmap = cfbGetScreenPixmap;
pScreen->SetScreenPixmap = cfbSetScreenPixmap;
return TRUE;

View File

@ -63,6 +63,7 @@ compCloseScreen (int index, ScreenPtr pScreen)
pScreen->CloseScreen = cs->CloseScreen;
pScreen->BlockHandler = cs->BlockHandler;
pScreen->InstallColormap = cs->InstallColormap;
pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
pScreen->ReparentWindow = cs->ReparentWindow;
pScreen->MoveWindow = cs->MoveWindow;
pScreen->ResizeWindow = cs->ResizeWindow;
@ -109,6 +110,33 @@ compInstallColormap (ColormapPtr pColormap)
pScreen->InstallColormap = compInstallColormap;
}
/* Fake backing store via automatic redirection */
static Bool
compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
CompScreenPtr cs = GetCompScreen (pScreen);
Bool ret;
pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
ret = pScreen->ChangeWindowAttributes(pWin, mask);
if (ret && (mask & CWBackingStore)) {
if (pWin->backingStore != NotUseful) {
compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
pWin->backStorage = TRUE;
} else {
compUnredirectWindow(serverClient, pWin,
CompositeRedirectAutomatic);
pWin->backStorage = FALSE;
}
}
pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
return ret;
}
static void
compScreenUpdate (ScreenPtr pScreen)
{
@ -424,6 +452,9 @@ compScreenInit (ScreenPtr pScreen)
cs->InstallColormap = pScreen->InstallColormap;
pScreen->InstallColormap = compInstallColormap;
cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
cs->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = compBlockHandler;

View File

@ -143,6 +143,11 @@ typedef struct _CompScreen {
*/
InstallColormapProcPtr InstallColormap;
/*
* Fake backing store via automatic redirection
*/
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
ScreenBlockHandlerProcPtr BlockHandler;
CloseScreenProcPtr CloseScreen;
Bool damaged;

View File

@ -98,12 +98,11 @@ add_option(InputOption **options, const char *key, const char *value)
}
static char *
get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name,
DBusError *error)
get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
{
char *prop, *ret;
prop = libhal_device_get_property_string(hal_ctx, udi, name, error);
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
DebugF(" [config/hal] getting %s on %s returned %s\n", name, udi, prop);
if (prop) {
ret = xstrdup(prop);
@ -117,13 +116,12 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name,
}
static char *
get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop,
DBusError *error)
get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
{
char **props, *ret, *str;
int i, len = 0;
props = libhal_device_get_property_strlist(hal_ctx, udi, prop, error);
props = libhal_device_get_property_strlist(hal_ctx, udi, prop, NULL);
if (props) {
for (i = 0; props[i]; i++)
len += strlen(props[i]);
@ -187,24 +185,22 @@ device_added(LibHalContext *hal_ctx, const char *udi)
if (type == TYPE_NONE)
goto out_error;
driver = get_prop_string(hal_ctx, udi, "input.x11_driver", &error);
path = get_prop_string(hal_ctx, udi, "input.device", &error);
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
path = get_prop_string(hal_ctx, udi, "input.device");
if (!driver || !path) {
DebugF("[config/hal] no driver or path specified for %s\n", udi);
goto unwind;
}
name = get_prop_string(hal_ctx, udi, "info.product", &error);
name = get_prop_string(hal_ctx, udi, "info.product");
if (!name)
name = xstrdup("(unnamed)");
if (type & TYPE_KEYS) {
xkb_rules = get_prop_string(hal_ctx, udi, "input.xkb_rules", &error);
xkb_model = get_prop_string(hal_ctx, udi, "input.xkb_model", &error);
xkb_layout = get_prop_string(hal_ctx, udi, "input.xkb_layout", &error);
xkb_variant = get_prop_string(hal_ctx, udi, "input.xkb_variant",
&error);
xkb_options = get_prop_string_array(hal_ctx, udi, "input.xkb_options",
&error);
xkb_rules = get_prop_string(hal_ctx, udi, "input.xkb.rules");
xkb_model = get_prop_string(hal_ctx, udi, "input.xkb.model");
xkb_layout = get_prop_string(hal_ctx, udi, "input.xkb.layout");
xkb_variant = get_prop_string(hal_ctx, udi, "input.xkb.variant");
xkb_options = get_prop_string_array(hal_ctx, udi, "input.xkb.options");
}
options = xcalloc(sizeof(*options), 1);
@ -273,7 +269,8 @@ disconnect_hook(void *data)
if (info->hal_ctx) {
dbus_error_init(&error);
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
DebugF("[config/hal] couldn't shut down context?\n");
DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
error.name, error.message);
libhal_ctx_free(info->hal_ctx);
dbus_error_free(&error);
}
@ -320,6 +317,7 @@ connect_hook(DBusConnection *connection, void *data)
devices = libhal_find_device_by_capability(info->hal_ctx, "input",
&num_devices, &error);
/* FIXME: Get default devices if error is set. */
for (i = 0; i < num_devices; i++)
device_added(info->hal_ctx, devices[i]);
libhal_free_string_array(devices);
@ -330,7 +328,8 @@ connect_hook(DBusConnection *connection, void *data)
out_ctx2:
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
DebugF("[config/hal] couldn't shut down context?\n");
DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
error.name, error.message);
out_ctx:
libhal_ctx_free(info->hal_ctx);
out_err:

View File

@ -11,21 +11,21 @@
</match>
<match key="info.capabilities" contains="input.keys">
<merge key="input.xkb_rules" type="string">base</merge>
<merge key="input.xkb.rules" type="string">base</merge>
<!-- If we're using Linux, we use evdev by default (falling back to
keyboard otherwise). -->
<merge key="input.x11_driver" type="string">keyboard</merge>
<merge key="input.xkb_model" type="string">keyboard</merge>
<merge key="input.xkb.model" type="string">pc105</merge>
<match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
string="Linux">
<merge key="input.x11_driver" type="string">evdev</merge>
<merge key="input.xkb_model" type="string">evdev</merge>
<merge key="input.xkb.model" type="string">evdev</merge>
</match>
<merge key="input.xkb_layout" type="string">us</merge>
<merge key="input.xkb.layout" type="string">us</merge>
<merge key="input.xkb_variant" type="string" />
<merge key="input.xkb.variant" type="string" />
</match>
</device>
</deviceinfo>

View File

@ -85,7 +85,13 @@ if test "x$WDTRACE" != "xno" ; then
[Define to 1 if the DTrace Xserver provider probes should be built in.])
fi
AM_CONDITIONAL(XSERVER_DTRACE, [test "x$WDTRACE" != "xno"])
AC_DEFINE_DIR(XERRORDB_PATH, libdir/XErrorDB, [Path to XErrorDB file])
# DTrace support uses XErrorDB to get request names
AC_ARG_WITH(xerrordb,
AS_HELP_STRING([--with-xerrordb=PATH], [Path to XErrorDB file (default: ${datadir}/X11/XErrorDB)]),
[ XERRORDB_PATH="$withval" ],
[ XERRORDB_PATH="${datadir}/X11/XErrorDB" ])
AC_DEFINE_DIR(XERRORDB_PATH, XERRORDB_PATH, [Path to XErrorDB file])
AC_HEADER_DIRENT
AC_HEADER_STDC
@ -592,6 +598,7 @@ XTRANS_CONNECTION_FLAGS
# Secure RPC detection macro from xtrans.m4
XTRANS_SECURE_RPC_FLAGS
AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
@ -618,7 +625,9 @@ XEXT_INC='-I$(top_srcdir)/Xext'
XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
PIXMAN="[pixman >= 0.9.2]"
PIXMAN="[pixman-1 >= 0.9.5]"
PKG_CHECK_MODULES(PIXMAN, $PIXMAN)
AC_SUBST(PIXMAN_CFLAGS)
dnl Core modules for most extensions, et al.
REQUIRED_MODULES="[randrproto >= 1.2] renderproto [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto xextproto [xproto >= 7.0.9] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4.2] [kbproto >= 1.0.3]"
@ -1163,7 +1172,7 @@ if test "x$DMX" = xyes; then
modules not found.])
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $OS_LIB $CWRAP_LIB"
XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $OS_LIB $CWRAP_LIB"
AC_SUBST([XDMX_LIBS])
dnl USB sources in DMX require <linux/input.h>
@ -1246,7 +1255,7 @@ AC_MSG_RESULT([$XGL])
AM_CONDITIONAL(XGL, [test "x$XGL" = xyes])
if test "x$XGL" = xyes; then
XGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XGL_LIBS])
AC_DEFINE(XGL_MODULAR, 1, [Use loadable XGL modules])
@ -1267,7 +1276,7 @@ AC_MSG_RESULT([$XEGL])
AM_CONDITIONAL(XEGL, [test "x$XEGL" = xyes])
if test "x$XEGL" = xyes; then
XEGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XEGL_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XEGL_LIBS])
fi
@ -1283,7 +1292,7 @@ AC_MSG_RESULT([$XGLX])
AM_CONDITIONAL(XGLX, [test "x$XGLX" = xyes])
if test "x$XGLX" = xyes; then
XGLX_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
XGLX_LIBS="$FB_LIB $MI_LIB $COMPOSITE_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_LAYER_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XGLX_LIBS])
fi
@ -1311,6 +1320,10 @@ dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
AC_CHECK_LIB([dl], [dlopen], XORG_LIBS="$XORG_LIBS -ldl"))
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
XSERVER_LIBS="$XSERVER_LIBS $PCIACCESS_LIBS"
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
case $host_os in
darwin*)
XORG_OS="Darwin"
@ -1347,7 +1360,7 @@ return 0;}
# LDFLAGS=$save_LDFLAGS
# ])
xorg_cv_AGL_framework=no
DARWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
DARWIN_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
AC_SUBST([DARWIN_LIBS])
AC_CHECK_LIB([Xplugin],[xp_init],[:])
AC_SUBST([APPLE_APPLICATIONS_DIR])
@ -1566,7 +1579,6 @@ return 0;}
AC_SUBST([XORG_OS])
AC_SUBST([XORG_OS_SUBDIR])
dnl only used in hw/xfree86/scanpci, TTBOMK
AC_PATH_PROG(PERL, perl, no)
dnl unlikely as this may be ...
if test "x$PERL" = xno; then
@ -1597,6 +1609,7 @@ return 0;}
AC_DEFINE_DIR(DEFAULT_LIBRARY_PATH, libdir, [Default library install path])
AC_DEFINE_DIR(DEFAULT_LOGPREFIX, LOGPREFIX, [Default log location])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation])
driverdir="$moduledir/drivers"
AC_SUBST([moduledir])
@ -1645,8 +1658,8 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau $PIXMAN])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_LIBS="$DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS"
XPRINT_EXTENSIONS="$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"
XPRINT_LIBS="$DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS $XPRINT_LIBS"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
@ -1701,7 +1714,7 @@ if test "x$XWIN" = xauto; then
mingw*) XWIN="yes" ;;
*) XWIN="no" ;;
esac
XWIN_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $LAYER_LIB $XPSTUBS_LIB $OS_LIB $SHADOW_LIB"
XWIN_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $CONFIG_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DAMAGE_LIB $LAYER_LIB $XPSTUBS_LIB $OS_LIB $SHADOW_LIB"
AC_SUBST([XWIN_LIBS])
fi
AC_MSG_RESULT([$XWIN])
@ -1945,6 +1958,7 @@ AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg],
if test x$XORGCFG = xyes ; then
PKG_CHECK_MODULES([XORGCFG_DEP],
[xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11])
XORGCFG_DEP_CFLAGS="$XORGCFG_DEP_CFLAGS $PIXMAN_CFLAGS"
AC_CHECK_LIB([curses],[waddstr],
[XORGCFG_DEP_LIBS="$XORGCFG_DEP_LIBS -lcurses"; CURSES=yes],
AC_CHECK_LIB([ncurses],[waddstr],
@ -2079,7 +2093,6 @@ hw/xfree86/os-support/usl/Makefile
hw/xfree86/parser/Makefile
hw/xfree86/rac/Makefile
hw/xfree86/ramdac/Makefile
hw/xfree86/scanpci/Makefile
hw/xfree86/shadowfb/Makefile
hw/xfree86/vbe/Makefile
hw/xfree86/vgahw/Makefile
@ -2094,8 +2107,6 @@ hw/xfree86/utils/cvt/Makefile
hw/xfree86/utils/gtf/Makefile
hw/xfree86/utils/ioport/Makefile
hw/xfree86/utils/kbd_mode/Makefile
hw/xfree86/utils/pcitweak/Makefile
hw/xfree86/utils/scanpci/Makefile
hw/xfree86/utils/xorgcfg/Makefile
hw/xfree86/utils/xorgconfig/Makefile
hw/dmx/config/Makefile

View File

@ -250,7 +250,7 @@ acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
}
}
else {
mult = pow((float)(dx * dx + dy * dy),
mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
((float)(pDev->ptrfeed->ctrl.num) /
(float)(pDev->ptrfeed->ctrl.den) - 1.0) /
2.0) / 2.0;

View File

@ -176,7 +176,6 @@ static Bool TileScreenSaver(int i, int kind);
#define SubStrSend(pWin,pParent) (StrSend(pWin) || SubSend(pParent))
_X_EXPORT int numSaveUndersViewable = 0;
_X_EXPORT int deltaSaveUndersViewable = 0;
@ -3035,9 +3034,6 @@ UnrealizeTree(
deltaSaveUndersViewable--;
#endif
pChild->viewable = FALSE;
if (pChild->backStorage)
(*pChild->drawable.pScreen->SaveDoomedAreas)(
pChild, &pChild->clipList, 0, 0);
(* MarkUnrealizedWindow)(pChild, pWin, fromConfigure);
pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
}
@ -3165,9 +3161,6 @@ UnmapSubwindows(WindowPtr pWin)
#ifdef DO_SAVE_UNDERS
pChild->DIXsaveUnder = FALSE;
#endif /* DO_SAVE_UNDERS */
if (pChild->backStorage)
(*pScreen->SaveDoomedAreas)(
pChild, &pChild->clipList, 0, 0);
}
}
}

View File

@ -32,10 +32,6 @@
#include <dix-config.h>
#endif
#ifdef MITSHM
#include "shmint.h"
#endif
#include <stdlib.h>
#include "exa_priv.h"
@ -253,7 +249,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth)
pExaScr->info->pixmapPitchAlign);
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 32767) {
if (pExaPixmap->fb_pitch > 131071) {
fbDestroyPixmap(pPixmap);
return NULL;
}
@ -526,6 +522,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
if (ps) {
ps->Composite = pExaScr->SavedComposite;
ps->Glyphs = pExaScr->SavedGlyphs;
ps->Trapezoids = pExaScr->SavedTrapezoids;
}
#endif
@ -669,8 +666,6 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr->SavedPaintWindowBorder = pScreen->PaintWindowBorder;
pScreen->PaintWindowBorder = exaPaintWindow;
pScreen->BackingStoreFuncs.SaveAreas = ExaCheckSaveAreas;
pScreen->BackingStoreFuncs.RestoreAreas = ExaCheckRestoreAreas;
#ifdef RENDER
if (ps) {
pExaScr->SavedComposite = ps->Composite;
@ -684,6 +679,9 @@ exaDriverInit (ScreenPtr pScreen,
pExaScr->SavedGlyphs = ps->Glyphs;
ps->Glyphs = exaGlyphs;
pExaScr->SavedTrapezoids = ps->Trapezoids;
ps->Trapezoids = exaTrapezoids;
}
#endif
@ -692,7 +690,7 @@ exaDriverInit (ScreenPtr pScreen,
* Shared pixmaps are almost always a performance loss for us, but this
* still allows for SHM PutImage.
*/
ShmRegisterFuncs(pScreen, NULL);
ShmRegisterFuncs(pScreen, &exaShmFuncs);
#endif
/*
* Hookup offscreen pixmaps

View File

@ -138,9 +138,9 @@ exaFillSpans(DrawablePtr pDrawable, GCPtr pGC, int n,
exaMarkSync(pScreen);
}
static void
exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *bits)
static Bool
exaDoPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *bits, int src_stride)
{
ExaScreenPriv (pDrawable->pScreen);
PixmapPtr pPix;
@ -149,7 +149,8 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
BoxPtr pbox;
int nbox;
int xoff, yoff;
int src_stride, bpp = pDrawable->bitsPerPixel;
int bpp = pDrawable->bitsPerPixel;
Bool access_prepared = FALSE;
pixmaps[0].as_dst = TRUE;
pixmaps[0].as_src = FALSE;
@ -168,19 +169,12 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
exaDoMigration (pixmaps, 1, TRUE);
if (pExaScr->info->UploadToScreen == NULL)
goto fallback;
pPix = exaGetOffscreenPixmap (pDrawable, &xoff, &yoff);
if (pPix == NULL)
goto fallback;
x += pDrawable->x;
y += pDrawable->y;
pClip = fbGetCompositeClip(pGC);
src_stride = PixmapBytePad(w, pDrawable->depth);
for (nbox = REGION_NUM_RECTS(pClip),
pbox = REGION_RECTS(pClip);
nbox--;
@ -205,8 +199,10 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
continue;
src = bits + (y1 - y) * src_stride + (x1 - x) * (bpp / 8);
ok = pExaScr->info->UploadToScreen(pPix, x1 + xoff, y1 + yoff,
x2 - x1, y2 - y1, src, src_stride);
ok = (pPix && pExaScr->info->UploadToScreen) ?
pExaScr->info->UploadToScreen(pPix, x1 + xoff, y1 + yoff,
x2 - x1, y2 - y1, src, src_stride) :
FALSE;
/* If we fail to accelerate the upload, fall back to using unaccelerated
* fb calls.
*/
@ -216,7 +212,11 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int dstBpp;
int dstXoff, dstYoff;
exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
if (!access_prepared) {
exaPrepareAccess(pDrawable, EXA_PREPARE_DEST);
access_prepared = TRUE;
}
fbGetStipDrawable(pDrawable, dst, dst_stride, dstBpp,
dstXoff, dstYoff);
@ -230,22 +230,55 @@ exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
(x2 - x1) * dstBpp,
y2 - y1,
GXcopy, FB_ALLONES, dstBpp);
exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
}
exaPixmapDirty(pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
if (access_prepared)
exaFinishAccess(pDrawable, EXA_PREPARE_DEST);
exaPixmapDirty(pixmaps[0].pPix, x1 + xoff, y1 + yoff, x2 + xoff, y2 + yoff);
}
return;
return TRUE;
migrate_and_fallback:
exaDoMigration (pixmaps, 1, FALSE);
fallback:
ExaCheckPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
return FALSE;
}
static void
exaPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *bits)
{
if (!exaDoPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits,
PixmapBytePad(w, pDrawable->depth)))
ExaCheckPutImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format,
bits);
}
#ifdef MITSHM
static void
exaShmPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, unsigned int format,
int w, int h, int sx, int sy, int sw, int sh, int dx, int dy,
char *data)
{
int src_stride = PixmapBytePad(w, depth);
if (exaDoPutImage(pDrawable, pGC, depth, dx, dy, sw, sh, 0, format, data +
sy * src_stride + sx * BitsPerPixel(depth) / 8,
src_stride))
return;
fbShmPutImage(pDrawable, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy,
data);
}
ShmFuncs exaShmFuncs = { NULL, exaShmPutImage };
#endif
static Bool inline
exaCopyNtoNTwoDir (DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
GCPtr pGC, BoxPtr pbox, int nbox, int dx, int dy)
@ -669,8 +702,9 @@ exaPolyFillRect(DrawablePtr pDrawable,
* call exaFillRegion{Solid,Tiled}.
*/
if ((pGC->fillStyle == FillSolid || pGC->fillStyle == FillTiled) &&
(pGC->alu == GXcopy || pGC->alu == GXclear || pGC->alu == GXnoop ||
pGC->alu == GXcopyInverted || pGC->alu == GXset)) {
(nrect == 1 || pGC->alu == GXcopy || pGC->alu == GXclear ||
pGC->alu == GXnoop || pGC->alu == GXcopyInverted ||
pGC->alu == GXset)) {
if (((pGC->fillStyle == FillSolid || pGC->tileIsPixel) &&
exaFillRegionSolid(pDrawable, pReg, pGC->fillStyle == FillSolid ?
pGC->fgPixel : pGC->tile.pixel, pGC->planemask,
@ -1324,7 +1358,7 @@ exaGetImage (DrawablePtr pDrawable, int x, int y, int w, int h,
goto fallback;
if (pExaScr->info->DownloadFromScreen == NULL)
goto migrate_and_fallback;
goto fallback;
/* Only cover the ZPixmap, solid copy case. */
if (format != ZPixmap || !EXA_PM_IS_SOLID(pDrawable, planeMask))

View File

@ -620,7 +620,6 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
/* Now, try to move them all into FB */
for (i = 0; i < npixmaps; i++) {
exaMoveInPixmap(pixmaps[i].pPix);
ExaOffscreenMarkUsed (pixmaps[i].pPix);
}
/* If we couldn't fit everything in, then kick back out */
@ -631,8 +630,13 @@ exaDoMigration (ExaMigrationPtr pixmaps, int npixmaps, Bool can_accel)
pixmaps[i].pPix->drawable.height));
for (j = 0; j < npixmaps; j++)
exaMoveOutPixmap(pixmaps[j].pPix);
break;
return;
}
}
/* Yay, everything's offscreen, mark memory as used */
for (i = 0; i < npixmaps; i++) {
ExaOffscreenMarkUsed (pixmaps[i].pPix);
}
}
}

View File

@ -35,6 +35,9 @@
#include <X11/X.h>
#define NEED_EVENTS
#include <X11/Xproto.h>
#ifdef MITSHM
#include "shmint.h"
#endif
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "windowstr.h"
@ -108,6 +111,7 @@ typedef struct {
RasterizeTrapezoidProcPtr SavedRasterizeTrapezoid;
AddTrianglesProcPtr SavedAddTriangles;
GlyphsProcPtr SavedGlyphs;
TrapezoidsProcPtr SavedTrapezoids;
#endif
Bool swappedOut;
enum ExaMigrationHeuristic migration;
@ -264,20 +268,6 @@ ExaCheckGetSpans (DrawablePtr pDrawable,
int nspans,
char *pdstStart);
void
ExaCheckSaveAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin);
void
ExaCheckRestoreAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin);
void
ExaCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
@ -305,6 +295,10 @@ exaGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth,
extern const GCOps exaOps;
#ifdef MITSHM
extern ShmFuncs exaShmFuncs;
#endif
#ifdef RENDER
void
ExaCheckComposite (CARD8 op,
@ -392,6 +386,11 @@ exaComposite(CARD8 op,
CARD16 width,
CARD16 height);
void
exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntrap, xTrapezoid *traps);
void
exaRasterizeTrapezoid (PicturePtr pPicture, xTrapezoid *trap,
int x_off, int y_off);

View File

@ -749,6 +749,132 @@ done:
}
#endif
/**
* Same as miCreateAlphaPicture, except it uses ExaCheckPolyFillRect instead
* of PolyFillRect to initialize the pixmap after creating it, to prevent
* the pixmap from being migrated.
*
* See the comments about exaTrapezoids.
*/
static PicturePtr
exaCreateAlphaPicture (ScreenPtr pScreen,
PicturePtr pDst,
PictFormatPtr pPictFormat,
CARD16 width,
CARD16 height)
{
PixmapPtr pPixmap;
PicturePtr pPicture;
GCPtr pGC;
int error;
xRectangle rect;
if (width > 32767 || height > 32767)
return 0;
if (!pPictFormat)
{
if (pDst->polyEdge == PolyEdgeSharp)
pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
else
pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
if (!pPictFormat)
return 0;
}
pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
pPictFormat->depth);
if (!pPixmap)
return 0;
pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
if (!pGC)
{
(*pScreen->DestroyPixmap) (pPixmap);
return 0;
}
ValidateGC (&pPixmap->drawable, pGC);
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = height;
ExaCheckPolyFillRect (&pPixmap->drawable, pGC, 1, &rect);
exaPixmapDirty (pPixmap, 0, 0, width, height);
FreeScratchGC (pGC);
pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
0, 0, serverClient, &error);
(*pScreen->DestroyPixmap) (pPixmap);
return pPicture;
}
/**
* exaTrapezoids is essentially a copy of miTrapezoids that uses
* exaCreateAlphaPicture instead of miCreateAlphaPicture.
*
* The problem with miCreateAlphaPicture is that it calls PolyFillRect
* to initialize the contents after creating the pixmap, which
* causes the pixmap to be moved in for acceleration. The subsequent
* call to RasterizeTrapezoid won't be accelerated however, which
* forces the pixmap to be moved out again.
*
* exaCreateAlphaPicture avoids this roundtrip by using ExaCheckPolyFillRect
* to initialize the contents.
*/
void
exaTrapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int ntrap, xTrapezoid *traps)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
PictureScreenPtr ps = GetPictureScreen(pScreen);
/*
* Check for solid alpha add
*/
if (op == PictOpAdd && miIsSolidAlpha (pSrc))
{
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
}
else if (maskFormat)
{
PicturePtr pPicture;
BoxRec bounds;
INT16 xDst, yDst;
INT16 xRel, yRel;
xDst = traps[0].left.p1.x >> 16;
yDst = traps[0].left.p1.y >> 16;
miTrapezoidBounds (ntrap, traps, &bounds);
if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
return;
pPicture = exaCreateAlphaPicture (pScreen, pDst, maskFormat,
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
if (!pPicture)
return;
for (; ntrap; ntrap--, traps++)
(*ps->RasterizeTrapezoid) (pPicture, traps,
-bounds.x1, -bounds.y1);
xRel = bounds.x1 + xSrc - xDst;
yRel = bounds.y1 + ySrc - yDst;
CompositePicture (op, pSrc, pPicture, pDst,
xRel, yRel, 0, 0, bounds.x1, bounds.y1,
bounds.x2 - bounds.x1,
bounds.y2 - bounds.y1);
FreePicture (pPicture, 0);
}
else
{
if (pDst->polyEdge == PolyEdgeSharp)
maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
else
maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
for (; ntrap; ntrap--, traps++)
exaTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
}
}
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
/**

View File

@ -283,34 +283,6 @@ ExaCheckGetSpans (DrawablePtr pDrawable,
exaFinishAccess (pDrawable, EXA_PREPARE_SRC);
}
void
ExaCheckSaveAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin)
{
EXA_FALLBACK(("from %p (%c)\n", &pPixmap->drawable,
exaDrawableLocation(&pPixmap->drawable)));
exaPrepareAccess ((DrawablePtr)pPixmap, EXA_PREPARE_DEST);
fbSaveAreas (pPixmap, prgnSave, xorg, yorg, pWin);
exaFinishAccess ((DrawablePtr)pPixmap, EXA_PREPARE_DEST);
}
void
ExaCheckRestoreAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin)
{
EXA_FALLBACK(("to %p (%c)\n", &pPixmap->drawable,
exaDrawableLocation(&pPixmap->drawable)));
exaPrepareAccess ((DrawablePtr)pPixmap, EXA_PREPARE_DEST);
fbRestoreAreas (pPixmap, prgnSave, xorg, yorg, pWin);
exaFinishAccess ((DrawablePtr)pPixmap, EXA_PREPARE_DEST);
}
/* XXX: Note the lack of a prepare on the tile, if the window has a tiled
* background. This function happens to only be called if pExaScr->swappedOut,
* so we actually end up not having to do it since the tile won't be in fb.
@ -382,19 +354,19 @@ exaGetPixmapFirstPixel (PixmapPtr pPixmap)
ExaMigrationRec pixmaps[1];
ExaPixmapPriv (pPixmap);
fb = pExaPixmap->sys_ptr;
/* Try to avoid framebuffer readbacks */
if (exaPixmapIsOffscreen(pPixmap)) {
if (!miPointInRegion(DamageRegion(pExaPixmap->pDamage), 0, 0, &box)) {
fb = pExaPixmap->sys_ptr;
} else {
need_finish = TRUE;
fb = pPixmap->devPrivate.ptr;
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPixmap;
exaDoMigration (pixmaps, 1, FALSE);
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
}
if (exaPixmapIsOffscreen(pPixmap) &&
miPointInRegion(DamageRegion(pExaPixmap->pDamage), 0, 0, &box))
{
need_finish = TRUE;
pixmaps[0].as_dst = FALSE;
pixmaps[0].as_src = TRUE;
pixmaps[0].pPix = pPixmap;
exaDoMigration (pixmaps, 1, FALSE);
exaPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
fb = pPixmap->devPrivate.ptr;
}
switch (pPixmap->drawable.bitsPerPixel) {

View File

@ -24,7 +24,6 @@ libfb_la_SOURCES = \
fbbits.h \
fbblt.c \
fbbltone.c \
fbbstore.c \
fbcopy.c \
fbfill.c \
fbfillrect.c \

20
fb/fb.h
View File

@ -26,7 +26,7 @@
#define _FB_H_
#include <X11/X.h>
#include <pixman/pixman.h>
#include <pixman.h>
#include "scrnintstr.h"
#include "pixmap.h"
@ -1262,23 +1262,6 @@ fbBltPlane (FbBits *src,
FbStip bgxor,
Pixel planeMask);
/*
* fbbstore.c
*/
void
fbSaveAreas(PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin);
void
fbRestoreAreas(PixmapPtr pPixmap,
RegionPtr prgnRestore,
int xorg,
int yorg,
WindowPtr pWin);
/*
* fbcmap.c
*/
@ -2118,6 +2101,7 @@ fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
pixman_image_t *image_from_pict (PicturePtr pict,
Bool has_clip);
void free_pixman_pict (PicturePtr, pixman_image_t *);
#endif /* _FB_H_ */

View File

@ -1,63 +0,0 @@
/*
* Copyright © 1998 Keith Packard
*
* 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 Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "fb.h"
void
fbSaveAreas(PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin)
{
fbCopyWindowProc (&pWin->drawable,
&pPixmap->drawable,
0,
REGION_RECTS(prgnSave),
REGION_NUM_RECTS(prgnSave),
xorg, yorg,
FALSE,
FALSE,
0,0);
}
void
fbRestoreAreas(PixmapPtr pPixmap,
RegionPtr prgnRestore,
int xorg,
int yorg,
WindowPtr pWin)
{
fbCopyWindowProc (&pPixmap->drawable,
&pWin->drawable,
0,
REGION_RECTS(prgnRestore),
REGION_NUM_RECTS(prgnRestore),
-xorg, -yorg,
FALSE,
FALSE,
0,0);
}

View File

@ -64,8 +64,8 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
if (!pixman_blt ((uint32_t *)src, (uint32_t *)dst, srcStride, dstStride, srcBpp, dstBpp,
(pbox->x1 + dx + srcXoff),
(pbox->y1 + dy + srcYoff),
(pbox->x1 + srcXoff),
(pbox->y1 + srcYoff),
(pbox->x1 + dstXoff),
(pbox->y1 + dstYoff),
(pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1)))
goto fallback;

View File

@ -185,15 +185,11 @@ fbComposite (CARD8 op,
pixman_image_composite (op, src, mask, dest,
xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height);
}
if (src)
pixman_image_unref (src);
if (mask)
pixman_image_unref (mask);
if (dest)
pixman_image_unref (dest);
free_pixman_pict (pSrc, src);
free_pixman_pict (pMask, mask);
free_pixman_pict (pDst, dest);
}
void
@ -295,9 +291,9 @@ create_bits_picture (PicturePtr pict,
pixman_image_t *image;
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
bits += yoff * stride + xoff;
bits = (CARD8*)bits + yoff * stride * sizeof(FbBits) + xoff * (bpp / 8);
image = pixman_image_create_bits (
pict->format,
pict->pDrawable->width, pict->pDrawable->height,
@ -332,8 +328,6 @@ create_bits_picture (PicturePtr pict,
/* Indexed table */
if (pict->pFormat->index.devPrivate)
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
fbFinishAccess (pict->pDrawable);
return image;
}
@ -379,7 +373,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict)
pixman_image_set_alpha_map (
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
pixman_image_unref (alpha_map);
free_pixman_pict (pict->alphaMap, alpha_map);
}
pixman_image_set_component_alpha (image, pict->componentAlpha);
@ -403,6 +397,7 @@ set_image_properties (pixman_image_t *image, PicturePtr pict)
}
pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
pixman_image_set_source_clipping (image, TRUE);
}
pixman_image_t *
@ -445,6 +440,13 @@ image_from_pict (PicturePtr pict,
return image;
}
void
free_pixman_pict (PicturePtr pict, pixman_image_t *image)
{
if (image && pixman_image_unref (image) && pict->pDrawable)
fbFinishAccess (pict->pDrawable);
}
Bool
fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{

View File

@ -142,12 +142,6 @@ fbSetupScreen(ScreenPtr pScreen,
pScreen->GetWindowPixmap = _fbGetWindowPixmap;
pScreen->SetWindowPixmap = _fbSetWindowPixmap;
pScreen->BackingStoreFuncs.SaveAreas = fbSaveAreas;
pScreen->BackingStoreFuncs.RestoreAreas = fbRestoreAreas;
pScreen->BackingStoreFuncs.SetClipmaskRgn = 0;
pScreen->BackingStoreFuncs.GetImagePixmap = 0;
pScreen->BackingStoreFuncs.GetSpansPixmap = 0;
return TRUE;
}

View File

@ -47,9 +47,7 @@ fbAddTraps (PicturePtr pPicture,
pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
fbFinishAccess (pPicture->pDrawable);
pixman_image_unref (image);
free_pixman_pict (pPicture, image);
}
void
@ -65,9 +63,7 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
fbFinishAccess (pPicture->pDrawable);
pixman_image_unref (image);
free_pixman_pict (pPicture, image);
}
static int

View File

@ -188,6 +188,7 @@
#define fbWinPrivateIndex wfbWinPrivateIndex
#define fbZeroLine wfbZeroLine
#define fbZeroSegment wfbZeroSegment
#define free_pixman_pict wfb_free_pixman_pict
#define image_from_pict wfb_image_from_pict
#define xxScrPrivateIndex wfbxxScrPrivateIndex
#define xxGCPrivateIndex wfbxxGCPrivateIndex

View File

@ -992,7 +992,7 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable)
WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = TRUE;
RegionPtr pOldClip = NULL, bsExposed;
RegionPtr pOldClip = NULL;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@ -1048,12 +1048,6 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable)
if (WasViewable)
{
if (pWin->backStorage)
{
pOldClip = REGION_CREATE(pScreen, NullBox, 1);
REGION_COPY(pScreen, pOldClip, &pWin->clipList);
}
if (pWin->firstChild)
{
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
@ -1077,28 +1071,6 @@ xf86SetRootClip (ScreenPtr pScreen, BOOL enable)
(*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
}
if (pWin->backStorage &&
((pWin->backingStore == Always) || WasViewable))
{
if (!WasViewable)
pOldClip = &pWin->clipList; /* a convenient empty region */
bsExposed = (*pScreen->TranslateBackingStore)
(pWin, 0, 0, pOldClip,
pWin->drawable.x, pWin->drawable.y);
if (WasViewable)
REGION_DESTROY(pScreen, pOldClip);
if (bsExposed)
{
RegionPtr valExposed = NullRegion;
if (pWin->valdata)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
REGION_EMPTY(pScreen, valExposed);
REGION_DESTROY(pScreen, bsExposed);
}
}
if (WasViewable)
{
if (anyMarked)

View File

@ -30,6 +30,8 @@
extern Window EphyrPreExistingHostWin;
extern Bool EphyrWantGrayScale;
extern Bool kdHasPointer;
extern Bool kdHasKbd;
void
InitCard (char *name)
@ -54,19 +56,30 @@ InitInput (int argc, char **argv)
KdKeyboardInfo *ki;
KdPointerInfo *pi;
ki = KdNewKeyboard();
if (!ki)
FatalError("Couldn't create Xephyr keyboard\n");
ki->driver = &EphyrKeyboardDriver;
KdAddKeyboardDriver(&EphyrKeyboardDriver);
KdAddKeyboard(ki);
pi = KdNewPointer();
if (!pi)
FatalError("Couldn't create Xephyr pointer\n");
pi->driver = &EphyrMouseDriver;
#ifdef linux
KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
#endif
KdAddPointerDriver(&EphyrMouseDriver);
KdAddPointer(pi);
#ifdef linux
KdAddPointerDriver(&LinuxEvdevMouseDriver);
#endif
if (!kdHasKbd) {
ki = KdNewKeyboard();
if (!ki)
FatalError("Couldn't create Xephyr keyboard\n");
ki->driver = &EphyrKeyboardDriver;
KdAddKeyboard(ki);
}
if (!kdHasPointer) {
pi = KdNewPointer();
if (!pi)
FatalError("Couldn't create Xephyr pointer\n");
pi->driver = &EphyrMouseDriver;
KdAddPointer(pi);
}
KdInitInput();
}

View File

@ -42,11 +42,8 @@
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define BIT(x) (1 << OFF(x))
#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y))
#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y))
#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y)))
typedef struct _kevdevMouse {
typedef struct _kevdev {
/* current device state */
int rel[REL_MAX + 1];
int abs[ABS_MAX + 1];
@ -65,23 +62,60 @@ typedef struct _kevdevMouse {
} Kevdev;
static void
EvdevMotion (KdPointerInfo *pi)
EvdevPtrBtn (KdPointerInfo *pi, struct input_event *ev)
{
int flags = KD_MOUSE_DELTA | pi->buttonState;
if (ev->code >= BTN_MOUSE && ev->code < BTN_JOYSTICK) {
switch (ev->code) {
case BTN_LEFT:
if (ev->value == 1)
flags |= KD_BUTTON_1;
else
flags &= ~KD_BUTTON_1;
break;
case BTN_MIDDLE:
if (ev->value == 1)
flags |= KD_BUTTON_2;
else
flags &= ~KD_BUTTON_2;
break;
case BTN_RIGHT:
if (ev->value == 1)
flags |= KD_BUTTON_3;
else
flags &= ~KD_BUTTON_3;
break;
default:
/* Unknow button */
break;
}
KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
}
}
static void
EvdevPtrMotion (KdPointerInfo *pi, struct input_event *ev)
{
Kevdev *ke = pi->driverPrivate;
int i;
int i;
int flags = KD_MOUSE_DELTA | pi->buttonState;
for (i = 0; i <= ke->max_rel; i++)
if (ke->rel[i])
{
int a;
ErrorF ("rel");
for (a = 0; a <= ke->max_rel; a++)
{
if (ISBITSET (ke->relbits, a))
ErrorF (" %d=%d", a, ke->rel[a]);
ke->rel[a] = 0;
if (ISBITSET (ke->relbits, a))
{
if (a == 0)
KdEnqueuePointerEvent(pi, flags, ke->rel[a], 0, 0);
else if (a == 1)
KdEnqueuePointerEvent(pi, flags, 0, ke->rel[a], 0);
}
ke->rel[a] = 0;
}
ErrorF ("\n");
break;
}
for (i = 0; i < ke->max_abs; i++)
@ -98,10 +132,30 @@ EvdevMotion (KdPointerInfo *pi)
ErrorF ("\n");
break;
}
if (ev->code == REL_WHEEL) {
for (i = 0; i < abs (ev->value); i++)
{
if (ev->value > 0)
flags |= KD_BUTTON_4;
else
flags |= KD_BUTTON_5;
KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
if (ev->value > 0)
flags &= ~KD_BUTTON_4;
else
flags &= ~KD_BUTTON_5;
KdEnqueuePointerEvent (pi, flags, 0, 0, 0);
}
}
}
static void
EvdevRead (int evdevPort, void *closure)
EvdevPtrRead (int evdevPort, void *closure)
{
KdPointerInfo *pi = closure;
Kevdev *ke = pi->driverPrivate;
@ -110,8 +164,12 @@ EvdevRead (int evdevPort, void *closure)
int n;
n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
if (n <= 0)
if (n <= 0) {
if (errno == ENODEV)
DeleteInputDeviceRequest(pi->dixdev);
return;
}
n /= sizeof (struct input_event);
for (i = 0; i < n; i++)
{
@ -119,26 +177,20 @@ EvdevRead (int evdevPort, void *closure)
case EV_SYN:
break;
case EV_KEY:
EvdevMotion (pi);
ASSIGNBIT(ke->key,events[i].code, events[i].value);
if (events[i].code < 0x100)
ErrorF ("key %d %d\n", events[i].code, events[i].value);
else
ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
EvdevPtrBtn (pi, &events[i]);
break;
case EV_REL:
ke->rel[events[i].code] += events[i].value;
EvdevPtrMotion (pi, &events[i]);
break;
case EV_ABS:
ke->abs[events[i].code] = events[i].value;
EvdevPtrMotion (pi, &events[i]);
break;
}
}
EvdevMotion (pi);
}
int EvdevInputType;
char *kdefaultEvdev[] = {
"/dev/input/event0",
"/dev/input/event1",
@ -149,7 +201,7 @@ char *kdefaultEvdev[] = {
#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
static Status
EvdevInit (KdPointerInfo *pi)
EvdevPtrInit (KdPointerInfo *pi)
{
int i;
int fd;
@ -157,25 +209,29 @@ EvdevInit (KdPointerInfo *pi)
if (!pi->path) {
for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
fd = open (kdefaultEvdev[i], 2);
if (fd >= 0) {
pi->path = KdSaveString (kdefaultEvdev[i]);
break;
}
if (fd >= 0) {
pi->path = KdSaveString (kdefaultEvdev[i]);
break;
}
}
}
else {
fd = open (pi->path, 2);
fd = open (pi->path, O_RDWR);
if (fd < 0) {
ErrorF("Failed to open evdev device %s\n", pi->path);
return BadMatch;
}
}
close(fd);
pi->name = KdSaveString("Evdev mouse");
return Success;
}
static Status
EvdevEnable (KdPointerInfo *pi)
EvdevPtrEnable (KdPointerInfo *pi)
{
int fd;
@ -259,17 +315,19 @@ EvdevEnable (KdPointerInfo *pi)
return BadValue;
}
}
if (!KdRegisterFd (fd, EvdevRead, pi)) {
if (!KdRegisterFd (fd, EvdevPtrRead, pi)) {
xfree (ke);
close (fd);
return BadAlloc;
}
pi->driverPrivate = ke;
ke->fd = fd;
return Success;
}
static void
EvdevDisable (KdPointerInfo *pi)
EvdevPtrDisable (KdPointerInfo *pi)
{
Kevdev *ke;
@ -284,26 +342,195 @@ EvdevDisable (KdPointerInfo *pi)
}
static void
EvdevFini (KdPointerInfo *pi)
EvdevPtrFini (KdPointerInfo *pi)
{
}
/*
* Evdev keyboard functions
*/
static void
readMapping (KdKeyboardInfo *ki)
{
int minScanCode, maxScanCode;
if (!ki)
return;
minScanCode = 0;
maxScanCode = 193;
ki->keySyms.mapWidth = 2;
ki->minScanCode = minScanCode;
ki->maxScanCode = maxScanCode;
}
static void
EvdevKbdRead (int evdevPort, void *closure)
{
KdKeyboardInfo *ki = closure;
struct input_event events[NUM_EVENTS];
int i, n;
n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
if (n <= 0) {
if (errno == ENODEV)
DeleteInputDeviceRequest(ki->dixdev);
return;
}
n /= sizeof (struct input_event);
for (i = 0; i < n; i++)
{
if (events[i].type == EV_KEY)
KdEnqueueKeyboardEvent (ki, events[i].code, !events[i].value);
/* FIXME: must implement other types of events
else
ErrorF("Event type (%d) not delivered\n", events[i].type);
*/
}
}
static Status
EvdevKbdInit (KdKeyboardInfo *ki)
{
int fd;
if (!ki->path) {
ErrorF("Couldn't find evdev device path\n");
return BadValue;
}
else {
fd = open (ki->path, O_RDWR);
if (fd < 0) {
ErrorF("Failed to open evdev device %s\n", ki->path);
return BadMatch;
}
}
close (fd);
ki->name = KdSaveString("Evdev keyboard");
readMapping(ki);
return Success;
}
static Status
EvdevKbdEnable (KdKeyboardInfo *ki)
{
unsigned long ev[NBITS(EV_MAX)];
Kevdev *ke;
int fd;
if (!ki || !ki->path)
return BadImplementation;
fd = open(ki->path, O_RDWR);
if (fd < 0)
return BadMatch;
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) {
perror ("EVIOCGBIT 0");
close (fd);
return BadMatch;
}
ke = xalloc (sizeof (Kevdev));
if (!ke) {
close (fd);
return BadAlloc;
}
memset (ke, '\0', sizeof (Kevdev));
if (!KdRegisterFd (fd, EvdevKbdRead, ki)) {
xfree (ke);
close (fd);
return BadAlloc;
}
ki->driverPrivate = ke;
ke->fd = fd;
return Success;
}
static void
EvdevKbdLeds (KdKeyboardInfo *ki, int leds)
{
/* struct input_event event;
Kevdev *ke;
ki->driverPrivate = ke;
memset(&event, 0, sizeof(event));
event.type = EV_LED;
event.code = LED_CAPSL;
event.value = leds & (1 << 0) ? 1 : 0;
write(ke->fd, (char *) &event, sizeof(event));
event.type = EV_LED;
event.code = LED_NUML;
event.value = leds & (1 << 1) ? 1 : 0;
write(ke->fd, (char *) &event, sizeof(event));
event.type = EV_LED;
event.code = LED_SCROLLL;
event.value = leds & (1 << 2) ? 1 : 0;
write(ke->fd, (char *) &event, sizeof(event));
event.type = EV_LED;
event.code = LED_COMPOSE;
event.value = leds & (1 << 3) ? 1 : 0;
write(ke->fd, (char *) &event, sizeof(event));
*/
}
static void
EvdevKbdBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{
}
static void
EvdevKbdDisable (KdKeyboardInfo *ki)
{
Kevdev *ke;
ke = ki->driverPrivate;
if (!ki || !ki->driverPrivate)
return;
KdUnregisterFd (ki, ke->fd, TRUE);
xfree (ke);
ki->driverPrivate = 0;
}
static void
EvdevKbdFini (KdKeyboardInfo *ki)
{
}
KdPointerDriver LinuxEvdevMouseDriver = {
"evdev",
EvdevInit,
EvdevEnable,
EvdevDisable,
EvdevFini,
EvdevPtrInit,
EvdevPtrEnable,
EvdevPtrDisable,
EvdevPtrFini,
NULL,
};
#if 0
KdKeyboardFuncs LinuxEvdevKeyboardFuncs = {
EvdevKbdLoad,
KdKeyboardDriver LinuxEvdevKeyboardDriver = {
"evdev",
EvdevKbdInit,
EvdevKbdEnable,
EvdevKbdLeds,
EvdevKbdBell,
EvdevKbdDisable,
EvdevKbdFini,
0,
NULL,
};
#endif

View File

@ -456,7 +456,9 @@ KdOsAddInputDrivers ()
#ifdef TSLIB
KdAddPointerDriver(&TsDriver);
#endif
KdAddPointerDriver(&LinuxEvdevMouseDriver);
KdAddKeyboardDriver(&LinuxKeyboardDriver);
KdAddKeyboardDriver(&LinuxEvdevKeyboardDriver);
}
static void

View File

@ -118,7 +118,7 @@ TslibEnable (KdPointerInfo *pi)
private->fd = ts_fd(private->tsDev);
if (!private->tsDev || ts_config(private->tsDev) || private->fd < 0) {
ErrorF("[tslib/TslibEnable] failed to open %s\n", pi->path);
if (private->fd > 0);
if (private->fd >= 0)
close(private->fd);
return BadAlloc;
}

View File

@ -223,30 +223,6 @@ KdCheckGetSpans (DrawablePtr pDrawable,
fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
}
void
KdCheckSaveAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin)
{
kaaWaitSync(pWin->drawable.pScreen);
kaaDrawableDirty (&pPixmap->drawable);
fbSaveAreas (pPixmap, prgnSave, xorg, yorg, pWin);
}
void
KdCheckRestoreAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin)
{
kaaWaitSync(pWin->drawable.pScreen);
kaaDrawableDirty ((DrawablePtr)pWin);
fbRestoreAreas (pPixmap, prgnSave, xorg, yorg, pWin);
}
void
KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what)
{
@ -292,9 +268,6 @@ KdScreenInitAsync (ScreenPtr pScreen)
pScreen->PaintWindowBackground = KdCheckPaintWindow;
pScreen->PaintWindowBorder = KdCheckPaintWindow;
pScreen->CopyWindow = KdCheckCopyWindow;
pScreen->BackingStoreFuncs.SaveAreas = KdCheckSaveAreas;
pScreen->BackingStoreFuncs.RestoreAreas = KdCheckRestoreAreas;
#ifdef RENDER
KdPictureInitAsync (pScreen);
#endif

View File

@ -81,6 +81,8 @@ int kdVirtualTerminal = -1;
Bool kdSwitchPending;
char *kdSwitchCmd;
DDXPointRec kdOrigin;
Bool kdHasPointer = FALSE;
Bool kdHasKbd = FALSE;
static Bool kdCaughtSignal = FALSE;
@ -99,7 +101,7 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
WindowPtr pChild;
Bool WasViewable;
Bool anyMarked = FALSE;
RegionPtr pOldClip = 0, bsExposed;
RegionPtr pOldClip = 0;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@ -157,12 +159,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
if (WasViewable)
{
if (pWin->backStorage)
{
pOldClip = REGION_CREATE(pScreen, NullBox, 1);
REGION_COPY(pScreen, pOldClip, &pWin->clipList);
}
if (pWin->firstChild)
{
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
@ -186,28 +182,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
(*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
}
if (pWin->backStorage &&
((pWin->backingStore == Always) || WasViewable))
{
if (!WasViewable)
pOldClip = &pWin->clipList; /* a convenient empty region */
bsExposed = (*pScreen->TranslateBackingStore)
(pWin, 0, 0, pOldClip,
pWin->drawable.x, pWin->drawable.y);
if (WasViewable)
REGION_DESTROY(pScreen, pOldClip);
if (bsExposed)
{
RegionPtr valExposed = NullRegion;
if (pWin->valdata)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
REGION_EMPTY(pScreen, valExposed);
REGION_DESTROY(pScreen, bsExposed);
}
}
if (WasViewable)
{
if (anyMarked)
@ -596,6 +570,8 @@ KdUseMsg (void)
ErrorF("-card pcmcia Use PCMCIA card as additional screen\n");
ErrorF("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP{,DEPTH/BPP}[xFREQ]] Specify screen characteristics\n");
ErrorF("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
ErrorF("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n");
ErrorF("-keybd driver [,,options] Specify the keyboard driver and its options\n");
ErrorF("-zaphod Disable cursor screen switching\n");
ErrorF("-2button Emulate 3 button mouse\n");
ErrorF("-3button Disable 3 button mouse emulation\n");
@ -604,7 +580,6 @@ KdUseMsg (void)
ErrorF("-softCursor Force software cursor\n");
ErrorF("-videoTest Start the server, pause momentarily and exit\n");
ErrorF("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
ErrorF("-mouse path[,n] Filename of mouse device, n is number of buttons\n");
ErrorF("-switchCmd Command to execute on vt switch\n");
ErrorF("-nozap Don't terminate server on Ctrl+Alt+Backspace\n");
ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
@ -737,12 +712,14 @@ KdProcessArgument (int argc, char **argv, int i)
if (i + 1 >= argc)
UseMsg();
KdAddConfigPointer(argv[i + 1]);
kdHasPointer = TRUE;
return 2;
}
if (!strcmp (argv[i], "-keybd")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigKeyboard(argv[i + 1]);
kdHasKbd = TRUE;
return 2;
}

View File

@ -330,6 +330,11 @@ struct _KdKeyboardInfo {
int inputClass;
#ifdef XKB
XkbDescPtr xkb;
char *xkbRules;
char *xkbModel;
char *xkbLayout;
char *xkbVariant;
char *xkbOptions;
#endif
int LockLed;
@ -606,20 +611,6 @@ KdCheckGetSpans (DrawablePtr pDrawable,
int nspans,
char *pdstStart);
void
KdCheckSaveAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin);
void
KdCheckRestoreAreas (PixmapPtr pPixmap,
RegionPtr prgnSave,
int xorg,
int yorg,
WindowPtr pWin);
void
KdCheckPaintWindow (WindowPtr pWin, RegionPtr pRegion, int what);
@ -873,12 +864,13 @@ KdRingBell (KdKeyboardInfo *ki,
int duration);
extern KdPointerDriver LinuxMouseDriver;
extern KdPointerDriver LinuxEvdevDriver;
extern KdPointerDriver LinuxEvdevMouseDriver;
extern KdPointerDriver Ps2MouseDriver;
extern KdPointerDriver BusMouseDriver;
extern KdPointerDriver MsMouseDriver;
extern KdPointerDriver TsDriver;
extern KdKeyboardDriver LinuxKeyboardDriver;
extern KdKeyboardDriver LinuxEvdevKeyboardDriver;
extern KdOsFuncs LinuxFuncs;
extern KdPointerDriver VxWorksMouseDriver;

View File

@ -792,7 +792,9 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
if (!noXkbExtension) {
memset(&names, 0, sizeof(XkbComponentNamesRec));
XkbSetRulesDflts ("base", "pc105", "us", NULL, NULL);
XkbSetRulesDflts (ki->xkbRules, ki->xkbModel, ki->xkbLayout,
ki->xkbVariant, ki->xkbOptions);
ret = XkbInitKeyboardDeviceStruct (pDevice,
&names,
&ki->keySyms,
@ -961,6 +963,13 @@ KdNewKeyboard (void)
ki->bellDuration = 200;
ki->next = NULL;
ki->options = NULL;
#ifdef XKB
ki->xkbRules = KdSaveString("base");
ki->xkbModel = KdSaveString("pc105");
ki->xkbLayout = KdSaveString("us");
ki->xkbVariant = NULL;
ki->xkbOptions = NULL;
#endif
return ki;
}
@ -1096,11 +1105,78 @@ KdRemovePointer (KdPointerInfo *pi)
KdFreePointer(pi);
}
/*
* You can call your kdriver server with something like:
* $ ./hw/kdrive/yourserver/X :1 -mouse evdev,,device=/dev/input/event4 -keybd
* evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br
*/
static Bool
KdGetOptions (InputOption **options, char *string)
{
InputOption *newopt = NULL, **tmpo = NULL;
int tam_key = 0;
newopt = (InputOption *) xalloc(sizeof (InputOption));
if (!newopt)
return FALSE;
bzero(newopt, sizeof (InputOption));
for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
; /* Hello, I'm here */
*tmpo = newopt;
if (strchr(string, '='))
{
tam_key = (strchr(string, '=') - string);
newopt->key = (char *)xalloc(tam_key);
strncpy(newopt->key, string, tam_key);
newopt->key[tam_key] = '\0';
newopt->value = xstrdup(strchr(string, '=') + 1);
}
else
{
newopt->key = xstrdup(string);
newopt->value = NULL;
}
newopt->next = NULL;
return TRUE;
}
static void
KdParseKbdOptions (KdKeyboardInfo *ki)
{
InputOption *option = NULL;
for (option = ki->options; option; option = option->next)
{
#ifdef XKB
if (strcasecmp(option->key, "XkbRules") == 0)
ki->xkbRules = option->value;
else if (strcasecmp(option->key, "XkbModel") == 0)
ki->xkbModel = option->value;
else if (strcasecmp(option->key, "XkbLayout") == 0)
ki->xkbLayout = option->value;
else if (strcasecmp(option->key, "XkbVariant") == 0)
ki->xkbVariant = option->value;
else if (strcasecmp(option->key, "XkbOptions") == 0)
ki->xkbOptions = option->value;
else if (!strcasecmp (option->key, "device"))
ki->path = KdSaveString(option->value);
else
#endif
ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
option->key, option->value);
}
}
KdKeyboardInfo *
KdParseKeyboard (char *arg)
{
char save[1024];
char delim;
InputOption *options = NULL;
KdKeyboardInfo *ki = NULL;
ki = KdNewKeyboard();
@ -1143,18 +1219,63 @@ KdParseKeyboard (char *arg)
else
ki->driverPrivate = xstrdup(save);
/* FIXME actually implement options */
if (delim != ',')
{
return ki;
}
arg = KdParseFindNext (arg, ",", save, &delim);
while (delim == ',')
{
arg = KdParseFindNext (arg, ",", save, &delim);
if (!KdGetOptions(&options, save))
{
KdFreeKeyboard(ki);
return NULL;
}
}
if (options)
{
ki->options = options;
KdParseKbdOptions(ki);
}
return ki;
}
static void
KdParsePointerOptions (KdPointerInfo *pi)
{
InputOption *option = NULL;
for (option = pi->options; option; option = option->next)
{
if (!strcmp (option->key, "emulatemiddle"))
pi->emulateMiddleButton = TRUE;
else if (!strcmp (option->key, "noemulatemiddle"))
pi->emulateMiddleButton = FALSE;
else if (!strcmp (option->key, "transformcoord"))
pi->transformCoordinates = TRUE;
else if (!strcmp (option->key, "rawcoord"))
pi->transformCoordinates = FALSE;
else if (!strcasecmp (option->key, "device"))
pi->path = KdSaveString(option->value);
else
ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
option->key, option->value);
}
}
KdPointerInfo *
KdParsePointer (char *arg)
{
char save[1024];
char delim;
KdPointerInfo *pi = NULL;
InputOption *options = NULL, *newopt = NULL, **tmpo = NULL;
InputOption *options = NULL;
int i = 0;
pi = KdNewPointer();
@ -1214,45 +1335,21 @@ KdParsePointer (char *arg)
s++;
}
}
else if (!strcmp (save, "emulatemiddle"))
pi->emulateMiddleButton = TRUE;
else if (!strcmp (save, "noemulatemiddle"))
pi->emulateMiddleButton = FALSE;
else if (!strcmp (save, "transformcoord"))
pi->transformCoordinates = TRUE;
else if (!strcmp (save, "rawcoord"))
pi->transformCoordinates = FALSE;
else
{
newopt = (InputOption *) xalloc(sizeof (InputOption));
if (!newopt)
if (!KdGetOptions(&options, save))
{
KdFreePointer(pi);
return NULL;
}
bzero(newopt, sizeof (InputOption));
for (tmpo = &options; *tmpo; tmpo = &(*tmpo)->next)
*tmpo = newopt;
if (strchr(arg, '='))
{
i = (strchr(arg, '=') - arg);
newopt->key = (char *)xalloc(i+1);
strncpy(newopt->key, arg, i+1);
newopt->value = xstrdup(strchr(arg, '=') + 1);
}
else
{
newopt->key = xstrdup(save);
newopt->value = NULL;
}
newopt->next = NULL;
}
}
if (options)
{
pi->options = options;
KdParsePointerOptions(pi);
}
return pi;
}
@ -2336,6 +2433,8 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
return BadValue;
}
/* FIXME: change this code below to use KdParseKbdOptions and
* KdParsePointerOptions */
for (option = options; option; option = option->next) {
if (strcmp(option->key, "device") == 0) {
if (pi && option->value)

View File

@ -20,12 +20,12 @@ DOC_SUBDIR = doc
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) $(CFB_SUBDIR) \
loader scanpci dixmods exa modes \
loader dixmods exa modes \
$(DRI_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR)
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
xf8_16bpp xf8_32bpp loader scanpci dixmods dri exa modes \
xf8_16bpp xf8_32bpp loader dixmods dri exa modes \
utils doc
bin_PROGRAMS = Xorg

View File

@ -44,7 +44,7 @@ libinit_a_SOURCES = xf86Build.h xf86Init.c
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
-I$(srcdir)/../scanpci -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod
sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \

View File

@ -42,6 +42,8 @@
#include <dix-config.h>
#endif
#include <pciaccess.h>
#include "xf86str.h"
#include "xf86Opt.h"
#include <X11/Xfuncproto.h>
@ -90,16 +92,13 @@ extern Bool xf86inSuspend;
/* xf86Bus.c */
Bool xf86CheckPciSlot(int bus, int device, int func);
int xf86ClaimPciSlot(int bus, int device, int func, DriverPtr drvp,
Bool xf86CheckPciSlot( const struct pci_device * );
int xf86ClaimPciSlot( struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
Bool xf86ParsePciBusString(const char *busID, int *bus, int *device,
int *func);
Bool xf86ComparePciBusString(const char *busID, int bus, int device, int func);
void xf86FormatPciBusNumber(int busnum, char *buffer);
pciVideoPtr *xf86GetPciVideoInfo(void);
pciConfigPtr *xf86GetPciConfigInfo(void);
void xf86SetPciVideo(pciVideoPtr, resType);
void xf86PrintResList(int verb, resPtr list);
resPtr xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex);
int xf86ClaimIsaSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
@ -110,7 +109,7 @@ int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
void xf86EnableAccess(ScrnInfoPtr pScrn);
void xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn);
Bool xf86IsPrimaryPci(pciVideoPtr pPci);
Bool xf86IsPrimaryPci(struct pci_device * pPci);
Bool xf86IsPrimaryIsa(void);
/* new RAC */
resPtr xf86AddResToList(resPtr rlist, resRange *Range, int entityIndex);
@ -126,19 +125,16 @@ int xf86GetNumEntityInstances(int entityIndex);
GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
EntityInfoPtr xf86GetEntityInfo(int entityIndex);
pciVideoPtr xf86GetPciInfoForEntity(int entityIndex);
int xf86GetPciEntity(int bus, int dev, int func);
struct pci_device * xf86GetPciInfoForEntity(int entityIndex);
Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave, pointer);
void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type);
resPtr xf86RegisterResources(int entityIndex, resList list,
unsigned long Access);
Bool xf86CheckPciMemBase(pciVideoPtr pPci, memType base);
Bool xf86CheckPciMemBase(struct pci_device * pPci, memType base);
void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs,
xf86SetAccessFuncPtr oldFuncs);
Bool xf86IsEntityPrimary(int entityIndex);
Bool xf86FixPciResource(int entityIndex, int prt, memType alignment,
unsigned long type);
resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes);
resPtr xf86SetOperatingState(resList list, int entityIndex, int mask);
void xf86EnterServerState(xf86State state);
@ -149,14 +145,9 @@ resRange xf86GetSparse(unsigned long type, memType fixed_bits,
memType decode_mask, memType address_mask,
resPtr avoid);
memType xf86ChkConflict(resRange *rgp, int entityIndex);
Bool xf86IsPciDevPresent(int bus, int dev, int func);
ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
Bool xf86NoSharedResources(int screenIndex, resType res);
resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2);
pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID,
char n, pciVideoPtr pvp_exclude);
pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class,
char n, pciVideoPtr pvp_exclude);
void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg);
Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func);
@ -175,8 +166,8 @@ DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
/* xf86Configure.c */
GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
void *busData, int chipset);
GDevPtr xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo,
int chipset);
GDevPtr xf86AddDeviceToConfigure( const char *driver,
struct pci_device * pVideo, int chipset );
/* xf86Cursor.c */

View File

@ -48,7 +48,6 @@
"\tLoad\t\"dbe\"\n" \
"\tLoad\t\"glx\"\n" \
"\tLoad\t\"freetype\"\n" \
"\tLoad\t\"type1\"\n" \
"\tLoad\t\"record\"\n" \
"\tLoad\t\"dri\"\n" \
"EndSection\n\n"
@ -156,7 +155,7 @@ AppendToConfig(const char *s)
}
static const char *
videoPtrToDriverName(pciVideoPtr info)
videoPtrToDriverName(struct pci_device *dev)
{
/*
* things not handled yet:
@ -164,7 +163,7 @@ videoPtrToDriverName(pciVideoPtr info)
* xgi
*/
switch (info->vendor)
switch (dev->vendor_id)
{
case 0x1142: return "apm";
case 0xedd8: return "ark";
@ -173,7 +172,7 @@ videoPtrToDriverName(pciVideoPtr info)
case 0x102c: return "chips";
case 0x1013: return "cirrus";
case 0x8086:
if ((info->chipType == 0x00d1) || (info->chipType == 0x7800))
if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800))
return "i740";
else return "i810";
case 0x102b: return "mga";
@ -182,7 +181,7 @@ videoPtrToDriverName(pciVideoPtr info)
case 0x10de: case 0x12d2: return "nv";
case 0x1163: return "rendition";
case 0x5333:
switch (info->chipType)
switch (dev->device_id)
{
case 0x88d0: case 0x88d1: case 0x88f0: case 0x8811:
case 0x8812: case 0x8814: case 0x8901:
@ -196,7 +195,7 @@ videoPtrToDriverName(pciVideoPtr info)
case 0x1039: return "sis";
case 0x126f: return "siliconmotion";
case 0x121a:
if (info->chipType < 0x0003)
if (dev->device_id < 0x0003)
return "voodoo";
else
return "tdfx";
@ -215,22 +214,23 @@ xf86AutoConfig(void)
{
const char **p;
char buf[1024];
pciVideoPtr *pciptr, info = NULL;
char *driver = NULL;
struct pci_device_iterator *iter;
struct pci_device * info = NULL;
const char *driver = NULL;
ConfigStatus ret;
/* Find the primary device, and get some information about it. */
if (xf86PciVideoInfo) {
for (pciptr = xf86PciVideoInfo; (info = *pciptr); pciptr++) {
if (xf86IsPrimaryPci(info)) {
break;
}
iter = pci_slot_match_iterator_create(NULL);
while ((info = pci_device_next(iter)) != NULL) {
if (xf86IsPrimaryPci(info)) {
break;
}
if (!info) {
ErrorF("Primary device is not PCI\n");
}
} else {
ErrorF("xf86PciVideoInfo is not set\n");
}
pci_iterator_destroy(iter);
if (!info) {
ErrorF("Primary device is not PCI\n");
}
if (info)

View File

@ -52,6 +52,7 @@
#include "xf86_OSproc.h"
#include "xf86RAC.h"
#include "Pci.h"
/* Entity data */
EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
@ -253,9 +254,7 @@ xf86IsEntityPrimary(int entityIndex)
switch (pEnt->busType) {
case BUS_PCI:
return (pEnt->pciBusId.bus == primaryBus.id.pci.bus &&
pEnt->pciBusId.device == primaryBus.id.pci.device &&
pEnt->pciBusId.func == primaryBus.id.pci.func);
return (pEnt->bus.id.pci == primaryBus.id.pci);
case BUS_ISA:
return TRUE;
case BUS_SBUS:
@ -1361,7 +1360,9 @@ xf86AddRangesToList(resPtr list, resRange *pRange, int entityIndex)
void
xf86ResourceBrokerInit(void)
{
#if 0
resPtr resPci;
#endif
osRes = NULL;
@ -1376,8 +1377,12 @@ xf86ResourceBrokerInit(void)
xf86PrintResList(3, osRes);
/* Bus dep initialization */
#if 0
resPci = ResourceBrokerInitPci(&osRes);
Acc = xf86JoinResLists(xf86DupResList(osRes), resPci);
#else
Acc = xf86DupResList( osRes );
#endif
xf86MsgVerb(X_INFO, 3, "All system resource ranges:\n");
xf86PrintResList(3, Acc);
@ -1765,7 +1770,7 @@ xf86GetResourcesImplicitly(int entityIndex)
case BUS_SBUS:
return NULL;
case BUS_PCI:
return GetImplicitPciResources(entityIndex);
return NULL;
case BUS_last:
return NULL;
}
@ -1856,31 +1861,34 @@ xf86RegisterResources(int entityIndex, resList list, unsigned long access)
}
static void
busTypeSpecific(EntityPtr pEnt, xf86State state, xf86AccessPtr *acc_mem,
busTypeSpecific(EntityPtr pEnt, xf86AccessPtr *acc_mem,
xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io)
{
pciAccPtr *ppaccp;
switch (pEnt->bus.type) {
case BUS_ISA:
case BUS_SBUS:
*acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
break;
*acc_mem = *acc_io = *acc_mem_io = &AccessNULL;
break;
case BUS_PCI:
ppaccp = xf86PciAccInfo;
while (*ppaccp) {
if ((*ppaccp)->busnum == pEnt->pciBusId.bus
&& (*ppaccp)->devnum == pEnt->pciBusId.device
&& (*ppaccp)->funcnum == pEnt->pciBusId.func) {
*acc_io = &(*ppaccp)->ioAccess;
*acc_mem = &(*ppaccp)->memAccess;
*acc_mem_io = &(*ppaccp)->io_memAccess;
break;
}
ppaccp++;
case BUS_PCI: {
struct pci_device *const dev = pEnt->bus.id.pci;
if ((dev != NULL) && ((void *)dev->user_data != NULL)) {
pciAccPtr const paccp = (pciAccPtr) dev->user_data;
*acc_io = & paccp->ioAccess;
*acc_mem = & paccp->memAccess;
*acc_mem_io = & paccp->io_memAccess;
}
else {
/* FIXME: This is an error path. We should probably have an
* FIXME: assertion here or something.
*/
*acc_io = NULL;
*acc_mem = NULL;
*acc_mem_io = NULL;
}
break;
}
default:
*acc_mem = *acc_io = *acc_mem_io = NULL;
break;
@ -1896,7 +1904,7 @@ setAccess(EntityPtr pEnt, xf86State state)
xf86AccessPtr org_mem = NULL, org_io = NULL, org_mem_io = NULL;
int prop;
busTypeSpecific(pEnt,state,&acc_mem,&acc_io,&acc_mem_io);
busTypeSpecific(pEnt, &acc_mem, &acc_io, &acc_mem_io);
/* The replacement function needs to handle _all_ shared resources */
/* unless they are handeled locally and disabled otherwise */
@ -2449,15 +2457,6 @@ xf86PostProbe(void)
#endif
}
xf86FreeResList(acc);
#if !(defined(__alpha__) && defined(linux)) && \
!(defined(__ia64__) && defined(linux)) && \
!(defined(__sparc64__) && defined(__OpenBSD__))
/*
* No need to validate on Alpha Linux or OpenBSD/sparc64,
* trust the kernel.
*/
ValidatePci();
#endif
xf86MsgVerb(X_INFO, 3, "resource ranges after probing:\n");
xf86PrintResList(3, Acc);
@ -2976,14 +2975,16 @@ xf86FindPrimaryDevice()
CheckGenericGA();
if (primaryBus.type != BUS_NONE) {
char *bus;
char *loc = xnfcalloc(1,9);
if (loc == NULL) return;
char loc[16];
switch (primaryBus.type) {
case BUS_PCI:
bus = "PCI";
sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus,
primaryBus.id.pci.device,primaryBus.id.pci.func);
snprintf(loc, sizeof(loc), " %2.2x@%2.2x:%2.2x:%1.1x",
primaryBus.id.pci->bus,
primaryBus.id.pci->domain,
primaryBus.id.pci->dev,
primaryBus.id.pci->func);
break;
case BUS_ISA:
bus = "ISA";
@ -2991,17 +2992,15 @@ xf86FindPrimaryDevice()
break;
case BUS_SBUS:
bus = "SBUS";
sprintf(loc," %2.2x",primaryBus.id.sbus.fbNum);
snprintf(loc, sizeof(loc), " %2.2x", primaryBus.id.sbus.fbNum);
break;
default:
bus = "";
loc[0] = '\0';
}
xf86MsgVerb(X_INFO, 2, "Primary Device is: %s%s\n",bus,loc);
xfree(loc);
}
}
#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__arm__)

View File

@ -91,7 +91,6 @@ typedef struct {
#define NEED_SHARED (NEED_MEM_SHARED | NEED_IO_SHARED)
#define busType bus.type
#define pciBusId bus.id.pci
#define isaBusId bus.id.isa
#define sbusBusId bus.id.sbus
@ -114,7 +113,7 @@ typedef struct x_BusAccRec {
struct {
int bus;
int primary_bus;
PCITAG acc;
struct pci_device * dev;
pciBridgesSave save;
} pci;
} busdep;

View File

@ -60,6 +60,7 @@
#include "configProcs.h"
#include "globals.h"
#include "extension.h"
#include "Pci.h"
#ifdef XINPUT
#include "xf86Xinput.h"
@ -114,6 +115,17 @@ extern DeviceAssocRec mouse_assoc;
static char *fontPath = NULL;
static ModuleDefault ModuleDefaults[] = {
{.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
{.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
};
/* Forward declarations */
static Bool configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen,
int scrnum, MessageType from);
@ -2530,8 +2542,9 @@ xf86HandleConfigFile(Bool autoconfig)
xf86Msg(X_WARNING, "Bus types other than PCI not yet isolable.\n"
"\tIgnoring IsolateDevice option.\n");
} else if (sscanf(scanptr, "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
xf86IsolateDevice.bus = bus;
xf86IsolateDevice.device = device;
xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
xf86IsolateDevice.dev = device;
xf86IsolateDevice.func = func;
xf86Msg(X_INFO,
"Isolating PCI bus \"%d:%d:%d\"\n", bus, device, func);

View File

@ -54,17 +54,6 @@ typedef struct _ModuleDefault {
XF86OptionPtr load_opt;
} ModuleDefault;
static ModuleDefault ModuleDefaults[] = {
{.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
{.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
{.name = "type1", .toLoad = TRUE, .load_opt=NULL},
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
};
/*
* prototypes
*/

View File

@ -35,13 +35,14 @@
#include <fcntl.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <pciaccess.h>
#include "Pci.h"
#include "os.h"
#include "loaderProcs.h"
#include "xf86.h"
#include "xf86Config.h"
#include "xf86_OSlib.h"
#include "xf86Priv.h"
#include "xf86PciData.h"
#define IN_XSERVER
#include "xf86Parser.h"
#include "xf86tokens.h"
@ -56,7 +57,7 @@
typedef struct _DevToConfig {
GDevRec GDev;
pciVideoPtr pVideo;
struct pci_device * pVideo;
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
sbusDevicePtr sVideo;
#endif
@ -101,7 +102,7 @@ GDevPtr
xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
{
int i, j;
pciVideoPtr pVideo = NULL;
struct pci_device * pVideo = NULL;
Bool isPrimary = FALSE;
if (xf86DoProbe || !xf86DoConfigure || !xf86DoConfigurePass1)
@ -110,11 +111,12 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
/* Check for duplicates */
switch (bus) {
case BUS_PCI:
pVideo = (pciVideoPtr) busData;
pVideo = (struct pci_device *) busData;
for (i = 0; i < nDevToConfig; i++)
if (DevToConfig[i].pVideo &&
(DevToConfig[i].pVideo->domain == pVideo->domain) &&
(DevToConfig[i].pVideo->bus == pVideo->bus) &&
(DevToConfig[i].pVideo->device == pVideo->device) &&
(DevToConfig[i].pVideo->dev == pVideo->dev) &&
(DevToConfig[i].pVideo->func == pVideo->func))
return NULL;
isPrimary = xf86IsPrimaryPci(pVideo);
@ -173,9 +175,9 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
char busnum[8];
NewDevice.pVideo = pVideo;
xf86FindPciNamesByDevice(pVideo->vendor, pVideo->chipType,
NOVENDOR, NOSUBSYS,
&VendorName, &CardName, NULL, NULL);
VendorName = pci_device_get_vendor_name( pVideo );
CardName = pci_device_get_device_name( pVideo );
if (!VendorName) {
VendorName = xnfalloc(15);
@ -197,13 +199,13 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
NewDevice.GDev.busID = xnfalloc(16);
xf86FormatPciBusNumber(pVideo->bus, busnum);
sprintf(NewDevice.GDev.busID, "PCI:%s:%d:%d",
busnum, pVideo->device, pVideo->func);
busnum, pVideo->dev, pVideo->func);
NewDevice.GDev.chipID = pVideo->chipType;
NewDevice.GDev.chipRev = pVideo->chipRev;
NewDevice.GDev.chipID = pVideo->device_id;
NewDevice.GDev.chipRev = pVideo->revision;
if (chipset < 0)
chipset = (pVideo->vendor << 16) | pVideo->chipType;
chipset = (pVideo->vendor_id << 16) | pVideo->device_id;
}
break;
case BUS_ISA:
@ -249,7 +251,8 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
* Backwards compatibility
*/
_X_EXPORT GDevPtr
xf86AddDeviceToConfigure(const char *driver, pciVideoPtr pVideo, int chipset)
xf86AddDeviceToConfigure(const char *driver, struct pci_device * pVideo,
int chipset)
{
return xf86AddBusDeviceToConfigure(driver, pVideo ? BUS_PCI : BUS_ISA,
pVideo, chipset);
@ -759,22 +762,20 @@ DoConfigure()
/* Call all of the probe functions, reporting the results. */
for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
xorgHWFlags flags;
Bool found_screen;
DriverRec * const drv = xf86DriverList[CurrentDriver];
if (!xorgHWAccess) {
if (!xf86DriverList[CurrentDriver]->driverFunc
|| !xf86DriverList[CurrentDriver]->driverFunc(NULL,
GET_REQUIRED_HW_INTERFACES,
&flags)
if (!drv->driverFunc
|| !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
|| NEED_IO_ENABLED(flags))
continue;
}
if (xf86DriverList[CurrentDriver]->Probe == NULL) continue;
if ((*xf86DriverList[CurrentDriver]->Probe)(
xf86DriverList[CurrentDriver], PROBE_DETECT) &&
xf86DriverList[CurrentDriver]->Identify)
(*xf86DriverList[CurrentDriver]->Identify)(0);
found_screen = xf86CallDriverProbe( drv, TRUE );
if ( found_screen && drv->Identify ) {
(*drv->Identify)(0);
}
}
if (nDevToConfig <= 0) {
@ -860,7 +861,7 @@ DoConfigure()
oldNumScreens = xf86NumScreens;
(*xf86DriverList[i]->Probe)(xf86DriverList[i], 0);
xf86CallDriverProbe( xf86DriverList[i], FALSE );
/* reorder */
k = screennum > 0 ? screennum : 1;
@ -888,7 +889,6 @@ DoConfigure()
}
}
}
xf86SetPciVideo(NULL,NONE);
}
xfree(driverProbed);
}

View File

@ -92,9 +92,7 @@ DoProbe()
xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n", drv->driverName);
if (drv->Probe == NULL) continue;
probeResult = (*drv->Probe)( drv, PROBE_DETECT );
probeResult = xf86CallDriverProbe( drv, TRUE );
if (!probeResult) {
xf86ErrorF("Probe in driver `%s' returns FALSE\n",
drv->driverName);

View File

@ -38,20 +38,76 @@
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <pciaccess.h>
#include "os.h"
#include "loaderProcs.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Pci.h"
#include "xf86ScanPci.h"
#include "Pci.h"
#include "xf86_OSproc.h"
static void ScanPciDisplayPCICardInfo(void);
void
ScanPciDisplayPCICardInfo(void)
{
struct pci_id_match match;
struct pci_device_iterator *iter;
const struct pci_device *dev;
xf86EnableIO();
if (! xf86scanpci()) {
xf86MsgVerb(X_NONE, 0, "No PCI info available\n");
return;
}
xf86MsgVerb(X_NONE, 0,
"Probing for PCI devices (Bus:Device:Function)\n\n");
iter = pci_id_match_iterator_create(NULL);
while ((dev = pci_device_next(iter)) != NULL) {
const char *svendorname = NULL, *subsysname = NULL;
const char *vendorname = NULL, *devicename = NULL;
xf86MsgVerb(X_NONE, 0, "(%d:%d:%d) ",
PCI_MAKE_BUS(dev->domain, dev->bus), dev->dev, dev->func);
/*
* Lookup as much as we can about the device.
*/
match.vendor_id = dev->vendor_id;
match.device_id = dev->device_id;
match.subvendor_id = (dev->subvendor_id != 0)
? dev->subvendor_id : PCI_MATCH_ANY;
match.subdevice_id = (dev->subdevice_id != 0)
? dev->subdevice_id : PCI_MATCH_ANY;
match.device_class = 0;
match.device_class_mask = 0;
pci_get_strings(& match, & vendorname, & devicename,
& svendorname, & subsysname);
if ((dev->subvendor_id != 0) || (dev->subdevice_id != 0)) {
xf86MsgVerb(X_NONE, 0, "%s %s (0x%04x / 0x%04x) using ",
(svendorname == NULL) ? "unknown vendor" : svendorname,
(subsysname == NULL) ? "unknown card" : subsysname,
dev->subvendor_id, dev->subdevice_id);
}
xf86MsgVerb(X_NONE, 0, "%s %s (0x%04x / 0x%04x)\n",
(vendorname == NULL) ? "unknown vendor" : vendorname,
(devicename == NULL) ? "unknown chip" : devicename,
dev->vendor_id, dev->device_id);
}
pci_iterator_destroy(iter);
}
void DoScanPci(int argc, char **argv, int i)
{
int j,skip,globalVerbose,scanpciVerbose;
ScanPciSetupProcPtr PciSetup;
ScanPciDisplayCardInfoProcPtr DisplayPCICardInfo;
int errmaj, errmin;
int j,skip,globalVerbose;
/*
* first we need to finish setup of the OS so that we can call other
@ -81,32 +137,7 @@ void DoScanPci(int argc, char **argv, int i)
if (xf86Verbose > globalVerbose)
xf86SetVerbosity(globalVerbose);
/*
* Setting scanpciVerbose to 0 will ensure that the output will go to
* stderr for all reasonable default stderr verbosity levels.
*/
scanpciVerbose = 0;
/*
* now get the loader set up and load the scanpci module
*/
/* Initialise the loader */
LoaderInit();
/* Tell the loader the default module search path */
LoaderSetPath(xf86ModulePath);
if (!LoadModule("scanpci", NULL, NULL, NULL, NULL, NULL,
&errmaj, &errmin)) {
LoaderErrorMsg(NULL, "scanpci", errmaj, errmin);
exit(1);
}
PciSetup = (ScanPciSetupProcPtr)LoaderSymbol("ScanPciSetupPciIds");
DisplayPCICardInfo =
(ScanPciDisplayCardInfoProcPtr)LoaderSymbol("ScanPciDisplayPCICardInfo");
if (!(*PciSetup)())
FatalError("ScanPciSetupPciIds() failed\n");
(*DisplayPCICardInfo)(scanpciVerbose);
ScanPciDisplayPCICardInfo();
/*
* That's it; we really should clean things up, but a simple

View File

@ -203,4 +203,7 @@ Bool xf86MiscModInDevAllowNonLocal = FALSE;
RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
_X_EXPORT Bool xf86inSuspend = FALSE;
Bool xorgHWAccess = FALSE;
PciBusId xf86IsolateDevice;
struct pci_slot_match xf86IsolateDevice = {
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0
};

View File

@ -39,6 +39,9 @@
#include <xorg-config.h>
#endif
#include <pciaccess.h>
#include "Pci.h"
#include <X11/X.h>
#include "os.h"
#include "servermd.h"
@ -1111,7 +1114,7 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
WindowPtr pChild;
Bool WasViewable = (Bool)(pWin->viewable);
Bool anyMarked = FALSE;
RegionPtr pOldClip = NULL, bsExposed;
RegionPtr pOldClip = NULL;
#ifdef DO_SAVE_UNDERS
Bool dosave = FALSE;
#endif
@ -1172,12 +1175,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
if (WasViewable)
{
if (pWin->backStorage)
{
pOldClip = REGION_CREATE(pScreen, NullBox, 1);
REGION_COPY(pScreen, pOldClip, &pWin->clipList);
}
if (pWin->firstChild)
{
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
@ -1201,28 +1198,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable)
(*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
}
if (pWin->backStorage &&
((pWin->backingStore == Always) || WasViewable))
{
if (!WasViewable)
pOldClip = &pWin->clipList; /* a convenient empty region */
bsExposed = (*pScreen->TranslateBackingStore)
(pWin, 0, 0, pOldClip,
pWin->drawable.x, pWin->drawable.y);
if (WasViewable)
REGION_DESTROY(pScreen, pOldClip);
if (bsExposed)
{
RegionPtr valExposed = NullRegion;
if (pWin->valdata)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
REGION_EMPTY(pScreen, valExposed);
REGION_DESTROY(pScreen, bsExposed);
}
}
if (WasViewable)
{
if (anyMarked)
@ -1595,7 +1570,7 @@ xf86MatchDevice(const char *drivername, GDevPtr **sectlist)
}
struct Inst {
pciVideoPtr pci;
struct pci_device * pci;
GDevPtr dev;
Bool foundHW; /* PCIid in list of supported chipsets */
Bool claimed; /* BusID matches with a device section */
@ -1643,7 +1618,8 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
int **foundEntities)
{
int i,j;
pciVideoPtr pPci, *ppPci;
struct pci_device * pPci;
struct pci_device_iterator *iter;
struct Inst *instances = NULL;
int numClaimedInstances = 0;
int allocatedInstances = 0;
@ -1654,8 +1630,6 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
*foundEntities = NULL;
if (!xf86PciVideoInfo)
return 0;
/* Each PCI device will contribute at least one entry. Each device
* section can contribute at most one entry. The sum of the two is
@ -1665,21 +1639,22 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
*/
if ( !xf86DoProbe && !(xf86DoConfigure && xf86DoConfigurePass1) ) {
unsigned max_entries = numDevs;
for (ppPci = xf86PciVideoInfo ; *ppPci != NULL ; ppPci++) {
iter = pci_slot_match_iterator_create(NULL);
while ((pPci = pci_device_next(iter)) != NULL) {
max_entries++;
}
instances = xnfalloc( max_entries * sizeof(struct Inst) );
pci_iterator_destroy(iter);
instances = xnfalloc(max_entries * sizeof(struct Inst));
}
for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) {
unsigned device_class = ((*ppPci)->class << 16)
| ((*ppPci)->subclass << 8) | ((*ppPci)->interface);
iter = pci_slot_match_iterator_create(NULL);
while ((pPci = pci_device_next(iter)) != NULL) {
unsigned device_class = pPci->device_class;
Bool foundVendor = FALSE;
pPci = *ppPci;
/* Convert the pre-PCI 2.0 device class for a VGA adapter to the
* 2.0 version of the same class.
*/
@ -1704,19 +1679,21 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
const unsigned device_id = (id->PCIid & 0x0000FFFF);
const unsigned match_class = 0x00030000 | id->PCIid;
if ( (vendor_id == pPci->vendor)
|| ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class)) ) {
if ( !foundVendor && (instances != NULL) ) {
if ((vendor_id == pPci->vendor_id)
|| ((vendorID == PCI_VENDOR_GENERIC) && (match_class == device_class))) {
if (!foundVendor && (instances != NULL)) {
++allocatedInstances;
instances[allocatedInstances - 1].pci = *ppPci;
instances[allocatedInstances - 1].pci = pPci;
instances[allocatedInstances - 1].dev = NULL;
instances[allocatedInstances - 1].claimed = FALSE;
instances[allocatedInstances - 1].foundHW = FALSE;
instances[allocatedInstances - 1].screen = 0;
foundVendor = TRUE;
}
if ( (device_id == pPci->chipType)
|| ((vendorID == PCI_VENDOR_GENERIC)
foundVendor = TRUE;
if ( (device_id == pPci->device_id)
|| ((vendorID == PCI_VENDOR_GENERIC)
&& (match_class == device_class)) ) {
if ( instances != NULL ) {
instances[allocatedInstances - 1].foundHW = TRUE;
@ -1725,11 +1702,10 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
if ( xf86CheckPciSlot(pPci->bus, pPci->device,
pPci->func) ) {
GDevPtr pGDev =
xf86AddDeviceToConfigure( drvp->driverName,
pPci, -1 );
if (xf86CheckPciSlot(pPci)) {
GDevPtr pGDev =
xf86AddDeviceToConfigure(drvp->driverName,
pPci, -1);
if (pGDev) {
/* After configure pass 1, chipID and chipRev
* are treated as over-rides, so clobber them
@ -1752,6 +1728,8 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
}
}
pci_iterator_destroy(iter);
/* In "probe only" or "configure" mode (signaled by instances being NULL),
* our work is done. Return the number of detected devices.
@ -1789,8 +1767,9 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
&& *devList[j]->busID) {
for (i = 0; i < allocatedInstances; i++) {
pPci = instances[i].pci;
if (xf86ComparePciBusString(devList[j]->busID, pPci->bus,
pPci->device,
if (xf86ComparePciBusString(devList[j]->busID,
PCI_MAKE_BUS( pPci->domain, pPci->bus ),
pPci->dev,
pPci->func)) {
allocatedInstances++;
instances[allocatedInstances - 1] = instances[i];
@ -1810,9 +1789,10 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
pPci = instances[i].pci;
for (j = 0; j < numDevs; j++) {
if (devList[j]->busID && *devList[j]->busID) {
if (xf86ComparePciBusString(devList[j]->busID, pPci->bus,
pPci->device,
pPci->func) &&
if (xf86ComparePciBusString(devList[j]->busID,
PCI_MAKE_BUS( pPci->domain, pPci->bus ),
pPci->dev,
pPci->func) &&
devList[j]->screen == instances[i].screen) {
if (devBus)
@ -1843,10 +1823,11 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
}
if (devBus) dev = devBus; /* busID preferred */
if (!dev) {
if (xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) {
if ( xf86CheckPciSlot( pPci ) ) {
xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID PCI:%i:%i:%i) found\n",
driverName, pPci->bus, pPci->device, pPci->func);
"for instance (BusID PCI:%u@%u:%u:%u) found\n",
driverName, pPci->domain, pPci->bus, pPci->dev,
pPci->func);
}
} else {
numClaimedInstances++;
@ -1957,31 +1938,27 @@ xf86MatchPciInstances(const char *driverName, int vendorID,
* XXX Need to make sure that two different drivers don't claim
* the same screen > 0 instance.
*/
if (instances[i].screen == 0 &&
!xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func))
if (instances[i].screen == 0 && !xf86CheckPciSlot( pPci ))
continue;
#ifdef DEBUG
ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
driverName, pPci->bus, pPci->device, pPci->func);
driverName, pPci->bus, pPci->dev, pPci->func);
#endif
/* Allocate an entry in the lists to be returned */
numFound++;
retEntities = xnfrealloc(retEntities, numFound * sizeof(int));
retEntities[numFound - 1]
= xf86ClaimPciSlot(pPci->bus, pPci->device,
pPci->func,drvp, instances[i].chip,
instances[i].dev,instances[i].dev->active ?
TRUE : FALSE);
retEntities[numFound - 1] = xf86ClaimPciSlot( pPci, drvp,
instances[i].chip,
instances[i].dev,
instances[i].dev->active);
if (retEntities[numFound - 1] == -1 && instances[i].screen > 0) {
for (j = 0; j < xf86NumEntities; j++) {
EntityPtr pEnt = xf86Entities[j];
if (pEnt->busType != BUS_PCI)
if (pEnt->bus.type != BUS_PCI)
continue;
if (pEnt->pciBusId.bus == pPci->bus &&
pEnt->pciBusId.device == pPci->device &&
pEnt->pciBusId.func == pPci->func) {
if (pEnt->bus.id.pci == pPci) {
retEntities[numFound - 1] = j;
xf86AddDevToEntity(j, instances[i].dev);
break;

View File

@ -92,6 +92,9 @@
#include "dpmsproc.h"
#endif
#include <pciaccess.h>
#include "Pci.h"
#include "xf86Bus.h"
/* forward declarations */
@ -101,15 +104,14 @@ static void xf86PrintDefaultModulePath(void);
static void xf86PrintDefaultLibraryPath(void);
static void xf86RunVtInit(void);
static Bool probe_devices_from_device_sections(DriverPtr drvp);
static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
static Bool check_for_matching_devices(DriverPtr drvp);
#ifdef XF86PM
void (*xf86OSPMClose)(void) = NULL;
#endif
static char *baseModules[] = {
"pcidata",
NULL
};
/* Common pixmap formats */
static PixmapFormatRec formats[MAXFORMATS] = {
@ -243,6 +245,233 @@ PostConfigInit(void)
OsInitColors();
}
#define END_OF_MATCHES(m) \
(((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0))
Bool
probe_devices_from_device_sections(DriverPtr drvp)
{
int i, j;
struct pci_device * pPci;
Bool foundScreen = FALSE;
const struct pci_id_match * const devices = drvp->supported_devices;
GDevPtr *devList;
const unsigned numDevs = xf86MatchDevice(drvp->driverName, & devList);
for ( i = 0 ; i < numDevs ; i++ ) {
struct pci_device_iterator *iter;
unsigned device_id;
/* Find the pciVideoRec associated with this device section.
*/
iter = pci_id_match_iterator_create(NULL);
while ((pPci = pci_device_next(iter)) != NULL) {
if (devList[i]->busID && *devList[i]->busID) {
if (xf86ComparePciBusString(devList[i]->busID,
((pPci->domain << 8)
| pPci->bus),
pPci->dev,
pPci->func)) {
break;
}
}
else if (xf86IsPrimaryPci(pPci)) {
break;
}
}
pci_iterator_destroy(iter);
if (pPci == NULL) {
continue;
}
device_id = (devList[i]->chipID > 0)
? devList[i]->chipID : pPci->device_id;
/* Once the pciVideoRec is found, determine if the device is supported
* by the driver. If it is, probe it!
*/
for ( j = 0 ; ! END_OF_MATCHES( devices[j] ) ; j++ ) {
if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
&& PCI_ID_COMPARE( devices[j].device_id, device_id )
&& ((devices[j].device_class_mask & pPci->device_class)
== devices[j].device_class) ) {
int entry;
/* Allow the same entity to be used more than once for
* devices with multiple screens per entity. This assumes
* implicitly that there will be a screen == 0 instance.
*
* FIXME Need to make sure that two different drivers don't
* FIXME claim the same screen > 0 instance.
*/
if ( (devList[i]->screen == 0) && !xf86CheckPciSlot( pPci ) )
continue;
#ifdef DEBUG
ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
drvp->driverName, pPci->bus, pPci->dev, pPci->func);
#endif
/* Allocate an entry in the lists to be returned */
entry = xf86ClaimPciSlot(pPci, drvp, device_id,
devList[i], devList[i]->active);
if ((entry == -1) && (devList[i]->screen > 0)) {
unsigned k;
for ( k = 0; k < xf86NumEntities; k++ ) {
EntityPtr pEnt = xf86Entities[k];
if (pEnt->busType != BUS_PCI)
continue;
if (pEnt->bus.id.pci == pPci) {
entry = k;
xf86AddDevToEntity(k, devList[i]);
break;
}
}
}
if (entry != -1) {
if ((*drvp->PciProbe)(drvp, entry, pPci,
devices[j].match_data)) {
foundScreen = TRUE;
}
}
break;
}
}
}
return foundScreen;
}
Bool
add_matching_devices_to_configure_list(DriverPtr drvp)
{
const struct pci_id_match * const devices = drvp->supported_devices;
int j;
struct pci_device *pPci;
struct pci_device_iterator *iter;
int numFound = 0;
iter = pci_id_match_iterator_create(NULL);
while ((pPci = pci_device_next(iter)) != NULL) {
/* Determine if this device is supported by the driver. If it is,
* add it to the list of devices to configure.
*/
for (j = 0 ; ! END_OF_MATCHES(devices[j]) ; j++) {
if ( PCI_ID_COMPARE( devices[j].vendor_id, pPci->vendor_id )
&& PCI_ID_COMPARE( devices[j].device_id, pPci->device_id )
&& ((devices[j].device_class_mask & pPci->device_class)
== devices[j].device_class) ) {
if (xf86CheckPciSlot(pPci)) {
GDevPtr pGDev =
xf86AddDeviceToConfigure(drvp->driverName, pPci, -1);
if (pGDev != NULL) {
/* After configure pass 1, chipID and chipRev are
* treated as over-rides, so clobber them here.
*/
pGDev->chipID = -1;
pGDev->chipRev = -1;
}
numFound++;
}
break;
}
}
}
pci_iterator_destroy(iter);
return (numFound != 0);
}
Bool
check_for_matching_devices(DriverPtr drvp)
{
const struct pci_id_match * const devices = drvp->supported_devices;
int j;
for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
struct pci_device_iterator *iter;
struct pci_device *dev;
iter = pci_id_match_iterator_create(& devices[j]);
dev = pci_device_next(iter);
pci_iterator_destroy(iter);
if (dev != NULL) {
return TRUE;
}
}
return FALSE;
}
/**
* Call the driver's correct probe function.
*
* If the driver implements the \c DriverRec::PciProbe entry-point and an
* appropriate PCI device (with matching Device section in the xorg.conf file)
* is found, it is called. If \c DriverRec::PciProbe or no devices can be
* successfully probed with it (e.g., only non-PCI devices are available),
* the driver's \c DriverRec::Probe function is called.
*
* \param drv Driver to probe
*
* \return
* If a device can be successfully probed by the driver, \c TRUE is
* returned. Otherwise, \c FALSE is returned.
*/
Bool
xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
{
Bool foundScreen = FALSE;
if ( drv->PciProbe != NULL ) {
if ( xf86DoProbe ) {
assert( detect_only );
foundScreen = check_for_matching_devices( drv );
}
else if ( xf86DoConfigure && xf86DoConfigurePass1 ) {
assert( detect_only );
foundScreen = add_matching_devices_to_configure_list( drv );
}
else {
assert( ! detect_only );
foundScreen = probe_devices_from_device_sections( drv );
}
}
if ( ! foundScreen && (drv->Probe != NULL) ) {
xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
drv->driverName );
foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT
: PROBE_DEFAULT );
}
return foundScreen;
}
void
InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
{
@ -313,10 +542,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
}
/* Force load mandatory base modules */
if (!xf86LoadModules(baseModules, NULL))
FatalError("Unable to load required base modules, Exiting...\n");
xf86OpenConsole();
/* Do a general bus probe. This will be a PCI probe for x86 platforms */
@ -433,16 +658,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|| NEED_IO_ENABLED(flags))
continue;
}
if (xf86DriverList[i]->Probe != NULL)
xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DEFAULT);
else {
xf86MsgVerb(X_WARNING, 0,
"Driver `%s' has no Probe function (ignoring)\n",
xf86DriverList[i]->driverName
? xf86DriverList[i]->driverName : "noname");
}
xf86SetPciVideo(NULL,NONE);
xf86CallDriverProbe( xf86DriverList[i], FALSE );
}
/*
@ -1501,8 +1718,9 @@ ddxProcessArgument(int argc, char **argv, int i)
FatalError("Bus types other than PCI not yet isolable\n");
}
if (sscanf(argv[i], "PCI:%d:%d:%d", &bus, &device, &func) == 3) {
xf86IsolateDevice.bus = bus;
xf86IsolateDevice.device = device;
xf86IsolateDevice.domain = PCI_DOM_FROM_BUS(bus);
xf86IsolateDevice.bus = PCI_BUS_NO_DOMAIN(bus);
xf86IsolateDevice.dev = device;
xf86IsolateDevice.func = func;
return 2;
} else {

View File

@ -83,7 +83,7 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(2, 0)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(3, 0)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(2, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)

View File

@ -36,6 +36,8 @@
#ifndef _XF86PRIV_H
#define _XF86PRIV_H
#include <pciaccess.h>
#include "xf86Privstr.h"
#include "propertyst.h"
@ -76,7 +78,7 @@ extern Bool xf86BestRefresh;
extern Gamma xf86Gamma;
extern char *xf86ServerName;
extern Bool xf86ShowUnresolved;
extern PciBusId xf86IsolateDevice;
extern struct pci_slot_match xf86IsolateDevice;
/* Other parameters */
@ -101,7 +103,6 @@ extern int xf86NumDrivers;
extern Bool xf86Resetting;
extern Bool xf86Initialising;
extern int xf86NumScreens;
extern pciVideoPtr *xf86PciVideoInfo;
extern xf86CurrentAccessRec xf86CurrentAccess;
extern const char *xf86VisualNames[];
extern int xf86Verbose; /* verbosity level */
@ -148,9 +149,6 @@ void xf86ClearEntityListForScreen(int scrnIndex);
void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
extern void xf86PostPreInit(void);
extern void xf86PostScreenInit(void);
extern memType getValidBIOSBase(PCITAG tag, int num);
extern memType getEmptyPciRange(PCITAG tag, int base_reg);
extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag);
/* xf86Config.c */
@ -187,6 +185,7 @@ void xf86CloseLog(void);
Bool xf86LoadModules(char **list, pointer *optlist);
int xf86SetVerbosity(int verb);
int xf86SetLogVerbosity(int verb);
Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
/* xf86Lock.c */

File diff suppressed because it is too large Load Diff

View File

@ -42,14 +42,11 @@ typedef struct {
} pciSave, *pciSavePtr;
typedef struct {
PCITAG tag;
struct pci_device * dev;
CARD32 ctrl;
} pciArg;
typedef struct {
int busnum;
int devnum;
int funcnum;
pciArg arg;
xf86AccessRec ioAccess;
xf86AccessRec io_memAccess;
@ -63,24 +60,7 @@ typedef union {
CARD16 control;
} pciBridgesSave, *pciBridgesSavePtr;
typedef struct pciBusRec {
int brbus, brdev, brfunc; /* ID of the bridge to this bus */
int primary, secondary, subordinate;
int subclass; /* bridge type */
int interface;
resPtr preferred_io; /* I/O range */
resPtr preferred_mem; /* non-prefetchable memory range */
resPtr preferred_pmem; /* prefetchable memory range */
resPtr io; /* for subtractive PCI-PCI bridges */
resPtr mem;
resPtr pmem;
int brcontrol; /* bridge_control byte */
struct pciBusRec *next;
} PciBusRec, *PciBusPtr;
void xf86PciProbe(void);
void ValidatePci(void);
resList GetImplicitPciResources(int entityIndex);
void initPciState(void);
void initPciBusState(void);
void DisablePciAccess(void);
@ -89,10 +69,7 @@ void PciStateEnter(void);
void PciBusStateEnter(void);
void PciStateLeave(void);
void PciBusStateLeave(void);
resPtr ResourceBrokerInitPci(resPtr *osRes);
void pciConvertRange2Host(int entityIndex, resRange *pRange);
void isaConvertRange2Host(resRange *pRange);
extern pciAccPtr * xf86PciAccInfo;
#endif /* _XF86_PCI_BUS_H */

View File

@ -43,11 +43,21 @@
#include "xf86Opt.h"
#include "xf86Pci.h"
/*
* memType is of the size of the addressable memory (machine size)
* usually unsigned long.
#include <pciaccess.h>
/**
* Integer type that is of the size of the addressable memory (machine size).
* On most platforms \c uintptr_t will suffice. However, on some mixed
* 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this
* must be 64-bits.
*/
typedef unsigned long memType;
#include <inttypes.h>
#if defined(__powerpc__)
typedef uint64_t memType;
#else
typedef uintptr_t memType;
#endif
/* Video mode flags */
@ -307,6 +317,9 @@ typedef struct {
int refCount;
} DriverRec1;
struct _SymTabRec;
struct _PciChipsets;
typedef struct _DriverRec {
int driverVersion;
char * driverName;
@ -316,6 +329,10 @@ typedef struct _DriverRec {
pointer module;
int refCount;
xorgDriverFuncProc *driverFunc;
const struct pci_id_match * supported_devices;
Bool (*PciProbe)( struct _DriverRec * drv, int entity_num,
struct pci_device * dev, intptr_t match_data );
} DriverRec, *DriverPtr;
/*
@ -361,11 +378,7 @@ typedef enum {
BUS_last /* Keep last */
} BusType;
typedef struct {
int bus;
int device;
int func;
} PciBusId;
struct pci_device;
typedef struct {
unsigned int dummy;
@ -379,7 +392,7 @@ typedef struct _bus {
BusType type;
union {
IsaBusId isa;
PciBusId pci;
struct pci_device *pci;
SbusBusId sbus;
} id;
} BusRec, *BusPtr;
@ -430,29 +443,6 @@ typedef struct {
pointer extraOptions;
} IDevRec, *IDevPtr;
typedef struct {
int vendor;
int chipType;
int chipRev;
int subsysVendor;
int subsysCard;
int bus;
int device;
int func;
int class;
int subclass;
int interface;
memType memBase[6];
memType ioBase[6];
int size[6];
unsigned char type[6];
memType biosBase;
int biosSize;
pointer thisCard;
Bool validSize;
Bool validate;
} pciVideoRec, *pciVideoPtr;
typedef struct {
int frameX0;
int frameY0;
@ -735,7 +725,7 @@ typedef struct {
resRange *resList;
} IsaChipsets;
typedef struct {
typedef struct _PciChipsets {
/**
* Key used to match this device with its name in an array of
* \c SymTabRec.
@ -1064,7 +1054,7 @@ typedef struct {
);
} DGAFunctionRec, *DGAFunctionPtr;
typedef struct {
typedef struct _SymTabRec {
int token; /* id of the token */
const char * name; /* token name */
} SymTabRec, *SymTabPtr;

View File

@ -40,8 +40,7 @@ extsmodule_LTLIBRARIES = librecord.la \
$(XTRAPMOD)
fontsmoduledir = $(moduledir)/fonts
fontsmodule_LTLIBRARIES = libfreetype.la \
libtype1.la
fontsmodule_LTLIBRARIES = libfreetype.la
AM_CFLAGS = @XORG_CFLAGS@ @DIX_CFLAGS@
INCLUDES = @XORG_INCS@ \
@ -104,9 +103,6 @@ libshadow_la_SOURCES = shmodule.c
libfreetype_la_LDFLAGS = -avoid-version
libfreetype_la_SOURCES = ftmodule.c
libtype1_la_LDFLAGS = -avoid-version
libtype1_la_SOURCES = type1mod.c
libdixmods_la_SOURCES = $(top_srcdir)/mi/miinitext.c
libdixmods_la_CFLAGS = -DXFree86LOADER $(AM_CFLAGS)

View File

@ -1,75 +0,0 @@
/*
* Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* 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.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include <X11/fonts/fontmod.h>
#include "xf86Module.h"
static MODULESETUPPROTO(type1Setup);
/*
* This is the module data function that is accessed when loading
* libtype1 as a module.
*/
static XF86ModuleVersionInfo VersRec =
{
"type1",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 0, 2,
ABI_CLASS_FONT, /* Font module */
ABI_FONT_VERSION,
MOD_CLASS_FONT,
{0,0,0,0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData type1ModuleData = { &VersRec, type1Setup, NULL };
extern void Type1RegisterFontFileFunctions(void);
FontModule type1Module = {
Type1RegisterFontFileFunctions,
"Type1",
NULL
};
static pointer
type1Setup(pointer module, pointer opts, int *errmaj, int *errmin)
{
type1Module.module = module;
LoadFont(&type1Module);
/* Need a non-NULL return */
return (pointer)1;
}

View File

@ -700,10 +700,10 @@ The standard name is case\-sensitive, and does not include the \(lqlib\(rq
prefix, or the \(lq.a\(rq, \(lq.o\(rq, or \(lq.so\(rq suffixes.
.PP
.RS 7
Example: the Type 1 font rasteriser can be loaded with the following entry:
Example: the FreeType font rasteriser can be loaded with the following entry:
.PP
.RS 4
.B "Load \*qtype1\*q"
.B "Load \*qfreetype\*q"
.RE
.RE
.TP 7

View File

@ -2449,20 +2449,17 @@ DRIMoveBuffersHelper(
}
char *
DRICreatePCIBusID(pciVideoPtr PciInfo)
DRICreatePCIBusID(const struct pci_device * dev)
{
char *busID;
int domain;
PCITAG tag;
busID = xalloc(20);
if (busID == NULL)
return NULL;
tag = pciTag(PciInfo->bus, PciInfo->device, PciInfo->func);
domain = xf86GetPciDomain(tag);
snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", domain,
PCI_BUS_NO_DOMAIN(PciInfo->bus), PciInfo->device, PciInfo->func);
snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus,
dev->dev, dev->func);
return busID;
}

View File

@ -35,6 +35,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _DRI_H_
#include <pciaccess.h>
#include "scrnintstr.h"
#include "xf86dri.h"
@ -363,7 +365,7 @@ extern void DRIMoveBuffersHelper(ScreenPtr pScreen,
int *ydir,
RegionPtr reg);
extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
extern char *DRICreatePCIBusID(const struct pci_device *PciInfo);
extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
extern int drmRemoveSIGIOHandler(int fd);

View File

@ -14,10 +14,7 @@ endif
libdummy_nonserver_a_SOURCES = \
fatalerror.c \
getvalidbios.c \
getemptypci.c \
logvwrite.c \
pcitestmulti.c \
$(STRL_SRCS) \
verrorf.c \
xalloc.c \

View File

@ -296,53 +296,99 @@ fbdev2xfree_timing(struct fb_var_screeninfo *var, DisplayModePtr mode)
/* -------------------------------------------------------------------- */
/* open correct framebuffer device */
/* try to find the framebuffer device for a given PCI device */
/**
* Try to find the framebuffer device for a given PCI device
*/
static int
fbdev_open_pci(pciVideoPtr pPci, char **namep)
fbdev_open_pci(struct pci_device * pPci, char **namep)
{
struct fb_fix_screeninfo fix;
char filename[16];
int fd,i,j;
memType res_start, res_end;
struct fb_fix_screeninfo fix;
char filename[256];
int fd,i,j;
for (i = 0; i < 8; i++) {
sprintf(filename,"/dev/fb%d",i);
if (-1 == (fd = open(filename,O_RDWR,0))) {
xf86DrvMsg(-1, X_WARNING,
"open %s: %s\n", filename, strerror(errno));
continue;
/* There are two ways to that we can determine which fb device is
* associated with this PCI device. The more modern way is to look in
* the sysfs directory for the PCI device for a file named
* "graphics:fb*"
*/
for (i = 0; i < 8; i++) {
sprintf(filename,
"/sys/bus/pci/devices/%04x:%02x:%02x.%d/graphics:fb%d",
pPci->domain, pPci->bus, pPci->dev, pPci->func, i);
fd = open(filename, O_RDONLY, 0);
if (fd != -1) {
close(fd);
sprintf(filename, "/dev/fb%d", i);
fd = open(filename, O_RDWR, 0);
if (fd != -1) {
if (ioctl(fd, FBIOGET_FSCREENINFO, (void*) & fix) != -1) {
if (namep) {
*namep = xnfalloc(16);
strncpy(*namep,fix.id,16);
}
return fd;
}
if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)&fix)) {
close(fd);
continue;
}
for (j = 0; j < 6; j++) {
res_start = pPci->memBase[j];
res_end = res_start+pPci->size[j];
if ((0 != fix.smem_len &&
(memType) fix.smem_start >= res_start &&
(memType) fix.smem_start < res_end) ||
(0 != fix.mmio_len &&
(memType) fix.mmio_start >= res_start &&
(memType) fix.mmio_start < res_end))
break;
}
if (j == 6) {
close(fd);
continue;
}
if (namep) {
*namep = xnfalloc(16);
strncpy(*namep,fix.id,16);
}
return fd;
}
}
if (namep)
*namep = NULL;
xf86DrvMsg(-1, X_ERROR,
"Unable to find a valid framebuffer device\n");
return -1;
close(fd);
}
/* The other way is to examine the resources associated with each fb
* device and see if there is a match with the PCI device. This technique
* has some problems on certain mixed 64-bit / 32-bit architectures.
* There is a flaw in the fb_fix_screeninfo structure in that it only
* returns the low 32-bits of the address of the resources associated with
* a device. However, on a mixed architecture the base addresses of PCI
* devices, even for 32-bit applications, may be higher than 0x0f0000000.
*/
for (i = 0; i < 8; i++) {
sprintf(filename,"/dev/fb%d",i);
if (-1 == (fd = open(filename,O_RDWR,0))) {
xf86DrvMsg(-1, X_WARNING,
"open %s: %s\n", filename, strerror(errno));
continue;
}
if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)&fix)) {
close(fd);
continue;
}
for (j = 0; j < 6; j++) {
const pciaddr_t res_start = pPci->regions[j].base_addr;
const pciaddr_t res_end = res_start + pPci->regions[j].size;
if ((0 != fix.smem_len &&
(pciaddr_t) fix.smem_start >= res_start &&
(pciaddr_t) fix.smem_start < res_end) ||
(0 != fix.mmio_len &&
(pciaddr_t) fix.mmio_start >= res_start &&
(pciaddr_t) fix.mmio_start < res_end))
break;
}
if (j == 6) {
close(fd);
continue;
}
if (namep) {
*namep = xnfalloc(16);
strncpy(*namep,fix.id,16);
}
return fd;
}
if (namep)
*namep = NULL;
xf86DrvMsg(-1, X_ERROR,
"Unable to find a valid framebuffer device\n");
return -1;
}
static int
@ -387,7 +433,7 @@ fbdev_open(int scrnIndex, char *dev, char** namep)
/* -------------------------------------------------------------------- */
Bool
fbdevHWProbe(pciVideoPtr pPci, char *device,char **namep)
fbdevHWProbe(struct pci_device * pPci, char *device,char **namep)
{
int fd;
@ -403,7 +449,7 @@ fbdevHWProbe(pciVideoPtr pPci, char *device,char **namep)
}
Bool
fbdevHWInit(ScrnInfoPtr pScrn, pciVideoPtr pPci, char *device)
fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device)
{
fbdevHWPtr fPtr;

View File

@ -5,6 +5,8 @@
#include "xf86str.h"
#include "colormapst.h"
#include <pciaccess.h>
#define FBDEVHW_PACKED_PIXELS 0 /* Packed Pixels */
#define FBDEVHW_PLANES 1 /* Non interleaved planes */
#define FBDEVHW_INTERLEAVED_PLANES 2 /* Interleaved planes */
@ -14,8 +16,8 @@
Bool fbdevHWGetRec(ScrnInfoPtr pScrn);
void fbdevHWFreeRec(ScrnInfoPtr pScrn);
Bool fbdevHWProbe(pciVideoPtr pPci, char *device, char **namep);
Bool fbdevHWInit(ScrnInfoPtr pScrn, pciVideoPtr pPci, char *device);
Bool fbdevHWProbe(struct pci_device * pPci, char *device, char **namep);
Bool fbdevHWInit(ScrnInfoPtr pScrn, struct pci_device * pPci, char *device);
char* fbdevHWGetName(ScrnInfoPtr pScrn);
int fbdevHWGetDepth(ScrnInfoPtr pScrn, int *fbbpp);

View File

@ -9,7 +9,6 @@ libint10_la_LDFLAGS = -avoid-version
COMMON_SOURCES = \
helper_exec.c \
helper_mem.c \
pci.c \
xf86int10.c \
xf86int10module.c

View File

@ -16,6 +16,7 @@
#define _INT10_PRIVATE
#include "xf86int10.h"
#include "int10Defines.h"
#include "Pci.h"
#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
@ -55,12 +56,66 @@ int10MemRec genericMem = {
static void MapVRam(xf86Int10InfoPtr pInt);
static void UnmapVRam(xf86Int10InfoPtr pInt);
#ifdef _PC
#define GET_HIGH_BASE(x) (((V_BIOS + size + getpagesize() - 1)/getpagesize()) \
* getpagesize())
#define GET_HIGH_BASE(x) (((V_BIOS + (x) + getpagesize() - 1)/getpagesize()) \
* getpagesize())
#endif
static void *sysMem = NULL;
/**
* Read legacy VGA video BIOS associated with specified domain.
*
* Attempts to read up to 128KiB of legacy VGA video BIOS.
*
* \return
* The number of bytes read on success or -1 on failure.
*
* \bug
* PCI ROMs can contain multiple BIOS images (e.g., OpenFirmware, x86 VGA,
* etc.). How do we know that \c pci_device_read_rom will return the
* legacy VGA BIOS image?
*/
static int
read_legacy_video_BIOS(struct pci_device *dev, unsigned char *Buf)
{
const ADDRESS Base = 0xC0000;
const int Len = 0x10000 * 2;
const int pagemask = getpagesize() - 1;
const ADDRESS offset = Base & ~pagemask;
const unsigned long size = ((Base + Len + pagemask) & ~pagemask) - offset;
unsigned char *ptr, *src;
int len;
/* Try to use the civilized PCI interface first.
*/
if (pci_device_read_rom(dev, Buf) == 0) {
return dev->rom_size;
}
ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, dev, offset, size);
if (!ptr)
return -1;
/* Using memcpy() here can hang the system */
src = ptr + (Base - offset);
for (len = 0; len < (Len / 2); len++) {
Buf[len] = src[len];
}
if ((Buf[0] == 0x55) && (Buf[1] == 0xAA) && (Buf[2] > 0x80)) {
for ( /* empty */ ; len < Len; len++) {
Buf[len] = src[len];
}
}
xf86UnMapVidMem(-1, ptr, size);
return Len;
}
xf86Int10InfoPtr
xf86ExtendedInitInt10(int entityIndex, int Flags)
{
@ -68,7 +123,6 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
void* base = 0;
void* vbiosMem = 0;
void* options = NULL;
pciVideoPtr pvp;
int screen;
legacyVGARec vga;
@ -96,8 +150,10 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
pInt->scrnIndex = screen;
base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS);
pvp = xf86GetPciInfoForEntity(entityIndex);
if (pvp) pInt->Tag = pciTag(pvp->bus, pvp->device, pvp->func);
/* FIXME: Shouldn't this be a failure case? Leaving dev as NULL seems like
* FIXME: an error
*/
pInt->dev = xf86GetPciInfoForEntity(entityIndex);
/*
* we need to map video RAM MMIO as some chipsets map mmio
@ -150,14 +206,18 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
switch (location_type) {
case BUS_PCI: {
const int pci_entity = pInt->entityIndex;
int err;
struct pci_device *rom_device =
xf86GetPciInfoForEntity(pInt->entityIndex);
vbiosMem = (unsigned char *)base + bios_location;
if (!(size = mapPciRom(pci_entity,(unsigned char *)(vbiosMem)))) {
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n");
err = pci_device_read_rom(rom_device, vbiosMem);
if (err) {
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3) %s\n",
strerror(err));
goto error1;
}
INTPriv(pInt)->highMemory = GET_HIGH_BASE(size);
INTPriv(pInt)->highMemory = GET_HIGH_BASE(rom_device->rom_size);
break;
}
case BUS_ISA:
@ -191,24 +251,15 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
setup_int_vect(pInt);
set_return_trap(pInt);
/*
* Retrieve two segments: one at V_BIOS, the other 64kB beyond the first.
* This'll catch any BIOS that might have been initialised before server
* entry.
/* Retrieve the entire legacy video BIOS segment. This can be upto
* 128KiB.
*/
vbiosMem = (char *)base + V_BIOS;
(void)memset(vbiosMem, 0, 2 * V_BIOS_SIZE);
if (xf86ReadDomainMemory(pInt->Tag, V_BIOS, V_BIOS_SIZE, vbiosMem) <
V_BIOS_SIZE)
if (read_legacy_video_BIOS(pInt->dev, vbiosMem) < V_BIOS_SIZE) {
xf86DrvMsg(screen, X_WARNING,
"Unable to retrieve all of segment 0x0C0000.\n");
else if ((((unsigned char *)vbiosMem)[0] == 0x55) &&
(((unsigned char *)vbiosMem)[1] == 0xAA) &&
(((unsigned char *)vbiosMem)[2] > 0x80))
if (xf86ReadDomainMemory(pInt->Tag, V_BIOS + V_BIOS_SIZE, V_BIOS_SIZE,
(unsigned char *)vbiosMem + V_BIOS_SIZE) < V_BIOS_SIZE)
xf86DrvMsg(screen, X_WARNING,
"Unable to retrieve all of segment 0x0D0000.\n");
"Unable to retrieve all of segment 0x0C0000.\n");
}
/*
* If this adapter is the primary, use its post-init BIOS (if we can find
@ -227,9 +278,15 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
"No legacy BIOS found -- trying PCI\n");
}
if (!done) {
if (!mapPciRom(pInt->entityIndex, vbiosMem)) {
xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5)\n");
goto error1;
int err;
struct pci_device *rom_device =
xf86GetPciInfoForEntity(pInt->entityIndex);
err = pci_device_read_rom(rom_device, vbiosMem);
if (err) {
xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5) %s\n",
strerror(err));
goto error1;
}
}
}
@ -262,7 +319,7 @@ MapVRam(xf86Int10InfoPtr pInt)
int size = ((VRAM_SIZE + pagesize - 1) / pagesize) * pagesize;
INTPriv(pInt)->vRam = xf86MapDomainMemory(pInt->scrnIndex, VIDMEM_MMIO,
pInt->Tag, V_RAM, size);
pInt->dev, V_RAM, size);
pInt->ioBase = xf86Screens[pInt->scrnIndex]->domainIOBase;
}

View File

@ -29,6 +29,7 @@
#define _INT10_PRIVATE
#include "int10Defines.h"
#include "xf86int10.h"
#include "Pci.h"
#ifdef _X86EMU
#include "x86emu/x86emui.h"
#endif
@ -470,7 +471,7 @@ pciCfg1in(CARD16 addr, CARD32 *val)
return 1;
}
if (addr == 0xCFC) {
*val = pciReadLong(Int10Current->Tag, OFFSET(PciCfg1Addr));
pci_device_cfg_read_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inl(%#x) = %8.8x\n", PciCfg1Addr, *val);
return 1;
@ -488,7 +489,7 @@ pciCfg1out(CARD16 addr, CARD32 val)
if (addr == 0xCFC) {
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outl(%#x, %8.8x)\n", PciCfg1Addr, val);
pciWriteLong(Int10Current->Tag, OFFSET(PciCfg1Addr), val);
pci_device_cfg_write_u32(Int10Current->dev, val, OFFSET(PciCfg1Addr));
return 1;
}
return 0;
@ -497,7 +498,7 @@ pciCfg1out(CARD16 addr, CARD32 val)
static int
pciCfg1inw(CARD16 addr, CARD16 *val)
{
int offset, shift;
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
shift = (addr - 0xCF8) * 8;
@ -505,8 +506,9 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
*val = pciReadWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
const unsigned offset = addr - 0xCFC;
pci_device_cfg_read_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inw(%#x) = %4.4x\n", PciCfg1Addr + offset, *val);
return 1;
@ -517,7 +519,7 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
static int
pciCfg1outw(CARD16 addr, CARD16 val)
{
int offset, shift;
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
shift = (addr - 0xCF8) * 8;
@ -526,10 +528,11 @@ pciCfg1outw(CARD16 addr, CARD16 val)
return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
const unsigned offset = addr - 0xCFC;
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outw(%#x, %4.4x)\n", PciCfg1Addr + offset, val);
pciWriteWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
pci_device_cfg_write_u16(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;
@ -538,7 +541,7 @@ pciCfg1outw(CARD16 addr, CARD16 val)
static int
pciCfg1inb(CARD16 addr, CARD8 *val)
{
int offset, shift;
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
shift = (addr - 0xCF8) * 8;
@ -546,8 +549,9 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
*val = pciReadByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
const unsigned offset = addr - 0xCFC;
pci_device_cfg_read_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inb(%#x) = %2.2x\n", PciCfg1Addr + offset, *val);
return 1;
@ -558,7 +562,7 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
static int
pciCfg1outb(CARD16 addr, CARD8 val)
{
int offset, shift;
int shift;
if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
shift = (addr - 0xCF8) * 8;
@ -567,10 +571,11 @@ pciCfg1outb(CARD16 addr, CARD8 val)
return 1;
}
if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
offset = addr - 0xCFC;
const unsigned offset = addr - 0xCFC;
if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_outb(%#x, %2.2x)\n", PciCfg1Addr + offset, val);
pciWriteByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
pci_device_cfg_write_u8(Int10Current->dev, val, OFFSET(PciCfg1Addr) + offset);
return 1;
}
return 0;

View File

@ -1,55 +0,0 @@
/*
* XFree86 int10 module
* execute BIOS int 10h calls in x86 real mode environment
* Copyright 1999 Egbert Eich
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <string.h>
#include "xf86Pci.h"
#include "xf86.h"
#define _INT10_PRIVATE
#include "xf86int10.h"
int
mapPciRom(int pciEntity, unsigned char * address)
{
PCITAG tag;
unsigned char *mem, *ptr;
int length;
pciVideoPtr pvp = xf86GetPciInfoForEntity(pciEntity);
if (pvp == NULL) {
#ifdef DEBUG
ErrorF("mapPciRom: no PCI info\n");
#endif
return 0;
}
tag = pciTag(pvp->bus,pvp->device,pvp->func);
length = 1 << pvp->biosSize;
/* Read in entire PCI ROM */
mem = ptr = xnfcalloc(length, 1);
length = xf86ReadPciBIOS(0, tag, -1, ptr, length);
if (length > 0)
memcpy(address, ptr, length);
/* unmap/close/disable PCI bios mem */
xfree(mem);
#ifdef DEBUG
if (!length)
ErrorF("mapPciRom: no BIOS found\n");
#ifdef PRINT_PCI
else
dprint(address,0x20);
#endif
#endif
return length;
}

View File

@ -13,6 +13,7 @@
#define _INT10_PRIVATE
#include "xf86int10.h"
#include "int10Defines.h"
#include "Pci.h"
#define REG pInt
@ -23,8 +24,8 @@ static int int1A_handler(xf86Int10InfoPtr pInt);
static int int42_handler(xf86Int10InfoPtr pInt);
#endif
static int intE6_handler(xf86Int10InfoPtr pInt);
static PCITAG findPci(xf86Int10InfoPtr pInt, unsigned short bx);
static CARD32 pciSlotBX(pciVideoPtr pvp);
static struct pci_device *findPci(xf86Int10InfoPtr pInt, unsigned short bx);
static CARD32 pciSlotBX( const struct pci_device * pvp );
int
int_handler(xf86Int10InfoPtr pInt)
@ -592,13 +593,75 @@ int42_handler(xf86Int10InfoPtr pInt)
#define DEVICE_NOT_FOUND 0x86
#define BAD_REGISTER_NUMBER 0x87
#ifdef SHOW_ALL_DEVICES
/**
* These functions are meant to be used by the PCI BIOS emulation. Some
* BIOSes need to see if there are \b other chips of the same type around so
* by setting \c exclude one PCI device can be explicitely excluded, if
* required.
*/
static struct pci_device *
do_find(const struct pci_id_match *m, char n, const struct pci_device * exclude)
{
struct pci_device *dev;
struct pci_device_iterator *iter;
n++;
iter = pci_id_match_iterator_create(m);
while ((dev = pci_device_next(iter)) != NULL) {
if ((dev != exclude) && !(--n)) {
break;
}
}
pci_iterator_destroy(iter);
return dev;
}
static struct pci_device *
find_pci_device_vendor(CARD16 vendorID, CARD16 deviceID,
char n, const struct pci_device * exclude)
{
struct pci_id_match m;
m.vendor_id = vendorID;
m.device_id = deviceID;
m.subvendor_id = PCI_MATCH_ANY;
m.subdevice_id = PCI_MATCH_ANY;
m.device_class = 0;
m.device_class_mask = 0;
return do_find(& m, n, exclude);
}
static struct pci_device *
find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class,
char n, const struct pci_device * exclude)
{
struct pci_id_match m;
m.vendor_id = PCI_MATCH_ANY;
m.device_id = PCI_MATCH_ANY;
m.subvendor_id = PCI_MATCH_ANY;
m.subdevice_id = PCI_MATCH_ANY;
m.device_class = (((uint32_t)_class) << 16)
| (((uint32_t)subClass) << 8) | intf;
m.device_class_mask = 0x00ffffff;
return do_find(& m, n, exclude);
}
#endif
static int
int1A_handler(xf86Int10InfoPtr pInt)
{
PCITAG tag;
pciVideoPtr pvp;
struct pci_device * const pvp = xf86GetPciInfoForEntity(pInt->entityIndex);
struct pci_device * dev;
if (!(pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
if (pvp == NULL)
return 0; /* oops */
#ifdef PRINT_INT
@ -619,17 +682,19 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb102:
if (X86_DX == pvp->vendor && X86_CX == pvp->chipType && X86_ESI == 0) {
if ( (X86_DX == pvp->vendor_id)
&& (X86_CX == pvp->device_id)
&& (X86_ESI == 0) ) {
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
X86_EBX = pciSlotBX(pvp);
}
#ifdef SHOW_ALL_DEVICES
else
if ((pvp = xf86FindPciDeviceVendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
if ((dev = find_pci_device_vendor(X86_EDX, X86_ECX, X86_ESI, pvp))) {
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
X86_EBX = pciSlotBX(pvp);
X86_EBX = pciSlotBX(dev);
}
#endif
else {
@ -641,20 +706,18 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb103:
if (X86_CL == pvp->interface &&
X86_CH == pvp->subclass &&
((X86_ECX & 0xFFFF0000) >> 16) == pvp->class) {
if ( (X86_ECX & 0x00FFFFFF) == pvp->device_class ) {
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EBX = pciSlotBX(pvp);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
}
#ifdef SHOW_ALL_DEVICES
else if ((pvp = xf86FindPciClass(X86_CL, X86_CH,
(X86_ECX & 0xffff0000) >> 16,
X86_ESI, pvp))) {
else if ((dev = find_pci_class(X86_CL, X86_CH,
(X86_ECX & 0xffff0000) >> 16,
X86_ESI, pvp))) {
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
X86_EBX = pciSlotBX(pvp);
X86_EBX = pciSlotBX(dev);
}
#endif
else {
@ -666,8 +729,8 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb108:
if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) {
X86_CL = pciReadByte(tag, X86_EDI);
if ((dev = findPci(pInt, X86_EBX)) != NULL) {
pci_device_cfg_read_u8(dev, & X86_CL, X86_EDI);
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
} else {
@ -679,8 +742,8 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb109:
if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) {
X86_CX = pciReadWord(tag, X86_EDI);
if ((dev = findPci(pInt, X86_EBX)) != NULL) {
pci_device_cfg_read_u16(dev, & X86_CX, X86_EDI);
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
} else {
@ -692,8 +755,8 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb10a:
if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) {
X86_ECX = pciReadLong(tag, X86_EDI);
if ((dev = findPci(pInt, X86_EBX)) != NULL) {
pci_device_cfg_read_u32(dev, & X86_ECX, X86_EDI);
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
} else {
@ -705,8 +768,8 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb10b:
if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) {
pciWriteByte(tag, X86_EDI, X86_CL);
if ((dev = findPci(pInt, X86_EBX)) != NULL) {
pci_device_cfg_write_u8(dev, X86_CL, X86_EDI);
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
} else {
@ -718,8 +781,8 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb10c:
if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) {
pciWriteWord(tag, X86_EDI, X86_CX);
if ((dev = findPci(pInt, X86_EBX)) != NULL) {
pci_device_cfg_write_u16(dev, X86_CX, X86_EDI);
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
} else {
@ -731,8 +794,8 @@ int1A_handler(xf86Int10InfoPtr pInt)
#endif
return 1;
case 0xb10d:
if ((tag = findPci(pInt, X86_EBX)) != PCI_NOT_FOUND) {
pciWriteLong(tag, X86_EDI, X86_ECX);
if ((dev = findPci(pInt, X86_EBX)) != NULL) {
pci_device_cfg_write_u32(dev, X86_ECX, X86_EDI);
X86_EAX = X86_AL | (SUCCESSFUL << 8);
X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */
} else {
@ -753,21 +816,20 @@ int1A_handler(xf86Int10InfoPtr pInt)
}
}
static PCITAG
static struct pci_device *
findPci(xf86Int10InfoPtr pInt, unsigned short bx)
{
int bus = ((pInt->Tag >> 16) & ~0x00FF) | ((bx >> 8) & 0x00FF);
int dev = (bx >> 3) & 0x1F;
int func = bx & 0x7;
if (xf86IsPciDevPresent(bus, dev, func))
return pciTag(bus, dev, func);
return PCI_NOT_FOUND;
const unsigned bus = (bx >> 8) & 0x00FF;
const unsigned dev = (bx >> 3) & 0x001F;
const unsigned func = (bx ) & 0x0007;
return pci_device_find_by_slot(pInt->dev->domain, bus, dev, func);
}
static CARD32
pciSlotBX(pciVideoPtr pvp)
pciSlotBX(const struct pci_device * pvp)
{
return ((pvp->bus << 8) & 0x00FF00) | (pvp->device << 3) | (pvp->func);
return ((pvp->bus << 8) & 0x00FF00) | (pvp->dev << 3) | (pvp->func);
}
/*
@ -776,10 +838,10 @@ pciSlotBX(pciVideoPtr pvp)
static int
intE6_handler(xf86Int10InfoPtr pInt)
{
pciVideoPtr pvp;
struct pci_device * pvp;
if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex)))
X86_AX = (pvp->bus << 8) | (pvp->device << 3) | (pvp->func & 0x7);
X86_AX = (pvp->bus << 8) | (pvp->dev << 3) | (pvp->func & 0x7);
pushw(pInt, X86_CS);
pushw(pInt, X86_IP);
X86_CS = pInt->BIOSseg;

View File

@ -40,7 +40,7 @@ typedef struct {
int bp;
int flags;
int stackseg;
PCITAG Tag;
struct pci_device *dev;
IOADDRESS ioBase;
} xf86Int10InfoRec, *xf86Int10InfoPtr;
@ -179,8 +179,5 @@ Bool xf86int10GetBiosSegment(xf86Int10InfoPtr pInt, void *base);
void dprint(unsigned long start, unsigned long size);
#endif
/* pci.c */
int mapPciRom(int pciEntity, unsigned char *address);
#endif /* _INT10_PRIVATE */
#endif /* _XF86INT10_H */

View File

@ -42,6 +42,8 @@
#define OSNAME "linux"
#elif defined(__FreeBSD__)
#define OSNAME "freebsd"
#elif defined(__DragonFly__)
#define OSNAME "dragonfly"
#elif defined(__NetBSD__)
#define OSNAME "netbsd"
#elif defined(__OpenBSD__)

View File

@ -252,13 +252,11 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86MapVidMem)
SYMFUNC(xf86UnMapVidMem)
SYMFUNC(xf86MapReadSideEffects)
SYMFUNC(xf86GetPciDomain)
SYMFUNC(xf86MapDomainMemory)
SYMFUNC(xf86MapDomainIO)
SYMFUNC(xf86ReadDomainMemory)
SYMFUNC(xf86UDelay)
SYMFUNC(xf86IODelay)
SYMFUNC(xf86SlowBcopy)
SYMFUNC(xf86SetReallySlowBcopy)
#ifdef __alpha__
SYMFUNC(xf86SlowBCopyToBus)
SYMFUNC(xf86SlowBCopyFromBus)
@ -303,10 +301,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
/* xf86Bus.c */
SYMFUNC(xf86CheckPciSlot)
SYMFUNC(xf86ClaimPciSlot)
SYMFUNC(xf86GetPciVideoInfo)
SYMFUNC(xf86GetPciEntity)
SYMFUNC(xf86GetPciConfigInfo)
SYMFUNC(xf86SetPciVideo)
SYMFUNC(xf86ClaimIsaSlot)
SYMFUNC(xf86ClaimFbSlot)
SYMFUNC(xf86ClaimNoSlot)
@ -337,17 +331,12 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86CheckPciMemBase)
SYMFUNC(xf86SetAccessFuncs)
SYMFUNC(xf86IsEntityPrimary)
SYMFUNC(xf86FixPciResource)
SYMFUNC(xf86SetOperatingState)
SYMFUNC(xf86EnterServerState)
SYMFUNC(xf86GetBlock)
SYMFUNC(xf86GetSparse)
SYMFUNC(xf86ReallocatePciResources)
SYMFUNC(xf86ChkConflict)
SYMFUNC(xf86IsPciDevPresent)
SYMFUNC(xf86FindScreenForEntity)
SYMFUNC(xf86FindPciDeviceVendor)
SYMFUNC(xf86FindPciClass)
SYMFUNC(xf86RegisterStateChangeNotificationCallback)
SYMFUNC(xf86DeregisterStateChangeNotificationCallback)
SYMFUNC(xf86NoSharedResources)
@ -706,21 +695,18 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(DPMSSet)
SYMFUNC(DPMSSupported)
#endif
SYMFUNC(pciFindFirst)
SYMFUNC(pciFindNext)
SYMFUNC(pciWriteByte)
SYMFUNC(pciWriteWord)
SYMFUNC(pciWriteLong)
SYMFUNC(pciReadByte)
SYMFUNC(pciReadWord)
SYMFUNC(pciReadLong)
SYMFUNC(pciSetBitsLong)
/* xf86Debug.c */
#ifdef BUILDDEBUG
SYMFUNC(xf86Break1)
SYMFUNC(xf86Break2)
SYMFUNC(xf86Break3)
SYMFUNC(xf86SPTimestamp)
SYMFUNC(xf86STimestamp)
#endif
SYMFUNC(pciTag)
SYMFUNC(pciBusAddrToHostAddr)
SYMFUNC(pciHostAddrToBusAddr)
SYMFUNC(xf86MapPciMem)
SYMFUNC(xf86scanpci)
SYMFUNC(xf86ReadPciBIOS)
/* Loader functions */
SYMFUNC(LoadSubModule)
@ -1152,9 +1138,12 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86CrtcCreate)
SYMFUNC(xf86CrtcDestroy)
SYMFUNC(xf86CrtcInUse)
SYMFUNC(xf86CrtcSetScreenSubpixelOrder)
SYMFUNC(xf86RotateCloseScreen)
SYMFUNC(xf86CrtcRotate)
SYMFUNC(xf86CrtcSetMode)
SYMFUNC(xf86CrtcSetSizeRange)
SYMFUNC(xf86CrtcScreenInit)
SYMFUNC(xf86CVTMode)
SYMFUNC(xf86DisableUnusedFunctions)
SYMFUNC(xf86DPMSSet)
@ -1167,18 +1156,25 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86ModesAdd)
SYMFUNC(xf86ModesEqual)
SYMFUNC(xf86ModeVRefresh)
SYMFUNC(xf86ModeWidth)
SYMFUNC(xf86ModeHeight)
SYMFUNC(xf86OutputCreate)
SYMFUNC(xf86OutputDestroy)
SYMFUNC(xf86OutputGetEDID)
SYMFUNC(xf86ConnectorGetName)
SYMFUNC(xf86OutputGetEDIDModes)
SYMFUNC(xf86OutputRename)
SYMFUNC(xf86OutputUseScreenMonitor)
SYMFUNC(xf86OutputSetEDID)
SYMFUNC(xf86OutputFindClosestMode)
SYMFUNC(xf86PrintModeline)
SYMFUNC(xf86ProbeOutputModes)
SYMFUNC(xf86PruneInvalidModes)
SYMFUNC(xf86SetModeCrtc)
SYMFUNC(xf86SetModeDefaultName)
SYMFUNC(xf86SetScrnInfoModes)
SYMFUNC(xf86SetDesiredModes)
SYMFUNC(xf86SetSingleMode)
SYMFUNC(xf86ValidateModesClocks)
SYMFUNC(xf86ValidateModesFlags)
SYMFUNC(xf86ValidateModesSize)
@ -1196,12 +1192,14 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86RandR12PreInit)
SYMFUNC(xf86RandR12SetConfig)
SYMFUNC(xf86RandR12SetRotations)
SYMFUNC(xf86RandR12TellChanged)
#endif
SYMFUNC(xf86_cursors_init)
SYMFUNC(xf86_reload_cursors)
SYMFUNC(xf86_show_cursors)
SYMFUNC(xf86_hide_cursors)
SYMFUNC(xf86_cursors_fini)
SYMFUNC(xf86_crtc_clip_video_helper)
SYMFUNC(xf86DoEDID_DDC1)
SYMFUNC(xf86DoEDID_DDC2)

View File

@ -45,13 +45,15 @@
#include "picturestr.h"
#endif
#include "xf86xv.h"
/*
* Initialize xf86CrtcConfig structure
*/
int xf86CrtcConfigPrivateIndex = -1;
void
_X_EXPORT void
xf86CrtcConfigInit (ScrnInfoPtr scrn,
const xf86CrtcConfigFuncsRec *funcs)
{
@ -66,7 +68,7 @@ xf86CrtcConfigInit (ScrnInfoPtr scrn,
scrn->privates[xf86CrtcConfigPrivateIndex].ptr = config;
}
void
_X_EXPORT void
xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
int minWidth, int minHeight,
int maxWidth, int maxHeight)
@ -82,7 +84,7 @@ xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
/*
* Crtc functions
*/
xf86CrtcPtr
_X_EXPORT xf86CrtcPtr
xf86CrtcCreate (ScrnInfoPtr scrn,
const xf86CrtcFuncsRec *funcs)
{
@ -114,7 +116,7 @@ xf86CrtcCreate (ScrnInfoPtr scrn,
return crtc;
}
void
_X_EXPORT void
xf86CrtcDestroy (xf86CrtcPtr crtc)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
@ -126,7 +128,7 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
{
memmove (&xf86_config->crtc[c],
&xf86_config->crtc[c+1],
xf86_config->num_crtc - (c + 1));
((xf86_config->num_crtc - (c + 1)) * sizeof(void*)));
xf86_config->num_crtc--;
break;
}
@ -138,7 +140,7 @@ xf86CrtcDestroy (xf86CrtcPtr crtc)
* Return whether any outputs are connected to the specified pipe
*/
Bool
_X_EXPORT Bool
xf86CrtcInUse (xf86CrtcPtr crtc)
{
ScrnInfoPtr pScrn = crtc->scrn;
@ -151,7 +153,7 @@ xf86CrtcInUse (xf86CrtcPtr crtc)
return FALSE;
}
void
_X_EXPORT void
xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
{
#ifdef RENDER
@ -219,7 +221,7 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen)
/**
* Sets the given video mode on the given crtc
*/
Bool
_X_EXPORT Bool
xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
int x, int y)
{
@ -490,7 +492,7 @@ xf86OutputInitialRotation (xf86OutputPtr output)
return RR_Rotate_0;
}
xf86OutputPtr
_X_EXPORT xf86OutputPtr
xf86OutputCreate (ScrnInfoPtr scrn,
const xf86OutputFuncsRec *funcs,
const char *name)
@ -550,7 +552,7 @@ xf86OutputCreate (ScrnInfoPtr scrn,
return output;
}
Bool
_X_EXPORT Bool
xf86OutputRename (xf86OutputPtr output, const char *name)
{
int len = strlen(name) + 1;
@ -569,7 +571,7 @@ xf86OutputRename (xf86OutputPtr output, const char *name)
return TRUE;
}
void
_X_EXPORT void
xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
{
if (use_screen_monitor != output->use_screen_monitor)
@ -579,7 +581,7 @@ xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor)
}
}
void
_X_EXPORT void
xf86OutputDestroy (xf86OutputPtr output)
{
ScrnInfoPtr scrn = output->scrn;
@ -594,7 +596,7 @@ xf86OutputDestroy (xf86OutputPtr output)
{
memmove (&xf86_config->output[o],
&xf86_config->output[o+1],
xf86_config->num_output - (o + 1));
((xf86_config->num_output - (o + 1)) * sizeof(void*)));
xf86_config->num_output--;
break;
}
@ -655,7 +657,7 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen)
/*
* Called at ScreenInit time to set up
*/
Bool
_X_EXPORT Bool
xf86CrtcScreenInit (ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
@ -1212,7 +1214,7 @@ xf86SortModes (DisplayModePtr input)
return output;
}
void
_X_EXPORT void
xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@ -1453,10 +1455,10 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
*/
/* XXX where does this function belong? Here? */
void
_X_EXPORT void
xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr scrn, int *x, int *y);
void
_X_EXPORT void
xf86SetScrnInfoModes (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@ -1524,7 +1526,7 @@ xf86SetScrnInfoModes (ScrnInfoPtr scrn)
* accordingly.
*/
Bool
_X_EXPORT Bool
xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@ -1728,7 +1730,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
* modes (used in EnterVT functions, or at server startup)
*/
Bool
_X_EXPORT Bool
xf86SetDesiredModes (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@ -1808,7 +1810,7 @@ xf86SetDesiredModes (ScrnInfoPtr scrn)
* - Closer in refresh rate to the requested mode.
*/
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
{
DisplayModePtr best = NULL, scan = NULL;
@ -1871,7 +1873,7 @@ xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
* mode across all outputs that are currently active.
*/
Bool
_X_EXPORT Bool
xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
@ -1943,7 +1945,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
* If the new mode is off, it will turn off outputs and then CRTCs.
* Otherwise, it will affect CRTCs before outputs.
*/
void
_X_EXPORT void
xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@ -1981,7 +1983,7 @@ xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
* Even for monitors with no DPMS support, by the definition of our DPMS hooks,
* the outputs will still get disabled (blanked).
*/
Bool
_X_EXPORT Bool
xf86SaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@ -1997,7 +1999,7 @@ xf86SaveScreen(ScreenPtr pScreen, int mode)
/**
* Disable all inactive crtcs and outputs
*/
void
_X_EXPORT void
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
@ -2051,7 +2053,7 @@ xf86OutputSetEDIDProperty (xf86OutputPtr output, void *data, int data_len)
/**
* Set the EDID information for the specified output
*/
void
_X_EXPORT void
xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
{
ScrnInfoPtr scrn = output->scrn;
@ -2117,7 +2119,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
* Return the list of modes supported by the EDID information
* stored in 'output'
*/
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86OutputGetEDIDModes (xf86OutputPtr output)
{
ScrnInfoPtr scrn = output->scrn;
@ -2128,7 +2130,7 @@ xf86OutputGetEDIDModes (xf86OutputPtr output)
return xf86DDCGetModes(scrn->scrnIndex, edid_mon);
}
xf86MonPtr
_X_EXPORT xf86MonPtr
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
{
ScrnInfoPtr scrn = output->scrn;
@ -2139,8 +2141,124 @@ xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
static char *_xf86ConnectorNames[] = { "None", "VGA", "DVI-I", "DVI-D",
"DVI-A", "Composite", "S-Video",
"Component", "LFP", "Proprietary" };
char *
_X_EXPORT char *
xf86ConnectorGetName(xf86ConnectorType connector)
{
return _xf86ConnectorNames[connector];
}
static void
x86_crtc_box_intersect(BoxPtr dest, BoxPtr a, BoxPtr b)
{
dest->x1 = a->x1 > b->x1 ? a->x1 : b->x1;
dest->x2 = a->x2 < b->x2 ? a->x2 : b->x2;
dest->y1 = a->y1 > b->y1 ? a->y1 : b->y1;
dest->y2 = a->y2 < b->y2 ? a->y2 : b->y2;
if (dest->x1 >= dest->x2 || dest->y1 >= dest->y2)
dest->x1 = dest->x2 = dest->y1 = dest->y2 = 0;
}
static void
x86_crtc_box(xf86CrtcPtr crtc, BoxPtr crtc_box)
{
if (crtc->enabled) {
crtc_box->x1 = crtc->x;
crtc_box->x2 = crtc->x + xf86ModeWidth(&crtc->mode, crtc->rotation);
crtc_box->y1 = crtc->y;
crtc_box->y2 = crtc->y + xf86ModeHeight(&crtc->mode, crtc->rotation);
} else
crtc_box->x1 = crtc_box->x2 = crtc_box->y1 = crtc_box->y2 = 0;
}
static int
xf86_crtc_box_area(BoxPtr box)
{
return (int) (box->x2 - box->x1) * (int) (box->y2 - box->y1);
}
/*
* Return the crtc covering 'box'. If two crtcs cover a portion of
* 'box', then prefer 'desired'. If 'desired' is NULL, then prefer the crtc
* with greater coverage
*/
static xf86CrtcPtr
xf86_covering_crtc(ScrnInfoPtr pScrn,
BoxPtr box,
xf86CrtcPtr desired,
BoxPtr crtc_box_ret)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
xf86CrtcPtr crtc, best_crtc;
int coverage, best_coverage;
int c;
BoxRec crtc_box, cover_box;
best_crtc = NULL;
best_coverage = 0;
crtc_box_ret->x1 = 0;
crtc_box_ret->x2 = 0;
crtc_box_ret->y1 = 0;
crtc_box_ret->y2 = 0;
for (c = 0; c < xf86_config->num_crtc; c++) {
crtc = xf86_config->crtc[c];
x86_crtc_box(crtc, &crtc_box);
x86_crtc_box_intersect(&cover_box, &crtc_box, box);
coverage = xf86_crtc_box_area(&cover_box);
if (coverage && crtc == desired) {
*crtc_box_ret = crtc_box;
return crtc;
} else if (coverage > best_coverage) {
*crtc_box_ret = crtc_box;
best_crtc = crtc;
best_coverage = coverage;
}
}
return best_crtc;
}
/*
* For overlay video, compute the relevant CRTC and
* clip video to that
*/
_X_EXPORT Bool
xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
xf86CrtcPtr *crtc_ret,
xf86CrtcPtr desired_crtc,
BoxPtr dst,
INT32 *xa,
INT32 *xb,
INT32 *ya,
INT32 *yb,
RegionPtr reg,
INT32 width,
INT32 height)
{
Bool ret;
RegionRec crtc_region_local;
RegionPtr crtc_region = reg;
if (crtc_ret) {
BoxRec crtc_box;
xf86CrtcPtr crtc = xf86_covering_crtc(pScrn, dst,
desired_crtc,
&crtc_box);
if (crtc) {
REGION_INIT (pScreen, &crtc_region_local, &crtc_box, 1);
crtc_region = &crtc_region_local;
REGION_INTERSECT (pScreen, crtc_region, crtc_region, reg);
}
*crtc_ret = crtc;
}
ret = xf86XVClipVideoHelper(dst, xa, xb, ya, yb,
crtc_region, width, height);
if (crtc_region != reg)
REGION_UNINIT (pScreen, &crtc_region_local);
return ret;
}

View File

@ -765,5 +765,24 @@ xf86_hide_cursors (ScrnInfoPtr scrn);
*/
void
xf86_cursors_fini (ScreenPtr screen);
/*
* For overlay video, compute the relevant CRTC and
* clip video to that.
* wraps xf86XVClipVideoHelper()
*/
Bool
xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
xf86CrtcPtr *crtc_ret,
xf86CrtcPtr desired_crtc,
BoxPtr dst,
INT32 *xa,
INT32 *xb,
INT32 *ya,
INT32 *yb,
RegionPtr reg,
INT32 width,
INT32 height);
#endif /* _XF86CRTC_H_ */

View File

@ -256,7 +256,7 @@ xf86_crtc_hide_cursor (xf86CrtcPtr crtc)
}
}
void
_X_EXPORT void
xf86_hide_cursors (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@ -282,7 +282,7 @@ xf86_crtc_show_cursor (xf86CrtcPtr crtc)
}
}
void
_X_EXPORT void
xf86_show_cursors (ScrnInfoPtr scrn)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
@ -447,7 +447,10 @@ xf86_use_hw_cursor (ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
if (xf86_config->cursor)
FreeCursor (xf86_config->cursor, None);
xf86_config->cursor = cursor;
++cursor->refcnt;
if (cursor->bits->width > cursor_info->MaxWidth ||
cursor->bits->height> cursor_info->MaxHeight)
@ -463,7 +466,10 @@ xf86_use_hw_cursor_argb (ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
if (xf86_config->cursor)
FreeCursor (xf86_config->cursor, None);
xf86_config->cursor = cursor;
++cursor->refcnt;
/* Make sure ARGB support is available */
if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
@ -522,7 +528,7 @@ xf86_load_cursor_argb (ScrnInfoPtr scrn, CursorPtr cursor)
}
}
Bool
_X_EXPORT Bool
xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
@ -573,7 +579,7 @@ xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
* Reloads cursor images as needed, then adjusts cursor positions
*/
void
_X_EXPORT void
xf86_reload_cursors (ScreenPtr screen)
{
ScrnInfoPtr scrn;
@ -616,7 +622,7 @@ xf86_reload_cursors (ScreenPtr screen)
/**
* Clean up CRTC-based cursor code
*/
void
_X_EXPORT void
xf86_cursors_fini (ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
@ -632,4 +638,9 @@ xf86_cursors_fini (ScreenPtr screen)
xfree (xf86_config->cursor_image);
xf86_config->cursor_image = NULL;
}
if (xf86_config->cursor)
{
FreeCursor (xf86_config->cursor, None);
xf86_config->cursor = NULL;
}
}

View File

@ -255,7 +255,7 @@ static DGAFunctionRec xf86_dga_funcs = {
NULL
};
Bool
_X_EXPORT Bool
xf86DiDGAReInit (ScreenPtr pScreen)
{
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];
@ -267,7 +267,7 @@ xf86DiDGAReInit (ScreenPtr pScreen)
return DGAReInitModes (pScreen, xf86_config->dga_modes, xf86_config->dga_nmode);
}
Bool
_X_EXPORT Bool
xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address)
{
ScrnInfoPtr scrn = xf86Screens[pScreen->myNum];

View File

@ -50,36 +50,12 @@
typedef enum {
DDC_QUIRK_NONE = 0,
/* Force detailed sync polarity to -h +v */
DDC_QUIRK_DT_SYNC_HM_VP = 1 << 0,
/* First detailed mode is bogus, prefer largest mode at 60hz */
DDC_QUIRK_PREFER_LARGE_60 = 1 << 1,
DDC_QUIRK_PREFER_LARGE_60 = 1 << 0,
/* 135MHz clock is too high, drop a bit */
DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 2
DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 1,
} ddc_quirk_t;
static Bool quirk_dt_sync_hm_vp (int scrnIndex, xf86MonPtr DDC)
{
/* Belinea 1924S1W */
if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
DDC->vendor.prod_id == 1932)
return TRUE;
/* Belinea 10 20 30W */
if (memcmp (DDC->vendor.name, "MAX", 4) == 0 &&
DDC->vendor.prod_id == 2007)
return TRUE;
/* ViewSonic VX2025wm (bug #9941) */
if (memcmp (DDC->vendor.name, "VSC", 4) == 0 &&
DDC->vendor.prod_id == 58653)
return TRUE;
/* Samsung SyncMaster 205BW */
if (memcmp (DDC->vendor.name, "SAM", 4) == 0 &&
DDC->vendor.prod_id == 541)
return TRUE;
return FALSE;
}
static Bool quirk_prefer_large_60 (int scrnIndex, xf86MonPtr DDC)
{
/* Belinea 10 15 55 */
@ -122,10 +98,6 @@ typedef struct {
} ddc_quirk_map_t;
static const ddc_quirk_map_t ddc_quirks[] = {
{
quirk_dt_sync_hm_vp, DDC_QUIRK_DT_SYNC_HM_VP,
"Set detailed timing sync polarity to -h +v"
},
{
quirk_prefer_large_60, DDC_QUIRK_PREFER_LARGE_60,
"Detailed timing is not preferred, use largest mode at 60Hz"
@ -274,20 +246,15 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
if (timing->interlaced)
Mode->Flags |= V_INTERLACE;
if (quirks & DDC_QUIRK_DT_SYNC_HM_VP)
Mode->Flags |= V_NHSYNC | V_PVSYNC;
if (timing->misc & 0x02)
Mode->Flags |= V_PVSYNC;
else
{
if (timing->misc & 0x02)
Mode->Flags |= V_PHSYNC;
else
Mode->Flags |= V_NHSYNC;
if (timing->misc & 0x01)
Mode->Flags |= V_PVSYNC;
else
Mode->Flags |= V_NVSYNC;
}
Mode->Flags |= V_NVSYNC;
if (timing->misc & 0x01)
Mode->Flags |= V_PHSYNC;
else
Mode->Flags |= V_NHSYNC;
return Mode;
}
@ -336,7 +303,7 @@ DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
}
}
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
{
int preferred, i;
@ -422,7 +389,7 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
/*
* Fill out MonPtr with xf86MonPtr information.
*/
void
_X_EXPORT void
xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
{
DisplayModePtr Modes = NULL, Mode;

View File

@ -49,7 +49,7 @@ extern XF86ConfigPtr xf86configptr;
*
* Exact copy of xf86Mode.c's.
*/
double
_X_EXPORT double
xf86ModeHSync(DisplayModePtr mode)
{
double hsync = 0.0;
@ -67,7 +67,7 @@ xf86ModeHSync(DisplayModePtr mode)
*
* Exact copy of xf86Mode.c's.
*/
double
_X_EXPORT double
xf86ModeVRefresh(DisplayModePtr mode)
{
double refresh = 0.0;
@ -86,7 +86,7 @@ xf86ModeVRefresh(DisplayModePtr mode)
return refresh;
}
int
_X_EXPORT int
xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
{
switch (rotation & 0xf) {
@ -101,7 +101,7 @@ xf86ModeWidth (DisplayModePtr mode, Rotation rotation)
}
}
int
_X_EXPORT int
xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
{
switch (rotation & 0xf) {
@ -117,7 +117,7 @@ xf86ModeHeight (DisplayModePtr mode, Rotation rotation)
}
/** Sets a default mode name of <width>x<height> on a mode. */
void
_X_EXPORT void
xf86SetModeDefaultName(DisplayModePtr mode)
{
if (mode->name != NULL)
@ -134,7 +134,7 @@ xf86SetModeDefaultName(DisplayModePtr mode)
*
* Exact copy of xf86Mode.c's.
*/
void
_X_EXPORT void
xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
{
if ((p == NULL) || ((p->type & M_T_CRTC_C) == M_T_BUILTIN))
@ -185,7 +185,7 @@ xf86SetModeCrtc(DisplayModePtr p, int adjustFlags)
/**
* Allocates and returns a copy of pMode, including pointers within pMode.
*/
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86DuplicateMode(DisplayModePtr pMode)
{
DisplayModePtr pNew;
@ -209,7 +209,7 @@ xf86DuplicateMode(DisplayModePtr pMode)
*
* \param modeList doubly-linked mode list
*/
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
DisplayModePtr first = NULL, last = NULL;
@ -243,7 +243,7 @@ xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList)
*
* This isn't in xf86Modes.c, but it might deserve to be there.
*/
Bool
_X_EXPORT Bool
xf86ModesEqual(DisplayModePtr pMode1, DisplayModePtr pMode2)
{
if (pMode1->Clock == pMode2->Clock &&
@ -279,7 +279,7 @@ add(char **p, char *new)
*
* Convenient VRefresh printing was added, though, compared to xf86Mode.c
*/
void
_X_EXPORT void
xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
{
char tmp[256];
@ -327,7 +327,7 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
*
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
_X_EXPORT void
xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int flags)
{
@ -348,7 +348,7 @@ xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
*
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
_X_EXPORT void
xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int maxX, int maxY, int maxPitch)
{
@ -377,7 +377,7 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
*
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
_X_EXPORT void
xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
MonPtr mon)
{
@ -424,7 +424,7 @@ xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList,
*
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
_X_EXPORT void
xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
int *min, int *max, int n_ranges)
{
@ -458,7 +458,7 @@ xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
*
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
_X_EXPORT void
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
{
DisplayModePtr mode;
@ -492,7 +492,7 @@ xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList)
*
* This is not in xf86Modes.c, but would be part of the proposed new API.
*/
void
_X_EXPORT void
xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
Bool verbose)
{
@ -526,7 +526,7 @@ xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
*
* \param modes doubly-linked mode list.
*/
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new)
{
if (modes == NULL)
@ -592,7 +592,7 @@ xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
/**
* Build a mode list from a monitor configuration
*/
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
{
DisplayModePtr modes = NULL;
@ -624,7 +624,7 @@ xf86GetMonitorModes (ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor)
/**
* Build a mode list containing all of the default modes
*/
DisplayModePtr
_X_EXPORT DisplayModePtr
xf86GetDefaultModes (Bool interlaceAllowed, Bool doubleScanAllowed)
{
DisplayModePtr head = NULL, prev = NULL, mode;

View File

@ -244,7 +244,7 @@ xf86RandR12SetMode (ScreenPtr pScreen,
return ret;
}
Bool
_X_EXPORT Bool
xf86RandR12SetConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
@ -345,7 +345,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
randrp->virtualX = pScrn->virtualX;
randrp->virtualY = pScrn->virtualY;
}
if (pRoot)
if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
/* Let the driver update virtualX and virtualY */
@ -363,7 +363,7 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
xf86SetViewport (pScreen, 0, 0);
finish:
if (pRoot)
if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, TRUE);
#if RANDR_12_INTERFACE
if (WindowTable[pScreen->myNum] && ret)
@ -372,7 +372,7 @@ finish:
return ret;
}
Rotation
_X_EXPORT Rotation
xf86RandR12GetRotation(ScreenPtr pScreen)
{
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
@ -380,7 +380,7 @@ xf86RandR12GetRotation(ScreenPtr pScreen)
return randrp->rotation;
}
Bool
_X_EXPORT Bool
xf86RandR12CreateScreenResources (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@ -470,7 +470,7 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
}
Bool
_X_EXPORT Bool
xf86RandR12Init (ScreenPtr pScreen)
{
rrScrPrivPtr rp;
@ -520,7 +520,7 @@ xf86RandR12Init (ScreenPtr pScreen)
return TRUE;
}
void
_X_EXPORT void
xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
{
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
@ -538,7 +538,7 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
randrp->supported_rotations = rotations;
}
void
_X_EXPORT void
xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
{
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
@ -716,7 +716,7 @@ xf86RandR12CrtcSet (ScreenPtr pScreen,
xf86CrtcPtr *save_crtcs;
Bool save_enabled = crtc->enabled;
save_crtcs = ALLOCATE_LOCAL(config->num_crtc * sizeof (xf86CrtcPtr));
save_crtcs = ALLOCATE_LOCAL(config->num_output * sizeof (xf86CrtcPtr));
if ((randr_mode != NULL) != crtc->enabled)
changed = TRUE;
else if (randr_mode && !xf86RandRModeMatches (randr_mode, &crtc->mode))
@ -1072,7 +1072,7 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
* to DGA, VidMode or hot key. Tell RandR
*/
void
_X_EXPORT void
xf86RandR12TellChanged (ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@ -1122,7 +1122,7 @@ xf86RandR12Init12 (ScreenPtr pScreen)
#endif
Bool
_X_EXPORT Bool
xf86RandR12PreInit (ScrnInfoPtr pScrn)
{
return TRUE;

View File

@ -478,7 +478,7 @@ xf86RotateDestroy (xf86CrtcPtr crtc)
}
}
void
_X_EXPORT void
xf86RotateCloseScreen (ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
@ -489,7 +489,7 @@ xf86RotateCloseScreen (ScreenPtr screen)
xf86RotateDestroy (xf86_config->crtc[c]);
}
Bool
_X_EXPORT Bool
xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
{
ScrnInfoPtr pScrn = crtc->scrn;

View File

@ -159,7 +159,9 @@ xf86OpenConsole()
xf86ConsOpen_t *driver;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
int result;
#ifdef __FreeBSD__
struct utsname uts;
#endif
vtmode_t vtmode;
#endif
@ -250,6 +252,7 @@ xf86OpenConsole()
#endif
/* otherwise fall through */
case PCVT:
#if !(defined(__NetBSD__) && (__NetBSD_Version__ >= 200000000))
/*
* First activate the #1 VT. This is a hack to allow a server
* to be started while another one is active. There should be
@ -264,7 +267,7 @@ xf86OpenConsole()
}
sleep(1);
}
#endif
acquire_vt:
/*
* now get the VT

View File

@ -83,7 +83,7 @@ static const char *mouseDevs[] = {
DEFAULT_PS2_DEV,
NULL
};
#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
/* Only wsmouse mices are autoconfigured for now on OpenBSD */
#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse"
#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0"
@ -154,7 +154,7 @@ DefaultProtocol(void)
{
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
return "Auto";
#elif defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
return "WSMouse";
#else
return NULL;
@ -340,7 +340,7 @@ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
}
#endif
#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
/* Only support wsmouse configuration for now */
static const char *
@ -381,7 +381,7 @@ FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
}
return *pdev;
}
#endif /* __OpenBSD__ && WSCONS_SUPPORT */
#endif /* __OpenBSD__ || __NetBSD__ && WSCONS_SUPPORT */
#ifdef WSCONS_SUPPORT
#define NUMEVENTS 64
@ -779,11 +779,11 @@ xf86OSMouseInit(int flags)
p->SetBMRes = SetSysMouseRes;
p->SetMiscRes = SetSysMouseRes;
#endif
#if defined(__OpenBSD__) && defined(WSCONS_SUPPORT)
#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
p->SetupAuto = SetupAuto;
p->SetMiscRes = SetMouseRes;
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
p->FindDevice = FindDevice;
#endif
p->PreInit = bsdMousePreInit;

File diff suppressed because it is too large Load Diff

View File

@ -156,50 +156,6 @@
#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
#define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u)
/*
* Macros for bus numbers found in P2P headers.
*/
#define PCI_PRIMARY_BUS_EXTRACT(x, tag) \
((((x) & PCI_PRIMARY_BUS_MASK ) >> 0) | (PCI_DOM_FROM_TAG(tag) << 8))
#define PCI_SECONDARY_BUS_EXTRACT(x, tag) \
((((x) & PCI_SECONDARY_BUS_MASK ) >> 8) | (PCI_DOM_FROM_TAG(tag) << 8))
#define PCI_SUBORDINATE_BUS_EXTRACT(x, tag) \
((((x) & PCI_SUBORDINATE_BUS_MASK) >> 16) | (PCI_DOM_FROM_TAG(tag) << 8))
#define PCI_PRIMARY_BUS_INSERT(x, y) \
(((x) & ~PCI_PRIMARY_BUS_MASK ) | (((y) & 0xffu) << 0))
#define PCI_SECONDARY_BUS_INSERT(x, y) \
(((x) & ~PCI_SECONDARY_BUS_MASK ) | (((y) & 0xffu) << 8))
#define PCI_SUBORDINATE_BUS_INSERT(x, y) \
(((x) & ~PCI_SUBORDINATE_BUS_MASK) | (((y) & 0xffu) << 16))
/* Ditto for CardBus bridges */
#define PCI_CB_PRIMARY_BUS_EXTRACT(x, tag) \
PCI_PRIMARY_BUS_EXTRACT(x, tag)
#define PCI_CB_CARDBUS_BUS_EXTRACT(x, tag) \
PCI_SECONDARY_BUS_EXTRACT(x, tag)
#define PCI_CB_SUBORDINATE_BUS_EXTRACT(x, tag) \
PCI_SUBORDINATE_BUS_EXTRACT(x, tag)
#define PCI_CB_PRIMARY_BUS_INSERT(x, tag) \
PCI_PRIMARY_BUS_INSERT(x, tag)
#define PCI_CB_CARDBUS_BUS_INSERT(x, tag) \
PCI_SECONDARY_BUS_INSERT(x, tag)
#define PCI_CB_SUBORDINATE_BUS_INSERT(x, tag) \
PCI_SUBORDINATE_BUS_INSERT(x, tag)
#if X_BYTE_ORDER == X_BIG_ENDIAN
#define PCI_CPU(val) (((val >> 24) & 0x000000ff) | \
((val >> 8) & 0x0000ff00) | \
((val << 8) & 0x00ff0000) | \
((val << 24) & 0xff000000))
#define PCI_CPU16(val) (((val >> 8) & 0x000000ff) | \
((val << 8) & 0x0000ff00))
#else
#define PCI_CPU(val) (val)
#define PCI_CPU16(val) (val)
#endif
/*
* Debug Macros/Definitions
*/
@ -234,97 +190,79 @@
#if defined(__alpha__)
# if defined(linux)
# define ARCH_PCI_INIT axpPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# elif defined(__FreeBSD__) || defined(__OpenBSD__)
# elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
# define ARCH_PCI_INIT freebsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# elif defined(__NetBSD__)
# define ARCH_PCI_INIT netbsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__arm__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__hppa__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__ia64__)
# if defined(linux)
# define ARCH_PCI_INIT ia64linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# elif defined(FreeBSD)
# define ARCH_PCI_INIT freebsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
# define XF86SCANPCI_WRAPPER ia64ScanPCIWrapper
#elif defined(__i386__) || defined(i386)
# define ARCH_PCI_INIT ix86PciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# if defined(linux)
# define ARCH_PCI_OS_INIT linuxPciInit
# define ARCH_PCI_INIT linuxPciInit
# else
# define ARCH_PCI_INIT ix86PciInit
# endif
# define INCLUDE_XF86_NO_DOMAIN
#elif defined(__mc68000__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__mips__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__powerpc__) || defined(__powerpc64__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN /* Needs kernel work to remove */
# elif defined(__FreeBSD__) || defined(__OpenBSD__)
# define ARCH_PCI_INIT freebsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# elif defined(__NetBSD__)
# define ARCH_PCI_INIT netbsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# else
# define ARCH_PCI_INIT ppcPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__s390__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__sh__)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
#elif defined(__sparc__) || defined(sparc)
# if defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# elif defined(sun)
# define ARCH_PCI_INIT sparcPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc64__)
# define ARCH_PCI_INIT freebsdPciInit
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# endif
# if !defined(__FreeBSD__) && !defined(linux)
@ -333,28 +271,21 @@
#elif defined(__amd64__) || defined(__amd64)
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
# define ARCH_PCI_INIT freebsdPciInit
# elif defined(linux)
# define ARCH_PCI_INIT linuxPciInit
# else
# define ARCH_PCI_INIT ix86PciInit
# endif
# define INCLUDE_XF86_MAP_PCI_MEM
# define INCLUDE_XF86_NO_DOMAIN
# if defined(linux)
# define ARCH_PCI_OS_INIT linuxPciInit
# endif
#endif
#ifndef ARCH_PCI_INIT
#error No PCI support available for this architecture/OS combination
#endif
extern void ARCH_PCI_INIT(void);
#if defined(ARCH_PCI_OS_INIT)
extern void ARCH_PCI_OS_INIT(void);
#endif
#undef INCLUDE_XF86_NO_DOMAIN
#if defined(ARCH_PCI_PCI_BRIDGE)
extern void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI);
#endif
extern void ARCH_PCI_INIT(void);
#if defined(XF86SCANPCI_WRAPPER)
typedef enum {
@ -369,27 +300,7 @@ extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags);
* (e.g. a primary PCI bus and all of its secondaries)
*/
typedef struct pci_bus_funcs {
CARD32 (*pciReadLong)(PCITAG, int);
void (*pciWriteLong)(PCITAG, int, CARD32);
void (*pciSetBitsLong)(PCITAG, int, CARD32, CARD32);
ADDRESS (*pciAddrHostToBus)(PCITAG, PciAddrType, ADDRESS);
ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS);
/*
* The next three are optional. If NULL, the corresponding function is
* to be performed generically.
*/
CARD16 (*pciControlBridge)(int, CARD16, CARD16);
void (*pciGetBridgeBuses)(int, int *, int *, int *);
/* Use pointer's to avoid #include recursion */
void (*pciGetBridgeResources)(int, pointer *, pointer *, pointer *);
/* These are optional and will be implemented using read long
* if not present. */
CARD8 (*pciReadByte)(PCITAG, int);
void (*pciWriteByte)(PCITAG, int, CARD8);
CARD16 (*pciReadWord)(PCITAG, int);
void (*pciWriteWord)(PCITAG, int, CARD16);
} pciBusFuncs_t, *pciBusFuncs_p;
/*
@ -402,7 +313,7 @@ typedef struct pci_bus_info {
int primary_bus; /* Parent bus */
pciBusFuncs_p funcs; /* PCI access functions */
void *pciBusPriv; /* Implementation private data */
pciConfigPtr bridge; /* bridge that opens this bus */
struct pci_device *bridge; /* bridge that opens this bus */
} pciBusInfo_t;
#define HOST_NO_BUS ((pciBusInfo_t *)(-1))
@ -414,32 +325,14 @@ typedef struct pci_bus_info {
#define PCI_CFG_MECH_OTHER 3 /* Something else */
/* Generic PCI service functions and helpers */
PCITAG pciGenFindFirst(void);
PCITAG pciGenFindNext(void);
CARD32 pciCfgMech1Read(PCITAG tag, int offset);
void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val);
void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask,
CARD32 val);
CARD32 pciByteSwap(CARD32);
Bool pciMfDev(int, int);
ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS);
extern void pciSetOSBIOSPtr(int (*bios_fn)(PCITAG Tag, int basereg, unsigned char * buf, int len));
extern PCITAG (*pciFindFirstFP)(void);
extern PCITAG (*pciFindNextFP)(void);
extern CARD32 pciDevid;
extern CARD32 pciDevidMask;
extern int pciMaxBusNum;
extern int pciBusNum;
extern int pciDevNum;
extern int pciFuncNum;
extern PCITAG pciDeviceTag;
extern int xf86MaxPciDevs;
extern pciBusInfo_t *pciBusInfo[];
#endif /* _PCI_H */

View File

@ -229,9 +229,6 @@ axpPciInit()
pciNumBuses = bus + 1;
}
pciFindFirstFP = pciGenFindFirst;
pciFindNextFP = pciGenFindNext;
}
/*
@ -330,12 +327,11 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
pDomain->dense_mem + Base - _bus_base(), Size);
}
_X_EXPORT IOADDRESS
xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size)
IOADDRESS
xf86MapLegacyIO(struct pci_device *dev)
{
axpDomainPtr pDomain;
int domain = PCI_DOM_FROM_TAG(Tag);
const int domain = dev->domain;
if ((domain < 0) || (domain >= pciNumDomains) ||
!(pDomain = xf86DomainInfo[domain]))
@ -346,7 +342,7 @@ xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
* base [this is ok since we also constrain sparse I/O systems to
* a single domain in axpSetupDomains()]
*/
if (pDomain->sparse_io) return Base;
if (pDomain->sparse_io) return 0;
/*
* I/O addresses on Alpha are really just different physical memory
@ -359,42 +355,11 @@ xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
* Map the entire I/O space (64kB) at once and only once.
*/
if (!pDomain->mapped_io)
pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(ScreenNum, Flags,
pDomain->mapped_io = (IOADDRESS)xf86MapVidMem(-1, VIDMEM_MMIO,
pDomain->dense_io - _bus_base(),
0x10000);
return pDomain->mapped_io + Base;
}
_X_EXPORT int
xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf)
{
static unsigned long pagemask = 0;
unsigned char *MappedAddr;
unsigned long MapSize;
ADDRESS MapBase;
int i;
if (!pagemask) pagemask = xf86getpagesize() - 1;
/* Ensure page boundaries */
MapBase = Base & ~pagemask;
MapSize = ((Base + Len + pagemask) & ~pagemask) - MapBase;
/*
* VIDMEM_MMIO in order to get sparse mapping on sparse memory systems
* so we can use mmio functions to read (that way we can really get byte
* at a time reads on dense memory systems with byte/word instructions.
*/
MappedAddr = xf86MapDomainMemory(-1, VIDMEM_READONLY | VIDMEM_MMIO,
Tag, MapBase, MapSize);
for (i = 0; i < Len; i++) {
*Buf++ = xf86ReadMmio8(MappedAddr, Base - MapBase + i);
}
xf86UnMapVidMem(-1, MappedAddr, MapSize);
return Len;
return pDomain->mapped_io;
}
resPtr

View File

@ -83,7 +83,7 @@ static pciBusInfo_t freebsdPci0 = {
/* bridge */ NULL
};
#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
#if X_BYTE_ORDER == X_BIG_ENDIAN
#ifdef __sparc__
#ifndef ASI_PL
@ -124,8 +124,6 @@ freebsdPciInit()
pciNumBuses = 1;
pciBusInfo[0] = &freebsdPci0;
pciFindFirstFP = pciGenFindFirst;
pciFindNextFP = pciGenFindNext;
}
static CARD32

View File

@ -171,6 +171,7 @@
/*
* Intel x86 platform specific PCI access functions
*/
#if 0
static CARD32 ix86PciReadLongSetup(PCITAG tag, int off);
static void ix86PciWriteLongSetup(PCITAG, int off, CARD32 val);
static void ix86PciSetBitsLongSetup(PCITAG, int off, CARD32 mask, CARD32 val);
@ -180,27 +181,34 @@ static void ix86PciSetBitsLongCFG1(PCITAG, int off, CARD32 mask, CARD32 val);
static CARD32 ix86PciReadLongCFG2(PCITAG tag, int off);
static void ix86PciWriteLongCFG2(PCITAG, int off, CARD32 val);
static void ix86PciSetBitsLongCFG2(PCITAG, int off, CARD32 mask, CARD32 val);
#endif
static pciBusFuncs_t ix86Funcs0 = {
#if 0
/* pciReadLong */ ix86PciReadLongSetup,
/* pciWriteLong */ ix86PciWriteLongSetup,
/* pciSetBitsLong */ ix86PciSetBitsLongSetup,
#endif
/* pciAddrHostToBus */ pciAddrNOOP,
/* pciAddrBusToHost */ pciAddrNOOP
};
static pciBusFuncs_t ix86Funcs1 = {
#if 0
/* pciReadLong */ ix86PciReadLongCFG1,
/* pciWriteLong */ ix86PciWriteLongCFG1,
/* pciSetBitsLong */ ix86PciSetBitsLongCFG1,
#endif
/* pciAddrHostToBus */ pciAddrNOOP,
/* pciAddrBusToHost */ pciAddrNOOP
};
static pciBusFuncs_t ix86Funcs2 = {
#if 0
/* pciReadLong */ ix86PciReadLongCFG2,
/* pciWriteLong */ ix86PciWriteLongCFG2,
/* pciSetBitsLong */ ix86PciSetBitsLongCFG2,
#endif
/* pciAddrHostToBus */ pciAddrNOOP,
/* pciAddrBusToHost */ pciAddrNOOP
};
@ -218,6 +226,7 @@ static pciBusInfo_t ix86Pci0 = {
static Bool
ix86PciBusCheck(void)
{
#if 0
PCITAG tag;
CARD32 id, class;
CARD8 device;
@ -250,6 +259,7 @@ ix86PciBusCheck(void)
break;
}
}
#endif
return FALSE;
}
@ -271,12 +281,7 @@ void ix86PciSelectCfgmech(void)
* We rely on xf86Info.pciFlags to tell which mechanisms to try....
*/
switch (xf86Info.pciFlags) {
case PCIOsConfig:
#ifdef ARCH_PCI_OS_INIT
return;
#endif
case PCIProbe1:
if (!xf86EnableIO())
return;
@ -544,6 +549,7 @@ ix86PcibusTag(CARD8 bus, CARD8 cardnum, CARD8 func)
}
#endif
#if 0
static CARD32
ix86PciReadLongSetup(PCITAG Tag, int reg)
{
@ -680,6 +686,7 @@ ix86PciSetBitsLongCFG2(PCITAG Tag, int reg, CARD32 mask, CARD32 val)
outb(PCI_CFGMECH2_ENABLE_REG, 0);
outb(PCI_CFGMECH2_FORWARD_REG, 0);
}
#endif
void
ix86PciInit()
@ -687,8 +694,6 @@ ix86PciInit()
/* Initialize pciBusInfo[] array and function pointers */
pciNumBuses = 1;
pciBusInfo[0] = &ix86Pci0;
pciFindFirstFP = pciGenFindFirst;
pciFindNextFP = pciGenFindNext;
/* Make sure that there is a PCI bus present. */
ix86PciSelectCfgmech();

File diff suppressed because it is too large Load Diff

View File

@ -79,8 +79,6 @@ netbsdPciInit()
pciNumBuses = 1;
pciBusInfo[0] = &netbsdPci0;
pciFindFirstFP = pciGenFindFirst;
pciFindNextFP = pciGenFindNext;
/* use businfo to get the number of devs */
if (ioctl(devpci, PCI_IOC_BUSINFO, &pci_businfo) != 0)
FatalError("netbsdPciInit: not a PCI bus device");

View File

@ -622,7 +622,7 @@ xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
}
_X_EXPORT IOADDRESS
xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
xf86MapLegacyIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size)
{
sparcDomainPtr pDomain;
@ -632,7 +632,7 @@ xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
!(pDomain = xf86DomainInfo[domain]) ||
(((unsigned long long)Base + (unsigned long long)Size) >
pDomain->io_size))
FatalError("xf86MapDomainIO() called with invalid parameters.\n");
FatalError("xf86MapLegacyIO() called with invalid parameters.\n");
/* Permanently map all of I/O space */
if (!pDomain->io) {
@ -648,30 +648,6 @@ xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
return (IOADDRESS)pDomain->io + Base;
}
_X_EXPORT int
xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len, unsigned char *Buf)
{
unsigned char *ptr, *src;
ADDRESS offset;
unsigned long size;
int len;
/* Ensure page boundaries */
offset = Base & ~pagemask;
size = ((Base + Len + pagemask) & ~pagemask) - offset;
ptr = xf86MapDomainMemory(-1, VIDMEM_READONLY, Tag, offset, size);
/* Using memcpy() here hangs the system */
src = ptr + (Base - offset);
for (len = Len; len-- > 0;)
*Buf++ = *src++;
xf86UnMapVidMem(-1, ptr, size);
return Len;
}
resPtr
xf86BusAccWindowsFromOS(void)
{

View File

@ -106,8 +106,7 @@
#include <X11/Xarch.h>
#include <X11/Xfuncproto.h>
#include "misc.h"
#define PCI_NOT_FOUND 0xFFFFFFFFU
#include <pciaccess.h>
/*
* PCI cfg space definitions (e.g. stuff right out of the PCI spec)
@ -172,19 +171,6 @@
#define PCI_SUBCLASS_PREHISTORIC_MISC 0x00
#define PCI_SUBCLASS_PREHISTORIC_VGA 0x01
/* 0x01 mass storage subclasses */
#define PCI_SUBCLASS_MASS_STORAGE_SCSI 0x00
#define PCI_SUBCLASS_MASS_STORAGE_IDE 0x01
#define PCI_SUBCLASS_MASS_STORAGE_FLOPPY 0x02
#define PCI_SUBCLASS_MASS_STORAGE_IPI 0x03
#define PCI_SUBCLASS_MASS_STORAGE_MISC 0x80
/* 0x02 network subclasses */
#define PCI_SUBCLASS_NETWORK_ETHERNET 0x00
#define PCI_SUBCLASS_NETWORK_TOKENRING 0x01
#define PCI_SUBCLASS_NETWORK_FDDI 0x02
#define PCI_SUBCLASS_NETWORK_MISC 0x80
/* 0x03 display subclasses */
#define PCI_SUBCLASS_DISPLAY_VGA 0x00
#define PCI_SUBCLASS_DISPLAY_XGA 0x01
@ -195,11 +181,6 @@
#define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x01
#define PCI_SUBCLASS_MULTIMEDIA_MISC 0x80
/* 0x05 memory subclasses */
#define PCI_SUBCLASS_MEMORY_RAM 0x00
#define PCI_SUBCLASS_MEMORY_FLASH 0x01
#define PCI_SUBCLASS_MEMORY_MISC 0x80
/* 0x06 bridge subclasses */
#define PCI_SUBCLASS_BRIDGE_HOST 0x00
#define PCI_SUBCLASS_BRIDGE_ISA 0x01
@ -213,33 +194,6 @@
#define PCI_SUBCLASS_BRIDGE_MISC 0x80
#define PCI_IF_BRIDGE_PCI_SUBTRACTIVE 0x01
/* 0x07 communications controller subclasses */
#define PCI_SUBCLASS_COMMUNICATIONS_SERIAL 0x00
#define PCI_SUBCLASS_COMMUNICATIONS_PARALLEL 0x01
#define PCI_SUBCLASS_COMMUNICATIONS_MULTISERIAL 0x02
#define PCI_SUBCLASS_COMMUNICATIONS_MODEM 0x03
#define PCI_SUBCLASS_COMMUNICATIONS_MISC 0x80
/* 0x08 generic system peripherals subclasses */
#define PCI_SUBCLASS_SYSPERIPH_PIC 0x00
#define PCI_SUBCLASS_SYSPERIPH_DMA 0x01
#define PCI_SUBCLASS_SYSPERIPH_TIMER 0x02
#define PCI_SUBCLASS_SYSPERIPH_RTC 0x03
#define PCI_SUBCLASS_SYSPERIPH_HOTPCI 0x04
#define PCI_SUBCLASS_SYSPERIPH_MISC 0x80
/* 0x09 input device subclasses */
#define PCI_SUBCLASS_INPUT_KEYBOARD 0x00
#define PCI_SUBCLASS_INPUT_DIGITIZER 0x01
#define PCI_SUBCLASS_INPUT_MOUSE 0x02
#define PCI_SUBCLASS_INPUT_SCANNER 0x03
#define PCI_SUBCLASS_INPUT_GAMEPORT 0x04
#define PCI_SUBCLASS_INPUT_MISC 0x80
/* 0x0a docking station subclasses */
#define PCI_SUBCLASS_DOCKING_GENERIC 0x00
#define PCI_SUBCLASS_DOCKING_MISC 0x80
/* 0x0b processor subclasses */
#define PCI_SUBCLASS_PROCESSOR_386 0x00
#define PCI_SUBCLASS_PROCESSOR_486 0x01
@ -249,101 +203,6 @@
#define PCI_SUBCLASS_PROCESSOR_MIPS 0x30
#define PCI_SUBCLASS_PROCESSOR_COPROC 0x40
/* 0x0c serial bus controller subclasses */
#define PCI_SUBCLASS_SERIAL_FIREWIRE 0x00
#define PCI_SUBCLASS_SERIAL_ACCESS 0x01
#define PCI_SUBCLASS_SERIAL_SSA 0x02
#define PCI_SUBCLASS_SERIAL_USB 0x03
#define PCI_SUBCLASS_SERIAL_FIBRECHANNEL 0x04
#define PCI_SUBCLASS_SERIAL_SMBUS 0x05
/* 0x0d wireless controller subclasses */
#define PCI_SUBCLASS_WIRELESS_IRDA 0x00
#define PCI_SUBCLASS_WIRELESS_CONSUMER_IR 0x01
#define PCI_SUBCLASS_WIRELESS_RF 0x02
#define PCI_SUBCLASS_WIRELESS_MISC 0x80
/* 0x0e intelligent I/O controller subclasses */
#define PCI_SUBCLASS_I2O_I2O 0x00
/* 0x0f satellite communications controller subclasses */
#define PCI_SUBCLASS_SATELLITE_TV 0x01
#define PCI_SUBCLASS_SATELLITE_AUDIO 0x02
#define PCI_SUBCLASS_SATELLITE_VOICE 0x03
#define PCI_SUBCLASS_SATELLITE_DATA 0x04
/* 0x10 encryption/decryption controller subclasses */
#define PCI_SUBCLASS_CRYPT_NET_COMPUTING 0x00
#define PCI_SUBCLASS_CRYPT_ENTERTAINMENT 0x10
#define PCI_SUBCLASS_CRYPT_MISC 0x80
/* 0x11 data acquisition and signal processing controller subclasses */
#define PCI_SUBCLASS_DATAACQ_DPIO 0x00
#define PCI_SUBCLASS_DATAACQ_MISC 0x80
/* Header */
#define PCI_HEADER_MISC 0x0c
#define PCI_HEADER_MULTIFUNCTION 0x00800000
/* Interrupt configration register */
#define PCI_INTERRUPT_REG 0x3c
#define PCI_INTERRUPT_PIN_MASK 0x0000ff00
#define PCI_INTERRUPT_PIN_EXTRACT(x) \
((((x) & PCI_INTERRUPT_PIN_MASK) >> 8) & 0xff)
#define PCI_INTERRUPT_PIN_NONE 0x00
#define PCI_INTERRUPT_PIN_A 0x01
#define PCI_INTERRUPT_PIN_B 0x02
#define PCI_INTERRUPT_PIN_C 0x03
#define PCI_INTERRUPT_PIN_D 0x04
#define PCI_INTERRUPT_LINE_MASK 0x000000ff
#define PCI_INTERRUPT_LINE_EXTRACT(x) \
((((x) & PCI_INTERRUPT_LINE_MASK) >> 0) & 0xff)
#define PCI_INTERRUPT_LINE_INSERT(x,v) \
(((x) & ~PCI_INTERRUPT_LINE_MASK) | ((v) << 0))
/* Base registers */
#define PCI_MAP_REG_START 0x10
#define PCI_MAP_REG_END 0x28
#define PCI_MAP_ROM_REG 0x30
#define PCI_MAP_MEMORY 0x00000000
#define PCI_MAP_IO 0x00000001
#define PCI_MAP_MEMORY_TYPE 0x00000007
#define PCI_MAP_IO_TYPE 0x00000003
#define PCI_MAP_MEMORY_TYPE_32BIT 0x00000000
#define PCI_MAP_MEMORY_TYPE_32BIT_1M 0x00000002
#define PCI_MAP_MEMORY_TYPE_64BIT 0x00000004
#define PCI_MAP_MEMORY_TYPE_MASK 0x00000006
#define PCI_MAP_MEMORY_CACHABLE 0x00000008
#define PCI_MAP_MEMORY_ATTR_MASK 0x0000000e
#define PCI_MAP_MEMORY_ADDRESS_MASK 0xfffffff0
#define PCI_MAP_IO_ATTR_MASK 0x00000003
#define PCI_MAP_IS_IO(b) ((b) & PCI_MAP_IO)
#define PCI_MAP_IS_MEM(b) (!PCI_MAP_IS_IO(b))
#define PCI_MAP_IS64BITMEM(b) \
(((b) & PCI_MAP_MEMORY_TYPE) == PCI_MAP_MEMORY_TYPE_64BIT)
#define PCIGETMEMORY(b) ((b) & PCI_MAP_MEMORY_ADDRESS_MASK)
#define PCIGETMEMORY64HIGH(b) (*((CARD32*)&(b) + 1))
#define PCIGETMEMORY64(b) \
(PCIGETMEMORY(b) | ((CARD64)PCIGETMEMORY64HIGH(b) << 32))
#define PCI_MAP_IO_ADDRESS_MASK 0xfffffffc
#define PCIGETIO(b) ((b) & PCI_MAP_IO_ADDRESS_MASK)
#define PCI_MAP_ROM_DECODE_ENABLE 0x00000001
#define PCI_MAP_ROM_ADDRESS_MASK 0xfffff800
#define PCIGETROM(b) ((b) & PCI_MAP_ROM_ADDRESS_MASK)
/* PCI-PCI bridge mapping registers */
#define PCI_PCI_BRIDGE_BUS_REG 0x18
#define PCI_SUBORDINATE_BUS_MASK 0x00ff0000
@ -354,12 +213,6 @@
#define PCI_PCI_BRIDGE_MEM_REG 0x20
#define PCI_PCI_BRIDGE_PMEM_REG 0x24
#define PCI_PPB_IOBASE_EXTRACT(x) (((x) << 8) & 0xFF00)
#define PCI_PPB_IOLIMIT_EXTRACT(x) (((x) << 0) & 0xFF00)
#define PCI_PPB_MEMBASE_EXTRACT(x) (((x) << 16) & 0xFFFF0000)
#define PCI_PPB_MEMLIMIT_EXTRACT(x) (((x) << 0) & 0xFFFF0000)
#define PCI_PCI_BRIDGE_CONTROL_REG 0x3E
#define PCI_PCI_BRIDGE_PARITY_EN 0x01
#define PCI_PCI_BRIDGE_SERR_EN 0x02
@ -368,31 +221,6 @@
#define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20
#define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40
#define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80
/* header type 2 extensions */
#define PCI_CB_BRIDGE_CTL_CB_RESET 0x40 /* CardBus reset */
#define PCI_CB_BRIDGE_CTL_16BIT_INT 0x80 /* Enable interrupt for 16-bit cards */
#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 0x100
#define PCI_CB_BRIDGE_CTL_PREFETCH_MEM1 0x200
#define PCI_CB_BRIDGE_CTL_POST_WRITES 0x400
#define PCI_CB_SEC_STATUS_REG 0x16 /* Secondary status */
#define PCI_CB_PRIMARY_BUS_REG 0x18 /* PCI bus number */
#define PCI_CB_CARD_BUS_REG 0x19 /* CardBus bus number */
#define PCI_CB_SUBORDINATE_BUS_REG 0x1a /* Subordinate bus number */
#define PCI_CB_LATENCY_TIMER_REG 0x1b /* CardBus latency timer */
#define PCI_CB_MEM_BASE_0_REG 0x1c
#define PCI_CB_MEM_LIMIT_0_REG 0x20
#define PCI_CB_MEM_BASE_1_REG 0x24
#define PCI_CB_MEM_LIMIT_1_REG 0x28
#define PCI_CB_IO_BASE_0_REG 0x2c
#define PCI_CB_IO_LIMIT_0_REG 0x30
#define PCI_CB_IO_BASE_1_REG 0x34
#define PCI_CB_IO_LIMIT_1_REG 0x38
#define PCI_CB_BRIDGE_CONTROL_REG 0x3E
#define PCI_CB_IO_RANGE_MASK ~0x03
#define PCI_CB_IOBASE(x) (x & PCI_CB_IO_RANGE_MASK)
#define PCI_CB_IOLIMIT(x) ((x & PCI_CB_IO_RANGE_MASK) + 3)
/* Subsystem identification register */
#define PCI_SUBSYSTEM_ID_REG 0x2c
@ -410,258 +238,6 @@ typedef unsigned long ADDRESS; /* Memory/PCI address */
typedef unsigned long IOADDRESS; /* Must be large enough for a pointer */
typedef unsigned long PCITAG;
/*
* PCI configuration space
*/
typedef struct pci_cfg_regs {
/* start of official PCI config space header */
union { /* Offset 0x0 - 0x3 */
CARD32 device_vendor;
struct {
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD16 device;
CARD16 vendor;
#else
CARD16 vendor;
CARD16 device;
#endif
} dv;
} dv_id;
union { /* Offset 0x4 - 0x8 */
CARD32 status_command;
struct {
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD16 status;
CARD16 command;
#else
CARD16 command;
CARD16 status;
#endif
} sc;
} stat_cmd;
union { /* Offset 0x8 - 0xb */
CARD32 class_revision;
struct {
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD8 base_class;
CARD8 sub_class;
CARD8 prog_if;
CARD8 rev_id;
#else
CARD8 rev_id;
CARD8 prog_if;
CARD8 sub_class;
CARD8 base_class;
#endif
} cr;
} class_rev;
union { /* Offset 0xc - 0xf */
CARD32 bist_header_latency_cache;
struct {
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD8 bist;
CARD8 header_type;
CARD8 latency_timer;
CARD8 cache_line_size;
#else
CARD8 cache_line_size;
CARD8 latency_timer;
CARD8 header_type;
CARD8 bist;
#endif
} bhlc;
} bhlc;
union { /* Offset 0x10 - 0x3b */
struct { /* header type 2 */
CARD32 cg_rsrvd1; /* 0x10 */
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD16 secondary_status; /* 0x16 */
CARD16 cg_rsrvd2; /* 0x14 */
union {
CARD32 cg_bus_reg;
struct {
CARD8 latency_timer; /* 0x1b */
CARD8 subordinate_bus_number; /* 0x1a */
CARD8 cardbus_bus_number; /* 0x19 */
CARD8 primary_bus_number; /* 0x18 */
} cgbr;
} cgbr;
#else
CARD16 cg_rsrvd2; /* 0x14 */
CARD16 secondary_status; /* 0x16 */
union {
CARD32 cg_bus_reg;
struct {
CARD8 primary_bus_number; /* 0x18 */
CARD8 cardbus_bus_number; /* 0x19 */
CARD8 subordinate_bus_number; /* 0x1a */
CARD8 latency_timer; /* 0x1b */
} cgbr;
} cgbr;
#endif
CARD32 mem_base0; /* 0x1c */
CARD32 mem_limit0; /* 0x20 */
CARD32 mem_base1; /* 0x24 */
CARD32 mem_limit1; /* 0x28 */
CARD32 io_base0; /* 0x2c */
CARD32 io_limit0; /* 0x30 */
CARD32 io_base1; /* 0x34 */
CARD32 io_limit1; /* 0x38 */
} cg;
struct {
union { /* Offset 0x10 - 0x27 */
struct { /* header type 0 */
CARD32 dv_base0;
CARD32 dv_base1;
CARD32 dv_base2;
CARD32 dv_base3;
CARD32 dv_base4;
CARD32 dv_base5;
} dv;
struct { /* header type 1 */
CARD32 bg_rsrvd[2];
#if X_BYTE_ORDER == X_BIG_ENDIAN
union {
CARD32 pp_bus_reg;
struct {
CARD8 secondary_latency_timer;
CARD8 subordinate_bus_number;
CARD8 secondary_bus_number;
CARD8 primary_bus_number;
} ppbr;
} ppbr;
CARD16 secondary_status;
CARD8 io_limit;
CARD8 io_base;
CARD16 mem_limit;
CARD16 mem_base;
CARD16 prefetch_mem_limit;
CARD16 prefetch_mem_base;
#else
union {
CARD32 pp_bus_reg;
struct {
CARD8 primary_bus_number;
CARD8 secondary_bus_number;
CARD8 subordinate_bus_number;
CARD8 secondary_latency_timer;
} ppbr;
} ppbr;
CARD8 io_base;
CARD8 io_limit;
CARD16 secondary_status;
CARD16 mem_base;
CARD16 mem_limit;
CARD16 prefetch_mem_base;
CARD16 prefetch_mem_limit;
#endif
} bg;
} bc;
union { /* Offset 0x28 - 0x2b */
CARD32 rsvd1;
CARD32 pftch_umem_base;
CARD32 cardbus_cis_ptr;
} um_c_cis;
union { /* Offset 0x2c - 0x2f */
CARD32 subsys_card_vendor;
CARD32 pftch_umem_limit;
CARD32 rsvd2;
struct {
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD16 subsys_card;
CARD16 subsys_vendor;
#else
CARD16 subsys_vendor;
CARD16 subsys_card;
#endif
} ssys;
} um_ssys_id;
union { /* Offset 0x30 - 0x33 */
CARD32 baserom;
struct {
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD16 io_ulimit;
CARD16 io_ubase;
#else
CARD16 io_ubase;
CARD16 io_ulimit;
#endif
} b_u_io;
} uio_rom;
struct {
CARD32 rsvd3; /* Offset 0x34 - 0x37 */
CARD32 rsvd4; /* Offset 0x38 - 0x3b */
} rsvd;
} cd;
} cx;
union { /* Offset 0x3c - 0x3f */
union { /* header type 0 */
CARD32 max_min_ipin_iline;
struct {
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD8 max_lat;
CARD8 min_gnt;
CARD8 int_pin;
CARD8 int_line;
#else
CARD8 int_line;
CARD8 int_pin;
CARD8 min_gnt;
CARD8 max_lat;
#endif
} mmii;
} mmii;
struct { /* header type 1 */
#if X_BYTE_ORDER == X_BIG_ENDIAN
CARD16 bridge_control; /* upper 8 bits reserved */
CARD8 rsvd2;
CARD8 rsvd1;
#else
CARD8 rsvd1;
CARD8 rsvd2;
CARD16 bridge_control; /* upper 8 bits reserved */
#endif
} bctrl;
} bm;
union { /* Offset 0x40 - 0xff */
CARD32 dwords[48];
CARD8 bytes[192];
} devspf;
} pciCfgRegs;
typedef union pci_cfg_spc {
pciCfgRegs regs;
CARD32 dwords[256/sizeof(CARD32)];
CARD8 bytes[256/sizeof(CARD8)];
} pciCfgSpc;
/*
* Data structure returned by xf86scanpci including contents of
* PCI config space header
*/
typedef struct pci_device {
PCITAG tag;
int busnum;
int devnum;
int funcnum;
pciCfgSpc cfgspc;
int basesize[7]; /* number of bits in base addr allocations */
Bool minBasesize;
pointer businfo; /* pointer to secondary's bus info structure */
Bool fakeDevice; /* Device added by system chipset support */
} pciDevice, *pciConfigPtr;
typedef enum {
PCI_MEM,
PCI_MEM_SIZE,
@ -673,130 +249,17 @@ typedef enum {
PCI_IO_SPARSE_MASK
} PciAddrType;
#define pci_device_vendor cfgspc.regs.dv_id.device_vendor
#define pci_vendor cfgspc.regs.dv_id.dv.vendor
#define pci_device cfgspc.regs.dv_id.dv.device
#define pci_status_command cfgspc.regs.stat_cmd.status_command
#define pci_command cfgspc.regs.stat_cmd.sc.command
#define pci_status cfgspc.regs.stat_cmd.sc.status
#define pci_class_revision cfgspc.regs.class_rev.class_revision
#define pci_rev_id cfgspc.regs.class_rev.cr.rev_id
#define pci_prog_if cfgspc.regs.class_rev.cr.prog_if
#define pci_sub_class cfgspc.regs.class_rev.cr.sub_class
#define pci_base_class cfgspc.regs.class_rev.cr.base_class
#define pci_bist_header_latency_cache cfgspc.regs.bhlc.bist_header_latency_cache
#define pci_cache_line_size cfgspc.regs.bhlc.bhlc.cache_line_size
#define pci_latency_timer cfgspc.regs.bhlc.bhlc.latency_timer
#define pci_header_type cfgspc.regs.bhlc.bhlc.header_type
#define pci_bist cfgspc.regs.bhlc.bhlc.bist
#define pci_cb_secondary_status cfgspc.regs.cx.cg.secondary_status
#define pci_cb_bus_register cfgspc.regs.cx.cg.cgbr.cg_bus_reg
#define pci_cb_primary_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.primary_bus_number
#define pci_cb_cardbus_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.cardbus_bus_number
#define pci_cb_subordinate_bus_number cfgspc.regs.cx.cg.cgbr.cgbr.subordinate_bus_number
#define pci_cb_latency_timer cfgspc.regs.cx.cg.cgbr.cgbr.latency_timer
#define pci_cb_membase0 cfgspc.regs.cx.cg.mem_base0
#define pci_cb_memlimit0 cfgspc.regs.cx.cg.mem_limit0
#define pci_cb_membase1 cfgspc.regs.cx.cg.mem_base1
#define pci_cb_memlimit1 cfgspc.regs.cx.cg.mem_limit1
#define pci_cb_iobase0 cfgspc.regs.cx.cg.io_base0
#define pci_cb_iolimit0 cfgspc.regs.cx.cg.io_limit0
#define pci_cb_iobase1 cfgspc.regs.cx.cg.io_base1
#define pci_cb_iolimit1 cfgspc.regs.cx.cg.io_limit1
#define pci_base0 cfgspc.regs.cx.cd.bc.dv.dv_base0
#define pci_base1 cfgspc.regs.cx.cd.bc.dv.dv_base1
#define pci_base2 cfgspc.regs.cx.cd.bc.dv.dv_base2
#define pci_base3 cfgspc.regs.cx.cd.bc.dv.dv_base3
#define pci_base4 cfgspc.regs.cx.cd.bc.dv.dv_base4
#define pci_base5 cfgspc.regs.cx.cd.bc.dv.dv_base5
#define pci_cardbus_cis_ptr cfgspc.regs.cx.cd.umem_c_cis.cardbus_cis_ptr
#define pci_subsys_card_vendor cfgspc.regs.cx.cd.um_ssys_id.subsys_card_vendor
#define pci_subsys_vendor cfgspc.regs.cx.cd.um_ssys_id.ssys.subsys_vendor
#define pci_subsys_card cfgspc.regs.cx.cd.um_ssys_id.ssys.subsys_card
#define pci_baserom cfgspc.regs.cx.cd.uio_rom.baserom
#define pci_pp_bus_register cfgspc.regs.cx.cd.bc.bg.ppbr.pp_bus_reg
#define pci_primary_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.primary_bus_number
#define pci_secondary_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.secondary_bus_number
#define pci_subordinate_bus_number cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.subordinate_bus_number
#define pci_secondary_latency_timer cfgspc.regs.cx.cd.bc.bg.ppbr.ppbr.secondary_latency_timer
#define pci_io_base cfgspc.regs.cx.cd.bc.bg.io_base
#define pci_io_limit cfgspc.regs.cx.cd.bc.bg.io_limit
#define pci_secondary_status cfgspc.regs.cx.cd.bc.bg.secondary_status
#define pci_mem_base cfgspc.regs.cx.cd.bc.bg.mem_base
#define pci_mem_limit cfgspc.regs.cx.cd.bc.bg.mem_limit
#define pci_prefetch_mem_base cfgspc.regs.cx.cd.bc.bg.prefetch_mem_base
#define pci_prefetch_mem_limit cfgspc.regs.cx.cd.bc.bg.prefetch_mem_limit
#define pci_rsvd1 cfgspc.regs.cx.cd.um_c_cis.rsvd1
#define pci_rsvd2 cfgspc.regs.cx.cd.um_ssys_id.rsvd2
#define pci_prefetch_upper_mem_base cfgspc.regs.cx.cd.um_c_cis.pftch_umem_base
#define pci_prefetch_upper_mem_limit cfgspc.regs.cx.cd.um_ssys_id.pftch_umem_limit
#define pci_upper_io_base cfgspc.regs.cx.cd.uio_rom.b_u_io.io_ubase
#define pci_upper_io_limit cfgspc.regs.cx.cd.uio_rom.b_u_io.io_ulimit
#define pci_int_line cfgspc.regs.bm.mmii.mmii.int_line
#define pci_int_pin cfgspc.regs.bm.mmii.mmii.int_pin
#define pci_min_gnt cfgspc.regs.bm.mmii.mmii.min_gnt
#define pci_max_lat cfgspc.regs.bm.mmii.mmii.max_lat
#define pci_max_min_ipin_iline cfgspc.regs.bm.mmii.max_min_ipin_iline
#define pci_bridge_control cfgspc.regs.bm.bctrl.bridge_control
#define pci_user_config cfgspc.regs.devspf.dwords[0]
#define pci_user_config_0 cfgspc.regs.devspf.bytes[0]
#define pci_user_config_1 cfgspc.regs.devspf.bytes[1]
#define pci_user_config_2 cfgspc.regs.devspf.bytes[2]
#define pci_user_config_3 cfgspc.regs.devspf.bytes[3]
typedef enum {
PCI_BIOS_PC = 0,
PCI_BIOS_OPEN_FIRMWARE,
PCI_BIOS_HP_PA_RISC,
PCI_BIOS_OTHER
} PciBiosType;
/* Public PCI access functions */
void pciInit(void);
PCITAG pciFindFirst(CARD32 id, CARD32 mask);
PCITAG pciFindNext(void);
CARD32 pciReadLong(PCITAG tag, int offset);
CARD16 pciReadWord(PCITAG tag, int offset);
CARD8 pciReadByte(PCITAG tag, int offset);
void pciWriteLong(PCITAG tag, int offset, CARD32 val);
void pciWriteWord(PCITAG tag, int offset, CARD16 val);
void pciWriteByte(PCITAG tag, int offset, CARD8 val);
void pciSetBitsLong(PCITAG tag, int offset, CARD32 mask, CARD32 val);
void pciSetBitsByte(PCITAG tag, int offset, CARD8 mask, CARD8 val);
ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
ADDRESS pciHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr);
PCITAG pciTag(int busnum, int devnum, int funcnum);
PCITAG pciDomTag(int domnum, int busnum, int devnum, int funcnum);
int pciGetBaseSize(PCITAG tag, int indx, Bool destructive, Bool *min);
CARD32 pciCheckForBrokenBase(PCITAG tag,int basereg);
pointer xf86MapPciMem(int ScreenNum, int Flags, PCITAG Tag,
ADDRESS Base, unsigned long Size);
int xf86ReadPciBIOS(unsigned long Offset, PCITAG Tag, int basereg,
unsigned char *Buf, int Len);
pciConfigPtr *xf86scanpci(int flags);
pciConfigPtr xf86GetPciConfigFromTag(PCITAG Tag);
Bool xf86scanpci(void);
extern int pciNumBuses;
/* Domain access functions. Some of these probably shouldn't be public */
int xf86GetPciDomain(PCITAG tag);
pointer xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag,
ADDRESS Base, unsigned long Size);
IOADDRESS xf86MapDomainIO(int ScreenNum, int Flags, PCITAG Tag,
IOADDRESS Base, unsigned long Size);
int xf86ReadDomainMemory(PCITAG Tag, ADDRESS Base, int Len,
unsigned char *Buf);
typedef enum {
ROM_BASE_PRESET = -2,
ROM_BASE_BIOS,
ROM_BASE_MEM0 = 0,
ROM_BASE_MEM1,
ROM_BASE_MEM2,
ROM_BASE_MEM3,
ROM_BASE_MEM4,
ROM_BASE_MEM5,
ROM_BASE_FIND
} romBaseSource;
pointer xf86MapDomainMemory(int ScreenNum, int Flags, struct pci_device *dev,
ADDRESS Base, unsigned long Size);
IOADDRESS xf86MapLegacyIO(struct pci_device *dev);
#endif /* _XF86PCI_H */

View File

@ -1073,13 +1073,13 @@ xf86PostScanZX1(void)
xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x "
"ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n",
pPCI->busnum, pPCI->devnum, pPCI->funcnum,
pPCI->pci_vendor, pPCI->pci_device, pPCI->pci_rev_id,
pPCI->pci_vendor, pPCI->_pci_device, pPCI->pci_rev_id,
pPCI->pci_base_class, pPCI->pci_sub_class);
#else
xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x"
" card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n",
pPCI->busnum, pPCI->devnum, pPCI->funcnum,
pPCI->pci_vendor, pPCI->pci_device,
pPCI->pci_vendor, pPCI->_pci_device,
pPCI->pci_subsys_vendor, pPCI->pci_subsys_card,
pPCI->pci_rev_id, pPCI->pci_base_class,
pPCI->pci_sub_class, pPCI->pci_prog_if,
@ -1122,13 +1122,13 @@ xf86PostScanZX1(void)
xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x "
"ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n",
pPCI->busnum, pPCI->devnum, pPCI->funcnum,
pPCI->pci_vendor, pPCI->pci_device, pPCI->pci_rev_id,
pPCI->pci_vendor, pPCI->_pci_device, pPCI->pci_rev_id,
pPCI->pci_base_class, pPCI->pci_sub_class);
#else
xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x"
" card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n",
pPCI->busnum, pPCI->devnum, pPCI->funcnum,
pPCI->pci_vendor, pPCI->pci_device,
pPCI->pci_vendor, pPCI->_pci_device,
pPCI->pci_subsys_vendor, pPCI->pci_subsys_card,
pPCI->pci_rev_id, pPCI->pci_base_class,
pPCI->pci_sub_class, pPCI->pci_prog_if,

Some files were not shown because too many files have changed in this diff Show More