summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-06-30 12:19:28 +1000
committerDave Airlie <airlied@redhat.com>2009-06-30 12:19:28 +1000
commitde1ed01214874dcdd6116ff2587c8710d6ed4d2d (patch)
tree964e0eb7dbe424cd27d1c7a0166c6ba9e659fdcd
parent790097c51330090b2b7b90429b9ab8ddf259fd8e (diff)
radeon: add support for write followed by read relocs.
the DDX does this and used to handle it internally
-rw-r--r--libdrm/radeon/radeon_cs_gem.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libdrm/radeon/radeon_cs_gem.c b/libdrm/radeon/radeon_cs_gem.c
index b9f6f4b7..82ef16cb 100644
--- a/libdrm/radeon/radeon_cs_gem.c
+++ b/libdrm/radeon/radeon_cs_gem.c
@@ -144,12 +144,19 @@ static int cs_gem_write_reloc(struct radeon_cs *cs,
* domain set then the read_domain should also be set for this
* new relocation.
*/
- if (reloc->read_domain && !read_domain) {
- return -EINVAL;
- }
- if (reloc->write_domain && !write_domain) {
- return -EINVAL;
+ /* the DDX expects to read and write from same pixmap */
+ if (write_domain && (reloc->read_domain & write_domain)) {
+ reloc->read_domain = 0;
+ reloc->write_domain = write_domain;
+ } else if (read_domain & reloc->write_domain) {
+ reloc->read_domain = 0;
+ } else {
+ if (write_domain != reloc->write_domain)
+ return -EINVAL;
+ if (read_domain != reloc->read_domain)
+ return -EINVAL;
}
+
reloc->read_domain |= read_domain;
reloc->write_domain |= write_domain;
/* update flags */