Loading...
1/**************************************************************************
2 * Copyright (c) 2014 Patrik Jakobsson
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 **************************************************************************/
15
16#ifndef _GEM_H
17#define _GEM_H
18
19extern int psb_gem_create(struct drm_file *file, struct drm_device *dev,
20 u64 size, u32 *handlep, int stolen, u32 align);
21#endif
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
15struct drm_device;
16
17/*
18 * PSB GEM object
19 */
20
21struct psb_gem_object {
22 struct drm_gem_object base;
23
24 struct resource resource; /* GTT resource for our allocation */
25 u32 offset; /* GTT offset of our object */
26 int in_gart; /* Currently in the GART (ref ct) */
27 bool stolen; /* Backed from stolen RAM */
28 bool mmapping; /* Is mmappable */
29 struct page **pages; /* Backing pages if present */
30};
31
32static inline struct psb_gem_object *to_psb_gem_object(struct drm_gem_object *obj)
33{
34 return container_of(obj, struct psb_gem_object, base);
35}
36
37struct psb_gem_object *
38psb_gem_create(struct drm_device *dev, u64 size, const char *name, bool stolen, u32 align);
39
40int psb_gem_pin(struct psb_gem_object *pobj);
41void psb_gem_unpin(struct psb_gem_object *pobj);
42
43/*
44 * Memory management
45 */
46
47int psb_gem_mm_init(struct drm_device *dev);
48void psb_gem_mm_fini(struct drm_device *dev);
49int psb_gem_mm_resume(struct drm_device *dev);
50
51#endif