#include <linux/pagemap.h>
+#include <asm/set_memory.h>
+
#include <drm/drm.h>
#include <drm/drm_vma_manager.h>
npages = gt->gem.size / PAGE_SIZE;
- ret = psb_gtt_insert(dev, gt, 0);
+ set_pages_array_wc(pages, npages);
+
+ ret = psb_gtt_insert(dev, gt);
if (ret)
goto err_drm_gem_put_pages;
(gpu_base + gt->offset), gt->npage, 0, 0);
psb_gtt_remove(dev, gt);
+ /* Reset caching flags */
+ set_pages_array_wb(gt->pages, gt->npage);
+
drm_gem_put_pages(>->gem, gt->pages, true, false);
gt->pages = NULL;
* Alan Cox <alan@linux.intel.com>
*/
-#include <linux/shmem_fs.h>
-
-#include <asm/set_memory.h>
-
#include "psb_drv.h"
* psb_gtt_insert - put an object into the GTT
* @dev: our DRM device
* @r: our GTT range
- * @resume: on resume
*
* Take our preallocated GTT range and insert the GEM object into
* the GTT. This is protected via the gtt mutex which the caller
* must hold.
*/
-int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r, int resume)
+int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r)
{
u32 __iomem *gtt_slot;
u32 pte;
- struct page **pages;
int i;
if (r->pages == NULL) {
WARN_ON(r->stolen); /* refcount these maybe ? */
gtt_slot = psb_gtt_entry(dev, r);
- pages = r->pages;
-
- if (!resume) {
- /* Make sure changes are visible to the GPU */
- set_pages_array_wc(pages, r->npage);
- }
/* Write our page entries into the GTT itself */
for (i = 0; i < r->npage; i++) {
for (i = 0; i < r->npage; i++)
iowrite32(pte, gtt_slot++);
ioread32(gtt_slot - 1);
- set_pages_array_wb(r->pages, r->npage);
}
static void psb_gtt_alloc(struct drm_device *dev)
while (r != NULL) {
range = container_of(r, struct gtt_range, resource);
if (range->pages) {
- psb_gtt_insert(dev, range, 1);
+ psb_gtt_insert(dev, range);
size += range->resource.end - range->resource.start;
restored++;
}
const char *name, resource_size_t size, resource_size_t align,
bool stolen, u32 *offset);
-int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r, int resume);
+int psb_gtt_insert(struct drm_device *dev, struct gtt_range *r);
void psb_gtt_remove(struct drm_device *dev, struct gtt_range *r);
#endif