diff options
author | Eric Anholt <anholt@freebsd.org> | 2003-04-24 00:25:36 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2003-04-24 00:25:36 +0000 |
commit | 1fc0a5e1e4c43a0e9fe8b0d9860f22ae8e820d46 (patch) | |
tree | 396b905a16cb361eefbd6dc884c931a51fe9c7b2 /bsd-core | |
parent | e15b0b6a1b95e4145363b15e1a581ee230b2f9a2 (diff) |
Make DRM(read) and DRM(poll) stubs and remove DRM(write) and
DRM(write_string). This is the first part of removing much of the
support code for gamma from the BSD DRM, since it appears that no new
drivers are using it and nobody has ever shown interest in gamma on
BSD.
Diffstat (limited to 'bsd-core')
-rw-r--r-- | bsd-core/drmP.h | 11 | ||||
-rw-r--r-- | bsd-core/drm_context.c | 9 | ||||
-rw-r--r-- | bsd-core/drm_drv.c | 9 | ||||
-rw-r--r-- | bsd-core/drm_fops.c | 137 | ||||
-rw-r--r-- | bsd-core/drm_os_freebsd.h | 1 | ||||
-rw-r--r-- | bsd-core/drm_os_netbsd.h | 1 |
6 files changed, 3 insertions, 165 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h index 96dd52d8..e07337cc 100644 --- a/bsd-core/drmP.h +++ b/bsd-core/drmP.h @@ -487,21 +487,11 @@ struct drm_device { drm_histogram_t histo; #endif - /* Callback to X server for context switch - and for heavy-handed reset. */ - char buf[DRM_BSZ]; /* Output buffer */ - char *buf_rp; /* Read pointer */ - char *buf_wp; /* Write pointer */ - char *buf_end; /* End pointer */ #ifdef __FreeBSD__ struct sigio *buf_sigio; /* Processes waiting for SIGIO */ #elif defined(__NetBSD__) pid_t buf_pgid; #endif - struct selinfo buf_sel; /* Workspace for select/poll */ - int buf_selecting;/* True if poll sleeper */ - wait_queue_head_t buf_readers; /* Processes waiting to read */ - wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ /* Sysctl support */ struct drm_sysctl_info *sysctl; @@ -527,7 +517,6 @@ extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); /* Driver support (drm_drv.h) */ extern int DRM(version)( DRM_IOCTL_ARGS ); -extern int DRM(write_string)(drm_device_t *dev, const char *s); /* Memory management support (drm_memory.h) */ extern void DRM(mem_init)(void); diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c index c3a20f6e..5ceb23f2 100644 --- a/bsd-core/drm_context.c +++ b/bsd-core/drm_context.c @@ -206,8 +206,6 @@ bad: int DRM(context_switch)( drm_device_t *dev, int old, int new ) { - char buf[64]; - if ( test_and_set_bit( 0, &dev->context_flag ) ) { DRM_ERROR( "Reentering -- FIXME\n" ); return DRM_ERR(EBUSY); @@ -226,9 +224,6 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new ) if ( DRM(flags) & DRM_FLAG_NOCTX ) { DRM(context_switch_complete)( dev, new ); - } else { - sprintf( buf, "C %d %d\n", old, new ); - DRM(write_string)( dev, buf ); } return 0; @@ -374,7 +369,6 @@ int DRM(rmctx)( DRM_IOCTL_ARGS ) int DRM(context_switch)(drm_device_t *dev, int old, int new) { - char buf[64]; drm_queue_t *q; #if 0 @@ -412,9 +406,6 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new) if (DRM(flags) & DRM_FLAG_NOCTX) { DRM(context_switch_complete)(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - DRM(write_string)(dev, buf); } atomic_dec(&q->use_count); diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c index d43a4666..4de2d3b5 100644 --- a/bsd-core/drm_drv.c +++ b/bsd-core/drm_drv.c @@ -228,7 +228,6 @@ static struct cdevsw DRM(cdevsw) = { .d_open = DRM( open ), .d_close = DRM( close ), .d_read = DRM( read ), - .d_write = DRM( write ), .d_ioctl = DRM( ioctl ), .d_poll = DRM( poll ), .d_mmap = DRM( mmap ), @@ -290,7 +289,7 @@ static struct cdevsw DRM(cdevsw) = { DRM(open), DRM(close), DRM(read), - DRM(write), + nowrite, DRM(ioctl), nostop, notty, @@ -518,17 +517,11 @@ static int DRM(setup)( drm_device_t *dev ) dev->ctx_start = 0; dev->lck_start = 0; - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; #ifdef __FreeBSD__ dev->buf_sigio = NULL; #elif defined(__NetBSD__) dev->buf_pgid = 0; #endif - dev->buf_readers = 0; - dev->buf_writers = 0; - dev->buf_selecting = 0; DRM_DEBUG( "\n" ); diff --git a/bsd-core/drm_fops.c b/bsd-core/drm_fops.c index 75baa5f2..b0c18fa3 100644 --- a/bsd-core/drm_fops.c +++ b/bsd-core/drm_fops.c @@ -98,148 +98,15 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p, } -/* The drm_read and drm_write_string code (especially that which manages - the circular buffer), is based on Alessandro Rubini's LINUX DEVICE - DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */ +/* The DRM(read) and DRM(poll) are stubs to prevent spurious errors + * on older X Servers (4.3.0 and earlier) */ int DRM(read)(dev_t kdev, struct uio *uio, int ioflag) { - DRM_DEVICE; - int left; - int avail; - int send; - int cur; - int error = 0; - - DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); - - while (dev->buf_rp == dev->buf_wp) { - DRM_DEBUG(" sleeping\n"); - if (dev->flags & FASYNC) - return EWOULDBLOCK; - error = tsleep(&dev->buf_rp, PZERO|PCATCH, "drmrd", 0); - if (error) { - DRM_DEBUG(" interrupted\n"); - return error; - } - DRM_DEBUG(" awake\n"); - } - - left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - avail = DRM_BSZ - left; - send = DRM_MIN(avail, uio->uio_resid); - - while (send) { - if (dev->buf_wp > dev->buf_rp) { - cur = DRM_MIN(send, dev->buf_wp - dev->buf_rp); - } else { - cur = DRM_MIN(send, dev->buf_end - dev->buf_rp); - } - error = uiomove(dev->buf_rp, cur, uio); - if (error) - break; - dev->buf_rp += cur; - if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; - send -= cur; - } - - wakeup(&dev->buf_wp); - return error; -} - -int DRM(write_string)(drm_device_t *dev, const char *s) -{ - int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - int send = strlen(s); - int count; -#ifdef __NetBSD__ - struct proc *p; -#endif /* __NetBSD__ */ - - DRM_DEBUG("%d left, %d to send (%p, %p)\n", - left, send, dev->buf_rp, dev->buf_wp); - - if (left == 1 || dev->buf_wp != dev->buf_rp) { - DRM_ERROR("Buffer not empty (%d left, wp = %p, rp = %p)\n", - left, - dev->buf_wp, - dev->buf_rp); - } - - while (send) { - if (dev->buf_wp >= dev->buf_rp) { - count = DRM_MIN(send, dev->buf_end - dev->buf_wp); - if (count == left) --count; /* Leave a hole */ - } else { - count = DRM_MIN(send, dev->buf_rp - dev->buf_wp - 1); - } - strncpy(dev->buf_wp, s, count); - dev->buf_wp += count; - if (dev->buf_wp == dev->buf_end) dev->buf_wp = dev->buf; - send -= count; - } - - if (dev->buf_selecting) { - dev->buf_selecting = 0; - selwakeup(&dev->buf_sel); - } - -#ifdef __FreeBSD__ - DRM_DEBUG("dev->buf_sigio=%p\n", dev->buf_sigio); - if (dev->buf_sigio) { - DRM_DEBUG("dev->buf_sigio->sio_pgid=%d\n", dev->buf_sigio->sio_pgid); -#if __FreeBSD_version >= 500000 - pgsigio(&dev->buf_sigio, SIGIO, 0); -#else - pgsigio(dev->buf_sigio, SIGIO, 0); -#endif /* __FreeBSD_version */ - } -#endif /* __FreeBSD__ */ -#ifdef __NetBSD__ - if (dev->buf_pgid) { - DRM_DEBUG("dev->buf_pgid=%d\n", dev->buf_pgid); - if(dev->buf_pgid > 0) - gsignal(dev->buf_pgid, SIGIO); - else if(dev->buf_pgid && (p = pfind(-dev->buf_pgid)) != NULL) - psignal(p, SIGIO); - } -#endif /* __NetBSD__ */ - DRM_DEBUG("waking\n"); - wakeup(&dev->buf_rp); - return 0; } int DRM(poll)(dev_t kdev, int events, DRM_STRUCTPROC *p) { - DRM_DEVICE; - int s; - int revents = 0; - - s = spldrm(); - if (events & (POLLIN | POLLRDNORM)) { - int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - if (left > 0) - revents |= events & (POLLIN | POLLRDNORM); - else - selrecord(p, &dev->buf_sel); - } - splx(s); - - return revents; -} - -int DRM(write)(dev_t kdev, struct uio *uio, int ioflag) -{ -#if DRM_DEBUG_CODE - DRM_DEVICE; -#endif -#ifdef __FreeBSD__ - DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", - curproc->p_pid, dev->device, dev->open_count); -#elif defined(__NetBSD__) - DRM_DEBUG("pid = %d, device = %p, open_count = %d\n", - curproc->p_pid, &dev->device, dev->open_count); -#endif return 0; } diff --git a/bsd-core/drm_os_freebsd.h b/bsd-core/drm_os_freebsd.h index 30a6e362..93e768fe 100644 --- a/bsd-core/drm_os_freebsd.h +++ b/bsd-core/drm_os_freebsd.h @@ -385,7 +385,6 @@ extern d_ioctl_t DRM(ioctl); extern d_open_t DRM(open); extern d_close_t DRM(close); extern d_read_t DRM(read); -extern d_write_t DRM(write); extern d_poll_t DRM(poll); extern d_mmap_t DRM(mmap); extern int DRM(open_helper)(dev_t kdev, int flags, int fmt, diff --git a/bsd-core/drm_os_netbsd.h b/bsd-core/drm_os_netbsd.h index fa158254..e0a332d7 100644 --- a/bsd-core/drm_os_netbsd.h +++ b/bsd-core/drm_os_netbsd.h @@ -338,7 +338,6 @@ extern dev_type_ioctl(DRM(ioctl)); extern dev_type_open(DRM(open)); extern dev_type_close(DRM(close)); extern dev_type_read(DRM(read)); -extern dev_type_write(DRM(write)); extern dev_type_poll(DRM(poll)); extern dev_type_mmap(DRM(mmap)); extern int DRM(open_helper)(dev_t kdev, int flags, int fmt, |