<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Mar 29, 2018 at 7:07 AM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Fixes a regression caused by modifiers support. For some hw to<br>
continue working even if not supporting ARGB8888 and ARGB2101010<br>
formats, we assume that all imported BOs are opaque.<br>
<br>
Signed-off-by: Louis-Francis Ratté-Boulianne <<a href="mailto:lfrb@collabora.com">lfrb@collabora.com</a>><br>
---<br>
hw/xfree86/drivers/<wbr>modesetting/drmmode_display.c | 20 ++++++++++++++++++++<br>
1 file changed, 20 insertions(+)<br>
<br>
diff --git a/hw/xfree86/drivers/<wbr>modesetting/drmmode_display.c b/hw/xfree86/drivers/<wbr>modesetting/drmmode_display.c<br>
index 47c11adce..e010eae21 100644<br>
--- a/hw/xfree86/drivers/<wbr>modesetting/drmmode_display.c<br>
+++ b/hw/xfree86/drivers/<wbr>modesetting/drmmode_display.c<br>
@@ -70,12 +70,28 @@ modifiers_ptr(struct drm_format_modifier_blob *blob)<br>
return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset);<br>
}<br>
<br>
+static uint32_t<br>
+get_opaque_format(uint32_t format)<br>
+{<br>
+ switch (format) {<br>
+ case DRM_FORMAT_ARGB8888:<br>
+ return DRM_FORMAT_XRGB8888;<br>
+ case DRM_FORMAT_ARGB2101010:<br>
+ return DRM_FORMAT_XRGB2101010;<br>
+ default:<br>
+ return format;<br>
+ }<br>
+}<br>
+<br>
Bool<br>
drmmode_is_format_supported(<wbr>ScrnInfoPtr scrn, uint32_t format, uint64_t modifier)<br>
{<br>
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);<br>
int c, i, j;<br>
<br>
+ /* BO are imported as opaque surface, so let's pretend there is no alpha */<br>
+ format = get_opaque_format(format);<br>
+<br>
for (c = 0; c < xf86_config->num_crtc; c++) {<br>
xf86CrtcPtr crtc = xf86_config->crtc[c];<br>
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;<br>
@@ -123,6 +139,9 @@ get_modifiers_set(ScrnInfoPtr scrn, uint32_t format, uint64_t **modifiers,<br>
int c, i, j, k, count_modifiers = 0;<br>
uint64_t *tmp, *ret = NULL;<br>
<br>
+ /* BOs are imported as opaque surfaces, so pretend the same thing here */<br>
+ format = get_opaque_format(format);<br>
+<br>
*modifiers = NULL;<br>
for (c = 0; c < xf86_config->num_crtc; c++) {<br>
xf86CrtcPtr crtc = xf86_config->crtc[c];<br>
@@ -684,6 +703,7 @@ drmmode_bo_import(drmmode_ptr drmmode, drmmode_bo *bo,<br>
memset(modifiers, 0, sizeof(modifiers));<br>
<br>
format = gbm_bo_get_format(bo->gbm);<br>
+ format = get_opaque_format(format);<br>
for (i = 0; i < num_fds; i++) {<br>
handles[i] = gbm_bo_get_handle_for_plane(<wbr>bo->gbm, i).u32;<br>
strides[i] = gbm_bo_get_stride_for_plane(<wbr>bo->gbm, i);<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.14.3<br>
</font></span><br></blockquote></div><br></div><div class="gmail_extra">Looks good to me.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Tested-by: Olivier Fourdan <<a href="mailto:ofourdan@redhat.com">ofourdan@redhat.com</a>><br></div><div class="gmail_extra">Reviewed-by: Olivier Fourdan <<a href="mailto:ofourdan@redhat.com">ofourdan@redhat.com</a>><br></div></div>