From: Eric Anholt Subject: Re: [PATCH 10/12] Add glamor back into the driver Date: Wed, 30 Jul 2014 19:28:42 -0700 Message-ID: <8761iedzxh.fsf@eliezer.anholt.net> References: <1406243908-1123-1-git-send-email-keithp@keithp.com> <1406243908-1123-11-git-send-email-keithp@keithp.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2129849159==" Return-path: In-Reply-To: <1406243908-1123-11-git-send-email-keithp-aN4HjG94KOLQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: xorg-devel-bounces-go0+a7rfsptAfugRpC6u6w@public.gmane.org Sender: "xorg-devel" To: Keith Packard , xorg-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: intel-gfx@lists.freedesktop.org --===============2129849159== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Keith Packard writes: > This adds glamor support back into the driver, but instad of going > through UXA, this uses it directly instead. This is hard to read with the conditionalizing all of the UXA code in the same commit as adding the glamor code. Then there are a bunch of unrelated whitespace changes, or flattening of a bunch of nested conditionals. The only substantive problem I see is intel_glamor_set_pixmap_bo(). > +static void intel_check_accel_option(ScrnInfoPtr scrn) > +{ > + intel_screen_private *intel =3D intel_get_screen_private(scrn); > + enum { NONE, SNA, UXA, GLAMOR } accel_method =3D DEFAULT_ACCEL_METHOD; > + const char *s; > + > + s =3D xf86GetOptValString(intel->Options, OPTION_ACCEL_METHOD); > + if (s !=3D NULL) { > +#if USE_GLAMOR > + if (strcasecmp(s, "glamor") =3D=3D 0) > + accel_method =3D GLAMOR; > + else > +#endif > +#if USE_UXA > + if (strcasecmp(s, "uxa") =3D=3D 0) > + accel_method =3D UXA; > + else > +#endif > + accel_method =3D DEFAULT_ACCEL_METHOD; > + } > + switch (accel_method) { > + default: > +#if USE_GLAMOR > + case GLAMOR: > + intel->accel =3D ACCEL_GLAMOR; > + break; > +#endif > +#if USE_UXA > + case UXA: > + intel->accel =3D ACCEL_UXA; > + break; > +#endif > + } The extra enum and temporary variable introduced here seems pretty pointless (even if that pattern had happened before). > diff --git a/src/uxa/intel_glamor.c b/src/uxa/intel_glamor.c > index 21636d1..e2bc24c 100644 > --- a/src/uxa/intel_glamor.c > +++ b/src/uxa/intel_glamor.c > +Bool > +intel_glamor_set_pixmap_bo(PixmapPtr pixmap, drm_intel_bo *bo) > +{ > + if (bo =3D=3D NULL || glamor_egl_create_textured_pixmap(pixmap, > + bo->handle, > + intel_pixmap= _pitch(pixmap))) > + { > + intel_glamor_reference_pixmap_bo(pixmap, bo); > + return TRUE; > + } > + return FALSE; > +} I don't think this will work -- glamor_egl uses a different fd from intel->bufmgr, so you're attaching some unrelated BO, if you're even that lucky. > Bool > intel_glamor_init(ScreenPtr screen) > { > ScrnInfoPtr scrn =3D xf86ScreenToScrn(screen); > - intel_screen_private *intel =3D intel_get_screen_private(scrn); >=20=20 > - if ((intel->uxa_flags & UXA_GLAMOR_EGL_INITIALIZED) =3D=3D 0) > - goto fail; > + if (!dixPrivateKeyRegistered(&intel_glamor_pixmap_key)) > + if (!dixRegisterPrivateKey(&intel_glamor_pixmap_key, PRI= VATE_PIXMAP, sizeof (struct intel_glamor_pixmap))) > + return FALSE; No need to check for initiailization -- double-calling it is safe (as long as the size is consistent). > void > @@ -258,18 +240,52 @@ intel_glamor_flush(intel_screen_private * intel) > ScreenPtr screen; >=20=20 > screen =3D xf86ScrnToScreen(intel->scrn); > - if (intel->uxa_flags & UXA_USE_GLAMOR) > - glamor_block_handler(screen); > + glamor_block_handler(screen); > } glamor_block_handler() is pretty awfully named. We should do something about that. --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJT2anaAAoJELXWKTbR/J7oaLYP/R7KUa4nJ9J1jXlKyetNGrTz ZCJuAdReCuZPtZoR+hJ7kLypXZaOIJUAux/sGt7/aszp5WCehQ0Fa5wSb7XQaLmu ymonK5Sj+aup4oI0AtCsOPXYPdHOM+ffHDiCdWDeEWwPcw5OzKHyndYCc07iqgJ0 kgwyE4jdQU33twTUqHeOhZYhlL/QC8vbtLoYirKge9DphghI2pfiiNV4kXnQ0ehi YoXB2kXting/IZrHJAf+uaMjoQxJrn7Gd/eJ9LKgCJ0Ny8+6WJlgDXKtv2RZPzAY WVhpRGYI1aUH3pIegwBqy02vVoMYHVrWq4Vca42ZGt53fP0s0lyY6QOM8MdEgBPH JwZjCESlESUOBPDTXKbxoDOER+8P5gcE92CNRLouRnzxNyz8N0QxZcHJtldNM3jK qSycB759D6Ju2jMcEfFUqZHYLgYG9jum4MHoBptFzmAn5qJ+2fv1esLo+xWwyRM4 3Ec2lpGr0QJFpbSJaC7j5aQQGNY8nuHUG2mbiLhuNXOUqTUgoq+BvzeGF1i2vojF 7uFlOmxaybSDcM6W7BOl6zZxfsK5TGw3p4ImBk1mECmBC4KmD87aVRFGSmc+69ty 0FMZtV7HMrjn879+GKdQ4QTqI4ocPeyB5dOqAXio1+EycPtTyR5InuRppn7JXMmp SDebv45dxdbUVQm5yC9N =cFxx -----END PGP SIGNATURE----- --==-=-=-- --===============2129849159== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ xorg-devel-go0+a7rfsptAfugRpC6u6w@public.gmane.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel --===============2129849159==--