diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 16:02:01 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 16:02:01 -0700 | 
| commit | fc1caf6eafb30ea185720e29f7f5eccca61ecd60 (patch) | |
| tree | 666dabc25a9b02e5c05f9eba32fa6b0d8027341a /drivers/gpu/drm/r128/r128_state.c | |
| parent | 9779714c8af09d57527f18d9aa2207dcc27a8687 (diff) | |
| parent | 96576a9e1a0cdb8a43d3af5846be0948f52b4460 (diff) | |
| download | olio-linux-3.10-fc1caf6eafb30ea185720e29f7f5eccca61ecd60.tar.xz olio-linux-3.10-fc1caf6eafb30ea185720e29f7f5eccca61ecd60.zip  | |
Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (204 commits)
  agp: intel-agp: do not use PCI resources before pci_enable_device()
  agp: efficeon-agp: do not use PCI resources before pci_enable_device()
  drm: kill BKL from common code
  drm/kms: Simplify setup of the initial I2C encoder config.
  drm,io-mapping: Specify slot to use for atomic mappings
  drm/radeon/kms: only expose underscan on avivo chips
  drm/radeon: add new pci ids
  drm: Cleanup after failing to create master->unique and dev->name
  drm/radeon: tone down overchatty acpi debug messages.
  drm/radeon/kms: enable underscan option for digital connectors
  drm/radeon/kms: fix calculation of h/v scaling factors
  drm/radeon/kms/igp: sideport is AMD only
  drm/radeon/kms: handle the case of no active displays properly in the bandwidth code
  drm: move ttm global code to core drm
  drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it.
  drm/radeon/kms: make sure HPD is set to NONE on analog-only connectors
  drm/radeon/kms: make sure rio_mem is valid before unmapping it
  drm/agp/i915: trim stolen space to 32M
  drm/i915: Unset cursor if out-of-bounds upon mode change (v4)
  drm/i915: Unreference object not handle on creation
  ...
