Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329351
b: refs/heads/master
c: 86a1ee2
h: refs/heads/master
i:
  329349: c5981e3
  329347: 01e4587
  329343: 7a53f97
v: v3
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Aug 24, 2012
1 parent 67da7da commit 47a6211
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 25 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: 53621860c38caff37fff99ba5f0b817511907bc4
refs/heads/master: 86a1ee26bb60e1ab8984e92f0e9186c354670aed
6 changes: 4 additions & 2 deletions trunk/drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,8 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
void i915_gem_free_object(struct drm_gem_object *obj);
int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj,
uint32_t alignment,
bool map_and_fenceable);
bool map_and_fenceable,
bool nonblocking);
void i915_gem_object_unpin(struct drm_i915_gem_object *obj);
int __must_check i915_gem_object_unbind(struct drm_i915_gem_object *obj);
void i915_gem_release_mmap(struct drm_i915_gem_object *obj);
Expand Down Expand Up @@ -1454,7 +1455,8 @@ void i915_gem_init_global_gtt(struct drm_device *dev,
int __must_check i915_gem_evict_something(struct drm_device *dev, int min_size,
unsigned alignment,
unsigned cache_level,
bool mappable);
bool mappable,
bool nonblock);
int i915_gem_evict_everything(struct drm_device *dev);

/* i915_gem_stolen.c */
Expand Down
29 changes: 16 additions & 13 deletions trunk/drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *o
static void i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj);
static __must_check int i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
unsigned alignment,
bool map_and_fenceable);
bool map_and_fenceable,
bool nonblocking);
static int i915_gem_phys_pwrite(struct drm_device *dev,
struct drm_i915_gem_object *obj,
struct drm_i915_gem_pwrite *args,
Expand Down Expand Up @@ -609,7 +610,7 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
char __user *user_data;
int page_offset, page_length, ret;

ret = i915_gem_object_pin(obj, 0, true);
ret = i915_gem_object_pin(obj, 0, true, true);
if (ret)
goto out;

Expand Down Expand Up @@ -925,18 +926,16 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
goto out;
}

