On 21 July 2012 17:36, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This function does a downsample from mt to mt->singlesample_mt.<br>
<br>
Conceptually, this function belongs in intel_mipmap_tree.c. However, it<br>
needs to interact with blorp, which is C++. So I created a new file,<br>
brw_blorp_orphands.cpp, for this and other functions that fall into the<br></blockquote><div><br>No "d" in "orphans". Other than that, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>><br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
same category.<br>
<br>
CC: Eric Anholt <<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>><br>
CC: Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>><br>
Signed-off-by: Chad Versace <<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/Makefile.sources | 1 +<br>
src/mesa/drivers/dri/i965/brw_blorp_orphans.cpp | 66 +++++++++++++++++++++++++<br>
src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 10 ++++<br>
3 files changed, 77 insertions(+)<br>
create mode 100644 src/mesa/drivers/dri/i965/brw_blorp_orphans.cpp<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources<br>
index 334bfd9..4bbd905 100644<br>
--- a/src/mesa/drivers/dri/i965/Makefile.sources<br>
+++ b/src/mesa/drivers/dri/i965/Makefile.sources<br>
@@ -113,6 +113,7 @@ i965_C_FILES = \<br>
i965_CXX_FILES = \<br>
brw_blorp.cpp \<br>
brw_blorp_blit.cpp \<br>
+ brw_blorp_orphans.cpp \<br>
brw_cubemap_normalize.cpp \<br>
brw_fs.cpp \<br>
brw_fs_cfg.cpp \<br>
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_orphans.cpp b/src/mesa/drivers/dri/i965/brw_blorp_orphans.cpp<br>
new file mode 100644<br>
index 0000000..0b16438<br>
--- /dev/null<br>
+++ b/src/mesa/drivers/dri/i965/brw_blorp_orphans.cpp<br>
@@ -0,0 +1,66 @@<br>
+/*<br>
+ * Copyright © 2012 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * \file<br>
+ *<br>
+ * This file contains functions which whose definitions conceptually belong<br>
+ * in other C files but need to interact closely with blorp.<br>
+ */<br>
+<br>
+#include "intel_mipmap_tree.h"<br>
+<br>
+#include "brw_blorp.h"<br>
+<br>
+extern "C" {<br>
+<br>
+/**<br>
+ * \brief Downsample from mt to mt->singlesample_mt.<br>
+ *<br>
+ * If the miptree needs no downsample, then skip.<br>
+ */<br>
+void<br>
+intel_miptree_downsample(struct intel_context *intel,<br>
+ struct intel_mipmap_tree *mt)<br>
+{<br>
+ if (!mt->need_downsample)<br>
+ return;<br>
+<br>
+ int src_x0 = 0;<br>
+ int src_y0 = 0;<br>
+ int dst_x0 = 0;<br>
+ int dst_y0 = 0;<br>
+<br>
+ brw_blorp_blit_params params(brw_context(&intel->ctx),<br>
+ mt, mt->singlesample_mt,<br>
+ src_x0, src_y0,<br>
+ dst_x0, dst_y0,<br>
+ mt->singlesample_mt->width0,<br>
+ mt->singlesample_mt->height0,<br>
+ false, false);<br>
+ brw_blorp_exec(intel, ¶ms);<br>
+<br>
+ mt->need_downsample = false;<br>
+}<br>
+<br>
+} /* end extern "C" */<br>
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h<br>
index bb3fa50..0b76fad 100644<br>
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h<br>
@@ -540,6 +540,9 @@ intel_miptree_unmap(struct intel_context *intel,<br>
unsigned int slice);<br>
<br>
#ifdef I915<br>
+<br>
+void intel_miptree_downsample();<br>
+<br>
static inline void<br>
intel_hiz_exec(struct intel_context *intel, struct intel_mipmap_tree *mt,<br>
unsigned int level, unsigned int layer, enum gen6_hiz_op op)<br>
@@ -548,7 +551,14 @@ intel_hiz_exec(struct intel_context *intel, struct intel_mipmap_tree *mt,<br>
* there.<br>
*/<br>
}<br>
+<br>
#else<br>
+<br>
+void<br>
+intel_miptree_downsample(struct intel_context *intel,<br>
+ struct intel_mipmap_tree *mt);<br>
+<br>
+<br>
void<br>
intel_hiz_exec(struct intel_context *intel, struct intel_mipmap_tree *mt,<br>
unsigned int level, unsigned int layer, enum gen6_hiz_op op);<br>
<span><font color="#888888">--<br>
1.7.11.2<br>
<br>
</font></span></blockquote></div><br>