diff options
author | Alex Deucher <alex@samba.(none)> | 2007-12-12 22:37:44 -0500 |
---|---|---|
committer | Alex Deucher <alex@samba.(none)> | 2007-12-12 22:37:44 -0500 |
commit | f5ac34983411e4c4f41ab1817dce582830f398fd (patch) | |
tree | 4d2c47513ae6893ff7ea928704718356eb3824cd | |
parent | f2b2e0804183b52d9d3f56ad85b3552ece76c544 (diff) | |
parent | 6ccf5b33d27218ae1c45ab93c122438ed536d8ba (diff) |
Merge branch 'master' of git+ssh://agd5f@git.freedesktop.org/git/xorg/driver/xf86-video-ati into atombios-support
merge and fix conflicts
-rw-r--r-- | src/r128_dri.c | 6 | ||||
-rw-r--r-- | src/r128_probe.c | 2 | ||||
-rw-r--r-- | src/radeon.h | 4 | ||||
-rw-r--r-- | src/radeon_bios.c | 7 | ||||
-rw-r--r-- | src/radeon_crtc.c | 2 | ||||
-rw-r--r-- | src/radeon_cursor.c | 49 | ||||
-rw-r--r-- | src/radeon_dri.c | 3 | ||||
-rw-r--r-- | src/radeon_driver.c | 5 | ||||
-rw-r--r-- | src/radeon_exa.c | 20 | ||||
-rw-r--r-- | src/radeon_output.c | 54 | ||||
-rw-r--r-- | src/radeon_probe.h | 2 |
11 files changed, 100 insertions, 54 deletions
diff --git a/src/r128_dri.c b/src/r128_dri.c index fc91421d..edb77bac 100644 --- a/src/r128_dri.c +++ b/src/r128_dri.c @@ -80,9 +80,9 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; R128InfoPtr info = R128PTR(pScrn); int numConfigs = 0; - __GLXvisualConfig *pConfigs = 0; - R128ConfigPrivPtr pR128Configs = 0; - R128ConfigPrivPtr *pR128ConfigPtrs = 0; + __GLXvisualConfig *pConfigs = NULL; + R128ConfigPrivPtr pR128Configs = NULL; + R128ConfigPrivPtr *pR128ConfigPtrs = NULL; int i, accum, stencil, db; switch (info->CurrentLayout.pixel_code) { diff --git a/src/r128_probe.c b/src/r128_probe.c index b2298dff..0be21e8a 100644 --- a/src/r128_probe.c +++ b/src/r128_probe.c @@ -193,7 +193,7 @@ R128Probe(DriverPtr drv, int flags) pScrn = NULL; if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - R128PciChipsets, 0, 0, 0, 0, 0))) + R128PciChipsets, NULL, NULL, NULL, NULL, NULL))) { pScrn->driverVersion = R128_VERSION_CURRENT; pScrn->driverName = R128_DRIVER_NAME; diff --git a/src/radeon.h b/src/radeon.h index b1091bd1..038fcc7e 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -408,10 +408,6 @@ typedef struct { #endif Bool accelOn; xf86CursorInfoPtr cursor; - CARD32 cursor_offset; -#ifdef USE_XAA - unsigned long cursor_end; -#endif Bool allowColorTiling; Bool tilingEnabled; /* mirror of sarea->tiling_enabled */ #ifdef ARGB_CURSOR diff --git a/src/radeon_bios.c b/src/radeon_bios.c index cca3d435..7b4eafb4 100644 --- a/src/radeon_bios.c +++ b/src/radeon_bios.c @@ -72,13 +72,12 @@ Bool RADEONGetBIOSInfo(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) int tmp; unsigned short dptr; - if (!(info->VBIOS = xalloc( #ifdef XSERVER_LIBPCIACCESS - info->PciInfo->rom_size + info->VBIOS = xalloc(info->PciInfo->rom_size); #else - RADEON_VBIOS_SIZE + info->VBIOS = xalloc(RADEON_VBIOS_SIZE); #endif - ))) { + if (!info->VBIOS) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot allocate space for hold Video BIOS!\n"); return FALSE; diff --git a/src/radeon_crtc.c b/src/radeon_crtc.c index caf73691..cf78e2cb 100644 --- a/src/radeon_crtc.c +++ b/src/radeon_crtc.c @@ -651,7 +651,7 @@ RADEONComputePLL(RADEONPLLPtr pll, CARD32 best_error = 0xffffffff; CARD32 best_vco_diff = 1; - ErrorF("freq: %d\n", freq); + ErrorF("freq: %lu\n", freq); for (i = 0; post_divs[i]; i++) { int post_div = post_divs[i]; diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c index 00913c85..842668be 100644 --- a/src/radeon_cursor.c +++ b/src/radeon_cursor.c @@ -100,7 +100,7 @@ avivo_setup_cursor(xf86CrtcPtr crtc, Bool enable) if (enable) { OUTREG(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, - info->fbLocation + info->cursor_offset); + info->fbLocation + radeon_crtc->cursor_offset); OUTREG(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset, ((CURSOR_WIDTH - 1) << 16) | (CURSOR_HEIGHT - 1)); OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, @@ -207,9 +207,9 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) | ((xorigin ? 0 : x) << 16) | (yorigin ? 0 : y))); RADEONCTRACE(("cursor_offset: 0x%x, yorigin: %d, stride: %d, temp %08X\n", - info->cursor_offset + pScrn->fbOffset, yorigin, stride, temp)); + radeon_crtc->cursor_offset + pScrn->fbOffset, yorigin, stride, temp)); OUTREG(RADEON_CUR_OFFSET, - info->cursor_offset + pScrn->fbOffset + yorigin * stride); + radeon_crtc->cursor_offset + pScrn->fbOffset + yorigin * stride); } else if (crtc_id == 1) { OUTREG(RADEON_CUR2_HORZ_VERT_OFF, (RADEON_CUR2_LOCK | (xorigin << 16) @@ -218,9 +218,9 @@ radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) | ((xorigin ? 0 : x) << 16) | (yorigin ? 0 : y))); RADEONCTRACE(("cursor_offset2: 0x%x, yorigin: %d, stride: %d, temp %08X\n", - info->cursor_offset + pScrn->fbOffset, yorigin, stride, temp)); + radeon_crtc->cursor_offset + pScrn->fbOffset, yorigin, stride, temp)); OUTREG(RADEON_CUR2_OFFSET, - info->cursor_offset + pScrn->fbOffset + yorigin * stride); + radeon_crtc->cursor_offset + pScrn->fbOffset + yorigin * stride); } } } @@ -229,8 +229,9 @@ void radeon_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg) { ScrnInfoPtr pScrn = crtc->scrn; + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; RADEONInfoPtr info = RADEONPTR(pScrn); - CARD32 *pixels = (CARD32 *)(pointer)(info->FB + info->cursor_offset); + CARD32 *pixels = (CARD32 *)(pointer)(info->FB + radeon_crtc->cursor_offset + pScrn->fbOffset); int pixel, i; CURSOR_SWAPPING_DECL_MMIO @@ -270,9 +271,10 @@ void radeon_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) { ScrnInfoPtr pScrn = crtc->scrn; + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *d = (CARD32 *)(pointer)(info->FB + info->cursor_offset); + CARD32 *d = (CARD32 *)(pointer)(info->FB + radeon_crtc->cursor_offset + pScrn->fbOffset); RADEONCTRACE(("RADEONLoadCursorARGB\n")); @@ -293,16 +295,18 @@ Bool RADEONCursorInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int width; int width_bytes; int height; int size_bytes; - + CARD32 cursor_offset = 0; + int c; size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT; width = pScrn->displayWidth; width_bytes = width * (pScrn->bitsPerPixel / 8); - height = (size_bytes + width_bytes - 1) / width_bytes; + height = ((size_bytes * xf86_config->num_crtc) + width_bytes - 1) / width_bytes; #ifdef USE_XAA if (!info->useEXA) { @@ -313,19 +317,30 @@ Bool RADEONCursorInit(ScreenPtr pScreen) align, NULL, NULL, NULL); if (!fbarea) { - info->cursor_offset = 0; + cursor_offset = 0; xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Hardware cursor disabled" " due to insufficient offscreen memory\n"); + return FALSE; } else { - info->cursor_offset = RADEON_ALIGN((fbarea->box.x1 + - fbarea->box.y1 * width) * - info->CurrentLayout.pixel_bytes, - align); - info->cursor_end = info->cursor_offset + size_bytes; + cursor_offset = RADEON_ALIGN((fbarea->box.x1 + + fbarea->box.y1 * width) * + info->CurrentLayout.pixel_bytes, + 256); + + for (c = 0; c < xf86_config->num_crtc; c++) { + xf86CrtcPtr crtc = xf86_config->crtc[c]; + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + + radeon_crtc->cursor_offset = cursor_offset + (c * size_bytes); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using hardware cursor %d (scanline %u)\n", c, + (unsigned)(radeon_crtc->cursor_offset / pScrn->displayWidth + / info->CurrentLayout.pixel_bytes)); + } + } - RADEONCTRACE(("RADEONCursorInit (0x%08x-0x%08x)\n", - info->cursor_offset, info->cursor_end)); } #endif diff --git a/src/radeon_dri.c b/src/radeon_dri.c index dbfa8d9e..ac8d03c9 100644 --- a/src/radeon_dri.c +++ b/src/radeon_dri.c @@ -1361,6 +1361,9 @@ Bool RADEONDRISetVBlankInterrupt(ScrnInfoPtr pScrn, Bool on) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int value = 0; + if (!info->want_vblank_interrupts) + on = FALSE; + if (info->directRenderingEnabled && info->pKernelDRMVersion->version_minor >= 28) { if (on) { if (xf86_config->num_crtc > 1 && xf86_config->crtc[1]->enabled) diff --git a/src/radeon_driver.c b/src/radeon_driver.c index 0baf2ef5..2c5e64fb 100644 --- a/src/radeon_driver.c +++ b/src/radeon_driver.c @@ -3846,10 +3846,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, if (!info->useEXA) { int width, height; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using hardware cursor (scanline %u)\n", - (unsigned)(info->cursor_offset / pScrn->displayWidth - / info->CurrentLayout.pixel_bytes)); if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) { xf86DrvMsg(scrnIndex, X_INFO, @@ -3864,7 +3860,6 @@ Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); } } else { - info->cursor_offset = 0; xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); } diff --git a/src/radeon_exa.c b/src/radeon_exa.c index 8a12e1b2..4da4841a 100644 --- a/src/radeon_exa.c +++ b/src/radeon_exa.c @@ -374,6 +374,7 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); int cpp = info->CurrentLayout.pixel_bytes; int screen_size; int byteStride = pScrn->displayWidth * cpp; @@ -405,14 +406,23 @@ Bool RADEONSetupMemEXA (ScreenPtr pScreen) /* Reserve static area for hardware cursor */ if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { int cursor_size = 64 * 4 * 64; + int c; - info->cursor_offset = info->exa->offScreenBase; + for (c = 0; c < xf86_config->num_crtc; c++) { + xf86CrtcPtr crtc = xf86_config->crtc[c]; + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + + radeon_crtc->cursor_offset = info->exa->offScreenBase; + info->exa->offScreenBase += cursor_size; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Will use %d kb for hardware cursor %d at offset 0x%08x\n", + (cursor_size * xf86_config->num_crtc) / 1024, + c, + (unsigned int)radeon_crtc->cursor_offset); + } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Will use %d kb for hardware cursor at offset 0x%08x\n", - cursor_size / 1024, (unsigned int)info->cursor_offset); - info->exa->offScreenBase += cursor_size; } #if defined(XF86DRI) diff --git a/src/radeon_output.c b/src/radeon_output.c index 4dc47ce0..02c96aef 100644 --- a/src/radeon_output.c +++ b/src/radeon_output.c @@ -741,6 +741,45 @@ void RADEONConnectorFindMonitor(ScrnInfoPtr pScrn, xf86OutputPtr output) } } +static RADEONMonitorType +RADEONDetectLidStatus(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONMonitorType MonType = MT_NONE; +#ifdef __linux__ + char lidline[50]; /* 50 should be sufficient for our purposes */ + FILE *f = fopen ("/proc/acpi/button/lid/LID/state", "r"); + + if (f != NULL) { + while (fgets(lidline, sizeof lidline, f)) { + if (!strncmp(lidline, "state:", strlen ("state:"))) { + if (strstr(lidline, "open")) { + ErrorF("proc lid open\n"); + return MT_LCD; + } + else if (strstr(lidline, "closed")) { + ErrorF("proc lid closed\n"); + return MT_NONE; + } + } + } + } +#endif + + if (!info->IsAtomBios) { + unsigned char *RADEONMMIO = info->MMIO; + + /* see if the lid is closed -- only works at boot */ + if (INREG(RADEON_BIOS_6_SCRATCH) & 0x10) + MonType = MT_NONE; + else + MonType = MT_LCD; + } else + MonType = MT_LCD; + + return MonType; +} + static RADEONMonitorType RADEONPortCheckNonDDC(ScrnInfoPtr pScrn, xf86OutputPtr output) { RADEONOutputPrivatePtr radeon_output = output->driver_private; @@ -748,21 +787,10 @@ static RADEONMonitorType RADEONPortCheckNonDDC(ScrnInfoPtr pScrn, xf86OutputPtr if (radeon_output->type == OUTPUT_LVDS) { #if defined(__powerpc__) - /* not sure on ppc, OF? */ + MonType = MT_LCD; #else - RADEONInfoPtr info = RADEONPTR(pScrn); - - if (!info->IsAtomBios) { - unsigned char *RADEONMMIO = info->MMIO; - - /* see if the lid is closed -- only works at boot */ - if (INREG(RADEON_BIOS_6_SCRATCH) & 0x10) - MonType = MT_NONE; - else - MonType = MT_LCD; - } else + MonType = RADEONDetectLidStatus(pScrn); #endif - MonType = MT_LCD; } /*else if (radeon_output->type == OUTPUT_DVI) { if (radeon_output->TMDSType == TMDS_INT) { if (INREG(RADEON_FP_GEN_CNTL) & RADEON_FP_DETECT_SENSE) diff --git a/src/radeon_probe.h b/src/radeon_probe.h index df071499..a25d6350 100644 --- a/src/radeon_probe.h +++ b/src/radeon_probe.h @@ -165,6 +165,7 @@ typedef struct _RADEONCrtcPrivateRec { #endif int crtc_id; int binding; + CARD32 cursor_offset; /* Lookup table values to be set when the CRTC is enabled */ CARD8 lut_r[256], lut_g[256], lut_b[256]; @@ -175,7 +176,6 @@ typedef struct _RADEONCrtcPrivateRec { int fb_pitch, fb_width, fb_height; INT16 cursor_x; INT16 cursor_y; - unsigned long cursor_offset; } RADEONCrtcPrivateRec, *RADEONCrtcPrivatePtr; typedef struct { |