some patches and remarks for ng
1 patch for libnouveau_drm, 4 for drm and one work in progress patch for the ddx.
Getting nv50 to run proved to be more difficult than i thought (at some point i stopped because it would require significant changes), i just have a few remarks.
- Buffer object access is not guarded by fences at all, which is a major issue. You worked around that by using M2MF I suppose, but this needs a structural fix.
- Comments are scarce, please be more verbose. I know it's all very obvious to the people that write the code, but for others it's less obvious.
- I think buffer object untiling should happen in userspace, which will also allow some nice optimizations that EXA does (using damage to selectively copy and such).
- The WIP patch contains sysmem pixmaps, i fixed this for git xserver (and nominated it for 1.6), but expect older versions to blow up due to NULL'ing of devPrivate.ptr.
(http://cgit.freedesktop.org/xorg/xserver/commit/?id=3534a5e5d9c5af85149c799f324257f89507fa23)
Consider the patches hints, and don't blindly apply them.
Maarten.
From abed0dd3583ac173e19570a4a0010eb56b45bc0b Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Tue, 23 Dec 2008 21:16:10 +0100
Subject: [PATCH] A few minor fixes.
--- src/nouveau_bo.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
src/nouveau_bo.c +12 -5
@@ -328,7 +328,9 @@ nouveau_bo_wait(struct nouveau_bo *bo, int cpu_write)nouveau_pushbuf_flush (nvbo->pending_channel,0 ); } -nouveau_bo_kmap (nvbo); + ret =nouveau_bo_kmap (nvbo); +if (ret) +return ret; req.handle = nvbo->handle; ret = drmCommandWrite(nvdev->fd, DRM_NOUVEAU_GEM_CPU_PREP,
@@ -350,8 +352,11 @@ nouveau_bo_map(struct nouveau_bo *bo, uint32_t flags)return -EINVAL ;if (!nouveau_bo_allocated (nvbo)) { -if (nvbo->flags & (NOUVEAU_BO_VRAM |NOUVEAU_BO_GART )) -nouveau_bo_kalloc (nvbo,NULL ); +if (nvbo->flags & (NOUVEAU_BO_VRAM |NOUVEAU_BO_GART )) { + ret =nouveau_bo_kalloc (nvbo,NULL ); +if (ret) +return ret; + }if (!nouveau_bo_allocated (nvbo)) { ret =nouveau_bo_ualloc (nvbo);
@@ -468,7 +473,9 @@ nouveau_bo_emit_buffer(struct nouveau_channel *chan, struct nouveau_bo *bo)return nvbo->pending;if (!nvbo->handle) { -nouveau_bo_kalloc (nvbo, chan); + ret =nouveau_bo_kalloc (nvbo, chan); +if (ret) +return NULL ;if (nvbo->sysmem) {void *sysmem_tmp = nvbo->sysmem;
@@ -494,7 +501,7 @@ nouveau_bo_emit_buffer(struct nouveau_channel *chan, struct nouveau_bo *bo) pbbo->user_priv = (uint64_t )(unsigned long )ref; pbbo->handle = nvbo->handle; pbbo->valid_domains =NOUVEAU_GEM_DOMAIN_VRAM |NOUVEAU_GEM_DOMAIN_GART ; - pbbo->read_domains = + pbbo->read_domains =0 ; pbbo->write_domains =0 ; pbbo->presumed_domain = nvbo->domain; pbbo->presumed_offset = nvbo->offset;
Signature · 1 line
1.6.0.6
From 8caaf0c4a3dc4579e09963173438d876d335fbb5 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Tue, 23 Dec 2008 21:12:14 +0100
Subject: [PATCH] nv50: properly handle gart.
--- shared-core/nouveau_object.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
shared-core/nouveau_object.c +8 -1
@@ -961,6 +961,8 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,/* VRAM ctxdma */ if (dev_priv->card_type >=NV_50 ) { +/* VRAM is mapped into 512-1024 MB in the page directory. */ +/* The reason available size is used, is to avoid dma'ing into RAMIN. */ ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, (512*1024*1024), dev_priv->fb_available_size,
@@ -986,7 +988,12 @@ nouveau_gpuobj_channel_init(struct nouveau_channel *chan,/* TT memory ctxdma */ if (dev_priv->card_type >=NV_50 ) { - tt = vram; +/* GART is mapped into 0-512MB of the page directory. */ + ret =nouveau_gpuobj_dma_new (chan,NV_CLASS_DMA_IN_MEMORY , +0 , +512 *1024 *1024 , +NV_DMA_ACCESS_RW , +NV_DMA_TARGET_AGP , &tt); }else if (dev_priv->gart_info.type !=NOUVEAU_GART_NONE ) { ret = nouveau_gpuobj_gart_dma_new(chan, 0,
Signature · 1 line
1.6.0.6
From 4fa3a8c10d9960343e98d37caa730c26438af1f3 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Fri, 26 Dec 2008 14:40:19 +0100
Subject: [PATCH] nouveau: At least do something if drm_fence_emit() fails.
--- linux-core/nouveau_gem.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
linux-core/nouveau_gem.c +3 -1
@@ -443,7 +443,9 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, ret =drm_fence_object_emit (fence,0 , chan->id,DRM_FENCE_TYPE_EXE );if (ret) { -/*XXX*/ +/*XXX: something better that can be done? */ +DRM_ERROR ("drm_fence_object_emit failed, expect problems.\n" ); + goto out; }if (nouveau_gem_pushbuf_sync (chan)) {
Signature · 1 line
1.6.0.6
From 6c11a595323be09b15f61c5daa31a13b65565243 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sat, 27 Dec 2008 20:25:37 +0100
Subject: [PATCH] nouveau: Fix some major brain damage in the size of useable vram.
- On NV50 ramin would get overwritten with serious concequences.
--- shared-core/nouveau_mem.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
shared-core/nouveau_mem.c +4 -1
@@ -384,6 +384,9 @@ nouveau_mem_init(struct drm_device *dev)/* non-mappable vram */ dev_priv->fb_available_size =nouveau_mem_fb_amount (dev); dev_priv->fb_available_size -= dev_priv->ramin_rsvd_vram; +/* It's possible that this size is including the reserved area. */ +if (dev_priv->card_type ==NV_50 ) + dev_priv->fb_available_size -= dev_priv->ramin->size; vram_size = dev_priv->fb_available_size >>PAGE_SHIFT ; bar1_size =drm_get_resource_len (dev,1 ) >>PAGE_SHIFT ;if (bar1_size < vram_size) {
@@ -396,7 +399,7 @@ nouveau_mem_init(struct drm_device *dev) }/* mappable vram */ -if ((ret =drm_bo_init_mm (dev,DRM_BO_MEM_VRAM ,0 , vram_size*3 ,1 ))) { +if ((ret =drm_bo_init_mm (dev,DRM_BO_MEM_VRAM ,0 , vram_size,1 ))) {DRM_ERROR ("Failed VRAM mm init: %d\n" , ret);return ret; }
Signature · 1 line
1.6.0.6
From 39153befd2ce0c1342e86970972365255d6cec63 Mon Sep 17 00:00:00 2001
From: Maarten Maathuis <[email protected]>
Date: Sun, 28 Dec 2008 00:56:43 +0100
Subject: [PATCH] nv50: Also reset old pages in nouveau_bo_move().
--- linux-core/nouveau_bo.c | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-)
linux-core/nouveau_bo.c +21 -1
@@ -293,6 +293,7 @@ nouveau_bo_move(struct drm_buffer_object *bo, int evict, int no_wait,if (dev_priv->init_state !=NOUVEAU_CARD_INIT_DONE )return drm_bo_move_memcpy (bo, evict, no_wait, new_mem); +/* DRM_BO_MEM_PRIV0 is used for vram beyond the first 256 MB. */ if (dev_priv->card_type == NV_50 && (new_mem->mem_type == DRM_BO_MEM_VRAM || new_mem->mem_type == DRM_BO_MEM_PRIV0) &&
@@ -317,7 +318,26 @@ nouveau_bo_move(struct drm_buffer_object *bo, int evict, int no_wait, offset +=65536 ; } } - + +/* Also clean up old pages. */ +if (dev_priv->card_type ==NV_50 && + (old_mem->mem_type ==DRM_BO_MEM_VRAM || + old_mem->mem_type ==DRM_BO_MEM_PRIV0 ) && + !(old_mem->flags &DRM_NOUVEAU_BO_FLAG_NOVM )) { +struct nouveau_gpuobj *pt = dev_priv->vm_vram_pt; +unsigned offset = old_mem->mm_node->start <<PAGE_SHIFT ; +unsigned count = old_mem->size /65536 ; +unsigned tile =0 ; + +while (count--) { +unsigned pte = offset /65536 ; + +INSTANCE_WR (pt, (pte *2 ) +0 ,0 ); +INSTANCE_WR (pt, (pte *2 ) +1 ,0 ); + offset +=65536 ; + } + } +if (old_mem->flags &DRM_BO_FLAG_CLEAN ) { return drm_bo_move_accel_cleanup(bo, 1, no_wait, bo->new_fence_class,
Signature · 1 line
1.6.0.6
src/nv50_exa.c +4 -0
@@ -114,6 +114,8 @@ NV50EXAAcquireSurface2D(PixmapPtr ppix, int is_src)if (!NV50EXA2DSurfaceFormat (ppix, &fmt))return FALSE; +ErrorF ("is_src %d ppix 0x%08X tiled %d width %d height %d\n" , is_src, ppix, surf->bo->tiled, ppix->drawable.width, ppix->drawable.height); + bo_flags =NOUVEAU_BO_VRAM ; bo_flags |= is_src ?NOUVEAU_BO_RD :NOUVEAU_BO_WR ;
@@ -274,6 +276,8 @@ NV50EXACopy(PixmapPtr pdpix, int srcX , int srcY, {NV50EXA_LOCALS (pdpix); +ErrorF ("srcX %d srcY %d dstX %d dstY %d width %d height %d\n" , srcX, srcY, dstX, dstY, width, height); +BEGIN_RING (chan, eng2d,0x0110 ,1 );OUT_RING (chan,0 );BEGIN_RING (chan, eng2d,0x088c ,1 );
src/nv_exa.c +230 -7
287 lines not on this page · raw message
src/nv_type.h +17 -1
@@ -357,9 +357,25 @@ enum LVDS_script {struct nouveau_pixmap {struct nouveau_bo *bo; +struct nouveau_bo *lbo;/* Linear copy for nv50. */ +uint32_t flags;/* tiled access flags */ int size; }; +struct nouveau_bo_copy { +/* Buffer objects. */ +struct nouveau_bo *src; +struct nouveau_bo *dst; + +/* Dimensions to copy. */ +int x, y, w, h; + +/* Pixmap information. */ +int cpp; +int src_pitch, src_line_len, src_height; +int dst_pitch, dst_line_len, dst_height; +}; +static inline struct nouveau_pixmap *nouveau_pixmap (PixmapPtr pPixmap) {
@@ -604,7 +620,7 @@ typedef struct _NVPortPrivRec {#define TIMER_MASK (OFF_TIMER | FREE_TIMER) -#if 0 +#if 1 #define NOUVEAU_FALLBACK(fmt,args...) do { \ fprintf(stderr, "FALLBACK: "fmt, ##args); \ return FALSE; \
_______________________________________________
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): 6d4bc9fc0901030853q7f341c16l231ebf42c4643ede-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 10 lines · Maarten Maathuis
1 patch for
libnouveau_drm, 4 for drm and one work in progress patch for the ddx.Getting nv50 to run proved to be more difficult than i thought (at some point i stopped because it would require significant changes), i just have a few remarks.
- Buffer object access is not guarded by fences at all, which is a major issue. You worked around that by using M2MF I suppose, but this needs a structural fix.
I have no idea where you got that idea from...
Quoted 7 lines
- Comments are scarce, please be more verbose. I know it's all very obvious to the people that write the code, but for others it's less obvious.
- I think buffer object untiling should happen in userspace, which will also allow some nice optimizations that EXA does (using damage to selectively copy and such).
Sure, I agree. The drm is still going to need to know a bit more info on the buffer layout than it currently does regardless.
Quoted 6 lines
- The WIP patch contains sysmem pixmaps, i fixed this for git xserver (and nominated it for 1.6), but expect older versions to blow up due to NULL'ing of devPrivate.ptr.
(http://cgit.freedesktop.org/xorg/xserver/commit/?id=3534a5e5d9c5af85149c799f324257f89507fa23)Consider the patches hints, and don't blindly apply them.
libnouveau_drm 0001: I'll apply it, harmless changes
drm 0001: Oops, missed that from an earlier change. Will apply. drm 0002: I won't apply, we'll need to do a lot more extensive cleanup if we fail there. What exactly is needed I'm not sure, haven't looked into it properly yet - hence the XXX
drm 0003: NACK on the PRAMIN changes. PRAMIN doesn't work *anything* like previously. The current code is fine, no channel has access to the parts of VRAM mapped into PRAMIN. On the VRAM size, thanks, that's left-over from when the code was supporting both the old mm and ttm at the same time.
drm 0004: It doesn't hurt I guess.
Quoted 6 lines
Maarten.
_______________________________________________
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): 1231115075.14351.23.camel-oFTkVezJ1HzzwxVw7NwMvg@public.gmane.org
Quoted 9 lines · Ben Skeggs
Quoted 7 lines · Maarten Maathuis
1 patch for
libnouveau_drm, 4 for drm and one work in progress patch for the ddx.Getting nv50 to run proved to be more difficult than i thought (at some point i stopped because it would require significant changes), i just have a few remarks.
Quoted 6 lines
Quoted 4 lines
- Buffer object access is not guarded by fences at all, which is a major issue. You worked around that by using M2MF I suppose, but this needs a structural fix.
I have no idea where you got that idea from...
So where is buffer object mapping waiting for any pending gpu activity?
Quoted 43 lines
Quoted 11 lines
- Comments are scarce, please be more verbose. I know it's all very obvious to the people that write the code, but for others it's less obvious.
- I think buffer object untiling should happen in userspace, which will also allow some nice optimizations that EXA does (using damage to selectively copy and such).
Sure, I agree. The drm is still going to need to know a bit more info on the buffer layout than it currently does regardless.
Quoted 7 lines
- The WIP patch contains sysmem pixmaps, i fixed this for git xserver (and nominated it for 1.6), but expect older versions to blow up due to NULL'ing of devPrivate.ptr.
(http://cgit.freedesktop.org/xorg/xserver/commit/?id=3534a5e5d9c5af85149c799f324257f89507fa23)Consider the patches hints, and don't blindly apply them.
libnouveau_drm0001: I'll apply it, harmless changes
drm 0001: Oops, missed that from an earlier change. Will apply. drm 0002: I won't apply, we'll need to do a lot more extensive cleanup if we fail there. What exactly is needed I'm not sure, haven't looked into it properly yet - hence the XXX
drm 0003: NACK on the PRAMIN changes. PRAMIN doesn't work *anything* like previously. The current code is fine, no channel has access to the parts of VRAM mapped into PRAMIN. On the VRAM size, thanks, that's left-over from when the code was supporting both the old mm and ttm at the same time.
drm 0004: It doesn't hurt I guess.Quoted 6 lines
Maarten.
_______________________________________________
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): [email protected]
Quoted 9 lines · Maarten Maathuis
Quoted 8 lines · Ben Skeggs
Quoted 7 lines · Maarten Maathuis
1 patch for
libnouveau_drm, 4 for drm and one work in progress patch for the ddx.Getting nv50 to run proved to be more difficult than i thought (at some point i stopped because it would require significant changes), i just have a few remarks.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
- Buffer object access is not guarded by fences at all, which is a major issue. You worked around that by using M2MF I suppose, but this needs a structural fix.
I have no idea where you got that idea from...
So where is buffer object mapping waiting for any pending gpu activity?
I should add that I originally had drm_bo_move_memcpy in mind, which just maps and memcpy's as far as i can see. Sorry if i didn't mention that I had this example in mind.
Quoted 37 lines
Quoted 36 lines
Quoted 8 lines
- Comments are scarce, please be more verbose. I know it's all very obvious to the people that write the code, but for others it's less obvious.
- I think buffer object untiling should happen in userspace, which will also allow some nice optimizations that EXA does (using damage to selectively copy and such).
Sure, I agree. The drm is still going to need to know a bit more info on the buffer layout than it currently does regardless.
Quoted 7 lines
- The WIP patch contains sysmem pixmaps, i fixed this for git xserver (and nominated it for 1.6), but expect older versions to blow up due to NULL'ing of devPrivate.ptr.
(http://cgit.freedesktop.org/xorg/xserver/commit/?id=3534a5e5d9c5af85149c799f324257f89507fa23)Consider the patches hints, and don't blindly apply them.
libnouveau_drm0001: I'll apply it, harmless changes
drm 0001: Oops, missed that from an earlier change. Will apply. drm 0002: I won't apply, we'll need to do a lot more extensive cleanup if we fail there. What exactly is needed I'm not sure, haven't looked into it properly yet - hence the XXX
drm 0003: NACK on the PRAMIN changes. PRAMIN doesn't work *anything* like previously. The current code is fine, no channel has access to the parts of VRAM mapped into PRAMIN. On the VRAM size, thanks, that's left-over from when the code was supporting both the old mm and ttm at the same time.
drm 0004: It doesn't hurt I guess.Quoted 5 lines
Maarten.
_______________________________________________
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): [email protected]
Am Montag, den 05.01.2009, 16:27 +0100 schrieb Maarten Maathuis:
Quoted 13 lines · Maarten Maathuis
Quoted 12 lines · Ben Skeggs
Quoted 11 lines · Maarten Maathuis
Quoted 10 lines
1 patch for
libnouveau_drm, 4 for drm and one work in progress patch for the ddx.Getting nv50 to run proved to be more difficult than i thought (at some point i stopped because it would require significant changes), i just have a few remarks.
- Buffer object access is not guarded by fences at all, which is a major issue. You worked around that by using M2MF I suppose, but this needs a structural fix.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
I have no idea where you got that idea from...
So where is buffer object mapping waiting for any pending gpu activity?
I should add that I originally had
drm_bo_move_memcpyin mind, which just maps and memcpy's as far as i can see. Sorry if i didn't mention that I had this example in mind.
Hmm, you might be right there, that's not what I thought you were talking about :) I assumed TTM would handle idling the buffer object in that case - but it's possible that it doesn't. I'll look into it.
Quoted 39 lines
Quoted 38 lines
Quoted 37 lines
Quoted 9 lines
- Comments are scarce, please be more verbose. I know it's all very obvious to the people that write the code, but for others it's less obvious.
- I think buffer object untiling should happen in userspace, which will also allow some nice optimizations that EXA does (using damage to selectively copy and such).
Sure, I agree. The drm is still going to need to know a bit more info on the buffer layout than it currently does regardless.
Quoted 7 lines
- The WIP patch contains sysmem pixmaps, i fixed this for git xserver (and nominated it for 1.6), but expect older versions to blow up due to NULL'ing of devPrivate.ptr.
(http://cgit.freedesktop.org/xorg/xserver/commit/?id=3534a5e5d9c5af85149c799f324257f89507fa23)Consider the patches hints, and don't blindly apply them.
libnouveau_drm0001: I'll apply it, harmless changes
drm 0001: Oops, missed that from an earlier change. Will apply. drm 0002: I won't apply, we'll need to do a lot more extensive cleanup if we fail there. What exactly is needed I'm not sure, haven't looked into it properly yet - hence the XXX
drm 0003: NACK on the PRAMIN changes. PRAMIN doesn't work *anything* like previously. The current code is fine, no channel has access to the parts of VRAM mapped into PRAMIN. On the VRAM size, thanks, that's left-over from when the code was supporting both the old mm and ttm at the same time.
drm 0004: It doesn't hurt I guess.Quoted 5 lines
Maarten.
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau