OSDN Git Service

Pre-test native window pointer for validity
authorPaul Drews <paul.drews@intel.com>
Wed, 18 Jan 2012 19:01:49 +0000 (11:01 -0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 5 May 2016 17:55:11 +0000 (01:55 +0800)
commita5252da6a4c6064d71eed6cd9824ad3e0e047589
tree4eeb86aa9a6f6f8b58fdd425f8c6a3716ed54d89
parentdd07995c754e7281e788d24f66b7363afa173c4f
Pre-test native window pointer for validity

This fixes a segfault in the oglconform tests when running
the test:

  adb shell /data/app/oglconform -v 4 -minFmt -es -test egl-basic negative.drawables.winSurfBadWin

According the the egl specification this should return
EGL_BAD_NATIVE_WINDOW.  The segfault was resulting from the
fact that the window handle is a (cast to opaque) pointer,
and there are not straightforward ways of pre-testing a
pointer for validity.  The fix implemented here is:

  () Take advantage of the msync() system-call logic to test
     pre-test basic pointer validity
  () Once confirmed that we can reference through the
     pointer, look for the "magic" value dropped in by the
     implementation to mark this type at runtime.

Change-Id: Id7d21c822c8a416e45caba25c63d7076d1e547a5
Original-Change-Id: I3c8df8ef5ece5c0fa71c47417766b5453c355f8b
Signed-off-by: Russell Webb <russell.webb@intel.com>
Signed-off-by: Paul Drews <paul.drews@intel.com>
opengl/libs/EGL/eglApi.cpp