Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[xsrc/trunk]: xsrc/external/mit/xorg-server/dist/hw/xfree86 Restore -flipPixe...



details:   https://anonhg.NetBSD.org/xsrc/rev/59f896060ab6
branches:  trunk
changeset: 7120:59f896060ab6
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jul 30 16:13:53 2022 +0000

description:
Restore -flipPixels option removed in upstream server-21.1-branch.

https://gitlab.freedesktop.org/xorg/xserver/-/commit/d1c00c859c6676fbb540420c9055788bc19cb18f
Note ScrnInfoRec structure in hw/xfree86/common/xf86str.h isn't reverted
because it isn't used by -flipPixels option so that we can keep ABI
compatibility among xf86-video-foo drivers.

This -flipPixels is mandatory at least by Xorg server users with
xf86-video-wsfb driver on NetBSD/mac68k and SE/30 mono screen
that has "black=1 and white=0" VRAM.

"go for it" by mrg@ on current-users@:
https://mail-index.netbsd.org/current-users/2022/07/24/msg042731.html

diffstat:

 external/mit/xorg-server/dist/hw/xfree86/common/xf86.h        |  10 ++++
 external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c |   1 +
 external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c  |  16 ++++++-
 external/mit/xorg-server/dist/hw/xfree86/common/xf86Init.c    |   5 ++
 external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h    |   1 +
 external/mit/xorg-server/dist/hw/xfree86/doc/ddxDesign.xml    |  25 +++++++++++
 external/mit/xorg-server/dist/hw/xfree86/man/Xorg.man         |   3 +
 external/mit/xorg-server/dist/hw/xfree86/vgahw/vgaHW.c        |   4 +-
 8 files changed, 62 insertions(+), 3 deletions(-)

diffs (181 lines):

diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/common/xf86.h
--- a/external/mit/xorg-server/dist/hw/xfree86/common/xf86.h    Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/common/xf86.h    Sat Jul 30 16:13:53 2022 +0000
@@ -79,6 +79,14 @@
 
 #define XF86SCRNINFO(p) xf86ScreenToScrn(p)
 
