summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nvfx/nvfx_resource.h
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-08-03 05:47:41 +0200
committerLuca Barbieri <[email protected]>2010-08-21 20:42:14 +0200
commit28eb392a853bb43bdc6cfe7ba814f046c39ca7ae (patch)
tree6e7cc6d42f4a439aa8e543976e3893829a23be85 /src/gallium/drivers/nvfx/nvfx_resource.h
parentff74143fcc80b0157875bb0ce4b34a80f92e09c2 (diff)
nvfx: new 2D: new render temporaries with resources
This patch adds support for creating temporary surfaces to allow rendering to surfaces that cannot be rendered to. It uses the _second_ version of the render temporary infrastructure. This is necessary for swizzled 3D textures and small mipmaps of swizzled 2D textures. This version of the patch creates a resource to use as a temporary instead of a raw BO, making the code simpler.
Diffstat (limited to 'src/gallium/drivers/nvfx/nvfx_resource.h')
-rw-r--r--src/gallium/drivers/nvfx/nvfx_resource.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/gallium/drivers/nvfx/nvfx_resource.h b/src/gallium/drivers/nvfx/nvfx_resource.h
index 42d04ebb370..be1845dd9c1 100644
--- a/src/gallium/drivers/nvfx/nvfx_resource.h
+++ b/src/gallium/drivers/nvfx/nvfx_resource.h
@@ -1,13 +1,16 @@
-
#ifndef NVFX_RESOURCE_H
#define NVFX_RESOURCE_H
#include "util/u_transfer.h"
#include "util/u_format.h"
#include "util/u_math.h"
+#include "util/u_double_list.h"
+#include "util/u_surfaces.h"
+#include "util/u_dirty_surfaces.h"
#include <nouveau/nouveau_bo.h>
struct pipe_resource;
+struct nv04_region;
/* This gets further specialized into either buffer or texture
@@ -38,17 +41,34 @@ nvfx_resource_on_gpu(struct pipe_resource* pr)
#define NVFX_MAX_TEXTURE_LEVELS 16
+/* We have the following invariants for render temporaries
+ *
+ * 1. Render temporaries are always linear
+ * 2. Render temporaries are always up to date
+ * 3. Currently, render temporaries are destroyed when the resource is used for sampling, but kept for any other use
+ *
+ * Also, we do NOT flush temporaries on any pipe->flush().
+ * This is fine, as long as scanout targets and shared resources never need temps.
+ *
+ * TODO: we may want to also support swizzled temporaries to improve performance in some cases.
+ */
+
struct nvfx_miptree {
struct nvfx_resource base;
unsigned linear_pitch; /* for linear textures, 0 for swizzled and compressed textures with level-dependent minimal pitch */
unsigned face_size; /* 128-byte aligned face/total size */
unsigned level_offset[NVFX_MAX_TEXTURE_LEVELS];
+
+ struct util_surfaces surfaces;
+ struct util_dirty_surfaces dirty_surfaces;
};
struct nvfx_surface {
- struct pipe_surface base;
+ struct util_dirty_surface base;
unsigned pitch;
+
+ struct nvfx_miptree* temp;
};
static INLINE
@@ -65,6 +85,12 @@ nvfx_surface_buffer(struct pipe_surface *surf)
return mt->bo;
}
+static INLINE struct util_dirty_surfaces*
+nvfx_surface_get_dirty_surfaces(struct pipe_surface* surf)
+{
+ struct nvfx_miptree *mt = (struct nvfx_miptree *)surf->texture;
+ return &mt->dirty_surfaces;
+}
void
nvfx_init_resource_functions(struct pipe_context *pipe);
@@ -141,4 +167,10 @@ nvfx_subresource_pitch(struct pipe_resource* pt, unsigned level)
}
}
+void
+nvfx_surface_create_temp(struct pipe_context* pipe, struct pipe_surface* surf);
+
+void
+nvfx_surface_flush(struct pipe_context* pipe, struct pipe_surface* surf);
+
#endif