dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i915: Drop legacy execbuffer support
@ 2021-03-10 21:00 Jason Ekstrand
  2021-03-10 22:04 ` Keith Packard
  2021-03-12  2:25 ` Dixit, Ashutosh
  0 siblings, 2 replies; 7+ messages in thread
From: Jason Ekstrand @ 2021-03-10 21:00 UTC (permalink / raw)
  To: dri-devel, intel-gfx, airlied; +Cc: Jason Ekstrand

libdrm has supported the newer execbuffer2 ioctl and using it by default
when it exists since libdrm commit b50964027bef249a0cc3d511de05c2464e0a1e22
which landed Mar 2, 2010.  The i915 and i965 drivers in Mesa at the time
both used libdrm and so did the Intel X11 back-end.  The SNA back-end
for X11 has always used execbuffer2.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
---
 .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 100 ------------------
 drivers/gpu/drm/i915/gem/i915_gem_ioctls.h    |   2 -
 drivers/gpu/drm/i915/i915_drv.c               |   2 +-
 3 files changed, 1 insertion(+), 103 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index fe170186dd428..99772f37bff60 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -3394,106 +3394,6 @@ static bool check_buffer_count(size_t count)
 	return !(count < 1 || count > INT_MAX || count > SIZE_MAX / sz - 1);
 }
 
-/*
- * Legacy execbuffer just creates an exec2 list from the original exec object
- * list array and passes it to the real function.
- */
-int
-i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data,
-			  struct drm_file *file)
-{
-	struct drm_i915_private *i915 = to_i915(dev);
-	struct drm_i915_gem_execbuffer *args = data;
-	struct drm_i915_gem_execbuffer2 exec2;
-	struct drm_i915_gem_exec_object *exec_list = NULL;
-	struct drm_i915_gem_exec_object2 *exec2_list = NULL;
-	const size_t count = args->buffer_count;
-	unsigned int i;
-	int err;
-
-	if (!check_buffer_count(count)) {
-		drm_dbg(&i915->drm, "execbuf2 with %zd buffers\n", count);
-		return -EINVAL;
-	}
-
-	exec2.buffers_ptr = args->buffers_ptr;
-	exec2.buffer_count = args->buffer_count;
-	exec2.batch_start_offset = args->batch_start_offset;
-	exec2.batch_len = args->batch_len;
-	exec2.DR1 = args->DR1;
-	exec2.DR4 = args->DR4;
-	exec2.num_cliprects = args->num_cliprects;
-	exec2.cliprects_ptr = args->cliprects_ptr;
-	exec2.flags = I915_EXEC_RENDER;
-	i915_execbuffer2_set_context_id(exec2, 0);
-
-	err = i915_gem_check_execbuffer(&exec2);
-	if (err)
-		return err;
-
-	/* Copy in the exec list from userland */
-	exec_list = kvmalloc_array(count, sizeof(*exec_list),
-				   __GFP_NOWARN | GFP_KERNEL);
-
-	/* Allocate extra slots for use by the command parser */
-	exec2_list = kvmalloc_array(count + 2, eb_element_size(),
-				    __GFP_NOWARN | GFP_KERNEL);
-	if (exec_list == NULL || exec2_list == NULL) {
-		drm_dbg(&i915->drm,
-			"Failed to allocate exec list for %d buffers\n",
-			args->buffer_count);
-		kvfree(exec_list);
-		kvfree(exec2_list);
-		return -ENOMEM;
-	}
-	err = copy_from_user(exec_list,
-			     u64_to_user_ptr(args->buffers_ptr),
-			     sizeof(*exec_list) * count);
-	if (err) {
-		drm_dbg(&i915->drm, "copy %d exec entries failed %d\n",
-			args->buffer_count, err);
-		kvfree(exec_list);
-		kvfree(exec2_list);
-		return -EFAULT;
-	}
-
-	for (i = 0; i < args->buffer_count; i++) {
-		exec2_list[i].handle = exec_list[i].handle;
-		exec2_list[i].relocation_count = exec_list[i].relocation_count;
-		exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr;
-		exec2_list[i].alignment = exec_list[i].alignment;
-		exec2_list[i].offset = exec_list[i].offset;
-		if (INTEL_GEN(to_i915(dev)) < 4)
-			exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE;
-		else
-			exec2_list[i].flags = 0;
-	}
-
-	err = i915_gem_do_execbuffer(dev, file, &exec2, exec2_list);
-	if (exec2.flags & __EXEC_HAS_RELOC) {
-		struct drm_i915_gem_exec_object __user *user_exec_list =
-			u64_to_user_ptr(args->buffers_ptr);
-
-		/* Copy the new buffer offsets back to the user's exec list. */
-		for (i = 0; i < args->buffer_count; i++) {
-			if (!(exec2_list[i].offset & UPDATE))
-				continue;
-
-			exec2_list[i].offset =
-				gen8_canonical_addr(exec2_list[i].offset & PIN_OFFSET_MASK);
-			exec2_list[i].offset &= PIN_OFFSET_MASK;
-			if (__copy_to_user(&user_exec_list[i].offset,
-					   &exec2_list[i].offset,
-					   sizeof(user_exec_list[i].offset)))
-				break;
-		}
-	}
-
-	kvfree(exec_list);
-	kvfree(exec2_list);
-	return err;
-}
-
 int
 i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
 			   struct drm_file *file)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ioctls.h b/drivers/gpu/drm/i915/gem/i915_gem_ioctls.h
