diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-19 16:22:20 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-19 16:51:50 +0100 |
commit | 15d3eea7004822e5cbd48d676692e1b6a2b26d3e (patch) | |
tree | d0a43a88e2b8e16d3ec7165dfe60b510cb6b8c6e | |
parent | e4fce3b7801038e4f64d848a0995f4b441b4d2aa (diff) |
sna: Handle mixed bo/buffers in assertions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.h | 14 | ||||
-rw-r--r-- | src/sna/sna_io.c | 8 | ||||
-rw-r--r-- | src/sna/sna_render.c | 2 | ||||
-rw-r--r-- | src/sna/sna_video.c | 2 |
4 files changed, 17 insertions, 9 deletions
diff --git a/src/sna/kgem.h b/src/sna/kgem.h index b038bb1e..f7ee5b4c 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -420,16 +420,24 @@ int kgem_bo_fenced_size(struct kgem *kgem, struct kgem_bo *bo); void kgem_get_tile_size(struct kgem *kgem, int tiling, int *tile_width, int *tile_height, int *tile_size); +static inline int __kgem_buffer_size(struct kgem_bo *bo) +{ + assert(bo->proxy && bo->io); + return bo->size.bytes; +} + static inline int kgem_bo_size(struct kgem_bo *bo) { assert(!(bo->proxy && bo->io)); return PAGE_SIZE * bo->size.pages.count; } -static inline int kgem_buffer_size(struct kgem_bo *bo) +static inline int __kgem_bo_size(struct kgem_bo *bo) { - assert(bo->proxy && bo->io); - return bo->size.bytes; + if (bo->io) + return __kgem_buffer_size(bo); + else + return __kgem_bo_size(bo); } static inline bool kgem_bo_blt_pitch_is_ok(struct kgem *kgem, diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index f1df84a2..b53143f3 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -438,7 +438,7 @@ fallback: _kgem_set_mode(kgem, KGEM_BLT); tmp_box += nbox_this_time; } while (1); - assert(offset == kgem_buffer_size(dst_bo)); + assert(offset == __kgem_buffer_size(dst_bo)); kgem_buffer_read_sync(kgem, dst_bo); @@ -470,7 +470,7 @@ fallback: src += pitch * height; } while (--nbox); - assert(src - (char *)ptr == kgem_buffer_size(dst_bo)); + assert(src - (char *)ptr == __kgem_buffer_size(dst_bo)); kgem_bo_destroy(kgem, dst_bo); sna->blt_state.fill_bo = 0; } @@ -841,7 +841,7 @@ tile: box++; offset += pitch * height; } while (--nbox_this_time); - assert(offset == kgem_buffer_size(src_bo)); + assert(offset == __kgem_buffer_size(src_bo)); if (nbox) { _kgem_submit(kgem); @@ -1079,7 +1079,7 @@ fallback: box++; offset += pitch * height; } while (--nbox_this_time); - assert(offset == kgem_buffer_size(src_bo)); + assert(offset == __kgem_buffer_size(src_bo)); if (nbox) { _kgem_submit(kgem); diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index fd105f49..e503586e 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -1604,7 +1604,7 @@ do_fixup: w, h); pixman_image_unref(src); } else { - memset(ptr, 0, kgem_buffer_size(channel->bo)); + memset(ptr, 0, __kgem_buffer_size(channel->bo)); dst = src; } } diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c index b76a3c47..b8690ece 100644 --- a/src/sna/sna_video.c +++ b/src/sna/sna_video.c @@ -102,7 +102,7 @@ sna_video_buffer(struct sna *sna, struct sna_video_frame *frame) { /* Free the current buffer if we're going to have to reallocate */ - if (video->buf && kgem_bo_size(video->buf) < frame->size) + if (video->buf && __kgem_bo_size(video->buf) < frame->size) sna_video_free_buffers(sna, video); if (video->buf == NULL) |