summaryrefslogtreecommitdiff
path: root/src/i830_cursor.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@bouzouki.jf.intel.com>2006-12-13 13:15:14 -0800
committerKeith Packard <keithp@bouzouki.jf.intel.com>2006-12-13 13:15:14 -0800
commit3fe802453a85183a69c36a098639895f49b17df1 (patch)
treed1ebfa96e8cf067cc161799384d0a8586d18fa6c /src/i830_cursor.c
parent0f6addc8a6aeb9bd041d0f8e8e5850e76764ba51 (diff)
Move xf86CrtcConfig to ScrnInfo private.
Pull xf86CrtcConfig out of the driver private structure and allocate a ScrnInfo private index for it. Also, make the arrays of outputs and crtcs dynamic instead of fixed.
Diffstat (limited to 'src/i830_cursor.c')
-rw-r--r--src/i830_cursor.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/i830_cursor.c b/src/i830_cursor.c
index e9ca8f15..cb1585fb 100644
--- a/src/i830_cursor.c
+++ b/src/i830_cursor.c
@@ -86,10 +86,11 @@ I830SetPipeCursorBase (xf86CrtcPtr crtc)
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
int pipe = intel_crtc->pipe;
I830Ptr pI830 = I830PTR(pScrn);
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
int cursor_base = (pipe == 0 ? CURSOR_A_BASE : CURSOR_B_BASE);
I830MemRange *cursor_mem;
- if (pipe >= pI830->xf86_config.num_crtc)
+ if (pipe >= xf86_config->num_crtc)
FatalError("Bad pipe number for cursor base setting\n");
if (pI830->CursorIsARGB)
@@ -180,17 +181,18 @@ I830SetPipeCursor (xf86CrtcPtr crtc, Bool force)
void
I830InitHWCursor(ScrnInfoPtr pScrn)
{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
int i;
DPRINTF(PFX, "I830InitHWCursor\n");
- for (i = 0; i < pI830->xf86_config.num_crtc; i++)
- pI830->xf86_config.crtc[i]->cursorShown = FALSE;
+ for (i = 0; i < xf86_config->num_crtc; i++)
+ 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->xf86_config.num_crtc; i++)
+ for (i = 0; i < xf86_config->num_crtc; i++)
{
int cursor_control = i == 0 ? CURSOR_A_CONTROL : CURSOR_B_CONTROL;
temp = INREG(cursor_control);
@@ -204,7 +206,7 @@ I830InitHWCursor(ScrnInfoPtr pScrn)
temp |= CURSOR_MODE_64_4C_AX;
/* Need to set control, then address. */
OUTREG(cursor_control, temp);
- I830SetPipeCursorBase(pI830->xf86_config.crtc[i]);
+ I830SetPipeCursorBase(xf86_config->crtc[i]);
}
} else {
temp = INREG(CURSOR_CONTROL);
@@ -217,7 +219,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_config.crtc[0]);
+ I830SetPipeCursorBase(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);
@@ -454,6 +456,7 @@ static void I830LoadCursorARGB (ScrnInfoPtr pScrn, CursorPtr pCurs)
static void
I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
CARD32 temp;
Bool inrange;
@@ -490,9 +493,9 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
x -= hotspotx;
y -= hotspoty;
- for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++)
+ for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
{
- xf86CrtcPtr crtc = pI830->xf86_config.crtc[pipe];
+ xf86CrtcPtr crtc = xf86_config->crtc[pipe];
DisplayModePtr mode = &crtc->curMode;
int thisx = x - crtc->x;
int thisy = y - crtc->y;
@@ -542,6 +545,7 @@ I830SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
static void
I830ShowCursor(ScrnInfoPtr pScrn)
{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int pipe;
@@ -556,26 +560,28 @@ I830ShowCursor(ScrnInfoPtr pScrn)
pI830->CursorMemARGB->Physical, pI830->CursorMemARGB->Start);
pI830->cursorOn = TRUE;
- for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++)
- I830SetPipeCursor (pI830->xf86_config.crtc[pipe], TRUE);
+ for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
+ I830SetPipeCursor (xf86_config->crtc[pipe], TRUE);
}
static void
I830HideCursor(ScrnInfoPtr pScrn)
{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int pipe;
DPRINTF(PFX, "I830HideCursor\n");
pI830->cursorOn = FALSE;
- for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++)
- I830SetPipeCursor (pI830->xf86_config.crtc[pipe], TRUE);
+ for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
+ I830SetPipeCursor (xf86_config->crtc[pipe], TRUE);
}
static void
I830SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
I830Ptr pI830 = I830PTR(pScrn);
int pipe;
@@ -587,9 +593,9 @@ I830SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
DPRINTF(PFX, "I830SetCursorColors\n");
- for (pipe = 0; pipe < pI830->xf86_config.num_crtc; pipe++)
+ for (pipe = 0; pipe < xf86_config->num_crtc; pipe++)
{
- xf86CrtcPtr crtc = pI830->xf86_config.crtc[pipe];
+ xf86CrtcPtr crtc = xf86_config->crtc[pipe];
int pal0 = pipe == 0 ? CURSOR_A_PALETTE0 : CURSOR_B_PALETTE0;
if (crtc->enabled)