diff options
Diffstat (limited to 'src/lx_output.c')
-rw-r--r-- | src/lx_output.c | 99 |
1 files changed, 51 insertions, 48 deletions
diff --git a/src/lx_output.c b/src/lx_output.c index 6e36426..40455ce 100644 --- a/src/lx_output.c +++ b/src/lx_output.c @@ -37,8 +37,7 @@ #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -typedef struct _LXOutputPrivateRec -{ +typedef struct _LXOutputPrivateRec { I2CBusPtr pDDCBus; } LXOutputPrivateRec, *LXOutputPrivatePtr; @@ -55,30 +54,31 @@ lx_create_resources(xf86OutputPtr output) /* Scaling is only used for panels */ if (!(pGeode->Output & OUTPUT_PANEL)) - return; + return; scale_atom = MAKE_ATOM("scale"); ret = RRConfigureOutputProperty(output->randr_output, - scale_atom, FALSE, FALSE, FALSE, 0, NULL); + scale_atom, FALSE, FALSE, FALSE, 0, NULL); if (ret) { - xf86DrvMsg(pScrni->scrnIndex, X_ERROR, - "RRConfigureOutputProperty error %d\n", ret); + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "RRConfigureOutputProperty error %d\n", ret); } s = "on"; ret = RRChangeOutputProperty(output->randr_output, scale_atom, - XA_STRING, 8, PropModeReplace, strlen(s), (pointer) s, FALSE, FALSE); + XA_STRING, 8, PropModeReplace, strlen(s), + (pointer) s, FALSE, FALSE); if (ret) { - xf86DrvMsg(pScrni->scrnIndex, X_ERROR, - "RRCharOutputProperty error %d\n", ret); + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "RRCharOutputProperty error %d\n", ret); } } static Bool lx_output_set_property(xf86OutputPtr output, Atom property, - RRPropertyValuePtr value) + RRPropertyValuePtr value) { ScrnInfoPtr pScrni = output->scrn; GeodeRec *pGeode = GEODEPTR(pScrni); @@ -87,33 +87,34 @@ lx_output_set_property(xf86OutputPtr output, Atom property, int ret; if (property != scale_atom) - return FALSE; + return FALSE; if (value->type != XA_STRING || value->format != 8) - return FALSE; + return FALSE; - s = (char *)value->data; + s = (char *) value->data; if (value->size == 2 && !strncmp("on", s, 2)) - pGeode->Scale = TRUE; + pGeode->Scale = TRUE; else if (value->size == 3 && !strncmp("off", s, 3)) - pGeode->Scale = FALSE; + pGeode->Scale = FALSE; if (pGeode->Scale != scale && output->crtc) { - xf86CrtcPtr crtc = output->crtc; + xf86CrtcPtr crtc = output->crtc; - if (crtc->enabled) { - ret = xf86CrtcSetMode(crtc, &crtc->desiredMode, - crtc->desiredRotation, crtc->desiredX, crtc->desiredY); + if (crtc->enabled) { + ret = xf86CrtcSetMode(crtc, &crtc->desiredMode, + crtc->desiredRotation, crtc->desiredX, + crtc->desiredY); - if (!ret) { - xf86DrvMsg(pScrni->scrnIndex, X_ERROR, - "Failed to set mode after property change!\n"); + if (!ret) { + xf86DrvMsg(pScrni->scrnIndex, X_ERROR, + "Failed to set mode after property change!\n"); - pGeode->Scale = scale; - return FALSE; - } - } + pGeode->Scale = scale; + return FALSE; + } + } } return TRUE; @@ -187,14 +188,14 @@ lx_output_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) static Bool lx_output_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, - DisplayModePtr adjusted_mode) + DisplayModePtr adjusted_mode) { return TRUE; } static void lx_output_mode_set(xf86OutputPtr output, DisplayModePtr mode, - DisplayModePtr adjusted_mode) + DisplayModePtr adjusted_mode) { ScrnInfoPtr pScrni = output->scrn; GeodeRec *pGeode = GEODEPTR(pScrni); @@ -202,10 +203,10 @@ lx_output_mode_set(xf86OutputPtr output, DisplayModePtr mode, /* Configure the output path */ if (pGeode->Output & OUTPUT_PANEL) - df_set_output_path((pGeode->Output & OUTPUT_CRT) ? - DF_DISPLAY_CRT_FP : DF_DISPLAY_FP); + df_set_output_path((pGeode->Output & OUTPUT_CRT) ? + DF_DISPLAY_CRT_FP : DF_DISPLAY_FP); else - df_set_output_path(DF_DISPLAY_CRT); + df_set_output_path(DF_DISPLAY_CRT); } static xf86OutputStatus @@ -228,11 +229,12 @@ lx_output_get_modes(xf86OutputPtr output) DisplayModePtr modes; if (!(pGeode->Output & OUTPUT_PANEL)) { - mon = xf86OutputGetEDID(output, lx_output->pDDCBus); - xf86OutputSetEDID(output, mon); - modes = xf86OutputGetEDIDModes(output); - } else { - modes = xf86DuplicateMode(pGeode->panelMode); + mon = xf86OutputGetEDID(output, lx_output->pDDCBus); + xf86OutputSetEDID(output, mon); + modes = xf86OutputGetEDIDModes(output); + } + else { + modes = xf86DuplicateMode(pGeode->panelMode); } return modes; @@ -242,19 +244,19 @@ static void lx_output_destroy(xf86OutputPtr output) { if (output->driver_private) - free(output->driver_private); + free(output->driver_private); output->driver_private = NULL; } #ifdef RANDR_GET_CRTC_INTERFACE -static xf86CrtcPtr lx_output_get_crtc(xf86OutputPtr output) +static xf86CrtcPtr +lx_output_get_crtc(xf86OutputPtr output) { return output->crtc; } #endif - static const xf86OutputFuncsRec lx_output_funcs = { .create_resources = lx_create_resources, .dpms = lx_output_dpms, @@ -286,8 +288,8 @@ LXSetupOutput(ScrnInfoPtr pScrni) lxpriv = xnfcalloc(1, sizeof(LXOutputPrivateRec)); if (!lxpriv) { - xf86OutputDestroy(output); - return; + xf86OutputDestroy(output); + return; } output->driver_private = lxpriv; @@ -299,13 +301,14 @@ LXSetupOutput(ScrnInfoPtr pScrni) GeodeI2CInit(pScrni, &lxpriv->pDDCBus, "CS5536 DDC"); if (pScrni->monitor->widthmm && pScrni->monitor->heightmm) { - /* prioritize the admin's screen size */ - output->mm_width = pScrni->monitor->widthmm; - output->mm_height = pScrni->monitor->heightmm; - } else if (pGeode->mm_width && pGeode->mm_height) { - /* if we have a panel that we're certain of the size of, set it */ - output->mm_width = pScrni->monitor->widthmm = pGeode->mm_width; - output->mm_height = pScrni->monitor->heightmm = pGeode->mm_height; + /* prioritize the admin's screen size */ + output->mm_width = pScrni->monitor->widthmm; + output->mm_height = pScrni->monitor->heightmm; + } + else if (pGeode->mm_width && pGeode->mm_height) { + /* if we have a panel that we're certain of the size of, set it */ + output->mm_width = pScrni->monitor->widthmm = pGeode->mm_width; + output->mm_height = pScrni->monitor->heightmm = pGeode->mm_height; } /* We only have one CRTC, and this output is tied to it */ |