[PATCH] dri2: Pass a ScreenPtr through to the driver's AuthMagic
Michel Dänzer
michel at daenzer.net
Fri Jun 15 03:35:00 PDT 2012
On Fre, 2012-06-15 at 19:01 +1000, Christopher James Halse Rogers
wrote:
> xwayland drivers need access to their screen private data to authenticate.
> Now that drivers no longer have direct access to the global screen arrays,
> this needs to be passed in as function context. The way it was working
> was ugly, anyway.
>
> Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers at canonical.com>
> ---
>
> This came up when I got around to fixing the nouveau xwayland patch review
> comments; with things no longer meant to access the global xf86Screens array
> the authmagic callback needed some other way to access driver private data.
>
> Nouveau patch using this follows; I'll send it upstream once this gets
> applied somewhere.
>
> CCd to xorg-devel mainly for sanity review, but could be applied; as Airlied
> has pointed out, there's no particular reason for the xwayland branch to
> diverge on core infrastructure.
[...]
> @@ -1202,9 +1215,17 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
> cur_minor = 1;
> }
>
> - if (info->version >= 5) {
> + if (info->version >= 7) {
> ds->AuthMagic = info->AuthMagic;
> }
> + else if (info->version >= 5) {
> + /*
> + * This cast is safe; if the driver has provided a V5 or V6 InfoRec
> + * then AuthMagic is of type DRI2LegacyAuthMagicProcPtr, and the C
> + * standard guarantees that we can typecast it back and call it.
> + */
> + ds->LegacyAuthMagic = (DRI2LegacyAuthMagicProcPtr)info->AuthMagic;
> + }
This is nifty, but it's an ABI break, as servers without this change
will treat the version 7 AuthMagic field incorrectly. Wouldn't it be
easier to add a second AuthMagic field at the end of version 7?
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Debian, X and DRI developer
More information about the xorg-devel
mailing list