summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-03-08 15:32:15 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2010-03-08 15:37:17 +0000
commit5fb36fe5ab2a2b30da213557936122a829493906 (patch)
tree842ba2a35fb8b943807026ceba616ea712a77009 /src
parent4083f40fbd085dc2039fe62592cf1239373c7fca (diff)
drm/i965: Acquire device around commit.
Diffstat (limited to 'src')
-rw-r--r--src/drm/cairo-drm-i915-surface.c4
-rw-r--r--src/drm/cairo-drm-i965-shader.c13
-rw-r--r--src/drm/cairo-drm-i965-surface.c106
3 files changed, 82 insertions, 41 deletions
diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index 08eef5840..fbfa83543 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -696,7 +696,7 @@ i915_fixup_unbounded (i915_surface_t *dst,
assert (status == CAIRO_STATUS_SUCCESS);
}
- device = i915_device (dst);
+ device = i915_device (dst);
status = cairo_device_acquire (&device->intel.base.base);
if (unlikely (status))
return status;
@@ -838,7 +838,7 @@ i915_fixup_unbounded_boxes (i915_surface_t *dst,
assert (status == CAIRO_STATUS_SUCCESS);
}
- device = i915_device (dst);
+ device = i915_device (dst);
status = cairo_device_acquire (&device->intel.base.base);
if (unlikely (status))
goto err_shader;
diff --git a/src/drm/cairo-drm-i965-shader.c b/src/drm/cairo-drm-i965-shader.c
index 27e16447f..9fecbf189 100644
--- a/src/drm/cairo-drm-i965-shader.c
+++ b/src/drm/cairo-drm-i965-shader.c
@@ -793,8 +793,8 @@ i965_shader_set_clip (i965_shader_t *shader,
1. / s->intel.drm.height);
cairo_matrix_translate (&shader->clip.base.matrix,
- NEAREST_BIAS + clip->path->extents.x,
- NEAREST_BIAS + clip->path->extents.y);
+ NEAREST_BIAS - clip->path->extents.x,
+ NEAREST_BIAS - clip->path->extents.y);
}
static cairo_bool_t
@@ -2513,14 +2513,17 @@ i965_emit_composite (i965_device_t *device,
uint32_t draw_rectangle;
if (i965_shader_needs_surface_update (shader, device)) {
- /* Binding table pointers */
+ uint32_t offset;
+
+ offset = emit_binding_table (device, shader);
+
+ /* Only the PS uses the binding table */
OUT_BATCH (BRW_3DSTATE_BINDING_TABLE_POINTERS | 4);
OUT_BATCH (0); /* vs */
OUT_BATCH (0); /* gs */
OUT_BATCH (0); /* clip */
OUT_BATCH (0); /* sf */
- /* Only the PS uses the binding table */
- OUT_BATCH (emit_binding_table (device, shader));
+ OUT_BATCH (offset);
device->target = shader->target;
device->source = shader->source.base.bo;
diff --git a/src/drm/cairo-drm-i965-surface.c b/src/drm/cairo-drm-i965-surface.c
index 0e5ba2893..3aabd9976 100644
--- a/src/drm/cairo-drm-i965-surface.c
+++ b/src/drm/cairo-drm-i965-surface.c
@@ -725,6 +725,7 @@ i965_fixup_unbounded (i965_surface_t *dst,
cairo_clip_t *clip)
{
i965_shader_t shader;
+ i965_device_t *device;
cairo_status_t status;
i965_shader_init (&shader, dst, CAIRO_OPERATOR_CLEAR);
@@ -755,10 +756,14 @@ i965_fixup_unbounded (i965_surface_t *dst,
return status;
}
- status = i965_shader_commit (&shader, i965_device (dst));
- if (unlikely (status)) {
- i965_shader_fini (&shader);
+ device = i965_device (dst);
+ status = cairo_device_acquire (&device->intel.base.base);
+ if (unlikely (status))
return status;
+
+ status = i965_shader_commit (&shader, device);
+ if (unlikely (status)) {
+ goto BAIL;
}
/* top */
@@ -818,7 +823,9 @@ i965_fixup_unbounded (i965_surface_t *dst,
}
i965_shader_fini (&shader);
- return CAIRO_STATUS_SUCCESS;
+ BAIL:
+ cairo_device_release (&device->intel.base.base);
+ return status;
}
static cairo_status_t
@@ -903,19 +910,31 @@ i965_fixup_unbounded_boxes (i965_surface_t *dst,
}
if (likely (status == CAIRO_STATUS_SUCCESS && clear.num_boxes)) {
- status = i965_shader_commit (&shader, i965_device (dst));
- if (likely (status == CAIRO_STATUS_SUCCESS)) {
- for (chunk = &clear.chunks; chunk != NULL; chunk = chunk->next) {
- for (i = 0; i < chunk->count; i++) {
- int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x);
- int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y);
- int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
- int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
-
- i965_shader_add_rectangle (&shader, x1, y1, x2 - x1, y2 - y1);
- }
+ i965_device_t *device;
+
+ device = i965_device (dst);
+ status = cairo_device_acquire (&device->intel.base.base);
+ if (unlikely (status))
+ goto err_shader;
+
+ status = i965_shader_commit (&shader, device);
+ if (unlikely (status))
+ goto err_device;
+
+ for (chunk = &clear.chunks; chunk != NULL; chunk = chunk->next) {
+ for (i = 0; i < chunk->count; i++) {
+ int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x);
+ int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y);
+ int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
+ int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
+
+ i965_shader_add_rectangle (&shader, x1, y1, x2 - x1, y2 - y1);
}
}
+
+err_device:
+ cairo_device_release (&device->intel.base.base);
+err_shader:
i965_shader_fini (&shader);
}
@@ -938,6 +957,7 @@ _composite_boxes (i965_surface_t *dst,
const struct _cairo_boxes_chunk *chunk;
cairo_status_t status;
i965_shader_t shader;
+ i965_device_t *device;
int i;
/* If the boxes are not pixel-aligned, we will need to compute a real mask */
@@ -963,26 +983,36 @@ _composite_boxes (i965_surface_t *dst,
i965_shader_set_clip (&shader, clip);
}
+ device = i965_device (dst);
+ status = cairo_device_acquire (&device->intel.base.base);
+ if (unlikely (status))
+ goto err_shader;
+
status = i965_shader_commit (&shader, i965_device (dst));
- if (likely (status == CAIRO_STATUS_SUCCESS)) {
- for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
- cairo_box_t *box = chunk->base;
- for (i = 0; i < chunk->count; i++) {
- int x1 = _cairo_fixed_integer_round (box[i].p1.x);
- int y1 = _cairo_fixed_integer_round (box[i].p1.y);
- int x2 = _cairo_fixed_integer_round (box[i].p2.x);
- int y2 = _cairo_fixed_integer_round (box[i].p2.y);
+ if (unlikely (status))
+ goto err_device;
- if (x2 > x1 && y2 > y1)
- i965_shader_add_rectangle (&shader, x1, y1, x2 - x1, y2 - y1);
- }
+ for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
+ cairo_box_t *box = chunk->base;
+ for (i = 0; i < chunk->count; i++) {
+ int x1 = _cairo_fixed_integer_round (box[i].p1.x);
+ int y1 = _cairo_fixed_integer_round (box[i].p1.y);
+ int x2 = _cairo_fixed_integer_round (box[i].p2.x);
+ int y2 = _cairo_fixed_integer_round (box[i].p2.y);
+
+ if (x2 > x1 && y2 > y1)
+ i965_shader_add_rectangle (&shader, x1, y1, x2 - x1, y2 - y1);
}
}
- i965_shader_fini (&shader);
- if (status == CAIRO_STATUS_SUCCESS && ! extents->is_bounded)
+ if (! extents->is_bounded)
status = i965_fixup_unbounded_boxes (dst, extents, clip, boxes);
+ err_device:
+ cairo_device_release (&device->intel.base.base);
+ err_shader:
+ i965_shader_fini (&shader);
+
return status;
}
@@ -1081,6 +1111,7 @@ i965_surface_mask (void *abstract_dst,
i965_surface_t *dst = abstract_dst;
cairo_composite_rectangles_t extents;
i965_shader_t shader;
+ i965_device_t *device;
cairo_clip_t local_clip;
cairo_region_t *clip_region = NULL;
cairo_bool_t need_clip_surface = FALSE;
@@ -1115,14 +1146,14 @@ i965_surface_mask (void *abstract_dst,
source,
&extents.bounded);
if (unlikely (status))
- goto BAIL;
+ goto err_shader;
status = i965_shader_acquire_pattern (&shader,
&shader.mask,
mask,
&extents.bounded);
if (unlikely (status))
- goto BAIL;
+ goto err_shader;
if (clip != NULL) {
status = _cairo_clip_get_region (clip, &clip_region);
@@ -1132,9 +1163,14 @@ i965_surface_mask (void *abstract_dst,
i965_shader_set_clip (&shader, clip);
}
- status = i965_shader_commit (&shader, i965_device (dst));
+ device = i965_device (dst);
+ status = cairo_device_acquire (&device->intel.base.base);
if (unlikely (status))
- goto BAIL;
+ goto err_shader;
+
+ status = i965_shader_commit (&shader, device);
+ if (unlikely (status))
+ goto err_device;
if (clip_region != NULL) {
unsigned int n, num_rectangles;
@@ -1160,7 +1196,9 @@ i965_surface_mask (void *abstract_dst,
if (! extents.is_bounded)
status = i965_fixup_unbounded (dst, &extents, clip);
- BAIL:
+ err_device:
+ cairo_device_release (&device->intel.base.base);
+ err_shader:
i965_shader_fini (&shader);
if (have_clip)
_cairo_clip_fini (&local_clip);
@@ -1509,7 +1547,7 @@ i965_surface_create_internal (cairo_drm_device_t *base_dev,
tiling = I915_TILING_NONE;
#endif
surface->intel.drm.stride = i965_tiling_stride (tiling,
- surface->intel.drm.stride);
+ surface->intel.drm.stride);
height = i965_tiling_height (tiling, height);
assert (height <= I965_MAX_SIZE);