From nobody Thu Oct 15 08:03:16 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j50ts01NVz6vQxQ for ; Thu, 15 Oct 2026 08:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j50tr6WMPz4K12 for ; Thu, 15 Oct 2026 08:03:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792051396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2oNlU1om9oA+hReyDYqDdY2usThOnaSCCX8TziE1jnk=; b=OOi8XdDZfJPdCnfY2AclCRRuCNa7EqxfcHPQ7OdWAuA+kojOTzS8l0eqQkU91sminpEAvC iGCVpYOgQs5/w6TvJzV1MfauO1+ch+CvGxYfXwE3Wns9eYQzfDrVsvTJL3DphF7wKFQJQP 7/O7nw7H6+6PjSxZvRDBB5cznFzixpnITTcOcffZoQz3S8GVWOGDw4ob64jKOt/puUTzE4 yj0Du7ElVcpIYR8xPTy2K0BUUmDDEK4zEd+oszE6m+FLCS0H9PVOmshtDc+mMILmsphMVy oGMaxrm6Dilp3V4panM/JPmSoSZgdZouiK9FWdFKnQnBDj7IM9oaL42wEIqBtw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792051396; b=ZF80MemWghAzBYMDGUDb6DpDyhSdcZ7+QbE+Y3Asg5mXDIbx52TQ072sxaSYYC7vOE6+6B X5SgMcyI/rUdsTd4x4Hq/9nHUG0kZjHh2UM/iLVJS4N3cqK7L6AkjmeJE7DDHmaVwp7ebx t7Tz9hYCjHN0D7zCDfKsWQI5Xbmt0KOgpzrBDGIMxtvSSCQeSGTW8BaHREdXM0heFOeGkd HBMVBBdxjom7jlTvT26DwZfR3boFkFKCnomCU0CmmHGBhTDw7C+Vf/mNRePsEHBokYYyrz sUaT9dM8zfXaoprENl2MYfoXmjpnd/G7iG3ND/xyhy25ALyp+9dNnC8diq1B+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792051396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2oNlU1om9oA+hReyDYqDdY2usThOnaSCCX8TziE1jnk=; b=glmcYGaVn66dJehHiuz82+R7jL+REujEXRXvVhJUXZmH39dqsor72qLDr+FLwGwRX35G0S hANc9zYPSFpYa2NhGNSfTxN4ttMWW5PPC5baDrlMEWIMOQQ2QTLLoZPT8JlI+55pfTwuLu 2WDF4vUPeAXLoMzF4BMNOS10VDoSgxKONJKBU421fLD5PTu8VSf42ZJOIHi7jjdKnNL5Qj orfIXhgJrFZ1+9YLrdI5yxv+outZVso2AkV1ggUl2vqrbmpFDRkF1W2sCa0eHXm0QDePG1 Aop9kL24iHg5TvdlmNWN222YAVAAJS2Hp60q2ReWl7xF+L87zf7xe0TDJ5q3Gw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j50tr5YrlzP3Y for ; Thu, 15 Oct 2026 08:03:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 20dc5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 15 Oct 2026 08:03:16 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Piotr Kubaj Subject: git: a4939c554aa1 - stable/14 - virtio_gpu: use an X8R8G8B8 resource on big-endian guests List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a4939c554aa1e2f7e998201f0ff84c3a44fba54e Auto-Submitted: auto-generated Date: Thu, 15 Oct 2026 08:03:16 +0000 Message-Id: <6ad088c4.20dc5.428247e7@gitrepo.freebsd.org> The branch stable/14 has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=a4939c554aa1e2f7e998201f0ff84c3a44fba54e commit a4939c554aa1e2f7e998201f0ff84c3a44fba54e Author: Piotr Kubaj AuthorDate: 2026-09-28 08:43:35 +0000 Commit: Piotr Kubaj CommitDate: 2026-10-15 07:49:51 +0000 virtio_gpu: use an X8R8G8B8 resource on big-endian guests The virtio-gpu resource formats are defined by byte order in memory, while vt(4) and the X server (through vt_fb and the fb mmap) write native 32-bit 0x00RRGGBB pixels into the shadow framebuffer. On a big-endian guest such as powerpc64 those pixels land in memory as 00 RR GG BB, which the host interprets under B8G8R8X8 with red and blue swapped and the padding byte taken as blue: white renders yellow and blue renders black. Request X8R8G8B8 on big-endian guests instead, which is also what the Linux driver does (DRM_FORMAT_HOST_XRGB8888). Reproduced with a colour test pattern on a powerpc64 QEMU pseries guest using the identically coded out-of-tree fork of this driver (graphics/virtio-gpu-qemu-kmod); little-endian guests are unchanged. Differential Revision: https://reviews.freebsd.org/D60085 Approved by: jhibbits MFC after: 1 week (cherry picked from commit 7cf02164a517824c07faed91c009be90f2f17ec0) (cherry picked from commit ceaf30c92ed7a44f532e24742ed08bcf730c8ac1) --- sys/dev/virtio/gpu/virtio_gpu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/virtio/gpu/virtio_gpu.c b/sys/dev/virtio/gpu/virtio_gpu.c index ccb49a6b7695..08757f43a038 100644 --- a/sys/dev/virtio/gpu/virtio_gpu.c +++ b/sys/dev/virtio/gpu/virtio_gpu.c @@ -61,6 +61,12 @@ /* The guest can allocate resource IDs, we only need one */ #define VTGPU_RESOURCE_ID 1 +#if _BYTE_ORDER == _BIG_ENDIAN +#define VTGPU_FORMAT VIRTIO_GPU_FORMAT_X8R8G8B8_UNORM +#else +#define VTGPU_FORMAT VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM +#endif + struct vtgpu_softc { /* Must be first so we can cast from info -> softc */ struct fb_info vtgpu_fb_info; @@ -537,7 +543,7 @@ vtgpu_create_2d(struct vtgpu_softc *sc) atomic_fetchadd_64(&sc->vtgpu_next_fence, 1)); s.req.resource_id = htole32(VTGPU_RESOURCE_ID); - s.req.format = htole32(VIRTIO_GPU_FORMAT_B8G8R8X8_UNORM); + s.req.format = htole32(VTGPU_FORMAT); s.req.width = htole32(sc->vtgpu_fb_info.fb_width); s.req.height = htole32(sc->vtgpu_fb_info.fb_height);