diff options
Diffstat (limited to 'xserver/hw/kdrive/src')
-rw-r--r-- | xserver/hw/kdrive/src/Makefile.am | 1 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/Makefile.in | 20 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kcmap.c | 15 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kdrive.c | 268 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kdrive.h | 150 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kinfo.c | 4 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kinput.c | 299 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kmode.c | 378 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kshadow.c | 4 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kxv.c | 236 | ||||
-rw-r--r-- | xserver/hw/kdrive/src/kxv.h | 21 |
11 files changed, 84 insertions, 1312 deletions
diff --git a/xserver/hw/kdrive/src/Makefile.am b/xserver/hw/kdrive/src/Makefile.am index b7f94b058..08331502f 100644 --- a/xserver/hw/kdrive/src/Makefile.am +++ b/xserver/hw/kdrive/src/Makefile.am @@ -19,7 +19,6 @@ libkdrive_la_SOURCES = \ kdrive.h \ kinfo.c \ kinput.c \ - kmode.c \ kshadow.c \ $(KDRIVE_XV_SOURCES) \ $(top_srcdir)/mi/miinitext.c diff --git a/xserver/hw/kdrive/src/Makefile.in b/xserver/hw/kdrive/src/Makefile.in index d679b82a8..1698d96fc 100644 --- a/xserver/hw/kdrive/src/Makefile.in +++ b/xserver/hw/kdrive/src/Makefile.in @@ -68,7 +68,7 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ - $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/xwayland-config.h \ $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -77,11 +77,11 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) @CONFIG_UDEV_TRUE@libkdrive_la_DEPENDENCIES = \ @CONFIG_UDEV_TRUE@ $(top_builddir)/config/libconfig.la am__libkdrive_la_SOURCES_DIST = fourcc.h kcmap.c kdrive.c kdrive.h \ - kinfo.c kinput.c kmode.c kshadow.c kxv.c kxv.h \ + kinfo.c kinput.c kshadow.c kxv.c kxv.h \ $(top_srcdir)/mi/miinitext.c @XV_TRUE@am__objects_1 = kxv.lo am_libkdrive_la_OBJECTS = kcmap.lo kdrive.lo kinfo.lo kinput.lo \ - kmode.lo kshadow.lo $(am__objects_1) miinitext.lo + kshadow.lo $(am__objects_1) miinitext.lo libkdrive_la_OBJECTS = $(am_libkdrive_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -314,6 +314,7 @@ RANLIB = @RANLIB@ RAWCPP = @RAWCPP@ RAWCPPFLAGS = @RAWCPPFLAGS@ RELEASE_DATE = @RELEASE_DATE@ +SCANNER_ARG = @SCANNER_ARG@ SDK_REQUIRED_MODULES = @SDK_REQUIRED_MODULES@ SED = @SED@ SELINUX_CFLAGS = @SELINUX_CFLAGS@ @@ -332,15 +333,18 @@ SYSCONFDIR = @SYSCONFDIR@ SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@ SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@ TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@ -TSLIB_CFLAGS = @TSLIB_CFLAGS@ -TSLIB_LIBS = @TSLIB_LIBS@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ +WAYLAND_EGLSTREAM_CFLAGS = @WAYLAND_EGLSTREAM_CFLAGS@ +WAYLAND_EGLSTREAM_DATADIR = @WAYLAND_EGLSTREAM_DATADIR@ +WAYLAND_EGLSTREAM_LIBS = @WAYLAND_EGLSTREAM_LIBS@ WAYLAND_PROTOCOLS_DATADIR = @WAYLAND_PROTOCOLS_DATADIR@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ +WAYLAND_SCANNER_CFLAGS = @WAYLAND_SCANNER_CFLAGS@ +WAYLAND_SCANNER_LIBS = @WAYLAND_SCANNER_LIBS@ WINDOWSDRI_CFLAGS = @WINDOWSDRI_CFLAGS@ WINDOWSDRI_LIBS = @WINDOWSDRI_LIBS@ WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ @@ -348,6 +352,8 @@ WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XCONFIGDIR = @XCONFIGDIR@ +XCONFIGFILE = @XCONFIGFILE@ XDMCP_CFLAGS = @XDMCP_CFLAGS@ XDMCP_LIBS = @XDMCP_LIBS@ XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ @@ -419,8 +425,6 @@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ -__XCONFIGDIR__ = @__XCONFIGDIR__@ -__XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ abi_videodrv = @abi_videodrv@ @@ -502,7 +506,6 @@ libkdrive_la_SOURCES = \ kdrive.h \ kinfo.c \ kinput.c \ - kmode.c \ kshadow.c \ $(KDRIVE_XV_SOURCES) \ $(top_srcdir)/mi/miinitext.c @@ -567,7 +570,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kdrive.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kinput.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kmode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kshadow.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kxv.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/miinitext.Plo@am__quote@ diff --git a/xserver/hw/kdrive/src/kcmap.c b/xserver/hw/kdrive/src/kcmap.c index 0970064f6..b8697ca63 100644 --- a/xserver/hw/kdrive/src/kcmap.c +++ b/xserver/hw/kdrive/src/kcmap.c @@ -20,8 +20,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> #endif #include "kdrive.h" @@ -29,7 +29,7 @@ * Put the entire colormap into the DAC */ -void +static void KdSetColormap(ScreenPtr pScreen) { KdScreenPriv(pScreen); @@ -72,10 +72,6 @@ KdSetColormap(ScreenPtr pScreen) (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, (1 << pScreenPriv->screen->fb. depth), defs); - - /* recolor hardware cursor */ - if (pScreenPriv->card->cfuncs->recolorCursor) - (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, 0, 0); } /* @@ -235,9 +231,4 @@ KdStoreColors(ColormapPtr pCmap, int ndef, xColorItem * pdefs) } (*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs); - - /* recolor hardware cursor */ - if (pScreenPriv->card->cfuncs->recolorCursor) - (*pScreenPriv->card->cfuncs->recolorCursor) (pCmap->pScreen, ndef, - pdefs); } diff --git a/xserver/hw/kdrive/src/kdrive.c b/xserver/hw/kdrive/src/kdrive.c index f02d8262b..6e8168323 100644 --- a/xserver/hw/kdrive/src/kdrive.c +++ b/xserver/hw/kdrive/src/kdrive.c @@ -20,8 +20,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> #endif #include "kdrive.h" #include <mivalidate.h> @@ -30,6 +30,7 @@ #ifdef RANDR #include <randrstr.h> #endif +#include "glx_extinit.h" #ifdef XV #include "kxv.h" @@ -66,25 +67,18 @@ KdDepths kdDepths[] = { {32, 32} }; -#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0])) - #define KD_DEFAULT_BUTTONS 5 DevPrivateKeyRec kdScreenPrivateKeyRec; -unsigned long kdGeneration; +static unsigned long kdGeneration; -Bool kdVideoTest; -unsigned long kdVideoTestTime; Bool kdEmulateMiddleButton; Bool kdRawPointerCoordinates; Bool kdDisableZaphod; -Bool kdAllowZap; -Bool kdEnabled; -int kdSubpixelOrder; -int kdVirtualTerminal = -1; -Bool kdSwitchPending; -char *kdSwitchCmd; -DDXPointRec kdOrigin; +static Bool kdEnabled; +static int kdSubpixelOrder; +static char *kdSwitchCmd; +static DDXPointRec kdOrigin; Bool kdHasPointer = FALSE; Bool kdHasKbd = FALSE; const char *kdGlobalXkbRules = NULL; @@ -93,15 +87,6 @@ const char *kdGlobalXkbLayout = NULL; const char *kdGlobalXkbVariant = NULL; const char *kdGlobalXkbOptions = NULL; -static Bool kdCaughtSignal = FALSE; - -/* - * Carry arguments from InitOutput through driver initialization - * to KdScreenInit - */ - -KdOsFuncs *kdOsFuncs; - void KdDisableScreen(ScreenPtr pScreen) { @@ -114,14 +99,7 @@ KdDisableScreen(ScreenPtr pScreen) KdDisableColormap(pScreen); if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel) (*pScreenPriv->card->cfuncs->disableAccel) (pScreen); - if (!pScreenPriv->screen->softCursor && - pScreenPriv->card->cfuncs->disableCursor) - (*pScreenPriv->card->cfuncs->disableCursor) (pScreen); - if (pScreenPriv->card->cfuncs->dpms) - (*pScreenPriv->card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL); pScreenPriv->enabled = FALSE; - if (pScreenPriv->card->cfuncs->disable) - (*pScreenPriv->card->cfuncs->disable) (pScreen); } static void @@ -144,7 +122,7 @@ KdDoSwitchCmd(const char *reason) } } -void +static void KdSuspend(void) { KdCardInfo *card; @@ -155,23 +133,17 @@ KdSuspend(void) for (screen = card->screenList; screen; screen = screen->next) if (screen->mynum == card->selected && screen->pScreen) KdDisableScreen(screen->pScreen); - if (card->driver && card->cfuncs->restore) - (*card->cfuncs->restore) (card); } KdDisableInput(); KdDoSwitchCmd("suspend"); } } -void +static void KdDisableScreens(void) { KdSuspend(); - if (kdEnabled) { - if (kdOsFuncs->Disable) - (*kdOsFuncs->Disable) (); - kdEnabled = FALSE; - } + kdEnabled = FALSE; } Bool @@ -181,78 +153,20 @@ KdEnableScreen(ScreenPtr pScreen) if (pScreenPriv->enabled) return TRUE; - if (pScreenPriv->card->cfuncs->enable) - if (!(*pScreenPriv->card->cfuncs->enable) (pScreen)) - return FALSE; pScreenPriv->enabled = TRUE; pScreenPriv->dpmsState = KD_DPMS_NORMAL; pScreenPriv->card->selected = pScreenPriv->screen->mynum; - if (!pScreenPriv->screen->softCursor && - pScreenPriv->card->cfuncs->enableCursor) - (*pScreenPriv->card->cfuncs->enableCursor) (pScreen); if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel) (*pScreenPriv->card->cfuncs->enableAccel) (pScreen); KdEnableColormap(pScreen); SetRootClip(pScreen, ROOT_CLIP_FULL); - if (pScreenPriv->card->cfuncs->dpms) - (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState); return TRUE; } void -KdResume(void) -{ - KdCardInfo *card; - KdScreenInfo *screen; - - if (kdEnabled) { - KdDoSwitchCmd("resume"); - for (card = kdCardInfo; card; card = card->next) { - if (card->cfuncs->preserve) - (*card->cfuncs->preserve) (card); - for (screen = card->screenList; screen; screen = screen->next) - if (screen->mynum == card->selected && screen->pScreen) - KdEnableScreen(screen->pScreen); - } - KdEnableInput(); - KdReleaseAllKeys(); - } -} - -void -KdEnableScreens(void) -{ - if (!kdEnabled) { - kdEnabled = TRUE; - if (kdOsFuncs->Enable) - (*kdOsFuncs->Enable) (); - } - KdResume(); -} - -void -KdProcessSwitch(void) -{ - if (kdEnabled) - KdDisableScreens(); - else - KdEnableScreens(); -} - -void AbortDDX(enum ExitCode error) { KdDisableScreens(); - if (kdOsFuncs) { - if (kdEnabled && kdOsFuncs->Disable) - (*kdOsFuncs->Disable) (); - if (kdOsFuncs->Fini) - (*kdOsFuncs->Fini) (); - KdDoSwitchCmd("stop"); - } - - if (kdCaughtSignal) - OsAbort(); } void @@ -261,8 +175,8 @@ ddxGiveUp(enum ExitCode error) AbortDDX(error); } -Bool kdDumbDriver; -Bool kdSoftCursor; +static Bool kdDumbDriver; +static Bool kdSoftCursor; const char * KdParseFindNext(const char *cur, const char *delim, char *save, char *last) @@ -418,18 +332,7 @@ KdParseScreen(KdScreenInfo * screen, const char *arg) } } -/* - * Mouse argument syntax: - * - * device,protocol,options... - * - * Options are any of: - * 1-5 n button mouse - * 2button emulate middle button - * {NMO} Reorder buttons - */ - -void +static void KdParseRgba(char *rgba) { if (!strcmp(rgba, "rgb")) @@ -474,7 +377,6 @@ KdUseMsg(void) ErrorF ("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n"); ErrorF("-switchCmd Command to execute on vt switch\n"); - ErrorF("-zap Terminate server on Ctrl+Alt+Backspace\n"); ErrorF ("vtxx Use virtual terminal xx instead of the next available\n"); } @@ -507,10 +409,6 @@ KdProcessArgument(int argc, char **argv, int i) kdDisableZaphod = TRUE; return 1; } - if (!strcmp(argv[i], "-zap")) { - kdAllowZap = TRUE; - return 1; - } if (!strcmp(argv[i], "-3button")) { kdEmulateMiddleButton = FALSE; return 1; @@ -531,10 +429,6 @@ KdProcessArgument(int argc, char **argv, int i) kdSoftCursor = TRUE; return 1; } - if (!strcmp(argv[i], "-videoTest")) { - kdVideoTest = TRUE; - return 1; - } if (!strcmp(argv[i], "-origin")) { if ((i + 1) < argc) { char *x = argv[i + 1]; @@ -567,10 +461,6 @@ KdProcessArgument(int argc, char **argv, int i) UseMsg(); return 2; } - if (!strncmp(argv[i], "vt", 2) && - sscanf(argv[i], "vt%2d", &kdVirtualTerminal) == 1) { - return 1; - } if (!strcmp(argv[i], "-xkb-rules")) { if (i + 1 >= argc) { UseMsg(); @@ -629,25 +519,7 @@ KdProcessArgument(int argc, char **argv, int i) return 0; } -/* - * These are getting tossed in here until I can think of where - * they really belong - */ - -void -KdOsInit(KdOsFuncs * pOsFuncs) -{ - kdOsFuncs = pOsFuncs; - if (pOsFuncs) { - if (serverGeneration == 1) { - KdDoSwitchCmd("start"); - if (pOsFuncs->Init) - (*pOsFuncs->Init) (); - } - } -} - -Bool +static Bool KdAllocatePrivates(ScreenPtr pScreen) { KdPrivScreenPtr pScreenPriv; @@ -665,7 +537,7 @@ KdAllocatePrivates(ScreenPtr pScreen) return TRUE; } -Bool +static Bool KdCreateScreenResources(ScreenPtr pScreen) { KdScreenPriv(pScreen); @@ -684,7 +556,7 @@ KdCreateScreenResources(ScreenPtr pScreen) return ret; } -Bool +static Bool KdCloseScreen(ScreenPtr pScreen) { KdScreenPriv(pScreen); @@ -703,26 +575,12 @@ KdCloseScreen(ScreenPtr pScreen) else ret = TRUE; - if (pScreenPriv->dpmsState != KD_DPMS_NORMAL) - (*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL); - if (screen->mynum == card->selected) KdDisableScreen(pScreen); - /* - * Restore video hardware when last screen is closed - */ - if (screen == card->screenList) { - if (kdEnabled && card->cfuncs->restore) - (*card->cfuncs->restore) (card); - } - if (!pScreenPriv->screen->dumb && card->cfuncs->finiAccel) (*card->cfuncs->finiAccel) (pScreen); - if (!pScreenPriv->screen->softCursor && card->cfuncs->finiCursor) - (*card->cfuncs->finiCursor) (pScreen); - if (card->cfuncs->scrfini) (*card->cfuncs->scrfini) (screen); @@ -737,11 +595,7 @@ KdCloseScreen(ScreenPtr pScreen) * Clean up OS when last card is closed */ if (card == kdCardInfo) { - if (kdEnabled) { - kdEnabled = FALSE; - if (kdOsFuncs->Disable) - (*kdOsFuncs->Disable) (); - } + kdEnabled = FALSE; } } @@ -751,37 +605,10 @@ KdCloseScreen(ScreenPtr pScreen) return ret; } -Bool +static Bool KdSaveScreen(ScreenPtr pScreen, int on) { - KdScreenPriv(pScreen); - int dpmsState; - - if (!pScreenPriv->card->cfuncs->dpms) - return FALSE; - - dpmsState = pScreenPriv->dpmsState; - switch (on) { - case SCREEN_SAVER_OFF: - dpmsState = KD_DPMS_NORMAL; - break; - case SCREEN_SAVER_ON: - if (dpmsState == KD_DPMS_NORMAL) - dpmsState = KD_DPMS_NORMAL + 1; - break; - case SCREEN_SAVER_CYCLE: - if (dpmsState < KD_DPMS_MAX) - dpmsState++; - break; - case SCREEN_SAVER_FORCER: - break; - } - if (dpmsState != pScreenPriv->dpmsState) { - if (pScreenPriv->enabled) - (*pScreenPriv->card->cfuncs->dpms) (pScreen, dpmsState); - pScreenPriv->dpmsState = dpmsState; - } - return TRUE; + return FALSE; } static Bool @@ -858,7 +685,7 @@ KdSetSubpixelOrder(ScreenPtr pScreen, Rotation randr) /* Pass through AddScreen, which doesn't take any closure */ static KdScreenInfo *kdCurrentScreen; -Bool +static Bool KdScreenInit(ScreenPtr pScreen, int argc, char **argv) { KdScreenInfo *screen = kdCurrentScreen; @@ -968,7 +795,6 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv) /* * Wrap CloseScreen, the order now is: * KdCloseScreen - * miBSCloseScreen * fbCloseScreen */ pScreenPriv->CloseScreen = pScreen->CloseScreen; @@ -993,21 +819,10 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv) /* * Enable the hardware */ - if (!kdEnabled) { - kdEnabled = TRUE; - if (kdOsFuncs->Enable) - (*kdOsFuncs->Enable) (); - } + kdEnabled = TRUE; if (screen->mynum == card->selected) { - if (card->cfuncs->preserve) - (*card->cfuncs->preserve) (card); - if (card->cfuncs->enable) - if (!(*card->cfuncs->enable) (pScreen)) - return FALSE; pScreenPriv->enabled = TRUE; - if (!screen->softCursor && card->cfuncs->enableCursor) - (*card->cfuncs->enableCursor) (pScreen); KdEnableColormap(pScreen); if (!screen->dumb && card->cfuncs->enableAccel) (*card->cfuncs->enableAccel) (pScreen); @@ -1016,7 +831,7 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv) return TRUE; } -void +static void KdInitScreen(ScreenInfo * pScreenInfo, KdScreenInfo * screen, int argc, char **argv) { @@ -1065,7 +880,7 @@ KdSetPixmapFormats(ScreenInfo * pScreenInfo) /* * Fill in additional formats */ - for (i = 0; i < NUM_KD_DEPTHS; i++) + for (i = 0; i < ARRAY_SIZE(kdDepths); i++) if (!depthToBpp[kdDepths[i].depth]) depthToBpp[kdDepths[i].depth] = kdDepths[i].bpp; @@ -1118,27 +933,6 @@ KdAddScreen(ScreenInfo * pScreenInfo, AddScreen(KdScreenInit, argc, argv); } -#if 0 /* This function is not used currently */ - -int -KdDepthToFb(ScreenPtr pScreen, int depth) -{ - KdScreenPriv(pScreen); - - for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb.frameBuffer; fb++) - if (pScreenPriv->screen->fb.depth == depth) - return fb; -} - -#endif - -static int -KdSignalWrapper(int signum) -{ - kdCaughtSignal = TRUE; - return 1; /* use generic OS layer cleanup & abort */ -} - void KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) { @@ -1180,7 +974,7 @@ KdInitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) for (screen = card->screenList; screen; screen = screen->next) KdAddScreen(pScreenInfo, screen, argc, argv); - OsRegisterSigWrapper(KdSignalWrapper); + xorgGlxCreateVendor(); #if defined(CONFIG_UDEV) || defined(CONFIG_HAL) if (SeatId) /* Enable input hot-plugging */ @@ -1193,18 +987,6 @@ OsVendorFatalError(const char *f, va_list args) { } -int -DPMSSet(ClientPtr client, int level) -{ - return Success; -} - -Bool -DPMSSupported(void) -{ - return FALSE; -} - /* These stubs can be safely removed once we can * split input and GPU parts in hotplug.h et al. */ #ifdef CONFIG_UDEV_KMS diff --git a/xserver/hw/kdrive/src/kdrive.h b/xserver/hw/kdrive/src/kdrive.h index 3c7f2cdf2..432f89140 100644 --- a/xserver/hw/kdrive/src/kdrive.h +++ b/xserver/hw/kdrive/src/kdrive.h @@ -110,19 +110,10 @@ typedef struct _KdCardFuncs { Bool (*initScreen) (ScreenPtr); /* initialize ScreenRec */ Bool (*finishInitScreen) (ScreenPtr pScreen); Bool (*createRes) (ScreenPtr); /* create screen resources */ - void (*preserve) (KdCardInfo *); /* save graphics card state */ - Bool (*enable) (ScreenPtr); /* set up for rendering */ - Bool (*dpms) (ScreenPtr, int); /* set DPMS screen saver */ - void (*disable) (ScreenPtr); /* turn off rendering */ - void (*restore) (KdCardInfo *); /* restore graphics card state */ void (*scrfini) (KdScreenInfo *); /* close down screen */ void (*cardfini) (KdCardInfo *); /* close down */ Bool (*initCursor) (ScreenPtr); /* detect and map cursor */ - void (*enableCursor) (ScreenPtr); /* enable cursor */ - void (*disableCursor) (ScreenPtr); /* disable cursor */ - void (*finiCursor) (ScreenPtr); /* close down */ - void (*recolorCursor) (ScreenPtr, int, xColorItem *); Bool (*initAccel) (ScreenPtr); void (*enableAccel) (ScreenPtr); @@ -222,8 +213,6 @@ struct _KdPointerInfo { struct _KdPointerInfo *next; }; -extern int KdCurScreen; - void KdAddPointerDriver(KdPointerDriver * driver); void KdRemovePointerDriver(KdPointerDriver * driver); KdPointerInfo *KdNewPointer(void); @@ -290,42 +279,6 @@ int KdAddConfigKeyboard(char *pointer); int KdAddKeyboard(KdKeyboardInfo * ki); void KdRemoveKeyboard(KdKeyboardInfo * ki); -typedef struct _KdOsFuncs { - int (*Init) (void); - void (*Enable) (void); - Bool (*SpecialKey) (KeySym); - void (*Disable) (void); - void (*Fini) (void); - void (*pollEvents) (void); - void (*Bell) (int, int, int); -} KdOsFuncs; - -typedef enum _KdSyncPolarity { - KdSyncNegative, KdSyncPositive -} KdSyncPolarity; - -typedef struct _KdMonitorTiming { - /* label */ - int horizontal; - int vertical; - int rate; - /* pixel clock */ - int clock; /* in KHz */ - /* horizontal timing */ - int hfp; /* front porch */ - int hbp; /* back porch */ - int hblank; /* blanking */ - KdSyncPolarity hpol; /* polarity */ - /* vertical timing */ - int vfp; /* front porch */ - int vbp; /* back porch */ - int vblank; /* blanking */ - KdSyncPolarity vpol; /* polarity */ -} KdMonitorTiming; - -extern const KdMonitorTiming kdMonitorTimings[]; -extern const int kdNumMonitorTimings; - typedef struct _KdPointerMatrix { int matrix[2][3]; } KdPointerMatrix; @@ -334,15 +287,8 @@ extern DevPrivateKeyRec kdScreenPrivateKeyRec; #define kdScreenPrivateKey (&kdScreenPrivateKeyRec) -extern unsigned long kdGeneration; -extern Bool kdEnabled; -extern Bool kdSwitchPending; extern Bool kdEmulateMiddleButton; extern Bool kdDisableZaphod; -extern Bool kdAllowZap; -extern int kdVirtualTerminal; -extern char *kdSwitchCmd; -extern KdOsFuncs *kdOsFuncs; #define KdGetScreenPriv(pScreen) ((KdPrivScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey)) @@ -352,9 +298,6 @@ extern KdOsFuncs *kdOsFuncs; /* kcmap.c */ void - KdSetColormap(ScreenPtr pScreen); - -void KdEnableColormap(ScreenPtr pScreen); void @@ -378,9 +321,6 @@ extern miPointerScreenFuncRec kdPointerScreenFuncs; void KdDisableScreen(ScreenPtr pScreen); -void - KdDisableScreens(void); - Bool KdEnableScreen(ScreenPtr pScreen); @@ -388,12 +328,6 @@ void KdEnableScreens(void); void - KdSuspend(void); - -void - KdResume(void); - -void KdProcessSwitch(void); Rotation KdAddRotation(Rotation a, Rotation b); @@ -403,48 +337,18 @@ Rotation KdSubRotation(Rotation a, Rotation b); void KdParseScreen(KdScreenInfo * screen, const char *arg); -KdPointerInfo *KdParsePointer(const char *arg); - -KdKeyboardInfo *KdParseKeyboard(const char *arg); - const char * KdParseFindNext(const char *cur, const char *delim, char *save, char *last); void - KdParseRgba(char *rgba); - -void KdUseMsg(void); int KdProcessArgument(int argc, char **argv, int i); void - KdOsInit(KdOsFuncs * pOsFuncs); - -void KdOsAddInputDrivers(void); -Bool - KdAllocatePrivates(ScreenPtr pScreen); - -Bool - KdCreateScreenResources(ScreenPtr pScreen); - -Bool - KdCloseScreen(ScreenPtr pScreen); - -Bool - KdSaveScreen(ScreenPtr pScreen, int on); - -Bool - KdScreenInit(ScreenPtr pScreen, int argc, char **argv); - -void - -KdInitScreen(ScreenInfo * pScreenInfo, - KdScreenInfo * screen, int argc, char **argv); - void KdInitCard(ScreenInfo * pScreenInfo, KdCardInfo * card, int argc, char **argv); @@ -476,17 +380,7 @@ void void KdCloseInput(void); -Bool - KdRegisterFd(int fd, void (*read) (int fd, void *closure), void *closure); - -void - KdUnregisterFds(void *closure, Bool do_close); - -void - KdUnregisterFd(void *closure, int fd, Bool do_close); - void - KdEnqueueKeyboardEvent(KdKeyboardInfo * ki, unsigned char scan_code, unsigned char is_up); @@ -500,33 +394,17 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo * ki, unsigned char scan_code, #define KD_MOUSE_DELTA 0x80000000 void - KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry, int rz); void - -_KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, - int b, int absrel, Bool force); - -void - KdReleaseAllKeys(void); - -void - KdSetLed(KdKeyboardInfo * ki, int led, Bool on); - -void KdSetPointerMatrix(KdPointerMatrix *pointer); void - KdComputePointerMatrix(KdPointerMatrix *pointer, Rotation randr, int width, int height); void - KdScreenToPointerCoords(int *x, int *y); - -void KdBlockHandler(ScreenPtr pScreen, void *timeout); void @@ -538,34 +416,6 @@ void void KdEnableInput(void); -void - KdRingBell(KdKeyboardInfo * ki, int volume, int pitch, int duration); - -/* kmode.c */ -const KdMonitorTiming *KdFindMode(KdScreenInfo * screen, - Bool (*supported) (KdScreenInfo *, - const KdMonitorTiming *)); - -Bool - -KdTuneMode(KdScreenInfo * screen, - Bool (*usable) (KdScreenInfo *), - Bool (*supported) (KdScreenInfo *, const KdMonitorTiming *)); - -#ifdef RANDR -Bool - -KdRandRGetInfo(ScreenPtr pScreen, - int randr, - Bool (*supported) (ScreenPtr pScreen, const KdMonitorTiming *)); - -const KdMonitorTiming *KdRandRGetTiming(ScreenPtr pScreen, - Bool (*supported) (ScreenPtr pScreen, - const KdMonitorTiming - *), int rate, - RRScreenSizePtr pSize); -#endif - /* kshadow.c */ Bool KdShadowFbAlloc(KdScreenInfo * screen, Bool rotate); diff --git a/xserver/hw/kdrive/src/kinfo.c b/xserver/hw/kdrive/src/kinfo.c index f91d57504..4abb082b0 100644 --- a/xserver/hw/kdrive/src/kinfo.c +++ b/xserver/hw/kdrive/src/kinfo.c @@ -20,8 +20,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> #endif #include "kdrive.h" diff --git a/xserver/hw/kdrive/src/kinput.c b/xserver/hw/kdrive/src/kinput.c index 8b08747a6..8ab8c24c8 100644 --- a/xserver/hw/kdrive/src/kinput.c +++ b/xserver/hw/kdrive/src/kinput.c @@ -21,8 +21,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#include <xkb-config.h> #endif #include "kdrive.h" #include "inputstr.h" @@ -54,11 +55,6 @@ #include <hotplug.h> #endif -#ifdef KDRIVE_EVDEV -#define DEV_INPUT_EVENT_PREFIX "/dev/input/event" -#define DEV_INPUT_EVENT_PREFIX_LEN (sizeof(DEV_INPUT_EVENT_PREFIX) - 1) -#endif - #define AtomFromName(x) MakeAtom(x, strlen(x), 1) struct KdConfigDevice { @@ -84,21 +80,6 @@ static KdPointerMatrix kdPointerMatrix = { {0, 1, 0}} }; -void KdResetInputMachine(void); - -#define KD_MAX_INPUT_FDS 8 - -typedef struct _kdInputFd { - int fd; - void (*read) (int fd, void *closure); - int (*enable) (int fd, void *closure); - void (*disable) (int fd, void *closure); - void *closure; -} KdInputFd; - -static KdInputFd kdInputFds[KD_MAX_INPUT_FDS]; -static int kdNumInputFds; - extern Bool kdRawPointerCoordinates; extern const char *kdGlobalXkbRules; @@ -113,7 +94,7 @@ extern const char *kdGlobalXkbOptions; #define NOBLOCK FNDELAY #endif -void +static void KdResetInputMachine(void) { KdPointerInfo *pi; @@ -124,89 +105,11 @@ KdResetInputMachine(void) } } -static void -KdNonBlockFd(int fd) -{ - int flags; - - flags = fcntl(fd, F_GETFL); - flags |= FASYNC | NOBLOCK; - fcntl(fd, F_SETFL, flags); -} - -static void -KdNotifyFd(int fd, int ready, void *data) -{ - int i = (int) (intptr_t) data; - (*kdInputFds[i].read)(fd, kdInputFds[i].closure); -} - -static void -KdAddFd(int fd, int i) -{ - KdNonBlockFd(fd); - InputThreadRegisterDev(fd, KdNotifyFd, (void *) (intptr_t) i); -} - -static void -KdRemoveFd(int fd) -{ - int flags; - - InputThreadUnregisterDev(fd); - flags = fcntl(fd, F_GETFL); - flags &= ~(FASYNC | NOBLOCK); - fcntl(fd, F_SETFL, flags); -} - -Bool -KdRegisterFd(int fd, void (*read) (int fd, void *closure), void *closure) -{ - if (kdNumInputFds == KD_MAX_INPUT_FDS) - return FALSE; - kdInputFds[kdNumInputFds].fd = fd; - kdInputFds[kdNumInputFds].read = read; - kdInputFds[kdNumInputFds].enable = 0; - kdInputFds[kdNumInputFds].disable = 0; - kdInputFds[kdNumInputFds].closure = closure; - if (kdInputEnabled) - KdAddFd(fd, kdNumInputFds); - kdNumInputFds++; - return TRUE; -} - -void -KdUnregisterFd(void *closure, int fd, Bool do_close) -{ - int i, j; - - for (i = 0; i < kdNumInputFds; i++) { - if (kdInputFds[i].closure == closure && - (fd == -1 || kdInputFds[i].fd == fd)) { - if (kdInputEnabled) - KdRemoveFd(kdInputFds[i].fd); - if (do_close) - close(kdInputFds[i].fd); - for (j = i; j < (kdNumInputFds - 1); j++) - kdInputFds[j] = kdInputFds[j + 1]; - kdNumInputFds--; - break; - } - } -} - -void -KdUnregisterFds(void *closure, Bool do_close) -{ - KdUnregisterFd(closure, -1, do_close); -} - void KdDisableInput(void) { KdKeyboardInfo *ki; KdPointerInfo *pi; - int found = 0, i = 0; input_lock(); @@ -220,49 +123,6 @@ KdDisableInput(void) (*pi->driver->Disable) (pi); } - if (kdNumInputFds) { - ErrorF("[KdDisableInput] Buggy drivers: still %d input fds left!", - kdNumInputFds); - i = 0; - while (i < kdNumInputFds) { - found = 0; - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki == kdInputFds[i].closure) { - ErrorF(" fd %d belongs to keybd driver %s\n", - kdInputFds[i].fd, - ki->driver && ki->driver->name ? - ki->driver->name : "(unnamed!)"); - found = 1; - break; - } - } - - if (found) { - i++; - continue; - } - - for (pi = kdPointers; pi; pi = pi->next) { - if (pi == kdInputFds[i].closure) { - ErrorF(" fd %d belongs to pointer driver %s\n", - kdInputFds[i].fd, - pi->driver && pi->driver->name ? - pi->driver->name : "(unnamed!)"); - break; - } - } - - if (found) { - i++; - continue; - } - - ErrorF(" fd %d not claimed by any active device!\n", - kdInputFds[i].fd); - KdUnregisterFd(kdInputFds[i].closure, kdInputFds[i].fd, TRUE); - } - } - kdInputEnabled = FALSE; } @@ -501,6 +361,16 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev) } static void +KdRingBell(KdKeyboardInfo * ki, int volume, int pitch, int duration) +{ + if (!ki || !ki->driver || !ki->driver->Bell) + return; + + if (kdInputEnabled) + (*ki->driver->Bell) (ki, volume, pitch, duration); +} + +static void KdBell(int volume, DeviceIntPtr pDev, void *arg, int something) { KeybdCtrl *ctrl = arg; @@ -522,27 +392,12 @@ DDXRingBell(int volume, int pitch, int duration) { KdKeyboardInfo *ki = NULL; - if (kdOsFuncs->Bell) { - (*kdOsFuncs->Bell) (volume, pitch, duration); - } - else { - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki->dixdev->coreEvents) - KdRingBell(ki, volume, pitch, duration); - } + for (ki = kdKeyboards; ki; ki = ki->next) { + if (ki->dixdev->coreEvents) + KdRingBell(ki, volume, pitch, duration); } } -void -KdRingBell(KdKeyboardInfo * ki, int volume, int pitch, int duration) -{ - if (!ki || !ki->driver || !ki->driver->Bell) - return; - - if (kdInputEnabled) - (*ki->driver->Bell) (ki, volume, pitch, duration); -} - static void KdSetLeds(KdKeyboardInfo * ki, int leds) { @@ -555,7 +410,7 @@ KdSetLeds(KdKeyboardInfo * ki, int leds) } } -void +static void KdSetLed(KdKeyboardInfo * ki, int led, Bool on) { if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed) @@ -619,20 +474,6 @@ KdComputePointerMatrix(KdPointerMatrix * m, Rotation randr, int width, } } -void -KdScreenToPointerCoords(int *x, int *y) -{ - int (*m)[3] = kdPointerMatrix.matrix; - int div = m[0][1] * m[1][0] - m[1][1] * m[0][0]; - int sx = *x; - int sy = *y; - - *x = (m[0][1] * sy - m[0][1] * m[1][2] + m[1][1] * m[0][2] - - m[1][1] * sx) / div; - *y = (m[1][0] * sx + m[0][0] * m[1][2] - m[1][0] * m[0][2] - - m[0][0] * sy) / div; -} - static void KdKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl) { @@ -1091,19 +932,9 @@ KdParseKbdOptions(KdKeyboardInfo * ki) ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", key, value); } - -#ifdef KDRIVE_EVDEV - if (!ki->driver && ki->path != NULL && - strncasecmp(ki->path, - DEV_INPUT_EVENT_PREFIX, - DEV_INPUT_EVENT_PREFIX_LEN) == 0) { - ki->driver = KdFindKeyboardDriver("evdev"); - ki->options = input_option_new(ki->options, "driver", "evdev"); - } -#endif } -KdKeyboardInfo * +static KdKeyboardInfo * KdParseKeyboard(const char *arg) { char save[1024]; @@ -1209,19 +1040,9 @@ KdParsePointerOptions(KdPointerInfo * pi) ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", key, value); } - -#ifdef KDRIVE_EVDEV - if (!pi->driver && pi->path != NULL && - strncasecmp(pi->path, - DEV_INPUT_EVENT_PREFIX, - DEV_INPUT_EVENT_PREFIX_LEN) == 0) { - pi->driver = KdFindPointerDriver("evdev"); - pi->options = input_option_new(pi->options, "driver", "evdev"); - } -#endif } -KdPointerInfo * +static KdPointerInfo * KdParsePointer(const char *arg) { char save[1024]; @@ -1697,6 +1518,9 @@ KdClassifyInput(KdPointerInfo * pi, int type, int x, int y, int z, int b) return keyboard; } +static void +_KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, + int b, int absrel, Bool force); /* We return true if we're stealing the event. */ static Bool KdRunMouseMachine(KdPointerInfo * pi, KdInputClass c, int type, int x, int y, @@ -1771,46 +1595,29 @@ KdHandlePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, int b, } static void -KdReceiveTimeout(KdPointerInfo * pi) +_KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, + int b, int absrel, Bool force) { - KdRunMouseMachine(pi, timeout, 0, 0, 0, 0, 0, 0); -} - -/* - * kdCheckTermination - * - * This function checks for the key sequence that terminates the server. When - * detected, it sets the dispatchException flag and returns. The key sequence - * is: - * Control-Alt - * It's assumed that the server will be waken up by the caller when this - * function returns. - */ - -extern int nClients; + int valuators[3] = { x, y, z }; + ValuatorMask mask; -void -KdReleaseAllKeys(void) -{ -#if 0 - int key; - KdKeyboardInfo *ki; + /* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */ + if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel)) + return; - input_lock(); + valuator_mask_set_range(&mask, 0, 3, valuators); - for (ki = kdKeyboards; ki; ki = ki->next) { - for (key = ki->keySyms.minKeyCode; key < ki->keySyms.maxKeyCode; key++) { - if (key_is_down(ki->dixdev, key, KEY_POSTED | KEY_PROCESSED)) { - KdHandleKeyboardEvent(ki, KeyRelease, key); - QueueGetKeyboardEvents(ki->dixdev, KeyRelease, key, NULL); - } - } - } + QueuePointerEvents(pi->dixdev, type, b, absrel, &mask); +} - input_unlock(); -#endif +static void +KdReceiveTimeout(KdPointerInfo * pi) +{ + KdRunMouseMachine(pi, timeout, 0, 0, 0, 0, 0, 0); } +extern int nClients; + static void KdCheckLock(void) { @@ -1945,22 +1752,6 @@ KdEnqueuePointerEvent(KdPointerInfo * pi, unsigned long flags, int rx, int ry, } void -_KdEnqueuePointerEvent(KdPointerInfo * pi, int type, int x, int y, int z, - int b, int absrel, Bool force) -{ - int valuators[3] = { x, y, z }; - ValuatorMask mask; - - /* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */ - if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel)) - return; - - valuator_mask_set_range(&mask, 0, 3, valuators); - - QueuePointerEvents(pi->dixdev, type, b, absrel, &mask); -} - -void KdBlockHandler(ScreenPtr pScreen, void *timeo) { KdPointerInfo *pi; @@ -1977,11 +1768,6 @@ KdBlockHandler(ScreenPtr pScreen, void *timeo) myTimeout = ms; } } - /* if we need to poll for events, do that */ - if (kdOsFuncs->pollEvents) { - (*kdOsFuncs->pollEvents) (); - myTimeout = 20; - } if (myTimeout > 0) AdjustWaitForDelay(timeo, myTimeout); } @@ -2001,8 +1787,6 @@ KdWakeupHandler(ScreenPtr pScreen, int result) } } } - if (kdSwitchPending) - KdProcessSwitch(); } #define KdScreenOrigin(pScreen) (&(KdGetScreenPriv(pScreen)->screen->origin)) @@ -2089,13 +1873,10 @@ KdCrossScreen(ScreenPtr pScreen, Bool entering) { } -int KdCurScreen; /* current event screen */ - static void KdWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { input_lock(); - KdCurScreen = pScreen->myNum; miPointerWarpCursor(pDev, pScreen, x, y); input_unlock(); } @@ -2110,8 +1891,6 @@ void ProcessInputEvents(void) { mieqProcessInputEvents(); - if (kdSwitchPending) - KdProcessSwitch(); KdCheckLock(); } diff --git a/xserver/hw/kdrive/src/kmode.c b/xserver/hw/kdrive/src/kmode.c deleted file mode 100644 index ef1b6b4fa..000000000 --- a/xserver/hw/kdrive/src/kmode.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright 1999 SuSE, Inc. - * - * 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 SuSE not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. SuSE makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Keith Packard, SuSE, Inc. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -#include "kdrive.h" - -const KdMonitorTiming kdMonitorTimings[] = { - /* H V Hz KHz */ - /* FP BP BLANK POLARITY */ - - /* IPAQ modeline: - * - * Modeline "320x240" 5.7222 320 337 340 352 240 241 244 254" - */ - {320, 240, 64, 16256, - 17, 12, 32, KdSyncNegative, - 1, 11, 14, KdSyncNegative, - }, - - /* Other VESA modes */ - {640, 350, 85, 31500, /* VESA */ - 32, 96, 192, KdSyncPositive, /* 26.413 */ - 32, 60, 95, KdSyncNegative, /* 59.354 */ - }, - {640, 400, 60, 31500, /* VESA */ - 32, 96, 192, KdSyncNegative, /* 26.413 */ - 1, 41, 45, KdSyncPositive, /* 59.354 */ - }, - {720, 400, 85, 35500, /* VESA */ - 36, 108, 216, KdSyncNegative, /* 37.927 */ - 1, 42, 46, KdSyncPositive, /* 85.039 */ - }, - - /* Modeline "720x576" 29.000 720 736 800 880 576 577 580 625 */ - { - 720, 576, 52, 32954, /* PAL Video */ - 16, 80, 160, KdSyncPositive, /* 32.954 */ - 1, 45, 49, KdSyncPositive, /* 52.727 */ - }, - - /* 640x480 modes */ - {640, 480, 85, 36000, /* VESA */ - 56, 80, 192, KdSyncNegative, /* 43.269 */ - 1, 25, 29, KdSyncNegative, /* 85.008 */ - }, - {640, 480, 75, 31500, /* VESA */ - 16, 120, 200, KdSyncNegative, /* 37.500 */ - 1, 16, 20, KdSyncNegative, /* 75.000 */ - }, - {640, 480, 72, 31500, /* VESA */ - 16, 120, 176, KdSyncNegative, /* 37.861 */ - 1, 20, 24, KdSyncNegative, /* 72.809 */ - }, - {640, 480, 60, 25175, /* VESA */ - 16, 48, 160, KdSyncNegative, /* 31.469 */ - 10, 33, 45, KdSyncNegative, /* 59.940 */ - }, - - /* 800x600 modes */ - {800, 600, 85, 56250, /* VESA */ - 32, 152, 248, KdSyncPositive, /* 53.674 */ - 1, 27, 31, KdSyncPositive, /* 85.061 */ - }, - {800, 600, 75, 49500, /* VESA */ - 16, 160, 256, KdSyncPositive, /* 46.875 */ - 1, 21, 25, KdSyncPositive, /* 75.000 */ - }, - /* DEFAULT */ -#define MONITOR_TIMING_DEFAULT 9 - {800, 600, 72, 50000, /* VESA */ - 56, 64, 240, KdSyncPositive, /* 48.077 */ - 37, 23, 66, KdSyncPositive, /* 72.188 */ - }, - {800, 600, 60, 40000, /* VESA */ - 40, 88, 256, KdSyncPositive, /* 37.879 */ - 1, 23, 28, KdSyncPositive, /* 60.317 */ - }, - {800, 600, 56, 36000, /* VESA */ - 24, 128, 224, KdSyncPositive, /* 35.156 */ - 1, 22, 25, KdSyncPositive, /* 56.250 */ - }, - - /* 1024x768 modes */ - {1024, 768, 85, 94500, /* VESA */ - 48, 208, 352, KdSyncPositive, /* 68.677 */ - 1, 36, 40, KdSyncPositive, /* 84.997 */ - }, - {1024, 768, 75, 78750, /* VESA */ - 16, 176, 288, KdSyncPositive, /* 60.023 */ - 1, 28, 32, KdSyncPositive, /* 75.029 */ - }, - {1024, 768, 70, 75000, /* VESA */ - 24, 144, 304, KdSyncNegative, /* 56.476 */ - 3, 29, 38, KdSyncNegative, /* 70.069 */ - }, - {1024, 768, 60, 65000, /* VESA */ - 24, 160, 320, KdSyncNegative, /* 48.363 */ - 3, 29, 38, KdSyncNegative, /* 60.004 */ - }, - - /* 1152x864 mode */ - {1152, 864, 75, 108000, /* VESA */ - 64, 256, 448, KdSyncPositive, /* 67.500 */ - 1, 32, 36, KdSyncPositive, /* 75.000 */ - }, - - /* 1152x900 modes */ - {1152, 900, 85, 122500, /* ADDED */ - 48, 208, 384, KdSyncPositive, /* 79.753 */ - 1, 32, 38, KdSyncPositive, /* 85.024 */ - }, - {1152, 900, 75, 108250, /* ADDED */ - 32, 208, 384, KdSyncPositive, /* 70.475 */ - 1, 32, 38, KdSyncPositive, /* 75.133 */ - }, - {1152, 900, 70, 100250, /* ADDED */ - 32, 208, 384, KdSyncPositive, /* 65.267 */ - 2, 32, 38, KdSyncPositive, /* 69.581 */ - }, - {1152, 900, 66, 95000, /* ADDED */ - 32, 208, 384, KdSyncPositive, /* 61.849 */ - 1, 32, 38, KdSyncPositive, /* 65.937 */ - }, - - /* 1280x854 modes */ - {1280, 854, 103, 12500, /* ADDED */ - 56, 16, 128, KdSyncPositive, /* 102.554 */ - 1, 216, 12, KdSyncPositive, - }, - - /* 1280x960 modes */ - {1280, 960, 85, 148500, /* VESA */ - 64, 224, 448, KdSyncPositive, /* 85.938 */ - 1, 47, 51, KdSyncPositive, /* 85.002 */ - }, - {1280, 960, 60, 108000, /* VESA */ - 96, 312, 520, KdSyncPositive, /* 60.000 */ - 1, 36, 40, KdSyncPositive, /* 60.000 */ - }, - - /* 1280x1024 modes */ - {1280, 1024, 85, 157500, /* VESA */ - 64, 224, 448, KdSyncPositive, /* 91.146 */ - 1, 44, 48, KdSyncPositive, /* 85.024 */ - }, - {1280, 1024, 75, 135000, /* VESA */ - 16, 248, 408, KdSyncPositive, /* 79.976 */ - 1, 38, 42, KdSyncPositive, /* 75.025 */ - }, - {1280, 1024, 60, 108000, /* VESA */ - 48, 248, 408, KdSyncPositive, /* 63.981 */ - 1, 38, 42, KdSyncPositive, /* 60.020 */ - }, - - /* 1600x1200 modes */ - {1600, 1200, 85, 229500, /* VESA */ - 64, 304, 560, KdSyncPositive, /* 106.250 */ - 1, 46, 50, KdSyncPositive, /* 85.000 */ - }, - {1600, 1200, 75, 202500, /* VESA */ - 64, 304, 560, KdSyncPositive, /* 93.750 */ - 1, 46, 50, KdSyncPositive, /* 75.000 */ - }, - {1600, 1200, 70, 189000, /* VESA */ - 64, 304, 560, KdSyncPositive, /* 87.500 */ - 1, 46, 50, KdSyncPositive, /* 70.000 */ - }, - {1600, 1200, 65, 175500, /* VESA */ - 64, 304, 560, KdSyncPositive, /* 81.250 */ - 1, 46, 50, KdSyncPositive, /* 65.000 */ - }, - {1600, 1200, 60, 162000, /* VESA */ - 64, 304, 560, KdSyncPositive, /* 75.000 */ - 1, 46, 50, KdSyncPositive, /* 60.000 */ - }, - - /* 1792x1344 modes */ - {1792, 1344, 85, 301500, /* ADDED */ - 96, 352, 672, KdSyncNegative, /* 122.362 */ - 1, 92, 96, KdSyncPositive, /* 84.974 */ - }, - {1792, 1344, 75, 261000, /* VESA */ - 96, 352, 664, KdSyncNegative, /* 106.270 */ - 1, 69, 73, KdSyncPositive, /* 74.997 */ - }, - {1792, 1344, 60, 204750, /* VESA */ - 128, 328, 656, KdSyncNegative, /* 83.640 */ - 1, 46, 50, KdSyncPositive, /* 60.000 */ - }, - -#if 0 - {1800, 1012, 75}, - {1906, 1072, 68}, -#endif - - /* 1856x1392 modes */ - {1856, 1392, 85, 330500, /* ADDED */ - 160, 352, 736, KdSyncNegative, /* 127.508 */ - 1, 104, 108, KdSyncPositive, /* 85.001 */ - }, - {1856, 1392, 75, 288000, /* VESA */ - 128, 352, 704, KdSyncNegative, /* 112.500 */ - 1, 104, 108, KdSyncPositive, /* 75.000 */ - }, - {1856, 1392, 60, 218250, /* VESA */ - 96, 352, 672, KdSyncNegative, /* 86.333 */ - 1, 43, 47, KdSyncPositive, /* 59.995 */ - }, - - /* 1920x1440 modes */ - {1920, 1440, 85, 341750, /* ADDED */ - 160, 352, 760, KdSyncNegative, /* 127.512 */ - 1, 56, 60, KdSyncPositive, /* 85.012 */ - }, - {1920, 1440, 75, 297000, /* VESA */ - 144, 352, 720, KdSyncNegative, /* 112.500 */ - 1, 56, 60, KdSyncPositive, /* 75.000 */ - }, - {1920, 1440, 60, 234000, /* VESA */ - 128, 244, 680, KdSyncNegative, /* 90.000 */ - 1, 56, 60, KdSyncPositive, /* 60.000 */ - }, -}; - -#define NUM_MONITOR_TIMINGS (sizeof kdMonitorTimings/sizeof kdMonitorTimings[0]) - -const int kdNumMonitorTimings = NUM_MONITOR_TIMINGS; - -const KdMonitorTiming * -KdFindMode(KdScreenInfo * screen, - Bool (*supported) (KdScreenInfo *, const KdMonitorTiming *)) -{ - int i; - const KdMonitorTiming *t; - - for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++) { - if ((*supported) (screen, t) && - t->horizontal == screen->width && - t->vertical == screen->height && - (!screen->rate || t->rate <= screen->rate)) { - return t; - } - } - ErrorF("Warning: mode not found, using default\n"); - return &kdMonitorTimings[MONITOR_TIMING_DEFAULT]; -} - -static const KdMonitorTiming * -kdFindPrevSize(const KdMonitorTiming * old) -{ - const KdMonitorTiming *new, *prev; - - if (old == kdMonitorTimings) - return 0; - new = old; - /* - * Search for the previous size - */ - while (new != kdMonitorTimings) { - new--; - if (new->horizontal != old->horizontal && - new->vertical != old->vertical) { - break; - } - } - /* - * Match the refresh rate (<=) - */ - while (new != kdMonitorTimings) { - prev = new - 1; - if (prev->horizontal == new->horizontal && - prev->vertical == new->vertical && prev->rate > old->rate) { - break; - } - new--; - } - return new; -} - -Bool -KdTuneMode(KdScreenInfo * screen, - Bool (*usable) (KdScreenInfo *), - Bool (*supported) (KdScreenInfo *, const KdMonitorTiming *)) -{ - const KdMonitorTiming *t; - - while (!(*usable) (screen)) { - /* - * Fix requested depth and geometry until it works - */ - if (screen->fb.depth > 16) - screen->fb.depth = 16; - else if (screen->fb.depth > 8) - screen->fb.depth = 8; - else { - t = kdFindPrevSize(KdFindMode(screen, supported)); - if (!t) - return FALSE; - screen->width = t->horizontal; - screen->height = t->vertical; - screen->rate = t->rate; - } - } - return TRUE; -} - -#ifdef RANDR -Bool -KdRandRGetInfo(ScreenPtr pScreen, - int randr, - Bool (*supported) (ScreenPtr pScreen, const KdMonitorTiming *)) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - int i; - const KdMonitorTiming *t; - - for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++) { - if ((*supported) (pScreen, t)) { - RRScreenSizePtr pSize; - - pSize = RRRegisterSize(pScreen, - t->horizontal, - t->vertical, - screen->width_mm, screen->height_mm); - if (!pSize) - return FALSE; - if (!RRRegisterRate(pScreen, pSize, t->rate)) - return FALSE; - if (t->horizontal == screen->width && - t->vertical == screen->height && t->rate == screen->rate) - RRSetCurrentConfig(pScreen, randr, t->rate, pSize); - } - } - - return TRUE; -} - -const KdMonitorTiming * -KdRandRGetTiming(ScreenPtr pScreen, - Bool (*supported) (ScreenPtr pScreen, - const KdMonitorTiming *), - int rate, RRScreenSizePtr pSize) -{ - int i; - const KdMonitorTiming *t; - - for (i = 0, t = kdMonitorTimings; i < NUM_MONITOR_TIMINGS; i++, t++) { - if (t->horizontal == pSize->width && - t->vertical == pSize->height && - t->rate == rate && (*supported) (pScreen, t)) - return t; - } - return 0; -} -#endif diff --git a/xserver/hw/kdrive/src/kshadow.c b/xserver/hw/kdrive/src/kshadow.c index 7f1e2ee19..0cc8a1309 100644 --- a/xserver/hw/kdrive/src/kshadow.c +++ b/xserver/hw/kdrive/src/kshadow.c @@ -20,8 +20,8 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> #endif #include "kdrive.h" diff --git a/xserver/hw/kdrive/src/kxv.c b/xserver/hw/kdrive/src/kxv.c index 844deca0d..711f4d80d 100644 --- a/xserver/hw/kdrive/src/kxv.c +++ b/xserver/hw/kdrive/src/kxv.c @@ -35,8 +35,8 @@ of the copyright holder. */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> #endif #include "kdrive.h" @@ -110,18 +110,6 @@ static unsigned long PortResource = 0; #define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \ dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey)) -KdVideoAdaptorPtr -KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen) -{ - return calloc(1, sizeof(KdVideoAdaptorRec)); -} - -void -KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr) -{ - free(ptr); -} - Bool KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num) { @@ -720,27 +708,6 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) } static int -KdXVReputAllVideo(WindowPtr pWin, void *data) -{ - KdXVWindowPtr WinPriv; - - if (pWin->drawable.type != DRAWABLE_WINDOW) - return WT_DONTWALKCHILDREN; - - WinPriv = GET_KDXV_WINDOW(pWin); - - while (WinPriv) { - if (WinPriv->PortRec->type == XvInputMask) - KdXVReputVideo(WinPriv->PortRec); - else - KdXVRegetVideo(WinPriv->PortRec); - WinPriv = WinPriv->next; - } - - return WT_WALKCHILDREN; -} - -static int KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) { KdXVWindowPtr winPriv, PrivRoot; @@ -970,61 +937,6 @@ KdXVCloseScreen(ScreenPtr pScreen) return pScreen->CloseScreen(pScreen); } -static Bool -KdXVRunning(ScreenPtr pScreen) -{ - return (KdXVGeneration == serverGeneration && GET_XV_SCREEN(pScreen) != 0); -} - -Bool -KdXVEnable(ScreenPtr pScreen) -{ - if (!KdXVRunning(pScreen)) - return TRUE; - - WalkTree(pScreen, KdXVReputAllVideo, 0); - - return TRUE; -} - -void -KdXVDisable(ScreenPtr pScreen) -{ - XvScreenPtr pxvs; - XvAdaptorPtr pAdaptor; - XvPortPtr pPort; - XvPortRecPrivatePtr pPriv; - int i, j; - - if (!KdXVRunning(pScreen)) - return; - - pxvs = GET_XV_SCREEN(pScreen); - - for (i = 0; i < pxvs->nAdaptors; i++) { - pAdaptor = &pxvs->pAdaptors[i]; - for (j = 0; j < pAdaptor->nPorts; j++) { - pPort = &pAdaptor->pPorts[j]; - pPriv = (XvPortRecPrivatePtr) pPort->devPriv.ptr; - if (pPriv->isOn > XV_OFF) { - - (*pPriv->AdaptorRec->StopVideo) (pPriv->screen, - pPriv->DevPriv.ptr, TRUE); - pPriv->isOn = XV_OFF; - - if (pPriv->pCompositeClip && pPriv->FreeCompositeClip) - RegionDestroy(pPriv->pCompositeClip); - - pPriv->pCompositeClip = NULL; - - if (!pPriv->type && pPriv->pDraw) { /* still */ - KdXVRemovePortFromWindow((WindowPtr) pPriv->pDraw, pPriv); - } - } - } - } -} - /**** XvAdaptorRec fields ****/ static int @@ -1459,147 +1371,3 @@ KdXVQueryImageAttributes(XvPortPtr pPort, height, pitches, offsets); } - -/**************** Common video manipulation functions *******************/ - -void -KdXVCopyPackedData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, - int srcPitch, int dstPitch, int srcW, int srcH, int top, - int left, int h, int w) -{ - int srcDown = srcPitch, srcRight = 2, srcNext; - int p; - - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - srcDown = srcPitch; - srcRight = 2; - break; - case RR_Rotate_90: - src += (srcH - 1) * 2; - srcDown = -2; - srcRight = srcPitch; - break; - case RR_Rotate_180: - src += srcPitch * (srcH - 1) + (srcW - 1) * 2; - srcDown = -srcPitch; - srcRight = -2; - break; - case RR_Rotate_270: - src += srcPitch * (srcW - 1); - srcDown = 2; - srcRight = -srcPitch; - break; - } - - src = src + top * srcDown + left * srcRight; - - w >>= 1; - /* srcRight >>= 1; */ - srcNext = srcRight >> 1; - while (h--) { - CARD16 *s = (CARD16 *) src; - CARD32 *d = (CARD32 *) dst; - - p = w; - while (p--) { - *d++ = s[0] | (s[srcNext] << 16); - s += srcRight; - } - src += srcPitch; - dst += dstPitch; - } -} - -void -KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, - int srcPitch, int srcPitch2, int dstPitch, int srcW, - int srcH, int height, int top, int left, int h, int w, - int id) -{ - int i, j; - CARD8 *src1, *src2, *src3, *dst1; - int srcDown = srcPitch, srcDown2 = srcPitch2; - int srcRight = 2, srcRight2 = 1, srcNext = 1; - - /* compute source data pointers */ - src1 = src; - src2 = src1 + height * srcPitch; - src3 = src2 + (height >> 1) * srcPitch2; - switch (randr & RR_Rotate_All) { - case RR_Rotate_0: - srcDown = srcPitch; - srcDown2 = srcPitch2; - srcRight = 2; - srcRight2 = 1; - srcNext = 1; - break; - case RR_Rotate_90: - src1 = src1 + srcH - 1; - src2 = src2 + (srcH >> 1) - 1; - src3 = src3 + (srcH >> 1) - 1; - srcDown = -1; - srcDown2 = -1; - srcRight = srcPitch * 2; - srcRight2 = srcPitch2; - srcNext = srcPitch; - break; - case RR_Rotate_180: - src1 = src1 + srcPitch * (srcH - 1) + (srcW - 1); - src2 = src2 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcH >> 1) - 1) + ((srcW >> 1) - 1); - srcDown = -srcPitch; - srcDown2 = -srcPitch2; - srcRight = -2; - srcRight2 = -1; - srcNext = -1; - break; - case RR_Rotate_270: - src1 = src1 + srcPitch * (srcW - 1); - src2 = src2 + srcPitch2 * ((srcW >> 1) - 1); - src3 = src3 + srcPitch2 * ((srcW >> 1) - 1); - srcDown = 1; - srcDown2 = 1; - srcRight = -srcPitch * 2; - srcRight2 = -srcPitch2; - srcNext = -srcPitch; - break; - } - - /* adjust for origin */ - src1 += top * srcDown + left * srcNext; - src2 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - src3 += (top >> 1) * srcDown2 + (left >> 1) * srcRight2; - - if (id == FOURCC_I420) { - CARD8 *srct = src2; - - src2 = src3; - src3 = srct; - } - - dst1 = dst; - - w >>= 1; - for (j = 0; j < h; j++) { - CARD32 *dst32 = (CARD32 *) dst1; - CARD8 *s1l = src1; - CARD8 *s1r = src1 + srcNext; - CARD8 *s2 = src2; - CARD8 *s3 = src3; - - for (i = 0; i < w; i++) { - *dst32++ = *s1l | (*s1r << 16) | (*s3 << 8) | (*s2 << 24); - s1l += srcRight; - s1r += srcRight; - s2 += srcRight2; - s3 += srcRight2; - } - src1 += srcDown; - dst1 += dstPitch; - if (j & 1) { - src2 += srcDown2; - src3 += srcDown2; - } - } -} diff --git a/xserver/hw/kdrive/src/kxv.h b/xserver/hw/kdrive/src/kxv.h index b99729922..a264dcab2 100644 --- a/xserver/hw/kdrive/src/kxv.h +++ b/xserver/hw/kdrive/src/kxv.h @@ -148,27 +148,6 @@ typedef struct { Bool KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr Adaptors, int num); -void - -KdXVCopyPackedData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, - int srcPitch, int dstPitch, int srcW, int srcH, int top, - int left, int h, int w); - -void - -KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, - int srcPitch, int srcPitch2, int dstPitch, int srcW, - int srcH, int height, int top, int left, int h, int w, - int id); - -KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen); - -void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr); - -/* Must be called from KdCardInfo functions, can be called without Xv enabled */ -Bool KdXVEnable(ScreenPtr); -void KdXVDisable(ScreenPtr); - /*** These are DDX layer privates ***/ typedef struct { |