Commit d37cd8a8 authored by Dave Gordon's avatar Dave Gordon Committed by Tvrtko Ursulin

drm/i915: rename i915_gem_alloc_object() to i915_gem_object_create()

Because having both i915_gem_object_alloc() and i915_gem_alloc_object()
(with different return conventions) is just too confusing!

(i915_gem_object_alloc() is the low-level memory allocator, and remains
unchanged, whereas i915_gem_alloc_object() is a constructor that ALSO
initialises the newly-allocated object.)
Signed-off-by: default avatarDave Gordon <david.s.gordon@intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1461348872-4702-1-git-send-email-david.s.gordon@intel.com
parent ee0629cf
...@@ -2923,7 +2923,7 @@ void *i915_gem_object_alloc(struct drm_device *dev); ...@@ -2923,7 +2923,7 @@ void *i915_gem_object_alloc(struct drm_device *dev);
void i915_gem_object_free(struct drm_i915_gem_object *obj); void i915_gem_object_free(struct drm_i915_gem_object *obj);
void i915_gem_object_init(struct drm_i915_gem_object *obj, void i915_gem_object_init(struct drm_i915_gem_object *obj,
const struct drm_i915_gem_object_ops *ops); const struct drm_i915_gem_object_ops *ops);
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev, struct drm_i915_gem_object *i915_gem_object_create(struct drm_device *dev,
size_t size); size_t size);
struct drm_i915_gem_object *i915_gem_object_create_from_data( struct drm_i915_gem_object *i915_gem_object_create_from_data(
struct drm_device *dev, const void *data, size_t size); struct drm_device *dev, const void *data, size_t size);
......
...@@ -381,7 +381,7 @@ i915_gem_create(struct drm_file *file, ...@@ -381,7 +381,7 @@ i915_gem_create(struct drm_file *file,
return -EINVAL; return -EINVAL;
/* Allocate the new object */ /* Allocate the new object */
obj = i915_gem_alloc_object(dev, size); obj = i915_gem_object_create(dev, size);
if (obj == NULL) if (obj == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -4495,7 +4495,7 @@ static const struct drm_i915_gem_object_ops i915_gem_object_ops = { ...@@ -4495,7 +4495,7 @@ static const struct drm_i915_gem_object_ops i915_gem_object_ops = {
.put_pages = i915_gem_object_put_pages_gtt, .put_pages = i915_gem_object_put_pages_gtt,
}; };
struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev, struct drm_i915_gem_object *i915_gem_object_create(struct drm_device *dev,
size_t size) size_t size)
{ {
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
...@@ -5364,7 +5364,7 @@ i915_gem_object_create_from_data(struct drm_device *dev, ...@@ -5364,7 +5364,7 @@ i915_gem_object_create_from_data(struct drm_device *dev,
size_t bytes; size_t bytes;
int ret; int ret;
obj = i915_gem_alloc_object(dev, round_up(size, PAGE_SIZE)); obj = i915_gem_object_create(dev, round_up(size, PAGE_SIZE));
if (IS_ERR_OR_NULL(obj)) if (IS_ERR_OR_NULL(obj))
return obj; return obj;
......
...@@ -134,7 +134,7 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool, ...@@ -134,7 +134,7 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool,
if (obj == NULL) { if (obj == NULL) {
int ret; int ret;
obj = i915_gem_alloc_object(pool->dev, size); obj = i915_gem_object_create(pool->dev, size);
if (obj == NULL) if (obj == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
...@@ -178,7 +178,7 @@ i915_gem_alloc_context_obj(struct drm_device *dev, size_t size) ...@@ -178,7 +178,7 @@ i915_gem_alloc_context_obj(struct drm_device *dev, size_t size)
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
int ret; int ret;
obj = i915_gem_alloc_object(dev, size); obj = i915_gem_object_create(dev, size);
if (obj == NULL) if (obj == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
...@@ -57,7 +57,7 @@ static int render_state_init(struct render_state *so, struct drm_device *dev) ...@@ -57,7 +57,7 @@ static int render_state_init(struct render_state *so, struct drm_device *dev)
if (so->rodata->batch_items * 4 > 4096) if (so->rodata->batch_items * 4 > 4096)
return -EINVAL; return -EINVAL;
so->obj = i915_gem_alloc_object(dev, 4096); so->obj = i915_gem_object_create(dev, 4096);
if (so->obj == NULL) if (so->obj == NULL)
return -ENOMEM; return -ENOMEM;
......
...@@ -587,7 +587,7 @@ static struct drm_i915_gem_object *gem_allocate_guc_obj(struct drm_device *dev, ...@@ -587,7 +587,7 @@ static struct drm_i915_gem_object *gem_allocate_guc_obj(struct drm_device *dev,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
obj = i915_gem_alloc_object(dev, size); obj = i915_gem_object_create(dev, size);
if (!obj) if (!obj)
return NULL; return NULL;
......
...@@ -10318,7 +10318,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev, ...@@ -10318,7 +10318,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct drm_mode_fb_cmd2 mode_cmd = { 0 }; struct drm_mode_fb_cmd2 mode_cmd = { 0 };
obj = i915_gem_alloc_object(dev, obj = i915_gem_object_create(dev,
intel_framebuffer_size_for_mode(mode, bpp)); intel_framebuffer_size_for_mode(mode, bpp));
if (obj == NULL) if (obj == NULL)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
...@@ -150,7 +150,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper, ...@@ -150,7 +150,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
if (size * 2 < ggtt->stolen_usable_size) if (size * 2 < ggtt->stolen_usable_size)
obj = i915_gem_object_create_stolen(dev, size); obj = i915_gem_object_create_stolen(dev, size);
if (obj == NULL) if (obj == NULL)
obj = i915_gem_alloc_object(dev, size); obj = i915_gem_object_create(dev, size);
if (!obj) { if (!obj) {
DRM_ERROR("failed to allocate framebuffer\n"); DRM_ERROR("failed to allocate framebuffer\n");
ret = -ENOMEM; ret = -ENOMEM;
......
...@@ -1472,7 +1472,7 @@ static int lrc_setup_wa_ctx_obj(struct intel_engine_cs *engine, u32 size) ...@@ -1472,7 +1472,7 @@ static int lrc_setup_wa_ctx_obj(struct intel_engine_cs *engine, u32 size)
{ {
int ret; int ret;
engine->wa_ctx.obj = i915_gem_alloc_object(engine->dev, engine->wa_ctx.obj = i915_gem_object_create(engine->dev,
PAGE_ALIGN(size)); PAGE_ALIGN(size));
if (!engine->wa_ctx.obj) { if (!engine->wa_ctx.obj) {
DRM_DEBUG_DRIVER("alloc LRC WA ctx backing obj failed.\n"); DRM_DEBUG_DRIVER("alloc LRC WA ctx backing obj failed.\n");
...@@ -2665,7 +2665,7 @@ int intel_lr_context_deferred_alloc(struct intel_context *ctx, ...@@ -2665,7 +2665,7 @@ int intel_lr_context_deferred_alloc(struct intel_context *ctx,
/* One extra page as the sharing data between driver and GuC */ /* One extra page as the sharing data between driver and GuC */
context_size += PAGE_SIZE * LRC_PPHWSP_PN; context_size += PAGE_SIZE * LRC_PPHWSP_PN;
ctx_obj = i915_gem_alloc_object(dev, context_size); ctx_obj = i915_gem_object_create(dev, context_size);
if (!ctx_obj) { if (!ctx_obj) {
DRM_DEBUG_DRIVER("Alloc LRC backing obj failed.\n"); DRM_DEBUG_DRIVER("Alloc LRC backing obj failed.\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -1396,7 +1396,7 @@ void intel_setup_overlay(struct drm_device *dev) ...@@ -1396,7 +1396,7 @@ void intel_setup_overlay(struct drm_device *dev)
if (!OVERLAY_NEEDS_PHYSICAL(dev)) if (!OVERLAY_NEEDS_PHYSICAL(dev))
reg_bo = i915_gem_object_create_stolen(dev, PAGE_SIZE); reg_bo = i915_gem_object_create_stolen(dev, PAGE_SIZE);
if (reg_bo == NULL) if (reg_bo == NULL)
reg_bo = i915_gem_alloc_object(dev, PAGE_SIZE); reg_bo = i915_gem_object_create(dev, PAGE_SIZE);
if (reg_bo == NULL) if (reg_bo == NULL)
goto out_free; goto out_free;
overlay->reg_bo = reg_bo; overlay->reg_bo = reg_bo;
......
...@@ -671,7 +671,7 @@ intel_init_pipe_control(struct intel_engine_cs *engine) ...@@ -671,7 +671,7 @@ intel_init_pipe_control(struct intel_engine_cs *engine)
WARN_ON(engine->scratch.obj); WARN_ON(engine->scratch.obj);
engine->scratch.obj = i915_gem_alloc_object(engine->dev, 4096); engine->scratch.obj = i915_gem_object_create(engine->dev, 4096);
if (engine->scratch.obj == NULL) { if (engine->scratch.obj == NULL) {
DRM_ERROR("Failed to allocate seqno page\n"); DRM_ERROR("Failed to allocate seqno page\n");
ret = -ENOMEM; ret = -ENOMEM;
...@@ -2026,7 +2026,7 @@ static int init_status_page(struct intel_engine_cs *engine) ...@@ -2026,7 +2026,7 @@ static int init_status_page(struct intel_engine_cs *engine)
unsigned flags; unsigned flags;
int ret; int ret;
obj = i915_gem_alloc_object(engine->dev, 4096); obj = i915_gem_object_create(engine->dev, 4096);
if (obj == NULL) { if (obj == NULL) {
DRM_ERROR("Failed to allocate status page\n"); DRM_ERROR("Failed to allocate status page\n");
return -ENOMEM; return -ENOMEM;
...@@ -2167,7 +2167,7 @@ static int intel_alloc_ringbuffer_obj(struct drm_device *dev, ...@@ -2167,7 +2167,7 @@ static int intel_alloc_ringbuffer_obj(struct drm_device *dev,
if (!HAS_LLC(dev)) if (!HAS_LLC(dev))
obj = i915_gem_object_create_stolen(dev, ringbuf->size); obj = i915_gem_object_create_stolen(dev, ringbuf->size);
if (obj == NULL) if (obj == NULL)
obj = i915_gem_alloc_object(dev, ringbuf->size); obj = i915_gem_object_create(dev, ringbuf->size);
if (obj == NULL) if (obj == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -2780,7 +2780,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ...@@ -2780,7 +2780,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
if (INTEL_INFO(dev)->gen >= 8) { if (INTEL_INFO(dev)->gen >= 8) {
if (i915_semaphore_is_enabled(dev)) { if (i915_semaphore_is_enabled(dev)) {
obj = i915_gem_alloc_object(dev, 4096); obj = i915_gem_object_create(dev, 4096);
if (obj == NULL) { if (obj == NULL) {
DRM_ERROR("Failed to allocate semaphore bo. Disabling semaphores\n"); DRM_ERROR("Failed to allocate semaphore bo. Disabling semaphores\n");
i915.semaphores = 0; i915.semaphores = 0;
...@@ -2889,7 +2889,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ...@@ -2889,7 +2889,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
/* Workaround batchbuffer to combat CS tlb bug. */ /* Workaround batchbuffer to combat CS tlb bug. */
if (HAS_BROKEN_CS_TLB(dev)) { if (HAS_BROKEN_CS_TLB(dev)) {
obj = i915_gem_alloc_object(dev, I830_WA_SIZE); obj = i915_gem_object_create(dev, I830_WA_SIZE);
if (obj == NULL) { if (obj == NULL) {
DRM_ERROR("Failed to allocate batch bo\n"); DRM_ERROR("Failed to allocate batch bo\n");
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment