[Mesa-dev] [PATCH v3 01/10] egl: add dri2_surface_fixup() helper (v3)

Gurchetan Singh gurchetansingh at chromium.org
Mon Nov 6 17:08:45 UTC 2017


This patch series was intended to:

a) de-duplicate code across various platforms.
b) do preparatory work for platform_tizen.

There was some confusion[1] on how we want to move forward with
platform_tizen.  Until we can figure that out, I suggest we drop patches
that move stuff out of platform_android in preparation for platform_tizen
[patches {1, 3, 4,  6}] for now.  I would change this suggestion if other
platforms (platform_wayland, platform_drm) start using the new
dri2_surface_* functions and advertising the associated extensions by the
end of the series, i.e EXT_buffer_age.

I think patch 5 can be it's own standalone patch in platform_android for
now.  You can also justify patch 8 if platform_surfaceless starts
using dri2_surface_get_front_image.

So in conclusion, I think we can go forward with patches {2, 5, 7, 8, 9},
with the appropriate changes.

[1] https://www.mail-archive.com/mesa-dev@lists.freedesktop.
org/msg173164.html

On Tue, Oct 24, 2017 at 2:44 PM, Gwan-gyeong Mun <elongbug at gmail.com> wrote:

> From: "Mun, Gwan-gyeong" <elongbug at gmail.com>
>
> To share common free outdated buffers and update size code.
> This compares width and height arguments with current egl surface
> dimension,
> if the compared surface dimension is differ, then it free local buffers and
> updates dimension.
>
> In preparation to adding of new platform which uses this helper.
>
> v2: Fixes from Eric's review:
>    a) Split out series of refactor for helpers to a separate series.
>    b) Add the new helper function and use them to replace the old code in
> the
>       same patch.
>
> v3: Fixes from Emil and Gurchetan's review
>   - Follow the naming convention which prevents too verbose name of
> functions.
>     a) use a dri2_surface_$action_$object naming convention
>     b) change a first argument type "struct dri2_egl_surface" to
> "_EGLSurface".
>
> Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
> Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.c         | 13 +++++++++++++
>  src/egl/drivers/dri2/egl_dri2.h         |  3 +++
>  src/egl/drivers/dri2/platform_android.c |  8 ++------
>  3 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_
> dri2.c
> index 503450542e..238e299aed 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -1079,6 +1079,19 @@ dri2_egl_surface_free_local_buffers(struct
> dri2_egl_surface *dri2_surf)
>     }
>  }
>
> +void
> +dri2_surface_fixup(_EGLSurface *surf, int width, int height)
> +{
> +   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
> +
> +   /* free outdated buffers and update the surface size */
> +   if (surf->Width != width || surf->Height != height) {
> +      dri2_egl_surface_free_local_buffers(dri2_surf);
> +      surf->Width = width;
> +      surf->Height = height;
> +   }
> +}
> +
>  /**
>   * Called via eglTerminate(), drv->API.Terminate().
>   *
> diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_
> dri2.h
> index cd2487ab22..208a03d73a 100644
> --- a/src/egl/drivers/dri2/egl_dri2.h
> +++ b/src/egl/drivers/dri2/egl_dri2.h
> @@ -455,6 +455,9 @@ dri2_egl_surface_alloc_local_buffer(struct
> dri2_egl_surface *dri2_surf,
>  void
>  dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf);
>
> +void
> +dri2_surface_fixup(_EGLSurface *surf, int width, int height);
> +
>  EGLBoolean
>  dri2_init_surface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
>          _EGLConfig *conf, const EGLint *attrib_list, EGLBoolean
> enable_out_fence);
> diff --git a/src/egl/drivers/dri2/platform_android.c
> b/src/egl/drivers/dri2/platform_android.c
> index e390365b8b..d00a3333a2 100644
> --- a/src/egl/drivers/dri2/platform_android.c
> +++ b/src/egl/drivers/dri2/platform_android.c
> @@ -414,12 +414,8 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
>     }
>
>     /* free outdated buffers and update the surface size */
> -   if (dri2_surf->base.Width != dri2_surf->buffer->width ||
> -       dri2_surf->base.Height != dri2_surf->buffer->height) {
> -      dri2_egl_surface_free_local_buffers(dri2_surf);
> -      dri2_surf->base.Width = dri2_surf->buffer->width;
> -      dri2_surf->base.Height = dri2_surf->buffer->height;
> -   }
> +   dri2_surface_fixup(&dri2_surf->base, dri2_surf->buffer->width,
> +                      dri2_surf->buffer->height);
>
>     return 0;
>  }
> --
> 2.14.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171106/cf0ea2c5/attachment.html>


More information about the mesa-dev mailing list