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.old/dist/fb Fix 1bpp Xservers on ...
details: https://anonhg.NetBSD.org/xsrc/rev/f792573051fb
branches: trunk
changeset: 10501:f792573051fb
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Jul 18 17:18:09 2020 +0000
description:
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.
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 ++++++--
3 files changed, 47 insertions(+), 3 deletions(-)
diffs (87 lines):
diff -r 996e57b392b7 -r f792573051fb external/mit/xorg-server.old/dist/fb/fb.h
--- a/external/mit/xorg-server.old/dist/fb/fb.h Sat Jul 18 15:48:08 2020 +0000
+++ b/external/mit/xorg-server.old/dist/fb/fb.h Sat Jul 18 17:18:09 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 996e57b392b7 -r f792573051fb external/mit/xorg-server.old/dist/fb/fbcmap_mi.c
--- a/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c Sat Jul 18 15:48:08 2020 +0000
+++ b/external/mit/xorg-server.old/dist/fb/fbcmap_mi.c Sat Jul 18 17:18:09 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 996e57b392b7 -r f792573051fb external/mit/xorg-server.old/dist/fb/fbscreen.c
--- a/external/mit/xorg-server.old/dist/fb/fbscreen.c Sat Jul 18 15:48:08 2020 +0000
+++ b/external/mit/xorg-server.old/dist/fb/fbscreen.c Sat Jul 18 17:18:09 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;
Home |
Main Index |
Thread Index |
Old Index