index 87d8b27f426de..7fd22f3efbef0 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_ioctls.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_ioctls.h
@@ -14,8 +14,6 @@ int i915_gem_busy_ioctl(struct drm_device *dev, void *data,
 			struct drm_file *file);
 int i915_gem_create_ioctl(struct drm_device *dev, void *data,
 			  struct drm_file *file);
-int i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data,
-			      struct drm_file *file);
 int i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
 			       struct drm_file *file);
 int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data,
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 3edd5e47ad682..64edcab59fe12 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1701,7 +1701,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(I915_VBLANK_SWAP, drm_noop, DRM_AUTH),
 	DRM_IOCTL_DEF_DRV(I915_HWS_ADDR, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
 	DRM_IOCTL_DEF_DRV(I915_GEM_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),
-	DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER, i915_gem_execbuffer_ioctl, DRM_AUTH),
+	DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER, drm_invalid_op, DRM_AUTH),
 	DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER2_WR, i915_gem_execbuffer2_ioctl, DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF_DRV(I915_GEM_PIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY),
 	DRM_IOCTL_DEF_DRV(I915_GEM_UNPIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY),
-- 
2.29.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] i915: Drop legacy execbuffer support
  2021-03-10 21:00 [PATCH] i915: Drop legacy execbuffer support Jason Ekstrand
@ 2021-03-10 22:04 ` Keith Packard
  2021-03-11 19:08   ` [Intel-gfx] " Dave Airlie
  2021-03-12  2:25 ` Dixit, Ashutosh
  1 sibling, 1 reply; 7+ messages in thread
From: Keith Packard @ 2021-03-10 22:04 UTC (permalink / raw)
  To: Jason Ekstrand, dri-devel, intel-gfx, airlied; +Cc: Jason Ekstrand


[-- Attachment #1.1: Type: text/plain, Size: 653 bytes --]

Jason Ekstrand <jason@jlekstrand.net> writes:

> libdrm has supported the newer execbuffer2 ioctl and using it by default
> when it exists since libdrm commit b50964027bef249a0cc3d511de05c2464e0a1e22
> which landed Mar 2, 2010.  The i915 and i965 drivers in Mesa at the time
> both used libdrm and so did the Intel X11 back-end.  The SNA back-end
> for X11 has always used execbuffer2.

All execbuffer users in the past that I'm aware of used libdrm, which
now uses the execbuffer2 ioctl for this API. That means these
applications will remain ABI compatible through this change.

Acked-by: Keith Packard <keithp@keithp.com>

-- 
-keith

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Intel-gfx] [PATCH] i915: Drop legacy execbuffer support
  2021-03-10 22:04 ` Keith Packard
