radeon/video: don't use sub-allocated buffers
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 30 Sep 2016 09:26:13 +0000 (11:26 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 30 Sep 2016 10:38:29 +0000 (12:38 +0200)
Cc: Christian König <christian.koenig@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97976
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97969
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/drivers/radeon/r600_buffer_common.c
src/gallium/drivers/radeon/radeon_video.c

index cbbcc293e124efc686ab110f73a6763ece56c836..784522dd45602b8648433b8f9327a2c9459722cf 100644 (file)
@@ -531,6 +531,9 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
 
        r600_init_resource_fields(rscreen, rbuffer, templ->width0, alignment);
 
+       if (templ->bind & PIPE_BIND_SHARED)
+               rbuffer->flags |= RADEON_FLAG_HANDLE;
+
        if (!r600_alloc_resource(rscreen, rbuffer)) {
                FREE(rbuffer);
                return NULL;
index d7c5a165ef3267d1f97e4c8fc3b58b0d1e218916..de8e11cd8e28195581fb497025b75df2ae853757 100644 (file)
@@ -66,8 +66,14 @@ bool rvid_create_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer,
 {
        memset(buffer, 0, sizeof(*buffer));
        buffer->usage = usage;
+
+       /* Hardware buffer placement restrictions require the kernel to be
+        * able to move buffers around individually, so request a
+        * non-sub-allocated buffer.
+        */
        buffer->res = (struct r600_resource *)
-               pipe_buffer_create(screen, PIPE_BIND_CUSTOM, usage, size);
+               pipe_buffer_create(screen, PIPE_BIND_CUSTOM | PIPE_BIND_SHARED,
+                                  usage, size);
 
        return buffer->res != NULL;
 }