<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 23, 2017 at 10:21 PM, Ben Widawsky <span dir="ltr"><<a href="mailto:ben@bwidawsk.net" target="_blank">ben@bwidawsk.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Since the code doesn't support modifiers yet, this patch should do<br>
nothing other than prepare for more patches.<br>
<br>
Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net" target="_blank">ben@bwidawsk.net</a>><br>
Acked-by: Daniel Stone <<a href="mailto:daniels@collabora.com" target="_blank">daniels@collabora.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/int<wbr>el_screen.c | 64 ++++++++++++++++++++++++------<wbr>--<br>
1 file changed, 49 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/in<wbr>tel_screen.c b/src/mesa/drivers/dri/i965/in<wbr>tel_screen.c<br>
index b7c0a55231..e3fe2a468f 100644<br>
--- a/src/mesa/drivers/dri/i965/in<wbr>tel_screen.c<br>
+++ b/src/mesa/drivers/dri/i965/in<wbr>tel_screen.c<br>
@@ -599,6 +599,48 @@ select_best_modifier(struct gen_device_info *devinfo,<br>
#undef YTILE<br>
}<br>
<br>
+static int<br>
+create_image_with_modifier(st<wbr>ruct intel_screen *screen,<br>
+ __DRIimage *image, uint64_t modifier,<br>
+ int width, int height, int cpp)<br>
+{<br>
+ uint32_t tiling = I915_TILING_X;<br>
+ unsigned long pitch;<br>
+<br>
+ switch (modifier) {<br>
+ case I915_FORMAT_MOD_Y_TILED:<br>
+ tiling = I915_TILING_Y;<br>
+ break;<br>
+ case I915_FORMAT_MOD_X_TILED:<br>
+ assert(tiling == I915_TILING_X);<br>
+ break;<br>
+ case DRM_FORMAT_MOD_LINEAR:<br>
+ tiling = I915_TILING_NONE;<br>
+ break;<br>
+ case DRM_FORMAT_MOD_INVALID:<br>
+ default:<br>
+ break;<br>
+ }<br>
+<br>
+ image->bo = drm_intel_bo_alloc_tiled(scree<wbr>n->bufmgr, "image+mod",<br>
+ width, height, cpp, &tiling,<br>
+ &pitch, 0);<br>
+ if (image->bo == NULL)<br>
+ return false;<br>
+<br>
+ if (tiling != I915_TILING_Y) {<br>
+ drm_intel_bo_unreference(image<wbr>->bo);<br>
+ return false;<br></blockquote><div><br></div><div>Why only Y-tiled?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
+<br>
+ image->width = width;<br>
+ image->height = height;<br>
+ image->pitch = pitch;<br>
+ image->modifier = modifier;<br>
+<br>
+ return true;<br>
+}<br>
+<br>
static __DRIimage *<br>
__intel_create_image(__DRIscr<wbr>een *dri_screen,<br>
int width, int height, int format,<br>
@@ -623,20 +665,6 @@ __intel_create_image(__DRIscre<wbr>en *dri_screen,<br>
assert(!(use && count));<br>
<br>
uint64_t modifier = select_best_modifier(&screen-><wbr>devinfo, modifiers, count);<br>
- switch (modifier) {<br>
- case I915_FORMAT_MOD_X_TILED:<br>
- assert(tiling == I915_TILING_X);<br>
- break;<br>
- case DRM_FORMAT_MOD_LINEAR:<br>
- tiling = I915_TILING_NONE;<br>
- break;<br>
- case I915_FORMAT_MOD_Y_TILED:<br>
- tiling = I915_TILING_Y;<br>
- break;<br>
- case DRM_FORMAT_MOD_INVALID:<br>
- default:<br>
- break;<br>
- }<br>
<br>
if (use & __DRI_IMAGE_USE_CURSOR) {<br>
if (width != 64 || height != 64)<br>
@@ -652,6 +680,13 @@ __intel_create_image(__DRIscre<wbr>en *dri_screen,<br>
return NULL;<br>
<br>
cpp = _mesa_get_format_bytes(image-><wbr>format);<br>
+ if (modifier != DRM_FORMAT_MOD_INVALID) {<br>
+ if (create_image_with_modifier(sc<wbr>reen, image, modifier, width,<br>
+ height, cpp)) {<br>
+ return image;<br></blockquote><div><br></div><div>Yeah, this is a good way to do it.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ }<br>
+ }<br>
+<br>
image->bo = drm_intel_bo_alloc_tiled(scree<wbr>n->bufmgr, "image",<br>
width, height, cpp, &tiling,<br>
&pitch, 0);<br>
@@ -662,7 +697,6 @@ __intel_create_image(__DRIscre<wbr>en *dri_screen,<br>
image->width = width;<br>
image->height = height;<br>
image->pitch = pitch;<br>
- image->modifier = modifier;<br>
<br>
return image;<br>
}<br>
<span class="m_-9083479446873360610HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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>