aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_execbuffer.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-12-08 05:43:06 -0500
committerChris Wilson <chris@chris-wilson.co.uk>2010-12-09 14:46:22 -0500
commitb8f7ab1788f23d79084f051bb9ae3cb02b55bff3 (patch)
tree2050906891ce977e93ac36236ed6ccbbdd00380c /drivers/gpu/drm/i915/i915_gem_execbuffer.c
parent67731b87e9572801c41f8fe779750babdd362416 (diff)
drm/i915: Mark the user reloc error paths as unlikely
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_execbuffer.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3305ae528de4..fda0dc858a1f 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -301,14 +301,14 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
301 /* The target buffer should have appeared before us in the 301 /* The target buffer should have appeared before us in the
302 * exec_object list, so it should have a GTT space bound by now. 302 * exec_object list, so it should have a GTT space bound by now.
303 */ 303 */
304 if (target_offset == 0) { 304 if (unlikely(target_offset == 0)) {
305 DRM_ERROR("No GTT space found for object %d\n", 305 DRM_ERROR("No GTT space found for object %d\n",
306 reloc->target_handle); 306 reloc->target_handle);
307 return ret; 307 return ret;
308 } 308 }
309 309
310 /* Validate that the target is in a valid r/w GPU domain */ 310 /* Validate that the target is in a valid r/w GPU domain */
311 if (reloc->write_domain & (reloc->write_domain - 1)) { 311 if (unlikely(reloc->write_domain & (reloc->write_domain - 1))) {
312 DRM_ERROR("reloc with multiple write domains: " 312 DRM_ERROR("reloc with multiple write domains: "
313 "obj %p target %d offset %d " 313 "obj %p target %d offset %d "
314 "read %08x write %08x", 314 "read %08x write %08x",
@@ -318,8 +318,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
318 reloc->write_domain); 318 reloc->write_domain);
319 return ret; 319 return ret;
320 } 320 }
321 if (reloc->write_domain & I915_GEM_DOMAIN_CPU || 321 if (unlikely((reloc->write_domain | reloc->read_domains) & I915_GEM_DOMAIN_CPU)) {
322 reloc->read_domains & I915_GEM_DOMAIN_CPU) {
323 DRM_ERROR("reloc with read/write CPU domains: " 322 DRM_ERROR("reloc with read/write CPU domains: "
324 "obj %p target %d offset %d " 323 "obj %p target %d offset %d "
325 "read %08x write %08x", 324 "read %08x write %08x",
@@ -329,8 +328,8 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
329 reloc->write_domain); 328 reloc->write_domain);
330 return ret; 329 return ret;
331 } 330 }
332 if (reloc->write_domain && target_obj->pending_write_domain && 331 if (unlikely(reloc->write_domain && target_obj->pending_write_domain &&
333 reloc->write_domain != target_obj->pending_write_domain) { 332 reloc->write_domain != target_obj->pending_write_domain)) {
334 DRM_ERROR("Write domain conflict: " 333 DRM_ERROR("Write domain conflict: "
335 "obj %p target %d offset %d " 334 "obj %p target %d offset %d "
336 "new %08x old %08x\n", 335 "new %08x old %08x\n",
@@ -351,7 +350,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
351 return 0; 350 return 0;
352 351
353 /* Check that the relocation address is valid... */ 352 /* Check that the relocation address is valid... */
354 if (reloc->offset > obj->base.size - 4) { 353 if (unlikely(reloc->offset > obj->base.size - 4)) {
355 DRM_ERROR("Relocation beyond object bounds: " 354 DRM_ERROR("Relocation beyond object bounds: "
356 "obj %p target %d offset %d size %d.\n", 355 "obj %p target %d offset %d size %d.\n",
357 obj, reloc->target_handle, 356 obj, reloc->target_handle,
@@ -359,7 +358,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
359 (int) obj->base.size); 358 (int) obj->base.size);
360 return ret; 359 return ret;
361 } 360 }
362 if (reloc->offset & 3) { 361 if (unlikely(reloc->offset & 3)) {
363 DRM_ERROR("Relocation not 4-byte aligned: " 362 DRM_ERROR("Relocation not 4-byte aligned: "
364 "obj %p target %d offset %d.\n", 363 "obj %p target %d offset %d.\n",
365 obj, reloc->target_handle, 364 obj, reloc->target_handle,
@@ -368,7 +367,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
368 } 367 }
369 368
370 /* and points to somewhere within the target object. */ 369 /* and points to somewhere within the target object. */
371 if (reloc->delta >= target_obj->size) { 370 if (unlikely(reloc->delta >= target_obj->size)) {
372 DRM_ERROR("Relocation beyond target object bounds: " 371 DRM_ERROR("Relocation beyond target object bounds: "
373 "obj %p target %d delta %d size %d.\n", 372 "obj %p target %d delta %d size %d.\n",
374 obj, reloc->target_handle, 373 obj, reloc->target_handle,