From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Packard Subject: Re: [PATCH 7/8] dri: add __DRIimageLoaderExtension and __DRIimageDriverExtension Date: Wed, 06 Nov 2013 10:09:13 -0800 Message-ID: <868ux1s8qe.fsf@miki.keithp.com> References: <1383618208-21310-1-git-send-email-keithp@keithp.com> <1383618208-21310-8-git-send-email-keithp@keithp.com> <20131106062554.GA12984@tokamak.local> <86ob5x4m28.fsf@miki.keithp.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1497308882==" Return-path: Received: from keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id D077F10233E for ; Wed, 6 Nov 2013 10:09:19 -0800 (PST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org To: Kristian =?utf-8?Q?H=C3=B8gsberg?= Cc: mesa3d-dev@lists.freedesktop.org, dri-devel List-Id: dri-devel@lists.freedesktop.org --===============1497308882== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Kristian H=C3=B8gsberg writes: > It just the two older create context functions (which fall back to > calling driCreateContextAtribs) and allocateBuffer and releaseBuffer. > The two buffer functions are __DRIbuffer specific of course, but we > can implement them in terms of __DRIimage in dri_util.c now. I guess the benefit is that we could remove the DRIdri2Extension functions from each driver and just use the DRIimage-based wrappers in dri_util then? We're still stuck with leaving the DRIdri2Extension as the interface From=20the loader though. > There is a third option, which is to pull the functions we need from > __DRIcoreExtension into the __DRIimageDriverExtension, which then is > all you need along with __DRIimageExtension. This is as painful in > the short term as the current __DRIimageDriverExtension, but it lets > of cut loose of the DRI1 (__DRIcoreExtension has the DRI1 > createNewScreen in it) and DRI2 baggage properly later on. And > pulling out the functions into a loader private struct as you suggest > will make it a lot less painful. The functions we move from core to > _DRIimageDriverExtension will share the same implementation in > dri_util.c so there's no new code. That doesn't seem like a crazy plan; at least Image-based loaders would be simple then; find the DRIimageDriverExtension and that's it. > Right - I actually like the clean break idea, but if we're going to > take that pain I want to get rid of all the junk and avoid the awkward > "use some stuff from __DRIcoreExtension and other stuff from > __DRIimageDriverExtension" setup. So we should either 1) make > __DRIimageDriverExtension completely replace __DRIcoreExtension and > __DRIdri2Extension, or 2) just do a minimal, incremental change (just > the extension to indicate the support for __DRIimage based > getbuffers). If we're going to get drivers to add DRIimageExtension to the list of exported extensions, then it doesn't seem like it matters which way we go here -- we can move from 2) to 1) in the future without changing any drivers, only the dri_util bits and the loaders. However, if we think that 1) is the way to go, we might as well just do it as that'd avoid having to ever fix the loaders. > The difference is that there the loader returns a packed array of the > buffers the driver asked for. Now we're using a struct which can be > sparsely populated, so the driver should only look at the fields it > asked for. My concern is that the DRI2 drivers always return a front buffer for pixmap drawables, and I think this is actually required for things to work right (I have vague memories of hacking at this when I started this). How about I just stick the set of returned images back into the DRIimageList struct: diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_= interface.h index 2601249..2a873d8 100644 =2D-- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -1319,6 +1319,7 @@ enum __DRIimageBufferMask { }; =20 struct __DRIimageList { + uint32_t image_mask; __DRIimage *back; __DRIimage *front; }; diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 1bb8241..7de7abd 100644 =2D-- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -1208,6 +1208,7 @@ dri3_get_buffers(__DRIdrawable *driDrawable, struct dri3_drawable *priv =3D loaderPrivate; struct dri3_buffer *front, *back; =20 + buffers->image_mask =3D 0; buffers->front =3D NULL; buffers->back =3D NULL; =20 @@ -1254,12 +1255,15 @@ dri3_get_buffers(__DRIdrawable *driDrawable, } =20 if (front) { + buffers->image_mask |=3D __DRI_IMAGE_BUFFER_FRONT; buffers->front =3D front->image; priv->have_fake_front =3D !priv->is_pixmap; } =20 =2D if (back) + if (back) { + buffers->image_mask |=3D __DRI_IMAGE_BUFFER_BACK; buffers->back =3D back->image; + } =20 priv->stamp =3D stamp; =20 diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri= /i965/brw_context.c index 90bbbfc..273d455 100644 =2D-- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -1338,7 +1338,7 @@ intel_update_image_buffers(struct brw_context *brw, _= _DRIdrawable *drawable) buffer_mask, &images); =20 =2D if (images.front) { + if (images.image_mask & __DRI_IMAGE_BUFFER_FRONT) { assert(front_rb); drawable->w =3D images.front->width; drawable->h =3D images.front->height; @@ -1348,7 +1348,7 @@ intel_update_image_buffers(struct brw_context *brw, _= _DRIdrawable *drawable) images.front, __DRI_IMAGE_BUFFER_FRONT); } =2D if (images.back) { + if (images.image_mask & __DRI_IMAGE_BUFFER_BACK) { drawable->w =3D images.back->width; drawable->h =3D images.back->height; intel_update_image_buffer(brw, =2D-=20 keith.packard@intel.com --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) iQIVAwUBUnqFydsiGmkAAAARAQhOAg/9EKrABKK65suAHYiYLo/akWDe4/9w/hX1 sB5PbKg/7gkHzDp/kgrQd/74II4fdg8+Fge90KHej1QtA6uOkJogV4BVAK/HfRgU v5uW3E82SL/lE1gGs/p3zA3T1xYTEcytibjBla2wsb/+hUanKhCAw96GPhsSocHW uP81mNfYahV12/6hiGn9jRFzX28fSWe5XpHmxncxY2zezDPCwebCs0EfP568saIw GB0KnOK1PQALMaNp0q1BpLa5KKyxeCXlR+93SAKqU9TeDWcKn5Pxy5yNwh3nBoEt zYFeC3vK9paJMEVXPlA7scwKi0TqBih2QlZ37mc6hLIZJsbk9O/r74ab2DBJMX6G eZmXZym6oElpGyG+5xm1UZqSF2/TitZ2gQjzUPRydMCy2F33kDJEC7lX1Iu2jITM Gt2RdeNwC83xR4ZFidRKL36HmnpTRi/MAZzky4rHnDRjk3EU7uYiM5FwFr0jgCOh itLyRdZKwSs4mGcLsoEO7PXdYIFpf/bZSHEPsSYHDOLDXMwAw4FpG3mwJRIGASEo iznGURyRoinbLpGmt0U1YEEv8IrA5T5KCIZfqAyUB4OBDIuTKJl50T5hYbRKKKkb 6lQxPw4XTdHuMoY9PcFC4tpqZ6MiZQBl5yIsFTIJujTyOe9yZGo2rKPdGr8c6uP5 HTsNusffhZ4= =FMXv -----END PGP SIGNATURE----- --=-=-=-- --===============1497308882== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1497308882==--