summaryrefslogtreecommitdiff
path: root/src/drm
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-04-29 15:19:18 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-04-30 10:16:23 +0100
commit07122f37d11eabe62bc9c81ccbf71bbe8b7a1005 (patch)
tree7075c26d696f75d006bd273f1482d8346557dc0f /src/drm
parent4cb733c28551f4a34cd4a225b8d797a55bf9b977 (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.c11
-rw-r--r--src/drm/cairo-drm-i965-shader.c11
-rw-r--r--src/drm/cairo-drm-intel-surface.c8
-rw-r--r--src/drm/cairo-drm-radeon-surface.c8
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);