@ 2021-03-11 19:08   ` Dave Airlie
  0 siblings, 0 replies; 7+ messages in thread
From: Dave Airlie @ 2021-03-11 19:08 UTC (permalink / raw)
  To: Keith Packard
  Cc: Dave Airlie, Intel Graphics Development, dri-devel, Jason Ekstrand

On Thu, 11 Mar 2021 at 08:04, Keith Packard <keithp@keithp.com> wrote:
>
> Jason Ekstrand <jason@jlekstrand.net> writes:
>
> > libdrm has supported the newer execbuffer2 ioctl and using it by default
> > when it exists since libdrm commit b50964027bef249a0cc3d511de05c2464e0a1e22
> > which landed Mar 2, 2010.  The i915 and i965 drivers in Mesa at the time
> > both used libdrm and so did the Intel X11 back-end.  The SNA back-end
> > for X11 has always used execbuffer2.
>
> All execbuffer users in the past that I'm aware of used libdrm, which
> now uses the execbuffer2 ioctl for this API. That means these
> applications will remain ABI compatible through this change.
>
> Acked-by: Keith Packard <keithp@keithp.com>

Acked-by: Dave Airlie <airlied@redhat.com>

Dave.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] i915: Drop legacy execbuffer support
  2021-03-10 21:00 [PATCH] i915: Drop legacy execbuffer support Jason Ekstrand
  2021-03-10 22:04 ` Keith Packard
@ 2021-03-12  2:25 ` Dixit, Ashutosh
  2021-03-12  4:31   ` Jason Ekstrand
  1 sibling, 1 reply; 7+ messages in thread
From: Dixit, Ashutosh @ 2021-03-12  2:25 UTC (permalink / raw)
  To: Jason Ekstrand; +Cc: intel-gfx, dri-devel

On Wed, 10 Mar 2021 13:00:49 -0800, Jason Ekstrand wrote:
>
> libdrm has supported the newer execbuffer2 ioctl and using it by default
> when it exists since libdrm commit b50964027bef249a0cc3d511de05c2464e0a1e22
> which landed Mar 2, 2010.  The i915 and i965 drivers in Mesa at the time
> both used libdrm and so did the Intel X11 back-end.  The SNA back-end
> for X11 has always used execbuffer2.
>
> Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
> ---
>  .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 100 ------------------
>  drivers/gpu/drm/i915/gem/i915_gem_ioctls.h    |   2 -
>  drivers/gpu/drm/i915/i915_drv.c               |   2 +-
>  3 files changed, 1 insertion(+), 103 deletions(-)

Don't we want to clean up references to legacy execbuffer in
include/uapi/drm/i915_drm.h too?
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] i915: Drop legacy execbuffer support
  2021-03-12  2:25 ` Dixit, Ashutosh
@ 2021-03-12  4:31   ` Jason Ekstrand
  2021-03-12  5:58     ` Dixit, Ashutosh
  2021-03-12 14:15     ` [Intel-gfx] " Daniel Vetter
  0 siblings, 2 replies; 7+ messages in thread
From: Jason Ekstrand @ 2021-03-12  4:31 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: intel-gfx, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 996 bytes --]


On March 11, 2021 20:26:06 "Dixit, Ashutosh" <ashutosh.dixit@intel.com> wrote:

> On Wed, 10 Mar 2021 13:00:49 -0800, Jason Ekstrand wrote:
>>
>> libdrm has supported the newer execbuffer2 ioctl and using it by default
>> when it exists since libdrm commit b50964027bef249a0cc3d511de05c2464e0a1e22
>> which landed Mar 2, 2010.  The i915 and i965 drivers in Mesa at the time
>> both used libdrm and so did the Intel X11 back-end.  The SNA back-end
>> for X11 has always used execbuffer2.
>>
>> Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
>> ---
>> .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 100 ------------------
>> drivers/gpu/drm/i915/gem/i915_gem_ioctls.h    |   2 -
>> drivers/gpu/drm/i915/i915_drv.c               |   2 +-
>> 3 files changed, 1 insertion(+), 103 deletions(-)
>
> Don't we want to clean up references to legacy execbuffer in
> include/uapi/drm/i915_drm.h too?

I thought about that but Daniel said we should leave them. Maybe a comment 
is in order?

--Jason


