On 26 November 2015 at 07:14, Ben Skeggs <skeg...@gmail.com> wrote: > From: Ben Skeggs <bske...@redhat.com> > > This will expose functionality supported by newer kernel interfaces. > > Current userspace uses the chipset to determine which classes are likely > exposed, which generally works pretty well, but isn't as flexible as it > could be. > > Unfortunately, the G98:GF100 video code in Mesa is still relying on the > kernel exposing incorrect vdec classes on some chipsets. The ABI16 > kernel interfaces have a workaround for this in place, but that will no > longer be available once libdrm supports NVIF. > > To prevent a regression when NVIF support is added, if there's no kernel > support for NVIF, libdrm will magic up a class list containing correct > vdec classes anyway instead of failing with -ENODEV. > > Signed-off-by: Ben Skeggs <bske...@redhat.com> > --- > nouveau/abi16.c | 28 ++++++++++++++++++++++++++++ > nouveau/nouveau-symbol-check | 3 +++ > nouveau/nouveau.c | 41 +++++++++++++++++++++++++++++++++++++++++ > nouveau/nouveau.h | 17 +++++++++++++++++ > nouveau/private.h | 1 + > 5 files changed, 90 insertions(+) > > diff --git a/nouveau/abi16.c b/nouveau/abi16.c > index 8f24ba2..34e9fb1 100644 > --- a/nouveau/abi16.c > +++ b/nouveau/abi16.c
> +drm_private int > +abi16_sclass(struct nouveau_object *obj, struct nouveau_sclass **psclass) > +{ > + struct nouveau_sclass *sclass; > + struct nouveau_device *dev; > + > + if (!(sclass = *psclass = calloc(8, sizeof(*sclass)))) Most places set the user provided pointer if the function succeeds. I.e. move *psclass = sclass; after the error check ? > + return -ENOMEM; > + > + switch (obj->oclass) { > + case NOUVEAU_FIFO_CHANNEL_CLASS: > + dev = (struct nouveau_device *)obj->parent; > + if (dev->chipset >= 0x98 && > + dev->chipset != 0xa0 && > + dev->chipset < 0xc0) { > + *sclass++ = (struct nouveau_sclass){ 0x85b1, -1, -1 }; > + *sclass++ = (struct nouveau_sclass){ 0x85b2, -1, -1 }; > + *sclass++ = (struct nouveau_sclass){ 0x85b3, -1, -1 }; Worth adding a comment (just grab the commit message) about this magic ? > --- a/nouveau/nouveau.h > +++ b/nouveau/nouveau.h > @@ -63,12 +63,29 @@ struct nv04_notify { > uint32_t length; > }; > > +struct nouveau_sclass { > + int32_t oclass; > + int minver; > + int maxver; > +}; > + > +struct nouveau_mclass { > + int32_t oclass; > + int version; > + void *data; > +}; > + Can you please add a comment about the meaning of sclass and mclass. Thanks Emil _______________________________________________ Nouveau mailing list Nouveau@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/nouveau