nouveau: move more abi16-specific logic into abi16.c
PATCH 1/13 nouveau: move more abi16-specific logic into abi16.c
From: Ben Skeggs <[email protected]>
--- nouveau/abi16.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++----- nouveau/nouveau.c | 56 +++++++------------------------------------------ nouveau/private.h | 7 ++----- 3 files changed, 67 insertions(+), 58 deletions(-)
nouveau/abi16.c +57 -5
@@ -33,7 +33,7 @@#include "private.h" -drm_private int +static int abi16_chan_nv04 (struct nouveau_object *obj) {struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -57,7 +57,7 @@ abi16_chan_nv04(struct nouveau_object *obj)return 0 ; } -drm_private int +static int abi16_chan_nvc0 (struct nouveau_object *obj) {struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -78,7 +78,7 @@ abi16_chan_nvc0(struct nouveau_object *obj)return 0 ; } -drm_private int +static int abi16_chan_nve0 (struct nouveau_object *obj) {struct nouveau_device *dev = (struct nouveau_device *)obj->parent;
@@ -104,7 +104,7 @@ abi16_chan_nve0(struct nouveau_object *obj)return 0 ; } -drm_private int +static int abi16_engobj (struct nouveau_object *obj) {struct drm_nouveau_grobj_alloc req = {
@@ -125,7 +125,7 @@ abi16_engobj(struct nouveau_object *obj)return 0 ; } -drm_private int +static int abi16_ntfy (struct nouveau_object *obj) {struct nv04_notify *ntfy = obj->data;
@@ -149,6 +149,58 @@ abi16_ntfy(struct nouveau_object *obj) } drm_private void +abi16_delete (struct nouveau_object *obj) +{ +struct nouveau_device *dev = +nouveau_object_find (obj,NOUVEAU_DEVICE_CLASS ); +if (obj->oclass ==NOUVEAU_FIFO_CHANNEL_CLASS ) { +struct drm_nouveau_channel_free req; + req.channel = obj->handle; +drmCommandWrite (dev->fd,DRM_NOUVEAU_CHANNEL_FREE , + &req,sizeof (req)); + }else { +struct drm_nouveau_gpuobj_free req; + req.channel = obj->parent->handle; + req.handle = obj->handle; +drmCommandWrite (dev->fd,DRM_NOUVEAU_GPUOBJ_FREE , + &req,sizeof (req)); + } +} + +drm_private bool +abi16_object (struct nouveau_object *obj,int (**func)(struct nouveau_object *)) +{ +struct nouveau_object *parent = obj->parent; + +if ((parent->length !=0 && parent->oclass ==NOUVEAU_DEVICE_CLASS )) { +if (obj->oclass ==NOUVEAU_FIFO_CHANNEL_CLASS ) { +struct nouveau_device *dev = (void *)parent; +if (dev->chipset <0xc0 ) + *func = abi16_chan_nv04; +else +if (dev->chipset <0xe0 ) + *func = abi16_chan_nvc0; +else + *func = abi16_chan_nve0; +return true; + } + }else +if ((parent->length !=0 && + parent->oclass ==NOUVEAU_FIFO_CHANNEL_CLASS )) { +if (obj->oclass ==NOUVEAU_NOTIFIER_CLASS ) { + *func = abi16_ntfy; +return true; + } + + *func = abi16_engobj; +return false; + } + + *func =NULL ; +return false; +} + +drm_private voidabi16_bo_info (struct nouveau_bo *bo,struct drm_nouveau_gem_info *info) {struct nouveau_bo_priv *nvbo =nouveau_bo (bo);
nouveau/nouveau.c +8 -48
83 lines not on this page · raw message
nouveau/private.h +2 -5
@@ -114,11 +114,8 @@ int nouveau_device_open_existing(struct nouveau_device **, int, int, drm_context_t);/* abi16.c */ -drm_private int abi16_chan_nv04(struct nouveau_object *); -drm_private int abi16_chan_nvc0(struct nouveau_object *); -drm_private int abi16_chan_nve0(struct nouveau_object *); -drm_private int abi16_engobj(struct nouveau_object *); -drm_private int abi16_ntfy(struct nouveau_object *); +drm_private bool abi16_object(struct nouveau_object *, int (**)(struct nouveau_object *)); +drm_private void abi16_delete(struct nouveau_object *); drm_private void abi16_bo_info(struct nouveau_bo *, struct drm_nouveau_gem_info *); drm_private int abi16_bo_init(struct nouveau_bo *, uint32_t alignment,union nouveau_bo_config *);
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1448522050-4873-1-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/13 nouveau: move object functions up, to avoid future foward decls
From: Ben Skeggs <[email protected]>
--- nouveau/nouveau.c | 112 +++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 56 deletions(-)
nouveau/nouveau.c +56 -56
@@ -59,6 +59,62 @@ debug_init(char *args) }#endif +int +nouveau_object_new (struct nouveau_object *parent,uint64_t handle, +uint32_t oclass,void *data,uint32_t length, +struct nouveau_object **pobj) +{ +struct nouveau_object *obj; +int (*func)(struct nouveau_object *); +int ret = -EINVAL ; + +if (length ==0 ) + length =sizeof (struct nouveau_object *); + obj =malloc (sizeof (*obj) + length); + obj->parent = parent; + obj->handle = handle; + obj->oclass = oclass; + obj->length = length; + obj->data = obj +1 ; +if (data) +memcpy (obj->data, data, length); + *(struct nouveau_object **)obj->data = obj; + +abi16_object (obj, &func); +if (func) + ret =func (obj); + +if (ret) { +free (obj); +return ret; + } + + *pobj = obj; +return 0 ; +} + +void +nouveau_object_del (struct nouveau_object **pobj) +{ +struct nouveau_object *obj = *pobj; +if (obj) { +abi16_delete (obj); +free (obj); + *pobj =NULL ; + } +} + +void * +nouveau_object_find (struct nouveau_object *obj,uint32_t pclass) +{ +while (obj && obj->oclass != pclass) { + obj = obj->parent; +if (pclass ==NOUVEAU_PARENT_CLASS ) +break ; + } +return obj; +} +/* this is the old libdrm's version of nouveau_device_wrap(), the symbol * is kept here to prevent AIGLX from crashing if the DDX is linked against * the new libdrm, but the DRI driver against the old
@@ -247,62 +303,6 @@ nouveau_client_del(struct nouveau_client **pclient) } } -int -nouveau_object_new (struct nouveau_object *parent,uint64_t handle, -uint32_t oclass,void *data,uint32_t length, -struct nouveau_object **pobj) -{ -struct nouveau_object *obj; -int (*func)(struct nouveau_object *); -int ret = -EINVAL ; - -if (length ==0 ) - length =sizeof (struct nouveau_object *); - obj =malloc (sizeof (*obj) + length); - obj->parent = parent; - obj->handle = handle; - obj->oclass = oclass; - obj->length = length; - obj->data = obj +1 ; -if (data) -memcpy (obj->data, data, length); - *(struct nouveau_object **)obj->data = obj; - -abi16_object (obj, &func); -if (func) - ret =func (obj); - -if (ret) { -free (obj); -return ret; - } - - *pobj = obj; -return 0 ; -} - -void -nouveau_object_del (struct nouveau_object **pobj) -{ -struct nouveau_object *obj = *pobj; -if (obj) { -abi16_delete (obj); -free (obj); - *pobj =NULL ; - } -} - -void * -nouveau_object_find (struct nouveau_object *obj,uint32_t pclass) -{ -while (obj && obj->oclass != pclass) { - obj = obj->parent; -if (pclass ==NOUVEAU_PARENT_CLASS ) -break ; - } -return obj; -} -static void nouveau_bo_del (struct nouveau_bo *bo) {
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 3/13 nouveau: make it possible to init object in pre-allocated memory
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
Required for an upcoming patch, not exposed to library clients.
--- nouveau/nouveau.c | 64 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 16 deletions(-)
nouveau/nouveau.c +48 -16
@@ -59,31 +59,63 @@ debug_init(char *args) }#endif -int -nouveau_object_new (struct nouveau_object *parent,uint64_t handle, -uint32_t oclass,void *data,uint32_t length, -struct nouveau_object **pobj) +static void +nouveau_object_fini (struct nouveau_object *obj) +{ +if (obj->data) { +abi16_delete (obj); +free (obj->data); + obj->data =NULL ; +return ; + } +} + +static int +nouveau_object_init (struct nouveau_object *parent,uint32_t handle, +int32_t oclass,void *data,uint32_t size, +struct nouveau_object *obj) { -struct nouveau_object *obj;int (*func)(struct nouveau_object *); -int ret = -EINVAL ; +int ret = -ENOSYS ; -if (length ==0 ) - length =sizeof (struct nouveau_object *); - obj =malloc (sizeof (*obj) + length); obj->parent = parent; obj->handle = handle; obj->oclass = oclass; - obj->length = length; - obj->data = obj +1 ; -if (data) -memcpy (obj->data, data, length); - *(struct nouveau_object **)obj->data = obj; + obj->length =0 ; + obj->data =NULL ;abi16_object (obj, &func); -if (func) +if (func) { + obj->length = size ? size :sizeof (struct nouveau_object *); +if (!(obj->data =malloc (obj->length))) +return -ENOMEM ; +if (data) +memcpy (obj->data, data, obj->length); + *(struct nouveau_object **)obj->data = obj; + ret =func (obj); + } + +if (ret) { +nouveau_object_fini (obj); +return ret; + } + +return 0 ; +} + +int +nouveau_object_new (struct nouveau_object *parent,uint64_t handle, +uint32_t oclass,void *data,uint32_t length, +struct nouveau_object **pobj) +{ +struct nouveau_object *obj; +int ret; + +if (!(obj =malloc (sizeof (*obj)))) +return -ENOMEM ; + ret =nouveau_object_init (parent, handle, oclass, data, length, obj);if (ret) {free (obj);return ret;
@@ -98,7 +130,7 @@ nouveau_object_del(struct nouveau_object **pobj) {struct nouveau_object *obj = *pobj;if (obj) { -abi16_delete (obj); +nouveau_object_fini (obj);free (obj); *pobj =NULL ; }
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 4/13 nouveau: add interface to call an object's methods
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
This will expose functionality supported by newer kernel interfaces, giving access to things such as ZBC controls, perfmon, etc.
--- nouveau/nouveau-symbol-check | 1 + nouveau/nouveau.c | 7 +++++++ nouveau/nouveau.h | 2 ++ 3 files changed, 10 insertions(+)
nouveau/nouveau-symbol-check +1 -0
@@ -33,6 +33,7 @@ nouveau_device_wrap nouveau_getparam nouveau_object_del nouveau_object_find +nouveau_object_mthd nouveau_object_new nouveau_pushbuf_bufctx nouveau_pushbuf_data
nouveau/nouveau.c +7 -0
@@ -59,6 +59,13 @@ debug_init(char *args) }#endif +int +nouveau_object_mthd (struct nouveau_object *obj, +uint32_t mthd,void *data,uint32_t size) +{ +return -ENODEV ; +} +static void nouveau_object_fini (struct nouveau_object *obj) {
nouveau/nouveau.h +2 -0
@@ -67,6 +67,8 @@ 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);void *nouveau_object_find (struct nouveau_object *,uint32_t parent_class);struct nouveau_device {
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 5/13 nouveau: add interfaces to query information about supported classes
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
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.
--- 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(+)
nouveau/abi16.c +28 -0
@@ -29,6 +29,7 @@#include <stdlib.h> #include <stdint.h> #include <stddef.h> +#include <errno.h> #include "private.h"
@@ -148,6 +149,33 @@ abi16_ntfy(struct nouveau_object *obj)return 0 ; } +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)))) +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 }; + } +break ; +default : +break ; + } + +return sclass - *psclass; +} + drm_private voidabi16_delete (struct nouveau_object *obj) {
nouveau/nouveau-symbol-check +3 -0
@@ -33,8 +33,11 @@ nouveau_device_wrap nouveau_getparam nouveau_object_del nouveau_object_find +nouveau_object_mclass nouveau_object_mthd nouveau_object_new +nouveau_object_sclass_get +nouveau_object_sclass_put nouveau_pushbuf_bufctx nouveau_pushbuf_data nouveau_pushbuf_del
nouveau/nouveau.c +41 -0
47 lines not on this page · raw message
nouveau/nouveau.h +17 -0
@@ -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; +}; +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 *);void *nouveau_object_find (struct nouveau_object *,uint32_t parent_class);struct nouveau_device {
nouveau/private.h +1 -0
@@ -116,6 +116,7 @@ nouveau_device_open_existing(struct nouveau_device **, int, int, drm_context_t);/* abi16.c */ drm_private bool abi16_object(struct nouveau_object *, int (**)(struct nouveau_object *)); drm_private void abi16_delete(struct nouveau_object *); +drm_private int abi16_sclass(struct nouveau_object *, struct nouveau_sclass **); drm_private void abi16_bo_info(struct nouveau_bo *, struct drm_nouveau_gem_info *); drm_private int abi16_bo_init(struct nouveau_bo *, uint32_t alignment,union nouveau_bo_config *);
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1448522050-4873-5-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [libdrm 05/13] nouveau: add interfaces to query information about supported classes
Quoted 30 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
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 <[email protected]>--- 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(+)nouveau/abi16.c +0
-0
nouveau/abi16.c abi16_ntfy(struct nouveau_object *obj) · line 158
Quoted 8 lines
nouveau/abi16.c +7
-0+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 ?
nouveau/abi16.c abi16_ntfy(struct nouveau_object *obj) · line 169
Quoted 11 lines
nouveau/abi16.c +11
-0+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 ?
Quoted 8 lines
nouveau/nouveau.h +2
-0@@ -63,12 +63,29 @@ struct nv04_notify {uint32_t length; }; +struct nouveau_sclass { +int32_t oclass;
nouveau/nouveau.h struct nv04_notify { · line 77
Quoted 10 lines
nouveau/nouveau.h +10
-0+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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 6/13 nouveau: introduce object to represent the kernel client
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
Because NVIF intentionally lacks some of the paths necessary to be compatible with various mistakes we've made over the years, libdrm needs to know whether a client has been updated and that it's safe to make use of the new kernel interfaces.
Clients still using nouveau_device_open()/wrap() will be forced to make use of ABI16 instead of NVIF.
--- nouveau/nouveau-symbol-check | 2 ++ nouveau/nouveau.c | 35 +++++++++++++++++++++++++++++++++++ nouveau/nouveau.h | 19 +++++++++++++++++++ 3 files changed, 56 insertions(+)
nouveau/nouveau-symbol-check +2 -0
@@ -30,6 +30,8 @@ nouveau_device_del nouveau_device_open nouveau_device_open_existing nouveau_device_wrap +nouveau_drm_del +nouveau_drm_new nouveau_getparam nouveau_object_del nouveau_object_find
nouveau/nouveau.c +35 -0
@@ -195,6 +195,41 @@ nouveau_object_find(struct nouveau_object *obj, uint32_t pclass)return obj; } +void +nouveau_drm_del (struct nouveau_drm **pdrm) +{ +free (*pdrm); + *pdrm =NULL ; +} + +int +nouveau_drm_new (int fd,struct nouveau_drm **pdrm) +{ +struct nouveau_drm *drm; +drmVersionPtr ver; + +#ifdef DEBUG +debug_init (getenv ("NOUVEAU_LIBDRM_DEBUG" )); +#endif + +if (!(drm = *pdrm =calloc (1 ,sizeof (*drm)))) +return -ENOMEM ; + drm->fd = fd; + +if (!(ver =drmGetVersion (fd))) { +nouveau_drm_del (pdrm); +return -EINVAL ; + } + + drm->drm_version = (ver->version_major <<24 ) | + (ver->version_minor <<8 ) | + ver->version_patchlevel; + drm->lib_version =0x01000300 ; + drm->nvif = false; +drmFreeVersion (ver); +return 0 ; +} +/* this is the old libdrm's version of nouveau_device_wrap(), the symbol * is kept here to prevent AIGLX from crashing if the DDX is linked against * the new libdrm, but the DRI driver against the old
nouveau/nouveau.h +19 -0
@@ -22,6 +22,25 @@ struct nouveau_object {void *data; }; +struct nouveau_drm { +struct nouveau_object client; +int fd; +uint32_t drm_version; +uint32_t lib_version; +bool nvif; +}; + +static inline struct nouveau_drm * +nouveau_drm (struct nouveau_object *obj) +{ +while (obj && obj->parent) + obj = obj->parent; +return (struct nouveau_drm *)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;
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1448522050-4873-6-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [libdrm 06/13] nouveau: introduce object to represent the kernel client
Quoted 4 lines · Ben Skeggs
nouveau/nouveau.c +1
-0+int
nouveau/nouveau.c nouveau_object_find(struct nouveau_object *obj, uint32_t pclass) · line 215
Quoted 10 lines
nouveau/nouveau.c +10
-0+nouveau_drm_new(int fd, struct nouveau_drm **pdrm) +{ + struct nouveau_drm *drm; +drmVersionPtr ver; + +#ifdef DEBUG +debug_init (getenv ("NOUVEAU_LIBDRM_DEBUG" )); +#endif + +if (!(drm = *pdrm =calloc (1 ,sizeof (*drm))))
Similar to previous patch - set *pdrm at a later stage.
nouveau/nouveau.c nouveau_object_find(struct nouveau_object *obj, uint32_t pclass) · line 227
Quoted 12 lines
nouveau/nouveau.c +12
-0+return -ENOMEM ; + drm->fd = fd; + +if (!(ver =drmGetVersion (fd))) { +nouveau_drm_del (pdrm); +return -EINVAL ; + } + + drm->drm_version = (ver->version_major <<24 ) | + (ver->version_minor <<8 ) | + ver->version_patchlevel; + drm->lib_version =0x01000300 ;
Do we need this - neither mesa nor xf86-video-nouveau use it.
-Emil
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 7/13 nouveau: stack legacy nouveau_device on top of nouveau_drm
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- nouveau/nouveau.c | 46 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 25 deletions(-)
nouveau/nouveau.c +21 -25
@@ -244,39 +244,36 @@ nouveau_device_open_existing(struct nouveau_device **pdev, int close, int fd,int nouveau_device_wrap (int fd,int close,struct nouveau_device **pdev) { -struct nouveau_device_priv *nvdev =calloc (1 ,sizeof (*nvdev)); -struct nouveau_device *dev = &nvdev->base; +struct nouveau_drm *drm; +struct nouveau_device_priv *nvdev; +struct nouveau_device *dev;uint64_t chipset, vram, gart, bousage; -drmVersionPtr ver;int ret;char *tmp; -#ifdef DEBUG -debug_init (getenv ("NOUVEAU_LIBDRM_DEBUG" )); -#endif - -if (!nvdev) +if (!(nvdev =calloc (1 ,sizeof (*nvdev))))return -ENOMEM ; + dev = &nvdev->base; + ret =pthread_mutex_init (&nvdev->lock,NULL );if (ret) {free (nvdev);return ret; } - nvdev->base.fd = fd; - - ver =drmGetVersion (fd); -if (ver) dev->drm_version = (ver->version_major <<24 ) | - (ver->version_minor <<8 ) | - ver->version_patchlevel; -drmFreeVersion (ver); - -if ( dev->drm_version !=0x00000010 && - (dev->drm_version <0x01000000 || - dev->drm_version >=0x02000000 )) { + ret =nouveau_drm_new (fd, &drm); +if (ret) {nouveau_device_del (&dev); -return -EINVAL ; +return ret; } + drm->nvif = false; + + nvdev->base.object.parent = &drm->client; + nvdev->base.object.oclass =NOUVEAU_DEVICE_CLASS ; + nvdev->base.object.length = ~0 ; + nvdev->base.fd = drm->fd; + nvdev->base.drm_version = drm->drm_version; + nvdev->base.lib_version = drm->lib_version; ret =nouveau_getparam (dev,NOUVEAU_GETPARAM_CHIPSET_ID , &chipset);if (ret ==0 )
@@ -305,9 +302,6 @@ nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev)else nvdev->gart_limit_percent =80 ;DRMINITLISTHEAD (&nvdev->bo_list); - nvdev->base.object.oclass =NOUVEAU_DEVICE_CLASS ; - nvdev->base.object.length = ~0 ; - nvdev->base.lib_version =0x01000000 ; nvdev->base.chipset = chipset; nvdev->base.vram_size = vram; nvdev->base.gart_size = gart;
@@ -337,10 +331,12 @@ nouveau_device_del(struct nouveau_device **pdev) {struct nouveau_device_priv *nvdev =nouveau_device (*pdev);if (nvdev) { -if (nvdev->close) -drmClose (nvdev->base.fd); +struct nouveau_drm *drm =nouveau_drm (&nvdev->base.object);free (nvdev->client); +nouveau_drm_del (&drm);pthread_mutex_destroy (&nvdev->lock); +if (nvdev->close) +drmClose (nvdev->base.fd);free (nvdev); *pdev =NULL ; }
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1448522050-4873-7-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [libdrm 07/13] nouveau: stack legacy nouveau_device on top of nouveau_drm
nouveau/nouveau.c nouveau_device_open_existing(struct nouveau_device **pdev, int close, int fd, · line 276
Quoted 4 lines · Ben Skeggs
nouveau/nouveau.c +1
-0+ nvdev->base.lib_version = drm->lib_version;
On top of last patch "do we need lib_version" there has been no ddx and mesa users that I can see. Do we want to carry keep this or we can just drop it ?
-Emil
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 8/13 nouveau: make use of nouveau_drm::fd instead of nouveau_device::fd
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
The latter is deprecated, and will not be valid for newer clients.
--- nouveau/abi16.c | 32 +++++++++++++++----------------- nouveau/nouveau-symbol-check | 1 - nouveau/nouveau.c | 43 +++++++++++++++++++++---------------------- nouveau/nouveau.h | 1 - nouveau/pushbuf.c | 7 ++++--- 5 files changed, 40 insertions(+), 44 deletions(-)
nouveau/abi16.c +15 -17
@@ -37,7 +37,7 @@static int abi16_chan_nv04 (struct nouveau_object *obj) { -struct nouveau_device *dev = (struct nouveau_device *)obj->parent; +struct nouveau_drm *drm =nouveau_drm (obj);struct nv04_fifo *nv04 = obj->data;struct drm_nouveau_channel_alloc req = { .fb_ctxdma_handle = nv04->vram,
@@ -45,7 +45,7 @@ abi16_chan_nv04(struct nouveau_object *obj) };int ret; - ret =drmCommandWriteRead (dev->fd,DRM_NOUVEAU_CHANNEL_ALLOC , + ret =drmCommandWriteRead (drm->fd,DRM_NOUVEAU_CHANNEL_ALLOC , &req,sizeof (req));if (ret)return ret;
@@ -61,12 +61,12 @@ abi16_chan_nv04(struct nouveau_object *obj)static int abi16_chan_nvc0 (struct nouveau_object *obj) { -struct nouveau_device *dev = (struct nouveau_device *)obj->parent; +struct nouveau_drm *drm =nouveau_drm (obj);struct drm_nouveau_channel_alloc req = {};struct nvc0_fifo *nvc0 = obj->data;int ret; - ret =drmCommandWriteRead (dev->fd,DRM_NOUVEAU_CHANNEL_ALLOC , + ret =drmCommandWriteRead (drm->fd,DRM_NOUVEAU_CHANNEL_ALLOC , &req,sizeof (req));if (ret)return ret;
@@ -82,7 +82,7 @@ abi16_chan_nvc0(struct nouveau_object *obj)static int abi16_chan_nve0 (struct nouveau_object *obj) { -struct nouveau_device *dev = (struct nouveau_device *)obj->parent; +struct nouveau_drm *drm =nouveau_drm (obj);struct drm_nouveau_channel_alloc req = {};struct nve0_fifo *nve0 = obj->data;int ret;
@@ -92,7 +92,7 @@ abi16_chan_nve0(struct nouveau_object *obj) req.tt_ctxdma_handle = nve0->engine; } - ret =drmCommandWriteRead (dev->fd,DRM_NOUVEAU_CHANNEL_ALLOC , + ret =drmCommandWriteRead (drm->fd,DRM_NOUVEAU_CHANNEL_ALLOC , &req,sizeof (req));if (ret)return ret;
@@ -108,16 +108,15 @@ abi16_chan_nve0(struct nouveau_object *obj)static int abi16_engobj (struct nouveau_object *obj) { +struct nouveau_drm *drm =nouveau_drm (obj);struct drm_nouveau_grobj_alloc req = { .channel = obj->parent->handle, .handle = obj->handle, .class = obj->oclass, }; -struct nouveau_device *dev;int ret; - dev =nouveau_object_find (obj,NOUVEAU_DEVICE_CLASS ); - ret =drmCommandWrite (dev->fd,DRM_NOUVEAU_GROBJ_ALLOC , + ret =drmCommandWrite (drm->fd,DRM_NOUVEAU_GROBJ_ALLOC , &req,sizeof (req));if (ret)return ret;
@@ -129,17 +128,16 @@ abi16_engobj(struct nouveau_object *obj)static int abi16_ntfy (struct nouveau_object *obj) { +struct nouveau_drm *drm =nouveau_drm (obj);struct nv04_notify *ntfy = obj->data;struct drm_nouveau_notifierobj_alloc req = { .channel = obj->parent->handle, .handle = ntfy->object->handle, .size = ntfy->length, }; -struct nouveau_device *dev;int ret; - dev =nouveau_object_find (obj,NOUVEAU_DEVICE_CLASS ); - ret =drmCommandWriteRead (dev->fd,DRM_NOUVEAU_NOTIFIEROBJ_ALLOC , + ret =drmCommandWriteRead (drm->fd,DRM_NOUVEAU_NOTIFIEROBJ_ALLOC , &req,sizeof (req));if (ret)return ret;
@@ -179,18 +177,17 @@ abi16_sclass(struct nouveau_object *obj, struct nouveau_sclass **psclass) drm_private voidabi16_delete (struct nouveau_object *obj) { -struct nouveau_device *dev = -nouveau_object_find (obj,NOUVEAU_DEVICE_CLASS ); +struct nouveau_drm *drm =nouveau_drm (obj);if (obj->oclass ==NOUVEAU_FIFO_CHANNEL_CLASS ) {struct drm_nouveau_channel_free req; req.channel = obj->handle; -drmCommandWrite (dev->fd,DRM_NOUVEAU_CHANNEL_FREE , +drmCommandWrite (drm->fd,DRM_NOUVEAU_CHANNEL_FREE , &req,sizeof (req)); }else {struct drm_nouveau_gpuobj_free req; req.channel = obj->parent->handle; req.handle = obj->handle; -drmCommandWrite (dev->fd,DRM_NOUVEAU_GPUOBJ_FREE , +drmCommandWrite (drm->fd,DRM_NOUVEAU_GPUOBJ_FREE , &req,sizeof (req)); } }
@@ -267,6 +264,7 @@ abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment, union nouveau_bo_config *config) {struct nouveau_device *dev = bo->device; +struct nouveau_drm *drm =nouveau_drm (&dev->object);struct drm_nouveau_gem_new req = {};struct drm_nouveau_gem_info *info = &req.info;int ret;
@@ -309,7 +307,7 @@ abi16_bo_init(struct nouveau_bo *bo, uint32_t alignment,if (!nouveau_device (dev)->have_bo_usage) info->tile_flags &=0x0000ff00 ; - ret =drmCommandWriteRead (dev->fd,DRM_NOUVEAU_GEM_NEW , + ret =drmCommandWriteRead (drm->fd,DRM_NOUVEAU_GEM_NEW , &req,sizeof (req));if (ret ==0 )abi16_bo_info (bo, &req.info);
nouveau/nouveau-symbol-check +0 -1
@@ -34,7 +34,6 @@ nouveau_drm_del nouveau_drm_new nouveau_getparam nouveau_object_del -nouveau_object_find nouveau_object_mclass nouveau_object_mthd nouveau_object_new
nouveau/nouveau.c +21 -22
154 lines not on this page · raw message
nouveau/nouveau.h +0 -1
@@ -105,7 +105,6 @@ int nouveau_object_sclass_get(struct nouveau_object *,void nouveau_object_sclass_put (struct nouveau_sclass **);int nouveau_object_mclass (struct nouveau_object *,const struct nouveau_mclass *); -void *nouveau_object_find (struct nouveau_object *,uint32_t parent_class);struct nouveau_device {struct nouveau_object object;
nouveau/pushbuf.c +4 -3
@@ -312,6 +312,7 @@ pushbuf_submit(struct nouveau_pushbuf *push, struct nouveau_object *chan)struct nouveau_pushbuf_priv *nvpb =nouveau_pushbuf (push);struct nouveau_pushbuf_krec *krec = nvpb->list;struct nouveau_device *dev = push->client->device; +struct nouveau_drm *drm =nouveau_drm (&dev->object);struct drm_nouveau_gem_pushbuf_bo_presumed *info;struct drm_nouveau_gem_pushbuf_bo *kref;struct drm_nouveau_gem_pushbuf req;
@@ -345,7 +346,7 @@ pushbuf_submit(struct nouveau_pushbuf *push, struct nouveau_object *chan)pushbuf_dump (krec, krec_id++, fifo->channel);#ifndef SIMULATE - ret =drmCommandWriteRead (dev->fd,DRM_NOUVEAU_GEM_PUSHBUF , + ret =drmCommandWriteRead (drm->fd,DRM_NOUVEAU_GEM_PUSHBUF , &req,sizeof (req)); nvpb->suffix0 = req.suffix0; nvpb->suffix1 = req.suffix1;
@@ -536,7 +537,7 @@ nouveau_pushbuf_new(struct nouveau_client *client, struct nouveau_object *chan, int nr, uint32_t size, bool immediate, struct nouveau_pushbuf **ppush) { - struct nouveau_device *dev = client->device; + struct nouveau_drm *drm = nouveau_drm(&client->device->object);struct nouveau_fifo *fifo = chan->data;struct nouveau_pushbuf_priv *nvpb;struct nouveau_pushbuf *push;
@@ -551,7 +552,7 @@ nouveau_pushbuf_new(struct nouveau_client *client, struct nouveau_object *chan,*/ req.channel = fifo->channel; req.nr_push =0 ; - ret =drmCommandWriteRead (dev->fd,DRM_NOUVEAU_GEM_PUSHBUF , + ret =drmCommandWriteRead (drm->fd,DRM_NOUVEAU_GEM_PUSHBUF , &req,sizeof (req));if (ret)return ret;
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1448522050-4873-8-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [libdrm 08/13] nouveau: make use of nouveau_drm::fd instead of nouveau_device::fd
Quoted 4 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
The latter is deprecated, and will not be valid for newer clients.
Mention (or split) the removal of nouveau_object_find ? Afaics it has never been used in mesa + ddx.
-Emil
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 9/13 nouveau: import and install a selection of nvif headers from the kernel
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- include/drm/nouveau_drm.h | 1 + nouveau/Makefile.am | 11 +++- nouveau/libdrm_nouveau.pc.in | 2 +- nouveau/nvif/cl0080.h | 45 ++++++++++++++ nouveau/nvif/cl9097.h | 44 ++++++++++++++ nouveau/nvif/class.h | 141 +++++++++++++++++++++++++++++++++++++++++++ nouveau/nvif/if0002.h | 38 ++++++++++++ nouveau/nvif/if0003.h | 33 ++++++++++ nouveau/nvif/ioctl.h | 132 ++++++++++++++++++++++++++++++++++++++++ nouveau/nvif/unpack.h | 28 +++++++++ 10 files changed, 473 insertions(+), 2 deletions(-) create mode 100644 nouveau/nvif/cl0080.h create mode 100644 nouveau/nvif/cl9097.h create mode 100644 nouveau/nvif/class.h create mode 100644 nouveau/nvif/if0002.h create mode 100644 nouveau/nvif/if0003.h create mode 100644 nouveau/nvif/ioctl.h create mode 100644 nouveau/nvif/unpack.h
include/drm/nouveau_drm.h +1 -0
@@ -200,6 +200,7 @@ struct drm_nouveau_sarea {#define DRM_NOUVEAU_GROBJ_ALLOC 0x04#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05#define DRM_NOUVEAU_GPUOBJ_FREE 0x06 +#define DRM_NOUVEAU_NVIF 0x07#define DRM_NOUVEAU_GEM_NEW 0x40#define DRM_NOUVEAU_GEM_PUSHBUF 0x41#define DRM_NOUVEAU_GEM_CPU_PREP 0x42
nouveau/Makefile.am +10 -1
@@ -14,9 +14,18 @@ libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES) -libdrm_nouveauincludedir = ${includedir}/libdrm +libdrm_nouveauincludedir = ${includedir}/libdrm/nouveau libdrm_nouveauinclude_HEADERS = $(LIBDRM_NOUVEAU_H_FILES) +libdrm_nouveaunvifincludedir = ${includedir}/libdrm/nouveau/nvif +libdrm_nouveaunvifinclude_HEADERS = nvif/class.h \ + nvif/cl0080.h \ + nvif/cl9097.h \ + nvif/if0002.h \ + nvif/if0003.h \ + nvif/ioctl.h \ + nvif/unpack.h + pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = libdrm_nouveau.pc
nouveau/libdrm_nouveau.pc.in +1 -1
@@ -7,5 +7,5 @@ Name: libdrm_nouveau Description: Userspace interface to nouveau kernel DRM services Version: @PACKAGE_VERSION@ Libs: -L${libdir} -ldrm_nouveau -Cflags: -I${includedir} -I${includedir}/libdrm +Cflags: -I${includedir} -I${includedir}/libdrm -I${includedir}/libdrm/nouveau Requires.private: libdrm
nouveau/nvif/cl0080.h new file +45 -0
45 lines not on this page · raw message
nouveau/nvif/cl9097.h new file +44 -0
44 lines not on this page · raw message
nouveau/nvif/class.h new file +141 -0
141 lines not on this page · raw message
nouveau/nvif/if0002.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef __NVIF_IF0002_H__ +#define __NVIF_IF0002_H__ + +#define NVIF_PERFMON_V0_QUERY_DOMAIN 0x00 +#define NVIF_PERFMON_V0_QUERY_SIGNAL 0x01 +#define NVIF_PERFMON_V0_QUERY_SOURCE 0x02 + +struct nvif_perfmon_query_domain_v0 { +__u8 version; +__u8 id; +__u8 counter_nr; +__u8 iter; +__u16 signal_nr; +__u8 pad05[2 ]; +char name[64 ]; +}; + +struct nvif_perfmon_query_signal_v0 { +__u8 version; +__u8 domain; +__u16 iter; +__u8 signal; +__u8 source_nr; +__u8 pad05[2 ]; +char name[64 ]; +}; + +struct nvif_perfmon_query_source_v0 { +__u8 version; +__u8 domain; +__u8 signal; +__u8 iter; +__u8 pad04[4 ]; +__u32 source; +__u32 mask; +char name[64 ]; +}; +#endif
nouveau/nvif/if0003.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef __NVIF_IF0003_H__ +#define __NVIF_IF0003_H__ + +struct nvif_perfdom_v0 { +__u8 version; +__u8 domain; +__u8 mode; +__u8 pad03[1 ]; +struct { +__u8 signal[4 ]; +__u64 source[4 ][8 ]; +__u16 logic_op; + } ctr[4 ]; +}; + +#define NVIF_PERFDOM_V0_INIT 0x00 +#define NVIF_PERFDOM_V0_SAMPLE 0x01 +#define NVIF_PERFDOM_V0_READ 0x02 + +struct nvif_perfdom_init { +}; + +struct nvif_perfdom_sample { +}; + +struct nvif_perfdom_read_v0 { +__u8 version; +__u8 pad01[7 ]; +__u32 ctr[4 ]; +__u32 clk; +__u8 pad04[4 ]; +}; +#endif
nouveau/nvif/ioctl.h new file +132 -0
132 lines not on this page · raw message
nouveau/nvif/unpack.h new file +28 -0
@@ -0,0 +1,28 @@ +#ifndef __NVIF_UNPACK_H__ +#define __NVIF_UNPACK_H__ + +#define nvif_unvers (r,d,s,m) ({ \ + void **_data = (d); __u32 *_size = (s); int _ret = (r); \ + if (_ret == -ENOSYS && *_size == sizeof(m)) { \ + *_data = NULL; \ + *_size = _ret = 0; \ + } \ + _ret; \ +}) + +#define nvif_unpack (r,d,s,m,vl,vh,x) ({ \ + void **_data = (d); __u32 *_size = (s); \ + int _ret = (r), _vl = (vl), _vh = (vh); \ + if (_ret == -ENOSYS && *_size >= sizeof(m) && \ + (m).version >= _vl && (m).version <= _vh) { \ + *_data = (__u8 *)*_data + sizeof(m); \ + *_size = *_size - sizeof(m); \ + if (_ret = 0, !(x)) { \ + _ret = *_size ? -E2BIG : 0; \ + *_data = NULL; \ + *_size = 0; \ + } \ + } \ + _ret; \ +}) +#endif
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1448522050-4873-9-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [libdrm 09/13] nouveau: import and install a selection of nvif headers from the kernel
nouveau/Makefile.am libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ · line 17
Quoted 10 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
nouveau/Makefile.am +1
-1@@ -14,9 +14,18 @@ libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES) -libdrm_nouveauincludedir = ${includedir}/libdrm +libdrm_nouveauincludedir = ${includedir}/libdrm/nouveau
Can we mention the change in the commit message, please ?
This will be a nice test for places missing LIBDRM_NOUVEAU_CFLAGS :-) I take it that neither mesa nor ddx explode with this change ?
-Emil
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): CACvgo53xNBm-HHMX2GvWh3EVr7v5SEzbJnGsQkEk2khEf1SYOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [libdrm 09/13] nouveau: import and install a selection of nvif headers from the kernel
Quoted 7 lines · Emil Velikov
Quoted 6 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
nouveau/Makefile.am +0
-0@@ -14,9 +14,18 @@ libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
Quoted 8 lines
nouveau/Makefile.am libdrm_nouveau_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@ · line 17
Quoted 4 lines
nouveau/Makefile.am +1
-1libdrm_nouveau_la_SOURCES = $(LIBDRM_NOUVEAU_FILES) -libdrm_nouveauincludedir = ${includedir}/libdrm +libdrm_nouveauincludedir = ${includedir}/libdrm/nouveauCan we mention the change in the commit message, please ?
This will be a nice test for places missing
LIBDRM_NOUVEAU_CFLAGS:-) I take it that neither mesa nor ddx explode with this change ?
Nope, they take it just fine. I tested all sorts of combinations of kernel (supports nvif vs not), libdrm (patched/unpatched), ddx (making sure it builds), and mesa (patched/unpatched) to make sure that nothing regressed.
Ben.
Quoted 3 lines
-Emil
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 10/13 nouveau: add new interface to create a nouveau_device
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- nouveau/nouveau-symbol-check | 1 + nouveau/nouveau.c | 133 ++++++++++++++++++++++++++++--------------- nouveau/nouveau.h | 2 + 3 files changed, 89 insertions(+), 47 deletions(-)
nouveau/nouveau-symbol-check +1 -0
@@ -27,6 +27,7 @@ nouveau_bufctx_reset nouveau_client_del nouveau_client_new nouveau_device_del +nouveau_device_new nouveau_device_open nouveau_device_open_existing nouveau_device_wrap
nouveau/nouveau.c +86 -47
179 lines not on this page · raw message
nouveau/nouveau.h +2 -0
@@ -118,6 +118,8 @@ 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 **);void nouveau_device_del (struct nouveau_device **);
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 11/13 nouveau: add support for newer kernel interfaces
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- nouveau/abi16.c | 5 +- nouveau/nouveau.c | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 155 insertions(+), 7 deletions(-)
nouveau/abi16.c +3 -2
@@ -32,7 +32,7 @@#include <errno.h> #include "private.h" - +#include "nvif/class.h" static int abi16_chan_nv04 (struct nouveau_object *obj)
@@ -197,7 +197,8 @@ abi16_object(struct nouveau_object *obj, int (**func)(struct nouveau_object *)) {struct nouveau_object *parent = obj->parent; -if ((parent->length !=0 && parent->oclass ==NOUVEAU_DEVICE_CLASS )) { +if ((parent->length !=0 && parent->oclass ==NOUVEAU_DEVICE_CLASS ) || + (parent->length ==0 && parent->oclass ==NV_DEVICE )) {if (obj->oclass ==NOUVEAU_FIFO_CHANNEL_CLASS ) {struct nouveau_device *dev = (void *)parent;if (dev->chipset <0xc0 )
nouveau/nouveau.c +152 -5
224 lines not on this page · raw message
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 12/13 nouveau: clean up nouveau.h, noting deprecated members/functions
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- nouveau/nouveau.h | 220 +++++++++++++++++++++++++++--------------------------- 1 file changed, 110 insertions(+), 110 deletions(-)
nouveau/nouveau.h +110 -110
@@ -1,27 +1,40 @@ #ifndef __NOUVEAU_H__ #define __NOUVEAU_H__ - -#include <stdint.h> #include <stdbool.h> +#include <xf86drm.h> -#define NOUVEAU_DEVICE_CLASS 0x80000000 -#define NOUVEAU_FIFO_CHANNEL_CLASS 0x80000001 -#define NOUVEAU_NOTIFIER_CLASS 0x80000002 -#define NOUVEAU_PARENT_CLASS 0xffffffff +struct nouveau_sclass { + int32_t oclass; + int minver; + int maxver; +}; -struct nouveau_list { - struct nouveau_list *prev; - struct nouveau_list *next; +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 */ }; +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;
@@ -41,76 +54,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; -}; - -struct nouveau_sclass { -int32_t oclass; -int minver; -int maxver; -}; - -struct nouveau_mclass { -int32_t oclass; -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;
@@ -118,20 +66,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 **);struct nouveau_client {struct nouveau_device *device;int id; }; -int nouveau_client_new (struct nouveau_device *,struct nouveau_client **); +int nouveau_client_new (struct nouveau_device *,struct nouveau_client **);void nouveau_client_del (struct nouveau_client **);union nouveau_bo_config {
@@ -178,22 +129,27 @@ struct nouveau_bo {union nouveau_bo_config config; }; -int nouveau_bo_new (struct nouveau_device *,uint32_t flags,uint32_t align, -uint64_t size,union nouveau_bo_config *, +int nouveau_bo_new (struct nouveau_device *,uint32_t flags,uint32_t align, +uint64_t size,union nouveau_bo_config *, +struct nouveau_bo **); +int nouveau_bo_wrap (struct nouveau_device *,uint32_t handle,struct nouveau_bo **); -int nouveau_bo_wrap (struct nouveau_device *,uint32_t handle, -struct nouveau_bo **); -int nouveau_bo_name_ref (struct nouveau_device *dev,uint32_t name, -struct nouveau_bo **); -int nouveau_bo_name_get (struct nouveau_bo *,uint32_t *name); +int nouveau_bo_name_ref (struct nouveau_device *v,uint32_t name, +struct nouveau_bo **); +int nouveau_bo_name_get (struct nouveau_bo *,uint32_t *name);void nouveau_bo_ref (struct nouveau_bo *,struct nouveau_bo **); -int nouveau_bo_map (struct nouveau_bo *,uint32_t access, +int nouveau_bo_map (struct nouveau_bo *,uint32_t access, +struct nouveau_client *); +int nouveau_bo_wait (struct nouveau_bo *,uint32_t access,struct nouveau_client *); -int nouveau_bo_wait (struct nouveau_bo *,uint32_t access, -struct nouveau_client *); -int nouveau_bo_prime_handle_ref (struct nouveau_device *dev,int prime_fd, -struct nouveau_bo **); -int nouveau_bo_set_prime (struct nouveau_bo *bo,int *prime_fd); +int nouveau_bo_prime_handle_ref (struct nouveau_device *,int prime_fd, +struct nouveau_bo **); +int nouveau_bo_set_prime (struct nouveau_bo *,int *prime_fd); + +struct nouveau_list { +struct nouveau_list *prev; +struct nouveau_list *next; +};struct nouveau_bufref {struct nouveau_list thead;
@@ -215,8 +171,8 @@ struct nouveau_bufctx {int relocs; }; -int nouveau_bufctx_new (struct nouveau_client *,int bins, -struct nouveau_bufctx **); +int nouveau_bufctx_new (struct nouveau_client *,int bins, +struct nouveau_bufctx **);void nouveau_bufctx_del (struct nouveau_bufctx **);struct nouveau_bufref * nouveau_bufctx_refn(struct nouveau_bufctx *, int bin,
@@ -245,16 +201,16 @@ struct nouveau_pushbuf_refn {uint32_t flags; }; -int nouveau_pushbuf_new (struct nouveau_client *,struct nouveau_object *channel, -int nr,uint32_t size,bool immediate, -struct nouveau_pushbuf **); +int nouveau_pushbuf_new (struct nouveau_client *,struct nouveau_object *chan, +int nr,uint32_t size,bool immediate, +struct nouveau_pushbuf **);void nouveau_pushbuf_del (struct nouveau_pushbuf **); -int nouveau_pushbuf_space (struct nouveau_pushbuf *,uint32_t dwords, -uint32_t relocs,uint32_t pushes); +int nouveau_pushbuf_space (struct nouveau_pushbuf *,uint32_t dwords, +uint32_t relocs,uint32_t pushes);void nouveau_pushbuf_data (struct nouveau_pushbuf *,struct nouveau_bo *,uint64_t offset,uint64_t length); -int nouveau_pushbuf_refn (struct nouveau_pushbuf *, -struct nouveau_pushbuf_refn *,int nr); +int nouveau_pushbuf_refn (struct nouveau_pushbuf *, +struct nouveau_pushbuf_refn *,int nr);/* Emits a reloc into the push buffer at the current position, you *must* * have previously added the referenced buffer to a buffer context, and * validated it against the current push buffer.
@@ -262,10 +218,54 @@ int nouveau_pushbuf_refn(struct nouveau_pushbuf *,void nouveau_pushbuf_reloc (struct nouveau_pushbuf *,struct nouveau_bo *,uint32_t data,uint32_t flags,uint32_t vor,uint32_t tor); -int nouveau_pushbuf_validate (struct nouveau_pushbuf *); +int nouveau_pushbuf_validate (struct nouveau_pushbuf *);uint32_t nouveau_pushbuf_refd (struct nouveau_pushbuf *,struct nouveau_bo *); -int nouveau_pushbuf_kick (struct nouveau_pushbuf *,struct nouveau_object *channel); +int nouveau_pushbuf_kick (struct nouveau_pushbuf *,struct nouveau_object *chan);struct nouveau_bufctx *nouveau_pushbuf_bufctx (struct nouveau_pushbuf *,struct nouveau_bufctx *); +#define NOUVEAU_DEVICE_CLASS 0x80000000 +#define NOUVEAU_FIFO_CHANNEL_CLASS 0x80000001 +#define NOUVEAU_NOTIFIER_CLASS 0x80000002 + +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; +};#endif
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 13/13 Bump version for release
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
@@ -20,7 +20,7 @@ AC_PREREQ([2.63]) AC_INIT([libdrm], - [2.4.65], + [2.4.66], [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI], [libdrm])
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
Hi Ben,
Quoted 31 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
Signed-off-by Ben Skeggs <[email protected]>--- nouveau/abi16.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++----- nouveau/nouveau.c | 56 +++++++------------------------------------------ nouveau/private.h | 7 ++----- 3 files changed, 67 insertions(+), 58 deletions(-)nouveau/abi16.c +17
-0+drm_private bool +abi16_object (struct nouveau_object *obj,int (**func)(struct nouveau_object *)) +{ +struct nouveau_object *parent = obj->parent; + +if ((parent->length !=0 && parent->oclass ==NOUVEAU_DEVICE_CLASS )) { +if (obj->oclass ==NOUVEAU_FIFO_CHANNEL_CLASS ) { +struct nouveau_device *dev = (void *)parent; +if (dev->chipset <0xc0 ) + *func = abi16_chan_nv04; +else +if (dev->chipset <0xe0 ) + *func = abi16_chan_nvc0; +else + *func = abi16_chan_nve0; +return true; + }
nouveau/abi16.c abi16_ntfy(struct nouveau_object *obj) · line 196
Quoted 10 lines
nouveau/abi16.c +10
-0+ }else +if ((parent->length !=0 && + parent->oclass ==NOUVEAU_FIFO_CHANNEL_CLASS )) { +if (obj->oclass ==NOUVEAU_NOTIFIER_CLASS ) { + *func = abi16_ntfy; +return true; + } + + *func = abi16_engobj; +return false;
Surely this is meant to be true, right ?
Quoted 15 lines
nouveau/abi16.c +7
-0+ } + + *func =NULL ; +return false; +} + +drm_private voidabi16_bo_info (struct nouveau_bo *bo,struct drm_nouveau_gem_info *info) {struct nouveau_bo_priv *nvbo =nouveau_bo (bo);nouveau/nouveau.c +0
-0
nouveau/nouveau.c nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev) · line 138
Quoted 4 lines
nouveau/nouveau.c +1
-0@@ -135,6 +135,7 @@ nouveau_device_wrap(int fd, int close, struct nouveau_device **pdev) nvdev->gart_limit_percent =80 ;DRMINITLISTHEAD (&nvdev->bo_list); nvdev->base.object.oclass =NOUVEAU_DEVICE_CLASS ; + nvdev->base.object.length = ~0 ;
There are no hints about this and it's use in abi16_object - worth splitting out or mentioning it in the commit message ?
-Emil
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau