summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500/gem.h
blob: 27df6ff4ed371bb8c190eccae4677e34e27b79f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* SPDX-License-Identifier: GPL-2.0-only */
/**************************************************************************
 * Copyright (c) 2014 Patrik Jakobsson
 * All Rights Reserved.
 *
 **************************************************************************/

#ifndef _GEM_H
#define _GEM_H

#include <linux/kernel.h>

#include <drm/drm_gem.h>

struct drm_device;

/*
 * PSB GEM object
 */

struct psb_gem_object {
	struct drm_gem_object base;

	struct resource resource;	/* GTT resource for our allocation */
	u32 offset;			/* GTT offset of our object */
	int in_gart;			/* Currently in the GART (ref ct) */
	bool stolen;			/* Backed from stolen RAM */
	bool mmapping;			/* Is mmappable */
	struct page **pages;		/* Backing pages if present */
};

static inline struct psb_gem_object *to_psb_gem_object(struct drm_gem_object *obj)
{
	return container_of(obj, struct psb_gem_object, base);
}

struct psb_gem_object *
psb_gem_create(struct drm_device *dev, u64 size, const char *name, bool stolen, u32 align);

int psb_gem_pin(struct psb_gem_object *pobj);
void psb_gem_unpin(struct psb_gem_object *pobj);

/*
 * Memory management
 */

int psb_gem_mm_init(struct drm_device *dev);
void psb_gem_mm_fini(struct drm_device *dev);
int psb_gem_mm_resume(struct drm_device *dev);

#endif