+#define XF86FLIP_PIXELS() \
+       do { \
+           if (xf86GetFlipPixels()) { \
+               pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \
+               pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \
+          } \
+       while (0)
+
 #define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE")
 
 /* Compatibility functions for pre-input-thread drivers */
@@ -278,6 +286,8 @@
 extern _X_EXPORT Gamma
 xf86GetGamma(void);
 extern _X_EXPORT Bool
+xf86GetFlipPixels(void);
+extern _X_EXPORT Bool
 xf86ServerIsExiting(void);
 extern _X_EXPORT Bool
 xf86ServerIsResetting(void);
diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c
--- a/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c     Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/common/xf86Globals.c     Sat Jul 30 16:13:53 2022 +0000
@@ -188,6 +188,7 @@
 int xf86Depth = -1;
 rgb xf86Weight = { 0, 0, 0 };
 
+Bool xf86FlipPixels = FALSE;
 Gamma xf86Gamma = { 0.0, 0.0, 0.0 };
 
 Bool xf86AllowMouseOpenFail = FALSE;
diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c
--- a/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c      Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/common/xf86Helper.c      Sat Jul 30 16:13:53 2022 +0000
@@ -952,8 +952,14 @@
 void
 xf86SetBlackWhitePixels(ScreenPtr pScreen)
 {
-    pScreen->whitePixel = 1;
-    pScreen->blackPixel = 0;
+    if (xf86FlipPixels) {
+        pScreen->whitePixel = 0;
+        pScreen->blackPixel = 1;
+    }
+    else {
+        pScreen->whitePixel = 1;
+        pScreen->blackPixel = 0;
+    }
 }
 
 /*
@@ -1405,6 +1411,12 @@
 }
 
 Bool
+xf86GetFlipPixels(void)
+{
+    return xf86FlipPixels;
+}
+
+Bool
 xf86ServerIsExiting(void)
 {
     return (dispatchException & DE_TERMINATE) == DE_TERMINATE;
diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/common/xf86Init.c
--- a/external/mit/xorg-server/dist/hw/xfree86/common/xf86Init.c        Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/common/xf86Init.c        Sat Jul 30 16:13:53 2022 +0000
@@ -954,6 +954,10 @@
         xf86ConfigDir = argv[i + 1];
         return 2;
     }
+    if (!strcmp(argv[i], "-flipPixels")) {
+        xf86FlipPixels = TRUE;
+        return 1;
+    }
 #ifdef XF86VIDMODE
     if (!strcmp(argv[i], "-disableVidMode")) {
         xf86VidModeDisabled = TRUE;
@@ -1233,6 +1237,7 @@
     ErrorF
         ("-pointer name          specify the core pointer InputDevice name\n");
     ErrorF("-nosilk                disable Silken Mouse\n");
+    ErrorF("-flipPixels            swap default black/white Pixel values\n");
 #ifdef XF86VIDMODE
     ErrorF("-disableVidMode        disable mode adjustments with xvidtune\n");
     ErrorF
diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h
--- a/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h        Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/common/xf86Priv.h        Sat Jul 30 16:13:53 2022 +0000
@@ -69,6 +69,7 @@
 extern _X_EXPORT int xf86FbBpp;
 extern _X_EXPORT int xf86Depth;
 extern _X_EXPORT rgb xf86Weight;
+extern _X_EXPORT Bool xf86FlipPixels;
 extern _X_EXPORT Gamma xf86Gamma;
 
 /* Other parameters */
diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/doc/ddxDesign.xml
--- a/external/mit/xorg-server/dist/hw/xfree86/doc/ddxDesign.xml        Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/doc/ddxDesign.xml        Sat Jul 30 16:13:53 2022 +0000
@@ -1833,6 +1833,7 @@
     xf86Depth                 -depth from the command line
     xf86Weight                -weight from the command line
     xf86Gamma                 -{r,g,b,}gamma from the command line
+    xf86FlipPixels            -flippixels from the command line
     xf86ProbeOnly             -probeonly from the command line
     defaultColorVisualClass   -cc from the command line
        </literallayout>
@@ -1893,6 +1894,17 @@
 
        </para></blockquote>
 
+      <blockquote><para>
+         <programlisting>
+    Bool xf86GetFlipPixels();
+         </programlisting>
+         <blockquote><para>
+      Returns <constant>TRUE</constant> if <option>-flippixels</option> is
+      present on the command line, and <constant>FALSE</constant> otherwise.
+           </para></blockquote>
+
+       </para></blockquote>
+
     </sect2>
 
     <sect2>
@@ -6004,6 +6016,19 @@
 
       <blockquote><para>
          <programlisting>
+    void xf86SetBlackWhitePixels(ScrnInfoPtr pScrn);
+         </programlisting>
+         <blockquote><para>
+      This functions sets the <structfield>blackPixel</structfield> and
+      <structfield>whitePixel</structfield> fields of the <structname>ScrnInfoRec</structname>
+      according to whether or not the <option>-flipPixels</option> command
+      line options is present.
+           </para>
+
+         </blockquote></para></blockquote>
+
+      <blockquote><para>
+         <programlisting>
     const char *xf86GetVisualName(int visual);
          </programlisting>
          <blockquote><para>
diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/man/Xorg.man
--- a/external/mit/xorg-server/dist/hw/xfree86/man/Xorg.man     Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/man/Xorg.man     Sat Jul 30 16:13:53 2022 +0000
@@ -171,6 +171,9 @@
 (or vice versa).  Legal values are 1, 8, 16, 24, 32.  Not all drivers
 support all values.
 .TP 8
+.B \-flipPixels
+Swap the default values for the black and white pixels.
+.TP 8
 .BI \-gamma " value"
 Set the gamma correction.
 .I value
diff -r 5792d730a31c -r 59f896060ab6 external/mit/xorg-server/dist/hw/xfree86/vgahw/vgaHW.c
--- a/external/mit/xorg-server/dist/hw/xfree86/vgahw/vgaHW.c    Thu Jul 28 06:32:35 2022 +0000
+++ b/external/mit/xorg-server/dist/hw/xfree86/vgahw/vgaHW.c    Sat Jul 30 16:13:53 2022 +0000
@@ -1314,8 +1314,10 @@
     if (depth == 1) {
         /* Initialise the Mono map according to which bit-plane gets used */
 
+        Bool flipPixels = xf86GetFlipPixels();
+
         for (i = 0; i < 16; i++)
-            if ((i & (1 << BIT_PLANE)) != 0)
+            if (((i & (1 << BIT_PLANE)) != 0) != flipPixels)
                 regp->Attribute[i] = WHITE_VALUE;
             else
                 regp->Attribute[i] = BLACK_VALUE;



Home | Main Index | Thread Index | Old Index