summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2015-10-20 01:15:39 -0400
committerBen Skeggs <bskeggs@redhat.com>2015-10-22 09:09:53 +1000
commit6252ca2b03bb316483810582e0baf537fcdc1ecb (patch)
treeac4c26ed4a0282688b7bdece5d78e11af6b32bb0 /lib
parent5df5f6682686c8b45be56f68ca3bde65560560bf (diff)
downloadnouveau-6252ca2b03bb316483810582e0baf537fcdc1ecb.tar.gz
gem: return only valid domain when there's only one
On nv50+, we restrict the valid domains to just the one where the buffer was originally created. However after the buffer is evicted to system memory, we might move it back to a different domain that was not originally valid. When sharing the buffer and retrieving its GEM_INFO data, we still want the domain that will be valid for this buffer in a pushbuf, not the one where it currently happens to be. This resolves fdo#92504 and several others. These are due to suspend evicting all buffers, making it more likely that they temporarily end up in the wrong place. Cc: stable@vger.kernel.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92504 Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/include/nvif/os.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/include/nvif/os.h b/lib/include/nvif/os.h
index d3581ef04..48bcf150b 100644
--- a/lib/include/nvif/os.h
+++ b/lib/include/nvif/os.h
@@ -134,6 +134,12 @@ typedef dma_addr_t resource_size_t;
#define IS_ENABLED(x) IS_ENABLED_##x
+static inline bool
+is_power_of_2(unsigned long n)
+{
+ return (n != 0 && ((n & (n - 1)) == 0));
+}
+
static inline int
order_base_2(u64 base)
{