[Mesa-dev] [PATCH 3/4] kmsro: Add etnaviv renderonly support

Eric Anholt eric at anholt.net
Fri Jan 25 01:21:17 UTC 2019


Rob Herring <robh at kernel.org> writes:

> Enable using etnaviv for KMS renderonly. This still needs KMS driver
> name mapping to kmsro to be used automatically.
>
> Signed-off-by: Rob Herring <robh at kernel.org>

> diff --git a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
> index 4448150cc0c6..e086c0858f05 100644
> --- a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
> +++ b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
> @@ -27,6 +27,7 @@
>  
>  #include "kmsro_drm_public.h"
>  #include "vc4/drm/vc4_drm_public.h"
> +#include "etnaviv/drm/etnaviv_drm_public.h"
>  #include "xf86drm.h"
>  
>  #include "pipe/p_screen.h"
> @@ -34,22 +35,39 @@
>  
>  struct pipe_screen *kmsro_drm_screen_create(int fd)
>  {
> +   struct pipe_screen *screen = NULL;
>     struct renderonly ro = {
> +      .kms_fd = fd,
> +      .gpu_fd = -1,
> +   };
> +
> +#if defined(GALLIUM_VC4)
> +   ro.gpu_fd = drmOpenWithType("vc4", NULL, DRM_NODE_RENDER);
> +   if (ro.gpu_fd >= 0) {
>        /* Passes the vc4-allocated BO through to the KMS-only DRM device using
>         * PRIME buffer sharing.  The VC4 BO must be linear, which the SCANOUT
>         * flag on allocation will have ensured.
>         */
> -      .create_for_resource = renderonly_create_gpu_import_for_resource,
> -      .kms_fd = fd,
> -      .gpu_fd = drmOpenWithType("vc4", NULL, DRM_NODE_RENDER),
> -   };
> +      ro.create_for_resource = renderonly_create_gpu_import_for_resource,
> +      screen = vc4_drm_screen_create_renderonly(&ro);
> +      if (!screen)
> +         close(ro.gpu_fd);
> +
> +      return screen;
> +   }
> +#endif
>  
> -   if (ro.gpu_fd < 0)
> -      return NULL;
> +#if defined(GALLIUM_ETNAVIV)
> +   ro.gpu_fd = drmOpenWithType("etnaviv", NULL, DRM_NODE_RENDER);
> +   if (ro.gpu_fd >= 0) {
> +      ro.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource,
> +      screen = etna_drm_screen_create_renderonly(&ro);
> +      if (!screen)
> +         close(ro.gpu_fd);
>  
> -   struct pipe_screen *screen = vc4_drm_screen_create_renderonly(&ro);
> -   if (!screen)
> -      close(ro.gpu_fd);
> +      return screen;
> +   }
> +#endif

Would it make more sense to open the first render node once, then check
if its name matches any of the drivers we support and calling their
setup function?

Either way, this would have my ack.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20190124/a8a09e6a/attachment.sig>


More information about the mesa-dev mailing list