Index: sys/external/bsd/drm2/dist/drm/radeon/radeon.h =================================================================== RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h,v retrieving revision 1.3 diff -p -u -r1.3 radeon.h --- sys/external/bsd/drm2/dist/drm/radeon/radeon.h 25 Jul 2014 12:47:18 -0000 1.3 +++ sys/external/bsd/drm2/dist/drm/radeon/radeon.h 13 Sep 2014 18:20:46 -0000 @@ -1077,6 +1077,8 @@ struct radeon_cs_parser { u32 ring; s32 priority; struct ww_acquire_ctx ticket; + /* XXX DEBUGGING HACK DON'T LET ME COMMIT */ + size_t nvalidated; }; static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx) Index: sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c =================================================================== RCS file: /cvsroot/src/sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c,v retrieving revision 1.1.1.1 diff -p -u -r1.1.1.1 radeon_cs.c --- sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c 16 Jul 2014 19:35:28 -0000 1.1.1.1 +++ sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c 13 Sep 2014 18:20:46 -0000 @@ -72,6 +72,18 @@ static void radeon_cs_buckets_get_list(s } } +static size_t +list_length(struct list_head *head) +{ + struct list_head *entry; + size_t n = 0; + + list_for_each(entry, head) + n++; + + return n; +} + static int radeon_cs_parser_relocs(struct radeon_cs_parser *p) { struct drm_device *ddev = p->rdev->ddev; @@ -177,6 +189,7 @@ static int radeon_cs_parser_relocs(struc p->vm_bos = radeon_vm_get_bos(p->rdev, p->ib.vm, &p->validated); + p->nvalidated = list_length(&p->validated); return radeon_bo_list_validate(p->rdev, &p->ticket, &p->validated, p->ring); } @@ -398,12 +411,23 @@ static void radeon_cs_parser_fini(struct * This slightly lowers the number of bytes moved by TTM * per frame under memory pressure. */ + size_t n0 __diagused = list_length(&parser->validated); + KASSERTMSG((n0 == parser->nvalidated), + "parser nvalidated changed: %zu != %zu\n", + parser->nvalidated, n0); list_sort(NULL, &parser->validated, cmp_size_smaller_first); + size_t n1 __diagused = list_length(&parser->validated); + KASSERTMSG((n0 == n1), + "list_sort changed length from %zu to %zu", n0, n1); ttm_eu_fence_buffer_objects(&parser->ticket, &parser->validated, parser->ib.fence); } else if (backoff) { + size_t n __diagused = list_length(&parser->validated); + KASSERTMSG((n == parser->nvalidated), + "parser nvalidated changed: %zu != %zu\n", + parser->nvalidated, n); ttm_eu_backoff_reservation(&parser->ticket, &parser->validated); }