Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318768
b: refs/heads/master
c: b259b31
h: refs/heads/master
v: v3
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Jul 25, 2012
1 parent eea5007 commit ec9c804
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eeef9b3874d756405ab8f71b4012a2e7ce31458e
refs/heads/master: b259b3120607f642daabdaadc99430a306899ffe
18 changes: 4 additions & 14 deletions trunk/drivers/gpu/drm/i915/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,11 @@ static int do_switch(struct drm_i915_gem_object *from_obj,
from_obj->dirty = 1;
BUG_ON(from_obj->ring != to->ring);
i915_gem_object_unpin(from_obj);

drm_gem_object_unreference(&from_obj->base);
}

drm_gem_object_reference(&to->obj->base);
ring->last_context_obj = to->obj;
to->is_initialized = true;

Expand Down Expand Up @@ -470,20 +473,7 @@ int i915_switch_context(struct intel_ring_buffer *ring,
if (from_obj == to->obj)
return 0;

ret = do_switch(from_obj, to, i915_gem_next_request_seqno(to->ring));
if (ret)
return ret;

/* Just to make the code a little cleaner we take the object reference
* after the switch was successful. It would be more intuitive to ref
* the 'to' object before the switch but we know the refcount must be >0
* if context_get() succeeded, and we hold struct mutex. So it's safe to
* do this here/now
*/
drm_gem_object_reference(&to->obj->base);
if (from_obj != NULL)
drm_gem_object_unreference(&from_obj->base);
return ret;
return do_switch(from_obj, to, i915_gem_next_request_seqno(to->ring));
}

int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
Expand Down

0 comments on commit ec9c804

Please sign in to comment.