[Mesa-dev] [PATCH 4/7] egl/surfaceless: tweak surfaceless_add_configs_for_visuals()

Gurchetan Singh gurchetansingh at chromium.org
Thu Aug 25 17:53:22 UTC 2016


>> unsigned int format_count[ARRAY_SIZE(visuals)] = {};

Isn't this invalid in C?
http://stackoverflow.com/questions/17589533/is-an-empty-initializer-list-valid-c-code

Other than that, this patch is
Reviewed-by: Gurchetan Singh <gurchetansingh at chromium.org>

On Thu, Aug 25, 2016 at 9:23 AM, Emil Velikov <emil.l.velikov at gmail.com>
wrote:

> From: Emil Velikov <emil.velikov at collabora.com>
>
> Analogous to previous commit.
>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
>  src/egl/drivers/dri2/platform_surfaceless.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_surfaceless.c
> b/src/egl/drivers/dri2/platform_surfaceless.c
> index 9e2aa7c..c788f82 100644
> --- a/src/egl/drivers/dri2/platform_surfaceless.c
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> @@ -189,25 +189,26 @@ surfaceless_add_configs_for_visuals(_EGLDriver
> *drv, _EGLDisplay *dpy)
>        { "RGB888",   { 0xff0000, 0xff00, 0xff, 0x0 } },
>        { "RGB565",   { 0x00f800, 0x07e0, 0x1f, 0x0 } },
>     };
> +   unsigned int format_count[ARRAY_SIZE(visuals)] = {};
>     unsigned int count, i, j;
>
>     count = 0;
> -   for (i = 0; i < ARRAY_SIZE(visuals); i++) {
> -      int format_count = 0;
> -
> -      for (j = 0; dri2_dpy->driver_configs[j]; j++) {
> +   for (i = 0; i < dri2_dpy->driver_configs[i]; i++) {
> +      for (j = 0; ARRAY_SIZE(visuals); j++) {
>           struct dri2_egl_config *dri2_conf;
>
> -         dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
> +         dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[i],
>                 count + 1, EGL_PBUFFER_BIT, NULL, visuals[i].rgba_masks);
>
>           if (dri2_conf) {
>              count++;
> -            format_count++;
> +            format_count[j]++;
>           }
>        }
> +   }
>
> -      if (!format_count) {
> +   for (i = 0; ARRAY_SIZE(format_count); i++) {
> +      if (!format_count[i]) {
>           _eglLog(_EGL_DEBUG, "No DRI config supports native format %s",
>                 visuals[i].format_name);
>        }
> --
> 2.9.0
>
> _______________________________________________
> 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/20160825/401a840c/attachment.html>


More information about the mesa-dev mailing list