Diffstat (limited to 'drivers/gpu/drm/r128/r128_state.c')
| -rw-r--r-- | drivers/gpu/drm/r128/r128_state.c | 121 | 
1 files changed, 53 insertions, 68 deletions
diff --git a/drivers/gpu/drm/r128/r128_state.c b/drivers/gpu/drm/r128/r128_state.c index af2665cf471..077af1f2f9b 100644 --- a/drivers/gpu/drm/r128/r128_state.c +++ b/drivers/gpu/drm/r128/r128_state.c @@ -37,8 +37,8 @@   * CCE hardware state programming functions   */ -static void r128_emit_clip_rects(drm_r128_private_t * dev_priv, -				 struct drm_clip_rect * boxes, int count) +static void r128_emit_clip_rects(drm_r128_private_t *dev_priv, +				 struct drm_clip_rect *boxes, int count)  {  	u32 aux_sc_cntl = 0x00000000;  	RING_LOCALS; @@ -80,7 +80,7 @@ static void r128_emit_clip_rects(drm_r128_private_t * dev_priv,  	ADVANCE_RING();  } -static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv) +static __inline__ void r128_emit_core(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	drm_r128_context_regs_t *ctx = &sarea_priv->context_state; @@ -95,7 +95,7 @@ static __inline__ void r128_emit_core(drm_r128_private_t * dev_priv)  	ADVANCE_RING();  } -static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv) +static __inline__ void r128_emit_context(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	drm_r128_context_regs_t *ctx = &sarea_priv->context_state; @@ -121,7 +121,7 @@ static __inline__ void r128_emit_context(drm_r128_private_t * dev_priv)  	ADVANCE_RING();  } -static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv) +static __inline__ void r128_emit_setup(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	drm_r128_context_regs_t *ctx = &sarea_priv->context_state; @@ -137,7 +137,7 @@ static __inline__ void r128_emit_setup(drm_r128_private_t * dev_priv)  	ADVANCE_RING();  } -static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv) +static __inline__ void r128_emit_masks(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	drm_r128_context_regs_t *ctx = &sarea_priv->context_state; @@ -156,7 +156,7 @@ static __inline__ void r128_emit_masks(drm_r128_private_t * dev_priv)  	ADVANCE_RING();  } -static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv) +static __inline__ void r128_emit_window(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	drm_r128_context_regs_t *ctx = &sarea_priv->context_state; @@ -171,7 +171,7 @@ static __inline__ void r128_emit_window(drm_r128_private_t * dev_priv)  	ADVANCE_RING();  } -static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv) +static __inline__ void r128_emit_tex0(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	drm_r128_context_regs_t *ctx = &sarea_priv->context_state; @@ -187,9 +187,8 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv)  	OUT_RING(tex->tex_cntl);  	OUT_RING(tex->tex_combine_cntl);  	OUT_RING(ctx->tex_size_pitch_c); -	for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) { +	for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++)  		OUT_RING(tex->tex_offset[i]); -	}  	OUT_RING(CCE_PACKET0(R128_CONSTANT_COLOR_C, 1));  	OUT_RING(ctx->constant_color_c); @@ -198,7 +197,7 @@ static __inline__ void r128_emit_tex0(drm_r128_private_t * dev_priv)  	ADVANCE_RING();  } -static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv) +static __inline__ void r128_emit_tex1(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	drm_r128_texture_regs_t *tex = &sarea_priv->tex_state[1]; @@ -211,9 +210,8 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv)  	OUT_RING(CCE_PACKET0(R128_SEC_TEX_CNTL_C, 1 + R128_MAX_TEXTURE_LEVELS));  	OUT_RING(tex->tex_cntl);  	OUT_RING(tex->tex_combine_cntl); -	for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++) { +	for (i = 0; i < R128_MAX_TEXTURE_LEVELS; i++)  		OUT_RING(tex->tex_offset[i]); -	}  	OUT_RING(CCE_PACKET0(R128_SEC_TEXTURE_BORDER_COLOR_C, 0));  	OUT_RING(tex->tex_border_color); @@ -221,7 +219,7 @@ static __inline__ void r128_emit_tex1(drm_r128_private_t * dev_priv)  	ADVANCE_RING();  } -static void r128_emit_state(drm_r128_private_t * dev_priv) +static void r128_emit_state(drm_r128_private_t *dev_priv)  {  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv;  	unsigned int dirty = sarea_priv->dirty; @@ -274,7 +272,7 @@ static void r128_emit_state(drm_r128_private_t * dev_priv)   * Performance monitoring functions   */ -static void r128_clear_box(drm_r128_private_t * dev_priv, +static void r128_clear_box(drm_r128_private_t *dev_priv,  			   int x, int y, int w, int h, int r, int g, int b)  {  	u32 pitch, offset; @@ -321,13 +319,12 @@ static void r128_clear_box(drm_r128_private_t * dev_priv,  	ADVANCE_RING();  } -static void r128_cce_performance_boxes(drm_r128_private_t * dev_priv) +static void r128_cce_performance_boxes(drm_r128_private_t *dev_priv)  { -	if (atomic_read(&dev_priv->idle_count) == 0) { +	if (atomic_read(&dev_priv->idle_count) == 0)  		r128_clear_box(dev_priv, 64, 4, 8, 8, 0, 255, 0); -	} else { +	else  		atomic_set(&dev_priv->idle_count, 0); -	}  }  #endif @@ -352,8 +349,8 @@ static void r128_print_dirty(const char *msg, unsigned int flags)  		 (flags & R128_REQUIRE_QUIESCENCE) ? "quiescence, " : "");  } -static void r128_cce_dispatch_clear(struct drm_device * dev, -				    drm_r128_clear_t * clear) +static void r128_cce_dispatch_clear(struct drm_device *dev, +				    drm_r128_clear_t *clear)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; @@ -458,7 +455,7 @@ static void r128_cce_dispatch_clear(struct drm_device * dev,  	}  } -static void r128_cce_dispatch_swap(struct drm_device * dev) +static void r128_cce_dispatch_swap(struct drm_device *dev)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; @@ -524,7 +521,7 @@ static void r128_cce_dispatch_swap(struct drm_device * dev)  	ADVANCE_RING();  } -static void r128_cce_dispatch_flip(struct drm_device * dev) +static void r128_cce_dispatch_flip(struct drm_device *dev)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	RING_LOCALS; @@ -542,11 +539,10 @@ static void r128_cce_dispatch_flip(struct drm_device * dev)  	R128_WAIT_UNTIL_PAGE_FLIPPED();  	OUT_RING(CCE_PACKET0(R128_CRTC_OFFSET, 0)); -	if (dev_priv->current_page == 0) { +	if (dev_priv->current_page == 0)  		OUT_RING(dev_priv->back_offset); -	} else { +	else  		OUT_RING(dev_priv->front_offset); -	}  	ADVANCE_RING(); @@ -566,7 +562,7 @@ static void r128_cce_dispatch_flip(struct drm_device * dev)  	ADVANCE_RING();  } -static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * buf) +static void r128_cce_dispatch_vertex(struct drm_device *dev, struct drm_buf *buf)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	drm_r128_buf_priv_t *buf_priv = buf->dev_private; @@ -585,9 +581,8 @@ static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * b  	if (buf->used) {  		buf_priv->dispatched = 1; -		if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) { +		if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS)  			r128_emit_state(dev_priv); -		}  		do {  			/* Emit the next set of up to three cliprects */ @@ -636,8 +631,8 @@ static void r128_cce_dispatch_vertex(struct drm_device * dev, struct drm_buf * b  	sarea_priv->nbox = 0;  } -static void r128_cce_dispatch_indirect(struct drm_device * dev, -				       struct drm_buf * buf, int start, int end) +static void r128_cce_dispatch_indirect(struct drm_device *dev, +				       struct drm_buf *buf, int start, int end)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	drm_r128_buf_priv_t *buf_priv = buf->dev_private; @@ -691,8 +686,8 @@ static void r128_cce_dispatch_indirect(struct drm_device * dev,  	dev_priv->sarea_priv->last_dispatch++;  } -static void r128_cce_dispatch_indices(struct drm_device * dev, -				      struct drm_buf * buf, +static void r128_cce_dispatch_indices(struct drm_device *dev, +				      struct drm_buf *buf,  				      int start, int end, int count)  {  	drm_r128_private_t *dev_priv = dev->dev_private; @@ -713,9 +708,8 @@ static void r128_cce_dispatch_indices(struct drm_device * dev,  	if (start != end) {  		buf_priv->dispatched = 1; -		if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS) { +		if (sarea_priv->dirty & ~R128_UPLOAD_CLIPRECTS)  			r128_emit_state(dev_priv); -		}  		dwords = (end - start + 3) / sizeof(u32); @@ -775,9 +769,9 @@ static void r128_cce_dispatch_indices(struct drm_device * dev,  	sarea_priv->nbox = 0;  } -static int r128_cce_dispatch_blit(struct drm_device * dev, +static int r128_cce_dispatch_blit(struct drm_device *dev,  				  struct drm_file *file_priv, -				  drm_r128_blit_t * blit) +				  drm_r128_blit_t *blit)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	struct drm_device_dma *dma = dev->dma; @@ -887,8 +881,8 @@ static int r128_cce_dispatch_blit(struct drm_device * dev,   * have hardware stencil support.   */ -static int r128_cce_dispatch_write_span(struct drm_device * dev, -					drm_r128_depth_t * depth) +static int r128_cce_dispatch_write_span(struct drm_device *dev, +					drm_r128_depth_t *depth)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	int count, x, y; @@ -902,12 +896,10 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev,  	if (count > 4096 || count <= 0)  		return -EMSGSIZE; -	if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { +	if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x)))  		return -EFAULT; -	} -	if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { +	if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y)))  		return -EFAULT; -	}  	buffer_size = depth->n * sizeof(u32);  	buffer = kmalloc(buffer_size, GFP_KERNEL); @@ -983,8 +975,8 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev,  	return 0;  } -static int r128_cce_dispatch_write_pixels(struct drm_device * dev, -					  drm_r128_depth_t * depth) +static int r128_cce_dispatch_write_pixels(struct drm_device *dev, +					  drm_r128_depth_t *depth)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	int count, *x, *y; @@ -1001,9 +993,8 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev,  	xbuf_size = count * sizeof(*x);  	ybuf_size = count * sizeof(*y);  	x = kmalloc(xbuf_size, GFP_KERNEL); -	if (x == NULL) { +	if (x == NULL)  		return -ENOMEM; -	}  	y = kmalloc(ybuf_size, GFP_KERNEL);  	if (y == NULL) {  		kfree(x); @@ -1105,8 +1096,8 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev,  	return 0;  } -static int r128_cce_dispatch_read_span(struct drm_device * dev, -				       drm_r128_depth_t * depth) +static int r128_cce_dispatch_read_span(struct drm_device *dev, +				       drm_r128_depth_t *depth)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	int count, x, y; @@ -1117,12 +1108,10 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev,  	if (count > 4096 || count <= 0)  		return -EMSGSIZE; -	if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { +	if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x)))  		return -EFAULT; -	} -	if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { +	if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y)))  		return -EFAULT; -	}  	BEGIN_RING(7); @@ -1148,8 +1137,8 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev,  	return 0;  } -static int r128_cce_dispatch_read_pixels(struct drm_device * dev, -					 drm_r128_depth_t * depth) +static int r128_cce_dispatch_read_pixels(struct drm_device *dev, +					 drm_r128_depth_t *depth)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	int count, *x, *y; @@ -1161,16 +1150,14 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev,  	if (count > 4096 || count <= 0)  		return -EMSGSIZE; -	if (count > dev_priv->depth_pitch) { +	if (count > dev_priv->depth_pitch)  		count = dev_priv->depth_pitch; -	}  	xbuf_size = count * sizeof(*x);  	ybuf_size = count * sizeof(*y);  	x = kmalloc(xbuf_size, GFP_KERNEL); -	if (x == NULL) { +	if (x == NULL)  		return -ENOMEM; -	}  	y = kmalloc(ybuf_size, GFP_KERNEL);  	if (y == NULL) {  		kfree(x); @@ -1220,7 +1207,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev,   * Polygon stipple   */ -static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple) +static void r128_cce_dispatch_stipple(struct drm_device *dev, u32 *stipple)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	int i; @@ -1230,9 +1217,8 @@ static void r128_cce_dispatch_stipple(struct drm_device * dev, u32 * stipple)  	BEGIN_RING(33);  	OUT_RING(CCE_PACKET0(R128_BRUSH_DATA0, 31)); -	for (i = 0; i < 32; i++) { +	for (i = 0; i < 32; i++)  		OUT_RING(stipple[i]); -	}  	ADVANCE_RING();  } @@ -1269,7 +1255,7 @@ static int r128_cce_clear(struct drm_device *dev, void *data, struct drm_file *f  	return 0;  } -static int r128_do_init_pageflip(struct drm_device * dev) +static int r128_do_init_pageflip(struct drm_device *dev)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	DRM_DEBUG("\n"); @@ -1288,7 +1274,7 @@ static int r128_do_init_pageflip(struct drm_device * dev)  	return 0;  } -static int r128_do_cleanup_pageflip(struct drm_device * dev) +static int r128_do_cleanup_pageflip(struct drm_device *dev)  {  	drm_r128_private_t *dev_priv = dev->dev_private;  	DRM_DEBUG("\n"); @@ -1645,17 +1631,16 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fi  	return 0;  } -void r128_driver_preclose(struct drm_device * dev, struct drm_file *file_priv) +void r128_driver_preclose(struct drm_device *dev, struct drm_file *file_priv)  {  	if (dev->dev_private) {  		drm_r128_private_t *dev_priv = dev->dev_private; -		if (dev_priv->page_flipping) { +		if (dev_priv->page_flipping)  			r128_do_cleanup_pageflip(dev); -		}  	}  } -void r128_driver_lastclose(struct drm_device * dev) +void r128_driver_lastclose(struct drm_device *dev)  {  	r128_do_cleanup_cce(dev);  }  |