[Nouveau] [libdrm v3 13/14] nouveau: clean up nouveau.h, noting deprecated members/functions

Emil Velikov emil.l.velikov at gmail.com
Thu Dec 17 15:18:43 PST 2015


Hi Ben,

A couple of side notes, not really anything we should do at this point.

On 16 December 2015 at 23:21, Ben Skeggs <skeggsb at gmail.com> wrote:
> From: Ben Skeggs <bskeggs at redhat.com>
>
> Signed-off-by: Ben Skeggs <bskeggs at redhat.com>
> ---
>  nouveau/nouveau.h | 227 +++++++++++++++++++++++++++---------------------------
>  1 file changed, 114 insertions(+), 113 deletions(-)
>
> diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h
> index f3cf8f5..335ce77 100644
> --- a/nouveau/nouveau.h
> +++ b/nouveau/nouveau.h
> @@ -4,24 +4,43 @@
>  #include <stdint.h>
>  #include <stdbool.h>
>
> -#define NOUVEAU_DEVICE_CLASS       0x80000000
> -#define NOUVEAU_FIFO_CHANNEL_CLASS 0x80000001
> -#define NOUVEAU_NOTIFIER_CLASS     0x80000002
> -#define NOUVEAU_PARENT_CLASS       0xffffffff
> +/* Supported class information, provided by the kernel */
> +struct nouveau_sclass {
> +       int32_t oclass;
> +       int minver;
> +       int maxver;
> +};
>
> -struct nouveau_list {
> -       struct nouveau_list *prev;
> -       struct nouveau_list *next;
> +/* Client-provided array describing class versions that are desired.
> + *
> + * These are used to match against the kernel's list of supported classes.
> + */
> +struct nouveau_mclass {
> +       int32_t oclass;
> +       int version;
> +       void *data;
>  };
>
>  struct nouveau_object {
>         struct nouveau_object *parent;
>         uint64_t handle;
>         uint32_t oclass;
> -       uint32_t length;
> -       void *data;
> +       uint32_t length;        /* deprecated */
> +       void *data;             /* deprecated */
Not 100% sure but we might get away with annotating these as
__attribute__ ((deprecated)).

>  };
>
> +int nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
> +                      uint32_t oclass, void *data, uint32_t length,
> +                      struct nouveau_object **);
> +void nouveau_object_del(struct nouveau_object **);
> +int nouveau_object_mthd(struct nouveau_object *, uint32_t mthd,
> +                       void *data, uint32_t size);
> +int nouveau_object_sclass_get(struct nouveau_object *,
> +                             struct nouveau_sclass **);
> +void nouveau_object_sclass_put(struct nouveau_sclass **);
> +int nouveau_object_mclass(struct nouveau_object *,
> +                         const struct nouveau_mclass *);
> +
>  struct nouveau_drm {
>         struct nouveau_object client;
>         int fd;
> @@ -40,81 +59,11 @@ nouveau_drm(struct nouveau_object *obj)
>  int nouveau_drm_new(int fd, struct nouveau_drm **);
>  void nouveau_drm_del(struct nouveau_drm **);
>
> -struct nouveau_fifo {
> -       struct nouveau_object *object;
> -       uint32_t channel;
> -       uint32_t pushbuf;
> -       uint64_t unused1[3];
> -};
> -
> -struct nv04_fifo {
> -       struct nouveau_fifo base;
> -       uint32_t vram;
> -       uint32_t gart;
> -       uint32_t notify;
> -};
> -
> -struct nvc0_fifo {
> -       struct nouveau_fifo base;
> -       uint32_t notify;
> -};
> -
> -#define NVE0_FIFO_ENGINE_GR  0x00000001
> -#define NVE0_FIFO_ENGINE_VP  0x00000002
> -#define NVE0_FIFO_ENGINE_PPP 0x00000004
> -#define NVE0_FIFO_ENGINE_BSP 0x00000008
> -#define NVE0_FIFO_ENGINE_CE0 0x00000010
> -#define NVE0_FIFO_ENGINE_CE1 0x00000020
> -#define NVE0_FIFO_ENGINE_ENC 0x00000040
> -
> -struct nve0_fifo {
> -       struct {
> -               struct nouveau_fifo base;
> -               uint32_t notify;
> -       };
> -       uint32_t engine;
> -};
> -
> -struct nv04_notify {
> -       struct nouveau_object *object;
> -       uint32_t offset;
> -       uint32_t length;
> -};
> -
> -/* Supported class information, provided by the kernel */
> -struct nouveau_sclass {
> -       int32_t oclass;
> -       int minver;
> -       int maxver;
> -};
> -
> -/* Client-provided array describing class versions that are desired.
> - *
> - * These are used to match against the kernel's list of supported classes.
> - */
> -struct nouveau_mclass {
> -       int32_t oclass; /* 0 == EOL */
> -       int version;
> -       void *data;
> -};
> -
> -int  nouveau_object_new(struct nouveau_object *parent, uint64_t handle,
> -                       uint32_t oclass, void *data, uint32_t length,
> -                       struct nouveau_object **);
> -void nouveau_object_del(struct nouveau_object **);
> -int  nouveau_object_mthd(struct nouveau_object *, uint32_t mthd,
> -                        void *data, uint32_t size);
> -int  nouveau_object_sclass_get(struct nouveau_object *,
> -                              struct nouveau_sclass **);
> -void nouveau_object_sclass_put(struct nouveau_sclass **);
> -int  nouveau_object_mclass(struct nouveau_object *,
> -                          const struct nouveau_mclass *);
> -
>  struct nouveau_device {
>         struct nouveau_object object;
> -       int fd;
> -       uint32_t lib_version;
> -       uint32_t drm_version;
> +       int fd;                 /* deprecated */
> +       uint32_t lib_version;   /* deprecated */
> +       uint32_t drm_version;   /* deprecated */
>         uint32_t chipset;
>         uint64_t vram_size;
>         uint64_t gart_size;
> @@ -122,20 +71,23 @@ struct nouveau_device {
>         uint64_t gart_limit;
>  };
>
> -int  nouveau_device_new(struct nouveau_object *parent, int32_t oclass,
> -                       void *data, uint32_t size, struct nouveau_device **);
> -int  nouveau_device_wrap(int fd, int close, struct nouveau_device **);
> -int  nouveau_device_open(const char *busid, struct nouveau_device **);
> +int nouveau_device_new(struct nouveau_object *parent, int32_t oclass,
> +                      void *data, uint32_t size, struct nouveau_device **);
>  void nouveau_device_del(struct nouveau_device **);
> -int  nouveau_getparam(struct nouveau_device *, uint64_t param, uint64_t *value);
> -int  nouveau_setparam(struct nouveau_device *, uint64_t param, uint64_t value);
> +
> +int nouveau_getparam(struct nouveau_device *, uint64_t param, uint64_t *value);
> +int nouveau_setparam(struct nouveau_device *, uint64_t param, uint64_t value);
> +
> +/* deprecated */
> +int nouveau_device_wrap(int fd, int close, struct nouveau_device **);
> +int nouveau_device_open(const char *busid, struct nouveau_device **);
While here, the tag will definitely work. Then again... we can even
nuke the deprecated symbols with relative ease*. Just rename the
library, .pc file and libdrm_nouveauincludedir folder to (something
like) libdrm_nouveau-2 and point mesa/others to use the new library.

It will spare us the issues we had with bumping the SONAME (have to
love that we allow unresolved symbols in the ddx) and one can mix the
new and old libdrm_nouveau each with its respective user.

Just thinking out loud :-)

-Emil


More information about the Nouveau mailing list