From 1f937389fc0a4783f08cd43d08f2b41e7dfa20d4 Mon Sep 17 00:00:00 2001 From: Tiago Vignatti Date: Thu, 2 Jul 2015 18:24:04 -0300 Subject: [PATCH] tests/vgem_fb_test: Remove volatile By simply removing volatile qualifier in draw() from uint32_t *ptr, memory accesses improve a lot in that test. We practically saw 1 order of magnitude in the performance of VGEM and the speed was equally on using drm_intel specific ioctls. The inclusion of volatile has forced the compiler to load and store the variable from memory on every run, hurting quite badly the performance. Therefore, performance is dropped due many read operations in the mapped pointer which is a no-no when objects are write-combining mapped. This patch also removes sleep, that bothers performance measurements --- tests/vgem_fb_test.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/vgem_fb_test.c b/tests/vgem_fb_test.c index dc1683c2..c6f16125 100644 --- a/tests/vgem_fb_test.c +++ b/tests/vgem_fb_test.c @@ -259,7 +259,7 @@ static void draw(struct context *ctx) { size_t bo_stride = gbm_bo_get_stride(ctx->gbm_buffer[fb_idx]); size_t bo_size = gbm_bo_get_stride(ctx->gbm_buffer[fb_idx]) * gbm_bo_get_height(ctx->gbm_buffer[fb_idx]); uint32_t *bo_ptr; - volatile uint32_t *ptr; + uint32_t *ptr; struct timeval start, end; for (sequence_subindex = 0; sequence_subindex < 4; sequence_subindex++) { @@ -306,11 +306,8 @@ static void draw(struct context *ctx) { break; } } - munmap(bo_ptr, bo_size); - usleep(1e6 / 120); /* 120 Hz */ - fb_idx = fb_idx ^ 1; } }