summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-13 18:00:46 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-11-13 18:00:46 -0200
commitd2709b1af22a06b24606ec8c01f39f1ca27ca8d3 (patch)
tree8fba29fadaf94fd0d9344cc78cd3f71628b2e244
parent0870d46718fe4e01953efd63cec46c54140b20f9 (diff)
Enable gamma correction on the MSOC.
-rw-r--r--src/smi501_crtc.c5
-rw-r--r--src/smi_501.h7
-rw-r--r--src/smi_driver.c3
3 files changed, 11 insertions, 4 deletions
diff --git a/src/smi501_crtc.c b/src/smi501_crtc.c
index 9e896b1..b827eed 100644
--- a/src/smi501_crtc.c
+++ b/src/smi501_crtc.c
@@ -65,6 +65,9 @@ SMI501_CrtcVideoInit_lcd(xf86CrtcPtr crtc)
mode->panel_fb_width.f.offset = pitch >> 4;
mode->panel_fb_width.f.width = width >> 4;
+ if (pSmi->Bpp > 1)
+ mode->panel_display_ctl.f.gamma = 1;
+
WRITE_SCR(pSmi, PANEL_DISPLAY_CTL, mode->panel_display_ctl.value);
WRITE_SCR(pSmi, PANEL_FB_WIDTH, mode->panel_fb_width.value);
@@ -97,6 +100,8 @@ SMI501_CrtcVideoInit_crt(xf86CrtcPtr crtc)
mode->crt_fb_width.f.offset = pitch >> 4;
mode->crt_fb_width.f.width = width >> 4;
+ if (pSmi->Bpp > 1)
+ mode->crt_display_ctl.f.gamma = 1;
WRITE_SCR(pSmi, CRT_DISPLAY_CTL, mode->crt_display_ctl.value);
WRITE_SCR(pSmi, CRT_FB_WIDTH, mode->crt_fb_width.value);
diff --git a/src/smi_501.h b/src/smi_501.h
index 9aff70c..8f46a0d 100644
--- a/src/smi_501.h
+++ b/src/smi_501.h
@@ -395,6 +395,10 @@ typedef struct _MSOCRegRec {
* 2:2 Panel Graphics Plane Enable.
* 0: Disable panel graphics plane.
* 1: Enable panel graphics plane.
+ * 3:3 Enable Gamma Control. Gamma control can only
+ * be enabled in RGB 5:6:5 and RGB 8:8:8 modes.
+ * 0: Disable.
+ * 1: Enable.
* 8:8 Enable Panel Timing.
* 0: Disable panel timing.
* 1: Enable panel timing.
@@ -421,7 +425,8 @@ typedef struct _MSOCRegRec {
struct {
int32_t format : bits( 0, 1);
int32_t enable : bits( 2, 2);
- int32_t u0 : bits( 3, 7);
+ int32_t gamma : bits( 3, 3);
+ int32_t u0 : bits( 4, 7);
int32_t timing : bits( 8, 8);
int32_t u1 : bits( 9, 11);
int32_t hsync : bits(12, 12);
diff --git a/src/smi_driver.c b/src/smi_driver.c
index d4a7afd..c7c18f3 100644
--- a/src/smi_driver.c
+++ b/src/smi_driver.c
@@ -885,8 +885,6 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags)
/*
* If the driver can do gamma correction, it should call xf86SetGamma()
- * here. (from MGA, no ViRGE gamma support yet, but needed for
- * xf86HandleColormaps support.)
*/
{
Gamma zeros = { 0.0, 0.0, 0.0 };
@@ -1763,7 +1761,6 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Initialize colormap layer. Must follow initialization of the default
* 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))
RETURN(FALSE);