From ac97e8dba654b9b3c5a9459953ce27056bcbb021 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sat, 7 Aug 2010 01:56:01 +0200 Subject: [PATCH] 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. --- src/gallium/drivers/nvfx/nvfx_resource.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 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 { -- 2.30.2