if (obj->gtt_space &&
obj->cache_level == I915_CACHE_NONE &&
if (obj->cache_level == I915_CACHE_NONE &&
obj->tiling_mode == I915_TILING_NONE &&
obj->map_and_fenceable &&
obj->base.write_domain != I915_GEM_DOMAIN_CPU) {
ret = i915_gem_gtt_pwrite_fast(dev, obj, args, file);
/* Note that the gtt paths might fail with non-page-backed user
* pointers (e.g. gtt mappings when moving data between
* textures). Fallback to the shmem path in that case. */
}

if (ret == -EFAULT)
if (ret == -EFAULT || ret == -ENOSPC)
ret = i915_gem_shmem_pwrite(dev, obj, args, file);

out:
Expand Down Expand Up @@ -1115,7 +1114,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
goto unlock;
}
if (!obj->gtt_space) {
ret = i915_gem_object_bind_to_gtt(obj, 0, true);
ret = i915_gem_object_bind_to_gtt(obj, 0, true, false);
if (ret)
goto unlock;

Expand Down Expand Up @@ -2772,7 +2771,8 @@ static void i915_gem_verify_gtt(struct drm_device *dev)
static int
i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
unsigned alignment,
bool map_and_fenceable)
bool map_and_fenceable,
bool nonblocking)
{
struct drm_device *dev = obj->base.dev;
drm_i915_private_t *dev_priv = dev->dev_private;
Expand Down Expand Up @@ -2848,7 +2848,8 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
if (obj->gtt_space == NULL) {
ret = i915_gem_evict_something(dev, size, alignment,
obj->cache_level,
map_and_fenceable);
map_and_fenceable,
nonblocking);
if (ret)
return ret;

Expand Down Expand Up @@ -3188,7 +3189,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
* (e.g. libkms for the bootup splash), we have to ensure that we
* always use map_and_fenceable for all scanout buffers.
*/
ret = i915_gem_object_pin(obj, alignment, true);
ret = i915_gem_object_pin(obj, alignment, true, false);
if (ret)
return ret;

Expand Down Expand Up @@ -3325,7 +3326,8 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file)
int
i915_gem_object_pin(struct drm_i915_gem_object *obj,
uint32_t alignment,
bool map_and_fenceable)
bool map_and_fenceable,
bool nonblocking)
{
int ret;

Expand All @@ -3349,7 +3351,8 @@ i915_gem_object_pin(struct drm_i915_gem_object *obj,

if (obj->gtt_space == NULL) {
ret = i915_gem_object_bind_to_gtt(obj, alignment,
map_and_fenceable);
map_and_fenceable,
nonblocking);
if (ret)
return ret;
}
Expand Down Expand Up @@ -3407,7 +3410,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
obj->user_pin_count++;
obj->pin_filp = file;
if (obj->user_pin_count == 1) {
ret = i915_gem_object_pin(obj, args->alignment, true);
ret = i915_gem_object_pin(obj, args->alignment, true, false);
if (ret)
goto out;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/gpu/drm/i915/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static int create_default_context(struct drm_i915_private *dev_priv)
* default context.
*/
dev_priv->ring[RCS].default_context = ctx;
ret = i915_gem_object_pin(ctx->obj, CONTEXT_ALIGN, false);
ret = i915_gem_object_pin(ctx->obj, CONTEXT_ALIGN, false, false);
if (ret)
goto err_destroy;

Expand Down Expand Up @@ -374,7 +374,7 @@ static int do_switch(struct i915_hw_context *to)
if (from_obj == to->obj)
return 0;

ret = i915_gem_object_pin(to->obj, CONTEXT_ALIGN, false);
ret = i915_gem_object_pin(to->obj, CONTEXT_ALIGN, false, false);
if (ret)
return ret;

Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/gpu/drm/i915/i915_gem_evict.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mark_free(struct drm_i915_gem_object *obj, struct list_head *unwind)
int
i915_gem_evict_something(struct drm_device *dev, int min_size,
unsigned alignment, unsigned cache_level,
bool mappable)
bool mappable, bool nonblocking)
{
drm_i915_private_t *dev_priv = dev->dev_private;
struct list_head eviction_list, unwind_list;
Expand Down Expand Up @@ -92,12 +92,16 @@ i915_gem_evict_something(struct drm_device *dev, int min_size,
goto found;
}

if (nonblocking)
goto none;

/* Now merge in the soon-to-be-expired objects... */
list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) {
if (mark_free(obj, &unwind_list))
goto found;
}

none:
/* Nothing found, clean up and bail out! */
while (!list_empty(&unwind_list)) {
obj = list_first_entry(&unwind_list,
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/i915/i915_gem_execbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pin_and_fence_object(struct drm_i915_gem_object *obj,
obj->tiling_mode != I915_TILING_NONE;
need_mappable = need_fence || need_reloc_mappable(obj);

ret = i915_gem_object_pin(obj, entry->alignment, need_mappable);
ret = i915_gem_object_pin(obj, entry->alignment, need_mappable, false);
if (ret)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/i915/intel_overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ void intel_setup_overlay(struct drm_device *dev)
}
overlay->flip_addr = reg_bo->phys_obj->handle->busaddr;
} else {
ret = i915_gem_object_pin(reg_bo, PAGE_SIZE, true);
ret = i915_gem_object_pin(reg_bo, PAGE_SIZE, true, false);
if (ret) {
DRM_ERROR("failed to pin overlay register bo\n");
goto out_free_bo;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/gpu/drm/i915/intel_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2138,7 +2138,7 @@ intel_alloc_context_page(struct drm_device *dev)
return NULL;
}

ret = i915_gem_object_pin(ctx, 4096, true);
ret = i915_gem_object_pin(ctx, 4096, true, false);
if (ret) {
DRM_ERROR("failed to pin power context: %d\n", ret);
goto err_unref;
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/gpu/drm/i915/intel_ringbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ init_pipe_control(struct intel_ring_buffer *ring)

i915_gem_object_set_cache_level(obj, I915_CACHE_LLC);

ret = i915_gem_object_pin(obj, 4096, true);
ret = i915_gem_object_pin(obj, 4096, true, false);
if (ret)
goto err_unref;

Expand Down Expand Up @@ -979,7 +979,7 @@ static int init_status_page(struct intel_ring_buffer *ring)

i915_gem_object_set_cache_level(obj, I915_CACHE_LLC);

ret = i915_gem_object_pin(obj, 4096, true);
ret = i915_gem_object_pin(obj, 4096, true, false);
if (ret != 0) {
goto err_unref;
}
Expand Down Expand Up @@ -1036,7 +1036,7 @@ static int intel_init_ring_buffer(struct drm_device *dev,

ring->obj = obj;

ret = i915_gem_object_pin(obj, PAGE_SIZE, true);
ret = i915_gem_object_pin(obj, PAGE_SIZE, true, false);
if (ret)
goto err_unref;

Expand Down

0 comments on commit 47a6211

Please sign in to comment.