diff options
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/drm_irq.c | 29 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_gem_tiling.c | 16 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 10 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 95 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 37 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 18 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_pm.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nv04_dfp.c | 12 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nv40_graph.c | 46 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/r100.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/r300.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_display.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/radeon_fb.c | 5 | 
17 files changed, 176 insertions, 115 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 3dadfa2a852..28d1d3c24d6 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -164,8 +164,10 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)  	 * available. In that case we can't account for this and just  	 * hope for the best.  	 */ -	if ((vblrc > 0) && (abs(diff_ns) > 1000000)) +	if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {  		atomic_inc(&dev->_vblank_count[crtc]); +		smp_mb__after_atomic_inc(); +	}  	/* Invalidate all timestamps while vblank irq's are off. */  	clear_vblank_timestamps(dev, crtc); @@ -491,6 +493,12 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc)  	/* Dot clock in Hz: */  	dotclock = (u64) crtc->hwmode.clock * 1000; +	/* Fields of interlaced scanout modes are only halve a frame duration. +	 * Double the dotclock to get halve the frame-/line-/pixelduration. +	 */ +	if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE) +		dotclock *= 2; +  	/* Valid dotclock? */  	if (dotclock > 0) {  		/* Convert scanline length in pixels and video dot clock to @@ -603,14 +611,6 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc,  		return -EAGAIN;  	} -	/* Don't know yet how to handle interlaced or -	 * double scan modes. Just no-op for now. -	 */ -	if (mode->flags & (DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLSCAN)) { -		DRM_DEBUG("crtc %d: Noop due to unsupported mode.\n", crtc); -		return -ENOTSUPP; -	} -  	/* Get current scanout position with system timestamp.  	 * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times  	 * if single query takes longer than max_error nanoseconds. @@ -858,10 +858,11 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)  	if (rc) {  		tslot = atomic_read(&dev->_vblank_count[crtc]) + diff;  		vblanktimestamp(dev, crtc, tslot) = t_vblank; -		smp_wmb();  	} +	smp_mb__before_atomic_inc();  	atomic_add(diff, &dev->_vblank_count[crtc]); +	smp_mb__after_atomic_inc();  }  /** @@ -1011,7 +1012,8 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,  		    struct drm_file *file_priv)  {  	struct drm_modeset_ctl *modeset = data; -	int crtc, ret = 0; +	int ret = 0; +	unsigned int crtc;  	/* If drm_vblank_init() hasn't been called yet, just no-op */  	if (!dev->num_crtcs) @@ -1293,15 +1295,16 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)  	 * e.g., due to spurious vblank interrupts. We need to  	 * ignore those for accounting.  	 */ -	if (abs(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) { +	if (abs64(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) {  		/* Store new timestamp in ringbuffer. */  		vblanktimestamp(dev, crtc, vblcount + 1) = tvblank; -		smp_wmb();  		/* Increment cooked vblank count. This also atomically commits  		 * the timestamp computed above.  		 */ +		smp_mb__before_atomic_inc();  		atomic_inc(&dev->_vblank_count[crtc]); +		smp_mb__after_atomic_inc();  	} else {  		DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n",  			  crtc, (int) diff_ns); diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 22a32b9932c..79a04fde69b 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c @@ -184,7 +184,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)  static bool  i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)  { -	int tile_width; +	int tile_width, tile_height;  	/* Linear is always fine */  	if (tiling_mode == I915_TILING_NONE) @@ -215,6 +215,20 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)  		}  	} +	if (IS_GEN2(dev) || +	    (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) +		tile_height = 32; +	else +		tile_height = 8; +	/* i8xx is strange: It has 2 interleaved rows of tiles, so needs an even +	 * number of tile rows. */ +	if (IS_GEN2(dev)) +		tile_height *= 2; + +	/* Size needs to be aligned to a full tile row */ +	if (size & (tile_height * stride - 1)) +		return false; +  	/* 965+ just needs multiples of tile width */  	if (INTEL_INFO(dev)->gen >= 4) {  		if (stride & (tile_width - 1)) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 97f946dcc1a..8a9e08bf1cf 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -316,6 +316,8 @@ static void i915_hotplug_work_func(struct work_struct *work)  	struct drm_mode_config *mode_config = &dev->mode_config;  	struct intel_encoder *encoder; +	DRM_DEBUG_KMS("running encoder hotplug functions\n"); +  	list_for_each_entry(encoder, &mode_config->encoder_list, base.head)  		if (encoder->hot_plug)  			encoder->hot_plug(encoder); @@ -1649,9 +1651,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev)  	} else {  		hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG |  			       SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; -		hotplug_mask |= SDE_AUX_MASK | SDE_FDI_MASK | SDE_TRANS_MASK; -		I915_WRITE(FDI_RXA_IMR, 0); -		I915_WRITE(FDI_RXB_IMR, 0); +		hotplug_mask |= SDE_AUX_MASK;  	}  	dev_priv->pch_irq_mask = ~hotplug_mask; diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 15d94c63918..729d4233b76 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -1553,17 +1553,7 @@  /* Backlight control */  #define BLC_PWM_CTL		0x61254 -#define   BACKLIGHT_MODULATION_FREQ_SHIFT		(17)  #define BLC_PWM_CTL2		0x61250 /* 965+ only */ -#define   BLM_COMBINATION_MODE (1 << 30) -/* - * This is the most significant 15 bits of the number of backlight cycles in a - * complete cycle of the modulated backlight control. - * - * The actual value is this field multiplied by two. - */ -#define   BACKLIGHT_MODULATION_FREQ_MASK		(0x7fff << 17) -#define   BLM_LEGACY_MODE				(1 << 16)  /*   * This is the number of cycles out of the backlight modulation cycle for which   * the backlight is on. diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3b006536b3d..e79b25bbee6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -1630,19 +1630,19 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,  		struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj;  		wait_event(dev_priv->pending_flip_queue, +			   atomic_read(&dev_priv->mm.wedged) ||  			   atomic_read(&obj->pending_flip) == 0);  		/* Big Hammer, we also need to ensure that any pending  		 * MI_WAIT_FOR_EVENT inside a user batch buffer on the  		 * current scanout is retired before unpinning the old  		 * framebuffer. +		 * +		 * This should only fail upon a hung GPU, in which case we +		 * can safely continue.  		 */  		ret = i915_gem_object_flush_gpu(obj, false); -		if (ret) { -			i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); -			mutex_unlock(&dev->struct_mutex); -			return ret; -		} +		(void) ret;  	}  	ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, @@ -2045,6 +2045,31 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)  		   atomic_read(&obj->pending_flip) == 0);  } +static bool intel_crtc_driving_pch(struct drm_crtc *crtc) +{ +	struct drm_device *dev = crtc->dev; +	struct drm_mode_config *mode_config = &dev->mode_config; +	struct intel_encoder *encoder; + +	/* +	 * If there's a non-PCH eDP on this crtc, it must be DP_A, and that +	 * must be driven by its own crtc; no sharing is possible. +	 */ +	list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { +		if (encoder->base.crtc != crtc) +			continue; + +		switch (encoder->type) { +		case INTEL_OUTPUT_EDP: +			if (!intel_encoder_is_pch_edp(&encoder->base)) +				return false; +			continue; +		} +	} + +	return true; +} +  static void ironlake_crtc_enable(struct drm_crtc *crtc)  {  	struct drm_device *dev = crtc->dev; @@ -2053,6 +2078,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)  	int pipe = intel_crtc->pipe;  	int plane = intel_crtc->plane;  	u32 reg, temp; +	bool is_pch_port = false;  	if (intel_crtc->active)  		return; @@ -2066,7 +2092,56 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)  			I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN);  	} -	ironlake_fdi_enable(crtc); +	is_pch_port = intel_crtc_driving_pch(crtc); + +	if (is_pch_port) +		ironlake_fdi_enable(crtc); +	else { +		/* disable CPU FDI tx and PCH FDI rx */ +		reg = FDI_TX_CTL(pipe); +		temp = I915_READ(reg); +		I915_WRITE(reg, temp & ~FDI_TX_ENABLE); +		POSTING_READ(reg); + +		reg = FDI_RX_CTL(pipe); +		temp = I915_READ(reg); +		temp &= ~(0x7 << 16); +		temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; +		I915_WRITE(reg, temp & ~FDI_RX_ENABLE); + +		POSTING_READ(reg); +		udelay(100); + +		/* Ironlake workaround, disable clock pointer after downing FDI */ +		if (HAS_PCH_IBX(dev)) +			I915_WRITE(FDI_RX_CHICKEN(pipe), +				   I915_READ(FDI_RX_CHICKEN(pipe) & +					     ~FDI_RX_PHASE_SYNC_POINTER_ENABLE)); + +		/* still set train pattern 1 */ +		reg = FDI_TX_CTL(pipe); +		temp = I915_READ(reg); +		temp &= ~FDI_LINK_TRAIN_NONE; +		temp |= FDI_LINK_TRAIN_PATTERN_1; +		I915_WRITE(reg, temp); + +		reg = FDI_RX_CTL(pipe); +		temp = I915_READ(reg); +		if (HAS_PCH_CPT(dev)) { +			temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; +			temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; +		} else { +			temp &= ~FDI_LINK_TRAIN_NONE; +			temp |= FDI_LINK_TRAIN_PATTERN_1; +		} +		/* BPC in FDI rx is consistent with that in PIPECONF */ +		temp &= ~(0x07 << 16); +		temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; +		I915_WRITE(reg, temp); + +		POSTING_READ(reg); +		udelay(100); +	}  	/* Enable panel fitting for LVDS */  	if (dev_priv->pch_pf_size && @@ -2100,6 +2175,10 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)  		intel_flush_display_plane(dev, plane);  	} +	/* Skip the PCH stuff if possible */ +	if (!is_pch_port) +		goto done; +  	/* For PCH output, training FDI link */  	if (IS_GEN6(dev))  		gen6_fdi_link_train(crtc); @@ -2184,7 +2263,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)  	I915_WRITE(reg, temp | TRANS_ENABLE);  	if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100))  		DRM_ERROR("failed to enable transcoder %d\n", pipe); - +done:  	intel_crtc_load_lut(crtc);  	intel_update_fbc(dev);  	intel_crtc_update_cursor(crtc, true); @@ -6496,7 +6575,7 @@ static void ironlake_disable_rc6(struct drm_device *dev)  		POSTING_READ(RSTDBYCTL);  	} -	ironlake_disable_rc6(dev); +	ironlake_teardown_rc6(dev);  }  static int ironlake_setup_rc6(struct drm_device *dev) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index c65992df458..d860abeda70 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -30,8 +30,6 @@  #include "intel_drv.h" -#define PCI_LBPC 0xf4 /* legacy/combination backlight modes */ -  void  intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,  		       struct drm_display_mode *adjusted_mode) @@ -112,19 +110,6 @@ done:  	dev_priv->pch_pf_size = (width << 16) | height;  } -static int is_backlight_combination_mode(struct drm_device *dev) -{ -	struct drm_i915_private *dev_priv = dev->dev_private; - -	if (INTEL_INFO(dev)->gen >= 4) -		return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE; - -	if (IS_GEN2(dev)) -		return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE; - -	return 0; -} -  static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)  {  	u32 val; @@ -181,9 +166,6 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev)  			if (INTEL_INFO(dev)->gen < 4)  				max &= ~1;  		} - -		if (is_backlight_combination_mode(dev)) -			max *= 0xff;  	}  	DRM_DEBUG_DRIVER("max backlight PWM = %d\n", max); @@ -201,15 +183,6 @@ u32 intel_panel_get_backlight(struct drm_device *dev)  		val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;  		if (IS_PINEVIEW(dev))  			val >>= 1; - -		if (is_backlight_combination_mode(dev)){ -			u8 lbpc; - -			val &= ~1; -			pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); -			val *= lbpc; -			val >>= 1; -		}  	}  	DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val); @@ -232,16 +205,6 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)  	if (HAS_PCH_SPLIT(dev))  		return intel_pch_panel_set_backlight(dev, level); - -	if (is_backlight_combination_mode(dev)){ -		u32 max = intel_panel_get_max_backlight(dev); -		u8 lpbc; - -		lpbc = level * 0xfe / max + 1; -		level /= lpbc; -		pci_write_config_byte(dev->pdev, PCI_LBPC, lpbc); -	} -  	tmp = I915_READ(BLC_PWM_CTL);  	if (IS_PINEVIEW(dev)) {  		tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1); diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 49e5e99917e..6bdab891c64 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c @@ -6228,7 +6228,7 @@ parse_dcb15_entry(struct drm_device *dev, struct dcb_table *dcb,  		entry->tvconf.has_component_output = false;  		break;  	case OUTPUT_LVDS: -		if ((conn & 0x00003f00) != 0x10) +		if ((conn & 0x00003f00) >> 8 != 0x10)  			entry->lvdsconf.use_straps_for_mode = true;  		entry->lvdsconf.use_power_scripts = true;  		break; diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index a7fae26f465..a52184007f5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -49,7 +49,10 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)  		DRM_ERROR("bo %p still attached to GEM object\n", bo);  	nv10_mem_put_tile_region(dev, nvbo->tile, NULL); -	nouveau_vm_put(&nvbo->vma); +	if (nvbo->vma.node) { +		nouveau_vm_unmap(&nvbo->vma); +		nouveau_vm_put(&nvbo->vma); +	}  	kfree(nvbo);  } @@ -128,6 +131,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,  		}  	} +	nvbo->bo.mem.num_pages = size >> PAGE_SHIFT;  	nouveau_bo_placement_set(nvbo, flags, 0);  	nvbo->channel = chan; @@ -166,17 +170,17 @@ static void  set_placement_range(struct nouveau_bo *nvbo, uint32_t type)  {  	struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev); +	int vram_pages = dev_priv->vram_size >> PAGE_SHIFT;  	if (dev_priv->card_type == NV_10 && -	    nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM)) { +	    nvbo->tile_mode && (type & TTM_PL_FLAG_VRAM) && +	    nvbo->bo.mem.num_pages < vram_pages / 2) {  		/*  		 * Make sure that the color and depth buffers are handled  		 * by independent memory controller units. Up to a 9x  		 * speed up when alpha-blending and depth-test are enabled  		 * at the same time.  		 */ -		int vram_pages = dev_priv->vram_size >> PAGE_SHIFT; -  		if (nvbo->tile_flags & NOUVEAU_GEM_TILE_ZETA) {  			nvbo->placement.fpfn = vram_pages / 2;  			nvbo->placement.lpfn = ~0; @@ -785,7 +789,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,  	if (ret)  		goto out; -	ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); +	ret = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, new_mem);  out:  	ttm_bo_mem_put(bo, &tmp_mem);  	return ret; @@ -811,11 +815,11 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,  	if (ret)  		return ret; -	ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, &tmp_mem); +	ret = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, &tmp_mem);  	if (ret)  		goto out; -	ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem); +	ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait_reserve, no_wait_gpu, new_mem);  	if (ret)  		goto out; diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index a21e0007683..390d82c3c4b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -507,6 +507,7 @@ nouveau_connector_native_mode(struct drm_connector *connector)  	int high_w = 0, high_h = 0, high_v = 0;  	list_for_each_entry(mode, &nv_connector->base.probed_modes, head) { +		mode->vrefresh = drm_mode_vrefresh(mode);  		if (helper->mode_valid(connector, mode) != MODE_OK ||  		    (mode->flags & DRM_MODE_FLAG_INTERLACE))  			continue; diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index f05c0cddfec..4399e2f34db 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c @@ -543,7 +543,7 @@ nouveau_pm_resume(struct drm_device *dev)  	struct nouveau_pm_engine *pm = &dev_priv->engine.pm;  	struct nouveau_pm_level *perflvl; -	if (pm->cur == &pm->boot) +	if (!pm->cur || pm->cur == &pm->boot)  		return;  	perflvl = pm->cur; diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index ef23550407b..c82db37d9f4 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c @@ -342,8 +342,8 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder,  	if (nv_encoder->dcb->type == OUTPUT_LVDS) {  		bool duallink, dummy; -		nouveau_bios_parse_lvds_table(dev, nv_connector->native_mode-> -					      clock, &duallink, &dummy); +		nouveau_bios_parse_lvds_table(dev, output_mode->clock, +					      &duallink, &dummy);  		if (duallink)  			regp->fp_control |= (8 << 28);  	} else @@ -518,8 +518,6 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)  		return;  	if (nv_encoder->dcb->lvdsconf.use_power_scripts) { -		struct nouveau_connector *nv_connector = nouveau_encoder_connector_get(nv_encoder); -  		/* when removing an output, crtc may not be set, but PANEL_OFF  		 * must still be run  		 */ @@ -527,12 +525,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)  			   nv04_dfp_get_bound_head(dev, nv_encoder->dcb);  		if (mode == DRM_MODE_DPMS_ON) { -			if (!nv_connector->native_mode) { -				NV_ERROR(dev, "Not turning on LVDS without native mode\n"); -				return; -			}  			call_lvds_script(dev, nv_encoder->dcb, head, -					 LVDS_PANEL_ON, nv_connector->native_mode->clock); +					 LVDS_PANEL_ON, nv_encoder->mode.clock);  		} else  			/* pxclk of 0 is fine for PANEL_OFF, and for a  			 * disconnected LVDS encoder there is no native_mode diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index 8870d72388c..18d30c2c1aa 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c @@ -211,18 +211,32 @@ nv40_graph_set_tile_region(struct drm_device *dev, int i)  	struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i];  	switch (dev_priv->chipset) { +	case 0x40: +	case 0x41: /* guess */ +	case 0x42: +	case 0x43: +	case 0x45: /* guess */ +	case 0x4e: +		nv_wr32(dev, NV20_PGRAPH_TSIZE(i), tile->pitch); +		nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), tile->limit); +		nv_wr32(dev, NV20_PGRAPH_TILE(i), tile->addr); +		nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tile->pitch); +		nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tile->limit); +		nv_wr32(dev, NV40_PGRAPH_TILE1(i), tile->addr); +		break;  	case 0x44:  	case 0x4a: -	case 0x4e:  		nv_wr32(dev, NV20_PGRAPH_TSIZE(i), tile->pitch);  		nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), tile->limit);  		nv_wr32(dev, NV20_PGRAPH_TILE(i), tile->addr);  		break; -  	case 0x46:  	case 0x47:  	case 0x49:  	case 0x4b: +	case 0x4c: +	case 0x67: +	default:  		nv_wr32(dev, NV47_PGRAPH_TSIZE(i), tile->pitch);  		nv_wr32(dev, NV47_PGRAPH_TLIMIT(i), tile->limit);  		nv_wr32(dev, NV47_PGRAPH_TILE(i), tile->addr); @@ -230,15 +244,6 @@ nv40_graph_set_tile_region(struct drm_device *dev, int i)  		nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tile->limit);  		nv_wr32(dev, NV40_PGRAPH_TILE1(i), tile->addr);  		break; - -	default: -		nv_wr32(dev, NV20_PGRAPH_TSIZE(i), tile->pitch); -		nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), tile->limit); -		nv_wr32(dev, NV20_PGRAPH_TILE(i), tile->addr); -		nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tile->pitch); -		nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tile->limit); -		nv_wr32(dev, NV40_PGRAPH_TILE1(i), tile->addr); -		break;  	}  } @@ -396,17 +401,20 @@ nv40_graph_init(struct drm_device *dev)  		break;  	default:  		switch (dev_priv->chipset) { -		case 0x46: -		case 0x47: -		case 0x49: -		case 0x4b: -			nv_wr32(dev, 0x400DF0, nv_rd32(dev, NV04_PFB_CFG0)); -			nv_wr32(dev, 0x400DF4, nv_rd32(dev, NV04_PFB_CFG1)); -			break; -		default: +		case 0x41: +		case 0x42: +		case 0x43: +		case 0x45: +		case 0x4e: +		case 0x44: +		case 0x4a:  			nv_wr32(dev, 0x4009F0, nv_rd32(dev, NV04_PFB_CFG0));  			nv_wr32(dev, 0x4009F4, nv_rd32(dev, NV04_PFB_CFG1));  			break; +		default: +			nv_wr32(dev, 0x400DF0, nv_rd32(dev, NV04_PFB_CFG0)); +			nv_wr32(dev, 0x400DF4, nv_rd32(dev, NV04_PFB_CFG1)); +			break;  		}  		nv_wr32(dev, 0x4069F0, nv_rd32(dev, NV04_PFB_CFG0));  		nv_wr32(dev, 0x4069F4, nv_rd32(dev, NV04_PFB_CFG1)); diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 095bc507fb1..a4e5e53e0a6 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c @@ -557,9 +557,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,  			/* use recommended ref_div for ss */  			if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { -				pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;  				if (ss_enabled) {  					if (ss->refdiv) { +						pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;  						pll->flags |= RADEON_PLL_USE_REF_DIV;  						pll->reference_div = ss->refdiv;  						if (ASIC_IS_AVIVO(rdev)) @@ -662,10 +662,12 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,  						   index, (uint32_t *)&args);  				adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10;  				if (args.v3.sOutput.ucRefDiv) { +					pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV;  					pll->flags |= RADEON_PLL_USE_REF_DIV;  					pll->reference_div = args.v3.sOutput.ucRefDiv;  				}  				if (args.v3.sOutput.ucPostDiv) { +					pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV;  					pll->flags |= RADEON_PLL_USE_POST_DIV;  					pll->post_div = args.v3.sOutput.ucPostDiv;  				} diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 56deae5bf02..93fa735c8c1 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c @@ -3490,7 +3490,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track  		track->num_texture = 16;  		track->maxy = 4096;  		track->separate_cube = 0; -		track->aaresolve = true; +		track->aaresolve = false;  		track->aa.robj = NULL;  	} @@ -3801,8 +3801,6 @@ static int r100_startup(struct radeon_device *rdev)  	r100_mc_program(rdev);  	/* Resume clock */  	r100_clock_startup(rdev); -	/* Initialize GPU configuration (# pipes, ...) */ -//	r100_gpu_init(rdev);  	/* Initialize GART (initialize after TTM so we can allocate  	 * memory through TTM but finalize after TTM) */  	r100_enable_bm(rdev); diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 768c60ee4ab..069efa8c8ec 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c @@ -910,6 +910,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,  			track->textures[i].compress_format = R100_TRACK_COMP_NONE;  			break;  		case R300_TX_FORMAT_X16: +		case R300_TX_FORMAT_FL_I16:  		case R300_TX_FORMAT_Y8X8:  		case R300_TX_FORMAT_Z5Y6X5:  		case R300_TX_FORMAT_Z6Y5X5: @@ -922,6 +923,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,  			track->textures[i].compress_format = R100_TRACK_COMP_NONE;  			break;  		case R300_TX_FORMAT_Y16X16: +		case R300_TX_FORMAT_FL_I16A16:  		case R300_TX_FORMAT_Z11Y11X10:  		case R300_TX_FORMAT_Z10Y11X11:  		case R300_TX_FORMAT_W8Z8Y8X8: diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 0e657095de7..3e7e7f9eb78 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -971,7 +971,7 @@ void radeon_compute_pll_legacy(struct radeon_pll *pll,  		max_fractional_feed_div = pll->max_frac_feedback_div;  	} -	for (post_div = min_post_div; post_div <= max_post_div; ++post_div) { +	for (post_div = max_post_div; post_div >= min_post_div; --post_div) {  		uint32_t ref_div;  		if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index 66324b5bb5b..cc44bdfec80 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c @@ -113,11 +113,14 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,  	u32 tiling_flags = 0;  	int ret;  	int aligned_size, size; +	int height = mode_cmd->height;  	/* need to align pitch with crtc limits */  	mode_cmd->pitch = radeon_align_pitch(rdev, mode_cmd->width, mode_cmd->bpp, fb_tiled) * ((mode_cmd->bpp + 1) / 8); -	size = mode_cmd->pitch * mode_cmd->height; +	if (rdev->family >= CHIP_R600) +		height = ALIGN(mode_cmd->height, 8); +	size = mode_cmd->pitch * height;  	aligned_size = ALIGN(size, PAGE_SIZE);  	ret = radeon_gem_object_create(rdev, aligned_size, 0,  				       RADEON_GEM_DOMAIN_VRAM,  |