xref: /freebsd/sys/dev/drm2/drm_global.h (revision 71625ec9)
1592ffb21SWarner Losh /**************************************************************************
2592ffb21SWarner Losh  *
3592ffb21SWarner Losh  * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
4592ffb21SWarner Losh  * All Rights Reserved.
5592ffb21SWarner Losh  *
6592ffb21SWarner Losh  * Permission is hereby granted, free of charge, to any person obtaining a
7592ffb21SWarner Losh  * copy of this software and associated documentation files (the
8592ffb21SWarner Losh  * "Software"), to deal in the Software without restriction, including
9592ffb21SWarner Losh  * without limitation the rights to use, copy, modify, merge, publish,
10592ffb21SWarner Losh  * distribute, sub license, and/or sell copies of the Software, and to
11592ffb21SWarner Losh  * permit persons to whom the Software is furnished to do so, subject to
12592ffb21SWarner Losh  * the following conditions:
13592ffb21SWarner Losh  *
14592ffb21SWarner Losh  * The above copyright notice and this permission notice (including the
15592ffb21SWarner Losh  * next paragraph) shall be included in all copies or substantial portions
16592ffb21SWarner Losh  * of the Software.
17592ffb21SWarner Losh  *
18592ffb21SWarner Losh  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19592ffb21SWarner Losh  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20592ffb21SWarner Losh  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21592ffb21SWarner Losh  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22592ffb21SWarner Losh  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23592ffb21SWarner Losh  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24592ffb21SWarner Losh  * USE OR OTHER DEALINGS IN THE SOFTWARE.
25592ffb21SWarner Losh  *
26592ffb21SWarner Losh  **************************************************************************/
27592ffb21SWarner Losh /*
28592ffb21SWarner Losh  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29592ffb21SWarner Losh  */
30592ffb21SWarner Losh 
31592ffb21SWarner Losh #ifndef _DRM_GLOBAL_H_
32592ffb21SWarner Losh #define _DRM_GLOBAL_H_
33592ffb21SWarner Losh enum drm_global_types {
34592ffb21SWarner Losh 	DRM_GLOBAL_TTM_MEM = 0,
35592ffb21SWarner Losh 	DRM_GLOBAL_TTM_BO,
36592ffb21SWarner Losh 	DRM_GLOBAL_TTM_OBJECT,
37592ffb21SWarner Losh 	DRM_GLOBAL_NUM
38592ffb21SWarner Losh };
39592ffb21SWarner Losh 
40592ffb21SWarner Losh struct drm_global_reference {
41592ffb21SWarner Losh 	enum drm_global_types global_type;
42592ffb21SWarner Losh 	size_t size;
43592ffb21SWarner Losh 	void *object;
44592ffb21SWarner Losh 	int (*init) (struct drm_global_reference *);
45592ffb21SWarner Losh 	void (*release) (struct drm_global_reference *);
46592ffb21SWarner Losh };
47592ffb21SWarner Losh 
48592ffb21SWarner Losh extern void drm_global_init(void);
49592ffb21SWarner Losh extern void drm_global_release(void);
50592ffb21SWarner Losh extern int drm_global_item_ref(struct drm_global_reference *ref);
51592ffb21SWarner Losh extern void drm_global_item_unref(struct drm_global_reference *ref);
52592ffb21SWarner Losh 
53592ffb21SWarner Losh MALLOC_DECLARE(M_DRM_GLOBAL);
54592ffb21SWarner Losh 
55592ffb21SWarner Losh #endif
56