summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-09-19 18:00:16 -0300
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-09-19 18:00:16 -0300
commit9ae840a358959615020fa4adb76c1487231927f3 (patch)
treeb8be2243288eda87cd738ce3a8d59dd3644f8cab
parentf4339a6a7aa077cb355dd23b77ea568ad2a481e3 (diff)
Add MSOC palette support to run at 8 bpp.
Colors should be correctly set, but most output using Render is not properly drawn, i.e. anti aliased fonts, etc. Need to investigate further, but it should be a general problem, not exclusive to the driver.
-rw-r--r--src/smi.h2
-rw-r--r--src/smi_501.c17
-rw-r--r--src/smi_501.h4
-rw-r--r--src/smi_driver.c42
4 files changed, 41 insertions, 24 deletions
diff --git a/src/smi.h b/src/smi.h
index 97a1f55..583a0c4 100644
--- a/src/smi.h
+++ b/src/smi.h
@@ -371,6 +371,8 @@ Bool SMI_MapMem(ScrnInfoPtr pScrn);
void SMI_UnmapMem(ScrnInfoPtr pScrn);
void SMI_AdjustFrame(int scrnIndex, int x, int y, int flags);
Bool SMI_SwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+void SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies,
+ LOCO *colors, VisualPtr pVisual);
/* smi_dga.c */
Bool SMI_DGAInit(ScreenPtr pScrn);
diff --git a/src/smi_501.c b/src/smi_501.c
index 725ab7a..1cd765c 100644
--- a/src/smi_501.c
+++ b/src/smi_501.c
@@ -491,8 +491,6 @@ SMI501_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr xf86mode)
WRITE_SCR(pSmi, SYSTEM_CTL, mode->system_ctl.value);
}
- /* FIXME update pallete here if running at 8 bpp */
-
SMI_AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV,
@@ -502,6 +500,21 @@ SMI501_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr xf86mode)
return (TRUE);
}
+void
+SMI501_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual)
+{
+ SMIPtr pSmi = SMIPTR(pScrn);
+ int i, port;
+
+ port = pSmi->IsSecondary ? CRT_PALETTE : PANEL_PALETTE;
+ for (i = 0; i < numColors; i++)
+ WRITE_SCR(pSmi, port + (indices[i] << 2),
+ (colors[indices[i]].red << 16) |
+ (colors[indices[i]].green << 8) |
+ colors[indices[i]].blue);
+}
+
static char *
format_integer_base2(int32_t word)
{
diff --git a/src/smi_501.h b/src/smi_501.h
index 9ade949..8e1719d 100644
--- a/src/smi_501.h
+++ b/src/smi_501.h
@@ -699,6 +699,8 @@ typedef struct _MSOCRegRec {
} crt_vsync;
} MSOCRegRec, *MSOCRegPtr;
+#define PANEL_PALETTE 0x080400
+#define CRT_PALETTE 0x080c00
/* In Kb - documentation says it is 64Kb... */
#define FB_RESERVE4USB 512
@@ -710,5 +712,7 @@ void SMI501_Save(ScrnInfoPtr pScrn);
void SMI501_DisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode, int flags);
Bool SMI501_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+void SMI501_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
+ LOCO *colors, VisualPtr pVisual);
#endif /*_SMI_501_H*/
diff --git a/src/smi_driver.c b/src/smi_driver.c
index bccecb4..dfa07be 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -76,8 +76,6 @@ static void SMI_EnableVideo(ScrnInfoPtr pScrn);
static Bool SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
static Bool SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool SMI_SaveScreen(ScreenPtr pScreen, int mode);
-static void SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies,
- LOCO *colors, VisualPtr pVisual);
static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode, int flags);
static Bool SMI_ddc1(int scrnIndex);
@@ -2414,8 +2412,10 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* colormap. And SetGamma call, else it will load palette with solid white.
*/
/* CZ 2.11.2001: CMAP_PALETTED_TRUECOLOR for gamma correction */
- if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, SMI_LoadPalette, NULL,
- CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR)) {
+ if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, IS_MSOC(pSmi) ?
+ SMI501_LoadPalette : SMI_LoadPalette, NULL,
+ CMAP_RELOAD_ON_MODE_SWITCH |
+ CMAP_PALETTED_TRUECOLOR)) {
LEAVE_PROC("SMI_ScreenInit");
return FALSE;
}
@@ -3298,32 +3298,30 @@ SMI_SwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
}
void
-SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors,
- VisualPtr pVisual)
+SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies,
+ LOCO *colors, VisualPtr pVisual)
{
SMIPtr pSmi = SMIPTR(pScrn);
int i;
ENTER_PROC("SMI_LoadPalette");
- if (!IS_MSOC(pSmi)) {
- /* Enable both the CRT and LCD DAC RAM paths, so both palettes are updated */
- if (pSmi->Chipset == SMI_LYNX3DM || pSmi->Chipset == SMI_COUGAR3DR) {
- CARD8 ccr66;
+ /* Enable both the CRT and LCD DAC RAM paths, so both palettes are updated */
+ if (pSmi->Chipset == SMI_LYNX3DM || pSmi->Chipset == SMI_COUGAR3DR) {
+ CARD8 ccr66;
- ccr66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66);
- ccr66 &= 0x0f;
- VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, ccr66);
- }
+ ccr66 = VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66);
+ ccr66 &= 0x0f;
+ VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x66, ccr66);
+ }
- for(i = 0; i < numColors; i++) {
- DEBUG((VERBLEV, "pal[%d] = %d %d %d\n", indicies[i],
- colors[indicies[i]].red, colors[indicies[i]].green, colors[indicies[i]].blue));
- VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, indicies[i]);
- VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].red);
- VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].green);
- VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].blue);
- }
+ for(i = 0; i < numColors; i++) {
+ DEBUG((VERBLEV, "pal[%d] = %d %d %d\n", indicies[i],
+ colors[indicies[i]].red, colors[indicies[i]].green, colors[indicies[i]].blue));
+ VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, indicies[i]);
+ VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].red);
+ VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].green);
+ VGAOUT8(pSmi, VGA_DAC_DATA, colors[indicies[i]].blue);
}
LEAVE_PROC("SMI_LoadPalette");