[-- Attachment #1.2: Type: text/html, Size: 2165 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] i915: Drop legacy execbuffer support
  2021-03-12  4:31   ` Jason Ekstrand
@ 2021-03-12  5:58     ` Dixit, Ashutosh
  2021-03-12 14:15     ` [Intel-gfx] " Daniel Vetter
  1 sibling, 0 replies; 7+ messages in thread
From: Dixit, Ashutosh @ 2021-03-12  5:58 UTC (permalink / raw)
  To: Jason Ekstrand; +Cc: intel-gfx, dri-devel

On Thu, 11 Mar 2021 20:31:33 -0800, Jason Ekstrand wrote:
> On March 11, 2021 20:26:06 "Dixit, Ashutosh" <ashutosh.dixit@intel.com> wrote:
>  On Wed, 10 Mar 2021 13:00:49 -0800, Jason Ekstrand wrote:
>
>  libdrm has supported the newer execbuffer2 ioctl and using it by default
>  when it exists since libdrm commit b50964027bef249a0cc3d511de05c2464e0a1e22
>  which landed Mar 2, 2010.  The i915 and i965 drivers in Mesa at the time
>  both used libdrm and so did the Intel X11 back-end.  The SNA back-end
>  for X11 has always used execbuffer2.
>
>  Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
>  ---
>  .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 100 ------------------
>  drivers/gpu/drm/i915/gem/i915_gem_ioctls.h    |   2 -
>  drivers/gpu/drm/i915/i915_drv.c               |   2 +-
>  3 files changed, 1 insertion(+), 103 deletions(-)
>
>  Don't we want to clean up references to legacy execbuffer in
>  include/uapi/drm/i915_drm.h too?
>
> I thought about that but Daniel said we should leave them. Maybe a
> comment is in order?

No, should be ok since we are using drm_invalid_op(). If we want to delete
the unused 'struct drm_i915_gem_execbuffer' we can do that by converting
from DRM_IOW to DRM_IO in the DRM_IOCTL_I915_GEM_EXECBUFFER #define.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Intel-gfx] [PATCH] i915: Drop legacy execbuffer support
  2021-03-12  4:31   ` Jason Ekstrand
  2021-03-12  5:58     ` Dixit, Ashutosh
@ 2021-03-12 14:15     ` Daniel Vetter
  1 sibling, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2021-03-12 14:15 UTC (permalink / raw)
  To: Jason Ekstrand; +Cc: Dixit, Ashutosh, intel-gfx, dri-devel

On Thu, Mar 11, 2021 at 10:31:33PM -0600, Jason Ekstrand wrote:
> 
> On March 11, 2021 20:26:06 "Dixit, Ashutosh" <ashutosh.dixit@intel.com> wrote:
> 
> > On Wed, 10 Mar 2021 13:00:49 -0800, Jason Ekstrand wrote:
> > > 
> > > libdrm has supported the newer execbuffer2 ioctl and using it by default
> > > when it exists since libdrm commit b50964027bef249a0cc3d511de05c2464e0a1e22
> > > which landed Mar 2, 2010.  The i915 and i965 drivers in Mesa at the time
> > > both used libdrm and so did the Intel X11 back-end.  The SNA back-end
> > > for X11 has always used execbuffer2.
> > > 
> > > Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
> > > ---
> > > .../gpu/drm/i915/gem/i915_gem_execbuffer.c    | 100 ------------------
> > > drivers/gpu/drm/i915/gem/i915_gem_ioctls.h    |   2 -
> > > drivers/gpu/drm/i915/i915_drv.c               |   2 +-
> > > 3 files changed, 1 insertion(+), 103 deletions(-)
> > 
> > Don't we want to clean up references to legacy execbuffer in
> > include/uapi/drm/i915_drm.h too?
> 
> I thought about that but Daniel said we should leave them. Maybe a comment
> is in order?

These headers are copied unchanged to userspace for building. We don't use
kernel-headers packages directly in any of our userspace (I hope at
least), but still better safe than sorry and avoid compilation failures
simply due to updated uapi headers that lost a few old things.

Also we need at least the struct size because that's encoded in the ioctl
number, and at that point might as well keep the entire thing.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-12 14:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 21:00 [PATCH] i915: Drop legacy execbuffer support Jason Ekstrand
2021-03-10 22:04 ` Keith Packard
2021-03-11 19:08   ` [Intel-gfx] " Dave Airlie
2021-03-12  2:25 ` Dixit, Ashutosh
2021-03-12  4:31   ` Jason Ekstrand
2021-03-12  5:58     ` Dixit, Ashutosh
2021-03-12 14:15     ` [Intel-gfx] " Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).