gem.h (1284B)
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