From patchwork Thu Aug 22 17:22:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 13773970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BC25C52D7C for ; Thu, 22 Aug 2024 17:24:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F96110E32E; Thu, 22 Aug 2024 17:24:08 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="QezCrIZv"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0493610E32E for ; Thu, 22 Aug 2024 17:24:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724347446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yi2sImE+csGTdylKz0AQ6alYTS92tDnluiFKm4HjHQA=; b=QezCrIZvoUVCMuo7ktwC9uJNGcYxXK5njaWqkFpdBs7huGiKRvO+OKiVrdd5b4i9izSk0v b73etkiq+mWSKXBhfdjDgCDiPpYzOb9oY3ec9sAsUt/v7MhHvqKIYIXtver2Hmv6KAEjFN 5bNP90cAnLijdLlseBIdRodpTNILfBE= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-629-5AIUiewIPXuer5mJ3DsXRA-1; Thu, 22 Aug 2024 13:24:03 -0400 X-MC-Unique: 5AIUiewIPXuer5mJ3DsXRA-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 37B061955D45; Thu, 22 Aug 2024 17:24:01 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.193.88]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9D10B19560AD; Thu, 22 Aug 2024 17:23:57 +0000 (UTC) From: Jocelyn Falempe To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Daniel Vetter , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev Cc: Jocelyn Falempe Subject: [PATCH 2/2] drm/virtio: Add support for XRGB8888 and BGRX8888 Date: Thu, 22 Aug 2024 19:22:01 +0200 Message-ID: <20240822172338.698922-2-jfalempe@redhat.com> In-Reply-To: <20240822172338.698922-1-jfalempe@redhat.com> References: <20240822172338.698922-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On big endian machine, fbdev wants BGRX8888, but gnome/wayland wants XRGB8888, which wasn't possible because virtio-gpu could only support one format. Now that it's fixed, it can supports both. Signed-off-by: Jocelyn Falempe --- drivers/gpu/drm/virtio/virtgpu_display.c | 6 ++++-- drivers/gpu/drm/virtio/virtgpu_plane.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 3f18ee0fd5155..023a9dfa4788a 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -321,8 +321,10 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev, struct virtio_gpu_object *bo; int ret; - if (mode_cmd->pixel_format != DRM_FORMAT_HOST_XRGB8888 && - mode_cmd->pixel_format != DRM_FORMAT_HOST_ARGB8888) + if (mode_cmd->pixel_format != DRM_FORMAT_XRGB8888 && + mode_cmd->pixel_format != DRM_FORMAT_ARGB8888 && + mode_cmd->pixel_format != DRM_FORMAT_BGRX8888 && + mode_cmd->pixel_format != DRM_FORMAT_BGRA8888) return ERR_PTR(-ENOENT); /* lookup object associated with res handle */ diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index a72a2dbda031c..32fbe30b45a46 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -30,11 +30,13 @@ #include "virtgpu_drv.h" static const uint32_t virtio_gpu_formats[] = { - DRM_FORMAT_HOST_XRGB8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_BGRX8888, }; static const uint32_t virtio_gpu_cursor_formats[] = { - DRM_FORMAT_HOST_ARGB8888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_BGRA8888, }; uint32_t virtio_gpu_translate_format(uint32_t drm_fourcc)