summaryrefslogtreecommitdiff
path: root/linux-core/drm_gem.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-05-06 20:00:23 -0700
committerKeith Packard <keithp@keithp.com>2008-05-06 20:00:23 -0700
commit61253f4f677518537368103799c9510b8b5ad1e3 (patch)
tree8ea2d019cef0e1bdad109b839dc911a4abe3e7c6 /linux-core/drm_gem.c
parent2b9ef32669acf8197cf7d9b73b851c001db494cd (diff)
[intel-GEM] Add memory domain support.
Memory domains allow the kernel to track which caches to flush and how to move objects before buffer execution.
Diffstat (limited to 'linux-core/drm_gem.c')
-rw-r--r--linux-core/drm_gem.c41
1 files changed, 4 insertions, 37 deletions
diff --git a/linux-core/drm_gem.c b/linux-core/drm_gem.c
index 929c008f..e2272f27 100644
--- a/linux-core/drm_gem.c
+++ b/linux-core/drm_gem.c
@@ -325,6 +325,10 @@ drm_gem_mmap_ioctl(struct drm_device *dev, void *data,
drm_gem_object_unreference(obj);
if (IS_ERR((void *)addr))
return (int) addr;
+
+ /* XXX hack until we have a driver callback to make this work */
+ obj->read_domains = DRM_GEM_DOMAIN_CPU;
+ obj->write_domain = DRM_GEM_DOMAIN_CPU;
args->addr_ptr = (uint64_t) addr;
@@ -540,40 +544,3 @@ drm_gem_object_handle_free (struct kref *kref)
}
EXPORT_SYMBOL(drm_gem_object_handle_free);
-/*
- * Set the next domain for the specified object. This
- * may not actually perform the necessary flushing/invaliding though,
- * as that may want to be batched with other set_domain operations
- */
-int drm_gem_object_set_domain (struct drm_gem_object *obj,
- uint32_t read_domains,
- uint32_t write_domain)
-{
- struct drm_device *dev = obj->dev;
- uint32_t invalidate_domains = 0;
- uint32_t flush_domains = 0;
-
- /*
- * Flush the current write domain if
- * the new read domains don't match. Invalidate
- * any read domains which differ from the old
- * write domain
- */
- if (obj->write_domain && obj->write_domain != read_domains)
- {
- flush_domains |= obj->write_domain;
- invalidate_domains |= read_domains & ~obj->write_domain;
- }
- /*
- * Invalidate any read caches which may have
- * stale data. That is, any new read domains.
- */
- invalidate_domains |= read_domains & ~obj->read_domains;
- obj->write_domain = write_domain;
- obj->read_domain = read_domains;
- if ((flush_domains | invalidate_domains) & DRM_GEM_DOMAIN_CPU)
- drm_gem_object_clflush (obj);
- dev->invalidate_domains |= invalidate_domains & ~DRM_GEM_DOMAIN_CPU;
- dev->flush_domains |= flush_domains & ~DRM_GEM_DOMAIN_CPU;
-}
-EXPORT_SYMBOL(drm_gem_object_set_domain);