[Mesa-dev] [PATCH] gallium: introduce load_pipe_screen()

Emil Velikov emil.l.velikov at gmail.com
Thu Feb 18 16:48:43 UTC 2016


Hi Rob,

On 10 February 2016 at 22:56, Rob Herring <robh at kernel.org> wrote:
> Introduce load_pipe_screen() public entry point for other code which
> dlopen()'s gralloc_dri.so for purposes of loading a pipe_screen. This way
> drm_gralloc can avoid static linking of each gallium winsys and driver,
> and avoid duplicated logic to figure out which pipe driver to load.
>
> This is based on Rob Clark's work. I moved it into pipe_loader which seems
> to be a better spot.
>
As Rob C might have mentioned it, I'm not at all a fan of this.
Although unless (until?) Android fixes their runtime to honour
--dynamic-list(s) we can keep it in. Please ensure it's Android
specific (add a bunch of ifdef ANDROID guards) add a few
notes/warnings "hack: we need this for android because..."

> Signed-off-by: Rob Herring <robh at kernel.org>
> ---
>  src/gallium/auxiliary/pipe-loader/pipe_loader.h     | 3 +++
>  src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 9 +++++++++
>  src/gallium/state_trackers/dri/dri2.c               | 4 +---
>  src/gallium/targets/dri/dri.sym                     | 1 +
>  4 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
> index 690d088..19d269f 100644
> --- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
> +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
> @@ -180,6 +180,9 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev);
>  bool
>  pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd);
>
> +struct pipe_screen *
> +load_pipe_screen(struct pipe_loader_device **dev, int fd);
> +
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> index 994a284..b7e0ac7 100644
> --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> @@ -306,3 +306,12 @@ static const struct pipe_loader_ops pipe_loader_drm_ops = {
>     .configuration = pipe_loader_drm_configuration,
>     .release = pipe_loader_drm_release
>  };
> +
> +PUBLIC struct pipe_screen *load_pipe_screen(struct pipe_loader_device **dev, int fd)
> +{
> +   struct pipe_screen *pscreen = NULL;
> +   if (pipe_loader_drm_probe_fd(dev, fd)) {
> +      pscreen = pipe_loader_create_screen(*dev);
> +   }
> +   return pscreen;
> +}
> diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
> index a11a6cb..29aaa96 100644
> --- a/src/gallium/state_trackers/dri/dri2.c
> +++ b/src/gallium/state_trackers/dri/dri2.c
> @@ -1461,9 +1461,7 @@ dri2_init_screen(__DRIscreen * sPriv)
>     if (screen->fd < 0 || (fd = dup(screen->fd)) < 0)
>        goto fail;
>
> -   if (pipe_loader_drm_probe_fd(&screen->dev, fd))
> -      pscreen = pipe_loader_create_screen(screen->dev);
> -
> +   pscreen = load_pipe_screen(&screen->dev, screen->fd);
>     if (!pscreen)
>         goto fail;
>
> diff --git a/src/gallium/targets/dri/dri.sym b/src/gallium/targets/dri/dri.sym
> index 1fdf18b..1d86c88 100644
> --- a/src/gallium/targets/dri/dri.sym
> +++ b/src/gallium/targets/dri/dri.sym

Can we wire (use) this into the Android build. Iirc Rob C mentioned
that things did work on his end.

Thanks
Emil


More information about the mesa-dev mailing list