diff options
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/drm_fops.c | 44 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | 20 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/graph/nv40.c | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 54 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreen.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreen_cs.c | 3 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/evergreend.h | 4 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/si.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/radeon/sid.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c | 2 | ||||
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 | 
14 files changed, 94 insertions, 52 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 7ef1b673e1b..133b4132983 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -121,6 +121,8 @@ int drm_open(struct inode *inode, struct file *filp)  	int minor_id = iminor(inode);  	struct drm_minor *minor;  	int retcode = 0; +	int need_setup = 0; +	struct address_space *old_mapping;  	minor = idr_find(&drm_minors_idr, minor_id);  	if (!minor) @@ -132,23 +134,37 @@ int drm_open(struct inode *inode, struct file *filp)  	if (drm_device_is_unplugged(dev))  		return -ENODEV; +	if (!dev->open_count++) +		need_setup = 1; +	mutex_lock(&dev->struct_mutex); +	old_mapping = dev->dev_mapping; +	if (old_mapping == NULL) +		dev->dev_mapping = &inode->i_data; +	/* ihold ensures nobody can remove inode with our i_data */ +	ihold(container_of(dev->dev_mapping, struct inode, i_data)); +	inode->i_mapping = dev->dev_mapping; +	filp->f_mapping = dev->dev_mapping; +	mutex_unlock(&dev->struct_mutex); +  	retcode = drm_open_helper(inode, filp, dev); -	if (!retcode) { -		atomic_inc(&dev->counts[_DRM_STAT_OPENS]); -		if (!dev->open_count++) -			retcode = drm_setup(dev); -	} -	if (!retcode) { -		mutex_lock(&dev->struct_mutex); -		if (dev->dev_mapping == NULL) -			dev->dev_mapping = &inode->i_data; -		/* ihold ensures nobody can remove inode with our i_data */ -		ihold(container_of(dev->dev_mapping, struct inode, i_data)); -		inode->i_mapping = dev->dev_mapping; -		filp->f_mapping = dev->dev_mapping; -		mutex_unlock(&dev->struct_mutex); +	if (retcode) +		goto err_undo; +	atomic_inc(&dev->counts[_DRM_STAT_OPENS]); +	if (need_setup) { +		retcode = drm_setup(dev); +		if (retcode) +			goto err_undo;  	} +	return 0; +err_undo: +	mutex_lock(&dev->struct_mutex); +	filp->f_mapping = old_mapping; +	inode->i_mapping = old_mapping; +	iput(container_of(dev->dev_mapping, struct inode, i_data)); +	dev->dev_mapping = old_mapping; +	mutex_unlock(&dev->struct_mutex); +	dev->open_count--;  	return retcode;  }  EXPORT_SYMBOL(drm_open); diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 16a9afb1060..05a909a17ce 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c @@ -22,6 +22,8 @@   * Authors: Ben Skeggs   */ +#include <subdev/bar.h> +  #include <engine/software.h>  #include <engine/disp.h> @@ -37,6 +39,7 @@ nv50_disp_sclass[] = {  static void  nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)  { +	struct nouveau_bar *bar = nouveau_bar(priv);  	struct nouveau_disp *disp = &priv->base;  	struct nouveau_software_chan *chan, *temp;  	unsigned long flags; @@ -46,18 +49,19 @@ nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)  		if (chan->vblank.crtc != crtc)  			continue; -		nv_wr32(priv, 0x001704, chan->vblank.channel); -		nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma); -  		if (nv_device(priv)->chipset == 0x50) { +			nv_wr32(priv, 0x001704, chan->vblank.channel); +			nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma); +			bar->flush(bar);  			nv_wr32(priv, 0x001570, chan->vblank.offset);  			nv_wr32(priv, 0x001574, chan->vblank.value);  		} else { -			if (nv_device(priv)->chipset >= 0xc0) { -				nv_wr32(priv, 0x06000c, -					upper_32_bits(chan->vblank.offset)); -			} -			nv_wr32(priv, 0x060010, chan->vblank.offset); +			nv_wr32(priv, 0x001718, 0x80000000 | chan->vblank.channel); +			bar->flush(bar); +			nv_wr32(priv, 0x06000c, +				upper_32_bits(chan->vblank.offset)); +			nv_wr32(priv, 0x060010, +				lower_32_bits(chan->vblank.offset));  			nv_wr32(priv, 0x060014, chan->vblank.value);  		} diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c index 8d0021049ec..425001204a8 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c @@ -156,8 +156,8 @@ nv40_graph_context_ctor(struct nouveau_object *parent,  static int  nv40_graph_context_fini(struct nouveau_object *object, bool suspend)  { -	struct nv04_graph_priv *priv = (void *)object->engine; -	struct nv04_graph_chan *chan = (void *)object; +	struct nv40_graph_priv *priv = (void *)object->engine; +	struct nv40_graph_chan *chan = (void *)object;  	u32 inst = 0x01000000 | nv_gpuobj(chan)->addr >> 4;  	int ret = 0; diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c index 12418574efe..f7c581ad199 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c @@ -38,7 +38,7 @@ struct nv40_mpeg_priv {  };  struct nv40_mpeg_chan { -	struct nouveau_mpeg base; +	struct nouveau_mpeg_chan base;  };  /******************************************************************************* diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c index 49050d991e7..9474cfca6e4 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c @@ -67,7 +67,7 @@ nv41_vm_unmap(struct nouveau_gpuobj *pgt, u32 pte, u32 cnt)  static void  nv41_vm_flush(struct nouveau_vm *vm)  { -	struct nv04_vm_priv *priv = (void *)vm->vmm; +	struct nv04_vmmgr_priv *priv = (void *)vm->vmm;  	mutex_lock(&nv_subdev(priv)->mutex);  	nv_wr32(priv, 0x100810, 0x00000022); diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 9a6e2cb282d..d3595b23434 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -355,7 +355,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force)  	 * valid - it's not (rh#613284)  	 */  	if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) { -		if (!(nv_connector->edid = nouveau_acpi_edid(dev, connector))) { +		if ((nv_connector->edid = nouveau_acpi_edid(dev, connector))) {  			status = connector_status_connected;  			goto out;  		} diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 2e566e123e9..3bce0299f64 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c @@ -1696,35 +1696,43 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc)  			return ATOM_PPLL2;  		DRM_ERROR("unable to allocate a PPLL\n");  		return ATOM_PPLL_INVALID; -	} else { -		if (ASIC_IS_AVIVO(rdev)) { -			/* in DP mode, the DP ref clock can come from either PPLL -			 * depending on the asic: -			 * DCE3: PPLL1 or PPLL2 -			 */ -			if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) { -				/* use the same PPLL for all DP monitors */ -				pll = radeon_get_shared_dp_ppll(crtc); -				if (pll != ATOM_PPLL_INVALID) -					return pll; -			} else { -				/* use the same PPLL for all monitors with the same clock */ -				pll = radeon_get_shared_nondp_ppll(crtc); -				if (pll != ATOM_PPLL_INVALID) -					return pll; -			} -			/* all other cases */ -			pll_in_use = radeon_get_pll_use_mask(crtc); +	} else if (ASIC_IS_AVIVO(rdev)) { +		/* in DP mode, the DP ref clock can come from either PPLL +		 * depending on the asic: +		 * DCE3: PPLL1 or PPLL2 +		 */ +		if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) { +			/* use the same PPLL for all DP monitors */ +			pll = radeon_get_shared_dp_ppll(crtc); +			if (pll != ATOM_PPLL_INVALID) +				return pll; +		} else { +			/* use the same PPLL for all monitors with the same clock */ +			pll = radeon_get_shared_nondp_ppll(crtc); +			if (pll != ATOM_PPLL_INVALID) +				return pll; +		} +		/* all other cases */ +		pll_in_use = radeon_get_pll_use_mask(crtc); +		/* the order shouldn't matter here, but we probably +		 * need this until we have atomic modeset +		 */ +		if (rdev->flags & RADEON_IS_IGP) {  			if (!(pll_in_use & (1 << ATOM_PPLL1)))  				return ATOM_PPLL1;  			if (!(pll_in_use & (1 << ATOM_PPLL2)))  				return ATOM_PPLL2; -			DRM_ERROR("unable to allocate a PPLL\n"); -			return ATOM_PPLL_INVALID;  		} else { -			/* on pre-R5xx asics, the crtc to pll mapping is hardcoded */ -			return radeon_crtc->crtc_id; +			if (!(pll_in_use & (1 << ATOM_PPLL2))) +				return ATOM_PPLL2; +			if (!(pll_in_use & (1 << ATOM_PPLL1))) +				return ATOM_PPLL1;  		} +		DRM_ERROR("unable to allocate a PPLL\n"); +		return ATOM_PPLL_INVALID; +	} else { +		/* on pre-R5xx asics, the crtc to pll mapping is hardcoded */ +		return radeon_crtc->crtc_id;  	}  } diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 14313ad43b7..af31f829f4a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -1372,7 +1372,7 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s  	WREG32(BIF_FB_EN, FB_READ_EN | FB_WRITE_EN);  	for (i = 0; i < rdev->num_crtc; i++) { -		if (save->crtc_enabled) { +		if (save->crtc_enabled[i]) {  			if (ASIC_IS_DCE6(rdev)) {  				tmp = RREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i]);  				tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 95e6318b626..c042e497e45 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c @@ -2725,6 +2725,9 @@ static bool evergreen_vm_reg_valid(u32 reg)  	/* check config regs */  	switch (reg) {  	case GRBM_GFX_INDEX: +	case CP_STRMOUT_CNTL: +	case CP_COHER_CNTL: +	case CP_COHER_SIZE:  	case VGT_VTX_VECT_EJECT_REG:  	case VGT_CACHE_INVALIDATION:  	case VGT_GS_VERTEX_REUSE: diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index df542f1a5df..2bc0f6a1b42 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h @@ -91,6 +91,10 @@  #define		FB_READ_EN					(1 << 0)  #define		FB_WRITE_EN					(1 << 1) +#define	CP_STRMOUT_CNTL					0x84FC + +#define	CP_COHER_CNTL					0x85F0 +#define	CP_COHER_SIZE					0x85F4  #define	CP_COHER_BASE					0x85F8  #define	CP_STALLED_STAT1			0x8674  #define	CP_STALLED_STAT2			0x8678 diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index b0db712060f..4422d630b33 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -2474,6 +2474,7 @@ static bool si_vm_reg_valid(u32 reg)  	/* check config regs */  	switch (reg) {  	case GRBM_GFX_INDEX: +	case CP_STRMOUT_CNTL:  	case VGT_VTX_VECT_EJECT_REG:  	case VGT_CACHE_INVALIDATION:  	case VGT_ESGS_RING_SIZE: diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h index 7d2a20e5657..a8871afc5b4 100644 --- a/drivers/gpu/drm/radeon/sid.h +++ b/drivers/gpu/drm/radeon/sid.h @@ -424,6 +424,7 @@  #       define RDERR_INT_ENABLE                         (1 << 0)  #       define GUI_IDLE_INT_ENABLE                      (1 << 19) +#define	CP_STRMOUT_CNTL					0x84FC  #define	SCRATCH_REG0					0x8500  #define	SCRATCH_REG1					0x8504  #define	SCRATCH_REG2					0x8508 diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c index 3ce68a2e312..d1498bfd787 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c @@ -306,7 +306,7 @@ void vmw_bo_pin(struct ttm_buffer_object *bo, bool pin)  	BUG_ON(!atomic_read(&bo->reserved));  	BUG_ON(old_mem_type != TTM_PL_VRAM && -	       old_mem_type != VMW_PL_FLAG_GMR); +	       old_mem_type != VMW_PL_GMR);  	pl_flags = TTM_PL_FLAG_VRAM | VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED;  	if (pin) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index ed3c1e7ddde..2dd185e42f2 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1098,6 +1098,11 @@ static void vmw_pm_complete(struct device *kdev)  	struct drm_device *dev = pci_get_drvdata(pdev);  	struct vmw_private *dev_priv = vmw_priv(dev); +	mutex_lock(&dev_priv->hw_mutex); +	vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2); +	(void) vmw_read(dev_priv, SVGA_REG_ID); +	mutex_unlock(&dev_priv->hw_mutex); +  	/**  	 * Reclaim 3d reference held by fbdev and potentially  	 * start fifo.  |