summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-01-29 11:18:17 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-01-29 11:18:17 +0000
commit9aabf5f46abf81e915eaf37ca0f69baf6f7c0edd (patch)
tree45fbcf784c1acd89d9b927676e7d284d4de661e8
parenta48c33ef421c3ca459f07e905c50642f8ea9250f (diff)
Rip out the drm_drawable support. There is no need for the xserver to
push cliprects into the kernel anymore so no op the ioctls. The only consumer of this information died a couple of months ago. When i've got removal of these calls from userland upstream i'm going to remove them from the interface entirely.
-rw-r--r--sys/dev/pci/drm/drmP.h14
-rw-r--r--sys/dev/pci/drm/drm_drawable.c205
-rw-r--r--sys/dev/pci/drm/drm_drv.c15
-rw-r--r--sys/dev/pci/drm/drm_internal.h40
-rw-r--r--sys/dev/pci/drm/files.drm3
5 files changed, 9 insertions, 268 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index 46ea5008043..32453e3b258 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -71,7 +71,6 @@
#include "drm.h"
#include "drm_linux_list.h"
#include "drm_atomic.h"
-#include "drm_internal.h"
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
@@ -500,7 +499,6 @@ struct drm_device {
DRM_SPINTYPE dma_lock; /* protects dev->dma */
DRM_SPINTYPE irq_lock; /* protects irq condition checks */
struct rwlock dev_lock; /* protects everything else */
- DRM_SPINTYPE drw_lock;
/* Usage Counters */
int open_count; /* Outstanding files open */
@@ -539,10 +537,6 @@ struct drm_device {
atomic_t *ctx_bitmap;
void *dev_private;
drm_local_map_t *agp_buffer_map;
-
- u_int drw_no;
- /* RB tree of drawable infos */
- RB_HEAD(drawable_tree, bsd_drm_drawable_info) drw_head;
};
struct drm_attach_args {
@@ -679,14 +673,6 @@ int drm_addctx(struct drm_device *, void *, struct drm_file *);
int drm_getctx(struct drm_device *, void *, struct drm_file *);
int drm_rmctx(struct drm_device *, void *, struct drm_file *);
-/* Drawable IOCTL support (drm_drawable.c) */
-int drm_adddraw(struct drm_device *, void *, struct drm_file *);
-int drm_rmdraw(struct drm_device *, void *, struct drm_file *);
-int drm_update_draw(struct drm_device *, void *, struct drm_file *);
-void drm_drawable_free_all(struct drm_device *);
-struct drm_drawable_info *drm_get_drawable_info(struct drm_device *,
- unsigned int);
-
/* Authentication IOCTL support (drm_auth.c) */
int drm_getmagic(struct drm_device *, void *, struct drm_file *);
int drm_authmagic(struct drm_device *, void *, struct drm_file *);
diff --git a/sys/dev/pci/drm/drm_drawable.c b/sys/dev/pci/drm/drm_drawable.c
deleted file mode 100644
index 4188c3190af..00000000000
--- a/sys/dev/pci/drm/drm_drawable.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*-
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
- * All Rights Reserved.
- *
- * 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
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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:
- * Rickard E. (Rik) Faith <faith@valinux.com>
- * Gareth Hughes <gareth@valinux.com>
- *
- */
-
-/** @file drm_drawable.c
- * This file implements ioctls to store information along with DRM drawables,
- * such as the current set of cliprects for vblank-synced buffer swaps.
- */
-
-#include "drmP.h"
-
-struct bsd_drm_drawable_info;
-
-int drm_drawable_compare(struct bsd_drm_drawable_info *,
- struct bsd_drm_drawable_info *);
-void drm_drawable_free(struct drm_device *dev,
- struct bsd_drm_drawable_info *draw);
-struct bsd_drm_drawable_info *
- drm_get_drawable(struct drm_device *, unsigned int);
-
-RB_PROTOTYPE(drawable_tree, bsd_drm_drawable_info, tree,
- drm_drawable_compare);
-
-struct bsd_drm_drawable_info {
- struct drm_drawable_info info;
- unsigned int handle;
- RB_ENTRY(bsd_drm_drawable_info) tree;
-};
-
-int
-drm_drawable_compare(struct bsd_drm_drawable_info *a,
- struct bsd_drm_drawable_info *b)
-{
- return (a->handle - b->handle);
-}
-
-RB_GENERATE(drawable_tree, bsd_drm_drawable_info, tree,
- drm_drawable_compare);
-
-struct bsd_drm_drawable_info *
-drm_get_drawable(struct drm_device *dev, unsigned int handle)
-{
- struct bsd_drm_drawable_info find;
-
- find.handle = handle;
- return (RB_FIND(drawable_tree, &dev->drw_head, &find));
-}
-
-struct drm_drawable_info *
-drm_get_drawable_info(struct drm_device *dev, unsigned int handle)
-{
- struct bsd_drm_drawable_info *result = NULL;
-
- if ((result = drm_get_drawable(dev, handle)))
- return (&result->info);
-
- return (NULL);
-}
-
-int
-drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_draw *draw = data;
- struct bsd_drm_drawable_info *info;
-
- info = drm_calloc(1, sizeof(struct bsd_drm_drawable_info),
- DRM_MEM_DRAWABLE);
- if (info == NULL)
- return (ENOMEM);
-
- DRM_SPINLOCK(&dev->drw_lock);
- draw->handle = info->handle = ++dev->drw_no;
- RB_INSERT(drawable_tree, &dev->drw_head, info);
- DRM_SPINUNLOCK(&dev->drw_lock);
-
- DRM_DEBUG("%d\n", draw->handle);
-
- return (0);
-}
-
-int
-drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_draw *draw = (drm_draw_t *)data;
- struct bsd_drm_drawable_info *info;
-
- DRM_SPINLOCK(&dev->drw_lock);
- info = drm_get_drawable(dev, draw->handle);
- if (info != NULL) {
- drm_drawable_free(dev, info);
- DRM_SPINUNLOCK(&dev->drw_lock);
- return (0);
- } else {
- DRM_SPINUNLOCK(&dev->drw_lock);
- return (EINVAL);
- }
-}
-
-int
-drm_update_draw(struct drm_device *dev, void *data, struct drm_file *file_priv)
-{
- struct drm_drawable_info *info;
- struct drm_update_draw *update = (struct drm_update_draw *)data;
- int ret = 0;
-
- DRM_SPINLOCK(&dev->drw_lock);
- info = drm_get_drawable_info(dev, update->handle);
- if (info == NULL) {
- ret = EINVAL;
- goto out;
- }
-
- switch (update->type) {
- case DRM_DRAWABLE_CLIPRECTS:
- if (update->num != info->num_rects) {
- struct drm_clip_rect *free = info->rects;
- size_t no = info->num_rects;
-
- info->rects = NULL;
- info->num_rects = 0;
- DRM_SPINUNLOCK(&dev->drw_lock);
- drm_free(free, sizeof(*info->rects) * no,
- DRM_MEM_DRAWABLE);
- DRM_SPINLOCK(&dev->drw_lock);
- }
- if (update->num == 0)
- goto out;
-
- if (info->rects == NULL) {
- struct drm_clip_rect *rects;
-
- DRM_SPINUNLOCK(&dev->drw_lock);
- rects = drm_calloc(update->num, sizeof(*info->rects),
- DRM_MEM_DRAWABLE);
- DRM_SPINLOCK(&dev->drw_lock);
- if (rects == NULL) {
- ret = ENOMEM;
- goto out;
- }
-
- info->rects = rects;
- info->num_rects = update->num;
- }
- /* For some reason the pointer arg is unsigned long long. */
- ret = copyin((void *)(intptr_t)update->data, info->rects,
- sizeof(*info->rects) * info->num_rects);
- break;
- default:
- ret = EINVAL;
- }
-
-out:
- DRM_SPINUNLOCK(&dev->drw_lock);
- return (ret);
-}
-
-void
-drm_drawable_free(struct drm_device *dev, struct bsd_drm_drawable_info *draw)
-{
- if (draw == NULL)
- return;
- RB_REMOVE(drawable_tree, &dev->drw_head, draw);
- DRM_SPINUNLOCK(&dev->drw_lock);
- drm_free(draw->info.rects, sizeof(*draw->info.rects) *
- draw->info.num_rects, DRM_MEM_DRAWABLE);
- drm_free(draw, sizeof(*draw), DRM_MEM_DRAWABLE);
- DRM_SPINLOCK(&dev->drw_lock);
-}
-
-void
-drm_drawable_free_all(struct drm_device *dev)
-{
- struct bsd_drm_drawable_info *draw;
-
- DRM_SPINLOCK(&dev->drw_lock);
- while ((draw = RB_ROOT(&dev->drw_head)) != NULL)
- drm_drawable_free(dev, draw);
- DRM_SPINUNLOCK(&dev->drw_lock);
-}
diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c
index 3584d93dc49..713954edc9f 100644
--- a/sys/dev/pci/drm/drm_drv.c
+++ b/sys/dev/pci/drm/drm_drv.c
@@ -130,7 +130,6 @@ drm_attach(struct device *parent, struct device *self, void *aux)
dev->unique_len = da->busid_len;
rw_init(&dev->dev_lock, "drmdevlk");
- mtx_init(&dev->drw_lock, IPL_NONE);
mtx_init(&dev->lock.spinlock, IPL_NONE);
TAILQ_INIT(&dev->maplist);
@@ -308,7 +307,6 @@ drm_lastclose(struct drm_device *dev)
drm_irq_uninstall(dev);
drm_agp_takedown(dev);
- drm_drawable_free_all(dev);
drm_dma_takedown(dev);
DRM_LOCK();
@@ -639,10 +637,6 @@ drmioctl(dev_t kdev, u_long cmd, caddr_t data, int flags,
return (drm_addctx(dev, data, file_priv));
case DRM_IOCTL_RM_CTX:
return (drm_rmctx(dev, data, file_priv));
- case DRM_IOCTL_ADD_DRAW:
- return (drm_adddraw(dev, data, file_priv));
- case DRM_IOCTL_RM_DRAW:
- return (drm_rmdraw(dev, data, file_priv));
case DRM_IOCTL_ADD_BUFS:
return (drm_addbufs_ioctl(dev, data, file_priv));
case DRM_IOCTL_CONTROL:
@@ -665,8 +659,15 @@ drmioctl(dev_t kdev, u_long cmd, caddr_t data, int flags,
return (drm_sg_alloc_ioctl(dev, data, file_priv));
case DRM_IOCTL_SG_FREE:
return (drm_sg_free(dev, data, file_priv));
+ case DRM_IOCTL_ADD_DRAW:
+ case DRM_IOCTL_RM_DRAW:
case DRM_IOCTL_UPDATE_DRAW:
- return (drm_update_draw(dev, data, file_priv));
+ /*
+ * Support removed from kernel since it's not used.
+ * just return zero until userland stops calling this
+ * ioctl.
+ */
+ return (0);
case DRM_IOCTL_SET_UNIQUE:
/*
* Deprecated in DRM version 1.1, and will return EBUSY
diff --git a/sys/dev/pci/drm/drm_internal.h b/sys/dev/pci/drm/drm_internal.h
deleted file mode 100644
index b82a189d38d..00000000000
--- a/sys/dev/pci/drm/drm_internal.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2007 Red Hat, Inc
- * All rights reserved.
- *
- * 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
- * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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.
- */
-
-/* This header file holds function prototypes and data types that are
- * internal to the drm (not exported to user space) but shared across
- * drivers and platforms */
-
-#ifndef __DRM_INTERNAL_H__
-#define __DRM_INTERNAL_H__
-
-/**
- * Drawable information.
- */
-struct drm_drawable_info {
- unsigned int num_rects;
- struct drm_clip_rect *rects;
-};
-
-#endif
diff --git a/sys/dev/pci/drm/files.drm b/sys/dev/pci/drm/files.drm
index 4252dff4cd8..d541ad9d66a 100644
--- a/sys/dev/pci/drm/files.drm
+++ b/sys/dev/pci/drm/files.drm
@@ -1,5 +1,5 @@
# $NetBSD: files.drm,v 1.2 2007/03/28 11:29:37 jmcneill Exp $
-# $OpenBSD: files.drm,v 1.7 2008/11/22 21:26:48 oga Exp $
+# $OpenBSD: files.drm,v 1.8 2009/01/29 11:18:16 oga Exp $
# direct rendering modules
define drmbase {}
@@ -10,7 +10,6 @@ file dev/pci/drm/drm_auth.c drm
file dev/pci/drm/drm_bufs.c drm
file dev/pci/drm/drm_context.c drm
file dev/pci/drm/drm_dma.c drm
-file dev/pci/drm/drm_drawable.c drm
file dev/pci/drm/drm_drv.c drm needs-flag
file dev/pci/drm/drm_ioctl.c drm
file dev/pci/drm/drm_irq.c drm