[PATCH xserver 1/2] modesetting: Ignore alpha channel when importing BOs for modesetting
Olivier Fourdan
ofourdan at redhat.com
Thu Mar 29 07:43:52 UTC 2018
On Thu, Mar 29, 2018 at 7:07 AM, Louis-Francis Ratté-Boulianne <
lfrb at collabora.com> wrote:
> Fixes a regression caused by modifiers support. For some hw to
> continue working even if not supporting ARGB8888 and ARGB2101010
> formats, we assume that all imported BOs are opaque.
>
> Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
> ---
> hw/xfree86/drivers/modesetting/drmmode_display.c | 20
> ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c
> b/hw/xfree86/drivers/modesetting/drmmode_display.c
> index 47c11adce..e010eae21 100644
> --- a/hw/xfree86/drivers/modesetting/drmmode_display.c
> +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
> @@ -70,12 +70,28 @@ modifiers_ptr(struct drm_format_modifier_blob *blob)
> return (struct drm_format_modifier *)(((char *)blob) +
> blob->modifiers_offset);
> }
>
> +static uint32_t
> +get_opaque_format(uint32_t format)
> +{
> + switch (format) {
> + case DRM_FORMAT_ARGB8888:
> + return DRM_FORMAT_XRGB8888;
> + case DRM_FORMAT_ARGB2101010:
> + return DRM_FORMAT_XRGB2101010;
> + default:
> + return format;
> + }
> +}
> +
> Bool
> drmmode_is_format_supported(ScrnInfoPtr scrn, uint32_t format, uint64_t
> modifier)
> {
> xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
> int c, i, j;
>
> + /* BO are imported as opaque surface, so let's pretend there is no
> alpha */
> + format = get_opaque_format(format);
> +
> for (c = 0; c < xf86_config->num_crtc; c++) {
> xf86CrtcPtr crtc = xf86_config->crtc[c];
> drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
> @@ -123,6 +139,9 @@ get_modifiers_set(ScrnInfoPtr scrn, uint32_t format,
> uint64_t **modifiers,
> int c, i, j, k, count_modifiers = 0;
> uint64_t *tmp, *ret = NULL;
>
> + /* BOs are imported as opaque surfaces, so pretend the same thing
> here */
> + format = get_opaque_format(format);
> +
> *modifiers = NULL;
> for (c = 0; c < xf86_config->num_crtc; c++) {
> xf86CrtcPtr crtc = xf86_config->crtc[c];
> @@ -684,6 +703,7 @@ drmmode_bo_import(drmmode_ptr drmmode, drmmode_bo *bo,
> memset(modifiers, 0, sizeof(modifiers));
>
> format = gbm_bo_get_format(bo->gbm);
> + format = get_opaque_format(format);
> for (i = 0; i < num_fds; i++) {
> handles[i] = gbm_bo_get_handle_for_plane(bo->gbm, i).u32;
> strides[i] = gbm_bo_get_stride_for_plane(bo->gbm, i);
> --
> 2.14.3
>
>
Looks good to me.
Tested-by: Olivier Fourdan <ofourdan at redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180329/78fc1628/attachment-0001.html>
More information about the xorg-devel
mailing list