<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 6, 2017 at 2:02 PM, Louis-Francis Ratté-Boulianne <span dir="ltr"><<a href="mailto:lfrb@collabora.com" target="_blank">lfrb@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
<br>
Given a tiling mode and an aux usage, return the DRM modifier.<br>
<br>
Signed-off-by: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
---<br>
src/intel/isl/isl.h | 6 +++++-<br>
src/intel/isl/isl_drm.c | 17 +++++++++++++++++<br>
2 files changed, 22 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h<br>
index e3acb0ec28..b255f15a5d 100644<br>
--- a/src/intel/isl/isl.h<br>
+++ b/src/intel/isl/isl.h<br>
@@ -1551,7 +1551,7 @@ isl_tiling_is_std_y(enum isl_tiling tiling)<br>
uint32_t<br>
isl_tiling_to_i915_tiling(enum isl_tiling tiling);<br>
<br>
-enum isl_tiling<br>
+enum isl_tiling<br>
isl_tiling_from_i915_tiling(<wbr>uint32_t tiling);<br>
<br>
const struct isl_drm_modifier_info * ATTRIBUTE_CONST<br>
@@ -1583,6 +1583,10 @@ isl_drm_modifier_get_default_<wbr>aux_state(uint64_t modifier)<br>
ISL_AUX_STATE_COMPRESSED_NO_<wbr>CLEAR;<br>
}<br>
<br>
+uint64_t ATTRIBUTE_CONST<br>
+isl_drm_modifier_from_tiling(<wbr>enum isl_tiling tiling,<br>
+ enum isl_aux_usage aux_usage);<br>
+<br>
struct isl_extent2d ATTRIBUTE_CONST<br>
isl_get_interleaved_msaa_px_<wbr>size_sa(uint32_t samples);<br>
<br>
diff --git a/src/intel/isl/isl_drm.c b/src/intel/isl/isl_drm.c<br>
index eb3c6f5913..a40142c6ec 100644<br>
--- a/src/intel/isl/isl_drm.c<br>
+++ b/src/intel/isl/isl_drm.c<br>
@@ -30,6 +30,10 @@<br>
#include "isl.h"<br>
#include "common/gen_device_info.h"<br>
<br>
+#ifndef DRM_FORMAT_MOD_INVALID<br>
+#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)<br>
+#endif<br>
+<br></blockquote><div><br></div><div>We include the copy of drm_foucc.h we have stashed in mesa, so you can just assume this is defined.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
uint32_t<br>
isl_tiling_to_i915_tiling(enum isl_tiling tiling)<br>
{<br>
@@ -106,3 +110,16 @@ isl_drm_modifier_get_info(<wbr>uint64_t modifier)<br>
<br>
return NULL;<br>
}<br>
+<br>
+uint64_t<br>
+isl_drm_modifier_from_tiling(<wbr>enum isl_tiling tiling,<br>
+ enum isl_aux_usage aux_usage)<br>
+{<br>
+ for (unsigned i = 0; i < ARRAY_SIZE(modifier_info); i++) {<br>
+ if (modifier_info[i].tiling == tiling &&<br>
+ modifier_info[i].aux_usage == aux_usage)<br>
+ return modifier_info[i].modifier;<br>
+ }<br>
+<br>
+ return DRM_FORMAT_MOD_INVALID;<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>