aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/native/openmax
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-06 06:15:21 +0100
committerSven Gothel <[email protected]>2010-11-06 06:15:21 +0100
commit1be7b5271ec1d08b6929a88dd811754d33d149de (patch)
tree2c321a1952035509eacc3bca1c46fa7385d31def /src/jogl/native/openmax
parentb0845ac49e7717c88b1714766518ac553751fa97 (diff)
Complete removal of NV KD and OMX started with 46f17013c7cd59d551371edb2c1a4a57f8cbd84f (code dependencies)
This currently removes KD fullscreen for NV devices and the whole OMX NV stream/file type detection, which renders the OMX hack useless. However, updated EGL sync (NV proprietary) to EGL_KHR_reusable_sync and EGL_KHR_fence_sync.
Diffstat (limited to 'src/jogl/native/openmax')
-rw-r--r--src/jogl/native/openmax/omx_tool.c58
-rw-r--r--src/jogl/native/openmax/omx_tool.h13
2 files changed, 45 insertions, 26 deletions
diff --git a/src/jogl/native/openmax/omx_tool.c b/src/jogl/native/openmax/omx_tool.c
index e9633af1b..c6b6494e2 100644
--- a/src/jogl/native/openmax/omx_tool.c
+++ b/src/jogl/native/openmax/omx_tool.c
@@ -23,8 +23,6 @@
#endif
#endif
-#include <NVOMX_IndexExtensions.h>
-
#define NOTSET_U8 ((OMX_U8)0xDE)
#define NOTSET_U16 ((OMX_U16)0xDEDE)
#define NOTSET_U32 ((OMX_U32)0xDEDEDEDE)
@@ -91,8 +89,7 @@ do { \
} while (0);
static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
-static PFNEGLCREATEFENCESYNCKHRPROC eglCreateFenceSyncKHR;
-static PFNEGLFENCEKHRPROC eglFenceKHR;
+static PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR;
static PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
static PFNEGLSIGNALSYNCKHRPROC eglSignalSyncKHR;
static int _hasEGLSync = 0;
@@ -134,11 +131,10 @@ static void InitStatic()
vOMX.s.nStep = 0;
GETEXTENSION(PFNEGLCREATEIMAGEKHRPROC, eglCreateImageKHR);
- GETEXTENSION(PFNEGLCREATEFENCESYNCKHRPROC, eglCreateFenceSyncKHR);
- GETEXTENSION(PFNEGLFENCEKHRPROC, eglFenceKHR);
+ GETEXTENSION(PFNEGLCREATESYNCKHRPROC, eglCreateSyncKHR);
GETEXTENSION(PFNEGLGETSYNCATTRIBKHRPROC, eglGetSyncAttribKHR);
GETEXTENSION(PFNEGLSIGNALSYNCKHRPROC, eglSignalSyncKHR);
- if(NULL==eglFenceKHR||NULL==eglGetSyncAttribKHR||NULL==eglSignalSyncKHR) {
+ if(NULL==eglGetSyncAttribKHR||NULL==eglSignalSyncKHR) {
_hasEGLSync = 0;
} else {
_hasEGLSync = 1;
@@ -515,7 +511,8 @@ static void DestroyInstanceUnlock(OMXToolBasicAV_t * pOMXAV)
static OMX_ERRORTYPE AddFile(OMXToolBasicAV_t * pOMXAV, const KDchar* filename)
{
- // FIXME: Non NV case ..
+// FIXME: Non NV case ..
+#if 0
OMX_ERRORTYPE eError;
NVX_PARAM_FILENAME oFilenameParam;
OMX_INDEXTYPE eIndexParamFilename;
@@ -533,11 +530,15 @@ static OMX_ERRORTYPE AddFile(OMXToolBasicAV_t * pOMXAV, const KDchar* filename)
return eError;
return OMX_ErrorNone;
+#else
+ return OMX_ErrorNotImplemented;
+#endif
}
static OMX_ERRORTYPE ProbePort(OMXToolBasicAV_t * pOMXAV, int port, KDchar *codec, KDchar* component)
{
- // FIXME: Non NV case ..
+// FIXME: Non NV case ..
+#if 0
OMX_U32 roles = 1;
OMX_ERRORTYPE err = OMX_ErrorNone;
OMX_INDEXTYPE eParam;
@@ -599,6 +600,9 @@ static OMX_ERRORTYPE ProbePort(OMXToolBasicAV_t * pOMXAV, int port, KDchar *code
}
return err != OMX_ErrorNone ? err : roles ? OMX_ErrorNone : OMX_ErrorComponentNotFound;
+#else
+ return OMX_ErrorNotImplemented;
+#endif
}
static int StartClock(OMXToolBasicAV_t * pOMXAV, KDboolean start, KDfloat32 time) {
@@ -672,6 +676,8 @@ static int SetMediaPosition(OMXToolBasicAV_t * pOMXAV, KDfloat32 time) {
static KDfloat32 GetMediaLength(OMXToolBasicAV_t * pOMXAV)
{
+// FIXME: Non NV case ..
+#if 0
NVX_PARAM_DURATION oDuration;
OMX_INDEXTYPE eParam;
@@ -682,6 +688,9 @@ static KDfloat32 GetMediaLength(OMXToolBasicAV_t * pOMXAV)
return -1.0f;
return (KDfloat32) (oDuration.nDuration * (1.0f/(1000.0f*1000.0f)));
+#else
+ return -1.0f;
+#endif
}
static OMX_ERRORTYPE UpdateStreamInfo(OMXToolBasicAV_t * pOMXAV, KDboolean issueCallback)
@@ -736,6 +745,8 @@ static OMX_ERRORTYPE UpdateStreamInfo(OMXToolBasicAV_t * pOMXAV, KDboolean issue
static int AttachAudioRenderer(OMXToolBasicAV_t * pOMXAV)
{
+// FIXME: Non NV case ..
+#if 0
int res=0;
// Configure audio port
@@ -808,6 +819,9 @@ static int AttachAudioRenderer(OMXToolBasicAV_t * pOMXAV)
OMXSAFE(OMX_SetupTunnel(pOMXAV->comp[OMXAV_H_CLOCK], pOMXAV->audioPort, pOMXAV->comp[OMXAV_H_ARENDERER], 1));
return OMX_ErrorNone;
+#else
+ return OMX_ErrorNotImplemented;
+#endif
}
static int AttachVideoRenderer(OMXToolBasicAV_t * pOMXAV)
@@ -911,7 +925,7 @@ static int DetachVideoRenderer(OMXToolBasicAV_t * pOMXAV)
return 0;
}
-OMXToolBasicAV_t * OMXToolBasicAV_CreateInstance()
+OMXToolBasicAV_t * OMXToolBasicAV_CreateInstance(EGLDisplay dpy)
{
int i;
OMXToolBasicAV_t * pOMXAV = NULL;
@@ -924,6 +938,8 @@ OMXToolBasicAV_t * OMXToolBasicAV_CreateInstance()
}
memset(pOMXAV, 0, sizeof(OMXToolBasicAV_t));
+ pOMXAV->dpy = dpy;
+
pOMXAV->audioPort=-1;
pOMXAV->videoPort=-1;
@@ -1410,7 +1426,7 @@ GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV) {
{
int attr;
if ( !_hasEGLSync || (
- eglGetSyncAttribKHR(pOMXAV->buffers[pOMXAV->omxPos].sync, EGL_SYNC_STATUS_KHR, &attr) &&
+ eglGetSyncAttribKHR(pOMXAV->dpy, pOMXAV->buffers[pOMXAV->omxPos].sync, EGL_SYNC_STATUS_KHR, &attr) &&
attr == EGL_SIGNALED_KHR )
)
{
@@ -1440,7 +1456,7 @@ GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV) {
//
// Only move on to rendering the next image if the insertion
// was successfull.
- if (!_hasEGLSync || eglFenceKHR(pOMXAV->buffers[pOMXAV->glPos].sync))
+ if (!_hasEGLSync || eglSignalSyncKHR(pOMXAV->dpy, pOMXAV->buffers[pOMXAV->glPos].sync, EGL_UNSIGNALED_KHR))
{
DBG_PRINT2( "GetNextTexture p3.2\n");
pOMXAV->available--;
@@ -1591,7 +1607,7 @@ int ModuleTest()
GETEXTENSION(PFNEGLDESTROYIMAGEKHRPROC, eglDestroyImageKHR);
- pOMXAV = OMXToolBasicAV_CreateInstance(3);
+ pOMXAV = OMXToolBasicAV_CreateInstance(eglDisplay);
if(OMXToolBasicAV_SetStream(pOMXAV, file)) {
return -1;
}
@@ -1641,8 +1657,8 @@ int ModuleTest()
}
printf("5 eglGetError: 0x%x\n", eglGetError());
- sync = eglCreateFenceSyncKHR(
- eglDisplay, EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR, &attrib);
+ sync = eglCreateSyncKHR(
+ eglDisplay, EGL_SYNC_FENCE_KHR, &attrib);
printf("6 eglGetError: 0x%x\n", eglGetError());
@@ -1652,12 +1668,12 @@ int ModuleTest()
}
printf("7\n");
- if( OMXToolBasicAV_ActivateStream(pOMXAV) ) {
+ if( OMXToolBasicAV_ActivateStream(eglDisplay, pOMXAV) ) {
return -1;
}
printf("8\n");
- if( OMXToolBasicAV_PlayStart(pOMXAV) ) {
+ if( OMXToolBasicAV_PlayStart(eglDisplay, pOMXAV) ) {
return -1;
}
@@ -1675,18 +1691,18 @@ int ModuleTest()
}
printf("9\n");
- if( OMXToolBasicAV_PlayStop(pOMXAV) ) {
+ if( OMXToolBasicAV_PlayStop(eglDisplay, pOMXAV) ) {
fprintf(stderr, "Err: Stop");
return -1;
}
printf("A1\n");
- OMXToolBasicAV_DetachVideoRenderer(pOMXAV); // Stop before ..
+ OMXToolBasicAV_DetachVideoRenderer(eglDisplay, pOMXAV); // Stop before ..
printf("A2\n");
- OMXToolBasicAV_AttachVideoRenderer(pOMXAV); // DetachVideoRenderer before ..
+ OMXToolBasicAV_AttachVideoRenderer(eglDisplay, pOMXAV); // DetachVideoRenderer before ..
printf("B\n");
- OMXToolBasicAV_DestroyInstance(pOMXAV);
+ OMXToolBasicAV_DestroyInstance(eglDisplay, pOMXAV);
printf("C\n");
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
diff --git a/src/jogl/native/openmax/omx_tool.h b/src/jogl/native/openmax/omx_tool.h
index 1a0adf0a0..dbc375dd7 100644
--- a/src/jogl/native/openmax/omx_tool.h
+++ b/src/jogl/native/openmax/omx_tool.h
@@ -1,3 +1,6 @@
+/**
+ * Uses the EGL Extensions: EGL_KHR_reusable_sync and EGL_KHR_fence_sync
+ */
#ifndef _OMX_TOOL_H
#define _OMX_TOOL_H
@@ -27,13 +30,12 @@
#endif
#include <OMX_Core.h>
+#include <OMX_Component.h>
#include <OMX_Index.h>
-#include <OMX_Video.h>
-#include <OMX_Audio.h>
-#include <OMX_Other.h>
-#include <OMX_Image.h>
+
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
+#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <KD/kd.h>
@@ -80,6 +82,7 @@ typedef enum
typedef struct {
+ EGLDisplay dpy;
OMX_VERSIONTYPE version;
OMX_HANDLETYPE comp[OMXAV_H_NUMBER];
OMX_HANDLETYPE endComponent;
@@ -138,7 +141,7 @@ KDint OMXToolBasicAV_SetState(OMXToolBasicAV_t * pOMXAV, OMX_STATETYPE state, KD
//
// User related functionality, mutex managed
//
-OMXToolBasicAV_t * OMXToolBasicAV_CreateInstance(); // #1
+OMXToolBasicAV_t * OMXToolBasicAV_CreateInstance(EGLDisplay dpy); // #1
void OMXToolBasicAV_SetStream(OMXToolBasicAV_t * pOMXAV, int vBufferNum, const KDchar * stream); // #2
void OMXToolBasicAV_SetStreamEGLImageTexture2D(OMXToolBasicAV_t * pOMXAV, KDint i, GLuint tex, EGLImageKHR image, EGLSyncKHR sync); // #3
void OMXToolBasicAV_ActivateStream(OMXToolBasicAV_t * pOMXAV); // #4