[Openchrome-users] xgamma enabled
Thomas Hellström
thomas
Wed Dec 6 05:07:54 PST 2006
Gonzalo A. de la Vega wrote:
> The following patch lets xgamma change the screen gamma, at least in
> 24 bit mode, in K8M800... that's what I've tested.
Hmm,
Does not seem to be a patch against openChrome SVN?
/Thomas
>
> Gonzalo
>
>------------------------------------------------------------------------
>
>--- ./unichrome/via_driver.c 2006-12-05 20:24:21.000000000 -0300
>+++ ./unichrome/via_driver.c 2006-12-05 20:22:49.000000000 -0300
>@@ -82,6 +82,7 @@
> static void VIAUnmapMem(ScrnInfoPtr pScrn);
>
> static void VIALoadRgbLut(ScrnInfoPtr pScrn, LOCO *colors);
>+static int VIAChangeGamma(int myNum, Gamma gamma);
>
> DriverRec VIA =
> {
>@@ -1340,25 +1341,6 @@
> VIAFreeRec(pScrn);
> return FALSE;
> }
>- /* The above code only sets the gamma values in the screen info structure.
>- * We should now build the LUT and call VIALoadRgbLut().
>- * I don't know what happens if the LUT values go over 255, so I limited
>- * since a value higher than that seem to be useles anyway (with 255 the
>- * screen saturates).
>- */
>- LOCO *colors;
>- colors=malloc(256*3*sizeof(unsigned short));
>- int cindex;
>- for(cindex=0;cindex<256;cindex++) {
>- colors[cindex].red=(unsigned short)(192*powf((float)cindex/255,1/pScrn->gamma.red));
>- colors[cindex].green=(unsigned short)(192*powf((float)cindex/255,1/pScrn->gamma.green));
>- colors[cindex].blue=(unsigned short)(192*powf((float)cindex/255,1/pScrn->gamma.blue));
>-
>-
>-
>- }
>- VIALoadRgbLut(pScrn, colors);
>-
> }
>
> /* detect amount of installed ram */
>@@ -2190,7 +2172,34 @@
> return;
> }
>
>+int VIAChangeGamma(int myNum, Gamma gamma)
>+{
>+ LOCO *colors;
>+ colors=malloc(256*3*sizeof(unsigned short));
>+ int cindex;
>+
>+ ScrnInfoPtr pScrn = xf86Screens[myNum];
>+
>+ if (gamma.red < GAMMA_MIN || gamma.red > GAMMA_MAX ||
>+ gamma.green < GAMMA_MIN || gamma.green > GAMMA_MAX ||
>+ gamma.blue < GAMMA_MIN || gamma.blue > GAMMA_MAX)
>+ return BadValue;
>+
>+ pScrn->gamma.red = gamma.red;
>+ pScrn->gamma.green = gamma.green;
>+ pScrn->gamma.blue = gamma.blue;
>+
>+ for(cindex=0;cindex<256;cindex++) {
>+ colors[cindex].red=(unsigned short)(255*powf((float)cindex/255,1/pScrn->gamma.red));
>+ colors[cindex].green=(unsigned short)(255*powf((float)cindex/255,1/pScrn->gamma.green));
>+ colors[cindex].blue=(unsigned short)(255*powf((float)cindex/255,1/pScrn->gamma.blue));
>
>+ }
>+
>+ VIALoadRgbLut(pScrn, colors);
>+ return Success;
>+}
>+
>
> /*
> *
>@@ -2328,7 +2337,7 @@
> pVia->CloseScreen = pScreen->CloseScreen;
> pScreen->SaveScreen = VIASaveScreen;
> pScreen->CloseScreen = VIACloseScreen;
>-
>+ pScrn->ChangeGamma = VIAChangeGamma;
> xf86DPMSInit(pScreen, VIADPMS, 0);
> DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- DPMS set up\n"));
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>openchrome-users mailing list
>openchrome-users at openchrome.org
>http://wiki.openchrome.org/mailman/listinfo/openchrome-users
>Main page:
>http://www.openchrome.org
>Wiki:
>http://wiki.openchrome.org
>User Forum:
>http://wiki.openchrome.org/tikiwiki/tiki-view_forum.php?forumId=1
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wiki.openchrome.org/pipermail/openchrome-users/attachments/20061206/bbd74747/attachment-0001.html
More information about the Openchrome-users
mailing list