diff options
Diffstat (limited to 'linux-core')
| -rw-r--r-- | linux-core/Makefile.kernel | 2 | ||||
| -rw-r--r-- | linux-core/radeon_drv.c | 2 | ||||
| -rw-r--r-- | linux-core/radeon_gem_proc.c | 143 | 
3 files changed, 146 insertions, 1 deletions
| diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel index 392abaf9..98616e4b 100644 --- a/linux-core/Makefile.kernel +++ b/linux-core/Makefile.kernel @@ -44,7 +44,7 @@ nouveau-objs := nouveau_drv.o nouveau_state.o nouveau_fifo.o nouveau_mem.o \  radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o radeon_gem.o \  	 radeon_buffer.o radeon_fence.o atom.o radeon_display.o radeon_atombios.o radeon_i2c.o radeon_connectors.o radeon_cs.o \  	atombios_crtc.o radeon_encoders.o radeon_fb.o radeon_combios.o radeon_legacy_crtc.o radeon_legacy_encoders.o \ -	radeon_cursor.o radeon_pm.o +	radeon_cursor.o radeon_pm.o radeon_gem_proc.o  sis-objs    := sis_drv.o sis_mm.o  ffb-objs    := ffb_drv.o ffb_context.o  savage-objs := savage_drv.o savage_bci.o savage_state.o diff --git a/linux-core/radeon_drv.c b/linux-core/radeon_drv.c index daa335b9..3bc0c057 100644 --- a/linux-core/radeon_drv.c +++ b/linux-core/radeon_drv.c @@ -122,6 +122,8 @@ static struct drm_driver driver = {  	.dma_ioctl = radeon_cp_buffers,  	.master_create = radeon_master_create,  	.master_destroy = radeon_master_destroy, +	.proc_init = radeon_gem_proc_init, +	.proc_cleanup = radeon_gem_proc_cleanup,  	.fops = {  		.owner = THIS_MODULE,  		.open = drm_open, diff --git a/linux-core/radeon_gem_proc.c b/linux-core/radeon_gem_proc.c new file mode 100644 index 00000000..d3b467b1 --- /dev/null +++ b/linux-core/radeon_gem_proc.c @@ -0,0 +1,143 @@ +/* + * Copyright © 2008 Intel Corporation + * + * 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 (including the next + * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *    Eric Anholt <eric@anholt.net> + *    Keith Packard <keithp@keithp.com> + * + */ + +#include "drmP.h" +#include "drm.h" +#include "radeon_drm.h" +#include "radeon_drv.h" + + +static int radeon_ring_info(char *buf, char **start, off_t offset, +			       int request, int *eof, void *data) +{ +	struct drm_minor *minor = (struct drm_minor *) data; +	struct drm_device *dev = minor->dev; +	drm_radeon_private_t *dev_priv = dev->dev_private; +	int len = 0; + +	if (offset > DRM_PROC_LIMIT) { +		*eof = 1; +		return 0; +	} + +	*start = &buf[offset]; +	*eof = 0; +	DRM_PROC_PRINT("RADEON_CP_RB_WPTR %08x\n", +		       RADEON_READ(RADEON_CP_RB_WPTR)); + +	DRM_PROC_PRINT("RADEON_CP_RB_RPTR %08x\n", +		       RADEON_READ(RADEON_CP_RB_RPTR)); + +	 +	if (len > request + offset) +		return request; +	*eof = 1; +	return len - offset; +} + +static int radeon_interrupt_info(char *buf, char **start, off_t offset, +			       int request, int *eof, void *data) +{ +	struct drm_minor *minor = (struct drm_minor *) data; +	struct drm_device *dev = minor->dev; +	drm_radeon_private_t *dev_priv = dev->dev_private; +	int len = 0; + +	if (offset > DRM_PROC_LIMIT) { +		*eof = 1; +		return 0; +	} + +	*start = &buf[offset]; +	*eof = 0; +	DRM_PROC_PRINT("Interrupt enable:    %08x\n", +		       RADEON_READ(RADEON_GEN_INT_CNTL)); + +	if (dev_priv->chip_family >= CHIP_RS690) { +	  DRM_PROC_PRINT("DxMODE_INT_MASK:         %08x\n", +			 RADEON_READ(R500_DxMODE_INT_MASK)); +	} +	DRM_PROC_PRINT("Interrupts received: %d\n", +		       atomic_read(&dev_priv->irq_received)); +	DRM_PROC_PRINT("Current sequence:    %d\n", +		       READ_BREADCRUMB(dev_priv)); +	DRM_PROC_PRINT("Counter sequence:     %d\n", +		       dev_priv->counter); + +	 +	if (len > request + offset) +		return request; +	*eof = 1; +	return len - offset; +} + +static struct drm_proc_list { +	/** file name */ +	const char *name; +	/** proc callback*/ +	int (*f) (char *, char **, off_t, int, int *, void *); +} radeon_gem_proc_list[] = { +	{"radeon_gem_interrupt", radeon_interrupt_info}, +	{"radeon_gem_ring", radeon_ring_info}, +}; + + +#define RADEON_GEM_PROC_ENTRIES ARRAY_SIZE(radeon_gem_proc_list) + +int radeon_gem_proc_init(struct drm_minor *minor) +{ +	struct proc_dir_entry *ent; +	int i, j; + +	for (i = 0; i < RADEON_GEM_PROC_ENTRIES; i++) { +		ent = create_proc_entry(radeon_gem_proc_list[i].name, +					S_IFREG | S_IRUGO, minor->dev_root); +		if (!ent) { +			DRM_ERROR("Cannot create /proc/dri/.../%s\n", +				  radeon_gem_proc_list[i].name); +			for (j = 0; j < i; j++) +				remove_proc_entry(radeon_gem_proc_list[i].name, +						  minor->dev_root); +			return -1; +		} +		ent->read_proc = radeon_gem_proc_list[i].f; +		ent->data = minor; +	} +	return 0; +} + +void radeon_gem_proc_cleanup(struct drm_minor *minor) +{ +	int i; + +	if (!minor->dev_root) +		return; + +	for (i = 0; i < RADEON_GEM_PROC_ENTRIES; i++) +		remove_proc_entry(radeon_gem_proc_list[i].name, minor->dev_root); +} | 
