xf86 ddx: add vga arbiter support.
This adds support for using the libpciaccess interface for vga arbitration support on top of a kernel which supports it. Currently patches are queued for kernel 2.6.32 in jbarnes pci tree, and shipping in Fedora kernel. Co-authors: Tiago Vignatti <tiago.vignatti@nokia.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
6fffcd5825
commit
e454f106dc
|
@ -1388,6 +1388,7 @@ if test "x$XORG" = xyes; then
|
||||||
AC_CHECK_FUNCS([pci_system_init_dev_mem])
|
AC_CHECK_FUNCS([pci_system_init_dev_mem])
|
||||||
AC_CHECK_FUNCS([pci_device_enable])
|
AC_CHECK_FUNCS([pci_device_enable])
|
||||||
AC_CHECK_FUNCS([pci_device_is_boot_vga])
|
AC_CHECK_FUNCS([pci_device_is_boot_vga])
|
||||||
|
AC_CHECK_FUNCS([pci_device_vgaarb_init])
|
||||||
LIBS=$SAVE_LIBS
|
LIBS=$SAVE_LIBS
|
||||||
CFLAGS=$SAVE_CFLAGS
|
CFLAGS=$SAVE_CFLAGS
|
||||||
XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS $SELINUX_LIB"
|
XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS $SELINUX_LIB"
|
||||||
|
|
|
@ -35,7 +35,7 @@ AM_LDFLAGS = -r
|
||||||
libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
|
libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
|
||||||
xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
|
xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
|
||||||
xf86Events.c xf86Globals.c xf86AutoConfig.c \
|
xf86Events.c xf86Globals.c xf86AutoConfig.c \
|
||||||
xf86Option.c xf86Init.c \
|
xf86Option.c xf86Init.c xf86VGAarbiter.c \
|
||||||
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
||||||
xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
|
xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
|
||||||
xf86Mode.c xorgHelper.c \
|
xf86Mode.c xorgHelper.c \
|
||||||
|
@ -52,7 +52,7 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
|
||||||
xf86PciInfo.h xf86Priv.h xf86Privstr.h \
|
xf86PciInfo.h xf86Priv.h xf86Privstr.h \
|
||||||
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
|
xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
|
||||||
$(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
|
$(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
|
||||||
xf86sbusBus.h
|
xf86sbusBus.h xf86VGAarbiter.h
|
||||||
|
|
||||||
DISTCLEANFILES = xf86Build.h
|
DISTCLEANFILES = xf86Build.h
|
||||||
CLEANFILES = $(BUILT_SOURCES)
|
CLEANFILES = $(BUILT_SOURCES)
|
||||||
|
@ -83,6 +83,8 @@ EXTRA_DIST = \
|
||||||
xorgVersion.h \
|
xorgVersion.h \
|
||||||
$(MODEDEFSOURCES) \
|
$(MODEDEFSOURCES) \
|
||||||
modeline2c.awk \
|
modeline2c.awk \
|
||||||
|
xf86VGAarbiter.h \
|
||||||
|
xf86VGAarbiterPriv.h \
|
||||||
$(DISTKBDSOURCES)
|
$(DISTKBDSOURCES)
|
||||||
|
|
||||||
if LNXACPI
|
if LNXACPI
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#define XF86_OS_PRIVS
|
#define XF86_OS_PRIVS
|
||||||
#define NEED_OS_RAC_PROTOS
|
#define NEED_OS_RAC_PROTOS
|
||||||
#include "xf86_OSproc.h"
|
#include "xf86_OSproc.h"
|
||||||
|
#include "xf86VGAarbiter.h"
|
||||||
|
|
||||||
#include "Pci.h"
|
#include "Pci.h"
|
||||||
|
|
||||||
|
@ -536,11 +537,25 @@ xf86PostPreInit(void)
|
||||||
void
|
void
|
||||||
xf86PostScreenInit(void)
|
xf86PostScreenInit(void)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
int vga_count;
|
||||||
if (doFramebufferMode) {
|
if (doFramebufferMode) {
|
||||||
SetSIGIOForState(OPERATING);
|
SetSIGIOForState(OPERATING);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we need to wrap the arbiter if we have more than
|
||||||
|
* one VGA card - hotplug cries.
|
||||||
|
*/
|
||||||
|
#ifdef HAVE_PCI_DEVICE_VGAARB_INIT
|
||||||
|
pci_device_vgaarb_get_info(NULL, &vga_count, NULL);
|
||||||
|
if (vga_count > 1 && xf86Screens) {
|
||||||
|
xf86Msg(X_INFO,"Number of VGA devices: %d: arbiter wrapping enabled\n", vga_count);
|
||||||
|
for (i = 0; i < xf86NumScreens; i++)
|
||||||
|
xf86VGAarbiterWrapFunctions(xf86Screens[i]->pScreen);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
DebugF("PostScreenInit generation: %i\n",serverGeneration);
|
DebugF("PostScreenInit generation: %i\n",serverGeneration);
|
||||||
xf86EnterServerState(OPERATING);
|
xf86EnterServerState(OPERATING);
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <X11/extensions/dpmsconst.h>
|
#include <X11/extensions/dpmsconst.h>
|
||||||
#include "dpmsproc.h"
|
#include "dpmsproc.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "xf86VGAarbiter.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
#ifdef DPMSExtension
|
||||||
|
@ -162,8 +163,9 @@ DPMSSet(ClientPtr client, int level)
|
||||||
pScrn = xf86Screens[i];
|
pScrn = xf86Screens[i];
|
||||||
pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
|
pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
|
||||||
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
|
if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
|
||||||
xf86EnableAccess(pScrn);
|
xf86VGAarbiterLock(pScrn);
|
||||||
pScrn->DPMSSet(pScrn, level, 0);
|
pScrn->DPMSSet(pScrn, level, 0);
|
||||||
|
xf86VGAarbiterUnlock(pScrn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
#include "picturestr.h"
|
#include "picturestr.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "xf86VGAarbiter.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
#ifdef DPMSExtension
|
||||||
|
@ -729,6 +730,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xf86VGAarbiterInit();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Match up the screens found by the probes against those specified
|
* Match up the screens found by the probes against those specified
|
||||||
* in the config file. Remove the ones that won't be used. Sort
|
* in the config file. Remove the ones that won't be used. Sort
|
||||||
|
@ -809,10 +812,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
xf86EnableAccess(xf86Screens[i]);
|
xf86VGAarbiterScrnInit(xf86Screens[i]);
|
||||||
|
xf86VGAarbiterLock(xf86Screens[i]);
|
||||||
if (xf86Screens[i]->PreInit &&
|
if (xf86Screens[i]->PreInit &&
|
||||||
xf86Screens[i]->PreInit(xf86Screens[i], 0))
|
xf86Screens[i]->PreInit(xf86Screens[i], 0))
|
||||||
xf86Screens[i]->configured = TRUE;
|
xf86Screens[i]->configured = TRUE;
|
||||||
|
xf86VGAarbiterUnlock(xf86Screens[i]);
|
||||||
}
|
}
|
||||||
for (i = 0; i < xf86NumScreens; i++)
|
for (i = 0; i < xf86NumScreens; i++)
|
||||||
if (!xf86Screens[i]->configured)
|
if (!xf86Screens[i]->configured)
|
||||||
|
@ -1025,7 +1030,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
#endif /* SCO325 */
|
#endif /* SCO325 */
|
||||||
|
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
xf86EnableAccess(xf86Screens[i]);
|
xf86VGAarbiterLock(xf86Screens[i]);
|
||||||
/*
|
/*
|
||||||
* Almost everything uses these defaults, and many of those that
|
* Almost everything uses these defaults, and many of those that
|
||||||
* don't, will wrap them.
|
* don't, will wrap them.
|
||||||
|
@ -1040,6 +1045,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
xf86Screens[i]->DriverFunc = NULL;
|
xf86Screens[i]->DriverFunc = NULL;
|
||||||
xf86Screens[i]->pScreen = NULL;
|
xf86Screens[i]->pScreen = NULL;
|
||||||
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
|
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
|
||||||
|
xf86VGAarbiterUnlock(xf86Screens[i]);
|
||||||
if (scr_index == i) {
|
if (scr_index == i) {
|
||||||
/*
|
/*
|
||||||
* Hook in our ScrnInfoRec, and initialise some other pScreen
|
* Hook in our ScrnInfoRec, and initialise some other pScreen
|
||||||
|
@ -1237,7 +1243,6 @@ AbortDDX(void)
|
||||||
* we might not have been wrapped yet. Therefore enable
|
* we might not have been wrapped yet. Therefore enable
|
||||||
* screen explicitely.
|
* screen explicitely.
|
||||||
*/
|
*/
|
||||||
xf86EnableAccess(xf86Screens[i]);
|
|
||||||
(xf86Screens[i]->LeaveVT)(i, 0);
|
(xf86Screens[i]->LeaveVT)(i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,6 @@ resume(pmEvent event, Bool undo)
|
||||||
xf86AccessEnter();
|
xf86AccessEnter();
|
||||||
xf86EnterServerState(SETUP);
|
xf86EnterServerState(SETUP);
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
xf86EnableAccess(xf86Screens[i]);
|
|
||||||
if (xf86Screens[i]->PMEvent)
|
if (xf86Screens[i]->PMEvent)
|
||||||
xf86Screens[i]->PMEvent(i,event,undo);
|
xf86Screens[i]->PMEvent(i,event,undo);
|
||||||
else {
|
else {
|
||||||
|
@ -110,7 +109,6 @@ resume(pmEvent event, Bool undo)
|
||||||
}
|
}
|
||||||
xf86EnterServerState(OPERATING);
|
xf86EnterServerState(OPERATING);
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
xf86EnableAccess(xf86Screens[i]);
|
|
||||||
if (xf86Screens[i]->EnableDisableFBAccess)
|
if (xf86Screens[i]->EnableDisableFBAccess)
|
||||||
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
|
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +163,6 @@ DoApmEvent(pmEvent event, Bool undo)
|
||||||
if (xf86Screens[i]->PMEvent) {
|
if (xf86Screens[i]->PMEvent) {
|
||||||
if (!setup) xf86EnterServerState(SETUP);
|
if (!setup) xf86EnterServerState(SETUP);
|
||||||
setup = 1;
|
setup = 1;
|
||||||
xf86EnableAccess(xf86Screens[i]);
|
|
||||||
xf86Screens[i]->PMEvent(i,event,undo);
|
xf86Screens[i]->PMEvent(i,event,undo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Tiago Vignatti
|
||||||
|
*
|
||||||
|
* 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 AUTHORS OR COPYRIGHT
|
||||||
|
* HOLDERS 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __XF86VGAARBITER_H
|
||||||
|
#define __XF86VGAARBITER_H
|
||||||
|
|
||||||
|
#include "screenint.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "xf86.h"
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
extern void xf86VGAarbiterInit(void);
|
||||||
|
extern void xf86VGAarbiterFini(void);
|
||||||
|
void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn);
|
||||||
|
extern Bool xf86VGAarbiterWrapFunctions(ScreenPtr pScreen);
|
||||||
|
extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn);
|
||||||
|
extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn);
|
||||||
|
|
||||||
|
/* allow a driver to remove itself from arbiter - really should be
|
||||||
|
* done in the kernel though */
|
||||||
|
extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn);
|
||||||
|
/* DRI and arbiter are really not possible together,
|
||||||
|
* you really want to remove the card from arbitration if you can */
|
||||||
|
extern _X_EXPORT Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen);
|
||||||
|
|
||||||
|
#endif /* __XF86VGAARBITER_H */
|
|
@ -0,0 +1,266 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009 Tiago Vignatti
|
||||||
|
*
|
||||||
|
* 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 AUTHORS OR COPYRIGHT
|
||||||
|
* HOLDERS 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_XORG_CONFIG_H
|
||||||
|
#include <xorg-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "misc.h"
|
||||||
|
#include "xf86.h"
|
||||||
|
#include "xf86_OSproc.h"
|
||||||
|
#include <X11/X.h>
|
||||||
|
#include "colormapst.h"
|
||||||
|
#include "scrnintstr.h"
|
||||||
|
#include "screenint.h"
|
||||||
|
#include "gcstruct.h"
|
||||||
|
#include "pixmapstr.h"
|
||||||
|
#include "pixmap.h"
|
||||||
|
#include "windowstr.h"
|
||||||
|
#include "window.h"
|
||||||
|
#include "xf86str.h"
|
||||||
|
#include "mipointer.h"
|
||||||
|
#include "mipointrst.h"
|
||||||
|
#ifdef RENDER
|
||||||
|
# include "picturestr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
|
||||||
|
|
||||||
|
#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
|
||||||
|
|
||||||
|
#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
|
||||||
|
dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
|
||||||
|
|
||||||
|
#define SCREEN_EPILOG(x,y) pScreen->x = y;
|
||||||
|
|
||||||
|
#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
|
||||||
|
ps->x = y;}
|
||||||
|
|
||||||
|
#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
|
||||||
|
|
||||||
|
#define PICTURE_PROLOGUE(field) ps->field = \
|
||||||
|
((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
|
||||||
|
VGAarbiterScreenKey))->field
|
||||||
|
|
||||||
|
#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap
|
||||||
|
|
||||||
|
#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0)
|
||||||
|
|
||||||
|
#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
|
||||||
|
|
||||||
|
#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
|
||||||
|
(miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \
|
||||||
|
miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \
|
||||||
|
((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
|
||||||
|
VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite;
|
||||||
|
|
||||||
|
#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
|
||||||
|
PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs;
|
||||||
|
|
||||||
|
#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
|
||||||
|
PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
|
||||||
|
|
||||||
|
#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
|
||||||
|
pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\
|
||||||
|
(x)->funcs = &VGAarbiterGCFuncs;
|
||||||
|
|
||||||
|
#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \
|
||||||
|
(VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\
|
||||||
|
(x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs;
|
||||||
|
|
||||||
|
#define GC_SCREEN register ScrnInfoPtr pScrn = \
|
||||||
|
xf86Screens[pGC->pScreen->myNum]
|
||||||
|
|
||||||
|
#define VGAGet(x)\
|
||||||
|
pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev); \
|
||||||
|
pci_device_vgaarb_lock();
|
||||||
|
|
||||||
|
#define VGAGet_GC(x)\
|
||||||
|
pci_device_vgaarb_set_target(xf86Screens[pGC->pScreen->myNum]->vgaDev); \
|
||||||
|
pci_device_vgaarb_lock();
|
||||||
|
|
||||||
|
#define VGAPut(x)\
|
||||||
|
pci_device_vgaarb_unlock();
|
||||||
|
|
||||||
|
#define VGAPut_GC(x)\
|
||||||
|
pci_device_vgaarb_unlock();
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _VGAarbiterScreen {
|
||||||
|
CreateGCProcPtr CreateGC;
|
||||||
|
CloseScreenProcPtr CloseScreen;
|
||||||
|
ScreenBlockHandlerProcPtr BlockHandler;
|
||||||
|
ScreenWakeupHandlerProcPtr WakeupHandler;
|
||||||
|
GetImageProcPtr GetImage;
|
||||||
|
GetSpansProcPtr GetSpans;
|
||||||
|
SourceValidateProcPtr SourceValidate;
|
||||||
|
CopyWindowProcPtr CopyWindow;
|
||||||
|
ClearToBackgroundProcPtr ClearToBackground;
|
||||||
|
CreatePixmapProcPtr CreatePixmap;
|
||||||
|
SaveScreenProcPtr SaveScreen;
|
||||||
|
/* Colormap */
|
||||||
|
StoreColorsProcPtr StoreColors;
|
||||||
|
/* Cursor */
|
||||||
|
DisplayCursorProcPtr DisplayCursor;
|
||||||
|
RealizeCursorProcPtr RealizeCursor;
|
||||||
|
UnrealizeCursorProcPtr UnrealizeCursor;
|
||||||
|
RecolorCursorProcPtr RecolorCursor;
|
||||||
|
SetCursorPositionProcPtr SetCursorPosition;
|
||||||
|
void (*AdjustFrame)(int,int,int,int);
|
||||||
|
Bool (*SwitchMode)(int, DisplayModePtr,int);
|
||||||
|
Bool (*EnterVT)(int, int);
|
||||||
|
void (*LeaveVT)(int, int);
|
||||||
|
void (*FreeScreen)(int, int);
|
||||||
|
miPointerSpriteFuncPtr miSprite;
|
||||||
|
#ifdef RENDER
|
||||||
|
CompositeProcPtr Composite;
|
||||||
|
GlyphsProcPtr Glyphs;
|
||||||
|
CompositeRectsProcPtr CompositeRects;
|
||||||
|
#endif
|
||||||
|
} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
|
||||||
|
|
||||||
|
typedef struct _VGAarbiterGC {
|
||||||
|
GCOps *wrapOps;
|
||||||
|
GCFuncs *wrapFuncs;
|
||||||
|
} VGAarbiterGCRec, *VGAarbiterGCPtr;
|
||||||
|
|
||||||
|
/* Screen funcs */
|
||||||
|
static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask);
|
||||||
|
static void VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask);
|
||||||
|
static Bool VGAarbiterCloseScreen (int i, ScreenPtr pScreen);
|
||||||
|
static void VGAarbiterGetImage (DrawablePtr pDrawable, int sx, int sy, int w,
|
||||||
|
int h, unsigned int format, unsigned long planemask, char *pdstLine);
|
||||||
|
static void VGAarbiterGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr
|
||||||
|
ppt, int *pwidth, int nspans, char *pdstStart);
|
||||||
|
static void VGAarbiterSourceValidate (DrawablePtr pDrawable, int x, int y,
|
||||||
|
int width, int height);
|
||||||
|
static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
|
||||||
|
RegionPtr prgnSrc);
|
||||||
|
static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w,
|
||||||
|
int h, Bool generateExposures);
|
||||||
|
static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
|
||||||
|
int depth, unsigned int usage_hint);
|
||||||
|
static Bool VGAarbiterCreateGC(GCPtr pGC);
|
||||||
|
static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
|
||||||
|
static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem
|
||||||
|
*pdefs);
|
||||||
|
static void VGAarbiterRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
|
CursorPtr pCurs, Bool displayed);
|
||||||
|
static Bool VGAarbiterRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
|
CursorPtr pCursor);
|
||||||
|
static Bool VGAarbiterUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
|
CursorPtr pCursor);
|
||||||
|
static Bool VGAarbiterDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
|
CursorPtr pCursor);
|
||||||
|
static Bool VGAarbiterSetCursorPosition (DeviceIntPtr pDev, ScreenPtr
|
||||||
|
pScreen, int x, int y, Bool generateEvent);
|
||||||
|
static void VGAarbiterAdjustFrame(int index, int x, int y, int flags);
|
||||||
|
static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
|
||||||
|
static Bool VGAarbiterEnterVT(int index, int flags);
|
||||||
|
static void VGAarbiterLeaveVT(int index, int flags);
|
||||||
|
static void VGAarbiterFreeScreen(int index, int flags);
|
||||||
|
|
||||||
|
/* GC funcs */
|
||||||
|
static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
|
||||||
|
DrawablePtr pDraw);
|
||||||
|
static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
|
||||||
|
static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
|
||||||
|
static void VGAarbiterDestroyGC(GCPtr pGC);
|
||||||
|
static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
|
||||||
|
int nrects);
|
||||||
|
static void VGAarbiterDestroyClip(GCPtr pGC);
|
||||||
|
static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
|
||||||
|
|
||||||
|
/* GC ops */
|
||||||
|
static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,
|
||||||
|
DDXPointPtr pptInit, int *pwidthInit, int fSorted);
|
||||||
|
static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
|
||||||
|
register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
|
||||||
|
static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
|
||||||
|
int x, int y, int w, int h, int leftPad, int format, char *pImage);
|
||||||
|
static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
|
||||||
|
GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty);
|
||||||
|
static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
|
||||||
|
GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty,
|
||||||
|
unsigned long bitPlane);
|
||||||
|
static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode,
|
||||||
|
int npt, xPoint *pptInit);
|
||||||
|
static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode,
|
||||||
|
int npt, DDXPointPtr pptInit);
|
||||||
|
static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
|
||||||
|
xSegment *pSeg);
|
||||||
|
static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC,
|
||||||
|
int nRectsInit, xRectangle *pRectsInit);
|
||||||
|
static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
|
||||||
|
xArc *parcs);
|
||||||
|
static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
|
||||||
|
int mode, int count, DDXPointPtr ptsIn);
|
||||||
|
static void VGAarbiterPolyFillRect( DrawablePtr pDraw, GCPtr pGC,
|
||||||
|
int nrectFill, xRectangle *prectInit);
|
||||||
|
static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
|
||||||
|
xArc *parcs);
|
||||||
|
static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
|
||||||
|
int count, char *chars);
|
||||||
|
static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
|
||||||
|
int count, unsigned short *chars);
|
||||||
|
static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
|
||||||
|
int count, char *chars);
|
||||||
|
static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
|
||||||
|
int count, unsigned short *chars);
|
||||||
|
static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
|
||||||
|
int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
|
||||||
|
static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
|
||||||
|
int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
|
||||||
|
static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
|
||||||
|
pDraw, int dx, int dy, int xOrg, int yOrg);
|
||||||
|
|
||||||
|
/* miSpriteFuncs */
|
||||||
|
static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr
|
||||||
|
pScreen, CursorPtr pCur);
|
||||||
|
static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr
|
||||||
|
pScreen, CursorPtr pCur);
|
||||||
|
static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
|
CursorPtr pCur, int x, int y);
|
||||||
|
static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
|
int x, int y);
|
||||||
|
static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
|
||||||
|
static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef RENDER
|
||||||
|
static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
|
||||||
|
PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
|
||||||
|
INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
|
||||||
|
static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
|
||||||
|
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr
|
||||||
|
list, GlyphPtr *glyphs);
|
||||||
|
static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor
|
||||||
|
*color, int nRect, xRectangle *rects);
|
||||||
|
#endif
|
|
@ -517,7 +517,7 @@ typedef struct _confdrirec {
|
||||||
|
|
||||||
/* These values should be adjusted when new fields are added to ScrnInfoRec */
|
/* These values should be adjusted when new fields are added to ScrnInfoRec */
|
||||||
#define NUM_RESERVED_INTS 16
|
#define NUM_RESERVED_INTS 16
|
||||||
#define NUM_RESERVED_POINTERS 15
|
#define NUM_RESERVED_POINTERS 14
|
||||||
#define NUM_RESERVED_FUNCS 11
|
#define NUM_RESERVED_FUNCS 11
|
||||||
|
|
||||||
typedef pointer (*funcPointer)(void);
|
typedef pointer (*funcPointer)(void);
|
||||||
|
@ -796,6 +796,8 @@ typedef struct _ScrnInfoRec {
|
||||||
int reservedInt[NUM_RESERVED_INTS];
|
int reservedInt[NUM_RESERVED_INTS];
|
||||||
|
|
||||||
int * entityInstanceList;
|
int * entityInstanceList;
|
||||||
|
struct pci_device *vgaDev;
|
||||||
|
|
||||||
pointer reservedPtr[NUM_RESERVED_POINTERS];
|
pointer reservedPtr[NUM_RESERVED_POINTERS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -69,6 +69,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include "mipointer.h"
|
#include "mipointer.h"
|
||||||
#include "xf86_OSproc.h"
|
#include "xf86_OSproc.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
|
#include "xf86VGAarbiter.h"
|
||||||
|
|
||||||
#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
|
#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
|
||||||
|
|
||||||
|
@ -333,6 +334,12 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!xf86VGAarbiterAllowDRI(pScreen)) {
|
||||||
|
DRIDrvMsg(pScreen->myNum, X_WARNING,
|
||||||
|
"Direct rendering is not supported when VGA arb is necessary for the device\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If Xinerama is on, don't allow DRI to initialise. It won't be usable
|
* If Xinerama is on, don't allow DRI to initialise. It won't be usable
|
||||||
* anyway.
|
* anyway.
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include "dri2.h"
|
#include "dri2.h"
|
||||||
|
#include "xf86VGAarbiter.h"
|
||||||
|
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
|
|
||||||
|
@ -414,6 +415,12 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
||||||
if (info->version < 3)
|
if (info->version < 3)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (!xf86VGAarbiterAllowDRI(pScreen)) {
|
||||||
|
xf86DrvMsg(pScreen->myNum, X_WARNING,
|
||||||
|
"[DRI2] Direct rendering is not supported when VGA arb is necessary for the device\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ds = xalloc(sizeof *ds);
|
ds = xalloc(sizeof *ds);
|
||||||
if (!ds)
|
if (!ds)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -121,6 +121,7 @@ cat > sdksyms.c << EOF
|
||||||
#include "xf86fbman.h"
|
#include "xf86fbman.h"
|
||||||
#include "xf86str.h"
|
#include "xf86str.h"
|
||||||
#include "xf86Xinput.h"
|
#include "xf86Xinput.h"
|
||||||
|
#include "xf86VGAarbiter.h"
|
||||||
#include "xisb.h"
|
#include "xisb.h"
|
||||||
#if XV
|
#if XV
|
||||||
# include "xf86xv.h"
|
# include "xf86xv.h"
|
||||||
|
|
|
@ -124,6 +124,9 @@
|
||||||
/* Have pci_enable_device */
|
/* Have pci_enable_device */
|
||||||
#undef HAVE_PCI_DEVICE_ENABLE
|
#undef HAVE_PCI_DEVICE_ENABLE
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pci_device_vgaarb_init' function. */
|
||||||
|
#undef HAVE_PCI_DEVICE_VGAARB_INIT
|
||||||
|
|
||||||
/* Path to text files containing PCI IDs */
|
/* Path to text files containing PCI IDs */
|
||||||
#undef PCI_TXT_IDS_PATH
|
#undef PCI_TXT_IDS_PATH
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue