From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH v3 1/2] drm/gem: drm_gem_dumb_map_offset(): reject dma-buf Date: Fri, 18 Aug 2017 13:34:45 -0700 Message-ID: <87shgopqca.fsf@eliezer.anholt.net> References: <1502986891-36764-1-git-send-email-noralf@tronnes.org> <1502986891-36764-2-git-send-email-noralf@tronnes.org> <20170818074656.xawukspyerve6wnb@phenom.ffwll.local> <1de97ff3-44d5-aeac-e03d-4976e455ab67@tronnes.org> <87mv6wdb9a.fsf@eliezer.anholt.net> <20170818201730.62slltrw4fwlj5qe@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1214505405==" Return-path: Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 9190F89C46 for ; Fri, 18 Aug 2017 20:41:09 +0000 (UTC) In-Reply-To: <20170818201730.62slltrw4fwlj5qe@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Daniel Vetter Cc: narmstrong@baylibre.com, daniel.vetter@ffwll.ch, liviu.dudau@arm.com, dri-devel@lists.freedesktop.org, thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com, daniel.vetter@intel.com, marex@denx.de, boris.brezillon@free-electrons.com, abrodkin@synopsys.com, linux@armlinux.org.uk, z.liuxinliang@hisilicon.com, kong.kongxinwei@hisilicon.com, tomi.valkeinen@ti.com, airlied@redhat.com, puck.chen@hisilicon.com, jsarha@ti.com, vincent.abriou@st.com, alison.wang@freescale.com, sw0312.kim@samsung.com, philippe.cornu@st.com, yannick.fertre@st.com, kyungmin.park@samsung.com, zourongrong@gmail.com, maxime.ripard@free-electrons.com, shawnguo@kernel.org, kraxel@redhat.com List-Id: dri-devel@lists.freedesktop.org --===============1214505405== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Daniel Vetter writes: > On Fri, Aug 18, 2017 at 10:41:21AM -0700, Eric Anholt wrote: >> Noralf Tr=C3=B8nnes writes: >> > Den 18.08.2017 09.46, skrev Daniel Vetter: >> >> On Thu, Aug 17, 2017 at 06:21:30PM +0200, Noralf Tr=C3=B8nnes wrote: >> >>> Reject mapping an imported dma-buf since is's an invalid use-case. >> >>> >> >>> Cc: Philipp Zabel >> >>> Cc: Laurent Pinchart >> >>> Cc: Sean Paul >> >>> Cc: Daniel Vetter >> >>> Signed-off-by: Noralf Tr=C3=B8nnes >> >> I think acks from someone using mali would be good too. amdgpu alread= y has >> >> such checks, so I think on the desktop side we're ok. >> >> >> >> Acked-by: Daniel Vetter >> >> >> >> But I think this one here definitely needs a few more acks. I could b= reak >> >> uabi if we're unlucky, so let's not rush it. >> > >> > Ok, I've CC'ed the affected parties to increase the odds that they look >> > at this. These are the drivers using drm_gem_dumb_map_offset() >> > (hopefully I got the list right): >>=20 >> If I understand the affected path right, this would break the PL111+VC4 >> combination: PL111 makes (dumb) buffers for scanout, and VC4 imports >> them and uses them for rendering. A vc4 glReadPixels of the window >> system buffer would map it and fail. > > It only rejects the map call on dumb buffers, and mmap on imported dma-buf > tends to not really work well, or at least break a few abstractions. Are > you sure this works currently? OK, that's right -- vc4 would be doing its "native" map call (the same code), not dumb map. Furthermore, I had it backwards (I had written things both ways at different points, iirc). We have VC4 making the buffers and PL111 dma-buf importing them. I don't see X11 mapping those buffers if glamor is enabled, so this should be OK for vc4. GBM's dumb mapping looks safe to me. X11 does some dumb maps, but I don't think any of those would be on imports. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlmXT2UACgkQtdYpNtH8 nujAEA/8CntLwlvIBriEvNImm2Vh0CTAIF/p3aFhJOtvfZu1OOjFbz+TVORhkbFU PhEiJNZ5gbouaFVyOzWv71hPyuP88vOq+mB5qvEiegb2VNZ1ioYX917hPzbS4ra7 VoTuhcbw3NuU88pVxYAtTwpWILObM7o4reLKKzD6zWniGDR3gFvcx04EVTV/4/Gi sdrIHipwr4aMgN8wFzy6GkHqtm5vTs6rRy50Vao0j2zrHvfb/qH6op7A4CRepEEJ eqCxezEqtnd/nDzNCnFjNKaHZ217CChFBmpcWakXqsxWsLUmUpA3mkfPDQiqoxY2 AnbJ+vUJKsfdkaZTb7sbtQtLNx2NW0cQXQNOkszmpwJM63ZVLwNEYp/s7ybAyNK2 Ja1a2wG7F/1q8tkKmdnoI1cmtkzFvJxb+Oxj0WexRkkHrxiAf3xSr+ythUdV7JeV v0MSDUB9WuPNb6v9XFY96K+ZqZ8FCBOlmt/qW80kN94j7RBTELhZsqKk3JLrAOXU yfWxtStj7qwdk2zBNC6fMZ4OEW9qXfgajaRWJW7FquF57ANkO+GkP6rnjQ5xy/HW EO3AJi1OuroaEmdDsMy/tNTCkhyU4laGjtQ1g1YOs6rVmIgxkkXxf2iiN8DAZrAI gOfvhfUCYkg+BD61Y9OAIuKFPHk9uIRrpR6vf0TazC0xyH6QS2o= =Gvj3 -----END PGP SIGNATURE----- --=-=-=-- --===============1214505405== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1214505405==--