Revised patch set v2. [PATCH 1/8] drm/nouveau: bo read/write wrappers for nv04_crtc.c [PATCH 2/8] drm/nouveau: use bo accessors for push buffers [PATCH 3/8] drm/nouveau: OUT_RINGp - optimize OUT_RING loops [PATCH 4/8] drm/nv50: proper notifier_bo access in nv50_display_vblank_crtc_handler() [PATCH 5/8] drm/nouveau: access fbcon notifier via bo accessors [PATCH 6/8] drm/nouveau: screen_base and lut must be iomem [PATCH 7/8] drm/nouveau: remove redundant check in nouveau_bo_del_ttm() [PATCH 8/8] drm/nouveau: remove mask in nv04_fbcon_imageblit()
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 1/8] drm/nouveau: bo read/write wrappers for nv04_crtc.c
Introduce accessors for TTM buffer object memory that has been mapped into the kernel virtual address space or as IO memory. IO memory needs to be accessed via special accessor functions, not by dereferencing the iomem cookie. The wrappers hide the details of 32-bit access and honour the TTM map type. nv04_crtc_cursor_set() is changed to use the new wrappers. 'cursor' is received from user space, which means we cannot assume that it is or is not iomem. 'nv_crtc->cursor.nvbo' should always be iomem, and as such the access is relatively slow. Therefore using the wrappers for it, too, should not cost much. Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/nouveau/nouveau_drv.h | 2 ++ drivers/gpu/drm/nouveau/nv04_crtc.c | 7 ++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index a7b2a61..e7a8d60 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -188,6 +188,29 @@ nouveau_bo_unmap(struct nouveau_bo *nvbo) ttm_bo_kunmap(&nvbo->kmap); } +u32 +nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index) +{ + bool is_iomem; + u32 *mem = ttm_kmap_obj_virtual(&nvbo->kmap, &is_iomem); + mem = &mem[index]; + if (is_iomem) + return ioread32_native((void __force __iomem *)mem); + else + return *mem; +} + +void +nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val) +{ + bool is_iomem; + u32 *mem = ttm_kmap_obj_virtual(&nvbo->kmap, &is_iomem); + mem = &mem[index]; + if (is_iomem) + iowrite32_native(val, (void __force __iomem *)mem); + else + *mem = val; +} static struct ttm_backend * nouveau_bo_create_ttm_backend_entry(struct ttm_bo_device *bdev) { diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index b2f69bc..fe6a0a1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -958,6 +958,8 @@ extern int nouveau_bo_pin(struct nouveau_bo *, uint32_t flags); extern int nouveau_bo_unpin(struct nouveau_bo *); extern int nouveau_bo_map(struct nouveau_bo *); extern void nouveau_bo_unmap(struct nouveau_bo *); +extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); +extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); /* nouveau_fence.c */ struct nouveau_fence; diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index dfe9003..4e56c25 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c @@ -848,7 +848,6 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct nouveau_bo *cursor = NULL; struct drm_gem_object *gem; - uint32_t *src, *dst, pixel; int ret = 0, alpha, i; if (width != 64 || height != 64) @@ -867,8 +866,6 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, ret = nouveau_bo_map(cursor); if (ret) goto out; - src = cursor->kmap.virtual; - dst = nv_crtc->cursor.nvbo->kmap.virtual; /* nv11+ supports premultiplied (PM), or non-premultiplied (NPM) alpha * cursors (though NPM in combination with fp dithering may not work on @@ -877,7 +874,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, * blob uses, however we get given PM cursors so we use PM mode */ for (i = 0; i < 64 * 64; i++) { - pixel = *src++; + uint32_t pixel = nouveau_bo_rd32(cursor, i); /* hw gets unhappy if alpha <= rgb values. for a PM image "less * than" shouldn't happen; fix "equal to" case by adding one to @@ -897,7 +894,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, } #endif - *dst++ = pixel; + nouveau_bo_wr32(nv_crtc->cursor.nvbo, i, pixel); } nouveau_bo_unmap(cursor); -- 1.6.3.3
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 2/8] drm/nouveau: use bo accessors for push buffers
Since push buffers may reside in system memory or VRAM (iomem), they must be accessed via the proper functions instead of just dereferencing a pointer which might be an iomem cookie. Remove the redundant member nouveau_channel::dma.pushbuf. Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nouveau_dma.c | 1 - drivers/gpu/drm/nouveau/nouveau_dma.h | 5 ++--- drivers/gpu/drm/nouveau/nouveau_drv.h | 3 +-- drivers/gpu/drm/nouveau/nv50_display.c | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 7b2bea3..183a7d5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c @@ -56,7 +56,6 @@ nouveau_dma_init(struct nouveau_channel *chan) ret = nouveau_bo_map(chan->pushbuf_bo); if (ret) return ret; - chan->dma.pushbuf = chan->pushbuf_bo->kmap.virtual; /* Map M2MF notifier object - fbcon. */ if (drm_core_check_feature(dev, DRIVER_MODESET)) { diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index 497edca..072d9b9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h @@ -106,7 +106,7 @@ OUT_RING(struct nouveau_channel *chan, int data) NV_INFO(chan->dev, "Ch%d/0x%08x: 0x%08x\n", chan->id, chan->dma.cur << 2, data); #endif - chan->dma.pushbuf[chan->dma.cur++] = data; + nouveau_bo_wr32(chan->pushbuf_bo, chan->dma.cur++, data); } static inline void @@ -116,9 +116,8 @@ BEGIN_RING(struct nouveau_channel *chan, int subc, int mthd, int size) } #define WRITE_PUT(val) do { \ - volatile uint32_t tmp; \ DRM_MEMORYBARRIER(); \ - tmp = chan->dma.pushbuf[0]; \ + nouveau_bo_rd32(chan->pushbuf_bo, 0); \ nvchan_wr32(chan->user_put, ((val) << 2) + chan->pushbuf_base); \ } while (0) diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index fe6a0a1..8516fda 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -214,8 +214,7 @@ struct nouveau_channel int free; int cur; int put; - - volatile uint32_t *pushbuf; + /* access via pushbuf_bo */ } dma; uint32_t sw_subchannel[8]; diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 59febd5..49225c8 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -328,7 +328,6 @@ nv50_display_init(struct drm_device *dev) evo->dma.put = 0; evo->dma.cur = evo->dma.put; evo->dma.free = evo->dma.max - evo->dma.cur; - evo->dma.pushbuf = evo->pushbuf_bo->kmap.virtual; RING_SPACE(evo, NOUVEAU_DMA_SKIPS); for (i = 0; i < NOUVEAU_DMA_SKIPS; i++) -- 1.6.3.3
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 3/8] drm/nouveau: OUT_RINGp - optimize OUT_RING loops
The introduction of nouveau_bo_wr32() in commit "drm/nouveau: use bo accessors for push buffers" to OUT_RING() made it considerably slower. 'x11perf -aa10text' benchmark hits the OUT_RING hard, since user pushbuffers are first copied from user to kernel, and then from kernel to the real pushbuffer bo using OUT_RING. The speed - before nouveau_bo_wr32(): 677k/sec - after: 475k/sec This patch implements OUT_RINGp() for copying an arbitrary number of dwords from an array to the pushbuffer bo. All OUT_RING copy loops are replaced with calls to OUT_RINGp(). This brings aa10text speed to 785k/sec. The tests have been run on nv28, Athlon64 3000+ (x86_64) and oprofile running. Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nouveau_dma.c | 13 +++++++++++++ drivers/gpu/drm/nouveau/nouveau_dma.h | 3 +++ drivers/gpu/drm/nouveau/nouveau_gem.c | 3 +-- drivers/gpu/drm/nouveau/nv04_fbcon.c | 14 ++++++++------ drivers/gpu/drm/nouveau/nv50_fbcon.c | 4 ++-- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 183a7d5..0025c3d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c @@ -90,6 +90,19 @@ nouveau_dma_init(struct nouveau_channel *chan) return 0; } +void +OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned nr_dwords) +{ + bool is_iomem; + u32 *mem = ttm_kmap_obj_virtual(&chan->pushbuf_bo->kmap, &is_iomem); + mem = &mem[chan->dma.cur]; + if (is_iomem) + memcpy_toio((void __force __iomem *)mem, data, nr_dwords * 4); + else + memcpy(mem, data, nr_dwords * 4); + chan->dma.cur += nr_dwords; +} + static inline bool READ_GET(struct nouveau_channel *chan, uint32_t *get) { diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index 072d9b9..cdaa37d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h @@ -109,6 +109,9 @@ OUT_RING(struct nouveau_channel *chan, int data) nouveau_bo_wr32(chan->pushbuf_bo, chan->dma.cur++, data); } +extern void +OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned nr_dwords); + static inline void BEGIN_RING(struct nouveau_channel *chan, int subc, int mthd, int size) { diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index d7e6e3b..ba3f93e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -528,8 +528,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, if (ret) goto out; - for (i = 0; i < req->nr_dwords; i++) - OUT_RING (chan, pushbuf[i]); + OUT_RINGp(chan, pushbuf, req->nr_dwords); ret = nouveau_fence_emit(fence); if (ret) { diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c index 648b435..14fc87f 100644 --- a/drivers/gpu/drm/nouveau/nv04_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c @@ -94,9 +94,12 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) struct drm_device *dev = par->dev; struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_channel *chan = dev_priv->channel; - uint32_t fg, bg, mask = ~(~0 >> (32 - info->var.bits_per_pixel)); - uint32_t dsize, width, *data = (uint32_t *) image->data; - int j, k = 0; + uint32_t fg; + uint32_t bg; + uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel)); + uint32_t dsize; + uint32_t width; + uint32_t *data = (uint32_t *)image->data; if (info->state != FBINFO_STATE_RUNNING) return; @@ -140,9 +143,8 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) } BEGIN_RING(chan, NvSubGdiRect, 0x0c00, iter_len); - for (j = iter_len; j--;) - OUT_RING(chan, data[k++]); - + OUT_RINGp(chan, data, iter_len); + data += iter_len; dsize -= iter_len; } diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50_fbcon.c index d7af9ed..d3807e3 100644 --- a/drivers/gpu/drm/nouveau/nv50_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c @@ -139,8 +139,8 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) dwords -= push; BEGIN_RING(chan, NvSub2D, 0x40000860, push); - while (push--) - OUT_RING(chan, *data++); + OUT_RINGp(chan, data, push); + data += push; } FIRE_RING (chan); -- 1.6.3.3
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 4/8] drm/nv50: proper notifier_bo access in nv50_display_vblank_crtc_handler()
Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nv50_display.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 49225c8..234133d 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -640,14 +640,12 @@ nv50_display_vblank_crtc_handler(struct drm_device *dev, int crtc) struct drm_nouveau_private *dev_priv = dev->dev_private; struct nouveau_channel *chan; struct list_head *entry, *tmp; - uint32_t *sem; list_for_each_safe(entry, tmp, &dev_priv->vbl_waiting) { chan = list_entry(entry, struct nouveau_channel, nvsw.vbl_wait); - sem = chan->notifier_bo->kmap.virtual; - sem[chan->nvsw.vblsem_offset] = chan->nvsw.vblsem_rval; - + nouveau_bo_wr32(chan->notifier_bo, chan->nvsw.vblsem_offset, + chan->nvsw.vblsem_rval); list_del(&chan->nvsw.vbl_wait); } } -- 1.6.3.3
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 5/8] drm/nouveau: access fbcon notifier via bo accessors
Notifier can live in system memory or VRAM, hence they must be accessed using the bo wrapper functions. Remove the redundant member nouveau_channel::m2mf_ntfy_map. Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nouveau_dma.c | 2 -- drivers/gpu/drm/nouveau/nouveau_drv.h | 1 - drivers/gpu/drm/nouveau/nouveau_fbcon.c | 5 +++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 0025c3d..b1f3a71 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c @@ -62,8 +62,6 @@ nouveau_dma_init(struct nouveau_channel *chan) ret = nouveau_bo_map(chan->notifier_bo); if (ret) return ret; - chan->m2mf_ntfy_map = chan->notifier_bo->kmap.virtual; - chan->m2mf_ntfy_map += chan->m2mf_ntfy; } /* Initialise DMA vars */ diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 8516fda..556b0fa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -203,7 +203,6 @@ struct nouveau_channel /* GPU object info for stuff used in-kernel (mm_enabled) */ uint32_t m2mf_ntfy; - volatile uint32_t *m2mf_ntfy_map; uint32_t vram_handle; uint32_t gart_handle; bool accel_done; diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 645b087..6a21a70 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -71,12 +71,13 @@ nouveau_fbcon_sync(struct fb_info *info) OUT_RING (chan, 0); BEGIN_RING(chan, 0, 0x0100, 1); OUT_RING (chan, 0); - chan->m2mf_ntfy_map[3] = 0xffffffff; + nouveau_bo_wr32(chan->notifier_bo, chan->m2mf_ntfy + 3, 0xffffffff); FIRE_RING (chan); ret = -EBUSY; for (i = 0; i < 100000; i++) { - if (chan->m2mf_ntfy_map[3] == 0) { + if (nouveau_bo_rd32(chan->notifier_bo, chan->m2mf_ntfy + 3) + == 0) { ret = 0; break; } -- 1.6.3.3
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 6/8] drm/nouveau: screen_base and lut must be iomem
This introduces nvbo_kmap_obj_iovirtual() for cases where the bo memory is guaranteed (or supposed) to be iomem. Fbcon assumes screen_base is iomem, and the crtc color LUT must reside in iomem. Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nouveau_drv.h | 11 +++++++++++ drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +- drivers/gpu/drm/nouveau/nv50_crtc.c | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 556b0fa..5aca302 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h @@ -95,6 +95,17 @@ nouveau_gem_object(struct drm_gem_object *gem) return gem ? gem->driver_private : NULL; } +/* TODO: submit equivalent to TTM generic API upstream? */ +static inline void __iomem * +nvbo_kmap_obj_iovirtual(struct nouveau_bo *nvbo) +{ + bool is_iomem; + void __iomem *ioptr = (void __force __iomem *)ttm_kmap_obj_virtual( + &nvbo->kmap, &is_iomem); + WARN_ON_ONCE(ioptr && !is_iomem); + return ioptr; +} + struct mem_block { struct mem_block *next; struct mem_block *prev; diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 6a21a70..2c261fd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -588,7 +588,7 @@ static int nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width, info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_IMAGEBLIT; - info->screen_base = nouveau_fb->nvbo->kmap.virtual; + info->screen_base = nvbo_kmap_obj_iovirtual(nouveau_fb->nvbo); info->screen_size = size; info->pseudo_palette = fb->pseudo_palette; diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index f1c67bf..f3dab44 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c @@ -43,7 +43,7 @@ nv50_crtc_lut_load(struct nouveau_crtc *crtc) { struct drm_device *dev = crtc->base.dev; uint32_t index = 0, i; - void __iomem *lut = crtc->lut.nvbo->kmap.virtual; + void __iomem *lut = nvbo_kmap_obj_iovirtual(crtc->lut.nvbo); NV_DEBUG(dev, "\n"); -- 1.6.3.3
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 7/8] drm/nouveau: remove redundant check in nouveau_bo_del_ttm()
ttm_bo_kunmap() already checks if the bo is not mapped. Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nouveau_bo.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index e7a8d60..eba257a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -39,8 +39,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); struct nouveau_bo *nvbo = nouveau_bo(bo); - if (unlikely(nvbo->kmap.virtual)) - ttm_bo_kunmap(&nvbo->kmap); + ttm_bo_kunmap(&nvbo->kmap); if (unlikely(nvbo->gem)) DRM_ERROR("bo %p still attached to GEM object\n", bo); -- 1.6.3.3
Pekka Paalanen
2009-Aug-17 13:42 UTC
[Nouveau] [PATCH 8/8] drm/nouveau: remove mask in nv04_fbcon_imageblit()
The local variable 'mask' is simply confusing, the value is equivalent to zero. Why? The literal 0 is by default signed. So is ~0. Bitshift to right of a signed type is implementation defined, gcc replicates the sign bit. Therefore ~0 >> x equals always ~0, and the final 'mask' value is 0. Remove this obfuscation. Signed-off-by: Pekka Paalanen <pq at iki.fi> --- drivers/gpu/drm/nouveau/nv04_fbcon.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c index 14fc87f..3d19492 100644 --- a/drivers/gpu/drm/nouveau/nv04_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c @@ -96,7 +96,6 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) struct nouveau_channel *chan = dev_priv->channel; uint32_t fg; uint32_t bg; - uint32_t mask = ~(~0 >> (32 - info->var.bits_per_pixel)); uint32_t dsize; uint32_t width; uint32_t *data = (uint32_t *)image->data; @@ -119,8 +118,8 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) width = (image->width + 31) & ~31; dsize = (width * image->height) >> 5; - fg = ((uint32_t *) info->pseudo_palette)[image->fg_color] | mask; - bg = ((uint32_t *) info->pseudo_palette)[image->bg_color] | mask; + fg = ((uint32_t *) info->pseudo_palette)[image->fg_color]; + bg = ((uint32_t *) info->pseudo_palette)[image->bg_color]; BEGIN_RING(chan, NvSubGdiRect, 0x0be4, 7); OUT_RING (chan, (image->dy << 16) | (image->dx & 0xffff)); -- 1.6.3.3
Maybe Matching Threads
- [PATCH 1/6] drm/nouveau: bo read/write wrappers for nv04_crtc.c
- [PATCH 1/2] drm/nv50: align size of buffer object to the right boundaries.
- [PATCH 1/4] drm/nouveau: refactor nouveau_dma_wait()
- [PATCH] drm/nouveau: rewrite nouveau_dma_wait()
- [PATCH 1/2] libdrm/nouveau: new optimized libdrm pushbuffer ABI