From: Eric Engestrom Date: Mon, 20 Jul 2020 11:38:24 +0000 (+0200) Subject: egl: inline _EGLAPI into _EGLDriver X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc03448008b86e2eacb95eddf27522dd6d6a2f99;p=mesa.git egl: inline _EGLAPI into _EGLDriver _EGLDriver was an empty wrapper around _EGLAPI, so let's only keep one of them. "driver" represents better what's being accessed, so that's the one we're keeping. Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt Part-of: --- diff --git a/src/egl/Makefile.sources b/src/egl/Makefile.sources index da1fce11de1..92589fafe24 100644 --- a/src/egl/Makefile.sources +++ b/src/egl/Makefile.sources @@ -1,6 +1,5 @@ LIBEGL_C_FILES := \ main/eglapi.c \ - main/eglapi.h \ main/eglarray.c \ main/eglarray.h \ main/eglconfig.c \ diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index ea8f15de114..4fc8d401991 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1136,7 +1136,7 @@ dri2_setup_extensions(_EGLDisplay *disp) } /** - * Called via eglInitialize(), GLX_drv->API.Initialize(). + * Called via eglInitialize(), drv->Initialize(). * * This must be guaranteed to be called exactly once, even if eglInitialize is * called many times (without a eglTerminate in between). @@ -1305,7 +1305,7 @@ dri2_egl_surface_free_local_buffers(struct dri2_egl_surface *dri2_surf) } /** - * Called via eglTerminate(), drv->API.Terminate(). + * Called via eglTerminate(), drv->Terminate(). * * This must be guaranteed to be called exactly once, even if eglTerminate is * called many times (without a eglInitialize in between). @@ -1463,7 +1463,7 @@ dri2_fill_context_attribs(struct dri2_egl_context *dri2_ctx, } /** - * Called via eglCreateContext(), drv->API.CreateContext(). + * Called via eglCreateContext(), drv->CreateContext(). */ static _EGLContext * dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, @@ -1638,7 +1638,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, } /** - * Called via eglDestroyContext(), drv->API.DestroyContext(). + * Called via eglDestroyContext(), drv->DestroyContext(). */ static EGLBoolean dri2_destroy_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx) @@ -1753,7 +1753,7 @@ dri2_create_drawable(struct dri2_egl_display *dri2_dpy, } /** - * Called via eglMakeCurrent(), drv->API.MakeCurrent(). + * Called via eglMakeCurrent(), drv->MakeCurrent(). */ static EGLBoolean dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, @@ -1871,7 +1871,7 @@ dri2_surface_get_dri_drawable(_EGLSurface *surf) } /* - * Called from eglGetProcAddress() via drv->API.GetProcAddress(). + * Called from eglGetProcAddress() via drv->GetProcAddress(). */ static _EGLProc dri2_get_proc_address(_EGLDriver *drv, const char *procname) @@ -3655,55 +3655,55 @@ dri2_interop_export_object(_EGLDisplay *disp, _EGLContext *ctx, void _eglInitDriver(_EGLDriver *dri2_drv) { - dri2_drv->API.Initialize = dri2_initialize; - dri2_drv->API.Terminate = dri2_terminate; - dri2_drv->API.CreateContext = dri2_create_context; - dri2_drv->API.DestroyContext = dri2_destroy_context; - dri2_drv->API.MakeCurrent = dri2_make_current; - dri2_drv->API.CreateWindowSurface = dri2_create_window_surface; - dri2_drv->API.CreatePixmapSurface = dri2_create_pixmap_surface; - dri2_drv->API.CreatePbufferSurface = dri2_create_pbuffer_surface; - dri2_drv->API.DestroySurface = dri2_destroy_surface; - dri2_drv->API.GetProcAddress = dri2_get_proc_address; - dri2_drv->API.WaitClient = dri2_wait_client; - dri2_drv->API.WaitNative = dri2_wait_native; - dri2_drv->API.BindTexImage = dri2_bind_tex_image; - dri2_drv->API.ReleaseTexImage = dri2_release_tex_image; - dri2_drv->API.SwapInterval = dri2_swap_interval; - dri2_drv->API.SwapBuffers = dri2_swap_buffers; - dri2_drv->API.SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage; - dri2_drv->API.SwapBuffersRegionNOK = dri2_swap_buffers_region; - dri2_drv->API.SetDamageRegion = dri2_set_damage_region; - dri2_drv->API.PostSubBufferNV = dri2_post_sub_buffer; - dri2_drv->API.CopyBuffers = dri2_copy_buffers, - dri2_drv->API.QueryBufferAge = dri2_query_buffer_age; - dri2_drv->API.CreateImageKHR = dri2_create_image; - dri2_drv->API.DestroyImageKHR = dri2_destroy_image_khr; - dri2_drv->API.CreateWaylandBufferFromImageWL = dri2_create_wayland_buffer_from_image; - dri2_drv->API.QuerySurface = dri2_query_surface; - dri2_drv->API.QueryDriverName = dri2_query_driver_name; - dri2_drv->API.QueryDriverConfig = dri2_query_driver_config; + dri2_drv->Initialize = dri2_initialize; + dri2_drv->Terminate = dri2_terminate; + dri2_drv->CreateContext = dri2_create_context; + dri2_drv->DestroyContext = dri2_destroy_context; + dri2_drv->MakeCurrent = dri2_make_current; + dri2_drv->CreateWindowSurface = dri2_create_window_surface; + dri2_drv->CreatePixmapSurface = dri2_create_pixmap_surface; + dri2_drv->CreatePbufferSurface = dri2_create_pbuffer_surface; + dri2_drv->DestroySurface = dri2_destroy_surface; + dri2_drv->GetProcAddress = dri2_get_proc_address; + dri2_drv->WaitClient = dri2_wait_client; + dri2_drv->WaitNative = dri2_wait_native; + dri2_drv->BindTexImage = dri2_bind_tex_image; + dri2_drv->ReleaseTexImage = dri2_release_tex_image; + dri2_drv->SwapInterval = dri2_swap_interval; + dri2_drv->SwapBuffers = dri2_swap_buffers; + dri2_drv->SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage; + dri2_drv->SwapBuffersRegionNOK = dri2_swap_buffers_region; + dri2_drv->SetDamageRegion = dri2_set_damage_region; + dri2_drv->PostSubBufferNV = dri2_post_sub_buffer; + dri2_drv->CopyBuffers = dri2_copy_buffers, + dri2_drv->QueryBufferAge = dri2_query_buffer_age; + dri2_drv->CreateImageKHR = dri2_create_image; + dri2_drv->DestroyImageKHR = dri2_destroy_image_khr; + dri2_drv->CreateWaylandBufferFromImageWL = dri2_create_wayland_buffer_from_image; + dri2_drv->QuerySurface = dri2_query_surface; + dri2_drv->QueryDriverName = dri2_query_driver_name; + dri2_drv->QueryDriverConfig = dri2_query_driver_config; #ifdef HAVE_LIBDRM - dri2_drv->API.CreateDRMImageMESA = dri2_create_drm_image_mesa; - dri2_drv->API.ExportDRMImageMESA = dri2_export_drm_image_mesa; - dri2_drv->API.ExportDMABUFImageQueryMESA = dri2_export_dma_buf_image_query_mesa; - dri2_drv->API.ExportDMABUFImageMESA = dri2_export_dma_buf_image_mesa; - dri2_drv->API.QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats; - dri2_drv->API.QueryDmaBufModifiersEXT = dri2_query_dma_buf_modifiers; + dri2_drv->CreateDRMImageMESA = dri2_create_drm_image_mesa; + dri2_drv->ExportDRMImageMESA = dri2_export_drm_image_mesa; + dri2_drv->ExportDMABUFImageQueryMESA = dri2_export_dma_buf_image_query_mesa; + dri2_drv->ExportDMABUFImageMESA = dri2_export_dma_buf_image_mesa; + dri2_drv->QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats; + dri2_drv->QueryDmaBufModifiersEXT = dri2_query_dma_buf_modifiers; #endif #ifdef HAVE_WAYLAND_PLATFORM - dri2_drv->API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl; - dri2_drv->API.UnbindWaylandDisplayWL = dri2_unbind_wayland_display_wl; - dri2_drv->API.QueryWaylandBufferWL = dri2_query_wayland_buffer_wl; + dri2_drv->BindWaylandDisplayWL = dri2_bind_wayland_display_wl; + dri2_drv->UnbindWaylandDisplayWL = dri2_unbind_wayland_display_wl; + dri2_drv->QueryWaylandBufferWL = dri2_query_wayland_buffer_wl; #endif - dri2_drv->API.GetSyncValuesCHROMIUM = dri2_get_sync_values_chromium; - dri2_drv->API.CreateSyncKHR = dri2_create_sync; - dri2_drv->API.ClientWaitSyncKHR = dri2_client_wait_sync; - dri2_drv->API.SignalSyncKHR = dri2_signal_sync; - dri2_drv->API.WaitSyncKHR = dri2_server_wait_sync; - dri2_drv->API.DestroySyncKHR = dri2_destroy_sync; - dri2_drv->API.GLInteropQueryDeviceInfo = dri2_interop_query_device_info; - dri2_drv->API.GLInteropExportObject = dri2_interop_export_object; - dri2_drv->API.DupNativeFenceFDANDROID = dri2_dup_native_fence_fd; - dri2_drv->API.SetBlobCacheFuncsANDROID = dri2_set_blob_cache_funcs; + dri2_drv->GetSyncValuesCHROMIUM = dri2_get_sync_values_chromium; + dri2_drv->CreateSyncKHR = dri2_create_sync; + dri2_drv->ClientWaitSyncKHR = dri2_client_wait_sync; + dri2_drv->SignalSyncKHR = dri2_signal_sync; + dri2_drv->WaitSyncKHR = dri2_server_wait_sync; + dri2_drv->DestroySyncKHR = dri2_destroy_sync; + dri2_drv->GLInteropQueryDeviceInfo = dri2_interop_query_device_info; + dri2_drv->GLInteropExportObject = dri2_interop_export_object; + dri2_drv->DupNativeFenceFDANDROID = dri2_dup_native_fence_fd; + dri2_drv->SetBlobCacheFuncsANDROID = dri2_set_blob_cache_funcs; } diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index f65eca1494f..b49337eef53 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -304,7 +304,7 @@ get_wl_surface_proxy(struct wl_egl_window *window) } /** - * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). + * Called via eglCreateWindowSurface(), drv->CreateWindowSurface(). */ static _EGLSurface * dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, @@ -426,7 +426,7 @@ dri2_wl_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp, } /** - * Called via eglDestroySurface(), drv->API.DestroySurface(). + * Called via eglDestroySurface(), drv->DestroySurface(). */ static EGLBoolean dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) @@ -1050,7 +1050,7 @@ try_damage_buffer(struct dri2_egl_surface *dri2_surf, } /** - * Called via eglSwapBuffers(), drv->API.SwapBuffers(). + * Called via eglSwapBuffers(), drv->SwapBuffers(). */ static EGLBoolean dri2_wl_swap_buffers_with_damage(_EGLDriver *drv, diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 8732a70c019..200f397691d 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -244,7 +244,7 @@ dri2_x11_get_red_mask_for_depth(struct dri2_egl_display *dri2_dpy, int depth) } /** - * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). + * Called via eglCreateWindowSurface(), drv->CreateWindowSurface(). */ static _EGLSurface * dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, @@ -360,7 +360,7 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type, } /** - * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). + * Called via eglCreateWindowSurface(), drv->CreateWindowSurface(). */ static _EGLSurface * dri2_x11_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index f230fcabb5b..ed410544a53 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -219,7 +219,7 @@ dri3_authenticate(_EGLDisplay *disp, uint32_t id) } /** - * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). + * Called via eglCreateWindowSurface(), drv->CreateWindowSurface(). */ static _EGLSurface * dri3_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, diff --git a/src/egl/drivers/haiku/egl_haiku.cpp b/src/egl/drivers/haiku/egl_haiku.cpp index ee92abe2574..52ab9dc7a7e 100644 --- a/src/egl/drivers/haiku/egl_haiku.cpp +++ b/src/egl/drivers/haiku/egl_haiku.cpp @@ -73,7 +73,7 @@ struct haiku_egl_surface /** - * Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface(). + * Called via eglCreateWindowSurface(), drv->CreateWindowSurface(). */ static _EGLSurface * haiku_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp, @@ -321,17 +321,17 @@ _eglInitDriver(_EGLDriver *driver) { CALLED(); - driver->API.Initialize = init_haiku; - driver->API.Terminate = haiku_terminate; - driver->API.CreateContext = haiku_create_context; - driver->API.DestroyContext = haiku_destroy_context; - driver->API.MakeCurrent = haiku_make_current; - driver->API.CreateWindowSurface = haiku_create_window_surface; - driver->API.CreatePixmapSurface = haiku_create_pixmap_surface; - driver->API.CreatePbufferSurface = haiku_create_pbuffer_surface; - driver->API.DestroySurface = haiku_destroy_surface; - - driver->API.SwapBuffers = haiku_swap_buffers; + driver->Initialize = init_haiku; + driver->Terminate = haiku_terminate; + driver->CreateContext = haiku_create_context; + driver->DestroyContext = haiku_destroy_context; + driver->MakeCurrent = haiku_make_current; + driver->CreateWindowSurface = haiku_create_window_surface; + driver->CreatePixmapSurface = haiku_create_pixmap_surface; + driver->CreatePbufferSurface = haiku_create_pbuffer_surface; + driver->DestroySurface = haiku_destroy_surface; + + driver->SwapBuffers = haiku_swap_buffers; TRACE("API Calls defined\n"); } diff --git a/src/egl/main/README.txt b/src/egl/main/README.txt index 9b5fd410618..3e236500215 100644 --- a/src/egl/main/README.txt +++ b/src/egl/main/README.txt @@ -25,11 +25,11 @@ entrypoints set. As part of initialization, the dispatch table in _EGLDriver->API must be populated with all the EGL entrypoints. Some functions like -driver->API.Initialize and driver->API.Terminate _must_ be implemented +driver->Initialize and driver->Terminate _must_ be implemented with driver-specific code (no default/fallback function is possible). -Shortly after, the driver->API.Initialize() function is executed. Any additional +Shortly after, the driver->Initialize() function is executed. Any additional driver initialization that wasn't done in the driver entry point should be done at this point. Typically, this will involve setting up visual configs, etc. @@ -54,7 +54,7 @@ defaults/fallbacks. Same thing for the eglGet/Query functions. Teardown: -When eglTerminate() is called, the driver->API.Terminate() function is +When eglTerminate() is called, the driver->Terminate() function is called. The driver should clean up after itself. eglTerminate() will then close/unload the driver (shared library). diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index e24a2672d0c..21fb747d692 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -96,7 +96,6 @@ #include "c11/threads.h" #include "util/macros.h" -#include "eglapi.h" #include "egldefines.h" #include "eglglobals.h" #include "eglcontext.h" @@ -675,7 +674,7 @@ eglTerminate(EGLDisplay dpy) if (disp->Initialized) { _EGLDriver *drv = disp->Driver; - drv->API.Terminate(drv, disp); + drv->Terminate(drv, disp); /* do not reset disp->Driver */ disp->ClientAPIsString[0] = 0; disp->Initialized = EGL_FALSE; @@ -805,7 +804,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, if (!share && share_list != EGL_NO_CONTEXT) RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT); - context = drv->API.CreateContext(drv, disp, conf, share, attrib_list); + context = drv->CreateContext(drv, disp, conf, share, attrib_list); ret = (context) ? _eglLinkContext(context) : EGL_NO_CONTEXT; RETURN_EGL_EVAL(disp, ret); @@ -824,7 +823,7 @@ eglDestroyContext(EGLDisplay dpy, EGLContext ctx) _EGL_CHECK_CONTEXT(disp, context, EGL_FALSE, drv); _eglUnlinkContext(context); - ret = drv->API.DestroyContext(drv, disp, context); + ret = drv->DestroyContext(drv, disp, context); RETURN_EGL_EVAL(disp, ret); } @@ -882,7 +881,7 @@ eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, if (read_surf && read_surf->Lost) RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_FALSE); - ret = drv->API.MakeCurrent(drv, disp, draw_surf, read_surf, context); + ret = drv->MakeCurrent(drv, disp, draw_surf, read_surf, context); RETURN_EGL_EVAL(disp, ret); } @@ -971,7 +970,7 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config, if (_eglNativeSurfaceAlreadyUsed(disp, native_window)) RETURN_EGL_ERROR(disp, EGL_BAD_ALLOC, EGL_NO_SURFACE); - surf = drv->API.CreateWindowSurface(drv, disp, conf, native_window, + surf = drv->CreateWindowSurface(drv, disp, conf, native_window, attrib_list); ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; @@ -1098,7 +1097,7 @@ _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config, if (_eglNativeSurfaceAlreadyUsed(disp, native_pixmap)) RETURN_EGL_ERROR(disp, EGL_BAD_ALLOC, EGL_NO_SURFACE); - surf = drv->API.CreatePixmapSurface(drv, disp, conf, native_pixmap, + surf = drv->CreatePixmapSurface(drv, disp, conf, native_pixmap, attrib_list); ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; @@ -1171,7 +1170,7 @@ eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, if ((conf->SurfaceType & EGL_PBUFFER_BIT) == 0) RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SURFACE); - surf = drv->API.CreatePbufferSurface(drv, disp, conf, attrib_list); + surf = drv->CreatePbufferSurface(drv, disp, conf, attrib_list); ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE; RETURN_EGL_EVAL(disp, ret); @@ -1189,7 +1188,7 @@ eglDestroySurface(EGLDisplay dpy, EGLSurface surface) _EGL_FUNC_START(disp, EGL_OBJECT_SURFACE_KHR, surf, EGL_FALSE); _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); _eglUnlinkSurface(surf); - ret = drv->API.DestroySurface(drv, disp, surf); + ret = drv->DestroySurface(drv, disp, surf); RETURN_EGL_EVAL(disp, ret); } @@ -1206,8 +1205,8 @@ eglQuerySurface(EGLDisplay dpy, EGLSurface surface, _EGL_FUNC_START(disp, EGL_OBJECT_SURFACE_KHR, surf, EGL_FALSE); _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); - if (drv->API.QuerySurface) - ret = drv->API.QuerySurface(drv, disp, surf, attribute, value); + if (drv->QuerySurface) + ret = drv->QuerySurface(drv, disp, surf, attribute, value); else ret = _eglQuerySurface(drv, disp, surf, attribute, value); @@ -1242,7 +1241,7 @@ eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) _EGL_FUNC_START(disp, EGL_OBJECT_SURFACE_KHR, surf, EGL_FALSE); _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); - ret = drv->API.BindTexImage(drv, disp, surf, buffer); + ret = drv->BindTexImage(drv, disp, surf, buffer); RETURN_EGL_EVAL(disp, ret); } @@ -1258,7 +1257,7 @@ eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) _EGL_FUNC_START(disp, EGL_OBJECT_SURFACE_KHR, surf, EGL_FALSE); _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); - ret = drv->API.ReleaseTexImage(drv, disp, surf, buffer); + ret = drv->ReleaseTexImage(drv, disp, surf, buffer); RETURN_EGL_EVAL(disp, ret); } @@ -1291,8 +1290,8 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval) surf->Config->MaxSwapInterval); if (surf->SwapInterval != interval) { - if (drv->API.SwapInterval) - ret = drv->API.SwapInterval(drv, disp, surf, interval); + if (drv->SwapInterval) + ret = drv->SwapInterval(drv, disp, surf, interval); else ret = _eglSwapInterval(drv, disp, surf, interval); } @@ -1338,7 +1337,7 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) if (surf->Lost) RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_FALSE); - ret = drv->API.SwapBuffers(drv, disp, surf); + ret = drv->SwapBuffers(drv, disp, surf); /* EGL_KHR_partial_update * Frame boundary successfully reached, @@ -1374,7 +1373,7 @@ _eglSwapBuffersWithDamageCommon(_EGLDisplay *disp, _EGLSurface *surf, if ((n_rects > 0 && rects == NULL) || n_rects < 0) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.SwapBuffersWithDamageEXT(drv, disp, surf, rects, n_rects); + ret = drv->SwapBuffersWithDamageEXT(drv, disp, surf, rects, n_rects); /* EGL_KHR_partial_update * Frame boundary successfully reached, @@ -1461,7 +1460,7 @@ eglSetDamageRegionKHR(EGLDisplay dpy, EGLSurface surface, RETURN_EGL_ERROR(disp, EGL_BAD_ACCESS, EGL_FALSE); _eglSetDamageRegionKHRClampRects(disp, surf, rects, n_rects); - ret = drv->API.SetDamageRegion(drv, disp, surf, rects, n_rects); + ret = drv->SetDamageRegion(drv, disp, surf, rects, n_rects); if (ret) surf->SetDamageRegionCalled = EGL_TRUE; @@ -1483,7 +1482,7 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) native_pixmap_ptr = (void*) target; _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv); - ret = drv->API.CopyBuffers(drv, disp, surf, native_pixmap_ptr); + ret = drv->CopyBuffers(drv, disp, surf, native_pixmap_ptr); RETURN_EGL_EVAL(disp, ret); } @@ -1511,7 +1510,7 @@ _eglWaitClientCommon(void) /* a valid current context implies an initialized current display */ assert(disp->Initialized); drv = disp->Driver; - ret = drv->API.WaitClient(drv, disp, ctx); + ret = drv->WaitClient(drv, disp, ctx); RETURN_EGL_EVAL(disp, ret); } @@ -1556,7 +1555,7 @@ eglWaitNative(EGLint engine) /* a valid current context implies an initialized current display */ assert(disp->Initialized); drv = disp->Driver; - ret = drv->API.WaitNative(drv, disp, engine); + ret = drv->WaitNative(drv, disp, engine); RETURN_EGL_EVAL(disp, ret); } @@ -1714,7 +1713,7 @@ eglReleaseThread(void) mtx_lock(&disp->Mutex); drv = disp->Driver; - (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); + (void) drv->MakeCurrent(drv, disp, NULL, NULL, NULL); mtx_unlock(&disp->Mutex); } } @@ -1745,7 +1744,7 @@ _eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target, if (ctx != EGL_NO_CONTEXT && target == EGL_LINUX_DMA_BUF_EXT) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); - img = drv->API.CreateImageKHR(drv, disp, context, target, + img = drv->CreateImageKHR(drv, disp, context, target, buffer, attr_list); ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR; @@ -1795,7 +1794,7 @@ _eglDestroyImageCommon(_EGLDisplay *disp, _EGLImage *img) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); _eglUnlinkImage(img); - ret = drv->API.DestroyImageKHR(drv, disp, img); + ret = drv->DestroyImageKHR(drv, disp, img); RETURN_EGL_EVAL(disp, ret); } @@ -1879,7 +1878,7 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list, RETURN_EGL_ERROR(disp, invalid_type_error, EGL_NO_SYNC_KHR); } - sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list); + sync = drv->CreateSyncKHR(drv, disp, type, attrib_list); ret = (sync) ? _eglLinkSync(sync) : EGL_NO_SYNC_KHR; RETURN_EGL_EVAL(disp, ret); @@ -1947,7 +1946,7 @@ _eglDestroySync(_EGLDisplay *disp, _EGLSync *s) disp->Extensions.ANDROID_native_fence_sync); _eglUnlinkSync(s); - ret = drv->API.DestroySyncKHR(drv, disp, s); + ret = drv->DestroySyncKHR(drv, disp, s); RETURN_EGL_EVAL(disp, ret); } @@ -1994,7 +1993,7 @@ _eglClientWaitSyncCommon(_EGLDisplay *disp, EGLDisplay dpy, if (s->Type == EGL_SYNC_REUSABLE_KHR) _eglUnlockDisplay(dpy); - ret = drv->API.ClientWaitSyncKHR(drv, disp, s, flags, timeout); + ret = drv->ClientWaitSyncKHR(drv, disp, s, flags, timeout); /* * 'disp' is already unlocked for reusable sync type, @@ -2047,7 +2046,7 @@ _eglWaitSyncCommon(_EGLDisplay *disp, _EGLSync *s, EGLint flags) if (flags != 0) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.WaitSyncKHR(drv, disp, s); + ret = drv->WaitSyncKHR(drv, disp, s); RETURN_EGL_EVAL(disp, ret); } @@ -2088,7 +2087,7 @@ eglSignalSyncKHR(EGLDisplay dpy, EGLSync sync, EGLenum mode) _EGL_CHECK_SYNC(disp, s, EGL_FALSE, drv); assert(disp->Extensions.KHR_reusable_sync); - ret = drv->API.SignalSyncKHR(drv, disp, s, mode); + ret = drv->SignalSyncKHR(drv, disp, s, mode); RETURN_EGL_EVAL(disp, ret); } @@ -2170,7 +2169,7 @@ eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSync sync) _EGL_CHECK_SYNC(disp, s, EGL_NO_NATIVE_FENCE_FD_ANDROID, drv); assert(disp->Extensions.ANDROID_native_fence_sync); - ret = drv->API.DupNativeFenceFDANDROID(drv, disp, s); + ret = drv->DupNativeFenceFDANDROID(drv, disp, s); RETURN_EGL_EVAL(disp, ret); } @@ -2197,7 +2196,7 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, surf != ctx->DrawSurface) RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE); - ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); + ret = drv->SwapBuffersRegionNOK(drv, disp, surf, numRects, rects); RETURN_EGL_EVAL(disp, ret); } @@ -2217,7 +2216,7 @@ eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list) if (!disp->Extensions.MESA_drm_image) RETURN_EGL_EVAL(disp, EGL_NO_IMAGE_KHR); - img = drv->API.CreateDRMImageMESA(drv, disp, attr_list); + img = drv->CreateDRMImageMESA(drv, disp, attr_list); ret = (img) ? _eglLinkImage(img) : EGL_NO_IMAGE_KHR; RETURN_EGL_EVAL(disp, ret); @@ -2240,7 +2239,7 @@ eglExportDRMImageMESA(EGLDisplay dpy, EGLImage image, if (!img) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.ExportDRMImageMESA(drv, disp, img, name, handle, stride); + ret = drv->ExportDRMImageMESA(drv, disp, img, name, handle, stride); RETURN_EGL_EVAL(disp, ret); } @@ -2263,7 +2262,7 @@ eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) if (!display) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.BindWaylandDisplayWL(drv, disp, display); + ret = drv->BindWaylandDisplayWL(drv, disp, display); RETURN_EGL_EVAL(disp, ret); } @@ -2283,7 +2282,7 @@ eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display) if (!display) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.UnbindWaylandDisplayWL(drv, disp, display); + ret = drv->UnbindWaylandDisplayWL(drv, disp, display); RETURN_EGL_EVAL(disp, ret); } @@ -2304,7 +2303,7 @@ eglQueryWaylandBufferWL(EGLDisplay dpy, struct wl_resource *buffer, if (!buffer) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.QueryWaylandBufferWL(drv, disp, buffer, attribute, value); + ret = drv->QueryWaylandBufferWL(drv, disp, buffer, attribute, value); RETURN_EGL_EVAL(disp, ret); } @@ -2329,7 +2328,7 @@ eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image) if (!img) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, NULL); - ret = drv->API.CreateWaylandBufferFromImageWL(drv, disp, img); + ret = drv->CreateWaylandBufferFromImageWL(drv, disp, img); RETURN_EGL_EVAL(disp, ret); } @@ -2350,7 +2349,7 @@ eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, if (!disp->Extensions.NV_post_sub_buffer) RETURN_EGL_EVAL(disp, EGL_FALSE); - ret = drv->API.PostSubBufferNV(drv, disp, surf, x, y, width, height); + ret = drv->PostSubBufferNV(drv, disp, surf, x, y, width, height); RETURN_EGL_EVAL(disp, ret); } @@ -2374,7 +2373,7 @@ eglGetSyncValuesCHROMIUM(EGLDisplay dpy, EGLSurface surface, if (!ust || !msc || !sbc) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.GetSyncValuesCHROMIUM(disp, surf, ust, msc, sbc); + ret = drv->GetSyncValuesCHROMIUM(disp, surf, ust, msc, sbc); RETURN_EGL_EVAL(disp, ret); } @@ -2397,7 +2396,7 @@ eglExportDMABUFImageQueryMESA(EGLDisplay dpy, EGLImage image, if (!img) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.ExportDMABUFImageQueryMESA(drv, disp, img, fourcc, nplanes, + ret = drv->ExportDMABUFImageQueryMESA(drv, disp, img, fourcc, nplanes, modifiers); RETURN_EGL_EVAL(disp, ret); @@ -2420,7 +2419,7 @@ eglExportDMABUFImageMESA(EGLDisplay dpy, EGLImage image, if (!img) RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); - ret = drv->API.ExportDMABUFImageMESA(drv, disp, img, fds, strides, offsets); + ret = drv->ExportDMABUFImageMESA(drv, disp, img, fds, strides, offsets); RETURN_EGL_EVAL(disp, ret); } @@ -2584,7 +2583,7 @@ eglQueryDmaBufFormatsEXT(EGLDisplay dpy, EGLint max_formats, _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); - ret = drv->API.QueryDmaBufFormatsEXT(drv, disp, max_formats, formats, + ret = drv->QueryDmaBufFormatsEXT(drv, disp, max_formats, formats, num_formats); RETURN_EGL_EVAL(disp, ret); @@ -2603,7 +2602,7 @@ eglQueryDmaBufModifiersEXT(EGLDisplay dpy, EGLint format, EGLint max_modifiers, _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); - ret = drv->API.QueryDmaBufModifiersEXT(drv, disp, format, max_modifiers, + ret = drv->QueryDmaBufModifiersEXT(drv, disp, format, max_modifiers, modifiers, external_only, num_modifiers); @@ -2648,7 +2647,7 @@ eglSetBlobCacheFuncsANDROID(EGLDisplay *dpy, EGLSetBlobFuncANDROID set, disp->BlobCacheSet = set; disp->BlobCacheGet = get; - drv->API.SetBlobCacheFuncsANDROID(drv, disp, set, get); + drv->SetBlobCacheFuncsANDROID(drv, disp, set, get); _eglUnlockDisplay(disp); } @@ -2728,7 +2727,7 @@ eglGetDisplayDriverConfig(EGLDisplay dpy) assert(disp->Extensions.MESA_query_driver); - ret = drv->API.QueryDriverConfig(disp); + ret = drv->QueryDriverConfig(disp); RETURN_EGL_EVAL(disp, ret); } @@ -2744,7 +2743,7 @@ eglGetDisplayDriverName(EGLDisplay dpy) assert(disp->Extensions.MESA_query_driver); - ret = drv->API.QueryDriverName(disp); + ret = drv->QueryDriverName(disp); RETURN_EGL_EVAL(disp, ret); } @@ -2818,8 +2817,8 @@ MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context, if (ret != MESA_GLINTEROP_SUCCESS) return ret; - if (drv->API.GLInteropQueryDeviceInfo) - ret = drv->API.GLInteropQueryDeviceInfo(disp, ctx, out); + if (drv->GLInteropQueryDeviceInfo) + ret = drv->GLInteropQueryDeviceInfo(disp, ctx, out); else ret = MESA_GLINTEROP_UNSUPPORTED; @@ -2841,8 +2840,8 @@ MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context, if (ret != MESA_GLINTEROP_SUCCESS) return ret; - if (drv->API.GLInteropExportObject) - ret = drv->API.GLInteropExportObject(disp, ctx, in, out); + if (drv->GLInteropExportObject) + ret = drv->GLInteropExportObject(disp, ctx, in, out); else ret = MESA_GLINTEROP_UNSUPPORTED; diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h deleted file mode 100644 index 968f4b27725..00000000000 --- a/src/egl/main/eglapi.h +++ /dev/null @@ -1,198 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 VMware, Inc. - * Copyright 2009-2010 Chia-I Wu - * Copyright 2010-2011 LunarG, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef EGLAPI_INCLUDED -#define EGLAPI_INCLUDED - -#include "egltypedefs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * A generic function ptr type - */ -typedef void (*_EGLProc)(void); - -struct wl_display; -struct mesa_glinterop_device_info; -struct mesa_glinterop_export_in; -struct mesa_glinterop_export_out; - -/** - * The API dispatcher jumps through these functions - */ -struct _egl_api -{ - /* driver funcs */ - EGLBoolean (*Initialize)(_EGLDriver *, _EGLDisplay *disp); - EGLBoolean (*Terminate)(_EGLDriver *, _EGLDisplay *disp); - const char *(*QueryDriverName)(_EGLDisplay *disp); - char *(*QueryDriverConfig)(_EGLDisplay *disp); - - /* context funcs */ - _EGLContext *(*CreateContext)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLConfig *config, _EGLContext *share_list, - const EGLint *attrib_list); - EGLBoolean (*DestroyContext)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLContext *ctx); - /* this is the only function (other than Initialize) that may be called - * with an uninitialized display - */ - EGLBoolean (*MakeCurrent)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *draw, _EGLSurface *read, - _EGLContext *ctx); - - /* surface funcs */ - _EGLSurface *(*CreateWindowSurface)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLConfig *config, void *native_window, - const EGLint *attrib_list); - _EGLSurface *(*CreatePixmapSurface)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLConfig *config, void *native_pixmap, - const EGLint *attrib_list); - _EGLSurface *(*CreatePbufferSurface)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLConfig *config, - const EGLint *attrib_list); - EGLBoolean (*DestroySurface)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface); - EGLBoolean (*QuerySurface)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, EGLint attribute, - EGLint *value); - EGLBoolean (*BindTexImage)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, EGLint buffer); - EGLBoolean (*ReleaseTexImage)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, EGLint buffer); - EGLBoolean (*SwapInterval)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surf, EGLint interval); - EGLBoolean (*SwapBuffers)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *draw); - EGLBoolean (*CopyBuffers)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, void *native_pixmap_target); - EGLBoolean (*SetDamageRegion)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, EGLint *rects, EGLint n_rects); - - /* misc functions */ - EGLBoolean (*WaitClient)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLContext *ctx); - EGLBoolean (*WaitNative)(_EGLDriver *drv, _EGLDisplay *disp, - EGLint engine); - - /* this function may be called from multiple threads at the same time */ - _EGLProc (*GetProcAddress)(_EGLDriver *drv, const char *procname); - - _EGLImage *(*CreateImageKHR)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLContext *ctx, EGLenum target, - EGLClientBuffer buffer, - const EGLint *attr_list); - EGLBoolean (*DestroyImageKHR)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLImage *image); - - _EGLSync *(*CreateSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, EGLenum type, - const EGLAttrib *attrib_list); - EGLBoolean (*DestroySyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSync *sync); - EGLint (*ClientWaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSync *sync, EGLint flags, EGLTime timeout); - EGLint (*WaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSync *sync); - EGLBoolean (*SignalSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSync *sync, EGLenum mode); - EGLint (*DupNativeFenceFDANDROID)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSync *sync); - - EGLBoolean (*SwapBuffersRegionNOK)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surf, EGLint numRects, - const EGLint *rects); - - _EGLImage *(*CreateDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp, - const EGLint *attr_list); - EGLBoolean (*ExportDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLImage *img, EGLint *name, - EGLint *handle, EGLint *stride); - - EGLBoolean (*BindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp, - struct wl_display *display); - EGLBoolean (*UnbindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp, - struct wl_display *display); - EGLBoolean (*QueryWaylandBufferWL)(_EGLDriver *drv, _EGLDisplay *displ, - struct wl_resource *buffer, - EGLint attribute, EGLint *value); - - struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDriver *drv, - _EGLDisplay *disp, - _EGLImage *img); - - EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, - const EGLint *rects, EGLint n_rects); - - EGLBoolean (*PostSubBufferNV)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLSurface *surface, EGLint x, EGLint y, - EGLint width, EGLint height); - - EGLint (*QueryBufferAge)(_EGLDriver *drv, - _EGLDisplay *disp, _EGLSurface *surface); - EGLBoolean (*GetSyncValuesCHROMIUM)(_EGLDisplay *disp, _EGLSurface *surface, - EGLuint64KHR *ust, EGLuint64KHR *msc, - EGLuint64KHR *sbc); - - EGLBoolean (*ExportDMABUFImageQueryMESA)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLImage *img, EGLint *fourcc, - EGLint *nplanes, - EGLuint64KHR *modifiers); - EGLBoolean (*ExportDMABUFImageMESA)(_EGLDriver *drv, _EGLDisplay *disp, - _EGLImage *img, EGLint *fds, - EGLint *strides, EGLint *offsets); - - int (*GLInteropQueryDeviceInfo)(_EGLDisplay *disp, _EGLContext *ctx, - struct mesa_glinterop_device_info *out); - int (*GLInteropExportObject)(_EGLDisplay *disp, _EGLContext *ctx, - struct mesa_glinterop_export_in *in, - struct mesa_glinterop_export_out *out); - - EGLBoolean (*QueryDmaBufFormatsEXT)(_EGLDriver *drv, _EGLDisplay *disp, - EGLint max_formats, EGLint *formats, - EGLint *num_formats); - EGLBoolean (*QueryDmaBufModifiersEXT) (_EGLDriver *drv, _EGLDisplay *disp, - EGLint format, EGLint max_modifiers, - EGLuint64KHR *modifiers, - EGLBoolean *external_only, - EGLint *num_modifiers); - - void (*SetBlobCacheFuncsANDROID) (_EGLDriver *drv, _EGLDisplay *disp, - EGLSetBlobFuncANDROID set, - EGLGetBlobFuncANDROID get); -}; - -#ifdef __cplusplus -} -#endif - -#endif /* EGLAPI_INCLUDED */ diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index 2cafc74db6f..3321d9e412e 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -303,7 +303,7 @@ _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) list = list->Next; _eglUnlinkContext(ctx); - drv->API.DestroyContext(drv, display, ctx); + drv->DestroyContext(drv, display, ctx); } assert(!display->ResourceLists[_EGL_RESOURCE_CONTEXT]); @@ -313,7 +313,7 @@ _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) list = list->Next; _eglUnlinkSurface(surf); - drv->API.DestroySurface(drv, display, surf); + drv->DestroySurface(drv, display, surf); } assert(!display->ResourceLists[_EGL_RESOURCE_SURFACE]); @@ -323,7 +323,7 @@ _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) list = list->Next; _eglUnlinkImage(image); - drv->API.DestroyImageKHR(drv, display, image); + drv->DestroyImageKHR(drv, display, image); } assert(!display->ResourceLists[_EGL_RESOURCE_IMAGE]); @@ -333,7 +333,7 @@ _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) list = list->Next; _eglUnlinkSync(sync); - drv->API.DestroySyncKHR(drv, display, sync); + drv->DestroySyncKHR(drv, display, sync); } assert(!display->ResourceLists[_EGL_RESOURCE_SYNC]); } diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 526de02e53b..7bc373d25d7 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -72,7 +72,7 @@ static _EGLDriver * _eglMatchAndInitialize(_EGLDisplay *disp) { if (_eglGetDriver()) - if (_eglDriver->API.Initialize(_eglDriver, disp)) + if (_eglDriver->Initialize(_eglDriver, disp)) return _eglDriver; return NULL; @@ -112,8 +112,8 @@ _eglMatchDriver(_EGLDisplay *disp) __eglMustCastToProperFunctionPointerType _eglGetDriverProc(const char *procname) { - if (_eglGetDriver() && _eglDriver->API.GetProcAddress) - return _eglDriver->API.GetProcAddress(_eglDriver, procname); + if (_eglGetDriver() && _eglDriver->GetProcAddress) + return _eglDriver->GetProcAddress(_eglDriver, procname); return NULL; } diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h index 1a5238af298..52767c26c52 100644 --- a/src/egl/main/egldriver.h +++ b/src/egl/main/egldriver.h @@ -35,7 +35,6 @@ #include "c99_compat.h" #include "egltypedefs.h" -#include "eglapi.h" #include @@ -69,13 +68,158 @@ extern "C" { _EGL_DRIVER_TYPECAST(drvname ## _surface, _EGLSurface, obj) \ _EGL_DRIVER_TYPECAST(drvname ## _config, _EGLConfig, obj) +/** + * A generic function ptr type + */ +typedef void (*_EGLProc)(void); + +struct wl_display; +struct mesa_glinterop_device_info; +struct mesa_glinterop_export_in; +struct mesa_glinterop_export_out; /** - * Base class for device drivers. + * The API dispatcher jumps through these functions */ struct _egl_driver { - _EGLAPI API; /**< EGL API dispatch table */ + /* driver funcs */ + EGLBoolean (*Initialize)(_EGLDriver *, _EGLDisplay *disp); + EGLBoolean (*Terminate)(_EGLDriver *, _EGLDisplay *disp); + const char *(*QueryDriverName)(_EGLDisplay *disp); + char *(*QueryDriverConfig)(_EGLDisplay *disp); + + /* context funcs */ + _EGLContext *(*CreateContext)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLConfig *config, _EGLContext *share_list, + const EGLint *attrib_list); + EGLBoolean (*DestroyContext)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLContext *ctx); + /* this is the only function (other than Initialize) that may be called + * with an uninitialized display + */ + EGLBoolean (*MakeCurrent)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *draw, _EGLSurface *read, + _EGLContext *ctx); + + /* surface funcs */ + _EGLSurface *(*CreateWindowSurface)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLConfig *config, void *native_window, + const EGLint *attrib_list); + _EGLSurface *(*CreatePixmapSurface)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLConfig *config, void *native_pixmap, + const EGLint *attrib_list); + _EGLSurface *(*CreatePbufferSurface)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLConfig *config, + const EGLint *attrib_list); + EGLBoolean (*DestroySurface)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface); + EGLBoolean (*QuerySurface)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface, EGLint attribute, + EGLint *value); + EGLBoolean (*BindTexImage)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface, EGLint buffer); + EGLBoolean (*ReleaseTexImage)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface, EGLint buffer); + EGLBoolean (*SwapInterval)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surf, EGLint interval); + EGLBoolean (*SwapBuffers)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *draw); + EGLBoolean (*CopyBuffers)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface, void *native_pixmap_target); + EGLBoolean (*SetDamageRegion)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface, EGLint *rects, EGLint n_rects); + + /* misc functions */ + EGLBoolean (*WaitClient)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLContext *ctx); + EGLBoolean (*WaitNative)(_EGLDriver *drv, _EGLDisplay *disp, + EGLint engine); + + /* this function may be called from multiple threads at the same time */ + _EGLProc (*GetProcAddress)(_EGLDriver *drv, const char *procname); + + _EGLImage *(*CreateImageKHR)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLContext *ctx, EGLenum target, + EGLClientBuffer buffer, + const EGLint *attr_list); + EGLBoolean (*DestroyImageKHR)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLImage *image); + + _EGLSync *(*CreateSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, EGLenum type, + const EGLAttrib *attrib_list); + EGLBoolean (*DestroySyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSync *sync); + EGLint (*ClientWaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSync *sync, EGLint flags, EGLTime timeout); + EGLint (*WaitSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSync *sync); + EGLBoolean (*SignalSyncKHR)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSync *sync, EGLenum mode); + EGLint (*DupNativeFenceFDANDROID)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSync *sync); + + EGLBoolean (*SwapBuffersRegionNOK)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surf, EGLint numRects, + const EGLint *rects); + + _EGLImage *(*CreateDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp, + const EGLint *attr_list); + EGLBoolean (*ExportDRMImageMESA)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLImage *img, EGLint *name, + EGLint *handle, EGLint *stride); + + EGLBoolean (*BindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp, + struct wl_display *display); + EGLBoolean (*UnbindWaylandDisplayWL)(_EGLDriver *drv, _EGLDisplay *disp, + struct wl_display *display); + EGLBoolean (*QueryWaylandBufferWL)(_EGLDriver *drv, _EGLDisplay *displ, + struct wl_resource *buffer, + EGLint attribute, EGLint *value); + + struct wl_buffer *(*CreateWaylandBufferFromImageWL)(_EGLDriver *drv, + _EGLDisplay *disp, + _EGLImage *img); + + EGLBoolean (*SwapBuffersWithDamageEXT)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface, + const EGLint *rects, EGLint n_rects); + + EGLBoolean (*PostSubBufferNV)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLSurface *surface, EGLint x, EGLint y, + EGLint width, EGLint height); + + EGLint (*QueryBufferAge)(_EGLDriver *drv, + _EGLDisplay *disp, _EGLSurface *surface); + EGLBoolean (*GetSyncValuesCHROMIUM)(_EGLDisplay *disp, _EGLSurface *surface, + EGLuint64KHR *ust, EGLuint64KHR *msc, + EGLuint64KHR *sbc); + + EGLBoolean (*ExportDMABUFImageQueryMESA)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLImage *img, EGLint *fourcc, + EGLint *nplanes, + EGLuint64KHR *modifiers); + EGLBoolean (*ExportDMABUFImageMESA)(_EGLDriver *drv, _EGLDisplay *disp, + _EGLImage *img, EGLint *fds, + EGLint *strides, EGLint *offsets); + + int (*GLInteropQueryDeviceInfo)(_EGLDisplay *disp, _EGLContext *ctx, + struct mesa_glinterop_device_info *out); + int (*GLInteropExportObject)(_EGLDisplay *disp, _EGLContext *ctx, + struct mesa_glinterop_export_in *in, + struct mesa_glinterop_export_out *out); + + EGLBoolean (*QueryDmaBufFormatsEXT)(_EGLDriver *drv, _EGLDisplay *disp, + EGLint max_formats, EGLint *formats, + EGLint *num_formats); + EGLBoolean (*QueryDmaBufModifiersEXT) (_EGLDriver *drv, _EGLDisplay *disp, + EGLint format, EGLint max_modifiers, + EGLuint64KHR *modifiers, + EGLBoolean *external_only, + EGLint *num_modifiers); + + void (*SetBlobCacheFuncsANDROID) (_EGLDriver *drv, _EGLDisplay *disp, + EGLSetBlobFuncANDROID set, + EGLGetBlobFuncANDROID get); }; diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c index 22257391d5c..2024271bee4 100644 --- a/src/egl/main/eglsurface.c +++ b/src/egl/main/eglsurface.c @@ -534,7 +534,7 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surface, return _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); _EGLContext *ctx = _eglGetCurrentContext(); - EGLint result = drv->API.QueryBufferAge(drv, disp, surface); + EGLint result = drv->QueryBufferAge(drv, disp, surface); /* error happened */ if (result < 0) return EGL_FALSE; diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c index d3c0cf4aa6f..b903229ce68 100644 --- a/src/egl/main/eglsync.c +++ b/src/egl/main/eglsync.c @@ -134,7 +134,7 @@ _eglGetSyncAttrib(_EGLDriver *drv, _EGLDisplay *disp, _EGLSync *sync, sync->Type == EGL_SYNC_CL_EVENT_KHR || sync->Type == EGL_SYNC_REUSABLE_KHR || sync->Type == EGL_SYNC_NATIVE_FENCE_ANDROID)) - drv->API.ClientWaitSyncKHR(drv, disp, sync, 0, 0); + drv->ClientWaitSyncKHR(drv, disp, sync, 0, 0); *value = sync->SyncStatus; break; diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h index 4809cf5d7d5..935fd023b3b 100644 --- a/src/egl/main/egltypedefs.h +++ b/src/egl/main/egltypedefs.h @@ -40,8 +40,6 @@ extern "C" { #endif -typedef struct _egl_api _EGLAPI; - typedef struct _egl_array _EGLArray; typedef struct _egl_config _EGLConfig; diff --git a/src/egl/meson.build b/src/egl/meson.build index d4912a65644..aca3de261f9 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -28,7 +28,6 @@ incs_for_egl = [inc_include, inc_src, inc_egl] files_egl = files( 'main/eglapi.c', - 'main/eglapi.h', 'main/eglarray.c', 'main/eglarray.h', 'main/eglconfig.c',