intel_upload_blit_*: Fix reporting and generate junk instead of using random.
authorEric Anholt <eric@anholt.net>
Tue, 31 Mar 2009 02:09:00 +0000 (19:09 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 31 Mar 2009 02:09:00 +0000 (19:09 -0700)
Turns out that random completely overwhelmed the cost of the driver stuff
in _large.c.  I definitely want to generate data, but still be able to see
the driver's responsibility.

benchmarks/intel_upload_blit_large.c
benchmarks/intel_upload_blit_small.c

index 9fc2ee1..aec19c4 100644 (file)
@@ -77,12 +77,13 @@ do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
        uint32_t data[width * height];
        drm_intel_bo *src_bo;
        int i;
+       static uint32_t seed = 1;
 
        /* Generate some junk.  Real workloads would be doing a lot more
         * work to generate the junk.
         */
        for (i = 0; i < width * height; i++) {
-               data[i] = (uint32_t)random();
+               data[i] = seed++;
        }
 
        /* Upload the junk. */
@@ -145,7 +146,7 @@ int main(int argc, char **argv)
 
        printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
               end_time - start_time,
-              (double)OBJECT_WIDTH * OBJECT_HEIGHT * 4 /
+              (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
               (end_time - start_time));
 
        intel_batchbuffer_free(batch);
index 11ea5c0..719a8a1 100644 (file)
@@ -76,6 +76,7 @@ do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
        uint32_t data[64];
        drm_intel_bo *src_bo;
        int i;
+       static uint32_t seed = 1;
 
        src_bo = drm_intel_bo_alloc(bufmgr, "src", width * height * 4, 4096);
 
@@ -96,7 +97,7 @@ do_render(drm_intel_bufmgr *bufmgr, struct intel_batchbuffer *batch,
                        size = width * height - i;
 
                for (j = 0; j < size; j++)
-                       data[j] = (uint32_t)random();
+                       data[j] = seed++;
 
                /* Upload the junk. */
                drm_intel_bo_subdata(src_bo, i * 4, size * 4, data);
@@ -160,7 +161,7 @@ int main(int argc, char **argv)
 
        printf("%d iterations in %.03f secs: %.01f MB/sec\n", i,
               end_time - start_time,
-              (double)OBJECT_WIDTH * OBJECT_HEIGHT * 4 /
+              (double)i * OBJECT_WIDTH * OBJECT_HEIGHT * 4 / 1024.0 / 1024.0 /
               (end_time - start_time));
 
        intel_batchbuffer_free(batch);