summaryrefslogtreecommitdiff
path: root/packages/xorg-xserver/xserver-kdrive
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2007-08-02 07:15:30 +0000
committerKoen Kooi <koen@openembedded.org>2007-08-02 07:15:30 +0000
commitb3e110eff605bd2361ea92bd748f59e48d508f33 (patch)
tree585a741d28885236452581e718ba458c6fd02c3d /packages/xorg-xserver/xserver-kdrive
parent81ded5cd087778af9e1a13e7a207b55b5448e07b (diff)
xorg mega commit: merge in change from poky
Diffstat (limited to 'packages/xorg-xserver/xserver-kdrive')
-rw-r--r--packages/xorg-xserver/xserver-kdrive/devfs.patch47
-rw-r--r--packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch307
-rw-r--r--packages/xorg-xserver/xserver-kdrive/xfbdev-fb-opt.patch82
3 files changed, 436 insertions, 0 deletions
diff --git a/packages/xorg-xserver/xserver-kdrive/devfs.patch b/packages/xorg-xserver/xserver-kdrive/devfs.patch
new file mode 100644
index 0000000000..a6238126c0
--- /dev/null
+++ b/packages/xorg-xserver/xserver-kdrive/devfs.patch
@@ -0,0 +1,47 @@
+
+#
+# Patch managed by http://www.holgerschurig.de/patcher.html
+#
+
+--- xserver/hw/kdrive/linux/linux.c~devfs
++++ xserver/hw/kdrive/linux/linux.c
+@@ -82,10 +82,10 @@
+ vtno = kdVirtualTerminal;
+ else
+ {
+- if ((fd = open("/dev/tty0",O_WRONLY,0)) < 0)
++ if ((fd = open("/dev/vc/0",O_WRONLY,0)) < 0)
+ {
+ FatalError(
+- "LinuxInit: Cannot open /dev/tty0 (%s)\n",
++ "LinuxInit: Cannot open /dev/tty/0 (%s)\n",
+ strerror(errno));
+ }
+ if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) ||
+@@ -96,7 +96,7 @@
+ }
+ close(fd);
+
+- sprintf(vtname,"/dev/tty%d",vtno); /* /dev/tty1-64 */
++ sprintf(vtname,"/dev/vc/%d",vtno); /* /dev/tty1-64 */
+
+ if ((LinuxConsoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0)
+ {
+@@ -113,7 +113,7 @@
+ *
+ * Why is this needed?
+ */
+- LinuxCheckChown ("/dev/tty0");
++ LinuxCheckChown ("/dev/vc/0");
+ /*
+ * Linux doesn't switch to an active vt after the last close of a vt,
+ * so we do this ourselves by remembering which is active now.
+@@ -453,7 +453,7 @@
+ activeVT = -1;
+ }
+ close(LinuxConsoleFd); /* make the vt-manager happy */
+- fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
++ fd = open ("/dev/vc/0", O_RDWR|O_NDELAY, 0);
+ if (fd >= 0)
+ {
+ memset (&vts, '\0', sizeof (vts)); /* valgrind */
diff --git a/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch b/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch
new file mode 100644
index 0000000000..c160cd41dc
--- /dev/null
+++ b/packages/xorg-xserver/xserver-kdrive/hide-cursor-and-ppm-root.patch
@@ -0,0 +1,307 @@
+diff -u -r xorg-server-X11R7.1-1.1.0.orig/dix/window.c xorg-server-X11R7.1-1.1.0/dix/window.c
+--- xorg-server-X11R7.1-1.1.0.orig/dix/window.c 2007-01-08 14:30:38.000000000 +0000
++++ xorg-server-X11R7.1-1.1.0/dix/window.c 2007-01-16 17:16:19.000000000 +0000
+@@ -185,6 +185,8 @@
+ _X_EXPORT int numSaveUndersViewable = 0;
+ _X_EXPORT int deltaSaveUndersViewable = 0;
+
++char* RootPPM = NULL;
++
+ #ifdef DEBUG
+ /******
+ * PrintWindowTree
+@@ -311,6 +313,115 @@
+ #endif
+ }
+
++static int
++get_int(FILE *fp)
++{
++ int c = 0;
++
++ while ((c = getc(fp)) != EOF)
++ {
++ if (isspace(c))
++ continue;
++
++ if (c == '#')
++ while (c = getc(fp))
++ if (c == EOF)
++ return 0;
++ else if (c == '\n')
++ break;
++
++ if (isdigit(c))
++ {
++ int val = c - '0';
++ while ((c = getc(fp)) && isdigit(c))
++ val = (val * 10) + (c - '0');
++ return val;
++ }
++ }
++
++ return 0;
++}
++
++static unsigned char*
++ppm_load (const char* path, int depth, int *width, int *height)
++{
++ FILE *fp;
++ int max, n = 0, w, h, i, j, bytes_per_line;
++ unsigned char *data, *res, h1, h2;
++
++ if (depth < 16 || depth > 32)
++ return NULL;
++
++ if (depth > 16)
++ depth = 32;
++
++ fp = fopen (path, "r");
++ if (fp == NULL)
++ return FALSE;
++
++ h1 = getc(fp);
++ h2 = getc(fp);
++
++ /* magic is 'P6' for raw ppm */
++ if (h1 != 'P' && h2 != '6')
++ goto fail;
++
++ w = get_int(fp);
++ h = get_int(fp);
++
++ if (w == 0 || h == 0)
++ goto fail;
++
++ max = get_int(fp);
++
++ if (max != 255)
++ goto fail;
++
++ bytes_per_line = ((w * depth + 31) >> 5) << 2;
++
++ res = data = malloc(bytes_per_line * h);
++
++ for (i=0; i<h; i++)
++ {
++ for (j=0; j<w; j++)
++ {
++ unsigned char buf[3];
++ fread(buf, 1, 3, fp);
++
++ switch (depth)
++ {
++ case 24:
++ case 32:
++ *data = buf[2];
++ *(data+1) = buf[1];
++ *(data+2) = buf[0];
++ data += 4;
++ break;
++ case 16:
++ default:
++ *(unsigned short*)data
++ = ((buf[0] >> 3) << 11) | ((buf[1] >> 2) << 5) | (buf[2] >> 3);
++ data += 2;
++ break;
++ }
++ }
++ data += (bytes_per_line - (w*(depth>>3)));
++ }
++
++ data = res;
++
++ *width = w;
++ *height = h;
++
++ fclose(fp);
++
++ return res;
++
++ fail:
++ fclose(fp);
++ return NULL;
++}
++
+ static void
+ MakeRootTile(WindowPtr pWin)
+ {
+@@ -321,6 +432,36 @@
+ register unsigned char *from, *to;
+ register int i, j;
+
++ if (RootPPM != NULL)
++ {
++ int w, h;
++ unsigned char *data;
++
++ if ((data = ppm_load (RootPPM, pScreen->rootDepth, &w, &h)) != NULL)
++ {
++ pWin->background.pixmap
++ = (*pScreen->CreatePixmap)(pScreen, w, h, pScreen->rootDepth);
++
++ pWin->backgroundState = BackgroundPixmap;
++ pGC = GetScratchGC(pScreen->rootDepth, pScreen);
++ if (!pWin->background.pixmap || !pGC)
++ FatalError("could not create root tile");
++
++ ValidateGC((DrawablePtr)pWin->background.pixmap, pGC);
++
++ (*pGC->ops->PutImage)((DrawablePtr)pWin->background.pixmap,
++ pGC,
++ pScreen->rootDepth,
++ 0, 0, w, h, 0, ZPixmap, (char *)data);
++ FreeScratchGC(pGC);
++
++ free(data);
++ return;
++ }
++ else
++ ErrorF("Unable to load root window image.");
++ }
++
+ pWin->background.pixmap = (*pScreen->CreatePixmap)(pScreen, 4, 4,
+ pScreen->rootDepth);
+
+@@ -357,6 +498,7 @@
+
+ }
+
++
+ WindowPtr
+ AllocateWindow(ScreenPtr pScreen)
+ {
+diff -u -r xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/src/kdrive.c xorg-server-X11R7.1-1.1.0/hw/kdrive/src/kdrive.c
+--- xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/src/kdrive.c 2007-01-08 14:30:38.000000000 +0000
++++ xorg-server-X11R7.1-1.1.0/hw/kdrive/src/kdrive.c 2007-01-15 17:53:06.000000000 +0000
+@@ -58,6 +58,9 @@
+ { 32, 32 }
+ };
+
++int
++ProcXFixesHideCursor (ClientPtr client) ;
++
+ #define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
+
+ int kdScreenPrivateIndex;
+@@ -84,6 +87,9 @@
+ KdOsFuncs *kdOsFuncs;
+ extern WindowPtr *WindowTable;
+
++extern Bool CursorInitiallyHidden; /* See Xfixes cursor.c */
++extern char* RootPPM; /* dix/window.c */
++
+ void
+ KdSetRootClip (ScreenPtr pScreen, BOOL enable)
+ {
+@@ -312,6 +318,7 @@
+ KdSetRootClip (pScreen, TRUE);
+ if (pScreenPriv->card->cfuncs->dpms)
+ (*pScreenPriv->card->cfuncs->dpms) (pScreen, pScreenPriv->dpmsState);
++
+ return TRUE;
+ }
+
+@@ -686,10 +693,14 @@
+ 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("-hide-cursor Start with cursor hidden\n");
++ ErrorF("-root-ppm [path] Specify ppm file to use as root window background.\n");
+ ErrorF("vtxx Use virtual terminal xx instead of the next available\n");
+ #ifdef PSEUDO8
+ p8UseMsg ();
+ #endif
++
++
+ }
+
+ int
+@@ -761,6 +772,19 @@
+ kdSoftCursor = TRUE;
+ return 1;
+ }
++ if (!strcmp (argv[i], "-hide-cursor"))
++ {
++ CursorInitiallyHidden = TRUE;
++ return 1;
++ }
++ if (!strcmp (argv[i], "-root-ppm"))
++ {
++ if ((i+1) < argc)
++ RootPPM = argv[i+1];
++ else
++ UseMsg ();
++ return 2;
++ }
+ if (!strcmp (argv[i], "-videoTest"))
+ {
+ kdVideoTest = TRUE;
+diff -u -r xorg-server-X11R7.1-1.1.0.orig/xfixes/cursor.c xorg-server-X11R7.1-1.1.0/xfixes/cursor.c
+--- xorg-server-X11R7.1-1.1.0.orig/xfixes/cursor.c 2007-01-08 14:30:38.000000000 +0000
++++ xorg-server-X11R7.1-1.1.0/xfixes/cursor.c 2007-01-11 16:33:00.000000000 +0000
+@@ -59,9 +59,12 @@
+ static RESTYPE CursorWindowType;
+ static int CursorScreenPrivateIndex = -1;
+ static int CursorGeneration;
++static Bool CursorGloballyHidden;
+ static CursorPtr CursorCurrent;
+ static CursorPtr pInvisibleCursor = NULL;
+
++Bool CursorInitiallyHidden = FALSE;
++
+ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen);
+
+ #define VERIFY_CURSOR(pCursor, cursor, client, access) { \
+@@ -130,7 +133,7 @@
+
+ Unwrap (cs, pScreen, DisplayCursor);
+
+- if (cs->pCursorHideCounts != NULL) {
++ if (cs->pCursorHideCounts != NULL || CursorGloballyHidden) {
+ ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor);
+ } else {
+ ret = (*pScreen->DisplayCursor) (pScreen, pCursor);
+@@ -848,6 +851,12 @@
+ return BadWindow;
+ }
+
++ /* Is cursor set to be initially hidden ?, if so reset this
++ * flag as now visibility assumed under control of client.
++ */
++ if (CursorGloballyHidden)
++ CursorGloballyHidden = FALSE;
++
+ /*
+ * Has client hidden the cursor before on this screen?
+ * If so, just increment the count.
+@@ -899,9 +908,19 @@
+ return BadWindow;
+ }
+
++ /* X was started with cursor hidden, therefore just reset our flag
++ * (returning to normal client control) and cause cursor to now be
++ * shown.
++ */
++ if (CursorGloballyHidden == TRUE)
++ {
++ CursorGloballyHidden = FALSE;
++ return (client->noClientException);
++ }
++
+ /*
+ * Has client hidden the cursor on this screen?
+- * If not, generate an error.
++ * If so, generate an error.
+ */
+ pChc = findCursorHideCount(client, pWin->drawable.pScreen);
+ if (pChc == NULL) {
+@@ -1009,6 +1028,8 @@
+ XFixesCursorInit (void)
+ {
+ int i;
++
++ CursorGloballyHidden = CursorInitiallyHidden;
+
+ if (CursorGeneration != serverGeneration)
+ {
diff --git a/packages/xorg-xserver/xserver-kdrive/xfbdev-fb-opt.patch b/packages/xorg-xserver/xserver-kdrive/xfbdev-fb-opt.patch
new file mode 100644
index 0000000000..a8f002ea2a
--- /dev/null
+++ b/packages/xorg-xserver/xserver-kdrive/xfbdev-fb-opt.patch
@@ -0,0 +1,82 @@
+---
+ hw/kdrive/fbdev/fbdev.c | 17 ++++++++++++-----
+ hw/kdrive/fbdev/fbdev.h | 1 +
+ hw/kdrive/fbdev/fbinit.c | 20 ++++++++++++++++----
+ 3 files changed, 29 insertions(+), 9 deletions(-)
+
+--- xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/fbdev/fbdev.c
++++ xorg-server-X11R7.1-1.1.0/hw/kdrive/fbdev/fbdev.c
+@@ -33,16 +33,23 @@
+
+ extern int KdTsPhyScreen;
+
++char *fbdevDevicePath = NULL;
+ Bool
+ fbdevInitialize (KdCardInfo *card, FbdevPriv *priv)
+ {
+ int k;
+ unsigned long off;
+- if ((priv->fd = open("/dev/fb0", O_RDWR)) < 0 && \
+- (priv->fd = open("/dev/fb/0", O_RDWR)) < 0) {
+- perror("Error opening /dev/fb0");
+- return FALSE;
+- }
++
++ if (fbdevDevicePath == NULL)
++ fbdevDevicePath = "/dev/fb0";
++
++ if ((priv->fd = open(fbdevDevicePath, O_RDWR)) < 0)
++ {
++ ErrorF("Error opening framebuffer %s: %s\n",
++ fbdevDevicePath, strerror(errno));
++ return FALSE;
++ }
++
+ /* quiet valgrind */
+ memset (&priv->fix, '\0', sizeof (priv->fix));
+ if ((k=ioctl(priv->fd, FBIOGET_FSCREENINFO, &priv->fix)) < 0) {
+--- xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/fbdev/fbdev.h
++++ xorg-server-X11R7.1-1.1.0/hw/kdrive/fbdev/fbdev.h
+@@ -53,6 +53,7 @@ typedef struct _fbdevScrPriv {
+ } FbdevScrPriv;
+
+ extern KdCardFuncs fbdevFuncs;
++extern char* fbdevDevicePath;
+
+ Bool
+ fbdevInitialize (KdCardInfo *card, FbdevPriv *priv);
+--- xorg-server-X11R7.1-1.1.0.orig/hw/kdrive/fbdev/fbinit.c
++++ xorg-server-X11R7.1-1.1.0/hw/kdrive/fbdev/fbinit.c
+@@ -59,16 +59,28 @@ InitInput (int argc, char **argv)
+ void
+ ddxUseMsg (void)
+ {
+- KdUseMsg();
++ KdUseMsg();
++ ErrorF("\nXfbdev Device Usage:\n");
++ ErrorF("-fb path Framebuffer device to use. Defaults to /dev/fb0\n");
++ ErrorF("\n");
+ }
+
+ int
+ ddxProcessArgument (int argc, char **argv, int i)
+ {
+- return KdProcessArgument (argc, argv, i);
+-}
+-
++ if (!strcmp (argv[i], "-fb"))
++ {
++ if (i+1 < argc)
++ {
++ fbdevDevicePath = argv[i+1];
++ return 2;
++ }
++ UseMsg();
++ exit(1);
++ }
+
++ return KdProcessArgument (argc, argv, i);
++}
+
+ KdCardFuncs fbdevFuncs = {
+ fbdevCardInit, /* cardinit */