[Mesa-dev] [PATCH 04/10] egl: Unhide functionality in _eglInitSync()
Chia-I Wu
olvaffe at gmail.com
Mon Feb 17 23:40:55 PST 2014
On Tue, Feb 18, 2014 at 12:21 AM, Juha-Pekka Heikkila
<juhapekka.heikkila at gmail.com> wrote:
> _eglInitResource() was used to memset entire _EGLSync by
> writing more than size of pointed target. This does work
> as long as Resource is the first element in _EGLSync,
> this patch fixes such dependency.
_EGLSync is a subclass of _EGLResource so the dependency always holds.
_eglInitResource is made to be able to initialize any class derived
from _EGLResource, by requiring the size of the derived class to be
specified.
>
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
> src/egl/main/eglsync.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c
> index 9d0067c..ba8a32f 100644
> --- a/src/egl/main/eglsync.c
> +++ b/src/egl/main/eglsync.c
> @@ -75,7 +75,8 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
> !(type == EGL_SYNC_FENCE_KHR && dpy->Extensions.KHR_fence_sync))
> return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR");
>
> - _eglInitResource(&sync->Resource, sizeof(*sync), dpy);
> + memset(sync, 0, sizeof(_EGLSync));
> + _eglInitResource(&sync->Resource, sizeof(_EGLResource), dpy);
> sync->Type = type;
> sync->SyncStatus = EGL_UNSIGNALED_KHR;
> sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
> --
> 1.8.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
olv at LunarG.com
More information about the mesa-dev
mailing list