From nobody Mon Feb 9 10:29:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558681423; cv=none; d=zoho.com; s=zohoarc; b=ZxllPgNYNL3ys5znORRuMJHubR9MfBgypKGT5+b6eaVekWY0R1GYx9e2YPGiPnvQ97MtnenXCgcCGU0rsTI+2FZsQvhO4uOHH7jwWYmBzsqZppddtnPcibTGYmlYZ97GR4jaoH1Op7e+f5PkYNqkUoo1GFde8zwlPbLjfsmh5sY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558681423; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=rYacYSTidfS1XKWiktH/uwX5j/aGoF3IjF/9Dg20Ih4=; b=WXH7ZGzxGwlvDO5zRoh7MBYiYScXyAfjC3ZJVFX3AUgXe/eA9xQ1IORtV/H6JUxiJNlgWrhmP6/7EFuvfIGQFLNYKTP3XUUAq2hWRbJpepC0AlKFkE94buaUnAOsadjdANvdtRzEnfTzLmi7YGfbo39/CrGciuGTac7uhvVsixI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558681423144658.7248697718956; Fri, 24 May 2019 00:03:43 -0700 (PDT) Received: from localhost ([127.0.0.1]:50066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU4Eb-0004u6-RI for importer@patchew.org; Fri, 24 May 2019 03:03:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU4Co-00044i-Um for qemu-devel@nongnu.org; Fri, 24 May 2019 03:01:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU4Cn-0005Gp-Ik for qemu-devel@nongnu.org; Fri, 24 May 2019 03:01:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32794) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hU4Cn-0005G5-60 for qemu-devel@nongnu.org; Fri, 24 May 2019 03:01:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE6E820260 for ; Fri, 24 May 2019 07:01:27 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-101.ams2.redhat.com [10.36.116.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 036AA62516; Fri, 24 May 2019 07:01:22 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AD1311753B; Fri, 24 May 2019 09:01:18 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 24 May 2019 09:01:18 +0200 Message-Id: <20190524070118.30157-5-kraxel@redhat.com> In-Reply-To: <20190524070118.30157-1-kraxel@redhat.com> References: <20190524070118.30157-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 24 May 2019 07:01:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/4] egl-helpers: add modifier support to egl_dmabuf_import_texture() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Williamson , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Check and use QemuDmaBuf->modifier in egl_dmabuf_import_texture() for dmabuf imports. Signed-off-by: Gerd Hoffmann --- ui/egl-helpers.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 0c9716067cfb..87bfd32e8ddb 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -229,20 +229,34 @@ int egl_get_fd_for_texture(uint32_t tex_id, EGLint *s= tride, EGLint *fourcc, void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) { EGLImageKHR image =3D EGL_NO_IMAGE_KHR; - EGLint attrs[] =3D { - EGL_DMA_BUF_PLANE0_FD_EXT, dmabuf->fd, - EGL_DMA_BUF_PLANE0_PITCH_EXT, dmabuf->stride, - EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, - EGL_WIDTH, dmabuf->width, - EGL_HEIGHT, dmabuf->height, - EGL_LINUX_DRM_FOURCC_EXT, dmabuf->fourcc, - EGL_NONE, /* end of list */ - }; + EGLint attrs[64]; + int i =3D 0; =20 if (dmabuf->texture !=3D 0) { return; } =20 + attrs[i++] =3D EGL_WIDTH; + attrs[i++] =3D dmabuf->width; + attrs[i++] =3D EGL_HEIGHT; + attrs[i++] =3D dmabuf->height; + attrs[i++] =3D EGL_LINUX_DRM_FOURCC_EXT; + attrs[i++] =3D dmabuf->fourcc; + + attrs[i++] =3D EGL_DMA_BUF_PLANE0_FD_EXT; + attrs[i++] =3D dmabuf->fd; + attrs[i++] =3D EGL_DMA_BUF_PLANE0_PITCH_EXT; + attrs[i++] =3D dmabuf->stride; + attrs[i++] =3D EGL_DMA_BUF_PLANE0_OFFSET_EXT; + attrs[i++] =3D 0; + if (dmabuf->modifier) { + attrs[i++] =3D EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT; + attrs[i++] =3D (dmabuf->modifier >> 0) & 0xffffffff; + attrs[i++] =3D EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT; + attrs[i++] =3D (dmabuf->modifier >> 32) & 0xffffffff; + } + attrs[i++] =3D EGL_NONE; + image =3D eglCreateImageKHR(qemu_egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, --=20 2.18.1