diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/i810_reg.h | 1 | ||||
-rw-r--r-- | src/i830.h | 117 | ||||
-rw-r--r-- | src/i830_crt.c | 38 | ||||
-rw-r--r-- | src/i830_cursor.c | 32 | ||||
-rw-r--r-- | src/i830_display.c | 78 | ||||
-rw-r--r-- | src/i830_display.h | 12 | ||||
-rw-r--r-- | src/i830_dri.c | 2 | ||||
-rw-r--r-- | src/i830_driver.c | 80 | ||||
-rw-r--r-- | src/i830_dvo.c | 32 | ||||
-rw-r--r-- | src/i830_lvds.c | 26 | ||||
-rw-r--r-- | src/i830_modes.c | 16 | ||||
-rw-r--r-- | src/i830_randr.c | 104 | ||||
-rw-r--r-- | src/i830_sdvo.c | 106 | ||||
-rw-r--r-- | src/i830_tv.c | 238 | ||||
-rw-r--r-- | src/i830_video.c | 2 | ||||
-rw-r--r-- | src/i830_xf86Crtc.c | 83 | ||||
-rw-r--r-- | src/i830_xf86Crtc.h | 101 |
17 files changed, 526 insertions, 542 deletions
diff --git a/src/i810_reg.h b/src/i810_reg.h index 53a063fc..5ec671fb 100644 --- a/src/i810_reg.h +++ b/src/i810_reg.h @@ -1098,6 +1098,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * This is used for load detection in combination with TVDAC_SENSE_MASK */ # define TV_TEST_MODE_MONITOR_DETECT (7 << 0) +# define TV_TEST_MODE_MASK (7 << 0) /** @} */ /** @defgroup TV_DAC @@ -208,100 +208,6 @@ typedef struct _I830OutputPrivateRec { #define I830OutputPrivate(o) ((I830OutputPrivatePtr) (o)->driver_private) -struct _I830OutputRec { - int type; - int pipe; - Bool enabled; - /** - * Marks that the output and associated pipe is temporarily enabled for - * load detection. - */ - Bool load_detect_temp; - - /** - * Turns the output on/off, or sets intermediate power levels if available. - * - * Unsupported intermediate modes drop to the lower power setting. If the - * mode is DPMSModeOff, the output must be disabled, as the DPLL may be - * disabled afterwards. - */ - void (*dpms)(ScrnInfoPtr pScrn, I830OutputPtr output, int mode); - - /** - * Saves the output's state for restoration on VT switch. - */ - void (*save)(ScrnInfoPtr pScrn, I830OutputPtr output); - - /** - * Restore's the output's state at VT switch. - */ - void (*restore)(ScrnInfoPtr pScrn, I830OutputPtr output); - - /** - * Callback for testing a video mode for a given output. - * - * This function should only check for cases where a mode can't be supported - * on the pipe specifically, and not represent generic CRTC limitations. - * - * \return MODE_OK if the mode is valid, or another MODE_* otherwise. - */ - int (*mode_valid)(ScrnInfoPtr pScrn, I830OutputPtr output, - DisplayModePtr pMode); - - /** - * Callback for setting up a video mode before any pipe/dpll changes. - * - * \param pMode the mode that will be set, or NULL if the mode to be set is - * unknown (such as the restore path of VT switching). - */ - void (*pre_set_mode)(ScrnInfoPtr pScrn, I830OutputPtr output, - DisplayModePtr pMode); - - /** - * Callback for setting up a video mode after the DPLL update but before - * the plane is enabled. - */ - void (*post_set_mode)(ScrnInfoPtr pScrn, I830OutputPtr output, - DisplayModePtr pMode); - - /** - * Probe for a connected output, and return detect_status. - */ - enum detect_status (*detect)(ScrnInfoPtr pScrn, I830OutputPtr output); - - /** - * Query the device for the modes it provides. - * - * This function may also update MonInfo, mm_width, and mm_height. - * - * \return singly-linked list of modes or NULL if no modes found. - */ - DisplayModePtr (*get_modes)(ScrnInfoPtr pScrn, I830OutputPtr output); - - /** - * List of available modes on this output. - * - * This should be the list from get_modes(), plus perhaps additional - * compatible modes added later. - */ - DisplayModePtr probed_modes; - - /** EDID monitor information */ - xf86MonPtr MonInfo; - - /** Physical size of the output currently attached. */ - int mm_width, mm_height; - - I2CBusPtr pI2CBus; - I2CBusPtr pDDCBus; - struct _I830DVODriver *i2c_drv; - /** Output-private structure. Should replace i2c_drv */ - void *dev_priv; -#ifdef RANDR_12_INTERFACE - RROutputPtr randr_output; -#endif -}; - typedef struct _I830PipeRec { Bool enabled; Bool gammaEnabled; @@ -317,6 +223,9 @@ typedef struct _I830PipeRec { } I830PipeRec, *I830PipePtr; typedef struct _I830Rec { + /* Must be first */ + xf86CrtcConfigRec xf86_config; + unsigned char *MMIOBase; unsigned char *FbBase; int cpp; @@ -333,9 +242,6 @@ typedef struct _I830Rec { int CloneVDisplay; I830EntPtr entityPrivate; -#if 0 - int pipe, origPipe; -#endif int init; unsigned int bufferOffset; /* for I830SelectBuffer */ @@ -487,17 +393,6 @@ typedef struct _I830Rec { Bool checkDevices; - /* XXX outputs and crtcs need to move to ScrnInfoRec */ - int num_outputs; -/* struct _I830OutputRec output[MAX_OUTPUTS]; */ - I830_xf86OutputPtr xf86_output[MAX_OUTPUTS]; - - /* [0] is Pipe A, [1] is Pipe B. */ - int num_pipes; - /* [0] is display plane A, [1] is display plane B. */ -/* I830PipeRec pipes[MAX_DISPLAY_PIPES]; */ - I830_xf86CrtcPtr xf86_crtc[MAX_DISPLAY_PIPES]; - /* Driver phase/state information */ Bool preinit; Bool starting; @@ -604,7 +499,7 @@ extern void I830PrintErrorState(ScrnInfoPtr pScrn); extern void I965PrintErrorState(ScrnInfoPtr pScrn); extern void I830Sync(ScrnInfoPtr pScrn); extern void I830InitHWCursor(ScrnInfoPtr pScrn); -extern void I830SetPipeCursor (I830_xf86CrtcPtr crtc, Bool force); +extern void I830SetPipeCursor (xf86CrtcPtr crtc, Bool force); extern Bool I830CursorInit(ScreenPtr pScreen); extern void IntelEmitInvarientState(ScrnInfoPtr pScrn); extern void I830EmitInvarientState(ScrnInfoPtr pScrn); @@ -685,7 +580,7 @@ extern Bool I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, /* i830_display.c */ Bool -i830PipeHasType (I830_xf86CrtcPtr crtc, int type); +i830PipeHasType (xf86CrtcPtr crtc, int type); /* i830_crt.c */ void i830_crt_init(ScrnInfoPtr pScrn); @@ -709,7 +604,7 @@ int I830ValidateXF86ModeList(ScrnInfoPtr pScrn, Bool first_time); void i830_reprobe_output_modes(ScrnInfoPtr pScrn); void i830_set_xf86_modes_from_outputs(ScrnInfoPtr pScrn); void i830_set_default_screen_size(ScrnInfoPtr pScrn); -DisplayModePtr i830_ddc_get_modes(I830_xf86OutputPtr output); +DisplayModePtr i830_ddc_get_modes(xf86OutputPtr output); /* i830_randr.c */ Bool I830RandRCreateScreenResources (ScreenPtr pScreen); diff --git a/src/i830_crt.c b/src/i830_crt.c index 716afbc8..37a5b3f9 100644 --- a/src/i830_crt.c +++ b/src/i830_crt.c @@ -35,7 +35,7 @@ #include "i830_display.h" static void -i830_crt_dpms(I830_xf86OutputPtr output, int mode) +i830_crt_dpms(xf86OutputPtr output, int mode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -64,7 +64,7 @@ i830_crt_dpms(I830_xf86OutputPtr output, int mode) } static void -i830_crt_save (I830_xf86OutputPtr output) +i830_crt_save (xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -73,7 +73,7 @@ i830_crt_save (I830_xf86OutputPtr output) } static void -i830_crt_restore (I830_xf86OutputPtr output) +i830_crt_restore (xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -82,7 +82,7 @@ i830_crt_restore (I830_xf86OutputPtr output) } static int -i830_crt_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_crt_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) { if (pMode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN; @@ -94,16 +94,16 @@ i830_crt_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) } static void -i830_crt_pre_set_mode (I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_crt_pre_set_mode (xf86OutputPtr output, DisplayModePtr pMode) { } static void -i830_crt_post_set_mode (I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_crt_post_set_mode (xf86OutputPtr output, DisplayModePtr pMode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - I830_xf86CrtcPtr crtc = output->crtc; + xf86CrtcPtr crtc = output->crtc; I830CrtcPrivatePtr i830_crtc = crtc->driver_private; int dpll_md_reg; CARD32 adpa, dpll_md; @@ -146,7 +146,7 @@ i830_crt_post_set_mode (I830_xf86OutputPtr output, DisplayModePtr pMode) * \return FALSE if CRT is disconnected. */ static Bool -i830_crt_detect_hotplug(I830_xf86OutputPtr output) +i830_crt_detect_hotplug(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -185,8 +185,8 @@ i830_crt_detect_hotplug(I830_xf86OutputPtr output) * \return FALSE if CRT is disconnected. */ static Bool -i830_crt_detect_load (I830_xf86CrtcPtr crtc, - I830_xf86OutputPtr output) +i830_crt_detect_load (xf86CrtcPtr crtc, + xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -257,7 +257,7 @@ i830_crt_detect_load (I830_xf86CrtcPtr crtc, * \return FALSE if no DDC response was detected. */ static Bool -i830_crt_detect_ddc(I830_xf86OutputPtr output) +i830_crt_detect_ddc(xf86OutputPtr output) { I830OutputPrivatePtr i830_output = output->driver_private; @@ -275,11 +275,11 @@ i830_crt_detect_ddc(I830_xf86OutputPtr output) * on active displays. */ static enum detect_status -i830_crt_detect(I830_xf86OutputPtr output) +i830_crt_detect(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - I830_xf86CrtcPtr crtc; + xf86CrtcPtr crtc; if (IS_I945G(pI830) || IS_I945GM(pI830) || IS_I965G(pI830)) { if (i830_crt_detect_hotplug(output)) @@ -329,7 +329,7 @@ i830_crt_detect(I830_xf86OutputPtr output) } static DisplayModePtr -i830_crt_get_modes(I830_xf86OutputPtr output) +i830_crt_get_modes(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; DisplayModePtr modes; @@ -361,13 +361,13 @@ i830_crt_get_modes(I830_xf86OutputPtr output) } static void -i830_crt_destroy (I830_xf86OutputPtr output) +i830_crt_destroy (xf86OutputPtr output) { if (output->driver_private) xfree (output->driver_private); } -static const I830_xf86OutputFuncsRec i830_crt_output_funcs = { +static const xf86OutputFuncsRec i830_crt_output_funcs = { .dpms = i830_crt_dpms, .save = i830_crt_save, .restore = i830_crt_restore, @@ -382,16 +382,16 @@ static const I830_xf86OutputFuncsRec i830_crt_output_funcs = { void i830_crt_init(ScrnInfoPtr pScrn) { - I830_xf86OutputPtr output; + xf86OutputPtr output; I830OutputPrivatePtr i830_output; - output = i830xf86OutputCreate (pScrn, &i830_crt_output_funcs, "VGA"); + output = xf86OutputCreate (pScrn, &i830_crt_output_funcs, "VGA"); if (!output) return; i830_output = xnfcalloc (sizeof (I830OutputPrivateRec), 1); if (!i830_output) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } i830_output->type = I830_OUTPUT_ANALOG; diff --git a/src/i830_cursor.c b/src/i830_cursor.c index a3526f87..e9ca8f15 100644 --- a/src/i830_cursor.c +++ b/src/i830_cursor.c @@ -80,7 +80,7 @@ static Bool I830UseHWCursorARGB(ScreenPtr pScrn, CursorPtr pCurs); #endif static void -I830SetPipeCursorBase (I830_xf86CrtcPtr crtc) +I830SetPipeCursorBase (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; I830CrtcPrivatePtr intel_crtc = crtc->driver_private; @@ -89,7 +89,7 @@ I830SetPipeCursorBase (I830_xf86CrtcPtr crtc) int cursor_base = (pipe == 0 ? CURSOR_A_BASE : CURSOR_B_BASE); I830MemRange *cursor_mem; - if (pipe >= pI830->num_pipes) + if (pipe >= pI830->xf86_config.num_crtc) FatalError("Bad pipe number for cursor base setting\n"); if (pI830->CursorIsARGB) @@ -105,7 +105,7 @@ I830SetPipeCursorBase (I830_xf86CrtcPtr crtc) } void -I830SetPipeCursor (I830_xf86CrtcPtr crtc, Bool force) +I830SetPipeCursor (xf86CrtcPtr crtc, Bool force) { ScrnInfoPtr pScrn = crtc->scrn; I830CrtcPrivatePtr intel_crtc = crtc->driver_private; @@ -185,12 +185,12 @@ I830InitHWCursor(ScrnInfoPtr pScrn) int i; DPRINTF(PFX, "I830InitHWCursor\n"); - for (i = 0; i < pI830->num_pipes; i++) - pI830->xf86_crtc[i]->cursorShown = FALSE; + for (i = 0; i < pI830->xf86_config.num_crtc; i++) + pI830->xf86_config.crtc[i]->cursorShown = FALSE; /* Initialise the HW cursor registers, leaving the cursor hidden. */ if (IS_MOBILE(pI830) || IS_I9XX(pI830)) { - for (i = 0; i < pI830->num_pipes; i++) + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { int cursor_control = i == 0 ? CURSOR_A_CONTROL : CURSOR_B_CONTROL; temp = INREG(cursor_control); @@ -204,7 +204,7 @@ I830InitHWCursor(ScrnInfoPtr pScrn) temp |= CURSOR_MODE_64_4C_AX; /* Need to set control, then address. */ OUTREG(cursor_control, temp); - I830SetPipeCursorBase(pI830->xf86_crtc[i]); + I830SetPipeCursorBase(pI830->xf86_config.crtc[i]); } } else { temp = INREG(CURSOR_CONTROL); @@ -217,7 +217,7 @@ I830InitHWCursor(ScrnInfoPtr pScrn) /* This initialises the format and leave the cursor disabled. */ OUTREG(CURSOR_CONTROL, temp); /* Need to set address and size after disabling. */ - I830SetPipeCursorBase(pI830->xf86_crtc[0]); + I830SetPipeCursorBase(pI830->xf86_config.crtc[0]); temp = ((I810_CURSOR_X & CURSOR_SIZE_MASK) << CURSOR_SIZE_HSHIFT) | ((I810_CURSOR_Y & CURSOR_SIZE_MASK) << CURSOR_SIZE_VSHIFT); OUTREG(CURSOR_SIZE, temp); @@ -490,9 +490,9 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) x -= hotspotx; y -= hotspoty; - for (pipe = 0; pipe < pI830->num_pipes; pipe++) + for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[pipe]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[pipe]; DisplayModePtr mode = &crtc->curMode; int thisx = x - crtc->x; int thisy = y - crtc->y; @@ -556,8 +556,8 @@ I830ShowCursor(ScrnInfoPtr pScrn) pI830->CursorMemARGB->Physical, pI830->CursorMemARGB->Start); pI830->cursorOn = TRUE; - for (pipe = 0; pipe < pI830->num_pipes; pipe++) - I830SetPipeCursor (pI830->xf86_crtc[pipe], TRUE); + for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++) + I830SetPipeCursor (pI830->xf86_config.crtc[pipe], TRUE); } static void @@ -569,8 +569,8 @@ I830HideCursor(ScrnInfoPtr pScrn) DPRINTF(PFX, "I830HideCursor\n"); pI830->cursorOn = FALSE; - for (pipe = 0; pipe < pI830->num_pipes; pipe++) - I830SetPipeCursor (pI830->xf86_crtc[pipe], TRUE); + for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++) + I830SetPipeCursor (pI830->xf86_config.crtc[pipe], TRUE); } static void @@ -587,9 +587,9 @@ I830SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) DPRINTF(PFX, "I830SetCursorColors\n"); - for (pipe = 0; pipe < pI830->num_pipes; pipe++) + for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[pipe]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[pipe]; int pal0 = pipe == 0 ? CURSOR_A_PALETTE0 : CURSOR_B_PALETTE0; if (crtc->enabled) diff --git a/src/i830_display.c b/src/i830_display.c index ba59f56b..dd79a5ee 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -64,15 +64,15 @@ i830PrintPll(char *prefix, int refclk, int m1, int m2, int n, int p1, int p2) * Returns whether any output on the specified pipe is of the specified type */ Bool -i830PipeHasType (I830_xf86CrtcPtr crtc, int type) +i830PipeHasType (xf86CrtcPtr crtc, int type) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); int i; - for (i = 0; i < pI830->num_outputs; i++) + for (i = 0; i < pI830->xf86_config.num_output; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + xf86OutputPtr output = pI830->xf86_config.output[i]; if (output->crtc == crtc) { I830OutputPrivatePtr intel_output = output->driver_private; @@ -91,7 +91,7 @@ i830PipeHasType (I830_xf86CrtcPtr crtc, int type) * clk = refclk * (5 * m1 + m2) / n / (p1 * p2) */ static Bool -i830PllIsValid(I830_xf86CrtcPtr crtc, int refclk, int m1, int m2, +i830PllIsValid(xf86CrtcPtr crtc, int refclk, int m1, int m2, int n, int p1, int p2) { ScrnInfoPtr pScrn = crtc->scrn; @@ -177,7 +177,7 @@ i830PllIsValid(I830_xf86CrtcPtr crtc, int refclk, int m1, int m2, * clk = refclk * (5 * m1 + m2) / n / (p1 * p2) */ static Bool -i830FindBestPLL(I830_xf86CrtcPtr crtc, int target, int refclk, +i830FindBestPLL(xf86CrtcPtr crtc, int target, int refclk, int *outm1, int *outm2, int *outn, int *outp1, int *outp2) { ScrnInfoPtr pScrn = crtc->scrn; @@ -262,7 +262,7 @@ i830WaitForVblank(ScrnInfoPtr pScreen) } void -i830PipeSetBase(I830_xf86CrtcPtr crtc, int x, int y) +i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -300,7 +300,7 @@ i830PipeSetBase(I830_xf86CrtcPtr crtc, int x, int y) * - Closer in refresh rate to the requested mode. */ DisplayModePtr -i830PipeFindClosestMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode) +i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -308,9 +308,9 @@ i830PipeFindClosestMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode) int i; /* Assume that there's only one output connected to the given CRTC. */ - for (i = 0; i < pI830->num_outputs; i++) + for (i = 0; i < pI830->xf86_config.num_output; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + xf86OutputPtr output = pI830->xf86_config.output[i]; if (output->crtc == crtc && output->probed_modes != NULL) { pScan = output->probed_modes; @@ -396,14 +396,14 @@ i830PipeFindClosestMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode) */ Bool -i830PipeInUse (I830_xf86CrtcPtr crtc) +i830PipeInUse (xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); int i; - for (i = 0; i < pI830->num_outputs; i++) - if (pI830->xf86_output[i]->crtc == crtc) + for (i = 0; i < pI830->xf86_config.num_output; i++) + if (pI830->xf86_config.output[i]->crtc == crtc) return TRUE; return FALSE; } @@ -417,7 +417,7 @@ i830PipeInUse (I830_xf86CrtcPtr crtc) * display data. */ Bool -i830PipeSetMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode, +i830PipeSetMode(xf86CrtcPtr crtc, DisplayModePtr pMode, Bool plane_enable) { ScrnInfoPtr pScrn = crtc->scrn; @@ -469,9 +469,9 @@ i830PipeSetMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode, didLock = I830DRILock(pScrn); #endif - for (i = 0; i < pI830->num_outputs; i++) + for (i = 0; i < pI830->xf86_config.num_output; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + xf86OutputPtr output = pI830->xf86_config.output[i]; I830OutputPrivatePtr intel_output = output->driver_private; if (output->crtc != crtc) continue; @@ -694,8 +694,8 @@ i830PipeSetMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode, OUTREG(PFIT_CONTROL, 0); } - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; if (output->crtc == crtc) (*output->funcs->post_set_mode)(output, pMode); } @@ -740,9 +740,9 @@ i830DisableUnusedFunctions(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling unused functions\n"); - for (o = 0; o < pI830->num_outputs; o++) + for (o = 0; o < pI830->xf86_config.num_output; o++) { - I830_xf86OutputPtr output = pI830->xf86_output[o]; + xf86OutputPtr output = pI830->xf86_config.output[o]; if (!output->crtc) (*output->funcs->dpms)(output, DPMSModeOff); } @@ -751,9 +751,9 @@ i830DisableUnusedFunctions(ScrnInfoPtr pScrn) * internal TV) should have no outputs trying to pull data out of it, so * we're ready to turn those off. */ - for (pipe = 0; pipe < pI830->num_pipes; pipe++) + for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[pipe]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[pipe]; I830CrtcPrivatePtr intel_crtc = crtc->driver_private; int pipe = intel_crtc->pipe; int dspcntr_reg = pipe == 0 ? DSPACNTR : DSPBCNTR; @@ -807,9 +807,9 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) DPRINTF(PFX, "i830SetMode\n"); - for (i = 0; i < pI830->num_pipes; i++) + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[i]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[i]; ok = i830PipeSetMode(crtc, i830PipeFindClosestMode(crtc, pMode), TRUE); @@ -832,9 +832,9 @@ i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) /* If we might have enabled/disabled some pipes, we need to reset * cloning mode support. */ - if (pI830->num_pipes >= 2 && - pI830->xf86_crtc[0]->enabled && - pI830->xf86_crtc[1]->enabled) + if (pI830->xf86_config.num_crtc >= 2 && + pI830->xf86_config.crtc[0]->enabled && + pI830->xf86_config.crtc[1]->enabled) pI830->Clone = TRUE; else pI830->Clone = FALSE; @@ -865,8 +865,8 @@ i830DescribeOutputConfiguration(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Output configuration:\n"); - for (i = 0; i < pI830->num_pipes; i++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[i]; + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { + xf86CrtcPtr crtc = pI830->xf86_config.crtc[i]; CARD32 dspcntr = INREG(DSPACNTR + (DSPBCNTR - DSPACNTR) * i); CARD32 pipeconf = INREG(PIPEACONF + (PIPEBCONF - PIPEACONF) * i); Bool hw_plane_enable = (dspcntr & DISPLAY_PLANE_ENABLE) != 0; @@ -896,9 +896,9 @@ i830DescribeOutputConfiguration(ScrnInfoPtr pScrn) } } - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; - I830_xf86CrtcPtr crtc = output->crtc; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; + xf86CrtcPtr crtc = output->crtc; I830CrtcPrivatePtr intel_crtc = crtc ? crtc->driver_private : NULL; xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -922,26 +922,26 @@ i830DescribeOutputConfiguration(ScrnInfoPtr pScrn) * \return crtc, or NULL if no pipes are available. */ -I830_xf86CrtcPtr -i830GetLoadDetectPipe(I830_xf86OutputPtr output) +xf86CrtcPtr +i830GetLoadDetectPipe(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); I830OutputPrivatePtr intel_output = output->driver_private; - I830_xf86CrtcPtr crtc; + xf86CrtcPtr crtc; int i; if (output->crtc) return output->crtc; - for (i = 0; i < pI830->num_pipes; i++) - if (!i830PipeInUse(pI830->xf86_crtc[i])) + for (i = 0; i < pI830->xf86_config.num_crtc; i++) + if (!i830PipeInUse(pI830->xf86_config.crtc[i])) break; - if (i == pI830->num_pipes) + if (i == pI830->xf86_config.num_crtc) return NULL; - crtc = pI830->xf86_crtc[i]; + crtc = pI830->xf86_config.crtc[i]; output->crtc = crtc; intel_output->load_detect_temp = TRUE; @@ -950,7 +950,7 @@ i830GetLoadDetectPipe(I830_xf86OutputPtr output) } void -i830ReleaseLoadDetectPipe(I830_xf86OutputPtr output) +i830ReleaseLoadDetectPipe(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr intel_output = output->driver_private; diff --git a/src/i830_display.h b/src/i830_display.h index 4409728d..e491b74e 100644 --- a/src/i830_display.h +++ b/src/i830_display.h @@ -27,14 +27,14 @@ /* i830_display.c */ DisplayModePtr -i830PipeFindClosestMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode); -Bool i830PipeSetMode(I830_xf86CrtcPtr crtc, DisplayModePtr pMode, +i830PipeFindClosestMode(xf86CrtcPtr crtc, DisplayModePtr pMode); +Bool i830PipeSetMode(xf86CrtcPtr crtc, DisplayModePtr pMode, Bool plane_enable); void i830DisableUnusedFunctions(ScrnInfoPtr pScrn); Bool i830SetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); -void i830PipeSetBase(I830_xf86CrtcPtr crtc, int x, int y); +void i830PipeSetBase(xf86CrtcPtr crtc, int x, int y); void i830WaitForVblank(ScrnInfoPtr pScrn); void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn); -I830_xf86CrtcPtr i830GetLoadDetectPipe(I830_xf86OutputPtr output); -void i830ReleaseLoadDetectPipe(I830_xf86OutputPtr output); -Bool i830PipeInUse(I830_xf86CrtcPtr crtc); +xf86CrtcPtr i830GetLoadDetectPipe(xf86OutputPtr output); +void i830ReleaseLoadDetectPipe(xf86OutputPtr output); +Bool i830PipeInUse(xf86CrtcPtr crtc); diff --git a/src/i830_dri.c b/src/i830_dri.c index af34afc5..d88b0bcf 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -1513,7 +1513,7 @@ I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on) if (pI830->directRenderingEnabled && pI830->drmMinor >= 5) { if (on) { - if (pI830->num_pipes > 1 && pI830->xf86_crtc[1]->enabled) + if (pI830->xf86_config.num_crtc > 1 && pI830->xf86_config.crtc[1]->enabled) pipe.pipe = DRM_I830_VBLANK_PIPE_B; else pipe.pipe = DRM_I830_VBLANK_PIPE_A; diff --git a/src/i830_driver.c b/src/i830_driver.c index 4d6e8168..50a5da05 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -548,9 +548,9 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, DPRINTF(PFX, "I830LoadPalette: numColors: %d\n", numColors); pI830 = I830PTR(pScrn); - for(p=0; p < pI830->num_pipes; p++) + for(p=0; p < pI830->xf86_config.num_crtc; p++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[p]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[p]; I830CrtcPrivatePtr intel_crtc = crtc->driver_private; if (p == 0) { @@ -671,7 +671,7 @@ I830SetupOutputs(ScrnInfoPtr pScrn) * Setup the CRTCs */ -static const I830_xf86CrtcFuncsRec i830_crtc_funcs = { +static const xf86CrtcFuncsRec i830_crtc_funcs = { }; static void @@ -680,9 +680,9 @@ I830SetupCrtcs(ScrnInfoPtr pScrn) I830Ptr pI830 = I830PTR(pScrn); int p; - for (p = 0; p < pI830->num_pipes; p++) + for (p = 0; p < pI830->xf86_config.num_crtc; p++) { - I830_xf86CrtcPtr crtc = i830xf86CrtcCreate (pScrn, &i830_crtc_funcs); + xf86CrtcPtr crtc = xf86CrtcCreate (pScrn, &i830_crtc_funcs); I830CrtcPrivatePtr intel_crtc; if (!crtc) @@ -691,7 +691,7 @@ I830SetupCrtcs(ScrnInfoPtr pScrn) intel_crtc->pipe = p; crtc->driver_private = intel_crtc; - pI830->xf86_crtc[p] = crtc; + pI830->xf86_config.crtc[p] = crtc; } } @@ -1142,14 +1142,14 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) } if (pI830->PciInfo->chipType == PCI_CHIP_E7221_G) - pI830->num_pipes = 1; + pI830->xf86_config.num_crtc = 1; else if (IS_MOBILE(pI830) || IS_I9XX(pI830)) - pI830->num_pipes = 2; + pI830->xf86_config.num_crtc = 2; else - pI830->num_pipes = 1; + pI830->xf86_config.num_crtc = 1; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%d display pipe%s available.\n", - pI830->num_pipes, pI830->num_pipes > 1 ? "s" : ""); + pI830->xf86_config.num_crtc, pI830->xf86_config.num_crtc > 1 ? "s" : ""); /* * Get the pre-allocated (stolen) memory size. @@ -1271,7 +1271,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) I830SetupCrtcs(pScrn); if (xf86ReturnOptValBool(pI830->Options, OPTION_CLONE, FALSE)) { - if (pI830->num_pipes == 1) { + if (pI830->xf86_config.num_crtc == 1) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Can't enable Clone Mode because this is a single pipe device\n"); PreInitCleanup(pScrn); @@ -1291,11 +1291,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) /* Perform the pipe assignment of outputs. This is a kludge until * we have better configuration support in the generic RandR code */ - for (i = 0; i < pI830->num_outputs; i++) + for (i = 0; i < pI830->xf86_config.num_output; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + xf86OutputPtr output = pI830->xf86_config.output[i]; I830OutputPrivatePtr intel_output = output->driver_private; - I830_xf86CrtcPtr crtc; + xf86CrtcPtr crtc; int p; output->crtc = NULL; @@ -1303,7 +1303,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) switch (intel_output->type) { case I830_OUTPUT_LVDS: /* LVDS must live on pipe B for two-pipe devices */ - crtc = pI830->xf86_crtc[pI830->num_pipes - 1]; + crtc = pI830->xf86_config.crtc[pI830->xf86_config.num_crtc - 1]; if (!i830PipeInUse (crtc)) output->crtc = crtc; break; @@ -1312,9 +1312,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) case I830_OUTPUT_SDVO: if ((*output->funcs->detect)(output) != OUTPUT_STATUS_DISCONNECTED) { - for (p = 0; p < pI830->num_pipes; p++) + for (p = 0; p < pI830->xf86_config.num_crtc; p++) { - crtc = pI830->xf86_crtc[p]; + crtc = pI830->xf86_config.crtc[p]; if (!i830PipeInUse(crtc)) { output->crtc = crtc; @@ -1324,7 +1324,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) } break; case I830_OUTPUT_TVOUT: - crtc = pI830->xf86_crtc[0]; + crtc = pI830->xf86_config.crtc[0]; if ((*output->funcs->detect)(output) != OUTPUT_STATUS_DISCONNECTED && !i830PipeInUse(crtc)) { @@ -1337,9 +1337,9 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) } } - for (i = 0; i < pI830->num_pipes; i++) + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[i]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[i]; crtc->enabled = i830PipeInUse(crtc); } @@ -2074,7 +2074,7 @@ SaveHWState(ScrnInfoPtr pScrn) temp = INREG(PIPEACONF); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEACONF is 0x%08lx\n", (unsigned long) temp); - if (pI830->num_pipes == 2) { + if (pI830->xf86_config.num_crtc == 2) { temp = INREG(PIPEBCONF); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEBCONF is 0x%08lx\n", (unsigned long) temp); @@ -2106,7 +2106,7 @@ SaveHWState(ScrnInfoPtr pScrn) pI830->savePaletteA[i] = INREG(PALETTE_A + (i << 2)); } - if(pI830->num_pipes == 2) { + if(pI830->xf86_config.num_crtc == 2) { pI830->savePIPEBCONF = INREG(PIPEBCONF); pI830->savePIPEBSRC = INREG(PIPEBSRC); pI830->saveDSPBCNTR = INREG(DSPBCNTR); @@ -2150,8 +2150,8 @@ SaveHWState(ScrnInfoPtr pScrn) pI830->savePFIT_CONTROL = INREG(PFIT_CONTROL); - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; if (output->funcs->save) (*output->funcs->save) (output); } @@ -2192,8 +2192,8 @@ RestoreHWState(ScrnInfoPtr pScrn) OUTREG(PIPEBCONF, temp & ~PIPEBCONF_ENABLE); /* Disable outputs if necessary */ - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; (*output->funcs->pre_set_mode) (output, NULL); } @@ -2219,7 +2219,7 @@ RestoreHWState(ScrnInfoPtr pScrn) OUTREG(PALETTE_A + (i << 2), pI830->savePaletteA[i]); } - if(pI830->num_pipes == 2) { + if(pI830->xf86_config.num_crtc == 2) { OUTREG(FPB0, pI830->saveFPB0); OUTREG(FPB1, pI830->saveFPB1); OUTREG(DPLL_B, pI830->saveDPLL_B); @@ -2243,8 +2243,8 @@ RestoreHWState(ScrnInfoPtr pScrn) OUTREG(PFIT_CONTROL, pI830->savePFIT_CONTROL); - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; (*output->funcs->restore) (output); } @@ -3280,9 +3280,9 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags) pI830->AccelInfoRec->NeedToSync = FALSE; } - for (i = 0; i < pI830->num_pipes; i++) + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[i]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[i]; if (crtc->enabled) i830PipeSetBase(crtc, x, y); } @@ -3396,9 +3396,9 @@ I830EnterVT(int scrnIndex, int flags) ResetState(pScrn, FALSE); SetHWOperatingState(pScrn); - for (i = 0; i < pI830->num_pipes; i++) + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[i]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[i]; /* Mark that we'll need to re-set the mode for sure */ memset(&crtc->curMode, 0, sizeof(crtc->curMode)); @@ -3566,7 +3566,7 @@ I830SaveScreen(ScreenPtr pScreen, int mode) DPRINTF(PFX, "I830SaveScreen: %d, on is %s\n", mode, BOOLTOSTRING(on)); if (pScrn->vtSema) { - for (i = 0; i < pI830->num_pipes; i++) { + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { if (i == 0) { ctrl = DSPACNTR; base = DSPABASE; @@ -3576,7 +3576,7 @@ I830SaveScreen(ScreenPtr pScreen, int mode) base = DSPBADDR; surf = DSPBSURF; } - if (pI830->xf86_crtc[i]->enabled) { + if (pI830->xf86_config.crtc[i]->enabled) { temp = INREG(ctrl); if (on) temp |= DISPLAY_PLANE_ENABLE; @@ -3613,15 +3613,15 @@ I830DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int i; CARD32 temp, ctrl, base; - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; (*output->funcs->dpms) (output, PowerManagementMode); } - for (i = 0; i < pI830->num_pipes; i++) + for (i = 0; i < pI830->xf86_config.num_crtc; i++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[i]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[i]; if (i == 0) { ctrl = DSPACNTR; @@ -3835,7 +3835,7 @@ i830MonitorDetectDebugger(ScrnInfoPtr pScrn) if (!pScrn->vtSema) return 1000; - for (i = 0; i < pI830->num_outputs; i++) { + for (i = 0; i < pI830->xf86_config.num_output; i++) { enum output_status ret; char *result; diff --git a/src/i830_dvo.c b/src/i830_dvo.c index b2921902..6fe31575 100644 --- a/src/i830_dvo.c +++ b/src/i830_dvo.c @@ -57,7 +57,7 @@ struct _I830DVODriver i830_dvo_drivers[] = #define I830_NUM_DVO_DRIVERS (sizeof(i830_dvo_drivers)/sizeof(struct _I830DVODriver)) static void -i830_dvo_dpms(I830_xf86OutputPtr output, int mode) +i830_dvo_dpms(xf86OutputPtr output, int mode) { I830OutputPrivatePtr intel_output = output->driver_private; if (mode == DPMSModeOn) @@ -67,7 +67,7 @@ i830_dvo_dpms(I830_xf86OutputPtr output, int mode) } static void -i830_dvo_save(I830_xf86OutputPtr output) +i830_dvo_save(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -84,7 +84,7 @@ i830_dvo_save(I830_xf86OutputPtr output) } static void -i830_dvo_restore(I830_xf86OutputPtr output) +i830_dvo_restore(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -98,7 +98,7 @@ i830_dvo_restore(I830_xf86OutputPtr output) } static int -i830_dvo_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_dvo_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) { I830OutputPrivatePtr intel_output = output->driver_private; @@ -114,7 +114,7 @@ i830_dvo_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) } static void -i830_dvo_pre_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_dvo_pre_set_mode(xf86OutputPtr output, DisplayModePtr pMode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -126,11 +126,11 @@ i830_dvo_pre_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) } static void -i830_dvo_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_dvo_post_set_mode(xf86OutputPtr output, DisplayModePtr pMode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); - I830_xf86CrtcPtr crtc = output->crtc; + xf86CrtcPtr crtc = output->crtc; I830CrtcPrivatePtr intel_crtc = crtc->driver_private; int pipe = intel_crtc->pipe; CARD32 dvo; @@ -165,7 +165,7 @@ i830_dvo_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) * Unimplemented. */ static enum detect_status -i830_dvo_detect(I830_xf86OutputPtr output) +i830_dvo_detect(xf86OutputPtr output) { return OUTPUT_STATUS_UNKNOWN; } @@ -202,7 +202,7 @@ I830I2CDetectDVOControllers(ScrnInfoPtr pScrn, I2CBusPtr pI2CBus, } static void -i830_dvo_destroy (I830_xf86OutputPtr output) +i830_dvo_destroy (xf86OutputPtr output) { I830OutputPrivatePtr intel_output = output->driver_private; @@ -217,7 +217,7 @@ i830_dvo_destroy (I830_xf86OutputPtr output) } } -static const I830_xf86OutputFuncsRec i830_dvo_output_funcs = { +static const xf86OutputFuncsRec i830_dvo_output_funcs = { .dpms = i830_dvo_dpms, .save = i830_dvo_save, .restore = i830_dvo_restore, @@ -232,18 +232,18 @@ static const I830_xf86OutputFuncsRec i830_dvo_output_funcs = { void i830_dvo_init(ScrnInfoPtr pScrn) { - I830_xf86OutputPtr output; + xf86OutputPtr output; I830OutputPrivatePtr intel_output; int ret; - output = i830xf86OutputCreate (pScrn, &i830_dvo_output_funcs, + output = xf86OutputCreate (pScrn, &i830_dvo_output_funcs, "ADD AGP card"); if (!output) return; intel_output = xnfcalloc (sizeof (I830OutputPrivateRec), 1); if (!intel_output) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } intel_output->type = I830_OUTPUT_DVO; @@ -253,14 +253,14 @@ i830_dvo_init(ScrnInfoPtr pScrn) ret = I830I2CInit(pScrn, &intel_output->pI2CBus, GPIOE, "DVOI2C_E"); if (!ret) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } ret = I830I2CInit(pScrn, &intel_output->pDDCBus, GPIOD, "DVODDC_D"); if (!ret) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } @@ -275,7 +275,7 @@ i830_dvo_init(ScrnInfoPtr pScrn) } else { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } } diff --git a/src/i830_lvds.c b/src/i830_lvds.c index e72b9e87..bfb4e148 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -73,7 +73,7 @@ i830SetLVDSPanelPower(ScrnInfoPtr pScrn, Bool on) } static void -i830_lvds_dpms (I830_xf86OutputPtr output, int mode) +i830_lvds_dpms (xf86OutputPtr output, int mode) { ScrnInfoPtr pScrn = output->scrn; @@ -84,7 +84,7 @@ i830_lvds_dpms (I830_xf86OutputPtr output, int mode) } static void -i830_lvds_save (I830_xf86OutputPtr output) +i830_lvds_save (xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -109,7 +109,7 @@ i830_lvds_save (I830_xf86OutputPtr output) } static void -i830_lvds_restore(I830_xf86OutputPtr output) +i830_lvds_restore(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -127,13 +127,13 @@ i830_lvds_restore(I830_xf86OutputPtr output) } static int -i830_lvds_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_lvds_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) { return MODE_OK; } static void -i830_lvds_pre_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_lvds_pre_set_mode(xf86OutputPtr output, DisplayModePtr pMode) { ScrnInfoPtr pScrn = output->scrn; /* Always make sure the LVDS is off before we play with DPLLs and pipe @@ -145,7 +145,7 @@ i830_lvds_pre_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) } static void -i830_lvds_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_lvds_post_set_mode(xf86OutputPtr output, DisplayModePtr pMode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -185,7 +185,7 @@ i830_lvds_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) * been set up if the LVDS was actually connected anyway. */ static enum detect_status -i830_lvds_detect(I830_xf86OutputPtr output) +i830_lvds_detect(xf86OutputPtr output) { return OUTPUT_STATUS_CONNECTED; } @@ -194,7 +194,7 @@ i830_lvds_detect(I830_xf86OutputPtr output) * Return the list of DDC modes if available, or the BIOS fixed mode otherwise. */ static DisplayModePtr -i830_lvds_get_modes(I830_xf86OutputPtr output) +i830_lvds_get_modes(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -225,7 +225,7 @@ i830_lvds_get_modes(I830_xf86OutputPtr output) } static void -i830_lvds_destroy (I830_xf86OutputPtr output) +i830_lvds_destroy (xf86OutputPtr output) { I830OutputPrivatePtr intel_output = output->driver_private; @@ -233,7 +233,7 @@ i830_lvds_destroy (I830_xf86OutputPtr output) xfree (intel_output); } -static const I830_xf86OutputFuncsRec i830_lvds_output_funcs = { +static const xf86OutputFuncsRec i830_lvds_output_funcs = { .dpms = i830_lvds_dpms, .save = i830_lvds_save, .restore = i830_lvds_restore, @@ -249,7 +249,7 @@ void i830_lvds_init(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - I830_xf86OutputPtr output; + xf86OutputPtr output; I830OutputPrivatePtr intel_output; @@ -286,13 +286,13 @@ i830_lvds_init(ScrnInfoPtr pScrn) } } - output = i830xf86OutputCreate (pScrn, &i830_lvds_output_funcs, "Built-in LCD panel"); + output = xf86OutputCreate (pScrn, &i830_lvds_output_funcs, "Built-in LCD panel"); if (!output) return; intel_output = xnfcalloc (sizeof (I830OutputPrivateRec), 1); if (!intel_output) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } intel_output->type = I830_OUTPUT_LVDS; diff --git a/src/i830_modes.c b/src/i830_modes.c index 7d4bcbae..19ea05c7 100644 --- a/src/i830_modes.c +++ b/src/i830_modes.c @@ -427,9 +427,9 @@ i830_reprobe_output_modes(ScrnInfoPtr pScrn) int i; /* Re-probe the list of modes for each output. */ - for (i = 0; i < pI830->num_outputs; i++) + for (i = 0; i < pI830->xf86_config.num_output; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + xf86OutputPtr output = pI830->xf86_config.output[i]; DisplayModePtr mode; while (output->probed_modes != NULL) @@ -511,8 +511,8 @@ i830_set_xf86_modes_from_outputs(ScrnInfoPtr pScrn) * pScrn->modes should only be used for XF86VidMode now, which we don't * care about enough to make some sort of unioned list. */ - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; if (output->probed_modes != NULL) { pScrn->modes = i830xf86DuplicateModes(pScrn, output->probed_modes); break; @@ -564,8 +564,8 @@ i830_set_default_screen_size(ScrnInfoPtr pScrn) /* Set up a virtual size that will cover any clone mode we'd want to * set for the currently-connected outputs. */ - for (i = 0; i < pI830->num_outputs; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + for (i = 0; i < pI830->xf86_config.num_output; i++) { + xf86OutputPtr output = pI830->xf86_config.output[i]; DisplayModePtr mode; for (mode = output->probed_modes; mode != NULL; mode = mode->next) @@ -615,7 +615,7 @@ I830ValidateXF86ModeList(ScrnInfoPtr pScrn, Bool first_time) #define EDID_ATOM_NAME "EDID_DATA" static void -i830_ddc_set_edid_property(I830_xf86OutputPtr output, void *data, int data_len) +i830_ddc_set_edid_property(xf86OutputPtr output, void *data, int data_len) { Atom edid_atom = MakeAtom(EDID_ATOM_NAME, sizeof(EDID_ATOM_NAME), TRUE); @@ -636,7 +636,7 @@ i830_ddc_set_edid_property(I830_xf86OutputPtr output, void *data, int data_len) * Generic get_modes function using DDC, used by many outputs. */ DisplayModePtr -i830_ddc_get_modes(I830_xf86OutputPtr output) +i830_ddc_get_modes(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr intel_output = output->driver_private; diff --git a/src/i830_randr.c b/src/i830_randr.c index 59c07ffc..ec0a2ec9 100644 --- a/src/i830_randr.c +++ b/src/i830_randr.c @@ -481,8 +481,8 @@ I830RandRCrtcNotify (RRCrtcPtr randr_crtc) int numOutputs; RROutputPtr randr_outputs[MAX_OUTPUTS]; RROutputPtr randr_output; - I830_xf86CrtcPtr crtc = randr_crtc->devPrivate; - I830_xf86OutputPtr output; + xf86CrtcPtr crtc = randr_crtc->devPrivate; + xf86OutputPtr output; int i, j; DisplayModePtr curMode = &crtc->curMode; @@ -491,9 +491,9 @@ I830RandRCrtcNotify (RRCrtcPtr randr_crtc) rotation = RR_Rotate_0; numOutputs = 0; randr_mode = NULL; - for (i = 0; i < pI830->num_outputs; i++) + for (i = 0; i < pI830->xf86_config.num_output; i++) { - output = pI830->xf86_output[i]; + output = pI830->xf86_config.output[i]; if (output->crtc == crtc) { randr_output = output->randr_output; @@ -529,20 +529,20 @@ I830RandRCrtcSet (ScreenPtr pScreen, { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - I830_xf86CrtcPtr crtc = randr_crtc->devPrivate; + xf86CrtcPtr crtc = randr_crtc->devPrivate; DisplayModePtr mode = randr_mode ? randr_mode->devPrivate : NULL; Bool changed = FALSE; int o, ro; - I830_xf86CrtcPtr save_crtcs[MAX_OUTPUTS]; + xf86CrtcPtr save_crtcs[MAX_OUTPUTS]; Bool save_enabled = crtc->enabled; if (!I830ModesEqual (&crtc->curMode, mode)) changed = TRUE; - for (o = 0; o < pI830->num_outputs; o++) + for (o = 0; o < pI830->xf86_config.num_output; o++) { - I830_xf86OutputPtr output = pI830->xf86_output[o]; - I830_xf86CrtcPtr new_crtc; + xf86OutputPtr output = pI830->xf86_config.output[o]; + xf86CrtcPtr new_crtc; save_crtcs[o] = output->crtc; @@ -577,9 +577,9 @@ I830RandRCrtcSet (ScreenPtr pScreen, if (!i830PipeSetMode (crtc, mode, TRUE)) { crtc->enabled = save_enabled; - for (o = 0; o < pI830->num_outputs; o++) + for (o = 0; o < pI830->xf86_config.num_output; o++) { - I830_xf86OutputPtr output = pI830->xf86_output[o]; + xf86OutputPtr output = pI830->xf86_config.output[o]; output->crtc = save_crtcs[o]; } return FALSE; @@ -676,9 +676,9 @@ I830RandRSetInfo12 (ScrnInfoPtr pScrn) RRCrtcPtr randr_crtc; int nclone; - for (o = 0; o < pI830->num_outputs; o++) + for (o = 0; o < pI830->xf86_config.num_output; o++) { - I830_xf86OutputPtr output = pI830->xf86_output[o]; + xf86OutputPtr output = pI830->xf86_config.output[o]; I830OutputPrivatePtr intel_output = output->driver_private; /* * Valid crtcs @@ -718,9 +718,9 @@ I830RandRSetInfo12 (ScrnInfoPtr pScrn) break; } ncrtc = 0; - for (p = 0; p < pI830->num_pipes; p++) + for (p = 0; p < pI830->xf86_config.num_crtc; p++) if (crtc_types & (1 << p)) - crtcs[ncrtc++] = pI830->xf86_crtc[p]->randr_crtc; + crtcs[ncrtc++] = pI830->xf86_config.crtc[p]->randr_crtc; if (output->crtc) randr_crtc = output->crtc->randr_crtc; @@ -754,9 +754,9 @@ I830RandRSetInfo12 (ScrnInfoPtr pScrn) * Valid clones */ nclone = 0; - for (c = 0; c < pI830->num_outputs; c++) + for (c = 0; c < pI830->xf86_config.num_output; c++) { - I830_xf86OutputPtr clone = pI830->xf86_output[c]; + xf86OutputPtr clone = pI830->xf86_config.output[c]; I830OutputPrivatePtr intel_clone = clone->driver_private; if (o != c && ((1 << intel_clone->type) & clone_types)) @@ -793,9 +793,9 @@ I830RandRCreateObjects12 (ScrnInfoPtr pScrn) /* * Configure crtcs */ - for (p = 0; p < pI830->num_pipes; p++) + for (p = 0; p < pI830->xf86_config.num_crtc; p++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[p]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[p]; RRCrtcGammaSetSize (crtc->randr_crtc, 256); } @@ -815,21 +815,21 @@ I830RandRCreateScreenResources12 (ScreenPtr pScreen) /* * Attach RandR objects to screen */ - for (p = 0; p < pI830->num_pipes; p++) - if (!RRCrtcAttachScreen (pI830->xf86_crtc[p]->randr_crtc, pScreen)) + for (p = 0; p < pI830->xf86_config.num_crtc; p++) + if (!RRCrtcAttachScreen (pI830->xf86_config.crtc[p]->randr_crtc, pScreen)) return FALSE; - for (o = 0; o < pI830->num_outputs; o++) - if (!RROutputAttachScreen (pI830->xf86_output[o]->randr_output, pScreen)) + for (o = 0; o < pI830->xf86_config.num_output; o++) + if (!RROutputAttachScreen (pI830->xf86_config.output[o]->randr_output, pScreen)) return FALSE; /* * Compute width of screen */ width = 0; height = 0; - for (p = 0; p < pI830->num_pipes; p++) + for (p = 0; p < pI830->xf86_config.num_crtc; p++) { - I830_xf86CrtcPtr crtc = pI830->xf86_crtc[p]; + xf86CrtcPtr crtc = pI830->xf86_config.crtc[p]; int crtc_width = crtc->x + crtc->curMode.HDisplay; int crtc_height = crtc->y + crtc->curMode.VDisplay; @@ -859,8 +859,8 @@ I830RandRCreateScreenResources12 (ScreenPtr pScreen) mmHeight); } - for (p = 0; p < pI830->num_pipes; p++) - I830RandRCrtcNotify (pI830->xf86_crtc[p]->randr_crtc); + for (p = 0; p < pI830->xf86_config.num_crtc; p++) + I830RandRCrtcNotify (pI830->xf86_config.crtc[p]->randr_crtc); if (randrp->virtualX == -1 || randrp->virtualY == -1) { @@ -963,7 +963,7 @@ static int I830RRPickCrtcs (RROutputPtr *outputs, RRCrtcPtr *best_crtcs, RRModePtr *modes, - int num_outputs, + int num_output, int n) { int c, o, l; @@ -975,7 +975,7 @@ I830RRPickCrtcs (RROutputPtr *outputs, int score; int my_score; - if (n == num_outputs) + if (n == num_output) return 0; output = outputs[n]; @@ -984,11 +984,11 @@ I830RRPickCrtcs (RROutputPtr *outputs, */ best_crtcs[n] = NULL; best_crtc = NULL; - best_score = I830RRPickCrtcs (outputs, best_crtcs, modes, num_outputs, n+1); + best_score = I830RRPickCrtcs (outputs, best_crtcs, modes, num_output, n+1); if (modes[n] == NULL) return best_score; - crtcs = xalloc (num_outputs * sizeof (RRCrtcPtr)); + crtcs = xalloc (num_output * sizeof (RRCrtcPtr)); if (!crtcs) return best_score; @@ -1034,12 +1034,12 @@ I830RRPickCrtcs (RROutputPtr *outputs, crtcs[n] = crtc; memcpy (crtcs, best_crtcs, n * sizeof (RRCrtcPtr)); score = my_score + I830RRPickCrtcs (outputs, crtcs, modes, - num_outputs, n+1); + num_output, n+1); if (score >= best_score) { best_crtc = crtc; best_score = score; - memcpy (best_crtcs, crtcs, num_outputs * sizeof (RRCrtcPtr)); + memcpy (best_crtcs, crtcs, num_output * sizeof (RRCrtcPtr)); } } xfree (crtcs); @@ -1050,18 +1050,18 @@ static Bool I830RRInitialConfiguration (RROutputPtr *outputs, RRCrtcPtr *crtcs, RRModePtr *modes, - int num_outputs) + int num_output) { int o; RRModePtr target_mode = NULL; - for (o = 0; o < num_outputs; o++) + for (o = 0; o < num_output; o++) modes[o] = NULL; /* * Let outputs with preferred modes drive screen size */ - for (o = 0; o < num_outputs; o++) + for (o = 0; o < num_output; o++) { RROutputPtr output = outputs[o]; @@ -1077,7 +1077,7 @@ I830RRInitialConfiguration (RROutputPtr *outputs, } if (!target_mode) { - for (o = 0; o < num_outputs; o++) + for (o = 0; o < num_output; o++) { RROutputPtr output = outputs[o]; if (output->connection != RR_Disconnected) @@ -1091,7 +1091,7 @@ I830RRInitialConfiguration (RROutputPtr *outputs, } } } - for (o = 0; o < num_outputs; o++) + for (o = 0; o < num_output; o++) { RROutputPtr output = outputs[o]; @@ -1099,7 +1099,7 @@ I830RRInitialConfiguration (RROutputPtr *outputs, modes[o] = I830ClosestMode (output, target_mode); } - if (!I830RRPickCrtcs (outputs, crtcs, modes, num_outputs, 0)) + if (!I830RRPickCrtcs (outputs, crtcs, modes, num_output, 0)) return FALSE; return TRUE; @@ -1111,7 +1111,7 @@ I830RRInitialConfiguration (RROutputPtr *outputs, */ static void -I830RRDefaultScreenLimits (RROutputPtr *outputs, int num_outputs, +I830RRDefaultScreenLimits (RROutputPtr *outputs, int num_output, RRCrtcPtr *crtcs, int num_crtc, int *widthp, int *heightp) { @@ -1126,7 +1126,7 @@ I830RRDefaultScreenLimits (RROutputPtr *outputs, int num_outputs, RRCrtcPtr crtc = crtcs[c]; int crtc_width = 1600, crtc_height = 1200; - for (o = 0; o < num_outputs; o++) + for (o = 0; o < num_output; o++) { RROutputPtr output = outputs[o]; @@ -1168,7 +1168,7 @@ I830RandRPreInit (ScrnInfoPtr pScrn) int c; #endif - if (pI830->num_outputs <= 0) + if (pI830->xf86_config.num_output <= 0) return FALSE; i830_reprobe_output_modes(pScrn); @@ -1186,17 +1186,17 @@ I830RandRPreInit (ScrnInfoPtr pScrn) * With RandR info set up, let RandR choose * the initial configuration */ - for (o = 0; o < pI830->num_outputs; o++) - outputs[o] = pI830->xf86_output[o]->randr_output; - for (c = 0; c < pI830->num_pipes; c++) - crtcs[c] = pI830->xf86_crtc[c]->randr_crtc; + for (o = 0; o < pI830->xf86_config.num_output; o++) + outputs[o] = pI830->xf86_config.output[o]->randr_output; + for (c = 0; c < pI830->xf86_config.num_crtc; c++) + crtcs[c] = pI830->xf86_config.crtc[c]->randr_crtc; if (!I830RRInitialConfiguration (outputs, output_crtcs, output_modes, - pI830->num_outputs)) + pI830->xf86_config.num_output)) return FALSE; - I830RRDefaultScreenLimits (outputs, pI830->num_outputs, - crtcs, pI830->num_pipes, + I830RRDefaultScreenLimits (outputs, pI830->xf86_config.num_output, + crtcs, pI830->xf86_config.num_crtc, &width, &height); if (width > pScrn->virtualX) @@ -1211,16 +1211,16 @@ I830RandRPreInit (ScrnInfoPtr pScrn) /* XXX override xf86 common frame computation code */ pScrn->display->frameX0 = 0; pScrn->display->frameY0 = 0; - for (o = 0; o < pI830->num_outputs; o++) + for (o = 0; o < pI830->xf86_config.num_output; o++) { - I830_xf86OutputPtr output = pI830->xf86_output[o]; + xf86OutputPtr output = pI830->xf86_config.output[o]; RRModePtr randr_mode = output_modes[o]; RRCrtcPtr randr_crtc = output_crtcs[o]; DisplayModePtr mode; if (randr_mode && randr_crtc) { - I830_xf86CrtcPtr crtc = randr_crtc->devPrivate; + xf86CrtcPtr crtc = randr_crtc->devPrivate; mode = (DisplayModePtr) randr_mode->devPrivate; crtc->desiredMode = *mode; diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index a8eba4c0..c685a8d1 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -80,7 +80,7 @@ struct i830_sdvo_priv { }; /** Read a single byte from the given address on the SDVO device. */ -static Bool i830_sdvo_read_byte(I830_xf86OutputPtr output, int addr, +static Bool i830_sdvo_read_byte(xf86OutputPtr output, int addr, unsigned char *ch) { I830OutputPrivatePtr intel_output = output->driver_private; @@ -96,7 +96,7 @@ static Bool i830_sdvo_read_byte(I830_xf86OutputPtr output, int addr, } /** Write a single byte to the given address on the SDVO device. */ -static Bool i830_sdvo_write_byte(I830_xf86OutputPtr output, +static Bool i830_sdvo_write_byte(xf86OutputPtr output, int addr, unsigned char ch) { I830OutputPrivatePtr intel_output = output->driver_private; @@ -166,7 +166,7 @@ static I2CSlaveAddr slaveAddr; * Writes out the data given in args (up to 8 bytes), followed by the opcode. */ static void -i830_sdvo_write_cmd(I830_xf86OutputPtr output, CARD8 cmd, void *args, int args_len) +i830_sdvo_write_cmd(xf86OutputPtr output, CARD8 cmd, void *args, int args_len) { I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; @@ -213,7 +213,7 @@ static const char *cmd_status_names[] = { * Reads back response_len bytes from the SDVO device, and returns the status. */ static CARD8 -i830_sdvo_read_response(I830_xf86OutputPtr output, void *response, int response_len) +i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len) { I830OutputPrivatePtr intel_output = output->driver_private; int i; @@ -262,13 +262,13 @@ i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode) * STOP. PROM access is terminated by accessing an internal register. */ static void -i830_sdvo_set_control_bus_switch(I830_xf86OutputPtr output, CARD8 target) +i830_sdvo_set_control_bus_switch(xf86OutputPtr output, CARD8 target) { i830_sdvo_write_cmd(output, SDVO_CMD_SET_CONTROL_BUS_SWITCH, &target, 1); } static Bool -i830_sdvo_set_target_input(I830_xf86OutputPtr output, Bool target_0, Bool target_1) +i830_sdvo_set_target_input(xf86OutputPtr output, Bool target_0, Bool target_1) { struct i830_sdvo_set_target_input_args targets = {0}; CARD8 status; @@ -294,7 +294,7 @@ i830_sdvo_set_target_input(I830_xf86OutputPtr output, Bool target_0, Bool target * which should be checked against the docs. */ static Bool -i830_sdvo_get_trained_inputs(I830_xf86OutputPtr output, Bool *input_1, Bool *input_2) +i830_sdvo_get_trained_inputs(xf86OutputPtr output, Bool *input_1, Bool *input_2) { struct i830_sdvo_get_trained_inputs_response response; CARD8 status; @@ -312,7 +312,7 @@ i830_sdvo_get_trained_inputs(I830_xf86OutputPtr output, Bool *input_1, Bool *inp } static Bool -i830_sdvo_get_active_outputs(I830_xf86OutputPtr output, +i830_sdvo_get_active_outputs(xf86OutputPtr output, CARD16 *outputs) { CARD8 status; @@ -324,7 +324,7 @@ i830_sdvo_get_active_outputs(I830_xf86OutputPtr output, } static Bool -i830_sdvo_set_active_outputs(I830_xf86OutputPtr output, +i830_sdvo_set_active_outputs(xf86OutputPtr output, CARD16 outputs) { CARD8 status; @@ -340,7 +340,7 @@ i830_sdvo_set_active_outputs(I830_xf86OutputPtr output, * Returns the pixel clock range limits of the current target input in kHz. */ static Bool -i830_sdvo_get_input_pixel_clock_range(I830_xf86OutputPtr output, int *clock_min, +i830_sdvo_get_input_pixel_clock_range(xf86OutputPtr output, int *clock_min, int *clock_max) { struct i830_sdvo_pixel_clock_range clocks; @@ -361,7 +361,7 @@ i830_sdvo_get_input_pixel_clock_range(I830_xf86OutputPtr output, int *clock_min, } static Bool -i830_sdvo_set_target_output(I830_xf86OutputPtr output, CARD16 outputs) +i830_sdvo_set_target_output(xf86OutputPtr output, CARD16 outputs) { CARD8 status; @@ -375,7 +375,7 @@ i830_sdvo_set_target_output(I830_xf86OutputPtr output, CARD16 outputs) /** Fetches either input or output timings to *dtd, depending on cmd. */ static Bool -i830_sdvo_get_timing(I830_xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd *dtd) +i830_sdvo_get_timing(xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd *dtd) { CARD8 status; @@ -395,20 +395,20 @@ i830_sdvo_get_timing(I830_xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd } static Bool -i830_sdvo_get_input_timing(I830_xf86OutputPtr output, struct i830_sdvo_dtd *dtd) +i830_sdvo_get_input_timing(xf86OutputPtr output, struct i830_sdvo_dtd *dtd) { return i830_sdvo_get_timing(output, SDVO_CMD_GET_INPUT_TIMINGS_PART1, dtd); } static Bool -i830_sdvo_get_output_timing(I830_xf86OutputPtr output, struct i830_sdvo_dtd *dtd) +i830_sdvo_get_output_timing(xf86OutputPtr output, struct i830_sdvo_dtd *dtd) { return i830_sdvo_get_timing(output, SDVO_CMD_GET_OUTPUT_TIMINGS_PART1, dtd); } /** Sets either input or output timings from *dtd, depending on cmd. */ static Bool -i830_sdvo_set_timing(I830_xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd *dtd) +i830_sdvo_set_timing(xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd *dtd) { CARD8 status; @@ -426,20 +426,20 @@ i830_sdvo_set_timing(I830_xf86OutputPtr output, CARD8 cmd, struct i830_sdvo_dtd } static Bool -i830_sdvo_set_input_timing(I830_xf86OutputPtr output, struct i830_sdvo_dtd *dtd) +i830_sdvo_set_input_timing(xf86OutputPtr output, struct i830_sdvo_dtd *dtd) { return i830_sdvo_set_timing(output, SDVO_CMD_SET_INPUT_TIMINGS_PART1, dtd); } static Bool -i830_sdvo_set_output_timing(I830_xf86OutputPtr output, struct i830_sdvo_dtd *dtd) +i830_sdvo_set_output_timing(xf86OutputPtr output, struct i830_sdvo_dtd *dtd) { return i830_sdvo_set_timing(output, SDVO_CMD_SET_OUTPUT_TIMINGS_PART1, dtd); } #if 0 static Bool -i830_sdvo_create_preferred_input_timing(I830_xf86OutputPtr output, CARD16 clock, +i830_sdvo_create_preferred_input_timing(xf86OutputPtr output, CARD16 clock, CARD16 width, CARD16 height) { struct i830_sdvo_priv *dev_priv = output->dev_priv; @@ -483,7 +483,7 @@ i830_sdvo_get_preferred_input_timing(I830OutputPtr output, /** Returns the SDVO_CLOCK_RATE_MULT_* for the current clock multiplier */ static int -i830_sdvo_get_clock_rate_mult(I830_xf86OutputPtr output) +i830_sdvo_get_clock_rate_mult(xf86OutputPtr output) { I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; @@ -512,7 +512,7 @@ i830_sdvo_get_clock_rate_mult(I830_xf86OutputPtr output) * is actually turned on. */ static Bool -i830_sdvo_set_clock_rate_mult(I830_xf86OutputPtr output, CARD8 val) +i830_sdvo_set_clock_rate_mult(xf86OutputPtr output, CARD8 val) { CARD8 status; @@ -525,7 +525,7 @@ i830_sdvo_set_clock_rate_mult(I830_xf86OutputPtr output, CARD8 val) } static void -i830_sdvo_pre_set_mode(I830_xf86OutputPtr output, DisplayModePtr mode) +i830_sdvo_pre_set_mode(xf86OutputPtr output, DisplayModePtr mode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -627,12 +627,12 @@ i830_sdvo_pre_set_mode(I830_xf86OutputPtr output, DisplayModePtr mode) } static void -i830_sdvo_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr mode) +i830_sdvo_post_set_mode(xf86OutputPtr output, DisplayModePtr mode) { ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; - I830_xf86CrtcPtr crtc = output->crtc; + xf86CrtcPtr crtc = output->crtc; I830CrtcPrivatePtr intel_crtc = crtc->driver_private; I830Ptr pI830 = I830PTR(pScrn); Bool input1, input2; @@ -690,7 +690,7 @@ i830_sdvo_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr mode) } static void -i830_sdvo_dpms(I830_xf86OutputPtr output, int mode) +i830_sdvo_dpms(xf86OutputPtr output, int mode) { ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr intel_output = output->driver_private; @@ -707,7 +707,7 @@ i830_sdvo_dpms(I830_xf86OutputPtr output, int mode) } static void -i830_sdvo_save(I830_xf86OutputPtr output) +i830_sdvo_save(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr intel_output = output->driver_private; @@ -744,7 +744,7 @@ i830_sdvo_save(I830_xf86OutputPtr output) } static void -i830_sdvo_restore(I830_xf86OutputPtr output) +i830_sdvo_restore(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830OutputPrivatePtr intel_output = output->driver_private; @@ -779,7 +779,7 @@ i830_sdvo_restore(I830_xf86OutputPtr output) } static int -i830_sdvo_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_sdvo_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) { I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; @@ -797,7 +797,7 @@ i830_sdvo_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) } static Bool -i830_sdvo_get_capabilities(I830_xf86OutputPtr output, struct i830_sdvo_caps *caps) +i830_sdvo_get_capabilities(xf86OutputPtr output, struct i830_sdvo_caps *caps) { CARD8 status; @@ -813,9 +813,10 @@ i830_sdvo_get_capabilities(I830_xf86OutputPtr output, struct i830_sdvo_caps *cap static Bool i830_sdvo_ddc_i2c_get_byte(I2CDevPtr d, I2CByte *data, Bool last) { - I830OutputPtr output = d->pI2CBus->DriverPrivate.ptr; - I2CBusPtr i2cbus = output->pI2CBus, savebus; - Bool ret; + xf86OutputPtr output = d->DriverPrivate.ptr; + I830OutputPrivatePtr intel_output = output->driver_private; + I2CBusPtr i2cbus = intel_output->pI2CBus, savebus; + Bool ret; savebus = d->pI2CBus; d->pI2CBus = i2cbus; @@ -829,9 +830,10 @@ i830_sdvo_ddc_i2c_get_byte(I2CDevPtr d, I2CByte *data, Bool last) static Bool i830_sdvo_ddc_i2c_put_byte(I2CDevPtr d, I2CByte c) { - I830OutputPtr output = d->pI2CBus->DriverPrivate.ptr; - I2CBusPtr i2cbus = output->pI2CBus, savebus; - Bool ret; + xf86OutputPtr output = d->DriverPrivate.ptr; + I830OutputPrivatePtr intel_output = output->driver_private; + I2CBusPtr i2cbus = intel_output->pI2CBus, savebus; + Bool ret; savebus = d->pI2CBus; d->pI2CBus = i2cbus; @@ -851,7 +853,7 @@ i830_sdvo_ddc_i2c_put_byte(I2CDevPtr d, I2CByte c) static Bool i830_sdvo_ddc_i2c_start(I2CBusPtr b, int timeout) { - I830_xf86OutputPtr output = b->DriverPrivate.ptr; + xf86OutputPtr output = b->DriverPrivate.ptr; I830OutputPrivatePtr intel_output = output->driver_private; I2CBusPtr i2cbus = intel_output->pI2CBus; @@ -863,7 +865,7 @@ i830_sdvo_ddc_i2c_start(I2CBusPtr b, int timeout) static void i830_sdvo_ddc_i2c_stop(I2CDevPtr d) { - I830_xf86OutputPtr output = d->DriverPrivate.ptr; + xf86OutputPtr output = d->DriverPrivate.ptr; I830OutputPrivatePtr intel_output = output->driver_private; I2CBusPtr i2cbus = intel_output->pI2CBus, savebus; @@ -900,7 +902,7 @@ i830_sdvo_ddc_i2c_address(I2CDevPtr d, I2CSlaveAddr addr) } static void -i830_sdvo_dump_cmd(I830_xf86OutputPtr output, int opcode) +i830_sdvo_dump_cmd(xf86OutputPtr output, int opcode) { CARD8 response[8]; @@ -909,7 +911,7 @@ i830_sdvo_dump_cmd(I830_xf86OutputPtr output, int opcode) } static void -i830_sdvo_dump_device(I830_xf86OutputPtr output) +i830_sdvo_dump_device(xf86OutputPtr output) { I830OutputPrivatePtr intel_output = output->driver_private; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; @@ -944,9 +946,9 @@ i830_sdvo_dump(ScrnInfoPtr pScrn) I830Ptr pI830 = I830PTR(pScrn); int i; - for (i = 0; i < pI830->num_outputs; i++) + for (i = 0; i < pI830->xf86_config.num_output; i++) { - I830_xf86OutputPtr output = pI830->xf86_output[i]; + xf86OutputPtr output = pI830->xf86_config.output[i]; I830OutputPrivatePtr intel_output = output->driver_private; if (intel_output->type == I830_OUTPUT_SDVO) @@ -964,7 +966,7 @@ i830_sdvo_dump(ScrnInfoPtr pScrn) * Takes 14ms on average on my i945G. */ static enum detect_status -i830_sdvo_detect(I830_xf86OutputPtr output) +i830_sdvo_detect(xf86OutputPtr output) { CARD8 response[2]; CARD8 status; @@ -982,7 +984,7 @@ i830_sdvo_detect(I830_xf86OutputPtr output) } static void -i830_sdvo_destroy (I830_xf86OutputPtr output) +i830_sdvo_destroy (xf86OutputPtr output) { I830OutputPrivatePtr intel_output = output->driver_private; @@ -997,7 +999,7 @@ i830_sdvo_destroy (I830_xf86OutputPtr output) } } -static const I830_xf86OutputFuncsRec i830_sdvo_output_funcs = { +static const xf86OutputFuncsRec i830_sdvo_output_funcs = { .dpms = i830_sdvo_dpms, .save = i830_sdvo_save, .restore = i830_sdvo_restore, @@ -1012,22 +1014,22 @@ static const I830_xf86OutputFuncsRec i830_sdvo_output_funcs = { void i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) { - I830_xf86OutputPtr output; + xf86OutputPtr output; I830OutputPrivatePtr intel_output; struct i830_sdvo_priv *dev_priv; int i; unsigned char ch[0x40]; I2CBusPtr i2cbus = NULL, ddcbus; - output = i830xf86OutputCreate (pScrn, &i830_sdvo_output_funcs, - "ADD2 PCIE card"); + output = xf86OutputCreate (pScrn, &i830_sdvo_output_funcs, + "ADD2 PCIE card"); if (!output) return; intel_output = xnfcalloc (sizeof (I830OutputPrivateRec) + sizeof (struct i830_sdvo_priv), 1); if (!intel_output) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } output->driver_private = intel_output; @@ -1045,7 +1047,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) if (i2cbus == NULL) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } @@ -1065,7 +1067,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize %s I2C device\n", SDVO_NAME(dev_priv)); - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } @@ -1077,7 +1079,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) ddcbus = xf86CreateI2CBusRec(); if (ddcbus == NULL) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } if (output_device == SDVOB) @@ -1094,7 +1096,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) if (!xf86I2CBusInit(ddcbus)) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } @@ -1105,7 +1107,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) /* Read the regs to test if we can talk to the device */ for (i = 0; i < 0x40; i++) { if (!i830_sdvo_read_byte(output, i, &ch[i])) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } } diff --git a/src/i830_tv.c b/src/i830_tv.c index ec78337a..c2192500 100644 --- a/src/i830_tv.c +++ b/src/i830_tv.c @@ -38,6 +38,7 @@ #include "i830_display.h" enum tv_type { + TV_TYPE_NONE, TV_TYPE_UNKNOWN, TV_TYPE_COMPOSITE, TV_TYPE_SVIDEO, @@ -46,6 +47,7 @@ enum tv_type { /** Private structure for the integrated TV support */ struct i830_tv_priv { + int type; CARD32 save_TV_H_CTL_1; CARD32 save_TV_H_CTL_2; CARD32 save_TV_H_CTL_3; @@ -141,69 +143,8 @@ const struct tv_mode { } }; - -static int -i830_tv_detect_type(I830_xf86OutputPtr output) -{ - ScrnInfoPtr pScrn = output->scrn; - I830Ptr pI830 = I830PTR(pScrn); - I830_xf86CrtcPtr crtc = output->crtc; - I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - CARD32 save_tv_ctl, save_tv_dac; - CARD32 tv_ctl, tv_dac; - - save_tv_ctl = INREG(TV_CTL); - save_tv_dac = INREG(TV_DAC); - - /* First, we have to disable the encoder but source from the right pipe, - * which is already enabled. - */ - tv_ctl = INREG(TV_CTL) & ~(TV_ENC_ENABLE | TV_ENC_PIPEB_SELECT); - if (intel_crtc->pipe == 1) - tv_ctl |= TV_ENC_PIPEB_SELECT; - OUTREG(TV_CTL, tv_ctl); - - /* Then set the voltage overrides. */ - tv_dac = DAC_CTL_OVERRIDE | DAC_A_0_7_V | DAC_B_0_7_V | DAC_C_0_7_V; - OUTREG(TV_DAC, tv_dac); - - /* Enable sensing of the load. */ - tv_ctl |= TV_TEST_MODE_MONITOR_DETECT; - OUTREG(TV_CTL, tv_ctl); - - tv_dac |= TVDAC_STATE_CHG_EN | TVDAC_A_SENSE_CTL | TVDAC_B_SENSE_CTL | - TVDAC_C_SENSE_CTL; - OUTREG(TV_DAC, tv_dac); - - /* Wait for things to take effect. */ - i830WaitForVblank(pScrn); - - tv_dac = INREG(TV_DAC); - - OUTREG(TV_DAC, save_tv_dac); - OUTREG(TV_CTL, save_tv_ctl); - - if ((tv_dac & TVDAC_SENSE_MASK) == (TVDAC_B_SENSE | TVDAC_C_SENSE)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected Composite TV connection\n"); - return TV_TYPE_COMPOSITE; - } else if ((tv_dac & TVDAC_SENSE_MASK) == TVDAC_A_SENSE) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected S-Video TV connection\n"); - return TV_TYPE_SVIDEO; - } else if ((tv_dac & TVDAC_SENSE_MASK) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Detected Component TV connection\n"); - return TV_TYPE_COMPONENT; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Couldn't detect TV connection\n"); - return TV_TYPE_UNKNOWN; - } -} - static void -i830_tv_dpms(I830_xf86OutputPtr output, int mode) +i830_tv_dpms(xf86OutputPtr output, int mode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -221,7 +162,7 @@ i830_tv_dpms(I830_xf86OutputPtr output, int mode) } static void -i830_tv_save(I830_xf86OutputPtr output) +i830_tv_save(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -247,7 +188,7 @@ i830_tv_save(I830_xf86OutputPtr output) } static void -i830_tv_restore(I830_xf86OutputPtr output) +i830_tv_restore(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -273,13 +214,13 @@ i830_tv_restore(I830_xf86OutputPtr output) } static int -i830_tv_mode_valid(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_tv_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) { return MODE_OK; } static void -i830_tv_pre_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_tv_pre_set_mode(xf86OutputPtr output, DisplayModePtr pMode) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -355,20 +296,22 @@ static const CARD32 v_chroma[43] = { }; static void -i830_tv_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) +i830_tv_post_set_mode(xf86OutputPtr output, DisplayModePtr pMode) { - ScrnInfoPtr pScrn = output->scrn; - I830Ptr pI830 = I830PTR(pScrn); - I830_xf86CrtcPtr crtc = output->crtc; - I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - enum tv_type type; - const struct tv_mode *tv_mode; + ScrnInfoPtr pScrn = output->scrn; + I830Ptr pI830 = I830PTR(pScrn); + xf86CrtcPtr crtc = output->crtc; + I830OutputPrivatePtr intel_output = output->driver_private; + I830CrtcPrivatePtr intel_crtc = crtc->driver_private; + struct i830_tv_priv *dev_priv = intel_output->dev_priv; + enum tv_type type; + const struct tv_mode *tv_mode; const struct tv_sc_mode *sc_mode; - CARD32 tv_ctl, tv_filter_ctl; - CARD32 hctl1, hctl2, hctl3; - CARD32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7; - CARD32 scctl1, scctl2, scctl3; - int i; + CARD32 tv_ctl, tv_filter_ctl; + CARD32 hctl1, hctl2, hctl3; + CARD32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7; + CARD32 scctl1, scctl2, scctl3; + int i; /* Need to actually choose or construct the appropriate * mode. For now, just set the first one in the list, with @@ -377,7 +320,7 @@ i830_tv_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) tv_mode = &tv_modes[0]; sc_mode = &tv_sc_modes[TV_SC_NTSC_MJ]; - type = i830_tv_detect_type(output); + type = dev_priv->type; hctl1 = (tv_mode->hsync_end << TV_HSYNC_END_SHIFT) | (tv_mode->htotal << TV_HTOTAL_SHIFT); @@ -503,6 +446,99 @@ i830_tv_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) OUTREG(TV_CTL, tv_ctl); } +static const DisplayModeRec tvModes[] = { + { + .name = "NTSC 480i", + .Clock = 108000, + + .HDisplay = 1024, + .HSyncStart = 1048, + .HSyncEnd = 1184, + .HTotal = 1344, + + .VDisplay = 768, + .VSyncStart = 771, + .VSyncEnd = 777, + .VTotal = 806, + + .type = M_T_DEFAULT + } +}; + +/** + * Detects TV presence by checking for load. + * + * Requires that the current pipe's DPLL is active. + + * \return TRUE if TV is connected. + * \return FALSE if TV is disconnected. + */ +static int +i830_tv_detect_type (xf86CrtcPtr crtc, + xf86OutputPtr output) +{ + ScrnInfoPtr pScrn = output->scrn; + I830Ptr pI830 = I830PTR(pScrn); + I830OutputPrivatePtr intel_output = output->driver_private; + struct i830_tv_priv *dev_priv = intel_output->dev_priv; + CARD32 tv_ctl, save_tv_ctl; + CARD32 tv_dac, save_tv_dac; + int type = TV_TYPE_UNKNOWN; + + tv_dac = INREG(TV_DAC); + /* + * Detect TV by polling) + */ + if (intel_output->load_detect_temp) + { + /* TV not currently running, prod it with destructive detect */ + save_tv_dac = tv_dac; + tv_ctl = INREG(TV_CTL); + save_tv_ctl = tv_ctl; + tv_ctl &= ~TV_ENC_ENABLE; + tv_ctl &= ~TV_TEST_MODE_MASK; + tv_ctl |= TV_TEST_MODE_MONITOR_DETECT; + tv_dac &= ~TVDAC_SENSE_MASK; + tv_dac |= (TVDAC_STATE_CHG_EN | + TVDAC_A_SENSE_CTL | + TVDAC_B_SENSE_CTL | + TVDAC_C_SENSE_CTL); + tv_dac = DAC_CTL_OVERRIDE | DAC_A_0_7_V | DAC_B_0_7_V | DAC_C_0_7_V; + OUTREG(TV_CTL, tv_ctl); + OUTREG(TV_DAC, tv_dac); + i830WaitForVblank(pScrn); + tv_dac = INREG(TV_DAC); + OUTREG(TV_DAC, save_tv_dac); + OUTREG(TV_CTL, save_tv_ctl); + } + /* + * A B C + * 0 1 1 Composite + * 1 0 X svideo + * 0 0 0 Component + */ + if ((tv_dac & TVDAC_SENSE_MASK) == (TVDAC_B_SENSE | TVDAC_C_SENSE)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected Composite TV connection\n"); + type = TV_TYPE_COMPOSITE; + } else if ((tv_dac & (TVDAC_A_SENSE|TVDAC_B_SENSE)) == TVDAC_A_SENSE) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected S-Video TV connection\n"); + type = TV_TYPE_SVIDEO; + } else if ((tv_dac & TVDAC_SENSE_MASK) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Detected Component TV connection\n"); + type = TV_TYPE_COMPONENT; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Couldn't detect TV connection\n"); + type = TV_TYPE_NONE; + } + + dev_priv->type = type; + return type; +} + /** * Detect the TV connection. * @@ -510,10 +546,34 @@ i830_tv_post_set_mode(I830_xf86OutputPtr output, DisplayModePtr pMode) * we have a pipe programmed in order to probe the TV. */ static enum detect_status -i830_tv_detect(I830_xf86OutputPtr output) +i830_tv_detect(xf86OutputPtr output) { - /* XXX need to load-detect */ - return OUTPUT_STATUS_CONNECTED; + xf86CrtcPtr crtc; + DisplayModeRec mode; + I830OutputPrivatePtr intel_output = output->driver_private; + int type; + + crtc = i830GetLoadDetectPipe (output); + if (!crtc) + return OUTPUT_STATUS_UNKNOWN; + + if (intel_output->load_detect_temp) + { + mode = tvModes[0]; + I830xf86SetModeCrtc (&mode, INTERLACE_HALVE_V); + i830PipeSetMode (crtc, &mode, FALSE); + } + type = i830_tv_detect_type (crtc, output); + i830ReleaseLoadDetectPipe (output); + + switch (type) { + case TV_TYPE_NONE: + return OUTPUT_STATUS_DISCONNECTED; + case TV_TYPE_UNKNOWN: + return OUTPUT_STATUS_UNKNOWN; + default: + return OUTPUT_STATUS_CONNECTED; + } } /** @@ -523,7 +583,7 @@ i830_tv_detect(I830_xf86OutputPtr output) * how to probe modes off of TV connections. */ static DisplayModePtr -i830_tv_get_modes(I830_xf86OutputPtr output) +i830_tv_get_modes(xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); @@ -565,13 +625,13 @@ i830_tv_get_modes(I830_xf86OutputPtr output) } static void -i830_tv_destroy (I830_xf86OutputPtr output) +i830_tv_destroy (xf86OutputPtr output) { if (output->driver_private) xfree (output->driver_private); } -static const I830_xf86OutputFuncsRec i830_tv_output_funcs = { +static const xf86OutputFuncsRec i830_tv_output_funcs = { .dpms = i830_tv_dpms, .save = i830_tv_save, .restore = i830_tv_restore, @@ -587,15 +647,14 @@ void i830_tv_init(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - I830_xf86OutputPtr output; + xf86OutputPtr output; I830OutputPrivatePtr intel_output; struct i830_tv_priv *dev_priv; if ((INREG(TV_CTL) & TV_FUSE_STATE_MASK) == TV_FUSE_STATE_DISABLED) return; - output = i830xf86OutputCreate (pScrn, &i830_tv_output_funcs, - "TV"); + output = xf86OutputCreate (pScrn, &i830_tv_output_funcs, "TV"); if (!output) return; @@ -604,12 +663,13 @@ i830_tv_init(ScrnInfoPtr pScrn) sizeof (struct i830_tv_priv), 1); if (!intel_output) { - i830xf86OutputDestroy (output); + xf86OutputDestroy (output); return; } dev_priv = (struct i830_tv_priv *) (intel_output + 1); intel_output->type = I830_OUTPUT_SDVO; intel_output->dev_priv = dev_priv; + dev_priv->type = TV_TYPE_UNKNOWN; output->driver_private = intel_output; } diff --git a/src/i830_video.c b/src/i830_video.c index 5ce2b5d3..2f626b2a 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -3595,7 +3595,7 @@ I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode) } /* Check we have an LFP connected */ - if (i830PipeHasType (pI830->xf86_crtc[pPriv->pipe], I830_OUTPUT_LVDS)) + if (i830PipeHasType (pI830->xf86_config.crtc[pPriv->pipe], I830_OUTPUT_LVDS)) { size = pPriv->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC); hsize = (size >> 16) & 0x7FF; diff --git a/src/i830_xf86Crtc.c b/src/i830_xf86Crtc.c index 630f3fad..2eb775bf 100644 --- a/src/i830_xf86Crtc.c +++ b/src/i830_xf86Crtc.c @@ -31,57 +31,70 @@ #include <stdio.h> #include "xf86.h" -#include "i830.h" -#include "i830_xf86Modes.h" #include "i830_xf86Crtc.h" /* * Crtc functions */ -I830_xf86CrtcPtr -i830xf86CrtcCreate (ScrnInfoPtr scrn, - const I830_xf86CrtcFuncsRec *funcs) +xf86CrtcPtr +xf86CrtcCreate (ScrnInfoPtr scrn, + const xf86CrtcFuncsRec *funcs) { - I830_xf86CrtcPtr xf86_crtc; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + xf86CrtcPtr crtc; - xf86_crtc = xcalloc (sizeof (I830_xf86CrtcRec), 1); - if (!xf86_crtc) + crtc = xcalloc (sizeof (xf86CrtcRec), 1); + if (!crtc) return NULL; - xf86_crtc->scrn = scrn; - xf86_crtc->funcs = funcs; + crtc->scrn = scrn; + crtc->funcs = funcs; #ifdef RANDR_12_INTERFACE - xf86_crtc->randr_crtc = RRCrtcCreate (xf86_crtc); - if (!xf86_crtc->randr_crtc) + crtc->randr_crtc = RRCrtcCreate (crtc); + if (!crtc->randr_crtc) { - xfree (xf86_crtc); + xfree (crtc); return NULL; } #endif - return xf86_crtc; + xf86_config->crtc[xf86_config->num_crtc++] = crtc; + return crtc; } void -i830xf86CrtcDestroy (I830_xf86CrtcPtr xf86_crtc) +xf86CrtcDestroy (xf86CrtcPtr crtc) { + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn); + int c; + + (*crtc->funcs->destroy) (crtc); #ifdef RANDR_12_INTERFACE - RRCrtcDestroy (xf86_crtc->randr_crtc); + RRCrtcDestroy (crtc->randr_crtc); #endif - xfree (xf86_crtc); + for (c = 0; c < xf86_config->num_crtc; c++) + if (xf86_config->crtc[c] == crtc) + { + memmove (&xf86_config->crtc[c], + &xf86_config->crtc[c+1], + xf86_config->num_crtc - (c + 1)); + xf86_config->num_crtc--; + break; + } + xfree (crtc); } /* * Output functions */ -I830_xf86OutputPtr -i830xf86OutputCreate (ScrnInfoPtr scrn, - const I830_xf86OutputFuncsRec *funcs, - const char *name) +xf86OutputPtr +xf86OutputCreate (ScrnInfoPtr scrn, + const xf86OutputFuncsRec *funcs, + const char *name) { - I830_xf86OutputPtr output; - I830Ptr pI830 = I830PTR(scrn); + xf86OutputPtr output; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int len = strlen (name); - output = xcalloc (sizeof (I830_xf86OutputRec) + len + 1, 1); + output = xcalloc (sizeof (xf86OutputRec) + len + 1, 1); if (!output) return NULL; output->scrn = scrn; @@ -96,16 +109,16 @@ i830xf86OutputCreate (ScrnInfoPtr scrn, return NULL; } #endif - pI830->xf86_output[pI830->num_outputs++] = output; + xf86_config->output[xf86_config->num_output++] = output; return output; } void -i830xf86OutputDestroy (I830_xf86OutputPtr output) +xf86OutputDestroy (xf86OutputPtr output) { - ScrnInfoPtr scrn = output->scrn; - I830Ptr pI830 = I830PTR(scrn); - int o; + ScrnInfoPtr scrn = output->scrn; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); + int o; (*output->funcs->destroy) (output); #ifdef RANDR_12_INTERFACE @@ -113,13 +126,13 @@ i830xf86OutputDestroy (I830_xf86OutputPtr output) #endif while (output->probed_modes) xf86DeleteMode (&output->probed_modes, output->probed_modes); - for (o = 0; o < pI830->num_outputs; o++) - if (pI830->xf86_output[o] == output) + for (o = 0; o < xf86_config->num_output; o++) + if (xf86_config->output[o] == output) { - memmove (&pI830->xf86_output[o], - &pI830->xf86_output[o+1], - pI830->num_outputs - (o + 1)); - pI830->num_outputs--; + memmove (&xf86_config->output[o], + &xf86_config->output[o+1], + xf86_config->num_output - (o + 1)); + xf86_config->num_output--; break; } xfree (output); diff --git a/src/i830_xf86Crtc.h b/src/i830_xf86Crtc.h index 32f84aff..1f9a03e9 100644 --- a/src/i830_xf86Crtc.h +++ b/src/i830_xf86Crtc.h @@ -19,15 +19,15 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ -#ifndef _I830_XF86CRTC_H_ -#define _I830_XF86CRTC_H_ +#ifndef _XF86CRTC_H_ +#define _XF86CRTC_H_ #include <edid.h> #include "i830_xf86Modes.h" -typedef struct _I830_xf86Crtc I830_xf86CrtcRec, *I830_xf86CrtcPtr; +typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr; -typedef struct _I830_xf86CrtcFuncs { +typedef struct _xf86CrtcFuncs { /** * Turns the crtc on/off, or sets intermediate power levels if available. * @@ -36,33 +36,33 @@ typedef struct _I830_xf86CrtcFuncs { * disabled afterwards. */ void - (*dpms)(I830_xf86CrtcPtr crtc, - int mode); + (*dpms)(xf86CrtcPtr crtc, + int mode); /** * Saves the crtc's state for restoration on VT switch. */ void - (*save)(I830_xf86CrtcPtr crtc); + (*save)(xf86CrtcPtr crtc); /** * Restore's the crtc's state at VT switch. */ void - (*restore)(I830_xf86CrtcPtr crtc); + (*restore)(xf86CrtcPtr crtc); /** * Clean up driver-specific bits of the crtc */ void - (*destroy) (I830_xf86CrtcPtr crtc); -} I830_xf86CrtcFuncsRec, *I830_xf86CrtcFuncsPtr; + (*destroy) (xf86CrtcPtr crtc); +} xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; -struct _I830_xf86Crtc { +struct _xf86Crtc { /** * Associated ScrnInfo */ - ScrnInfoPtr scrn; + ScrnInfoPtr scrn; /** * Active state of this CRTC @@ -104,7 +104,7 @@ struct _I830_xf86Crtc { DisplayModeRec desiredMode; /** crtc-specific functions */ - const I830_xf86CrtcFuncsRec *funcs; + const xf86CrtcFuncsRec *funcs; /** * Driver private @@ -126,9 +126,9 @@ struct _I830_xf86Crtc { #endif }; -typedef struct _I830_xf86Output I830_xf86OutputRec, *I830_xf86OutputPtr; +typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr; -typedef struct _I830_xf86OutputFuncs { +typedef struct _xf86OutputFuncs { /** * Turns the output on/off, or sets intermediate power levels if available. * @@ -137,20 +137,20 @@ typedef struct _I830_xf86OutputFuncs { * disabled afterwards. */ void - (*dpms)(I830_xf86OutputPtr output, + (*dpms)(xf86OutputPtr output, int mode); /** * Saves the output's state for restoration on VT switch. */ void - (*save)(I830_xf86OutputPtr output); + (*save)(xf86OutputPtr output); /** * Restore's the output's state at VT switch. */ void - (*restore)(I830_xf86OutputPtr output); + (*restore)(xf86OutputPtr output); /** * Callback for testing a video mode for a given output. @@ -161,8 +161,8 @@ typedef struct _I830_xf86OutputFuncs { * \return MODE_OK if the mode is valid, or another MODE_* otherwise. */ int - (*mode_valid)(I830_xf86OutputPtr output, - DisplayModePtr pMode); + (*mode_valid)(xf86OutputPtr output, + DisplayModePtr pMode); /** * Callback for setting up a video mode before any crtc/dpll changes. @@ -171,22 +171,22 @@ typedef struct _I830_xf86OutputFuncs { * unknown (such as the restore path of VT switching). */ void - (*pre_set_mode)(I830_xf86OutputPtr output, - DisplayModePtr pMode); + (*pre_set_mode)(xf86OutputPtr output, + DisplayModePtr pMode); /** * Callback for setting up a video mode after the DPLL update but before * the plane is enabled. */ void - (*post_set_mode)(I830_xf86OutputPtr output, - DisplayModePtr pMode); + (*post_set_mode)(xf86OutputPtr output, + DisplayModePtr pMode); /** * Probe for a connected output, and return detect_status. */ enum detect_status - (*detect)(I830_xf86OutputPtr output); + (*detect)(xf86OutputPtr output); /** * Query the device for the modes it provides. @@ -196,16 +196,16 @@ typedef struct _I830_xf86OutputFuncs { * \return singly-linked list of modes or NULL if no modes found. */ DisplayModePtr - (*get_modes)(I830_xf86OutputPtr output); + (*get_modes)(xf86OutputPtr output); /** * Clean up driver-specific bits of the output */ void - (*destroy) (I830_xf86OutputPtr output); -} I830_xf86OutputFuncsRec, *I830_xf86OutputFuncsPtr; + (*destroy) (xf86OutputPtr output); +} xf86OutputFuncsRec, *xf86OutputFuncsPtr; -struct _I830_xf86Output { +struct _xf86Output { /** * Associated ScrnInfo */ @@ -215,7 +215,7 @@ struct _I830_xf86Output { * * If this output is not in use, this field will be NULL. */ - I830_xf86CrtcPtr crtc; + xf86CrtcPtr crtc; /** * List of available modes on this output. * @@ -234,7 +234,7 @@ struct _I830_xf86Output { char *name; /** output-specific functions */ - const I830_xf86OutputFuncsRec *funcs; + const xf86OutputFuncsRec *funcs; /** driver private information */ void *driver_private; @@ -252,15 +252,28 @@ struct _I830_xf86Output { #endif }; +#define XF86_MAX_CRTC 4 +#define XF86_MAX_OUTPUT 16 + +typedef struct _xf86CrtcConfig { + int num_output; + xf86OutputPtr output[XF86_MAX_OUTPUT]; + + int num_crtc; + xf86CrtcPtr crtc[XF86_MAX_CRTC]; +} xf86CrtcConfigRec, *xf86CrtcConfigPtr; + +#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->driverPrivate)) + /* * Crtc functions */ -I830_xf86CrtcPtr -i830xf86CrtcCreate (ScrnInfoPtr scrn, - const I830_xf86CrtcFuncsRec *funcs); +xf86CrtcPtr +xf86CrtcCreate (ScrnInfoPtr scrn, + const xf86CrtcFuncsRec *funcs); void -i830xf86CrtcDestroy (I830_xf86CrtcPtr xf86_crtc); +xf86CrtcDestroy (xf86CrtcPtr crtc); /** @@ -270,8 +283,8 @@ i830xf86CrtcDestroy (I830_xf86CrtcPtr xf86_crtc); * the specified output */ -I830_xf86CrtcPtr -i830xf86AllocCrtc (I830_xf86OutputPtr output); +xf86CrtcPtr +xf86AllocCrtc (xf86OutputPtr output); /** * Free a crtc @@ -280,17 +293,17 @@ i830xf86AllocCrtc (I830_xf86OutputPtr output); */ void -i830xf86FreeCrtc (I830_xf86CrtcPtr crtc); +xf86FreeCrtc (xf86CrtcPtr crtc); /* * Output functions */ -I830_xf86OutputPtr -i830xf86OutputCreate (ScrnInfoPtr scrn, - const I830_xf86OutputFuncsRec *funcs, - const char *name); +xf86OutputPtr +xf86OutputCreate (ScrnInfoPtr scrn, + const xf86OutputFuncsRec *funcs, + const char *name); void -i830xf86OutputDestroy (I830_xf86OutputPtr xf86_output); +xf86OutputDestroy (xf86OutputPtr output); -#endif /* _I830_XF86CRTC_H_ */ +#endif /* _XF86CRTC_H_ */ |