Implement a number of KHR EGL extensions

Add following KHR EGL extensions:

EGL_KHR_gl_texture_3D_image
EGL_KHR_config_attribs
EGL_KHR_surfaceless_context
EGL_KHR_stream
EGL_KHR_stream_fifo
EGL_KHR_stream_producer_eglsurface
EGL_KHR_stream_consumer_gltexture
EGL_KHR_stream_cross_process_fd

Change-Id: Ie7a35b5e3761e343cb71cf446cba77f67f604bdf
This commit is contained in:
Season Li 2015-07-01 11:39:40 -07:00 committed by Jesse Hall
parent bbd4f23247
commit 000d88f026
2 changed files with 251 additions and 12 deletions

View File

@ -91,11 +91,19 @@ extern char const * const gExtensionString =
"EGL_KHR_gl_colorspace "
#endif
"EGL_KHR_gl_texture_2D_image "
"EGL_KHR_gl_texture_3D_image "
"EGL_KHR_gl_texture_cubemap_image "
"EGL_KHR_gl_renderbuffer_image "
"EGL_KHR_reusable_sync "
"EGL_KHR_fence_sync "
"EGL_KHR_create_context "
"EGL_KHR_config_attribs "
"EGL_KHR_surfaceless_context "
"EGL_KHR_stream "
"EGL_KHR_stream_fifo "
"EGL_KHR_stream_producer_eglsurface "
"EGL_KHR_stream_consumer_gltexture "
"EGL_KHR_stream_cross_process_fd "
"EGL_EXT_create_context_robustness "
"EGL_NV_system_time "
"EGL_ANDROID_image_native_buffer " // mandatory
@ -164,6 +172,31 @@ static const extention_map_t sExtensionMap[] = {
// EGL_KHR_partial_update
{ "eglSetDamageRegionKHR",
(__eglMustCastToProperFunctionPointerType)&eglSetDamageRegionKHR },
{ "eglCreateStreamKHR",
(__eglMustCastToProperFunctionPointerType)&eglCreateStreamKHR },
{ "eglDestroyStreamKHR",
(__eglMustCastToProperFunctionPointerType)&eglDestroyStreamKHR },
{ "eglStreamAttribKHR",
(__eglMustCastToProperFunctionPointerType)&eglStreamAttribKHR },
{ "eglQueryStreamKHR",
(__eglMustCastToProperFunctionPointerType)&eglQueryStreamKHR },
{ "eglQueryStreamu64KHR",
(__eglMustCastToProperFunctionPointerType)&eglQueryStreamu64KHR },
{ "eglQueryStreamTimeKHR",
(__eglMustCastToProperFunctionPointerType)&eglQueryStreamTimeKHR },
{ "eglCreateStreamProducerSurfaceKHR",
(__eglMustCastToProperFunctionPointerType)&eglCreateStreamProducerSurfaceKHR },
{ "eglStreamConsumerGLTextureExternalKHR",
(__eglMustCastToProperFunctionPointerType)&eglStreamConsumerGLTextureExternalKHR },
{ "eglStreamConsumerAcquireKHR",
(__eglMustCastToProperFunctionPointerType)&eglStreamConsumerAcquireKHR },
{ "eglStreamConsumerReleaseKHR",
(__eglMustCastToProperFunctionPointerType)&eglStreamConsumerReleaseKHR },
{ "eglGetStreamFileDescriptorKHR",
(__eglMustCastToProperFunctionPointerType)&eglGetStreamFileDescriptorKHR },
{ "eglCreateStreamFromFileDescriptorKHR",
(__eglMustCastToProperFunctionPointerType)&eglCreateStreamFromFileDescriptorKHR },
};
/*
@ -1527,6 +1560,212 @@ EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync,
return result;
}
EGLStreamKHR eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_NO_STREAM_KHR;
EGLStreamKHR result = EGL_NO_STREAM_KHR;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglCreateStreamKHR) {
result = cnx->egl.eglCreateStreamKHR(
dp->disp.dpy, attrib_list);
}
return result;
}
EGLBoolean eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglDestroyStreamKHR) {
result = cnx->egl.eglDestroyStreamKHR(
dp->disp.dpy, stream);
}
return result;
}
EGLBoolean eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream,
EGLenum attribute, EGLint value)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglStreamAttribKHR) {
result = cnx->egl.eglStreamAttribKHR(
dp->disp.dpy, stream, attribute, value);
}
return result;
}
EGLBoolean eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream,
EGLenum attribute, EGLint *value)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglQueryStreamKHR) {
result = cnx->egl.eglQueryStreamKHR(
dp->disp.dpy, stream, attribute, value);
}
return result;
}
EGLBoolean eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream,
EGLenum attribute, EGLuint64KHR *value)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglQueryStreamu64KHR) {
result = cnx->egl.eglQueryStreamu64KHR(
dp->disp.dpy, stream, attribute, value);
}
return result;
}
EGLBoolean eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream,
EGLenum attribute, EGLTimeKHR *value)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglQueryStreamTimeKHR) {
result = cnx->egl.eglQueryStreamTimeKHR(
dp->disp.dpy, stream, attribute, value);
}
return result;
}
EGLSurface eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config,
EGLStreamKHR stream, const EGLint *attrib_list)
{
clearError();
egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_NO_SURFACE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglCreateStreamProducerSurfaceKHR) {
EGLSurface surface = cnx->egl.eglCreateStreamProducerSurfaceKHR(
dp->disp.dpy, config, stream, attrib_list);
if (surface != EGL_NO_SURFACE) {
egl_surface_t* s = new egl_surface_t(dp.get(), config, NULL,
surface, cnx);
return s;
}
}
return EGL_NO_SURFACE;
}
EGLBoolean eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy,
EGLStreamKHR stream)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglStreamConsumerGLTextureExternalKHR) {
result = cnx->egl.eglStreamConsumerGLTextureExternalKHR(
dp->disp.dpy, stream);
}
return result;
}
EGLBoolean eglStreamConsumerAcquireKHR(EGLDisplay dpy,
EGLStreamKHR stream)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglStreamConsumerAcquireKHR) {
result = cnx->egl.eglStreamConsumerAcquireKHR(
dp->disp.dpy, stream);
}
return result;
}
EGLBoolean eglStreamConsumerReleaseKHR(EGLDisplay dpy,
EGLStreamKHR stream)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglStreamConsumerReleaseKHR) {
result = cnx->egl.eglStreamConsumerReleaseKHR(
dp->disp.dpy, stream);
}
return result;
}
EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR(
EGLDisplay dpy, EGLStreamKHR stream)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_NO_FILE_DESCRIPTOR_KHR;
EGLNativeFileDescriptorKHR result = EGL_NO_FILE_DESCRIPTOR_KHR;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglGetStreamFileDescriptorKHR) {
result = cnx->egl.eglGetStreamFileDescriptorKHR(
dp->disp.dpy, stream);
}
return result;
}
EGLStreamKHR eglCreateStreamFromFileDescriptorKHR(
EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor)
{
clearError();
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_NO_STREAM_KHR;
EGLStreamKHR result = EGL_NO_STREAM_KHR;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglCreateStreamFromFileDescriptorKHR) {
result = cnx->egl.eglCreateStreamFromFileDescriptorKHR(
dp->disp.dpy, file_descriptor);
}
return result;
}
// ----------------------------------------------------------------------------
// EGL_EGLEXT_VERSION 15
// ----------------------------------------------------------------------------

View File

@ -61,18 +61,18 @@ EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint,
/* EGL_EGLEXT_VERSION 15 */
// EGL_ENTRY(EGLStreamKHR, eglCreateStreamKHR, EGLDisplay, const EGLint *)
// EGL_ENTRY(EGLBoolean, eglDestroyStreamKHR, EGLDisplay, EGLStreamKHR)
// EGL_ENTRY(EGLBoolean, eglStreamAttribKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint)
// EGL_ENTRY(EGLBoolean, eglQueryStreamKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint *)
// EGL_ENTRY(EGLBoolean, eglQueryStreamu64KHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLuint64KHR *)
// EGL_ENTRY(EGLBoolean, eglStreamConsumerGLTextureExternalKHR, EGLDisplay, EGLStreamKHR)
// EGL_ENTRY(EGLBoolean, eglStreamConsumerAcquireKHR, EGLDisplay, EGLStreamKHR)
// EGL_ENTRY(EGLBoolean, eglStreamConsumerReleaseKHR, EGLDisplay, EGLStreamKHR)
// EGL_ENTRY(EGLSurface, eglCreateStreamProducerSurfaceKHR, EGLDisplay, EGLConfig, EGLStreamKHR, const EGLint *)
// EGL_ENTRY(EGLBoolean, eglQueryStreamTimeKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLTimeKHR*)
// EGL_ENTRY(EGLNativeFileDescriptorKHR, eglGetStreamFileDescriptorKHR, EGLDisplay, EGLStreamKHR)
// EGL_ENTRY(EGLStreamKHR, eglCreateStreamFromFileDescriptorKHR, EGLDisplay, EGLNativeFileDescriptorKHR)
EGL_ENTRY(EGLStreamKHR, eglCreateStreamKHR, EGLDisplay, const EGLint *)
EGL_ENTRY(EGLBoolean, eglDestroyStreamKHR, EGLDisplay, EGLStreamKHR)
EGL_ENTRY(EGLBoolean, eglStreamAttribKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint)
EGL_ENTRY(EGLBoolean, eglQueryStreamKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint *)
EGL_ENTRY(EGLBoolean, eglQueryStreamu64KHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLuint64KHR *)
EGL_ENTRY(EGLBoolean, eglStreamConsumerGLTextureExternalKHR, EGLDisplay, EGLStreamKHR)
EGL_ENTRY(EGLBoolean, eglStreamConsumerAcquireKHR, EGLDisplay, EGLStreamKHR)
EGL_ENTRY(EGLBoolean, eglStreamConsumerReleaseKHR, EGLDisplay, EGLStreamKHR)
EGL_ENTRY(EGLSurface, eglCreateStreamProducerSurfaceKHR, EGLDisplay, EGLConfig, EGLStreamKHR, const EGLint *)
EGL_ENTRY(EGLBoolean, eglQueryStreamTimeKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLTimeKHR*)
EGL_ENTRY(EGLNativeFileDescriptorKHR, eglGetStreamFileDescriptorKHR, EGLDisplay, EGLStreamKHR)
EGL_ENTRY(EGLStreamKHR, eglCreateStreamFromFileDescriptorKHR, EGLDisplay, EGLNativeFileDescriptorKHR)
EGL_ENTRY(EGLint, eglWaitSyncKHR, EGLDisplay, EGLSyncKHR, EGLint)
/* ANDROID extensions */