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/sun Implement functions t...
details: https://anonhg.NetBSD.org/xsrc/rev/b021af57f0b4
branches: trunk
changeset: 10512:b021af57f0b4
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jul 26 07:20:50 2020 +0000
description:
Implement functions to restore palette settings on exiting Xserver.
diffstat:
external/mit/xorg-server/dist/hw/sun/sun.h | 10 +++
external/mit/xorg-server/dist/hw/sun/sunCfb.c | 69 ++++++++++++++++++++++++--
external/mit/xorg-server/dist/hw/sun/sunFbs.c | 4 +-
3 files changed, 76 insertions(+), 7 deletions(-)
diffs (164 lines):
diff -r 146b66af515d -r b021af57f0b4 external/mit/xorg-server/dist/hw/sun/sun.h
--- a/external/mit/xorg-server/dist/hw/sun/sun.h Sun Jul 26 07:19:09 2020 +0000
+++ b/external/mit/xorg-server/dist/hw/sun/sun.h Sun Jul 26 07:20:50 2020 +0000
@@ -247,11 +247,21 @@
CursorPtr pCursor; /* current cursor */
} sunCursorRec, *sunCursorPtr;
+#define NCMAP 256
+typedef struct {
+ u_char origRed[NCMAP];
+ u_char origGreen[NCMAP];
+ u_char origBlue[NCMAP];
+} sunCmapRec, *sunCmapPtr;
+
typedef struct {
ColormapPtr installedMap;
CloseScreenProcPtr CloseScreen;
void (*UpdateColormap)(ScreenPtr, int, int, u_char *, u_char *, u_char *);
void (*GetColormap)(ScreenPtr, int, int, u_char *, u_char *, u_char *);
+ Bool origColormapValid;
+ sunCmapRec origColormap;
+ void (*RestoreColormap)(ScreenPtr);
sunCursorRec hardwareCursor;
Bool hasHardwareCursor;
} sunScreenRec, *sunScreenPtr;
diff -r 146b66af515d -r b021af57f0b4 external/mit/xorg-server/dist/hw/sun/sunCfb.c
--- a/external/mit/xorg-server/dist/hw/sun/sunCfb.c Sun Jul 26 07:19:09 2020 +0000
+++ b/external/mit/xorg-server/dist/hw/sun/sunCfb.c Sun Jul 26 07:20:50 2020 +0000
@@ -94,11 +94,15 @@
static void CGUpdateColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
static void CGGetColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
static void CGStoreColors(ColormapPtr, int, xColorItem *);
+static void CGSaveColormap(ScreenPtr);
+static void CGRestoreColormap(ScreenPtr);
+static void CGScreenInitCommon(ScreenPtr);
static void CGScreenInit(ScreenPtr);
static void checkMono(int, char **);
#ifdef INCLUDE_CG2_HEADER
static void CG2UpdateColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
static void CG2GetColormap(ScreenPtr, int, int, u_char *, u_char *, u_char *);
+static void CG2RestoreColormap(ScreenPtr);
static Bool CG2SaveScreen(ScreenPtr, int);
static void CG2ScreenInit(ScreenPtr pScreen);
#endif
@@ -246,22 +250,61 @@
}
static void
-CGScreenInit(ScreenPtr pScreen)
+CGSaveColormap(ScreenPtr pScreen)
+{
+ sunScreenPtr pPrivate = sunGetScreenPrivate(pScreen);
+ sunCmapPtr origColormap;
+ u_char *rmap, *gmap, *bmap;
+
+ origColormap = &pPrivate->origColormap;
+ rmap = origColormap->origRed;
+ gmap = origColormap->origGreen;
+ bmap = origColormap->origBlue;
+ (*pPrivate->GetColormap)(pScreen, 0, NCMAP, rmap, gmap, bmap);
+}
+
+static void
+CGRestoreColormap(ScreenPtr pScreen)
{
-#ifndef STATIC_COLOR /* { */
sunScreenPtr pPrivate = sunGetScreenPrivate(pScreen);
+ sunCmapPtr origColormap;
+ u_char *rmap, *gmap, *bmap;
+
+ if (pPrivate->origColormapValid) {
+ origColormap = &pPrivate->origColormap;
+ rmap = origColormap->origRed;
+ gmap = origColormap->origGreen;
+ bmap = origColormap->origBlue;
+ (*pPrivate->UpdateColormap)(pScreen, 0, NCMAP, rmap, gmap, bmap);
+ }
+}
+
+static void
+CGScreenInitCommon(ScreenPtr pScreen)
+{
pScreen->InstallColormap = sunInstallColormap;
pScreen->UninstallColormap = sunUninstallColormap;
pScreen->ListInstalledColormaps = sunListInstalledColormaps;
pScreen->StoreColors = CGStoreColors;
- pPrivate->UpdateColormap = CGUpdateColormap;
- pPrivate->GetColormap = CGGetColormap;
if (sunFlipPixels) {
Pixel pixel = pScreen->whitePixel;
pScreen->whitePixel = pScreen->blackPixel;
pScreen->blackPixel = pixel;
}
-#endif /* } */
+}
+
+static void
+CGScreenInit(ScreenPtr pScreen)
+{
+ sunScreenPtr pPrivate = sunGetScreenPrivate(pScreen);
+
+ CGScreenInitCommon(pScreen);
+ pPrivate->UpdateColormap = CGUpdateColormap;
+ pPrivate->GetColormap = CGGetColormap;
+ pPrivate->RestoreColormap = CGRestoreColormap;
+
+ CGSaveColormap(pScreen);
+ pPrivate->origColormapValid = TRUE;
}
static void
@@ -372,6 +415,15 @@
}
}
+static void
+CG2RestoreColormap(ScreenPtr pScreen)
+{
+ int screen = pScreen->myNum;
+
+ CGRestoreColormap(pScreen);
+ ((CG2Ptr)sunFbs[screen].fb)->regs.ppmask.reg = 1;
+}
+
static Bool
CG2SaveScreen(ScreenPtr pScreen, int on)
{
@@ -387,9 +439,14 @@
CG2ScreenInit(ScreenPtr pScreen)
{
sunScreenPtr pPrivate = sunGetScreenPrivate(pScreen);
- CGScreenInit (pScreen);
+
+ CGScreenInitCommon(pScreen);
pPrivate->UpdateColormap = CG2UpdateColormap;
pPrivate->GetColormap = CG2GetColormap;
+ pPrivate->RestoreColormap = CG2RestoreColormap;
+
+ CGSaveColormap(pScreen);
+ pPrivate->origColormapValid = TRUE;
}
Bool
diff -r 146b66af515d -r b021af57f0b4 external/mit/xorg-server/dist/hw/sun/sunFbs.c
--- a/external/mit/xorg-server/dist/hw/sun/sunFbs.c Sun Jul 26 07:19:09 2020 +0000
+++ b/external/mit/xorg-server/dist/hw/sun/sunFbs.c Sun Jul 26 07:20:50 2020 +0000
@@ -137,7 +137,7 @@
ErrorF("dixRegisterPrivateKey failed");
return FALSE;
}
- pPrivate = malloc (sizeof (sunScreenRec));
+ pPrivate = calloc(1, sizeof (sunScreenRec));
if (!pPrivate)
return FALSE;
@@ -171,6 +171,8 @@
#if 0 /* XXX GX is disabled for now */
sunDisableCursor (pScreen);
#endif
+ if (pPrivate->origColormapValid)
+ (*pPrivate->RestoreColormap)(pScreen);
pScreen->CloseScreen = pPrivate->CloseScreen;
ret = (*pScreen->CloseScreen) (pScreen);
(void) (*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
Home |
Main Index |
Thread Index |
Old Index