diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-04-29 15:19:18 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-04-30 10:16:23 +0100 |
commit | 07122f37d11eabe62bc9c81ccbf71bbe8b7a1005 (patch) | |
tree | 7075c26d696f75d006bd273f1482d8346557dc0f /src/drm | |
parent | 4cb733c28551f4a34cd4a225b8d797a55bf9b977 (diff) |
surface: Convert snapshots from an array to a double-linked list.
Saves the memory allocation for the array, and the overhead of
maintaining the area for both insertions and more importantly deletes.
Diffstat (limited to 'src/drm')
-rw-r--r-- | src/drm/cairo-drm-i915-shader.c | 11 | ||||
-rw-r--r-- | src/drm/cairo-drm-i965-shader.c | 11 | ||||
-rw-r--r-- | src/drm/cairo-drm-intel-surface.c | 8 | ||||
-rw-r--r-- | src/drm/cairo-drm-radeon-surface.c | 8 |
4 files changed, 12 insertions, 26 deletions
diff --git a/src/drm/cairo-drm-i915-shader.c b/src/drm/cairo-drm-i915-shader.c index f216c298..4a7c6b99 100644 --- a/src/drm/cairo-drm-i915-shader.c +++ b/src/drm/cairo-drm-i915-shader.c @@ -1281,17 +1281,16 @@ i915_surface_clone (i915_device_t *device, if (unlikely (clone->intel.drm.base.status)) return clone->intel.drm.base.status; - status = _cairo_surface_attach_snapshot (&image->base, - &clone->intel.drm.base, - intel_surface_detach_snapshot); - if (likely (status == CAIRO_STATUS_SUCCESS)) - status = intel_snapshot_cache_insert (&device->intel, &clone->intel); - + status = intel_snapshot_cache_insert (&device->intel, &clone->intel); if (unlikely (status)) { cairo_surface_destroy (&clone->intel.drm.base); return status; } + _cairo_surface_attach_snapshot (&image->base, + &clone->intel.drm.base, + intel_surface_detach_snapshot); + *clone_out = clone; return CAIRO_STATUS_SUCCESS; } diff --git a/src/drm/cairo-drm-i965-shader.c b/src/drm/cairo-drm-i965-shader.c index d76726c7..377b478d 100644 --- a/src/drm/cairo-drm-i965-shader.c +++ b/src/drm/cairo-drm-i965-shader.c @@ -282,17 +282,16 @@ i965_surface_clone (i965_device_t *device, return status; } - status = _cairo_surface_attach_snapshot (&image->base, - &clone->intel.drm.base, - intel_surface_detach_snapshot); - if (likely (status == CAIRO_STATUS_SUCCESS)) - status = intel_snapshot_cache_insert (&device->intel, &clone->intel); - + status = intel_snapshot_cache_insert (&device->intel, &clone->intel); if (unlikely (status)) { cairo_surface_destroy (&clone->intel.drm.base); return status; } + _cairo_surface_attach_snapshot (&image->base, + &clone->intel.drm.base, + intel_surface_detach_snapshot); + *clone_out = clone; return CAIRO_STATUS_SUCCESS; } diff --git a/src/drm/cairo-drm-intel-surface.c b/src/drm/cairo-drm-intel-surface.c index bfe181b1..9b06c228 100644 --- a/src/drm/cairo-drm-intel-surface.c +++ b/src/drm/cairo-drm-intel-surface.c @@ -90,13 +90,7 @@ intel_surface_acquire_source_image (void *abstract_surface, if (unlikely (status)) return status; - status = _cairo_surface_attach_snapshot (&surface->drm.base, - image, - cairo_surface_destroy); - if (unlikely (status)) { - cairo_surface_destroy (image); - return status; - } + _cairo_surface_attach_snapshot (&surface->drm.base, image, cairo_surface_destroy); DONE: *image_out = (cairo_image_surface_t *) cairo_surface_reference (image); diff --git a/src/drm/cairo-drm-radeon-surface.c b/src/drm/cairo-drm-radeon-surface.c index 2a5fb105..df95d8c6 100644 --- a/src/drm/cairo-drm-radeon-surface.c +++ b/src/drm/cairo-drm-radeon-surface.c @@ -106,13 +106,7 @@ radeon_surface_acquire_source_image (void *abstract_surface, if (unlikely (status)) return status; - status = _cairo_surface_attach_snapshot (&surface->base.base, - image, - cairo_surface_destroy); - if (unlikely (status)) { - cairo_surface_destroy (image); - return status; - } + _cairo_surface_attach_snapshot (&surface->base.base, image, cairo_surface_destroy); DONE: *image_out = (cairo_image_surface_t *) cairo_surface_reference (image); |