From: Eric Anholt Subject: Re: [PATCH 03/12] Don't use GetScratchPixmapHeader for shadow pixmaps Date: Wed, 30 Jul 2014 18:33:07 -0700 Message-ID: <87oaw6e2i4.fsf@eliezer.anholt.net> References: <1406243908-1123-1-git-send-email-keithp@keithp.com> <1406243908-1123-4-git-send-email-keithp@keithp.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0136254896==" Return-path: In-Reply-To: <1406243908-1123-4-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 --===============0136254896== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Keith Packard writes: > GetScratchPixmapHeader should only be used for local memory pixmaps, > as used by PutImage and friends. That's because when you free the > scratch pixmap header, it doesn't actually free the pixmap; instead, > it gets stuffed in pScreen->pScratchPixmap and any private data stored > on it will be left hanging around forever. > > In the case of glamor, that private data includes all of the GL > state. Using that scratch pixmap later results in glamor getting > mightily confused as the pixmap and underlying objects do not match. > > Avoid this by allocating pixmap headers explicitly for this purpose. > > Signed-off-by: Keith Packard > --- > src/uxa/intel_display.c | 44 ++++++++++++++++++++++++++++++-------------- > 1 file changed, 30 insertions(+), 14 deletions(-) > > diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c > index 0b83140..bcaafaa 100644 > --- a/src/uxa/intel_display.c > +++ b/src/uxa/intel_display.c > @@ -545,13 +545,31 @@ intel_crtc_shadow_allocate(xf86CrtcPtr crtc, int wi= dth, int height) > return NULL; > } >=20=20 > - drm_intel_bo_disable_reuse(intel_crtc->rotate_bo); > - > intel_crtc->rotate_pitch =3D rotate_pitch; > return intel_crtc->rotate_bo; > } See comment below... > @@ -602,8 +620,8 @@ intel_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr= rotate_pixmap, void *data) > struct intel_mode *mode =3D intel_crtc->mode; >=20=20 > if (rotate_pixmap) { > - intel_set_pixmap_bo(rotate_pixmap, NULL); > - FreeScratchPixmapHeader(rotate_pixmap); > + intel_set_pixmap_bo(rotate_pixmap, NULL); > + rotate_pixmap->drawable.pScreen->DestroyPixmap(rotate_pi= xmap); > } >=20=20 > if (data) { > @@ -1415,7 +1433,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, = int height) > int i, old_width, old_height, old_pitch; > int pitch; > uint32_t tiling; > - ScreenPtr screen; >=20=20 > if (scrn->virtualX =3D=3D width && scrn->virtualY =3D=3D height) > return TRUE; > @@ -1430,8 +1447,7 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, = int height) > old_front =3D intel->front_buffer; >=20=20 > if (intel->back_pixmap) { > - screen =3D intel->back_pixmap->drawable.pScreen; > - screen->DestroyPixmap(intel->back_pixmap); > + scrn->pScreen->DestroyPixmap(intel->back_pixmap); > intel->back_pixmap =3D NULL; > } >=20=20 Grumble, unrelated noise in the patch. > @@ -1454,7 +1470,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, = int height) > if (ret) > goto fail; >=20=20 > - drm_intel_bo_disable_reuse(intel->front_buffer); > intel->front_pitch =3D pitch; > intel->front_tiling =3D tiling; >=20=20 This change appears to be unrelated, and possibly harmful (if X has dropped the last ref to the BO, but it's still the scanout buffer, a new allocation would now reuse the BO and scribble on scanout until the next modeset happens). > @@ -2204,6 +2219,7 @@ Bool intel_crtc_on(xf86CrtcPtr crtc) > return ret; > } >=20=20 > + > static PixmapPtr > intel_create_pixmap_for_bo(ScreenPtr pScreen, dri_bo *bo, > int width, int height, Unrelated whitespace. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJT2ZzTAAoJELXWKTbR/J7oNCoP/j3nB2hlsh1fBQ3DoIj0zdqj ERVEqsxLucD/LoIDkQBuP25NmeB/YbMvdMhEeTEEkzf0rmUNnZyp/vzzygcvGCGW AapMvsbCBVMz/rSzYyA9uDCjQmL1SFwNb1siFXUiyoVwDv433jmZpReOAfT/mIY/ tSPjKCuV+HftxvqL75ZaWWgkxi8iZ7k+jX3LK/DD8qniTssOD0S2LdLCSNQUHCb2 1Qh7feg8T7fcUCBWRBhAgMk1BDTnec6yWYCavhYsIYp7ZNtPDyb4uqzhIpzbBfZN emft0ukgfgnIeVvd/FgKhxuQehsgnuwpv5j0FIUgP9KkQGMCunh2a/br15tgEEfB 9mQ8mgCeniTc7fWrUzKpTwxi6HXy71ladBFJoFV588ePJJQqTdRZU6mnherDdSN0 6Fs117qt9NeiTSn9SSmAaLuAaaKkvYyC83TMxdn2gFQU2BWlNWkeXCEiYv9uJi7z /Z/8cqHFivPtF4ac/LNFMuv4fOyAYAbfmLX6mTMetu4NOf2A846cYB+tWCTNaRvr PfkfTS2uOgwnVWZG2JvuVKjAvTJyEzEzKk5xF0Pm1BHEf/Kv7CkOzhfVBZyoeSNP BXNvKvJ2Vi1v6XvnvYxJtfzfQT3JMEf7K2q5q7/yaC+1DyvRcHScyPegjCjDzi2N nZGFWmtoWxsJTPw3KS6I =Eic5 -----END PGP SIGNATURE----- --=-=-=-- --===============0136254896== 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 --===============0136254896==--