All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-graphics-maintainer@vmware.com, syeh@vmware.com,
	thellstrom@vmware.com
Cc: Deepak Rawat <drawat@vmware.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
Date: Thu, 06 Sep 2018 09:49:12 +0100	[thread overview]
Message-ID: <153622375265.3050.15571396763621129072@skylake-alporthouse-com> (raw)
In-Reply-To: <20180906000350.2478-3-drawat@vmware.com>

Quoting Deepak Rawat (2018-09-06 01:03:47)
> vmwgfx does not support GEM interface so calling gem_close on vmwgfx
> results in error. Call dumb destroy IOCTL in case have dumb buffer.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/igt_fb.c  |  5 ++++-
>  lib/igt_kms.c | 15 +++++++++++++++
>  lib/igt_kms.h |  1 +
>  3 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d967..ba995a1a 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1920,7 +1920,10 @@ void igt_remove_fb(int fd, struct igt_fb *fb)
>  
>         cairo_surface_destroy(fb->cairo_surface);
>         do_or_die(drmModeRmFB(fd, fb->fb_id));
> -       gem_close(fd, fb->gem_handle);
> +       if (fb->is_dumb)
> +               kmstest_dumb_destroy(fd, fb->gem_handle);
> +       else
> +               gem_close(fd, fb->gem_handle);
>         fb->fb_id = 0;
>  }
>  
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 62d84684..9e9414cf 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -639,6 +639,21 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
>         return ptr;
>  }
>  
> +/**
> + * kmstest_dumb_destroy:
> + * @fd: Opened drm file descriptor
> + * @handle: Offset in the file referred to by fd
> + */
> +void kmstest_dumb_destroy(int fd, uint32_t handle)
> +{
> +       struct drm_mode_destroy_dumb arg = {};
> +
> +       igt_assert_neq(handle, 0);

Don't bother doing the kernel's job for it. Abusing the ioctl iface is
the name of the game.

> +       arg.handle = handle;
> +       do_ioctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);

struct drm_mode_destroy_dumb arg = { handle };

Try never to use do_ioctl() if you ever want to debug an error.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Deepak Rawat <drawat@vmware.com>,
	igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-graphics-maintainer@vmware.com, syeh@vmware.com,
	thellstrom@vmware.com
Cc: Deepak Rawat <drawat@vmware.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
Date: Thu, 06 Sep 2018 09:49:12 +0100	[thread overview]
Message-ID: <153622375265.3050.15571396763621129072@skylake-alporthouse-com> (raw)
In-Reply-To: <20180906000350.2478-3-drawat@vmware.com>

Quoting Deepak Rawat (2018-09-06 01:03:47)
> vmwgfx does not support GEM interface so calling gem_close on vmwgfx
> results in error. Call dumb destroy IOCTL in case have dumb buffer.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/igt_fb.c  |  5 ++++-
>  lib/igt_kms.c | 15 +++++++++++++++
>  lib/igt_kms.h |  1 +
>  3 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d967..ba995a1a 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1920,7 +1920,10 @@ void igt_remove_fb(int fd, struct igt_fb *fb)
>  
>         cairo_surface_destroy(fb->cairo_surface);
>         do_or_die(drmModeRmFB(fd, fb->fb_id));
> -       gem_close(fd, fb->gem_handle);
> +       if (fb->is_dumb)
> +               kmstest_dumb_destroy(fd, fb->gem_handle);
> +       else
> +               gem_close(fd, fb->gem_handle);
>         fb->fb_id = 0;
>  }
>  
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 62d84684..9e9414cf 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -639,6 +639,21 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
>         return ptr;
>  }
>  
> +/**
> + * kmstest_dumb_destroy:
> + * @fd: Opened drm file descriptor
> + * @handle: Offset in the file referred to by fd
> + */
> +void kmstest_dumb_destroy(int fd, uint32_t handle)
> +{
> +       struct drm_mode_destroy_dumb arg = {};
> +
> +       igt_assert_neq(handle, 0);

Don't bother doing the kernel's job for it. Abusing the ioctl iface is
the name of the game.

> +       arg.handle = handle;
> +       do_ioctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);

struct drm_mode_destroy_dumb arg = { handle };

Try never to use do_ioctl() if you ever want to debug an error.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-09-06  8:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06  0:03 [PATCH i-g-t 0/5] vmwgfx as a new driver for igt-gpu-tools Deepak Rawat
2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
2018-09-06  0:03 ` [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
2018-09-06  8:42   ` Petri Latvala
2018-09-06  8:42     ` [igt-dev] " Petri Latvala
2018-09-06 10:54     ` Jani Nikula
2018-09-06 10:54       ` [igt-dev] [Intel-gfx] " Jani Nikula
2018-09-06  0:03 ` [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers Deepak Rawat
2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
2018-09-06  8:49   ` Chris Wilson [this message]
2018-09-06  8:49     ` Chris Wilson
2018-09-06  0:03 ` [PATCH i-g-t 3/5] tests/kms: Don't check crtc state for vmwgfx legacy set_crtc Deepak Rawat
2018-09-06  0:03   ` [Intel-gfx] " Deepak Rawat
2018-09-06  8:54   ` [igt-dev] " Chris Wilson
2018-09-06  8:54     ` [Intel-gfx] " Chris Wilson
2018-09-06  0:03 ` [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface Deepak Rawat
2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
2018-09-06  8:58   ` Chris Wilson
2018-09-06  8:58     ` [igt-dev] [Intel-gfx] " Chris Wilson
2018-09-06 22:24     ` Deepak Singh Rawat
2018-09-06 22:24       ` [igt-dev] [Intel-gfx] " Deepak Singh Rawat
2018-09-06  0:03 ` [PATCH i-g-t 5/5] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property Deepak Rawat
2018-09-06  0:03   ` Deepak Rawat
2018-09-06 10:10 ` [igt-dev] ✓ Fi.CI.BAT: success for vmwgfx as a new driver for igt-gpu-tools Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=153622375265.3050.15571396763621129072@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=drawat@vmware.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=syeh@vmware.com \
    --cc=thellstrom@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.