From 44ed693ca6f8d19acb39174c6efada070652a027 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 22 May 2008 11:34:56 -0700 Subject: [gem] Use CPU domain for new or pageable objects Newly allocated objects need to be in the CPU domain as they've just been cleared by the CPU. Also, unmapping objects from the GTT needs to put them into the CPU domain, both to flush rendering as well as to ensure that any paging action gets flushed before we remap to the GTT. --- linux-core/drm_gem.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'linux-core/drm_gem.c') diff --git a/linux-core/drm_gem.c b/linux-core/drm_gem.c index a8253bc5..fb175d7d 100644 --- a/linux-core/drm_gem.c +++ b/linux-core/drm_gem.c @@ -100,6 +100,14 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size) kref_init(&obj->handlecount); obj->size = size; + /* + * We've just allocated pages from the kernel, + * so they've just been written by the CPU with + * zeros. They'll need to be clflushed before we + * use them with the GPU. + */ + obj->write_domain = DRM_GEM_DOMAIN_CPU; + obj->read_domains = DRM_GEM_DOMAIN_CPU; if (dev->driver->gem_init_object != NULL && dev->driver->gem_init_object(obj) != 0) { fput(obj->filp); -- cgit v1.2.3