nouveau: bump required libdrm version to 2.4.66
PATCH 1/9 nouveau: bump required libdrm version to 2.4.66
From: Ben Skeggs <[email protected]>
--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
@@ -73,7 +73,7 @@ LIBDRM_RADEON_REQUIRED=2.4.56 LIBDRM_AMDGPU_REQUIRED=2.4.63 LIBDRM_INTEL_REQUIRED=2.4.61 LIBDRM_NVVIEUX_REQUIRED=2.4.33 -LIBDRM_NOUVEAU_REQUIRED=2.4.62 +LIBDRM_NOUVEAU_REQUIRED=2.4.66 LIBDRM_FREEDRENO_REQUIRED=2.4.65 DRI2PROTO_REQUIRED=2.6 DRI3PROTO_REQUIRED=1.0
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): 1448522103-4925-1-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
PATCH 2/9 nouveau: remove use of deprecated nouveau_device::fd
From: Ben Skeggs <[email protected]>
--- src/gallium/drivers/nouveau/nouveau_screen.c | 1 + src/gallium/drivers/nouveau/nouveau_screen.h | 1 + src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
src/gallium/drivers/nouveau/nouveau_screen.c +1 -0
@@ -175,6 +175,7 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) data, size, &screen->channel);if (ret)return ret; + screen->drm =nouveau_drm (&dev->object); screen->device = dev; ret =nouveau_client_new (screen->device, &screen->client);
src/gallium/drivers/nouveau/nouveau_screen.h +1 -0
@@ -17,6 +17,7 @@ struct nouveau_bo;struct nouveau_screen {struct pipe_screen base; +struct nouveau_drm *drm;struct nouveau_device *device;struct nouveau_object *channel;struct nouveau_client *client;
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +1 -1
@@ -27,7 +27,7 @@ bool nouveau_drm_screen_unref(struct nouveau_screen *screen) ret = --screen->refcount;assert (ret >=0 );if (ret ==0 ) -util_hash_table_remove (fd_tab,intptr_to_pointer (screen->device->fd)); +util_hash_table_remove (fd_tab,intptr_to_pointer (screen->drm->fd));pipe_mutex_unlock (nouveau_screen_mutex);return ret ==0 ; }
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 3/9 nouveau: remove use of deprecated nouveau_device::drm_version
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- src/gallium/drivers/nouveau/nv50/nv50_miptree.c | 3 ++- src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 3 ++- src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c | 2 +- src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c | 4 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 9 +++++---- 7 files changed, 15 insertions(+), 12 deletions(-)
src/gallium/drivers/nouveau/nv50/nv50_miptree.c +2 -1
@@ -336,9 +336,10 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *templ) {struct nouveau_device *dev =nouveau_screen (pscreen)->device; +struct nouveau_drm *drm =nouveau_screen (pscreen)->drm;struct nv50_miptree *mt =CALLOC_STRUCT (nv50_miptree);struct pipe_resource *pt = &mt->base.base; -bool compressed = dev->drm_version >=0x01000101 ; +bool compressed = drm->drm_version >=0x01000101 ;int ret;union nouveau_bo_config bo_config;uint32_t bo_flags;
src/gallium/drivers/nouveau/nv50/nv50_screen.c +2 -2
@@ -518,11 +518,11 @@ nv50_screen_init_hwctx(struct nv50_screen *screen) }BEGIN_NV04 (push,NV50_3D (ZETA_COMP_ENABLE ),1 ); -PUSH_DATA (push, screen->base.device->drm_version >=0x01000101 ); +PUSH_DATA (push, screen->base.drm->drm_version >=0x01000101 );BEGIN_NV04 (push,NV50_3D (RT_COMP_ENABLE (0 )),8 );for (i =0 ; i <8 ; ++i) -PUSH_DATA (push, screen->base.device->drm_version >=0x01000101 ); +PUSH_DATA (push, screen->base.drm->drm_version >=0x01000101 );BEGIN_NV04 (push,NV50_3D (RT_CONTROL ),1 );PUSH_DATA (push,1 );
src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c +2 -1
@@ -248,9 +248,10 @@ nvc0_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *templ) {struct nouveau_device *dev =nouveau_screen (pscreen)->device; +struct nouveau_drm *drm =nouveau_screen (pscreen)->drm;struct nv50_miptree *mt =CALLOC_STRUCT (nv50_miptree);struct pipe_resource *pt = &mt->base.base; -bool compressed = dev->drm_version >=0x01000101 ; +bool compressed = drm->drm_version >=0x01000101 ;int ret;union nouveau_bo_config bo_config;uint32_t bo_flags;
src/gallium/drivers/nouveau/nvc0/nvc0_query.c +1 -1
@@ -184,7 +184,7 @@ nvc0_screen_get_driver_query_group_info(struct pipe_screen *pscreen, count++;#endif -if (screen->base.device->drm_version >=0x01000101 ) { +if (screen->base.drm->drm_version >=0x01000101 ) {if (screen->compute) {if (screen->base.class_3d ==NVE4_3D_CLASS ) { count++;
src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_metric.c +1 -1
@@ -404,7 +404,7 @@ nvc0_hw_metric_get_driver_query_info(struct nvc0_screen *screen, unsigned id,uint16_t class_3d = screen->base.class_3d;int count =0 ; -if (screen->base.device->drm_version >=0x01000101 ) { +if (screen->base.drm->drm_version >=0x01000101 ) {if (screen->compute) {if (class_3d <NVE4_3D_CLASS ) { const struct nvc0_hw_metric_query_cfg **queries =
src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c +2 -2
@@ -1251,7 +1251,7 @@ nvc0_hw_sm_create_query(struct nvc0_context *nvc0, unsigned type)struct nvc0_hw_query *hq;unsigned space; -if (nvc0->screen->base.device->drm_version <0x01000101 ) +if (nvc0->screen->base.drm->drm_version <0x01000101 )return NULL ; if ((type < NVE4_HW_SM_QUERY(0) || type > NVE4_HW_SM_QUERY_LAST) &&
@@ -1341,7 +1341,7 @@ nvc0_hw_sm_get_driver_query_info(struct nvc0_screen *screen, unsigned id, {int count =0 ; -if (screen->base.device->drm_version >=0x01000101 ) { +if (screen->base.drm->drm_version >=0x01000101 ) {if (screen->compute) {if (screen->base.class_3d ==NVE4_3D_CLASS ) { count +=NVE4_HW_SM_QUERY_COUNT ;
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +5 -4
@@ -687,7 +687,7 @@ nvc0_screen_create(struct nouveau_device *dev) screen->base.base.is_video_format_supported = nouveau_vp3_screen_video_supported; flags =NOUVEAU_BO_GART |NOUVEAU_BO_MAP ; -if (dev->drm_version >=0x01000202 ) +if (screen->base.drm->drm_version >=0x01000202 ) flags |=NOUVEAU_BO_COHERENT ; ret =nouveau_bo_new (dev, flags,0 ,4096 ,NULL , &screen->fence.bo);
@@ -811,10 +811,11 @@ nvc0_screen_create(struct nouveau_device *dev)PUSH_DATA (push,0x17 ); } -IMMED_NVC0 (push,NVC0_3D (ZETA_COMP_ENABLE ), dev->drm_version >=0x01000101 ); +IMMED_NVC0 (push,NVC0_3D (ZETA_COMP_ENABLE ), + screen->base.drm->drm_version >=0x01000101 );BEGIN_NVC0 (push,NVC0_3D (RT_COMP_ENABLE (0 )),8 );for (i =0 ; i <8 ; ++i) -PUSH_DATA (push, dev->drm_version >=0x01000101 ); +PUSH_DATA (push, screen->base.drm->drm_version >=0x01000101 );BEGIN_NVC0 (push,NVC0_3D (RT_CONTROL ),1 );PUSH_DATA (push,1 );
@@ -910,7 +911,7 @@ nvc0_screen_create(struct nouveau_device *dev)PUSH_DATAh (push, screen->uniform_bo->offset + (5 <<16 ) + (6 <<9 ));PUSH_DATA (push, screen->uniform_bo->offset + (5 <<16 ) + (6 <<9 )); -if (dev->drm_version >=0x01000101 ) { +if (screen->base.drm->drm_version >=0x01000101 ) { ret =nouveau_getparam (dev,NOUVEAU_GETPARAM_GRAPH_UNITS , &value);if (ret) {NOUVEAU_ERR ("NOUVEAU_GETPARAM_GRAPH_UNITS failed.\n" );
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 4/9 nouveau: return nouveau_screen from hw-specific creation functions
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
Kills off a void cast.
--- src/gallium/drivers/nouveau/nouveau_winsys.h | 6 +++--- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 4 ++-- src/gallium/drivers/nouveau/nv50/nv50_screen.c | 4 ++-- src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 4 ++-- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-)
src/gallium/drivers/nouveau/nouveau_winsys.h +3 -3
@@ -79,13 +79,13 @@ nouveau_screen_transfer_flags(unsigned pipe) return flags; } -extern struct pipe_screen * +extern struct nouveau_screen *nv30_screen_create (struct nouveau_device *); -extern struct pipe_screen * +extern struct nouveau_screen *nv50_screen_create (struct nouveau_device *); -extern struct pipe_screen * +extern struct nouveau_screen *nvc0_screen_create (struct nouveau_device *);#endif
src/gallium/drivers/nouveau/nv30/nv30_screen.c +2 -2
@@ -417,7 +417,7 @@ nv30_screen_destroy(struct pipe_screen *pscreen)return NULL ; \ }while (0 ) -struct pipe_screen * +struct nouveau_screen *nv30_screen_create (struct nouveau_device *dev) {struct nv30_screen *screen =CALLOC_STRUCT (nv30_screen);
@@ -693,5 +693,5 @@ nv30_screen_create(struct nouveau_device *dev)nouveau_pushbuf_kick (push, push->channel);nouveau_fence_new (&screen->base, &screen->base.fence.current, false); -return pscreen; +return &screen->base; }
src/gallium/drivers/nouveau/nv50/nv50_screen.c +2 -2
@@ -747,7 +747,7 @@ int nv50_tls_realloc(struct nv50_screen *screen, unsigned tls_space)return 1 ; } -struct pipe_screen * +struct nouveau_screen *nv50_screen_create (struct nouveau_device *dev) {struct nv50_screen *screen;
@@ -961,7 +961,7 @@ nv50_screen_create(struct nouveau_device *dev)nouveau_fence_new (&screen->base, &screen->base.fence.current, false); -return pscreen; +return &screen->base; fail:nv50_screen_destroy (pscreen);
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +2 -2
@@ -621,7 +621,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,return NULL ; \ }while (0 ) -struct pipe_screen * +struct nouveau_screen *nvc0_screen_create (struct nouveau_device *dev) {struct nvc0_screen *screen;
@@ -1062,7 +1062,7 @@ nvc0_screen_create(struct nouveau_device *dev)nouveau_fence_new (&screen->base, &screen->base.fence.current, false); -return pscreen; +return &screen->base; fail:nvc0_screen_destroy (pscreen);
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +2 -2
@@ -58,7 +58,7 @@ PUBLIC struct pipe_screen * nouveau_drm_screen_create(int fd) {struct nouveau_device *dev =NULL ; -struct pipe_screen *(*init)(struct nouveau_device *); +struct nouveau_screen *(*init)(struct nouveau_device *);struct nouveau_screen *screen;int ret, dupfd =-1 ;
@@ -116,7 +116,7 @@ nouveau_drm_screen_create(int fd) goto err; } - screen = (struct nouveau_screen *)init (dev); + screen =init (dev);if (!screen) goto err;
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 5/9 nouveau: fix screen creation failure paths
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
The winsys layer would attempt to cleanup the nouveau_device if screen init failed, however, in most paths the pipe driver would have already destroyed it, resulting in accesses to freed memory etc.
This commit fixes the problem by allowing the winsys to detect whether the pipe driver's destroy function needs to be called or not.
--- src/gallium/drivers/nouveau/nouveau_screen.c | 8 ++++++-- src/gallium/drivers/nouveau/nv30/nv30_screen.c | 19 ++++++++++--------- src/gallium/drivers/nouveau/nv50/nv50_screen.c | 6 +++--- src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 9 ++++----- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 16 ++++++++++------ 5 files changed, 33 insertions(+), 25 deletions(-)
src/gallium/drivers/nouveau/nouveau_screen.c +6 -2
@@ -147,6 +147,12 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)if (nv_dbg) nouveau_mesa_debug =atoi (nv_dbg); +/* These must be set before any failure is possible, as the cleanup +* paths assume they're responsible for deleting them. +*/ + screen->drm =nouveau_drm (&dev->object); + screen->device = dev; +/* * this is initialized to 1 in nouveau_drm_screen_create after screen * is fully constructed and added to the global screen list.
@@ -175,8 +181,6 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev) data, size, &screen->channel);if (ret)return ret; - screen->drm =nouveau_drm (&dev->object); - screen->device = dev; ret =nouveau_client_new (screen->device, &screen->client);if (ret)
src/gallium/drivers/nouveau/nv30/nv30_screen.c +10 -9
@@ -413,23 +413,20 @@ nv30_screen_destroy(struct pipe_screen *pscreen)#define FAIL_SCREEN_INIT (str, err) \ do { \ NOUVEAU_ERR(str, err); \ - nv30_screen_destroy(pscreen); \ - return NULL; \ + screen->base.base.context_create = NULL; \ + return &screen->base; \ } while(0)struct nouveau_screen *nv30_screen_create (struct nouveau_device *dev) { -struct nv30_screen *screen =CALLOC_STRUCT (nv30_screen); +struct nv30_screen *screen;struct pipe_screen *pscreen;struct nouveau_pushbuf *push;struct nv04_fifo *fifo;unsigned oclass =0 ;int ret, i; -if (!screen) -return NULL ; -switch (dev->chipset &0xf0 ) {case 0x30 :if (RANKINE_0397_CHIPSET & (1 << (dev->chipset &0x0f )))
@@ -458,10 +455,16 @@ nv30_screen_create(struct nouveau_device *dev)if (!oclass) {NOUVEAU_ERR ("unknown 3d class for 0x%02x\n" , dev->chipset); -FREE (screen);return NULL ; } + screen =CALLOC_STRUCT (nv30_screen); +if (!screen) +return NULL ; + + pscreen = &screen->base.base; + pscreen->destroy = nv30_screen_destroy; +/* * Some modern apps try to use msaa without keeping in mind the * restrictions on videomem of older cards. Resulting in dmesg saying:
@@ -479,8 +482,6 @@ nv30_screen_create(struct nouveau_device *dev)if (screen->max_sample_count >4 ) screen->max_sample_count =4 ; - pscreen = &screen->base.base; - pscreen->destroy = nv30_screen_destroy; pscreen->get_param = nv30_screen_get_param; pscreen->get_paramf = nv30_screen_get_paramf; pscreen->get_shader_param = nv30_screen_get_shader_param;
src/gallium/drivers/nouveau/nv50/nv50_screen.c +3 -3
@@ -762,6 +762,7 @@ nv50_screen_create(struct nouveau_device *dev)if (!screen)return NULL ; pscreen = &screen->base.base; + pscreen->destroy = nv50_screen_destroy; ret =nouveau_screen_init (&screen->base, dev);if (ret) {
@@ -782,7 +783,6 @@ nv50_screen_create(struct nouveau_device *dev) chan = screen->base.channel; - pscreen->destroy = nv50_screen_destroy; pscreen->context_create = nv50_create; pscreen->is_format_supported = nv50_screen_is_format_supported; pscreen->get_param = nv50_screen_get_param;
@@ -964,8 +964,8 @@ nv50_screen_create(struct nouveau_device *dev)return &screen->base; fail: -nv50_screen_destroy (pscreen); -return NULL ; + screen->base.base.context_create =NULL ; +return &screen->base; }int
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +4 -5
@@ -617,8 +617,7 @@ nvc0_screen_resize_tls_area(struct nvc0_screen *screen,#define FAIL_SCREEN_INIT (str, err) \ do { \ NOUVEAU_ERR(str, err); \ - nvc0_screen_destroy(pscreen); \ - return NULL; \ + goto fail; \ } while(0) struct nouveau_screen *
@@ -650,6 +649,7 @@ nvc0_screen_create(struct nouveau_device *dev)if (!screen)return NULL ; pscreen = &screen->base.base; + pscreen->destroy = nvc0_screen_destroy; ret =nouveau_screen_init (&screen->base, dev);if (ret) {
@@ -672,7 +672,6 @@ nvc0_screen_create(struct nouveau_device *dev) screen->base.vidmem_bindings =0 ; } - pscreen->destroy = nvc0_screen_destroy; pscreen->context_create = nvc0_create; pscreen->is_format_supported = nvc0_screen_is_format_supported; pscreen->get_param = nvc0_screen_get_param;
@@ -1065,8 +1064,8 @@ nvc0_screen_create(struct nouveau_device *dev)return &screen->base; fail: -nvc0_screen_destroy (pscreen); -return NULL ; + screen->base.base.context_create =NULL ; +return &screen->base; }int
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +10 -6
@@ -59,7 +59,7 @@ nouveau_drm_screen_create(int fd) {struct nouveau_device *dev =NULL ;struct nouveau_screen *(*init)(struct nouveau_device *); -struct nouveau_screen *screen; +struct nouveau_screen *screen =NULL ;int ret, dupfd =-1 ;pipe_mutex_lock (nouveau_screen_mutex);
@@ -117,7 +117,7 @@ nouveau_drm_screen_create(int fd) } screen =init (dev); -if (!screen) +if (!screen || !screen->base.context_create) goto err;/* Use dupfd in hash table, to avoid errors if the original fd gets
@@ -130,10 +130,14 @@ nouveau_drm_screen_create(int fd)return &screen->base; err: -if (dev) -nouveau_device_del (&dev); -else if (dupfd >=0 ) -close (dupfd); +if (screen) { + screen->base.destroy (&screen->base); + }else { +if (dev) +nouveau_device_del (&dev); +else if (dupfd >=0 ) +close (dupfd); + }pipe_mutex_unlock (nouveau_screen_mutex);return NULL ; }
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 6/9 nouveau: remove use of deprecated nouveau_device_wrap()
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
Switching to the newer libdrm entry-points tells libdrm that it's OK to make use of newer kernel interfaces.
We want to be able to isolate any bugs to either the interfaces changes, or the use of NVIF itself. As such, this commit has a slight hack which forces libdrm to continue using the older kernel interfaces.
--- src/gallium/drivers/nouveau/nouveau_screen.c | 4 +++ .../winsys/nouveau/drm/nouveau_drm_winsys.c | 31 ++++++++++++++++------ src/mesa/drivers/dri/nouveau/nouveau_screen.c | 18 ++++++++++++- src/mesa/drivers/dri/nouveau/nouveau_screen.h | 1 + 4 files changed, 45 insertions(+), 9 deletions(-)
src/gallium/drivers/nouveau/nouveau_screen.c +4 -0
@@ -234,6 +234,8 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)void nouveau_screen_fini (struct nouveau_screen *screen) { +int fd = screen->drm->fd; +nouveau_mm_destroy (screen->mm_GART);nouveau_mm_destroy (screen->mm_VRAM);
@@ -243,6 +245,8 @@ nouveau_screen_fini(struct nouveau_screen *screen)nouveau_object_del (&screen->channel);nouveau_device_del (&screen->device); +nouveau_drm_del (&screen->drm); +close (fd); } static void
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +23 -8
@@ -13,6 +13,9 @@#include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_screen.h" +#include <nvif/class.h> +#include <nvif/cl0080.h> +static struct util_hash_table *fd_tab =NULL ;pipe_static_mutex (nouveau_screen_mutex);
@@ -57,16 +60,19 @@ static int compare_fd(void *key1, void *key2) PUBLIC struct pipe_screen *nouveau_drm_screen_create (int fd) { +struct nouveau_drm *drm =NULL ;struct nouveau_device *dev =NULL ;struct nouveau_screen *(*init)(struct nouveau_device *);struct nouveau_screen *screen =NULL ; -int ret, dupfd =-1 ; +int ret, dupfd;pipe_mutex_lock (nouveau_screen_mutex);if (!fd_tab) { fd_tab =util_hash_table_create (hash_fd, compare_fd); -if (!fd_tab) - goto err; +if (!fd_tab) { +pipe_mutex_unlock (nouveau_screen_mutex); +return NULL ; + } } screen =util_hash_table_get (fd_tab,intptr_to_pointer (fd));
@@ -86,7 +92,17 @@ nouveau_drm_screen_create(int fd)* creation error. */ dupfd =dup (fd); - ret =nouveau_device_wrap (dupfd,1 , &dev); + + ret =nouveau_drm_new (dupfd, &drm); +if (ret) + goto err; + + drm->nvif = false; + + ret =nouveau_device_new (&drm->client,NV_DEVICE , + &(struct nv_device_v0 ) { + .device = ~0ULL , + },sizeof (struct nv_device_v0 ), &dev);if (ret) goto err;
@@ -133,10 +149,9 @@ err:if (screen) { screen->base.destroy (&screen->base); }else { -if (dev) -nouveau_device_del (&dev); -else if (dupfd >=0 ) -close (dupfd); +nouveau_device_del (&dev); +nouveau_drm_del (&drm); +close (dupfd); }pipe_mutex_unlock (nouveau_screen_mutex);return NULL ;
src/mesa/drivers/dri/nouveau/nouveau_screen.c +17 -1
@@ -40,6 +40,9 @@#include "main/renderbuffer.h" #include "swrast/s_renderbuffer.h" +#include <nvif/class.h> +#include <nvif/cl0080.h> +static const __DRIextension *nouveau_screen_extensions[]; static void
@@ -99,12 +102,24 @@ nouveau_init_screen2(__DRIscreen *dri_screen) dri_screen->driverPrivate = screen;/* Open the DRM device. */ - ret =nouveau_device_wrap (dri_screen->fd,0 , &screen->device); + ret =nouveau_drm_new (dri_screen->fd, &screen->drm);if (ret) {nouveau_error ("Error opening the DRM device.\n" ); goto fail; } + screen->drm->nvif = false; + + ret =nouveau_device_new (&screen->drm->client,NV_DEVICE , + &(struct nv_device_v0 ) { + .device = ~0ULL , + },sizeof (struct nv_device_v0 ), + &screen->device); +if (ret) { +nouveau_error ("Error creating device object.\n" ); + goto fail; + } +/* Choose the card specific function pointers. */ switch (screen->device->chipset &0xf0 ) {case 0x00 :
@@ -213,6 +228,7 @@ nouveau_destroy_screen(__DRIscreen *dri_screen)return ;nouveau_device_del (&screen->device); +nouveau_drm_del (&screen->drm);free (screen); dri_screen->driverPrivate =NULL ;
src/mesa/drivers/dri/nouveau/nouveau_screen.h +1 -0
@@ -33,6 +33,7 @@ struct nouveau_context;struct nouveau_screen {__DRIscreen *dri_screen; +struct nouveau_drm *drm;struct nouveau_device *device;const struct nouveau_driver *driver; };
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 7/9 nv50: fix g98+ vdec class allocation
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
The kernel previously exposed incorrect classes for some of the chipsets that this code supports. It no longer does, but the older object ioctls have compatibility to avoid breaking userspace.
This needs to be fixed before switching over to the newer interfaces.
Rather than hardcoding chipset->class like the rest of the driver does, this makes use of (new) sclass queries to determine what's available.
--- src/gallium/drivers/nouveau/nv50/nv98_video.c | 55 ++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 6 deletions(-)
src/gallium/drivers/nouveau/nv50/nv98_video.c +49 -6
@@ -56,6 +56,28 @@ nv98_decoder_decode_bitstream(struct pipe_video_codec *decoder,nv98_decoder_ppp (dec, desc, target, comm_seq); } +static const struct nouveau_mclass +nv98_decoder_msvld[] = { + {0x88b1 ,-1 }, + {0x86b1 ,-1 }, + {0x85b1 ,-1 }, + {} +}; + +static const struct nouveau_mclass +nv98_decoder_mspdec[] = { + {0x88b2 ,-1 }, + {0x85b2 ,-1 }, + {} +}; + +static const struct nouveau_mclass +nv98_decoder_msppp[] = { + {0x88b3 ,-1 }, + {0x85b3 ,-1 }, + {} +}; +struct pipe_video_codec *nv98_create_decoder (struct pipe_context *context,const struct pipe_video_codec *templ)
@@ -103,12 +125,33 @@ nv98_create_decoder(struct pipe_context *context, } push = dec->pushbuf; -if (!ret) - ret =nouveau_object_new (dec->channel[0 ],0x390b1 ,0x85b1 ,NULL ,0 , &dec->bsp); -if (!ret) - ret =nouveau_object_new (dec->channel[1 ],0x190b2 ,0x85b2 ,NULL ,0 , &dec->vp); -if (!ret) - ret =nouveau_object_new (dec->channel[2 ],0x290b3 ,0x85b3 ,NULL ,0 , &dec->ppp); +if (!ret) { + ret =nouveau_object_mclass (dec->channel[0 ], nv98_decoder_msvld); +if (ret >=0 ) { + ret =nouveau_object_new (dec->channel[0 ],0xbeef85b1 , + nv98_decoder_msvld[ret].oclass,NULL ,0 , + &dec->bsp); + } + } + +if (!ret) { + ret =nouveau_object_mclass (dec->channel[1 ], nv98_decoder_mspdec); +if (ret >=0 ) { + ret =nouveau_object_new (dec->channel[1 ],0xbeef85b2 , + nv98_decoder_mspdec[ret].oclass,NULL ,0 , + &dec->vp); + } + } + +if (!ret) { + ret =nouveau_object_mclass (dec->channel[2 ], nv98_decoder_msppp); +if (ret >=0 ) { + ret =nouveau_object_new (dec->channel[2 ],0xbeef85b3 , + nv98_decoder_msppp[ret].oclass,NULL ,0 , + &dec->ppp); + } + } +if (ret) goto fail;
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): 1448522103-4925-7-git-send-email-skeggsb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Re: [mesa 7/9] nv50: fix g98+ vdec class allocation
Quoted 12 lines · Ben Skeggs
src/gallium/drivers/nouveau/nv50/nv98_video.c +12
-0+static const struct nouveau_mclass +nv98_decoder_msvld[] = { + {0x88b1 ,-1 }, + {0x86b1 ,-1 }, + {0x85b1 ,-1 }, + {} +}; + +static const struct nouveau_mclass +nv98_decoder_mspdec[] = { + {0x88b2 ,-1 }, + {0x85b2 ,-1 },
src/gallium/drivers/nouveau/nv50/nv98_video.c nv98_decoder_decode_bitstream(struct pipe_video_codec *decoder, · line 80
Quoted 10 lines
src/gallium/drivers/nouveau/nv50/nv98_video.c +10
-0+ {} +}; + +static const struct nouveau_mclass +nv98_decoder_msppp[] = { + {0x88b3 ,-1 }, + {0x85b3 ,-1 }, + {} +}; +
Was going to suggest using the new headers, only to realise that there are no for video decoding. Is that intentional ?
-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): CACvgo53x74cJHXXJ6kZMAdFC2QU3QKeTg=9mRL9VDKq6MvnDMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Re: [mesa 7/9] nv50: fix g98+ vdec class allocation
Quoted 18 lines · Emil Velikov
Quoted 16 lines · Ben Skeggs
src/gallium/drivers/nouveau/nv50/nv98_video.c +16
-0+static const struct nouveau_mclass +nv98_decoder_msvld[] = { + {0x88b1 ,-1 }, + {0x86b1 ,-1 }, + {0x85b1 ,-1 }, + {} +}; + +static const struct nouveau_mclass +nv98_decoder_mspdec[] = { + {0x88b2 ,-1 }, + {0x85b2 ,-1 }, + {} +}; + +static const struct nouveau_mclass
Quoted 8 lines
src/gallium/drivers/nouveau/nv50/nv98_video.c nv98_decoder_decode_bitstream(struct pipe_video_codec *decoder, · line 80
Quoted 6 lines
src/gallium/drivers/nouveau/nv50/nv98_video.c +6
-0+nv98_decoder_msppp[] = { + {0x88b3 ,-1 }, + {0x85b3 ,-1 }, + {} +}; +Was going to suggest using the new headers, only to realise that there are no for video decoding. Is that intentional ?
There is, I was just being lazy. Fixed in the next series :)
Quoted 3 lines
-Emil
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 8/9 nvc0: remove allocation of unused sw class
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
This would need to be fixed before NVIF can be switched on, but since we don't use it anyway, just remove it.
--- src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 8 -------- src/gallium/drivers/nouveau/nvc0/nvc0_screen.h | 1 - 2 files changed, 9 deletions(-)
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +0 -8
@@ -447,7 +447,6 @@ nvc0_screen_destroy(struct pipe_screen *pscreen)nouveau_object_del (&screen->eng2d);nouveau_object_del (&screen->m2mf);nouveau_object_del (&screen->compute); -nouveau_object_del (&screen->nvsw);nouveau_screen_fini (&screen->base);
@@ -698,13 +697,6 @@ nvc0_screen_create(struct nouveau_device *dev) screen->base.fence.update = nvc0_screen_fence_update; - ret =nouveau_object_new (chan, - (dev->chipset <0xe0 ) ?0x1f906e :0x906e ,0x906e , -NULL ,0 , &screen->nvsw); -if (ret) -FAIL_SCREEN_INIT ("Error creating SW object: %d\n" , ret); - -switch (dev->chipset & ~0xf ) {case 0x110 :case 0x100 :
src/gallium/drivers/nouveau/nvc0/nvc0_screen.h +0 -1
@@ -105,7 +105,6 @@ struct nvc0_screen {struct nouveau_object *eng2d;struct nouveau_object *m2mf;struct nouveau_object *compute; -struct nouveau_object *nvsw; }; static inline struct nvc0_screen *
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 9/9 nouveau: enable use of new kernel interfaces
In reply to a message not in the archiveFrom: Ben Skeggs <[email protected]>
--- src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c | 2 -- src/mesa/drivers/dri/nouveau/nouveau_screen.c | 2 -- 2 files changed, 4 deletions(-)
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +0 -2
@@ -97,8 +97,6 @@ nouveau_drm_screen_create(int fd)if (ret) goto err; - drm->nvif = false; - ret = nouveau_device_new(&drm->client, NV_DEVICE, &(struct nv_device_v0) { .device = ~0ULL,
src/mesa/drivers/dri/nouveau/nouveau_screen.c +0 -2
@@ -108,8 +108,6 @@ nouveau_init_screen2(__DRIscreen *dri_screen) goto fail; } - screen->drm->nvif = false; - ret = nouveau_device_new(&screen->drm->client, NV_DEVICE, &(struct nv_device_v0) { .device = ~0ULL,
Signature · 6 lines
2.6.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau