[pkg-fso-commits] [SCM] xf86-video-glamo, SMedia Glamo video driver for X.Org branch, master, updated. upstream/0.0.0+20090224.git703acea1-15-g25c4b0e

Lars-Peter Clausen lars at metafoo.de
Mon May 18 16:46:37 UTC 2009


The following commit has been merged in the master branch:
commit 99b38c284e91efc45f9bc4c087e462abe98ae0a4
Author: Lars-Peter Clausen <lars at metafoo.de>
Date:   Wed Feb 25 00:52:05 2009 +0100

    Make the path to the sysfs state file for the jbt6k47 display driver
    configurable. It can either be set at configure time with
    --with-jbt6k47-state-path=PATH. Or at runtime in the xorg.conf device section.
    The option name is StatePath.

diff --git a/config.h.in b/config.h.in
index 72ca535..01e0d5a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -32,6 +32,12 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Set jbt6k74 state when changing resolution */
+#undef JBT6K74_SET_STATE
+
+/* Path to the jbt6k74 sysfs state path */
+#undef JBT6K74_STATE_PATH
+
 /* Name of package */
 #undef PACKAGE
 
diff --git a/configure.ac b/configure.ac
index 7720337..f3b1712 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,6 +50,17 @@ AC_ARG_ENABLE(pciaccess,     AS_HELP_STRING([--enable-pciaccess],
                              [Enable use of libpciaccess (default: disabled)]),
 			     [PCIACCESS=$enableval], [PCIACCESS=no])
 
+AC_ARG_ENABLE(jbt6k74-set-state, AS_HELP_STRING([--disable-jbt6k74-set-state],
+                                 [Whether the driver should set the jbt6k74
+                                 state when changing resolution  (default:
+                                 enabled)]),
+             [JBT6K74_SET_STATE=$enableval], [JBT6K74_SET_STATE=yes])
+
+AC_ARG_WITH(jbt6k74-state-path, AS_HELP_STRING([--with-jbt6k74-state-path=PATH],
+                                               [Path to the jbt6k74 sysfs state file [[default=/sys/bus/spi/devices/spi2.0/state]]]),
+           [JBT6K74_STATE_PATH="$withval"],
+           [JBT6K74_STATE_PATH="/sys/bus/spi/devices/spi2.0/state"])
+
 # Checks for extensions
 XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
@@ -66,6 +77,11 @@ if test "x$PCIACCESS" = xyes; then
     XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
 fi
 
+if test "x$JBT6K74_SET_STATE" = xyes; then
+    AC_DEFINE(JBT6K74_SET_STATE, 1, [Set jbt6k74 state when changing resolution])
+    AC_DEFINE_UNQUOTED(JBT6K74_STATE_PATH, "$JBT6K74_STATE_PATH", [Path to the jbt6k74 sysfs state path])
+fi
+
 # Checks for libraries.
 
 # Checks for header files.
diff --git a/src/glamo-driver.c b/src/glamo-driver.c
index 2c8735f..babf57d 100644
--- a/src/glamo-driver.c
+++ b/src/glamo-driver.c
@@ -128,11 +128,17 @@ typedef enum {
 	OPTION_SHADOW_FB,
     OPTION_DEVICE,
 	OPTION_DEBUG,
+#ifdef JBT6K74_SET_STATE
+    OPTION_JBT6K74_STATE_PATH
+#endif
 } GlamoOpts;
 
 static const OptionInfoRec GlamoOptions[] = {
 	{ OPTION_SHADOW_FB,	"ShadowFB",	OPTV_BOOLEAN,	{0},	FALSE },
 	{ OPTION_DEBUG,		"debug",	OPTV_BOOLEAN,	{0},	FALSE },
+#ifdef JBT6K74_SET_STATE
+	{ OPTION_JBT6K74_STATE_PATH, "StatePath", OPTV_STRING, {0}, FALSE },
+#endif
 	{ -1,			NULL,		OPTV_NONE,	{0},	FALSE }
 };
 
@@ -483,6 +489,13 @@ GlamoPreInit(ScrnInfoPtr pScrn, int flags)
 
     debug = xf86ReturnOptValBool(pGlamo->Options, OPTION_DEBUG, FALSE);
 
+#ifdef JBT6K74_SET_STATE
+    pGlamo->jbt6k74_state_path = xf86GetOptValString(pGlamo->Options,
+                                                     OPTION_JBT6K74_STATE_PATH);
+    if (pGlamo->jbt6k74_state_path == NULL)
+        pGlamo->jbt6k74_state_path = JBT6K74_STATE_PATH;
+#endif
+
     /* First approximation, may be refined in ScreenInit */
     pScrn->displayWidth = pScrn->virtualX;
 
@@ -724,6 +737,19 @@ static void
 GlamoSaveHW(ScrnInfoPtr pScrn) {
     GlamoPtr pGlamo = GlamoPTR(pScrn);
     volatile char *mmio = pGlamo->reg_base;
+#if JBT6K74_SET_STATE
+    int fd;
+
+    fd = open(pGlamo->jbt6k74_state_path, O_RDONLY);
+    if (fd != -1) {
+       read(fd, pGlamo->saved_jbt6k74_state, 14);
+        close(fd);
+    } else {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "Couldn't open \"%s\" to save display resolution: %s\n",
+                   pGlamo->jbt6k74_state_path, strerror(errno));
+    }
+#endif
 
     pGlamo->saved_clock_2d = MMIO_IN16(mmio, GLAMO_REG_CLOCK_2D);
     pGlamo->saved_clock_isp = MMIO_IN16(mmio, GLAMO_REG_CLOCK_ISP);
