diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-04-12 14:23:14 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-04-12 14:23:14 +0000 |
commit | 23bd4054f38c41f92bdb576d7901e1070c214196 (patch) | |
tree | 3ab394c320acc3c85ecd2f5506b8131610ea34ab | |
parent | 22a3a1e6d4f41d3dc4b564e66874943ec62688d7 (diff) |
just use an incremented int to calculate drawable ids. This is simpler
and causes no pointer size issues on amd64.
Tested by many.
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_drawable.c | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 09f0627976f..0fa1df871c5 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -1096,7 +1096,8 @@ int drm_adddraw(drm_device_t *dev, void *data, struct drm_file *file_priv); int drm_rmdraw(drm_device_t *dev, void *data, struct drm_file *file_priv); int drm_update_draw(drm_device_t *dev, void *data, struct drm_file *file_priv); void drm_drawable_free_all(struct drm_device *); -struct drm_drawable_info *drm_get_drawable_info(drm_device_t *dev, int handle); +struct drm_drawable_info *drm_get_drawable_info(drm_device_t *dev, + unsigned int handle); /* Authentication IOCTL support (drm_auth.c) */ int drm_getmagic(drm_device_t *dev, void *data, struct drm_file *file_priv); diff --git a/sys/dev/pci/drm/drm_drawable.c b/sys/dev/pci/drm/drm_drawable.c index 306f4bf5627..fb4ae3f0690 100644 --- a/sys/dev/pci/drm/drm_drawable.c +++ b/sys/dev/pci/drm/drm_drawable.c @@ -42,7 +42,7 @@ int drm_drawable_compare(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 *, int); + drm_get_drawable(struct drm_device *, unsigned int); #ifdef __OpenBSD__ RB_PROTOTYPE(drawable_tree, bsd_drm_drawable_info, tree, @@ -51,7 +51,7 @@ RB_PROTOTYPE(drawable_tree, bsd_drm_drawable_info, tree, struct bsd_drm_drawable_info { struct drm_drawable_info info; - int handle; + unsigned int handle; RB_ENTRY(bsd_drm_drawable_info) tree; }; @@ -75,7 +75,7 @@ RB_GENERATE(drawable_tree, bsd_drm_drawable_info, tree, #endif struct bsd_drm_drawable_info * -drm_get_drawable(struct drm_device *dev, int handle) +drm_get_drawable(struct drm_device *dev, unsigned int handle) { struct bsd_drm_drawable_info find; @@ -84,7 +84,7 @@ drm_get_drawable(struct drm_device *dev, int handle) } struct drm_drawable_info * -drm_get_drawable_info(drm_device_t *dev, int handle) +drm_get_drawable_info(drm_device_t *dev, unsigned int handle) { struct bsd_drm_drawable_info *result = NULL; @@ -108,7 +108,7 @@ drm_adddraw(drm_device_t *dev, void *data, struct drm_file *file_priv) #ifdef __FreeBSD__ info->handle = alloc_unr(dev->drw_unrhdr); #else - info->handle = (int)&info; /* pointers should be unique. */ + info->handle = ++dev->drw_no; #endif DRM_SPINLOCK(&dev->drw_lock); RB_INSERT(drawable_tree, &dev->drw_head, info); |