[Mesa-dev] [PATCH] egl: Add swrast support to surfaceless platform

Gurchetan Singh gurchetansingh at chromium.org
Wed Aug 2 15:55:30 UTC 2017


Would kms_swrast + vgem for surfaceless also work for the use case raised
in the bug, or is that a no-go because it assumes the presence of a
driver?  I've been testing it[1], it works pretty well, except for one
issue during ChromeOS startup.

[1] https://chromium-review.googlesource.com/c/558218

On Wed, Aug 2, 2017 at 4:05 AM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:

> [+Chad]
>
> Hi Akihiko Odaki,
>
> Thank you for the patch and welcome to Mesa!
>
> How you tested this patch? Did you run a test suite like piglit, dEQP, etc?
> Can you give it a spin with either one of these, comparing HW vs
> swrast surfacess and share the results.
>
> On 1 August 2017 at 06:49, Akihiko Odaki <nekomanma at pixiv.co.jp> wrote:
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101397
> > ---
> >  src/egl/drivers/dri2/platform_surfaceless.c | 114
> ++++++++++++++++++++++++++--
> >  src/gallium/state_trackers/dri/drisw.c      |  45 ++++++++++-
> A general rule of thumb - the difference in paths indicate these two
> are distinct components.
> As such they ought to be separate patches.
>
> But before that, please look at my other comment below.
>
> >  2 files changed, 148 insertions(+), 11 deletions(-)
> >
> > diff --git a/src/egl/drivers/dri2/platform_surfaceless.c
> b/src/egl/drivers/dri2/platform_surfaceless.c
> > index 1091b4febd..5487c89816 100644
> > --- a/src/egl/drivers/dri2/platform_surfaceless.c
> > +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> > @@ -133,9 +133,16 @@ dri2_surfaceless_create_surface(_EGLDriver *drv,
> _EGLDisplay *disp, EGLint type,
> >     if (!config)
> >        goto cleanup_surface;
> >
> > -   dri2_surf->dri_drawable =
> > -      dri2_dpy->image_driver->createNewDrawable(dri2_dpy->dri_screen,
> config,
> > -                                                dri2_surf);
> > +   if (dri2_dpy->image_driver) {
> > +      dri2_surf->dri_drawable =
> > +         dri2_dpy->image_driver->createNewDrawable(dri2_dpy->dri_screen,
> config,
> > +                                                   dri2_surf);
> > +   } else {
> > +      assert(dri2_dpy->swrast);
> > +      dri2_surf->dri_drawable =
> > +         dri2_dpy->swrast->createNewDrawable(dri2_dpy->dri_screen,
> config,
> > +                                             dri2_surf);
> > +   }
> >     if (dri2_surf->dri_drawable == NULL) {
> >        _eglError(EGL_BAD_ALLOC, "image->createNewDrawable");
> >        goto cleanup_surface;
> > @@ -229,7 +236,24 @@ surfaceless_add_configs_for_visuals(_EGLDriver
> *drv, _EGLDisplay *dpy)
> >     return (config_count != 0);
> >  }
> >
> > -static const struct dri2_egl_display_vtbl dri2_surfaceless_display_vtbl
> = {
> > +static const struct dri2_egl_display_vtbl dri2_surfaceless_swrast_display_vtbl
> = {
> > +   .create_pixmap_surface = dri2_fallback_create_pixmap_surface,
> > +   .create_pbuffer_surface = dri2_surfaceless_create_pbuffer_surface,
> > +   .destroy_surface = surfaceless_destroy_surface,
> > +   .create_image = dri2_create_image_khr,
> > +   .swap_interval = dri2_fallback_swap_interval,
> > +   .swap_buffers = surfaceless_swap_buffers,
> > +   .swap_buffers_region = dri2_fallback_swap_buffers_region,
> > +   .set_damage_region = dri2_fallback_set_damage_region,
> > +   .post_sub_buffer = dri2_fallback_post_sub_buffer,
> > +   .copy_buffers = dri2_fallback_copy_buffers,
> > +   .query_buffer_age = dri2_fallback_query_buffer_age,
> > +   .create_wayland_buffer_from_image = dri2_fallback_create_wayland_b
> uffer_from_image,
> > +   .get_sync_values = dri2_fallback_get_sync_values,
> > +   .get_dri_drawable = dri2_surface_get_dri_drawable,
> > +};
> > +
> > +static const struct dri2_egl_display_vtbl dri2_surfaceless_dri3_display_vtbl
> = {
> >     .create_pixmap_surface = dri2_fallback_create_pixmap_surface,
> >     .create_pbuffer_surface = dri2_surfaceless_create_pbuffer_surface,
> >     .destroy_surface = surfaceless_destroy_surface,
> > @@ -252,6 +276,66 @@ surfaceless_flush_front_buffer(__DRIdrawable
> *driDrawable, void *loaderPrivate)
> >  {
> >  }
> >
> > +static const __DRIextension *swrast_loader_extensions[] = {
> > +   NULL,
> I'm not 100% sure if it makes sense, for swrast at least, to have no
> loader extensions.
>
> Need to think about this a bit more. Although a related series comes
> to mind [1].
> It adds partial DRI_IMAGE support to state_trackers/dri/drisw.
>
> I'm wondering if we cannot reuse/share some goals across the board.
>
> Thanks
> Emil
>
> [1] https://patchwork.freedesktop.org/project/mesa/patches/?subm
> itter=16100&state=&q=&archive=&delegate=
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170802/44cb9ff6/attachment.html>


More information about the mesa-dev mailing list