From nobody Tue Nov 11 00:16:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.47 as permitted sender) client-ip=209.51.188.47; 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.47 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=1559913889; cv=none; d=zoho.com; s=zohoarc; b=hrINGl4REyacsOsnhfTvjhEs+OYsdtCAM5ZbHvMWq88wBfDu0EUX5sFZ/0f0Hlf7l1Drd7HWDPhj1ZelSZ3YtNlK3pXICuedizW2oaizjT7BA2qeS6hmKJjcMoQ1NwoR63mLmyl8zuWWEdcOx38TGqbsVJOQf4OnwWLUKpdTA38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559913889; 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=etpXcIwF3znjVI8Q5/rh2i79ZRMbO6F4VUry/GyH7eQ=; b=ZN4Pv3mRNrikDJLdvrN2U2EuBvcTrVBS8BrpbpeXth/XS8muNgPHnFKM6cd3s4GXTQ+NnnR/fAcACzjbxaCbrTzq6v8a6W7iqI6r8mHoaxGmTRwNxdDJEIMwcCqU/LVy/RyvfUA2Hcfm9aCIO9p6l/eOpDBBr9yKsnCf4ymEHdM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.47 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 (lists.gnu.org [209.51.188.47]) by mx.zohomail.com with SMTPS id 1559913889429471.64489990605944; Fri, 7 Jun 2019 06:24:49 -0700 (PDT) Received: from localhost ([::1]:51096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZErH-0003vg-Qb for importer@patchew.org; Fri, 07 Jun 2019 09:24:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34486) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZEm6-0007UL-Et for qemu-devel@nongnu.org; Fri, 07 Jun 2019 09:19:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZEm5-0005WW-FQ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 09:19:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41296) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZEm5-0005Te-A7 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 09:19:17 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B6BC6EB99 for ; Fri, 7 Jun 2019 13:19:11 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-25.ams2.redhat.com [10.36.117.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEE221001B0C; Fri, 7 Jun 2019 13:19:08 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2396A17538; Fri, 7 Jun 2019 15:19:02 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 7 Jun 2019 15:19:01 +0200 Message-Id: <20190607131901.20107-6-kraxel@redhat.com> In-Reply-To: <20190607131901.20107-1-kraxel@redhat.com> References: <20190607131901.20107-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 07 Jun 2019 13:19:11 +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] [PULL 5/5] egl-helpers: add modifier support to egl_dmabuf_import_texture() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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 Message-id: 20190529072144.26737-5-kraxel@redhat.com --- ui/egl-helpers.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 0c9716067cfb..edc53f6d3464 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -229,20 +229,36 @@ 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; +#ifdef EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT + 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; + } +#endif + attrs[i++] =3D EGL_NONE; + image =3D eglCreateImageKHR(qemu_egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, --=20 2.18.1