Source-Changes-HG archive

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

[xsrc/netbsd-9]: xsrc/external/mit Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/xsrc/rev/04df9d4e24bd
branches:  netbsd-9
changeset: 10515:04df9d4e24bd
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jul 26 10:56:19 2020 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #1027):

        external/mit/xorg-server/dist/fb/fbcmap_mi.c: revision 1.2
        external/mit/xorg-server.old/dist/fb/fbscreen.c: revision 1.2
        external/mit/xorg-server.old/dist/fb/fb.h: revision 1.2
        external/mit/xorg-server/dist/fb/fb.h: revision 1.2
        external/mit/xorg-server/dist/fb/fbscreen.c: revision 1.2
        external/mit/xorg-server.old/dist/fb/fbcmap_mi.c: revision 1.2

Fix 1bpp Xservers on "whitePixel=0, blackPixel=1" VRAMs.

- Don't override pScreen->blackPixel and pScreen->whitePixel
  (set in MD server Init functions per -filpPixels option)
  on 1bpp servers in merged fbSetupScreen() (merged one
  from cfbSetupScrenn and mfbSetupScreen() in old xsrc/xfree)
- Pull mfbCreateColormap() function from old xsrc/xfree tree
  and use it on 1bpp servers

Required by forthcoming X11R7'fied ancient Xsun and XsunMono servers:
 https://mail-index.netbsd.org/port-sun3/2020/07/17/msg000157.html

Without these fixes, mouse pointers and twm window titlebar etc. are
rendered inverted.

Pull 1bpp server fixes from xorg-server.old:
https://mail-index.netbsd.org/source-changes/2020/07/18/msg119488.html

Confirmed on luna68k 1bpp Xorg 1.20 server using xf86-video-wsfb
with "-flipPixels" option.

diffstat:

 external/mit/xorg-server.old/dist/fb/fb.h        |   3 ++
 external/mit/xorg-server.old/dist/fb/fbcmap_mi.c |  35 ++++++++++++++++++++++++
 external/mit/xorg-server.old/dist/fb/fbscreen.c  |  12 ++++++--
 external/mit/xorg-server/dist/fb/fb.h            |   3 ++
 external/mit/xorg-server/dist/fb/fbcmap_mi.c     |  35 ++++++++++++++++++++++++
 external/mit/xorg-server/dist/fb/fbscreen.c      |  12 ++++++--
 6 files changed, 94 insertions(+), 6 deletions(-)

diffs (174 lines):

diff -r 2a52a6439f06 -r 04df9d4e24bd external/mit/xorg-server.old/dist/fb/fb.h
--- a/external/mit/xorg-server.old/dist/fb/fb.h Sun Jul 26 10:49:51 2020 +0000
+++ b/external/mit/xorg-server.old/dist/fb/fb.h Sun Jul 26 10:56:19 2020 +0000
@@ -1282,6 +1282,9 @@
 extern _X_EXPORT Bool
 fbInitializeColormap(ColormapPtr pmap);
 
+extern _X_EXPORT Bool
+mfbCreateColormap(ColormapPtr pmap);
+
 extern _X_EXPORT int
 fbExpandDirectColors (ColormapPtr   pmap, 
                      int           ndef,
diff -r 2a52a6439f06 -r 04df9d4e24bd external/mit/xorg-server.old/dist/fb/fbcmap_mi.c
--- a/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c  Sun Jul 26 10:49:51 2020 +0000
+++ b/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c  Sun Jul 26 10:56:19 2020 +0000
@@ -69,6 +69,41 @@
     return miInitializeColormap(pmap);
 }
 
