summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvfx/nvfx_resource.h
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-08-07 01:56:01 +0200
committerLuca Barbieri <[email protected]>2010-08-21 20:42:14 +0200
commitac97e8dba654b9b3c5a9459953ce27056bcbb021 (patch)
treee0d8b0bd719447e9b3c57c20b795969a98dff557 /src/gallium/drivers/nvfx/nvfx_resource.h
parent37fa0cf4eaf6e67876a1f6b33389f17f99b02461 (diff)
nvfx: add nouveau_resource_on_gpu
Add a function to get whether a resource is likely on the GPU or not. Currently always returns TRUE.
Diffstat (limited to 'src/gallium/drivers/nvfx/nvfx_resource.h')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_resource.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h
index d28bfab9615..bdbf3dd3d89 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.h
+++ b/src/gallium/drivers/nvfx/nvfx_resource.h
@@ -3,9 +3,11 @@
#define NVFX_RESOURCE_H
#include "util/u_transfer.h"
+#include "util/u_format.h"
+#include "util/u_math.h"
+#include <nouveau/nouveau_bo.h>
struct pipe_resource;
-struct nouveau_bo;
/* This gets further specialized into either buffer or texture
@@ -22,6 +24,18 @@ struct nvfx_resource {
#define NVFX_RESOURCE_FLAG_LINEAR (PIPE_RESOURCE_FLAG_DRV_PRIV << 0)
+static inline int
+nvfx_resource_on_gpu(struct pipe_resource* pr)
+{
+#if 0
+ // a compiler error here means you need to apply libdrm-nouveau-add-domain.patch to libdrm
+ // TODO: return FALSE if not VRAM and on a PCI-E system
+ return ((struct nvfx_resource*)pr)->bo->domain & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART);
+#else
+ return TRUE;
+#endif
+}
+
#define NVFX_MAX_TEXTURE_LEVELS 16
struct nvfx_miptree {