Module Name: xsrc Committed By: martin Date: Sun Jul 26 10:56:19 UTC 2020
Modified Files: xsrc/external/mit/xorg-server.old/dist/fb [netbsd-9]: fb.h fbcmap_mi.c fbscreen.c xsrc/external/mit/xorg-server/dist/fb [netbsd-9]: fb.h fbcmap_mi.c fbscreen.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \ xsrc/external/mit/xorg-server.old/dist/fb/fb.h \ xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c \ xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c cvs rdiff -u -r1.1.1.6 -r1.1.1.6.2.1 \ xsrc/external/mit/xorg-server/dist/fb/fb.h \ xsrc/external/mit/xorg-server/dist/fb/fbscreen.c cvs rdiff -u -r1.1.1.5 -r1.1.1.5.4.1 \ xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: xsrc/external/mit/xorg-server.old/dist/fb/fb.h diff -u xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1.4.1 --- xsrc/external/mit/xorg-server.old/dist/fb/fb.h:1.1.1.1 Thu Jun 9 09:07:56 2016 +++ xsrc/external/mit/xorg-server.old/dist/fb/fb.h Sun Jul 26 10:56:19 2020 @@ -1282,6 +1282,9 @@ fbResolveColor(unsigned short *pred, extern _X_EXPORT Bool fbInitializeColormap(ColormapPtr pmap); +extern _X_EXPORT Bool +mfbCreateColormap(ColormapPtr pmap); + extern _X_EXPORT int fbExpandDirectColors (ColormapPtr pmap, int ndef, Index: xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c diff -u xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1.4.1 --- xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c:1.1.1.1 Thu Jun 9 09:07:56 2016 +++ xsrc/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c Sun Jul 26 10:56:19 2020 @@ -69,6 +69,41 @@ fbInitializeColormap(ColormapPtr pmap) 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, Index: xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c diff -u xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1.4.1 --- xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c:1.1.1.1 Thu Jun 9 09:07:56 2016 +++ xsrc/external/mit/xorg-server.old/dist/fb/fbscreen.c Sun Jul 26 10:56:19 2020 @@ -103,8 +103,10 @@ fbSetupScreen(ScreenPtr pScreen, 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 @@ fbSetupScreen(ScreenPtr pScreen, 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; Index: xsrc/external/mit/xorg-server/dist/fb/fb.h diff -u xsrc/external/mit/xorg-server/dist/fb/fb.h:1.1.1.6 xsrc/external/mit/xorg-server/dist/fb/fb.h:1.1.1.6.2.1 --- xsrc/external/mit/xorg-server/dist/fb/fb.h:1.1.1.6 Mon Dec 31 09:36:09 2018 +++ xsrc/external/mit/xorg-server/dist/fb/fb.h Sun Jul 26 10:56:19 2020 @@ -734,6 +734,9 @@ fbResolveColor(unsigned short *pred, extern _X_EXPORT Bool fbInitializeColormap(ColormapPtr pmap); +extern _X_EXPORT Bool + mfbCreateColormap(ColormapPtr pmap); + extern _X_EXPORT int fbExpandDirectColors(ColormapPtr pmap, Index: xsrc/external/mit/xorg-server/dist/fb/fbscreen.c diff -u xsrc/external/mit/xorg-server/dist/fb/fbscreen.c:1.1.1.6 xsrc/external/mit/xorg-server/dist/fb/fbscreen.c:1.1.1.6.2.1 --- xsrc/external/mit/xorg-server/dist/fb/fbscreen.c:1.1.1.6 Mon Dec 31 09:36:09 2018 +++ xsrc/external/mit/xorg-server/dist/fb/fbscreen.c Sun Jul 26 10:56:19 2020 @@ -100,8 +100,10 @@ fbSetupScreen(ScreenPtr pScreen, void *p 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 @@ fbSetupScreen(ScreenPtr pScreen, void *p 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; Index: xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c diff -u xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c:1.1.1.5 xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c:1.1.1.5.4.1 --- xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c:1.1.1.5 Wed Aug 10 07:44:35 2016 +++ xsrc/external/mit/xorg-server/dist/fb/fbcmap_mi.c Sun Jul 26 10:56:19 2020 @@ -66,6 +66,41 @@ fbInitializeColormap(ColormapPtr pmap) 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)