[Mesa-dev] [PATCH] egl: Fix for not setting EGL_BAD_MATCH by eglCreatePbufferSurface.

Ilia Mirkin imirkin at alum.mit.edu
Fri Mar 4 15:59:30 UTC 2016


On Fri, Mar 4, 2016 at 9:06 AM, Pielech, Adrian
<adrian.pielech at intel.com> wrote:
>
>
>
>
> This is fix for not setting EGL_BAD_MATCH when calling
> eglCreatePbufferSurface with invalid setting of EGL_TEXTURE_FORMAT and
> EGL_TEXTURE_TARGET.
>
> According to EGL spec the following combination should generate
> EGL_BAD_MATCH:
>
> EGL_TEXTURE_FORMAT == EGL_NO_TEXTURE and EGL_TEXTURE_TARGET !=
> EGL_NO_TEXTURE,
>
> EGL_TEXTURE_FORMAT != EGL_NO_TEXTURE and EGL_TEXTURE_TARGET ==
> EGL_NO_TEXTURE
>
>
>
>
>
> ---
>
> src/egl/main/eglsurface.c | 8 ++++++++
>
> 1 file changed, 8 insertions(+)
>
>
>
> diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
>
> index d42737e..b79e3c6 100644
>
> --- a/src/egl/main/eglsurface.c
>
> +++ b/src/egl/main/eglsurface.c
>
> @@ -223,6 +223,14 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const
> EGLint *attrib_list)
>
>       }
>
>     }
>
> +   //if surface is Pbuffer type and [(EGL_TEXTURE_FORMAT == EGL_NO_TEXTURE
> and EGL_TEXTURE_TARGET != EGL_NO_TEXTURE) or (EGL_TEXTURE_FORMAT !=
> EGL_NO_TEXTURE and EGL_TEXTURE_TARGET == EGL_NO_TEXTURE)] then the
> EGL_BAD_MATCH should be set

Is this substantially different than the code below? Feels like a

i++; // increment i by 1

type of situation... also try to keep lines under 80 chars.

>
> +   if ((surf->TextureFormat == EGL_NO_TEXTURE && surf->TextureTarget !=
> EGL_NO_TEXTURE ||
>
> +           surf->TextureFormat != EGL_NO_TEXTURE && surf->TextureTarget ==
> EGL_NO_TEXTURE) &&

If you were feeling clever, you could do something like

if (((surf->TextureFormat == EGL_NO_TEXTURE) ^ (surf->TextureTarget ==
EGL_NO_TEXTURE)) && (surf->Type & EGL_PBUFFER_BIT))

Your patch appears to have come through badly misformatted... I think
it's HTML-formatted maybe? Please make sure that your emails are able
to be processed by "git am". (Or just use git format-patch +
send-email and avoid the headache.)

>
> +           (surf->Type & EGL_PBUFFER_BIT))
>
> +   {
>
> +       err = EGL_BAD_MATCH;
>
> +   }
>
> +
>
>     return err;
>
> }
>
> --
>
> 2.7.0.rc3
>
> ---------------------------------------------------------------------
> Intel Technology Poland sp. z o.o.
> ul. S&#322owackiego 173 | 80-298 Gda&#324sk | S&#261d Rejonowy Gda&#324sk
> P&#243&#322noc | VII Wydzia&#322 Gospodarczy Krajowego Rejestru S&#261dowego
> - KRS 101882 | NIP 957-07-52-316 | Kapita&#322 zak&#322adowy 200.000 PLN.
>
> Ta wiadomo&#347&#263 wraz z za&#322&#261cznikami jest przeznaczona dla
> okre&#347lonego adresata i mo&#380e zawiera&#263 informacje poufne. W razie
> przypadkowego otrzymania tej wiadomo&#347ci, prosimy o powiadomienie nadawcy
> oraz trwa&#322e jej usuni&#281cie; jakiekolwiek przegl&#261danie lub
> rozpowszechnianie jest zabronione.
> This e-mail and any attachments may contain confidential material for the
> sole use of the intended recipient(s). If you are not the intended
> recipient, please contact the sender and delete all copies; any review or
> distribution by others is strictly prohibited.
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>


More information about the mesa-dev mailing list