aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-03-08 19:56:52 -0500
committerDave Airlie <airlied@redhat.com>2010-08-03 19:46:06 -0400
commitba4420c224c2808f2661cf8428f43ceef7a73a4a (patch)
tree67b32498483c797c76e8f504a83746bdef35db7d /include
parent2581afccadd347bf97c3a5620ba72c99aca8c355 (diff)
drm: move ttm global code to core drm
I wrote this for the prime sharing work, but I also noticed other external non-upstream drivers from a large company carrying a similiar patch, so I may as well ship it in master. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm.h2
-rw-r--r--include/drm/drmP.h2
-rw-r--r--include/drm/drm_global.h53
-rw-r--r--include/drm/ttm/ttm_bo_driver.h7
-rw-r--r--include/drm/ttm/ttm_module.h20
5 files changed, 61 insertions, 23 deletions
diff --git a/include/drm/drm.h b/include/drm/drm.h
index e3f46e0cb7dc..e5f70617dec5 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -663,6 +663,8 @@ struct drm_gem_open {
663#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 663#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock)
664#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 664#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock)
665 665
666#define DRM_IOCTL_GEM_PRIME_OPEN DRM_IOWR(0x2e, struct drm_gem_open)
667
666#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) 668#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30)
667#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) 669#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31)
668#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode) 670#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, struct drm_agp_mode)
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 04b564bfc4a1..53017ba0ab7b 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1453,6 +1453,8 @@ void drm_gem_vm_open(struct vm_area_struct *vma);
1453void drm_gem_vm_close(struct vm_area_struct *vma); 1453void drm_gem_vm_close(struct vm_area_struct *vma);
1454int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1454int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1455 1455
1456#include "drm_global.h"
1457
1456static inline void 1458static inline void
1457drm_gem_object_reference(struct drm_gem_object *obj) 1459drm_gem_object_reference(struct drm_gem_object *obj)
1458{ 1460{
diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
new file mode 100644
index 000000000000..a06805eaf649
--- /dev/null
+++ b/include/drm/drm_global.h
@@ -0,0 +1,53 @@
1/**************************************************************************
2 *
3 * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _DRM_GLOBAL_H_
32#define _DRM_GLOBAL_H_
33enum drm_global_types {
34 DRM_GLOBAL_TTM_MEM = 0,
35 DRM_GLOBAL_TTM_BO,
36 DRM_GLOBAL_TTM_OBJECT,
37 DRM_GLOBAL_NUM
38};
39
40struct drm_global_reference {
41 enum drm_global_types global_type;
42 size_t size;
43 void *object;
44 int (*init) (struct drm_global_reference *);
45 void (*release) (struct drm_global_reference *);
46};
47
48extern void drm_global_init(void);
49extern void drm_global_release(void);
50extern int drm_global_item_ref(struct drm_global_reference *ref);
51extern void drm_global_item_unref(struct drm_global_reference *ref);
52
53#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 0ea602da43e7..b87504235f18 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -34,6 +34,7 @@
34#include "ttm/ttm_memory.h" 34#include "ttm/ttm_memory.h"
35#include "ttm/ttm_module.h" 35#include "ttm/ttm_module.h"
36#include "drm_mm.h" 36#include "drm_mm.h"
37#include "drm_global.h"
37#include "linux/workqueue.h" 38#include "linux/workqueue.h"
38#include "linux/fs.h" 39#include "linux/fs.h"
39#include "linux/spinlock.h" 40#include "linux/spinlock.h"
@@ -362,7 +363,7 @@ struct ttm_bo_driver {
362 */ 363 */
363 364
364struct ttm_bo_global_ref { 365struct ttm_bo_global_ref {
365 struct ttm_global_reference ref; 366 struct drm_global_reference ref;
366 struct ttm_mem_global *mem_glob; 367 struct ttm_mem_global *mem_glob;
367}; 368};
368 369
@@ -687,8 +688,8 @@ extern int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
687extern void ttm_mem_io_free(struct ttm_bo_device *bdev, 688extern void ttm_mem_io_free(struct ttm_bo_device *bdev,
688 struct ttm_mem_reg *mem); 689 struct ttm_mem_reg *mem);
689 690
690extern void ttm_bo_global_release(struct ttm_global_reference *ref); 691extern void ttm_bo_global_release(struct drm_global_reference *ref);
691extern int ttm_bo_global_init(struct ttm_global_reference *ref); 692extern int ttm_bo_global_init(struct drm_global_reference *ref);
692 693
693extern int ttm_bo_device_release(struct ttm_bo_device *bdev); 694extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
694 695
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h
index cf416aee19af..45fa318c1585 100644
--- a/include/drm/ttm/ttm_module.h
+++ b/include/drm/ttm/ttm_module.h
@@ -35,26 +35,6 @@
35struct kobject; 35struct kobject;
36 36
37#define TTM_PFX "[TTM] " 37#define TTM_PFX "[TTM] "
38
39enum ttm_global_types {
40 TTM_GLOBAL_TTM_MEM = 0,
41 TTM_GLOBAL_TTM_BO,
42 TTM_GLOBAL_TTM_OBJECT,
43 TTM_GLOBAL_NUM
44};
45
46struct ttm_global_reference {
47 enum ttm_global_types global_type;
48 size_t size;
49 void *object;
50 int (*init) (struct ttm_global_reference *);
51 void (*release) (struct ttm_global_reference *);
52};
53
54extern void ttm_global_init(void);
55extern void ttm_global_release(void);
56extern int ttm_global_item_ref(struct ttm_global_reference *ref);
57extern void ttm_global_item_unref(struct ttm_global_reference *ref);
58extern struct kobject *ttm_get_kobj(void); 38extern struct kobject *ttm_get_kobj(void);
59 39
60#endif /* _TTM_MODULE_H_ */ 40#endif /* _TTM_MODULE_H_ */