#include <X11/Xlib.h>
#include <X11/Xmd.h>
#include <EGL/egl.h>
+#include <EGL/eglext.h>
#if defined(_OSP_EMUL_)
#define FGRAPHICS_INTERNAL_USE_EGLCOPYBUFFER
, swapDone(false)
, isFirstSwap(true)
, pSecondSglInfo(null)
+ , pBitmapPointer(null)
+ , pBitmapLocked(null)
{
}
bool swapDone;
bool isFirstSwap;
_SglInfo* pSecondSglInfo;
+ void* pBitmapPointer;
+ Bitmap* pBitmapLocked;
private:
_SglInfo(const _SglInfo& sglInfo);
return eglQuerySurface(dpy, EGL_NO_SURFACE, attribute, pValue);
}
- EGLBoolean ret = eglQuerySurface(dpy, pSglInfo->surface, attribute, pValue);
+ EGLBoolean ret = EGL_FALSE;
+ if (attribute == EGL_BITMAP_POINTER_KHR)
+ {
+ *pValue = (EGLint)pSglInfo->pBitmapPointer;
+ ret = EGL_TRUE;
+ }
+ else
+ {
+ ret = eglQuerySurface(dpy, pSglInfo->surface, attribute, pValue);
+ }
+
pSglInfoTableManipulatorInstance->UnlockSglInfoTable();
return ret;
typedef void (*__EglMustCastToProperFunctionPointerType)(void);
+EGLBoolean _SglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
+{
+ _SglInfoTableManipulator* pSglInfoTableManipulatorInstance = _SglInfoTableManipulator::GetInstance();
+
+ _SglIndex sglIndex = (_SglIndex)surface;
+ _SglInfo* pSglInfo = pSglInfoTableManipulatorInstance->LockSglInfoTable(sglIndex);
+
+ if (sglIndex <= INVALID_SGL_INDEX || pSglInfo == null || pSglInfo->pBitmap == null || pSglInfo->pBitmapLocked != null)
+ {
+ pSglInfoTableManipulatorInstance->UnlockSglInfoTable();
+ SysLog(NID_GRP, "_SglLockSurfaceKHR failed!! dpy:%#x sglIndex:%#x", (unsigned int)display
+ , (unsigned int)surface);
+ return EGL_FALSE;
+ }
+
+ _SglInfo* pSglInfoLock = pSglInfo;
+ BufferInfo bufferInfo;
+ if(!pSglInfo->isBackbuffer && pSglInfo->pSecondSglInfo != null)
+ {
+ pSglInfoLock = pSglInfo->pSecondSglInfo;
+ }
+
+ pSglInfoLock->pBitmap->Lock(bufferInfo);
+ pSglInfo->pBitmapPointer = bufferInfo.pPixels;
+ pSglInfo->pBitmapLocked = pSglInfoLock->pBitmap;
+ pSglInfoTableManipulatorInstance->UnlockSglInfoTable();
+
+ return EGL_TRUE;
+}
+
+EGLBoolean _SglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
+{
+ _SglInfoTableManipulator* pSglInfoTableManipulatorInstance = _SglInfoTableManipulator::GetInstance();
+
+ _SglIndex sglIndex = (_SglIndex)surface;
+ _SglInfo* pSglInfo = pSglInfoTableManipulatorInstance->LockSglInfoTable(sglIndex);
+
+ if (sglIndex <= INVALID_SGL_INDEX || pSglInfo == null || pSglInfo->pBitmap == null || pSglInfo->pBitmapLocked == null)
+ {
+ pSglInfoTableManipulatorInstance->UnlockSglInfoTable();
+ SysLog(NID_GRP, "_SglUnlockSurfaceKHR failed!! dpy:%#x sglIndex:%#x", (unsigned int)display
+ , (unsigned int)surface);
+ return EGL_FALSE;
+ }
+
+ pSglInfo->pBitmapLocked->Unlock();
+ pSglInfo->pBitmapPointer = null;
+ pSglInfo->pBitmapLocked = null;
+ pSglInfoTableManipulatorInstance->UnlockSglInfoTable();
+
+ return EGL_TRUE;
+}
+
__EglMustCastToProperFunctionPointerType
_SglGetProcAddress(const char* pProcName)
{
+ String name(pProcName);
+
+ if (name.CompareTo(String("eglLockSurfaceKHR")) == 0)
+ {
+ return (__EglMustCastToProperFunctionPointerType)_SglLockSurfaceKHR;
+ }
+ else if (name.CompareTo(String("eglUnlockSurfaceKHR")) == 0)
+ {
+ return (__EglMustCastToProperFunctionPointerType)_SglUnlockSurfaceKHR;
+ }
+
return eglGetProcAddress(pProcName);
}