<div dir="ltr"><div><div><div><div><div>Hi Daniel,<br><br></div>Thx for pointing this out. Where are the files related to winsys/presentation :) ?<br></div><br></div>Is your remark a blocker for landing the patches I submitted ? Maybe we can still land them and then if you could guide me what I should change to use newer api that would be great.<br><br></div>Cheers<br></div>Julien<br><div><div><div><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 30 October 2015 at 08:47, Daniel Stone <span dir="ltr"><<a href="mailto:daniel@fooishbar.org" target="_blank">daniel@fooishbar.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
I know this isn't your fault, but I really really don't see any reason<br>
why the vl winsys bits should continue to exist. We already have a<br>
winsys/presentation layer in Mesa ...<br>
<br>
Cheers,<br>
Daniel<br>
<div class="HOEnZb"><div class="h5"><br>
On 29 October 2015 at 17:40, Julien Isorce <<a href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a>> wrote:<br>
> This patch allows to use gallium vaapi without requiring<br>
> a X server running for your second graphic card.<br>
><br>
> Signed-off-by: Julien Isorce <<a href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a>><br>
> ---<br>
> src/gallium/state_trackers/va/Makefile.am | 9 ++++<br>
> src/gallium/state_trackers/va/context.c | 70 ++++++++++++++++++++++++++++---<br>
> 2 files changed, 73 insertions(+), 6 deletions(-)<br>
><br>
> diff --git a/src/gallium/state_trackers/va/Makefile.am b/src/gallium/state_trackers/va/Makefile.am<br>
> index 2a93a90..348cfe1 100644<br>
> --- a/src/gallium/state_trackers/va/Makefile.am<br>
> +++ b/src/gallium/state_trackers/va/Makefile.am<br>
> @@ -30,6 +30,15 @@ AM_CFLAGS = \<br>
> $(VA_CFLAGS) \<br>
> -DVA_DRIVER_INIT_FUNC="__vaDriverInit_$(VA_MAJOR)_$(VA_MINOR)"<br>
><br>
> +AM_CFLAGS += \<br>
> + $(GALLIUM_PIPE_LOADER_DEFINES) \<br>
> + -DPIPE_SEARCH_DIR=\"$(libdir)/gallium-pipe\"<br>
> +<br>
> +if HAVE_GALLIUM_STATIC_TARGETS<br>
> +AM_CFLAGS += \<br>
> + -DGALLIUM_STATIC_TARGETS=1<br>
> +endif<br>
> +<br>
> AM_CPPFLAGS = \<br>
> -I$(top_srcdir)/include<br>
><br>
> diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c<br>
> index a107cc4..bd533c4 100644<br>
> --- a/src/gallium/state_trackers/va/context.c<br>
> +++ b/src/gallium/state_trackers/va/context.c<br>
> @@ -28,7 +28,8 @@<br>
><br>
> #include "pipe/p_screen.h"<br>
> #include "pipe/p_video_codec.h"<br>
> -<br>
> +#include "pipe-loader/pipe_loader.h"<br>
> +#include "state_tracker/drm_driver.h"<br>
> #include "util/u_memory.h"<br>
> #include "util/u_handle_table.h"<br>
> #include "util/u_video.h"<br>
> @@ -36,6 +37,8 @@<br>
><br>
> #include "va_private.h"<br>
><br>
> +#include <va/va_drmcommon.h><br>
> +<br>
> static struct VADriverVTable vtable =<br>
> {<br>
> &vlVaTerminate,<br>
> @@ -99,6 +102,8 @@ PUBLIC VAStatus<br>
> VA_DRIVER_INIT_FUNC(VADriverContextP ctx)<br>
> {<br>
> vlVaDriver *drv;<br>
> + int drm_fd;<br>
> + struct drm_state *drm_info;<br>
><br>
> if (!ctx)<br>
> return VA_STATUS_ERROR_INVALID_CONTEXT;<br>
> @@ -107,9 +112,56 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx)<br>
> if (!drv)<br>
> return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
><br>
> - drv->vscreen = vl_screen_create(ctx->native_dpy, ctx->x11_screen);<br>
> - if (!drv->vscreen)<br>
> - goto error_screen;<br>
> + switch (ctx->display_type) {<br>
> + case VA_DISPLAY_ANDROID:<br>
> + case VA_DISPLAY_WAYLAND:<br>
> + FREE(drv);<br>
> + return VA_STATUS_ERROR_UNIMPLEMENTED;<br>
> + case VA_DISPLAY_GLX:<br>
> + case VA_DISPLAY_X11:<br>
> + drv->vscreen = vl_screen_create(ctx->native_dpy, ctx->x11_screen);<br>
> + if (!drv->vscreen)<br>
> + goto error_screen;<br>
> + break;<br>
> + case VA_DISPLAY_DRM:<br>
> + case VA_DISPLAY_DRM_RENDERNODES: {<br>
> + drm_info = (struct drm_state *) ctx->drm_state;<br>
> + if (!drm_info) {<br>
> + FREE(drv);<br>
> + return VA_STATUS_ERROR_INVALID_PARAMETER;<br>
> + }<br>
> +<br>
> +#if GALLIUM_STATIC_TARGETS<br>
> + drm_fd = drm_info->fd;<br>
> +#else<br>
> + drm_fd = dup(drm_info->fd);<br>
> +#endif<br>
> +<br>
> + if (drm_fd < 0) {<br>
> + FREE(drv);<br>
> + return VA_STATUS_ERROR_INVALID_PARAMETER;<br>
> + }<br>
> +<br>
> + drv->vscreen = CALLOC_STRUCT(vl_screen);<br>
> + if (!drv->vscreen)<br>
> + goto error_screen;<br>
> +<br>
> +#if GALLIUM_STATIC_TARGETS<br>
> + drv->vscreen->pscreen = dd_create_screen(drm_fd);<br>
> +#else<br>
> + if (pipe_loader_drm_probe_fd(&drv->dev, drm_fd))<br>
> + drv->vscreen->pscreen = pipe_loader_create_screen(drv->dev, PIPE_SEARCH_DIR);<br>
> +#endif<br>
> +<br>
> + if (!drv->vscreen->pscreen)<br>
> + goto error_pipe;<br>
> +<br>
> + }<br>
> + break;<br>
> + default:<br>
> + FREE(drv);<br>
> + return VA_STATUS_ERROR_INVALID_DISPLAY;<br>
> + }<br>
><br>
> drv->pipe = drv->vscreen->pscreen->context_create(drv->vscreen->pscreen,<br>
> drv->vscreen, 0);<br>
> @@ -145,7 +197,10 @@ error_htab:<br>
> drv->pipe->destroy(drv->pipe);<br>
><br>
> error_pipe:<br>
> - vl_screen_destroy(drv->vscreen);<br>
> + if (ctx->display_type == VA_DISPLAY_GLX || ctx->display_type == VA_DISPLAY_X11)<br>
> + vl_screen_destroy(drv->vscreen);<br>
> + else<br>
> + FREE(drv->vscreen);<br>
><br>
> error_screen:<br>
> FREE(drv);<br>
> @@ -282,7 +337,10 @@ vlVaTerminate(VADriverContextP ctx)<br>
> vl_compositor_cleanup_state(&drv->cstate);<br>
> vl_compositor_cleanup(&drv->compositor);<br>
> drv->pipe->destroy(drv->pipe);<br>
> - vl_screen_destroy(drv->vscreen);<br>
> + if (ctx->display_type == VA_DISPLAY_GLX || ctx->display_type == VA_DISPLAY_X11)<br>
> + vl_screen_destroy(drv->vscreen);<br>
> + else<br>
> + FREE(drv->vscreen);<br>
> handle_table_destroy(drv->htab);<br>
> FREE(drv);<br>
><br>
> --<br>
> 1.9.1<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div></div></div></div></div></div></div></div>