freedreno/a3xx: fix depth/stencil gmem restore
[mesa.git] / src / gallium / drivers / freedreno / freedreno_resource.h
index 575a143309f12f924aa18b5fcab007fe8c321451..7e10d7a6416419ffa8f5b0af148a303079db9e98 100644 (file)
 
 #include "util/u_transfer.h"
 
+#include "freedreno_util.h"
+
+/* for mipmap, cubemap, etc, each level is represented by a slice.
+ * Currently all slices are part of same bo (just different offsets),
+ * this is at least how it needs to be for cubemaps, although mipmap
+ * can be different bo's (although, not sure if there is a strong
+ * advantage to doing that)
+ */
+struct fd_resource_slice {
+       uint32_t offset;         /* offset of first layer in slice */
+       uint32_t pitch;
+       uint32_t size0;          /* size of first layer in slice */
+};
+
 struct fd_resource {
        struct u_resource base;
        struct fd_bo *bo;
-       uint32_t pitch, cpp;
+       uint32_t cpp;
+       struct fd_resource_slice slices[MAX_MIP_LEVELS];
        uint32_t timestamp;
        bool dirty;
 };
@@ -45,6 +60,13 @@ fd_resource(struct pipe_resource *ptex)
        return (struct fd_resource *)ptex;
 }
 
+static INLINE struct fd_resource_slice *
+fd_resource_slice(struct fd_resource *rsc, unsigned level)
+{
+       assert(level <= rsc->base.b.last_level);
+       return &rsc->slices[level];
+}
+
 void fd_resource_screen_init(struct pipe_screen *pscreen);
 void fd_resource_context_init(struct pipe_context *pctx);