aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2012-07-19 09:45:14 -0700
committerChad Versace <[email protected]>2012-08-07 09:30:33 -0700
commitf4873babdc27f697df9f4642209eca21a02ac476 (patch)
tree48051714159e9d213b74a2e4254ac61e9e3e556c /src/mesa/drivers/dri/intel/intel_mipmap_tree.h
parent4eba67285fb6b5d2dd4927e8dc4b3e2945435309 (diff)
intel: Allocate miptree for multisample DRI2 buffers
Immediately after obtaining, with DRI2GetBuffersWithFormat, the DRM buffer handle for a DRI2 buffer, we wrap that DRM buffer handle with a region and a miptree. This patch additionally allocates an accompanying multisample miptree if the DRI2 buffer is multisampled. Since we do not yet advertise multisample GL configs, the code for allocating the multisample miptree is currently inactive. This patch adds the following fields to intel_mipmap_tree: singlesample_mt needs_downsample and the following function stubs: intel_miptree_downsample intel_miptree_upsample Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_mipmap_tree.h')
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index bfeb69c36f8..12c7b6afcb7 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -248,6 +248,50 @@ struct intel_mipmap_tree
uint32_t offset;
/**
+ * \brief Singlesample miptree.
+ *
+ * This is used under two cases.
+ *
+ * --- Case 1: As persistent singlesample storage for multisample window
+ * system front and back buffers ---
+ *
+ * Suppose that the window system FBO was created with a multisample
+ * config. Let `back_irb` be the `intel_renderbuffer` for the FBO's back
+ * buffer. Then `back_irb` contains two miptrees: a parent multisample
+ * miptree (back_irb->mt) and a child singlesample miptree
+ * (back_irb->mt->singlesample_mt). The DRM buffer shared with DRI2
+ * belongs to `back_irb->mt->singlesample_mt` and contains singlesample
+ * data. The singlesample miptree is created at the same time as and
+ * persists for the lifetime of its parent multisample miptree.
+ *
+ * When access to the singlesample data is needed, such as at
+ * eglSwapBuffers and glReadPixels, an automatic downsample occurs from
+ * `back_rb->mt` to `back_rb->mt->singlesample_mt` when necessary.
+ *
+ * This description of the back buffer applies analogously to the front
+ * buffer.
+ *
+ *
+ * --- Case 2: As temporary singlesample storage for mapping multisample
+ * miptrees ---
+ *
+ * Suppose the intel_miptree_map is called on a multisample miptree, `mt`,
+ * for which case 1 does not apply (that is, `mt` does not belong to
+ * a front or back buffer). Then `mt->singlesample_mt` is null at the
+ * start of the call. intel_miptree_map will create a temporary
+ * singlesample miptree, store it at `mt->singlesample_mt`, downsample from
+ * `mt` to `mt->singlesample_mt` if necessary, then map
+ * `mt->singlesample_mt`. The temporary miptree is later deleted during
+ * intel_miptree_unmap.
+ */
+ struct intel_mipmap_tree *singlesample_mt;
+
+ /**
+ * \brief A downsample is needed from this miptree to singlesample_mt.
+ */
+ bool need_downsample;
+
+ /**
* \brief HiZ miptree
*
* This is non-null only if HiZ is enabled for this miptree.
@@ -325,6 +369,13 @@ intel_miptree_create_for_region(struct intel_context *intel,
gl_format format,
struct intel_region *region);
+struct intel_mipmap_tree*
+intel_miptree_create_for_dri2_buffer(struct intel_context *intel,
+ unsigned dri_attachment,
+ gl_format format,
+ uint32_t num_samples,
+ struct intel_region *region);
+
/**
* Create a miptree appropriate as the storage for a non-texture renderbuffer.
* The miptree has the following properties:
@@ -484,6 +535,14 @@ intel_miptree_all_slices_resolve_depth(struct intel_context *intel,
/**\}*/
+void
+intel_miptree_downsample(struct intel_context *intel,
+ struct intel_mipmap_tree *mt);
+
+void
+intel_miptree_upsample(struct intel_context *intel,
+ struct intel_mipmap_tree *mt);
+
/* i915_mipmap_tree.c:
*/
void i915_miptree_layout(struct intel_mipmap_tree *mt);