2019-05-30 07:57:49 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2011-11-04 02:21:09 +08:00
|
|
|
/**************************************************************************
|
|
|
|
* Copyright (c) 2007-2008, Intel Corporation.
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _PSB_GTT_H_
|
|
|
|
#define _PSB_GTT_H_
|
|
|
|
|
2014-09-23 21:46:53 +08:00
|
|
|
#include <drm/drm_gem.h>
|
2011-11-04 02:21:09 +08:00
|
|
|
|
|
|
|
/* This wants cleaning up with respect to the psb_dev and un-needed stuff */
|
|
|
|
struct psb_gtt {
|
|
|
|
uint32_t gatt_start;
|
|
|
|
uint32_t mmu_gatt_start;
|
|
|
|
uint32_t gtt_start;
|
|
|
|
uint32_t gtt_phys_start;
|
|
|
|
unsigned gtt_pages;
|
|
|
|
unsigned gatt_pages;
|
|
|
|
unsigned long stolen_size;
|
|
|
|
unsigned long vram_stolen_size;
|
|
|
|
struct rw_semaphore sem;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Exported functions */
|
|
|
|
extern int psb_gtt_init(struct drm_device *dev, int resume);
|
|
|
|
extern void psb_gtt_takedown(struct drm_device *dev);
|
|
|
|
|
|
|
|
/* Each gtt_range describes an allocation in the GTT area */
|
|
|
|
struct gtt_range {
|
|
|
|
struct resource resource; /* Resource for our allocation */
|
|
|
|
u32 offset; /* GTT offset of our object */
|
|
|
|
struct drm_gem_object gem; /* GEM high level stuff */
|
|
|
|
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 */
|
|
|
|
int npage; /* Number of backing pages */
|
2011-11-30 06:27:22 +08:00
|
|
|
int roll; /* Roll applied to the GTT entries */
|
2011-11-04 02:21:09 +08:00
|
|
|
};
|
|
|
|
|
2018-03-30 22:11:34 +08:00
|
|
|
#define to_gtt_range(x) container_of(x, struct gtt_range, gem)
|
|
|
|
|
2011-11-04 02:21:09 +08:00
|
|
|
extern struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
|
2014-01-06 09:39:10 +08:00
|
|
|
const char *name, int backed,
|
|
|
|
u32 align);
|
2011-11-04 02:21:09 +08:00
|
|
|
extern void psb_gtt_kref_put(struct gtt_range *gt);
|
|
|
|
extern void psb_gtt_free_range(struct drm_device *dev, struct gtt_range *gt);
|
|
|
|
extern int psb_gtt_pin(struct gtt_range *gt);
|
|
|
|
extern void psb_gtt_unpin(struct gtt_range *gt);
|
2011-11-30 06:27:22 +08:00
|
|
|
extern void psb_gtt_roll(struct drm_device *dev,
|
|
|
|
struct gtt_range *gt, int roll);
|
2013-04-06 05:56:18 +08:00
|
|
|
extern int psb_gtt_restore(struct drm_device *dev);
|
2011-11-04 02:21:09 +08:00
|
|
|
#endif
|