diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-24 12:37:59 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-25 13:34:31 +0100 |
commit | a932c73ab7b0e768ceb723ec280847e55c5cf495 (patch) | |
tree | 5c36b01199344f002ec9a43550e48544c6ad4d0c /overlay | |
parent | 68c63ddd36bc8e5379bf9573c24894246f5d0aa7 (diff) |
overlay: simplify types for object counts for 32/64bit porting
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/gem-objects.c | 6 | ||||
-rw-r--r-- | overlay/gem-objects.h | 11 | ||||
-rw-r--r-- | overlay/overlay.c | 4 |
3 files changed, 10 insertions, 11 deletions
diff --git a/overlay/gem-objects.c b/overlay/gem-objects.c index 8c8ae21b..d5044bc0 100644 --- a/overlay/gem-objects.c +++ b/overlay/gem-objects.c @@ -119,11 +119,11 @@ int gem_objects_update(struct gem_objects *obj) b = buf; - sscanf(b, "%d objects, %ld bytes", + sscanf(b, "%lu objects, %lu bytes", &obj->total_count, &obj->total_bytes); b = strchr(b, '\n'); - sscanf(b, "%*d [%*d] objects, %ld [%ld] bytes in gtt", + sscanf(b, "%*d [%*d] objects, %lu [%lu] bytes in gtt", &obj->total_gtt, &obj->total_aperture); ret = 0; @@ -144,7 +144,7 @@ int gem_objects_update(struct gem_objects *obj) break; /* Xorg: 35 objects, 16347136 bytes (0 active, 12103680 inactive, 0 unbound) */ - sscanf(++b, "%256s %u objects, %lu bytes", + sscanf(++b, "%256s %lu objects, %lu bytes", comm->name, &comm->count, &comm->bytes); insert_sorted(obj, comm); diff --git a/overlay/gem-objects.h b/overlay/gem-objects.h index 45cc1a67..2019ad4d 100644 --- a/overlay/gem-objects.h +++ b/overlay/gem-objects.h @@ -28,15 +28,14 @@ #include <stdint.h> struct gem_objects { - uint64_t total_bytes; - uint32_t total_count; - uint64_t total_gtt, total_aperture; - uint64_t max_gtt, max_aperture; + long unsigned total_bytes, total_count; + long unsigned total_gtt, total_aperture; + long unsigned max_gtt, max_aperture; struct gem_objects_comm { struct gem_objects_comm *next; char name[256]; - uint64_t bytes; - uint32_t count; + long unsigned bytes; + long unsigned count; } *comm; }; diff --git a/overlay/overlay.c b/overlay/overlay.c index 3ec240db..1f1eee79 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -681,7 +681,7 @@ static void show_gem_objects(struct overlay_context *ctx, struct overlay_gem_obj cairo_pattern_destroy(linear); cairo_fill(ctx->cr); - sprintf(buf, "Total: %ldMB, %d objects", + sprintf(buf, "Total: %ldMB, %ld objects", go->gem_objects.total_bytes >> 20, go->gem_objects.total_count); cairo_set_source_rgba(ctx->cr, 1, 1, 1, 1); cairo_move_to(ctx->cr, x, y); @@ -692,7 +692,7 @@ static void show_gem_objects(struct overlay_context *ctx, struct overlay_gem_obj if ((comm->bytes >> 20) == 0) break; - sprintf(buf, " %s %ldMB, %d objects", + sprintf(buf, " %s %ldMB, %ld objects", comm->name, comm->bytes >> 20, comm->count); cairo_set_source_rgba(ctx->cr, 1, 1, 1, 1); cairo_move_to(ctx->cr, x, y); |