diff options
Diffstat (limited to 'driver')
26 files changed, 259 insertions, 412 deletions
diff --git a/driver/xf86-video-intel/configure b/driver/xf86-video-intel/configure index 371de0461..2d57c2cb3 100644 --- a/driver/xf86-video-intel/configure +++ b/driver/xf86-video-intel/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for xf86-video-intel 2.3.1. +# Generated by GNU Autoconf 2.59 for xf86-video-intel 2.3.2. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='xf86-video-intel' PACKAGE_TARNAME='xf86-video-intel' -PACKAGE_VERSION='2.3.1' -PACKAGE_STRING='xf86-video-intel 2.3.1' +PACKAGE_VERSION='2.3.2' +PACKAGE_STRING='xf86-video-intel 2.3.2' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' ac_unique_file="Makefile.am" @@ -998,7 +998,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xf86-video-intel 2.3.1 to adapt to many kinds of systems. +\`configure' configures xf86-video-intel 2.3.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1064,7 +1064,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xf86-video-intel 2.3.1:";; + short | recursive ) echo "Configuration of xf86-video-intel 2.3.2:";; esac cat <<\_ACEOF @@ -1231,7 +1231,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -xf86-video-intel configure 2.3.1 +xf86-video-intel configure 2.3.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1245,7 +1245,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xf86-video-intel $as_me 2.3.1, which was +It was created by xf86-video-intel $as_me 2.3.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1848,7 +1848,7 @@ fi # Define the identity of the package. PACKAGE='xf86-video-intel' - VERSION='2.3.1' + VERSION='2.3.2' cat >>confdefs.h <<_ACEOF @@ -21670,12 +21670,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_DRI_CFLAGS="$DRI_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libdrm xf86driproto\"") >&5 - ($PKG_CONFIG --exists --print-errors "libdrm xf86driproto") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libdrm xf86driproto glproto\"") >&5 + ($PKG_CONFIG --exists --print-errors "libdrm xf86driproto glproto") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_DRI_CFLAGS=`$PKG_CONFIG --cflags "libdrm xf86driproto" 2>/dev/null` + pkg_cv_DRI_CFLAGS=`$PKG_CONFIG --cflags "libdrm xf86driproto glproto" 2>/dev/null` else pkg_failed=yes fi @@ -21688,12 +21688,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_DRI_LIBS="$DRI_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libdrm xf86driproto\"") >&5 - ($PKG_CONFIG --exists --print-errors "libdrm xf86driproto") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libdrm xf86driproto glproto\"") >&5 + ($PKG_CONFIG --exists --print-errors "libdrm xf86driproto glproto") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_DRI_LIBS=`$PKG_CONFIG --libs "libdrm xf86driproto" 2>/dev/null` + pkg_cv_DRI_LIBS=`$PKG_CONFIG --libs "libdrm xf86driproto glproto" 2>/dev/null` else pkg_failed=yes fi @@ -21712,14 +21712,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - DRI_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libdrm xf86driproto"` + DRI_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libdrm xf86driproto glproto"` else - DRI_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libdrm xf86driproto"` + DRI_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libdrm xf86driproto glproto"` fi # Put the nasty error message in config.log where it belongs echo "$DRI_PKG_ERRORS" >&5 - { { echo "$as_me:$LINENO: error: Package requirements (libdrm xf86driproto) were not met: + { { echo "$as_me:$LINENO: error: Package requirements (libdrm xf86driproto glproto) were not met: $DRI_PKG_ERRORS @@ -21730,7 +21730,7 @@ Alternatively, you may set the environment variables DRI_CFLAGS and DRI_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -echo "$as_me: error: Package requirements (libdrm xf86driproto) were not met: +echo "$as_me: error: Package requirements (libdrm xf86driproto glproto) were not met: $DRI_PKG_ERRORS @@ -22833,7 +22833,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by xf86-video-intel $as_me 2.3.1, which was +This file was extended by xf86-video-intel $as_me 2.3.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22896,7 +22896,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -xf86-video-intel config.status 2.3.1 +xf86-video-intel config.status 2.3.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/driver/xf86-video-intel/configure.ac b/driver/xf86-video-intel/configure.ac index f8a382409..af589de1b 100644 --- a/driver/xf86-video-intel/configure.ac +++ b/driver/xf86-video-intel/configure.ac @@ -22,7 +22,7 @@ AC_PREREQ(2.57) AC_INIT([xf86-video-intel], - 2.3.1, + 2.3.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xf86-video-intel) @@ -197,7 +197,7 @@ fi AM_CONDITIONAL(DRI, test x$DRI = xyes) if test "$DRI" = yes; then - PKG_CHECK_MODULES(DRI, [libdrm xf86driproto]) + PKG_CHECK_MODULES(DRI, [libdrm xf86driproto glproto]) AC_DEFINE(XF86DRI,1,[Enable DRI driver support]) AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support]) PKG_CHECK_MODULES(DRI_MM, [libdrm >= 2.3.1],[DRI_MM=yes], [DRI_MM=no]) diff --git a/driver/xf86-video-intel/src/bios_reader/bios_dumper.c b/driver/xf86-video-intel/src/bios_reader/bios_dumper.c index e2f3064e8..1353edaa7 100644 --- a/driver/xf86-video-intel/src/bios_reader/bios_dumper.c +++ b/driver/xf86-video-intel/src/bios_reader/bios_dumper.c @@ -36,6 +36,10 @@ #include <pciaccess.h> #include <err.h> +#ifndef DEFFILEMODE +#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* 0666*/ +#endif + static void usage(void) { fprintf(stderr, "usage: bios_dumper <filename>\n"); diff --git a/driver/xf86-video-intel/src/i810_reg.h b/driver/xf86-video-intel/src/i810_reg.h index cc4620a83..79a5b1e63 100644 --- a/driver/xf86-video-intel/src/i810_reg.h +++ b/driver/xf86-video-intel/src/i810_reg.h @@ -460,6 +460,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - new bits for i810 * - new register hwstam (mask) */ +#define PWRCTXA 0x2088 /* 965GM+ only */ +#define PWRCTX_EN (1<<0) #define HWSTAM 0x2098 /* p290 */ #define IER 0x20a0 /* p291 */ #define IIR 0x20a4 /* p292 */ @@ -497,7 +499,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define FWATER_BLC 0x20d8 #define FWATER_BLC2 0x20dc -#define FWATER_BLC_SELF 0x20e0 #define MM_BURST_LENGTH 0x00700000 #define MM_FIFO_WATERMARK 0x0001F000 #define LM_BURST_LENGTH 0x00000700 @@ -1121,6 +1122,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define RENCLK_GATE_D2 0x6208 #define RAMCLK_GATE_D 0x6210 /* CRL only */ +#define DEUC 0x6214 /* CRL only */ /* * This is a PCI config space register to manipulate backlight brightness @@ -1220,6 +1222,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18) #define SDVOC_GANG_MODE (1 << 16) #define SDVO_BORDER_ENABLE (1 << 7) +/** new with 965, default is to be set */ +#define SDVO_VSYNC_ACTIVE_HIGH (1 << 4) +#define SDVO_HSYNC_ACTIVE_HIGH (1 << 3) +/** 915/945 only, read-only bit */ #define SDVOB_PCIE_CONCURRENCY (1 << 3) #define SDVO_DETECTED (1 << 2) /* Bits to be preserved when writing */ diff --git a/driver/xf86-video-intel/src/i830.h b/driver/xf86-video-intel/src/i830.h index 0ae8270d0..def693fbc 100644 --- a/driver/xf86-video-intel/src/i830.h +++ b/driver/xf86-video-intel/src/i830.h @@ -426,6 +426,8 @@ typedef struct _I830Rec { i830_memory *logical_context; + i830_memory *power_context; + #ifdef XF86DRI i830_memory *back_buffer; i830_memory *third_buffer; @@ -552,10 +554,6 @@ typedef struct _I830Rec { Bool StolenOnly; - Bool swfSaved; - uint32_t saveSWF0; - uint32_t saveSWF4; - Bool checkDevices; /* Driver phase/state information */ @@ -647,6 +645,11 @@ typedef struct _I830Rec { uint32_t saveFBC_CONTROL2; uint32_t saveFBC_CONTROL; uint32_t saveFBC_FENCE_OFF; + uint32_t saveRENCLK_GATE_D1; + uint32_t saveRENCLK_GATE_D2; + uint32_t saveDSPCLK_GATE_D; + uint32_t saveRAMCLK_GATE_D; + uint32_t savePWRCTXA; enum last_3d *last_3d; @@ -658,6 +661,8 @@ typedef struct _I830Rec { #define I830PTR(p) ((I830Ptr)((p)->driverPrivate)) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) + #define I830_SELECT_FRONT 0 #define I830_SELECT_BACK 1 #define I830_SELECT_DEPTH 2 @@ -768,6 +773,7 @@ void i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem); extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn); Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn); Bool i830_allocate_texture_memory(ScrnInfoPtr pScrn); +Bool i830_allocate_pwrctx(ScrnInfoPtr pScrn); Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn); #ifdef INTEL_XVMC Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name, @@ -848,6 +854,14 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform, void i830_enter_render(ScrnInfoPtr); +static inline void +i830_wait_ring_idle(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0); +} + static inline int i830_fb_compression_supported(I830Ptr pI830) { if (!IS_MOBILE(pI830)) diff --git a/driver/xf86-video-intel/src/i830_accel.c b/driver/xf86-video-intel/src/i830_accel.c index 953a73bc5..7784c62a5 100644 --- a/driver/xf86-video-intel/src/i830_accel.c +++ b/driver/xf86-video-intel/src/i830_accel.c @@ -201,7 +201,7 @@ I830Sync(ScrnInfoPtr pScrn) ADVANCE_BATCH(); } - I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0); + i830_wait_ring_idle(pScrn); pI830->LpRing->space = pI830->LpRing->mem->size - 8; pI830->nextColorExpandBuf = 0; diff --git a/driver/xf86-video-intel/src/i830_debug.c b/driver/xf86-video-intel/src/i830_debug.c index 0eba57f68..15b02ceb7 100644 --- a/driver/xf86-video-intel/src/i830_debug.c +++ b/driver/xf86-video-intel/src/i830_debug.c @@ -546,10 +546,6 @@ static struct i830SnapshotRec { DEFINEREG(FBC_FENCE_OFF), DEFINEREG(FBC_MOD_NUM), - DEFINEREG(FWATER_BLC), - DEFINEREG(FWATER_BLC2), - DEFINEREG(FWATER_BLC_SELF), - DEFINEREG2(FPA0, i830_debug_fp), DEFINEREG2(FPA1, i830_debug_fp), DEFINEREG2(DPLL_A, i830_debug_dpll), diff --git a/driver/xf86-video-intel/src/i830_display.c b/driver/xf86-video-intel/src/i830_display.c index 4910d9671..df2f1a24a 100644 --- a/driver/xf86-video-intel/src/i830_display.c +++ b/driver/xf86-video-intel/src/i830_display.c @@ -241,13 +241,15 @@ static void intel_clock(I830Ptr pI830, int refclk, intel_clock_t *clock) } static void -i830PrintPll(char *prefix, intel_clock_t *clock) +i830PrintPll(ScrnInfoPtr pScrn, char *prefix, intel_clock_t *clock) { - ErrorF("%s: dotclock %d vco %d ((m %d, m1 %d, m2 %d), n %d, (p %d, p1 %d, p2 %d))\n", - prefix, clock->dot, clock->vco, - clock->m, clock->m1, clock->m2, - clock->n, - clock->p, clock->p1, clock->p2); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%s: dotclock %d vco %d ((m %d, m1 %d, m2 %d), n %d, " + "(p %d, p1 %d, p2 %d))\n", + prefix, clock->dot, clock->vco, + clock->m, clock->m1, clock->m2, + clock->n, + clock->p, clock->p1, clock->p2); } /** @@ -1262,7 +1264,7 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, "Adjusted mode for pipe %c:\n", pipe == 0 ? 'A' : 'B'); xf86PrintModeline(pScrn->scrnIndex, adjusted_mode); } - i830PrintPll("chosen", &clock); + i830PrintPll(pScrn, "chosen", &clock); } if (dpll & DPLL_VCO_ENABLE) @@ -1755,7 +1757,7 @@ i830_crtc_clock_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc) * configuration being accurate, which it isn't necessarily. */ if (0) - i830PrintPll("probed", &clock); + i830PrintPll(pScrn, "probed", &clock); return clock.dot; } diff --git a/driver/xf86-video-intel/src/i830_driver.c b/driver/xf86-video-intel/src/i830_driver.c index f5560874d..36ea7526b 100644 --- a/driver/xf86-video-intel/src/i830_driver.c +++ b/driver/xf86-video-intel/src/i830_driver.c @@ -692,11 +692,6 @@ I830MapMem(ScrnInfoPtr pScrn) (void **) &pI830->FbBase); if (err) return FALSE; - /* KLUDGE ALERT -- rewrite the PTEs to turn off the CD and WT bits */ -#if HAVE_MPROTECT - mprotect (pI830->FbBase, pI830->FbMapSize, PROT_NONE); - mprotect (pI830->FbBase, pI830->FbMapSize, PROT_READ|PROT_WRITE); -#endif #else pI830->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pI830->PciTag, @@ -934,6 +929,53 @@ I830SetupOutputs(ScrnInfoPtr pScrn) } } +static void +i830_init_clock_gating(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + /* Disable clock gating reported to work incorrectly according to the specs. + */ + if (IS_IGD_GM(pI830)) { + OUTREG(RENCLK_GATE_D1, 0); + OUTREG(RENCLK_GATE_D2, 0); + OUTREG(RAMCLK_GATE_D, 0); + OUTREG(DSPCLK_GATE_D, VRHUNIT_CLOCK_GATE_DISABLE | + OVRUNIT_CLOCK_GATE_DISABLE | + OVCUNIT_CLOCK_GATE_DISABLE); + } else if (IS_I965GM(pI830)) { + OUTREG(RENCLK_GATE_D1, I965_RCC_CLOCK_GATE_DISABLE); + OUTREG(RENCLK_GATE_D2, 0); + OUTREG(DSPCLK_GATE_D, 0); + OUTREG(RAMCLK_GATE_D, 0); + OUTREG16(DEUC, 0); + } else if (IS_I965G(pI830)) { + OUTREG(RENCLK_GATE_D1, I965_RCZ_CLOCK_GATE_DISABLE | + I965_RCC_CLOCK_GATE_DISABLE | + I965_RCPB_CLOCK_GATE_DISABLE | + I965_ISC_CLOCK_GATE_DISABLE | + I965_FBC_CLOCK_GATE_DISABLE); + OUTREG(RENCLK_GATE_D2, 0); + } else if (IS_I855(pI830) || IS_I865G(pI830)) { + OUTREG(RENCLK_GATE_D1, SV_CLOCK_GATE_DISABLE); + } else if (IS_I830(pI830)) { + OUTREG(DSPCLK_GATE_D, OVRUNIT_CLOCK_GATE_DISABLE); + } +} + +static void +i830_init_bios_control(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + /* Set "extended desktop" */ + OUTREG(SWF0, INREG(SWF0) | (1 << 21)); + + /* Set "driver loaded", "OS unknown", "APM 1.2" */ + OUTREG(SWF4, (INREG(SWF4) & ~((3 << 19) | (7 << 16))) | + (1 << 23) | (2 << 16)); +} + static int I830LVDSPresent(ScrnInfoPtr pScrn) { @@ -992,10 +1034,6 @@ PreInitCleanup(ScrnInfoPtr pScrn) if (pI830->entityPrivate) pI830->entityPrivate->pScrn_2 = NULL; } - if (pI830->swfSaved) { - OUTREG(SWF0, pI830->saveSWF0); - OUTREG(SWF4, pI830->saveSWF4); - } if (pI830->MMIOBase) I830UnmapMMIO(pScrn); I830FreeRec(pScrn); @@ -1461,19 +1499,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) i830TakeRegSnapshot(pScrn); -#if 1 - pI830->saveSWF0 = INREG(SWF0); - pI830->saveSWF4 = INREG(SWF4); - pI830->swfSaved = TRUE; - - /* Set "extended desktop" */ - OUTREG(SWF0, pI830->saveSWF0 | (1 << 21)); - - /* Set "driver loaded", "OS unknown", "APM 1.2" */ - OUTREG(SWF4, (pI830->saveSWF4 & ~((3 << 19) | (7 << 16))) | - (1 << 23) | (2 << 16)); -#endif - if (DEVICE_ID(pI830->PciInfo) == PCI_CHIP_E7221_G) num_pipe = 1; else @@ -1708,12 +1733,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) pI830->noAccel = TRUE; } - /* Don't need MMIO access anymore. */ - if (pI830->swfSaved) { - OUTREG(SWF0, pI830->saveSWF0); - OUTREG(SWF4, pI830->saveSWF4); - } - /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); @@ -1820,7 +1839,6 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush) if (temp & RING_VALID) { i830_refresh_ring(pScrn); I830Sync(pScrn); - DO_RING_IDLE(); } OUTREG(LP_RING + RING_LEN, 0); @@ -1901,19 +1919,6 @@ SetHWOperatingState(ScrnInfoPtr pScrn) DPRINTF(PFX, "SetHWOperatingState\n"); - /* Disable clock gating reported to work incorrectly according to the specs. - */ - if (IS_I965GM(pI830)) { - OUTREG(RENCLK_GATE_D1, I965_RCC_CLOCK_GATE_DISABLE); - } else if (IS_I965G(pI830)) { - OUTREG(RENCLK_GATE_D1, - I965_RCC_CLOCK_GATE_DISABLE | I965_ISC_CLOCK_GATE_DISABLE); - } else if (IS_I855(pI830) || IS_I865G(pI830)) { - OUTREG(RENCLK_GATE_D1, SV_CLOCK_GATE_DISABLE); - } else if (IS_I830(pI830)) { - OUTREG(DSPCLK_GATE_D, OVRUNIT_CLOCK_GATE_DISABLE); - } - i830_start_ring(pScrn); if (!pI830->SWCursor) I830InitHWCursor(pScrn); @@ -2056,6 +2061,17 @@ SaveHWState(ScrnInfoPtr pScrn) pI830->saveSWF[15] = INREG(SWF31); pI830->saveSWF[16] = INREG(SWF32); + pI830->saveDSPCLK_GATE_D = INREG(DSPCLK_GATE_D); + pI830->saveRENCLK_GATE_D1 = INREG(RENCLK_GATE_D1); + + if (IS_I965G(pI830)) { + pI830->saveRENCLK_GATE_D2 = INREG(RENCLK_GATE_D2); + pI830->saveRAMCLK_GATE_D = INREG(RAMCLK_GATE_D); + } + + if (IS_I965GM(pI830) || IS_IGD_GM(pI830)) + pI830->savePWRCTXA = INREG(PWRCTXA); + if (IS_MOBILE(pI830) && !IS_I830(pI830)) pI830->saveLVDS = INREG(LVDS); pI830->savePFIT_CONTROL = INREG(PFIT_CONTROL); @@ -2113,6 +2129,17 @@ RestoreHWState(ScrnInfoPtr pScrn) if (!IS_I830(pI830) && !IS_845G(pI830)) OUTREG(PFIT_CONTROL, pI830->savePFIT_CONTROL); + OUTREG(DSPCLK_GATE_D, pI830->saveDSPCLK_GATE_D); + OUTREG(RENCLK_GATE_D1, pI830->saveRENCLK_GATE_D1); + + if (IS_I965G(pI830)) { + OUTREG(RENCLK_GATE_D2, pI830->saveRENCLK_GATE_D2); + OUTREG(RAMCLK_GATE_D, pI830->saveRAMCLK_GATE_D); + } + + if (IS_I965GM(pI830) || IS_IGD_GM(pI830)) + OUTREG(PWRCTXA, pI830->savePWRCTXA); + /* * Pipe regs * To restore the saved state, we first need to program the PLL regs, @@ -2500,6 +2527,10 @@ i830_try_memory_allocation(ScrnInfoPtr pScrn) if (!i830_allocate_2d_memory(pScrn)) goto failed; + if (IS_I965GM(pI830) || IS_IGD_GM(pI830)) + if (!i830_allocate_pwrctx(pScrn)) + goto failed; + if (dri && !i830_allocate_3d_memory(pScrn)) goto failed; @@ -3098,20 +3129,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); - if (IS_I965G(pI830)) { - /* turn off clock gating */ -#if 0 - OUTREG(0x6204, 0x70804000); - OUTREG(0x6208, 0x00000001); -#else - OUTREG(0x6204, 0x70000000); -#endif - /* Enable DAP stateless accesses. - * Required for all i965 steppings. - */ - OUTREG(SVG_WORK_CTL, 0x00000010); - } - pI830->starting = FALSE; pI830->closing = FALSE; pI830->suspended = FALSE; @@ -3285,6 +3302,14 @@ I830EnterVT(int scrnIndex, int flags) i830_stop_ring(pScrn, FALSE); SetHWOperatingState(pScrn); + /* Tell the BIOS that we're in control of mode setting now. */ + i830_init_bios_control(pScrn); + + i830_init_clock_gating(pScrn); + + if (pI830->power_context) + OUTREG(PWRCTXA, pI830->power_context->offset | PWRCTX_EN); + /* Clear the framebuffer */ memset(pI830->FbBase + pScrn->fbOffset, 0, pScrn->virtualY * pScrn->displayWidth * pI830->cpp); @@ -3298,9 +3323,6 @@ I830EnterVT(int scrnIndex, int flags) } i830DescribeOutputConfiguration(pScrn); - i830_stop_ring(pScrn, TRUE); - SetHWOperatingState(pScrn); - #ifdef XF86DRI if (pI830->directRenderingEnabled) { /* HW status is fixed, we need to set it up before any drm @@ -3333,10 +3355,9 @@ I830EnterVT(int scrnIndex, int flags) int i; I830DRIResume(screenInfo.screens[scrnIndex]); - + i830_refresh_ring(pScrn); I830Sync(pScrn); - DO_RING_IDLE(); sarea->texAge++; for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++) diff --git a/driver/xf86-video-intel/src/i830_lvds.c b/driver/xf86-video-intel/src/i830_lvds.c index 48402dfa9..4f62a2b60 100644 --- a/driver/xf86-video-intel/src/i830_lvds.c +++ b/driver/xf86-video-intel/src/i830_lvds.c @@ -63,6 +63,9 @@ struct i830_lvds_priv { /* The panel needs dithering enabled */ Bool panel_wants_dither; + /* The panel is in DPMS off */ + Bool dpmsoff; + /* restore backlight to this value */ int backlight_duty_cycle; @@ -334,6 +337,7 @@ i830_lvds_get_backlight_kernel(xf86OutputPtr output) return 0; } + memset(val, 0, sizeof(val)); if (read(fd, val, BACKLIGHT_VALUE_LEN) == -1) goto out_err; @@ -388,6 +392,10 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on) uint32_t pp_status; if (on) { + /* if we're going from on->on, be aware to current level. */ + if ((INREG(PP_CONTROL) & POWER_TARGET_ON) && !dev_priv->dpmsoff) + dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); + /* * If we're going from off->on we may need to turn on the backlight. * We should use the saved value whenever possible, but on some @@ -405,12 +413,13 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on) } while ((pp_status & PP_ON) == 0); dev_priv->set_backlight(output, dev_priv->backlight_duty_cycle); + dev_priv->dpmsoff = FALSE; } else { /* * Only save the current backlight value if we're going from * on to off. */ - if (INREG(PP_CONTROL) & POWER_TARGET_ON) + if ((INREG(PP_CONTROL) & POWER_TARGET_ON) && !dev_priv->dpmsoff) dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); dev_priv->set_backlight(output, 0); @@ -418,6 +427,8 @@ i830SetLVDSPanelPower(xf86OutputPtr output, Bool on) do { pp_status = INREG(PP_STATUS); } while (pp_status & PP_ON); + + dev_priv->dpmsoff = TRUE; } } @@ -447,7 +458,8 @@ i830_lvds_save (xf86OutputPtr output) pI830->savePP_CONTROL = INREG(PP_CONTROL); pI830->savePP_CYCLE = INREG(PP_CYCLE); pI830->saveBLC_PWM_CTL = INREG(BLC_PWM_CTL); - dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); + if ((INREG(PP_CONTROL) & POWER_TARGET_ON) && !dev_priv->dpmsoff) + dev_priv->backlight_duty_cycle = dev_priv->get_backlight(output); } static void @@ -671,7 +683,7 @@ i830_lvds_mode_fixup(xf86OutputPtr output, DisplayModePtr mode, /* Letterbox will have top/bottom borders */ top_border = (dev_priv->panel_fixed_mode->VDisplay - - mode->VDisplay) / 2; + scaled_height) / 2; bottom_border = top_border; if (mode->VDisplay & 1) bottom_border++; @@ -1081,7 +1093,10 @@ i830_lvds_set_property(xf86OutputPtr output, Atom property, "RRConfigureOutputProperty error, %d\n", ret); } /* Set the current value of the backlight property */ - data = dev_priv->get_backlight(output); + if ((INREG(PP_CONTROL) & POWER_TARGET_ON) && !dev_priv->dpmsoff) + data = dev_priv->get_backlight(output); + else + data = dev_priv->backlight_duty_cycle; ret = RRChangeOutputProperty(output->randr_output, backlight_atom, XA_INTEGER, 32, PropModeReplace, 1, &data, FALSE, TRUE); @@ -1130,6 +1145,8 @@ i830_lvds_set_property(xf86OutputPtr output, Atom property, static Bool i830_lvds_get_property(xf86OutputPtr output, Atom property) { + ScrnInfoPtr pScrn = output->scrn; + I830Ptr pI830 = I830PTR(pScrn); I830OutputPrivatePtr intel_output = output->driver_private; struct i830_lvds_priv *dev_priv = intel_output->dev_priv; int ret; @@ -1140,8 +1157,11 @@ i830_lvds_get_property(xf86OutputPtr output, Atom property) */ if (property == backlight_atom) { int val; - val = dev_priv->get_backlight(output); - dev_priv->backlight_duty_cycle = val; + if ((INREG(PP_CONTROL) & POWER_TARGET_ON) && !dev_priv->dpmsoff) { + val = dev_priv->get_backlight(output); + dev_priv->backlight_duty_cycle = val; + } else + val = dev_priv->backlight_duty_cycle; ret = RRChangeOutputProperty(output->randr_output, backlight_atom, XA_INTEGER, 32, PropModeReplace, 1, &val, FALSE, TRUE); diff --git a/driver/xf86-video-intel/src/i830_memory.c b/driver/xf86-video-intel/src/i830_memory.c index 6835a6fc9..ccbe7bd1e 100644 --- a/driver/xf86-video-intel/src/i830_memory.c +++ b/driver/xf86-video-intel/src/i830_memory.c @@ -112,6 +112,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* Our hardware status area is just a single page */ #define HWSTATUS_PAGE_SIZE GTT_PAGE_SIZE +#define PWRCTX_SIZE GTT_PAGE_SIZE static i830_memory * i830_allocate_aperture(ScrnInfoPtr pScrn, const char *name, @@ -337,6 +338,7 @@ i830_reset_allocations(ScrnInfoPtr pScrn) pI830->exa_965_state = NULL; pI830->overlay_regs = NULL; pI830->logical_context = NULL; + pI830->power_context = NULL; #ifdef XF86DRI pI830->back_buffer = NULL; pI830->third_buffer = NULL; @@ -1654,6 +1656,22 @@ i830_allocate_hwstatus(ScrnInfoPtr pScrn) } Bool +i830_allocate_pwrctx(ScrnInfoPtr pScrn) +{ + I830Ptr pI830 = I830PTR(pScrn); + + pI830->power_context = i830_allocate_memory(pScrn, "power context", + PWRCTX_SIZE, GTT_PAGE_SIZE, + NEED_LIFETIME_FIXED); + if (!pI830->power_context) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Failed to allocate power context.\n"); + return FALSE; + } + return TRUE; +} + +Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); @@ -2002,6 +2020,7 @@ I830CheckAvailableMemory(ScrnInfoPtr pScrn) return maxPages * 4; } +#ifdef INTEL_XVMC /* * Allocate memory for MC compensation */ @@ -2023,3 +2042,4 @@ Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name, return TRUE; } +#endif diff --git a/driver/xf86-video-intel/src/i830_quirks.c b/driver/xf86-video-intel/src/i830_quirks.c index b1c142383..1bd8885c0 100644 --- a/driver/xf86-video-intel/src/i830_quirks.c +++ b/driver/xf86-video-intel/src/i830_quirks.c @@ -237,6 +237,8 @@ static i830_quirk i830_quirk_list[] = { { PCI_CHIP_I965_GM, 0x1028, 0x0256, quirk_ignore_tv }, /* Dell Inspiron 1318 */ { PCI_CHIP_I965_GM, 0x1028, 0x0286, quirk_ignore_tv }, + /* Dell Vostro A840 (LP: #235155) */ + { PCI_CHIP_I965_GM, 0x1028, 0x0298, quirk_ignore_tv }, /* Lenovo Napa TV (use dmi)*/ { PCI_CHIP_I945_GM, 0x17aa, SUBSYS_ANY, quirk_lenovo_tv_dmi }, @@ -272,6 +274,8 @@ static i830_quirk i830_quirk_list[] = { { PCI_CHIP_I855_GM, 0x1028, 0x0139, quirk_pipea_force }, /* Dell Latitude D500 needs pipe A force quirk */ { PCI_CHIP_I855_GM, 0x1028, 0x0152, quirk_pipea_force }, + /* Dell Latitude D505 needs pipe A force quirk (LP: #235643) */ + { PCI_CHIP_I855_GM, 0x1028, 0x0163, quirk_pipea_force }, /* Dell Latitude X300 needs pipe A force quirk */ { PCI_CHIP_I855_GM, 0x1028, 0x014f, quirk_pipea_force }, /* Dell Inspiron 510m needs pipe A force quirk */ diff --git a/driver/xf86-video-intel/src/i830_ring.h b/driver/xf86-video-intel/src/i830_ring.h index cf789eb6f..c2078fb49 100644 --- a/driver/xf86-video-intel/src/i830_ring.h +++ b/driver/xf86-video-intel/src/i830_ring.h @@ -75,28 +75,13 @@ union intfloat { pI830->ring_emitting = 0; \ } while (0) -/* - * XXX Note: the head/tail masks are different for 810 and i830. - * If the i810 always sets the higher bits to 0, then this shouldn't be - * a problem. Check this! - */ -#define DO_RING_IDLE() do { \ - int _head; \ - int _tail; \ - do { \ - _head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; \ - _tail = INREG(LP_RING + RING_TAIL) & I830_TAIL_MASK; \ - DELAY(10); \ - } while (_head != _tail); \ -} while (0) - #define BEGIN_LP_RING(n) \ do { \ if (pI830->ring_emitting != 0) \ FatalError("%s: BEGIN_LP_RING called without closing " \ "ADVANCE_LP_RING\n", __FUNCTION__); \ if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ - DO_RING_IDLE(); \ + i830_wait_ring_idle(pScrn); \ pI830->ring_emitting = (n) * 4; \ if ((n) & 1) \ pI830->ring_emitting += 4; \ diff --git a/driver/xf86-video-intel/src/i830_sdvo.c b/driver/xf86-video-intel/src/i830_sdvo.c index f60e38cfc..0dc6dca30 100644 --- a/driver/xf86-video-intel/src/i830_sdvo.c +++ b/driver/xf86-video-intel/src/i830_sdvo.c @@ -730,7 +730,9 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode, /* Set the SDVO control regs. */ if (IS_I965G(pI830)) { - sdvox = SDVO_BORDER_ENABLE; + sdvox = SDVO_BORDER_ENABLE | + SDVO_VSYNC_ACTIVE_HIGH | + SDVO_HSYNC_ACTIVE_HIGH; } else { sdvox = INREG(dev_priv->output_device); switch (dev_priv->output_device) { diff --git a/driver/xf86-video-intel/src/i830_tv.c b/driver/xf86-video-intel/src/i830_tv.c index 6adb9f2f6..cde929a73 100644 --- a/driver/xf86-video-intel/src/i830_tv.c +++ b/driver/xf86-video-intel/src/i830_tv.c @@ -788,6 +788,7 @@ i830_tv_dpms(xf86OutputPtr output, int mode) OUTREG(TV_CTL, INREG(TV_CTL) & ~TV_ENC_ENABLE); break; } + i830WaitForVblank(pScrn); } static void @@ -920,6 +921,7 @@ i830_tv_restore(xf86OutputPtr output) OUTREG(TV_DAC, dev_priv->save_TV_DAC); OUTREG(TV_CTL, dev_priv->save_TV_CTL); + i830WaitForVblank(pScrn); } static const tv_mode_t * @@ -1237,6 +1239,7 @@ i830_tv_mode_set(xf86OutputPtr output, DisplayModePtr mode, OUTREG(TV_V_CHROMA_0 + (i<<2), tv_mode->filter_table[j++]); OUTREG(TV_DAC, 0); OUTREG(TV_CTL, tv_ctl); + i830WaitForVblank(pScrn); } static const DisplayModeRec reported_modes[] = { @@ -1303,6 +1306,7 @@ i830_tv_detect_type (xf86CrtcPtr crtc, tv_dac = INREG(TV_DAC); OUTREG(TV_DAC, save_tv_dac); OUTREG(TV_CTL, save_tv_ctl); + i830WaitForVblank(pScrn); } /* * A B C diff --git a/driver/xf86-video-intel/src/i830_video.c b/driver/xf86-video-intel/src/i830_video.c index 67fe291b0..91e0e0099 100644 --- a/driver/xf86-video-intel/src/i830_video.c +++ b/driver/xf86-video-intel/src/i830_video.c @@ -2119,6 +2119,9 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, switch (id) { case FOURCC_YV12: case FOURCC_I420: +#ifdef INTEL_XVMC + case FOURCC_XVMC: +#endif OVERLAY_DEBUG("YUV420\n"); #if 0 /* set UV vertical phase to -0.25 */ @@ -2133,7 +2136,6 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, break; case FOURCC_UYVY: case FOURCC_YUY2: - default: OVERLAY_DEBUG("YUV422\n"); overlay->OSTRIDE = dstPitch; OCMD &= ~SOURCE_FORMAT; @@ -2376,6 +2378,9 @@ I830PutImage(ScrnInfoPtr pScrn, switch (destId) { case FOURCC_YV12: case FOURCC_I420: +#ifdef INTEL_XVMC + case FOURCC_XVMC: +#endif if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { dstPitch = ((height / 2) + pitchAlignMask) & ~pitchAlignMask; size = dstPitch * width * 3; @@ -2386,7 +2391,7 @@ I830PutImage(ScrnInfoPtr pScrn, break; case FOURCC_UYVY: case FOURCC_YUY2: - default: + if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { dstPitch = ((height << 1) + pitchAlignMask) & ~pitchAlignMask; size = dstPitch * width; @@ -2395,6 +2400,10 @@ I830PutImage(ScrnInfoPtr pScrn, size = dstPitch * height; } break; + default: + dstPitch = 0; + size = 0; + break; } #if 0 ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, dstPitch, size); @@ -2480,11 +2489,16 @@ I830PutImage(ScrnInfoPtr pScrn, break; case FOURCC_UYVY: case FOURCC_YUY2: - default: nlines = ((y2 + 0xffff) >> 16) - top; I830CopyPackedData(pScrn, pPriv, buf, srcPitch, dstPitch, top, left, nlines, npixels); break; +#ifdef INTEL_XVMC + case FOURCC_XVMC: + break; +#endif + default: + break; } if (pDraw->type == DRAWABLE_WINDOW) { diff --git a/driver/xf86-video-intel/src/i915_hwmc.c b/driver/xf86-video-intel/src/i915_hwmc.c index c3d3c7559..50e110685 100644 --- a/driver/xf86-video-intel/src/i915_hwmc.c +++ b/driver/xf86-video-intel/src/i915_hwmc.c @@ -95,8 +95,6 @@ typedef struct _I915XvMC PutImageFuncPtr savePutImage; } I915XvMC, *I915XvMCPtr; -#define ARRARY_SIZE(a) (sizeof(a) / sizeof(a[0])) - /* static int yv12_subpicture_index_list[2] = { @@ -161,6 +159,22 @@ static XF86ImagePtr i915_subpicture_list[2] = }; #endif +/* Check context size not exceed surface type max */ +static void +i915_check_context_size(XvMCContextPtr ctx) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ppSI); i++) { + if (ctx->surface_type_id == ppSI[i]->surface_type_id) { + if (ctx->width > ppSI[i]->max_width) + ctx->width = ppSI[i]->max_width; + if (ctx->height > ppSI[i]->max_height) + ctx->height = ppSI[i]->max_height; + } + } +} + /* * Init and clean up the screen private parts of XvMC. */ @@ -430,6 +444,8 @@ static int i915_xvmc_create_context (ScrnInfoPtr pScrn, XvMCContextPtr pContext, return BadAlloc; } + i915_check_context_size(pContext); + *priv = xcalloc(1, sizeof(I915XvMCCreateContextRec)); contextRec = (I915XvMCCreateContextRec *)*priv; @@ -776,10 +792,9 @@ static int i915_xvmc_put_image(ScrnInfoPtr pScrn, struct intel_xvmc_command *xvmc_cmd = (struct intel_xvmc_command *)buf; int ret; - if (pI830->XvMCEnabled) { - if (FOURCC_XVMC == id) { - switch (xvmc_cmd->command) { - case INTEL_XVMC_COMMAND_DISPLAY: + if (FOURCC_XVMC == id) { + switch (xvmc_cmd->command) { + case INTEL_XVMC_COMMAND_DISPLAY: if ((xvmc_cmd->srfNo >= I915_XVMC_MAX_SURFACES) || !pXvMC->surfaces[xvmc_cmd->srfNo] || !pXvMC->sfprivs[xvmc_cmd->srfNo]) { @@ -793,10 +808,9 @@ static int i915_xvmc_put_image(ScrnInfoPtr pScrn, id = xvmc_cmd->real_id; pI830->IsXvMCSurface = 1; break; - default: - return 0; - } - } + default: + return 0; + } } ret = pXvMC->savePutImage(pScrn, src_x, src_y, drw_x, drw_y, src_w, src_h, @@ -850,7 +864,7 @@ static void i915_xvmc_fini(ScrnInfoPtr pScrn) static XF86MCAdaptorRec pAdapt = { .name = "Intel(R) Textured Video", - .num_surfaces = ARRARY_SIZE(ppSI), + .num_surfaces = ARRAY_SIZE(ppSI), .surfaces = ppSI, #if 0 .num_subpictures = ARRARY_SIZE(i915_subpicture_list), diff --git a/driver/xf86-video-intel/src/i915_hwmc.h b/driver/xf86-video-intel/src/i915_hwmc.h index 0141fb256..7d90afcc1 100644 --- a/driver/xf86-video-intel/src/i915_hwmc.h +++ b/driver/xf86-video-intel/src/i915_hwmc.h @@ -32,7 +32,7 @@ #define STRIDE(w) (((w) + 0x3ff) & ~0x3ff) #define SIZE_Y420(w, h) (h * STRIDE(w)) #define SIZE_UV420(w, h) ((h >> 1) * STRIDE(w >> 1)) -#define SIZE_YUV420(w, h) (h * (STRIDE(w) + STRIDE(w >> 1))) +#define SIZE_YUV420(w, h) (SIZE_Y420(w,h) + SIZE_UV420(w,h) * 2) #define SIZE_XX44(w, h) (h * STRIDE(w)) #define I915_NUM_XVMC_ATTRIBUTES 0x02 diff --git a/driver/xf86-video-intel/src/modes/xf86Cursors.c b/driver/xf86-video-intel/src/modes/xf86Cursors.c index b5101642b..cb93dc6ba 100644 --- a/driver/xf86-video-intel/src/modes/xf86Cursors.c +++ b/driver/xf86-video-intel/src/modes/xf86Cursors.c @@ -137,7 +137,8 @@ cursor_bitpos (int flags, int x, Bool mask) mask = !mask; if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED) x = (x & ~3) | (3 - (x & 3)); - if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) + if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) == + (X_BYTE_ORDER == X_BIG_ENDIAN)) x = (x & ~7) | (7 - (x & 7)); if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1) x = (x << 1) + mask; @@ -226,7 +227,8 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); CursorPtr cursor = xf86_config->cursor; int c; - CARD8 *bits = cursor ? cursor->devPriv[screen->myNum] : NULL; + CARD8 *bits = cursor ? dixLookupPrivate(&cursor->devPrivates, + screen) : NULL; /* Save ARGB versions of these colors */ xf86_config->cursor_fg = (CARD32) fg | 0xff000000; @@ -399,7 +401,7 @@ xf86_crtc_load_cursor_image (xf86CrtcPtr crtc, CARD8 *src) int flags = cursor_info->Flags; cursor_image = xf86_config->cursor_image; - memset(cursor_image, 0, cursor_info->MaxWidth * stride); + memset(cursor_image, 0, cursor_info->MaxHeight * stride); for (y = 0; y < cursor_info->MaxHeight; y++) for (x = 0; x < cursor_info->MaxWidth; x++) @@ -612,7 +614,7 @@ xf86_reload_cursors (ScreenPtr screen) else #endif (*cursor_info->LoadCursorImage)(cursor_info->pScrn, - cursor->devPriv[screen->myNum]); + dixLookupPrivate(&cursor->devPrivates, screen)); (*cursor_info->SetCursorPosition)(cursor_info->pScrn, x, y); (*cursor_info->ShowCursor)(cursor_info->pScrn); diff --git a/driver/xf86-video-intel/src/xvmc/Makefile.am b/driver/xf86-video-intel/src/xvmc/Makefile.am index f571743fc..f2dab22c3 100644 --- a/driver/xf86-video-intel/src/xvmc/Makefile.am +++ b/driver/xf86-video-intel/src/xvmc/Makefile.am @@ -19,9 +19,8 @@ libIntelXvMC_la_SOURCES = intel_xvmc.c \ intel_batchbuffer.h \ xf86dri.c \ xf86dri.h \ - xf86dristr.h \ - driDrawable.c \ - driDrawable.h + xf86dristr.h + libIntelXvMC_la_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ @XVMCLIB_CFLAGS@ -I$(top_srcdir)/src -DTRUE=1 -DFALSE=0 libIntelXvMC_la_LDFLAGS = -version-number 1:0:0 libIntelXvMC_la_LIBADD = @DRI_LIBS@ diff --git a/driver/xf86-video-intel/src/xvmc/Makefile.in b/driver/xf86-video-intel/src/xvmc/Makefile.in index 9b64cfe5c..625ad3c68 100644 --- a/driver/xf86-video-intel/src/xvmc/Makefile.in +++ b/driver/xf86-video-intel/src/xvmc/Makefile.in @@ -63,12 +63,11 @@ libIntelXvMC_la_DEPENDENCIES = am__libIntelXvMC_la_SOURCES_DIST = intel_xvmc.c intel_xvmc.h \ i915_structs.h i915_program.h i915_xvmc.c i915_xvmc.h \ intel_batchbuffer.c intel_batchbuffer.h xf86dri.c xf86dri.h \ - xf86dristr.h driDrawable.c driDrawable.h + xf86dristr.h @XVMC_TRUE@am_libIntelXvMC_la_OBJECTS = libIntelXvMC_la-intel_xvmc.lo \ @XVMC_TRUE@ libIntelXvMC_la-i915_xvmc.lo \ @XVMC_TRUE@ libIntelXvMC_la-intel_batchbuffer.lo \ -@XVMC_TRUE@ libIntelXvMC_la-xf86dri.lo \ -@XVMC_TRUE@ libIntelXvMC_la-driDrawable.lo +@XVMC_TRUE@ libIntelXvMC_la-xf86dri.lo libIntelXvMC_la_OBJECTS = $(am_libIntelXvMC_la_OBJECTS) @XVMC_TRUE@am_libIntelXvMC_la_rpath = -rpath $(libdir) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) @@ -264,9 +263,7 @@ target_alias = @target_alias@ @XVMC_TRUE@ intel_batchbuffer.h \ @XVMC_TRUE@ xf86dri.c \ @XVMC_TRUE@ xf86dri.h \ -@XVMC_TRUE@ xf86dristr.h \ -@XVMC_TRUE@ driDrawable.c \ -@XVMC_TRUE@ driDrawable.h +@XVMC_TRUE@ xf86dristr.h @XVMC_TRUE@libIntelXvMC_la_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ @XVMCLIB_CFLAGS@ -I$(top_srcdir)/src -DTRUE=1 -DFALSE=0 @XVMC_TRUE@libIntelXvMC_la_LDFLAGS = -version-number 1:0:0 @@ -343,7 +340,6 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libI810XvMC_la-I810XvMC.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIntelXvMC_la-driDrawable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIntelXvMC_la-i915_xvmc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIntelXvMC_la-intel_batchbuffer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libIntelXvMC_la-intel_xvmc.Plo@am__quote@ @@ -405,13 +401,6 @@ libIntelXvMC_la-xf86dri.lo: xf86dri.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIntelXvMC_la_CFLAGS) $(CFLAGS) -c -o libIntelXvMC_la-xf86dri.lo `test -f 'xf86dri.c' || echo '$(srcdir)/'`xf86dri.c -libIntelXvMC_la-driDrawable.lo: driDrawable.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIntelXvMC_la_CFLAGS) $(CFLAGS) -MT libIntelXvMC_la-driDrawable.lo -MD -MP -MF "$(DEPDIR)/libIntelXvMC_la-driDrawable.Tpo" -c -o libIntelXvMC_la-driDrawable.lo `test -f 'driDrawable.c' || echo '$(srcdir)/'`driDrawable.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libIntelXvMC_la-driDrawable.Tpo" "$(DEPDIR)/libIntelXvMC_la-driDrawable.Plo"; else rm -f "$(DEPDIR)/libIntelXvMC_la-driDrawable.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='driDrawable.c' object='libIntelXvMC_la-driDrawable.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libIntelXvMC_la_CFLAGS) $(CFLAGS) -c -o libIntelXvMC_la-driDrawable.lo `test -f 'driDrawable.c' || echo '$(srcdir)/'`driDrawable.c - mostlyclean-libtool: -rm -f *.lo diff --git a/driver/xf86-video-intel/src/xvmc/driDrawable.c b/driver/xf86-video-intel/src/xvmc/driDrawable.c deleted file mode 100644 index 838633475..000000000 --- a/driver/xf86-video-intel/src/xvmc/driDrawable.c +++ /dev/null @@ -1,174 +0,0 @@ -/***************************************************************************** - * driDrawable.c: Lean Version of DRI utilities. - * - * Copyright (c) 2005 Thomas Hellstrom. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - -#include <X11/Xlibint.h> -#include <X11/Xutil.h> -#include "xf86drm.h" -#include "drm.h" -#include "xf86dri.h" -#include "drm_sarea.h" -#include "driDrawable.h" - -static unsigned -drawStamp(volatile drm_sarea_t * pSarea, int index) -{ - return pSarea->drawableTable[index].stamp; -} - -int -getDRIDrawableInfoLocked(void *drawHash, Display * display, int screen, - Drawable draw, unsigned lockFlags, int drmFD, drm_context_t drmContext, - drmAddress sarea, Bool updateInfo, drawableInfo ** info, - unsigned long infoSize) -{ - drawableInfo *drawInfo; - void *res; - drm_drawable_t drmDraw = 0; - volatile drm_sarea_t *pSarea = (drm_sarea_t *) sarea; - drm_clip_rect_t *clipFront, *clipBack; - - int ret; - - if (drmHashLookup(drawHash, (unsigned long)draw, &res)) { - - /* - * The drawable is unknown to us. Create it and put it in the - * hash table. - */ - - DRM_UNLOCK(drmFD, &pSarea->lock, drmContext); - if (!uniDRICreateDrawable(display, screen, draw, &drmDraw)) { - DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags); - return 1; - } - DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags); - - drawInfo = (drawableInfo *) malloc(infoSize); - if (!drawInfo) - return 1; - - drawInfo->drmDraw = drmDraw; - drawInfo->stamp = 0; - drawInfo->clipFront = 0; - drawInfo->clipBack = 0; - - drmHashInsert(drawHash, (unsigned long)draw, drawInfo); - - } else { - drawInfo = res; - } - - drawInfo->touched = FALSE; - while (!drawInfo->clipFront - || drawInfo->stamp != drawStamp(pSarea, drawInfo->index)) { - - /* - * The drawable has been touched since we last got info about it. - * obtain new info from the X server. - */ - - drawInfo->touched = TRUE; - - if (updateInfo || !drawInfo->clipFront) { - DRM_UNLOCK(drmFD, &pSarea->lock, drmContext); - - ret = uniDRIGetDrawableInfo(display, screen, draw, - &drawInfo->index, &drawInfo->stamp, &drawInfo->x, - &drawInfo->y, &drawInfo->w, &drawInfo->h, - &drawInfo->numClipFront, &clipFront, - &drawInfo->backX, &drawInfo->backY, - &drawInfo->numClipBack, &clipBack); - - DRM_LIGHT_LOCK(drmFD, &pSarea->lock, drmContext); - - /* - * Error. Probably the drawable is destroyed. Return error and old values. - */ - - if (!ret) { - free(drawInfo); - drawInfo = NULL; - drmHashDelete(drawHash, (unsigned long)draw); - - DRM_UNLOCK(drmFD, &pSarea->lock, drmContext); - uniDRIDestroyDrawable(display, screen, draw); - DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags); - - return 1; - } - - if (drawInfo->stamp != drawStamp(pSarea, drawInfo->index)) { - - /* - * The info is already outdated. Sigh. Have another go. - */ - - XFree(clipFront); - XFree(clipBack); - continue; - } - - if (drawInfo->clipFront) - XFree(drawInfo->clipFront); - drawInfo->clipFront = clipFront; - if (drawInfo->clipBack) - XFree(drawInfo->clipBack); - drawInfo->clipBack = clipBack; - } else { - if (!drawInfo->clipFront) - drawInfo->clipFront = (drm_clip_rect_t *) ~ 0UL; - drawInfo->stamp = drawStamp(pSarea, drawInfo->index); - } - } - *info = drawInfo; - return 0; -} - -void -driDestroyHashContents(void *drawHash) -{ - unsigned long key; - void *content; - drawableInfo *drawInfo; - - if (drmHashFirst(drawHash, &key, &content) < 1) - return; - drawInfo = (drawableInfo *) content; - if (drawInfo->clipBack) - XFree(drawInfo->clipBack); - if (drawInfo->clipFront) - XFree(drawInfo->clipFront); - free(drawInfo); - while (drmHashNext(drawHash, &key, &content) == 1) { - drawInfo = (drawableInfo *) content; - if (drawInfo->clipBack) - XFree(drawInfo->clipBack); - if (drawInfo->clipFront) - XFree(drawInfo->clipFront); - free(drawInfo); - } - - return; -} diff --git a/driver/xf86-video-intel/src/xvmc/driDrawable.h b/driver/xf86-video-intel/src/xvmc/driDrawable.h deleted file mode 100644 index a758c7c71..000000000 --- a/driver/xf86-video-intel/src/xvmc/driDrawable.h +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * driDrawable.h: Lean Version of DRI utilities. - * - * Copyright (c) 2005 Thomas Hellstrom. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifndef _DRIDRAWABLE_H -#define _DRIDRAWABLE_H - -typedef struct _drawableInfo -{ - drm_drawable_t drmDraw; - unsigned stamp; - unsigned index; - drm_clip_rect_t *clipFront; - drm_clip_rect_t *clipBack; - int x; - int y; - int w; - int h; - int backX; - int backY; - int numClipFront; - int numClipBack; - Bool touched; -} drawableInfo; - -/* - * Get updated info about the drawable "draw". The drawableInfo record returned is malloced - * and administrated internally. Never free it unless you know exactly what you are doing. - * The drm hash table "drawHash" needs to be initialized externally. - */ - -extern int -getDRIDrawableInfoLocked(void *drawHash, Display * display, int screen, - Drawable draw, unsigned lockFlags, int drmFD, drm_context_t drmContext, - drmAddress sarea, Bool updateInfo, drawableInfo ** info, - unsigned long infoSize); - -/* - * Free all resources created by the above function. Typically done on exit. - */ - -extern void driDestroyHashContents(void *drawHash); - -#endif diff --git a/driver/xf86-video-intel/src/xvmc/i915_xvmc.c b/driver/xf86-video-intel/src/xvmc/i915_xvmc.c index 20b2e613c..b1a17b4e8 100644 --- a/driver/xf86-video-intel/src/xvmc/i915_xvmc.c +++ b/driver/xf86-video-intel/src/xvmc/i915_xvmc.c @@ -1608,9 +1608,6 @@ static void i915_release_resource(Display *display, XvMCContext *context) pI915XvMC->ref--; i915_xvmc_unmap_buffers(pI915XvMC); - driDestroyHashContents(pI915XvMC->drawHash); - drmHashDestroy(pI915XvMC->drawHash); - free(pI915XvMC); context->privData = NULL; } @@ -1683,13 +1680,6 @@ static Status i915_xvmc_mc_create_context(Display *display, XvMCContext *context pSAREA = (drm_sarea_t *)xvmc_driver->sarea_address; pI915XvMC->sarea = (drmI830Sarea*)((char*)pSAREA + pI915XvMC->sarea_priv_offset); - if (NULL == (pI915XvMC->drawHash = drmHashCreate())) { - XVMC_ERR("Could not allocate drawable hash table."); - free(pI915XvMC); - context->privData = NULL; - return BadAlloc; - } - if (i915_xvmc_map_buffers(pI915XvMC)) { i915_xvmc_unmap_buffers(pI915XvMC); free(pI915XvMC); @@ -1997,7 +1987,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context, XVMC_ERR("Invalid Macroblock Parameters found."); break; } - } else { /* Frame Picture */ + } else { /* Field Picture */ switch (mb->motion_type & 3) { case XVMC_PREDICTION_FIELD: /* Field Based */ i915_mc_mpeg_macroblock_1fbmv(context, mb); @@ -2015,7 +2005,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context, XVMC_ERR("Invalid Macroblock Parameters found."); break; } - } /* Field Picture */ + } } intelFlushBatch(TRUE); diff --git a/driver/xf86-video-intel/src/xvmc/intel_xvmc.c b/driver/xf86-video-intel/src/xvmc/intel_xvmc.c index 1be8cc6b2..3c14f7391 100644 --- a/driver/xf86-video-intel/src/xvmc/intel_xvmc.c +++ b/driver/xf86-video-intel/src/xvmc/intel_xvmc.c @@ -513,7 +513,7 @@ Status XvMCCreateBlocks(Display *display, XvMCContext *context, */ Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *block) { - if (!display || block) + if (!display || !block) return BadValue; if (block->blocks) diff --git a/driver/xf86-video-intel/src/xvmc/intel_xvmc.h b/driver/xf86-video-intel/src/xvmc/intel_xvmc.h index 55066838d..bc863c475 100644 --- a/driver/xf86-video-intel/src/xvmc/intel_xvmc.h +++ b/driver/xf86-video-intel/src/xvmc/intel_xvmc.h @@ -53,7 +53,6 @@ #include <drm_sarea.h> #include "xf86dri.h" -#include "driDrawable.h" #include "intel_batchbuffer.h" |