xref: /openbmc/linux/drivers/gpu/drm/gma500/gem.h (revision 2cf1c348)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /**************************************************************************
3  * Copyright (c) 2014 Patrik Jakobsson
4  * All Rights Reserved.
5  *
6  **************************************************************************/
7 
8 #ifndef _GEM_H
9 #define _GEM_H
10 
11 #include <linux/kernel.h>
12 
13 #include <drm/drm_gem.h>
14 
15 struct drm_device;
16 
17 struct psb_gem_object {
18 	struct drm_gem_object base;
19 
20 	struct resource resource;	/* GTT resource for our allocation */
21 	u32 offset;			/* GTT offset of our object */
22 	int in_gart;			/* Currently in the GART (ref ct) */
23 	bool stolen;			/* Backed from stolen RAM */
24 	bool mmapping;			/* Is mmappable */
25 	struct page **pages;		/* Backing pages if present */
26 	int npage;			/* Number of backing pages */
27 };
28 
29 static inline struct psb_gem_object *to_psb_gem_object(struct drm_gem_object *obj)
30 {
31 	return container_of(obj, struct psb_gem_object, base);
32 }
33 
34 struct psb_gem_object *
35 psb_gem_create(struct drm_device *dev, u64 size, const char *name, bool stolen, u32 align);
36 
37 int psb_gem_pin(struct psb_gem_object *pobj);
38 void psb_gem_unpin(struct psb_gem_object *pobj);
39 
40 #endif
41