[Mesa-dev] [PATCH] virgl/vtest: disconnect on destroy

Dave Airlie airlied at gmail.com
Fri Feb 10 02:27:44 UTC 2017


On 10 February 2017 at 00:35,  <marcandre.lureau at redhat.com> wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> Since vtest is currently only handling a context at a time, calling
> disconnect in virgl_vtest_winsys_destroy() allows to pass tests such as
> piglit egl-create-context-invalid-flag-gles.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c | 9 +++++++++
>  src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c | 1 +
>  src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h | 2 ++
>  3 files changed, 12 insertions(+)
>
> diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
> index 4541419d8e..585b9e8156 100644
> --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
> +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c
> @@ -101,11 +101,20 @@ static int virgl_vtest_send_init(struct virgl_vtest_winsys *vws)
>     return 0;
>  }
>
> +int virgl_vtest_disconnect(struct virgl_vtest_winsys *vws)
> +{
> +   if (vws->sock_fd != -1)
> +      return close(vws->sock_fd);
> +
> +   return 0;
> +}

Does it need to return a value at all?

Otherwise
Reviewed-by: Dave Airlie <airlied at redhat.com>
> +
>  int virgl_vtest_connect(struct virgl_vtest_winsys *vws)
>  {
>     struct sockaddr_un un;
>     int sock, ret;
>
> +   vws->sock_fd = -1;
>     sock = socket(PF_UNIX, SOCK_STREAM, 0);
>     if (sock < 0)
>        return -1;
> diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
> index ce8ac97756..99470fde80 100644
> --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
> +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.c
> @@ -620,6 +620,7 @@ virgl_vtest_winsys_destroy(struct virgl_winsys *vws)
>     virgl_cache_flush(vtws);
>
>     pipe_mutex_destroy(vtws->mutex);
> +   virgl_vtest_disconnect(vtws);
>     FREE(vtws);
>  }
>
> diff --git a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
> index b4faa70b67..7ee5f6f09b 100644
> --- a/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
> +++ b/src/gallium/winsys/virgl/vtest/virgl_vtest_winsys.h
> @@ -106,6 +106,8 @@ virgl_vtest_cmd_buf(struct virgl_cmd_buf *cbuf)
>
>
>  int virgl_vtest_connect(struct virgl_vtest_winsys *vws);
> +int virgl_vtest_disconnect(struct virgl_vtest_winsys *vws);
> +
>  int virgl_vtest_send_get_caps(struct virgl_vtest_winsys *vws,
>                                struct virgl_drm_caps *caps);
>
> --
> 2.11.0.295.gd7dffce1c.dirty
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list