@@ -736,13 +762,15 @@ GlamoSaveHW(ScrnInfoPtr pScrn) {
                    "Framebuffer ioctl FBIOGET_FSCREENINFO failed: %s",
                    strerror(errno));
     }
-
 }
 
 static void
 GlamoRestoreHW(ScrnInfoPtr pScrn) {
     GlamoPtr pGlamo = GlamoPTR(pScrn);
     volatile char *mmio = pGlamo->reg_base;
+#ifdef JBT6K74_SET_STATE
+    int fd;
+#endif
 
     if (ioctl(pGlamo->fb_fd, FBIOPUT_VSCREENINFO, (void*)(&pGlamo->fb_saved_var)) == -1) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -755,6 +783,18 @@ GlamoRestoreHW(ScrnInfoPtr pScrn) {
     MMIO_OUT16(mmio, GLAMO_REG_CLOCK_GEN5_1, pGlamo->saved_clock_gen5_1);
     MMIO_OUT16(mmio, GLAMO_REG_CLOCK_GEN5_2, pGlamo->saved_clock_gen5_2);
     MMIO_OUT16(mmio, GLAMO_REG_HOSTBUS(2), pGlamo->saved_hostbus_2);
+
+#ifdef JBT6K74_SET_STATE
+    fd = open(pGlamo->jbt6k74_state_path, O_WRONLY);
+    if (fd != -1) {
+        write(fd, pGlamo->saved_jbt6k74_state, 14);
+        close(fd);
+    } else {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "Couldn't open \"%s\" to restore display resolution: %s\n",
+                   pGlamo->jbt6k74_state_path, strerror(errno));
+    }
+#endif
 }
 
 static Bool
@@ -773,7 +813,6 @@ GlamoEnterVT(int scrnIndex, int flags) {
     return TRUE;
 }
 
-
 static void
 GlamoLeaveVT(int scrnIndex, int flags) {
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
@@ -784,3 +823,4 @@ GlamoLeaveVT(int scrnIndex, int flags) {
 
     GlamoRestoreHW(pScrn);
 }
+
diff --git a/src/glamo-output.c b/src/glamo-output.c
index 57ce7c2..60ea902 100644
--- a/src/glamo-output.c
+++ b/src/glamo-output.c
@@ -39,9 +39,10 @@
 
 #include "glamo.h"
 
-static const char *display_state_switch_path = "/sys/bus/spi/devices/spi2.0/state";
-static const char *display_state_vga = "normal";
-static const char *display_state_qvga = "qvga-normal";
+#ifdef JBT6K74_SET_STATE
+static const char jbt6k74_state_vga[] = "normal";
+static const char jbt6k74_state_qvga[] = "qvga-normal";
+#endif
 
 typedef struct _GlamoOutput {
    DisplayModePtr modes;
@@ -241,18 +242,21 @@ GlamoOutputModeSet(xf86OutputPtr output, DisplayModePtr mode,
 
 static void
 GlamoOutputCommit(xf86OutputPtr output) {
-    int fd = open(display_state_switch_path, O_WRONLY);
+#ifdef JBT6K74_SET_STATE
+    GlamoPtr pGlamo = GlamoPTR(output->scrn);
+    int fd = open(pGlamo->jbt6k74_state_path, O_WRONLY);
     if (fd != -1) {
         if(output->crtc->mode.HDisplay == 240 && output->crtc->mode.VDisplay == 320)
-            write(fd, display_state_qvga, strlen(display_state_qvga));
+            write(fd, jbt6k74_state_qvga, sizeof(jbt6k74_state_qvga));
         else
-            write(fd, display_state_vga, strlen(display_state_vga));
+            write(fd, jbt6k74_state_vga, sizeof(jbt6k74_state_vga));
         close(fd);
     } else {
         xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
-                   "Couldn't open %s to change display resolution: %s\n",
-                   display_state_switch_path, strerror(errno));
+                   "Couldn't open \"%s\" to change display resolution: %s\n",
+                   pGlamo->jbt6k74_state_path, strerror(errno));
     }
+#endif
 }
 
 static void GlamoOutputDestroy(xf86OutputPtr output) {
diff --git a/src/glamo.h b/src/glamo.h
index 84cba3d..2cb3da0 100644
--- a/src/glamo.h
+++ b/src/glamo.h
@@ -125,7 +125,12 @@ typedef struct {
     short saved_clock_gen5_2;
     short saved_hostbus_2;
 
-    /* Use hardware acceleration */
+#ifdef JBT6K74_SET_STATE
+    char *jbt6k74_state_path;
+    char saved_jbt6k74_state[14];
+#endif
+
+/* Use hardware acceleration */
     Bool accel;
 } GlamoRec, *GlamoPtr;
 

-- 
xf86-video-glamo, SMedia Glamo video driver for X.Org



More information about the pkg-fso-commits mailing list