[PATCH] dri2: Pass a ScreenPtr through to the driver's AuthMagic

Christopher James Halse Rogers christopher.halse.rogers at canonical.com
Fri Jun 15 04:54:22 PDT 2012


On Fri, 2012-06-15 at 12:35 +0200, Michel Dänzer wrote:
> 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?

The only way a driver would send a version 7 DRI2InfoPtr would be if it
were built against a server with this code, right? Are drivers generally
expected work against a server *older* than they were built against?

It could easily be an extra field in the InfoPtr, of course.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120615/cd9d7087/attachment.pgp>


More information about the xorg-devel mailing list