+Bool
+mfbCreateColormap(ColormapPtr pmap)
+{
+    ScreenPtr  pScreen;
+    unsigned short  red0, green0, blue0;
+    unsigned short  red1, green1, blue1;
+    Pixel pix;
+
+    pScreen = pmap->pScreen;
+    if (pScreen->whitePixel == 0)
+    {
+       red0 = green0 = blue0 = ~0;
+       red1 = green1 = blue1 = 0;
+    }
+    else
+    {
+       red0 = green0 = blue0 = 0;
+       red1 = green1 = blue1 = ~0;
+    }
+
+    /* this is a monochrome colormap, it only has two entries, just fill
+     * them in by hand.  If it were a more complex static map, it would be
+     * worth writing a for loop or three to initialize it */
+
+    /* this will be pixel 0 */
+    pix = 0;
+    if (AllocColor(pmap, &red0, &green0, &blue0, &pix, 0) != Success)
+       return FALSE;
+
+    /* this will be pixel 1 */
+    if (AllocColor(pmap, &red1, &green1, &blue1, &pix, 0) != Success)
+       return FALSE;
+    return TRUE;
+}
+
 int
 fbExpandDirectColors (ColormapPtr   pmap,
                      int           ndef,
diff -r 2a52a6439f06 -r 04df9d4e24bd external/mit/xorg-server.old/dist/fb/fbscreen.c
--- a/external/mit/xorg-server.old/dist/fb/fbscreen.c   Sun Jul 26 10:49:51 2020 +0000
+++ b/external/mit/xorg-server.old/dist/fb/fbscreen.c   Sun Jul 26 10:56:19 2020 +0000
@@ -103,8 +103,10 @@
     if (!fbAllocatePrivates(pScreen, NULL))
        return FALSE;
     pScreen->defColormap = FakeClientID(0);
-    /* let CreateDefColormap do whatever it wants for pixels */ 
-    pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+    if (bpp > 1) {
+       /* let CreateDefColormap do whatever it wants for pixels */
+       pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+    }
     pScreen->QueryBestSize = fbQueryBestSize;
     /* SaveScreen */
     pScreen->GetImage = fbGetImage;
@@ -121,7 +123,11 @@
     pScreen->RealizeFont = fbRealizeFont;
     pScreen->UnrealizeFont = fbUnrealizeFont;
     pScreen->CreateGC = fbCreateGC;
-    pScreen->CreateColormap = fbInitializeColormap;
+    if (bpp == 1) {
+       pScreen->CreateColormap = mfbCreateColormap;
+    } else {
+       pScreen->CreateColormap = fbInitializeColormap;
+    }
     pScreen->DestroyColormap = (void (*)(ColormapPtr))NoopDDA;
     pScreen->InstallColormap = fbInstallColormap;
     pScreen->UninstallColormap = fbUninstallColormap;
diff -r 2a52a6439f06 -r 04df9d4e24bd external/mit/xorg-server/dist/fb/fb.h
--- a/external/mit/xorg-server/dist/fb/fb.h     Sun Jul 26 10:49:51 2020 +0000
+++ b/external/mit/xorg-server/dist/fb/fb.h     Sun Jul 26 10:56:19 2020 +0000
@@ -734,6 +734,9 @@
 extern _X_EXPORT Bool
  fbInitializeColormap(ColormapPtr pmap);
 
+extern _X_EXPORT Bool
+ mfbCreateColormap(ColormapPtr pmap);
+
 extern _X_EXPORT int
 
 fbExpandDirectColors(ColormapPtr pmap,
diff -r 2a52a6439f06 -r 04df9d4e24bd external/mit/xorg-server/dist/fb/fbcmap_mi.c
--- a/external/mit/xorg-server/dist/fb/fbcmap_mi.c      Sun Jul 26 10:49:51 2020 +0000
+++ b/external/mit/xorg-server/dist/fb/fbcmap_mi.c      Sun Jul 26 10:56:19 2020 +0000
@@ -66,6 +66,41 @@
     return miInitializeColormap(pmap);
 }
 
+Bool
+mfbCreateColormap(ColormapPtr pmap)
+{
+    ScreenPtr  pScreen;
+    unsigned short  red0, green0, blue0;
+    unsigned short  red1, green1, blue1;
+    Pixel pix;
+
+    pScreen = pmap->pScreen;
+    if (pScreen->whitePixel == 0)
+    {
+       red0 = green0 = blue0 = ~0;
+       red1 = green1 = blue1 = 0;
+    }
+    else
+    {
+       red0 = green0 = blue0 = 0;
+       red1 = green1 = blue1 = ~0;
+    }
+
+    /* this is a monochrome colormap, it only has two entries, just fill
+     * them in by hand.  If it were a more complex static map, it would be
+     * worth writing a for loop or three to initialize it */
+
+    /* this will be pixel 0 */
+    pix = 0;
+    if (AllocColor(pmap, &red0, &green0, &blue0, &pix, 0) != Success)
+       return FALSE;
+
+    /* this will be pixel 1 */
+    if (AllocColor(pmap, &red1, &green1, &blue1, &pix, 0) != Success)
+       return FALSE;
+    return TRUE;
+}
+
 int
 fbExpandDirectColors(ColormapPtr pmap,
                      int ndef, xColorItem * indefs, xColorItem * outdefs)
diff -r 2a52a6439f06 -r 04df9d4e24bd external/mit/xorg-server/dist/fb/fbscreen.c
--- a/external/mit/xorg-server/dist/fb/fbscreen.c       Sun Jul 26 10:49:51 2020 +0000
+++ b/external/mit/xorg-server/dist/fb/fbscreen.c       Sun Jul 26 10:56:19 2020 +0000
@@ -100,8 +100,10 @@
     if (!fbAllocatePrivates(pScreen))
         return FALSE;
     pScreen->defColormap = FakeClientID(0);
-    /* let CreateDefColormap do whatever it wants for pixels */
-    pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+    if (bpp > 1) {
+       /* let CreateDefColormap do whatever it wants for pixels */
+       pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
+    }
     pScreen->QueryBestSize = fbQueryBestSize;
     /* SaveScreen */
     pScreen->GetImage = fbGetImage;
@@ -118,7 +120,11 @@
     pScreen->RealizeFont = fbRealizeFont;
     pScreen->UnrealizeFont = fbUnrealizeFont;
     pScreen->CreateGC = fbCreateGC;
-    pScreen->CreateColormap = fbInitializeColormap;
+    if (bpp == 1) {
+       pScreen->CreateColormap = mfbCreateColormap;
+    } else {
+       pScreen->CreateColormap = fbInitializeColormap;
+    }
     pScreen->DestroyColormap = (void (*)(ColormapPtr)) NoopDDA;
     pScreen->InstallColormap = fbInstallColormap;
     pScreen->UninstallColormap = fbUninstallColormap;



Home | Main Index | Thread Index | Old Index