* [PATCH] drm/i915: stop checking for NULL vma->obj
@ 2022-03-04 17:42 Matthew Auld
2022-03-04 17:47 ` Thomas Hellström
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Auld @ 2022-03-04 17:42 UTC (permalink / raw)
To: intel-gfx; +Cc: Thomas Hellström, dri-devel
This is no longer possible since e6e1a304d759 ("drm/i915: vma is always
backed by an object.").
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
---
drivers/gpu/drm/i915/i915_vma.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
index 94fcdb7bd21d..7acfbbc63d17 100644
--- a/drivers/gpu/drm/i915/i915_vma.c
+++ b/drivers/gpu/drm/i915/i915_vma.c
@@ -515,21 +515,18 @@ int i915_vma_bind(struct i915_vma *vma,
if (!work->vma_res->bi.pages_rsgt)
work->pinned = i915_gem_object_get(vma->obj);
} else {
- if (vma->obj) {
- ret = i915_gem_object_wait_moving_fence(vma->obj, true);
- if (ret) {
- i915_vma_resource_free(vma->resource);
- vma->resource = NULL;
+ ret = i915_gem_object_wait_moving_fence(vma->obj, true);
+ if (ret) {
+ i915_vma_resource_free(vma->resource);
+ vma->resource = NULL;
- return ret;
- }
+ return ret;
}
vma->ops->bind_vma(vma->vm, NULL, vma->resource, cache_level,
bind_flags);
}
- if (vma->obj)
- set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
+ set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
atomic_or(bind_flags, &vma->flags);
return 0;
@@ -1360,7 +1357,7 @@ int i915_vma_pin_ww(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
if (flags & PIN_GLOBAL)
wakeref = intel_runtime_pm_get(&vma->vm->i915->runtime_pm);
- moving = vma->obj ? i915_gem_object_get_moving_fence(vma->obj) : NULL;
+ moving = i915_gem_object_get_moving_fence(vma->obj);
if (flags & vma->vm->bind_async_flags || moving) {
/* lock VM */
err = i915_vm_lock_objects(vma->vm, ww);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/i915: stop checking for NULL vma->obj
2022-03-04 17:42 [PATCH] drm/i915: stop checking for NULL vma->obj Matthew Auld
@ 2022-03-04 17:47 ` Thomas Hellström
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellström @ 2022-03-04 17:47 UTC (permalink / raw)
To: Matthew Auld, intel-gfx; +Cc: dri-devel
On Fri, 2022-03-04 at 17:42 +0000, Matthew Auld wrote:
> This is no longer possible since e6e1a304d759 ("drm/i915: vma is
> always
> backed by an object.").
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
LGTM.
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_vma.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_vma.c
> b/drivers/gpu/drm/i915/i915_vma.c
> index 94fcdb7bd21d..7acfbbc63d17 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -515,21 +515,18 @@ int i915_vma_bind(struct i915_vma *vma,
> if (!work->vma_res->bi.pages_rsgt)
> work->pinned = i915_gem_object_get(vma->obj);
> } else {
> - if (vma->obj) {
> - ret = i915_gem_object_wait_moving_fence(vma-
> >obj, true);
> - if (ret) {
> - i915_vma_resource_free(vma-
> >resource);
> - vma->resource = NULL;
> + ret = i915_gem_object_wait_moving_fence(vma->obj,
> true);
> + if (ret) {
> + i915_vma_resource_free(vma->resource);
> + vma->resource = NULL;
>
> - return ret;
> - }
> + return ret;
> }
> vma->ops->bind_vma(vma->vm, NULL, vma->resource,
> cache_level,
> bind_flags);
> }
>
> - if (vma->obj)
> - set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
> + set_bit(I915_BO_WAS_BOUND_BIT, &vma->obj->flags);
>
> atomic_or(bind_flags, &vma->flags);
> return 0;
> @@ -1360,7 +1357,7 @@ int i915_vma_pin_ww(struct i915_vma *vma,
> struct i915_gem_ww_ctx *ww,
> if (flags & PIN_GLOBAL)
> wakeref = intel_runtime_pm_get(&vma->vm->i915-
> >runtime_pm);
>
> - moving = vma->obj ? i915_gem_object_get_moving_fence(vma-
> >obj) : NULL;
> + moving = i915_gem_object_get_moving_fence(vma->obj);
> if (flags & vma->vm->bind_async_flags || moving) {
> /* lock VM */
> err = i915_vm_lock_objects(vma->vm, ww);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-04 17:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-04 17:42 [PATCH] drm/i915: stop checking for NULL vma->obj Matthew Auld
2022-03-04 17:47 ` Thomas Hellström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox