summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2014-01-28 12:47:38 -0800
committerChad Versace <[email protected]>2014-03-17 15:36:03 -0700
commitd019cd81b566649e9dbe157266f70841a10e00fa (patch)
treef025ba95651fa75866bbaf66c7729f859b758b27
parent90502b18b2b868250ab7e9189810ca42b3c812a1 (diff)
egl/dri2: Put platform func names into proper namespaces
Each of the egl_dri2 platforms (except Android) prefix their function names with "dri2", not "dri2_${platform}". This means many function names have three separate definitions in the egl_dri2 directory: one in each of platform_drm.c, platform_wayland.c, and platform_x11.c. For example, each of the three files defines dri2_create_window_surface(). The name collisions make it difficult to review patches for correctness ("Is this patch hunk calling a platform_x11 function or a global egl_dri2 function?"), complicate debugging, and confuse code navigation tools. For each function in platform_x11.c prefixed with 'dri2', this patch changes its prefix to 'dri2_x11'. Likewise for platform_drm.c and 'dri2_drm'; and platform_wayland.c and 'dri2_wl'. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
-rw-r--r--src/egl/drivers/dri2/platform_drm.c78
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c108
-rw-r--r--src/egl/drivers/dri2/platform_x11.c161
3 files changed, 177 insertions, 170 deletions
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index c082df775c9..9d3158ce72f 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -86,9 +86,9 @@ has_free_buffers(struct gbm_surface *_surf)
}
static _EGLSurface *
-dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
- _EGLConfig *conf, EGLNativeWindowType window,
- const EGLint *attrib_list)
+dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
+ _EGLConfig *conf, EGLNativeWindowType window,
+ const EGLint *attrib_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
@@ -139,16 +139,16 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
}
static _EGLSurface *
-dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
- _EGLConfig *conf, EGLNativeWindowType window,
- const EGLint *attrib_list)
+dri2_drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLConfig *conf, EGLNativeWindowType window,
+ const EGLint *attrib_list)
{
- return dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
- window, attrib_list);
+ return dri2_drm_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
+ window, attrib_list);
}
static EGLBoolean
-dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
+dri2_drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
@@ -248,7 +248,7 @@ get_aux_bo(struct dri2_egl_surface *dri2_surf,
}
static __DRIbuffer *
-dri2_get_buffers_with_format(__DRIdrawable *driDrawable,
+dri2_drm_get_buffers_with_format(__DRIdrawable *driDrawable,
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, void *loaderPrivate)
@@ -290,10 +290,10 @@ dri2_get_buffers_with_format(__DRIdrawable *driDrawable,
}
static __DRIbuffer *
-dri2_get_buffers(__DRIdrawable * driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+dri2_drm_get_buffers(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
{
unsigned int *attachments_with_format;
__DRIbuffer *buffer;
@@ -312,10 +312,10 @@ dri2_get_buffers(__DRIdrawable * driDrawable,
}
buffer =
- dri2_get_buffers_with_format(driDrawable,
- width, height,
- attachments_with_format, count,
- out_count, loaderPrivate);
+ dri2_drm_get_buffers_with_format(driDrawable,
+ width, height,
+ attachments_with_format, count,
+ out_count, loaderPrivate);
free(attachments_with_format);
@@ -323,12 +323,12 @@ dri2_get_buffers(__DRIdrawable * driDrawable,
}
static int
-dri_image_get_buffers(__DRIdrawable *driDrawable,
- unsigned int format,
- uint32_t *stamp,
- void *loaderPrivate,
- uint32_t buffer_mask,
- struct __DRIimageList *buffers)
+dri2_drm_image_get_buffers(__DRIdrawable *driDrawable,
+ unsigned int format,
+ uint32_t *stamp,
+ void *loaderPrivate,
+ uint32_t buffer_mask,
+ struct __DRIimageList *buffers)
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
struct gbm_dri_bo *bo;
@@ -344,14 +344,14 @@ dri_image_get_buffers(__DRIdrawable *driDrawable,
}
static void
-dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
+dri2_drm_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
(void) driDrawable;
(void) loaderPrivate;
}
static EGLBoolean
-dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
+dri2_drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
@@ -375,8 +375,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
}
static EGLint
-dri2_query_buffer_age(_EGLDriver *drv,
- _EGLDisplay *disp, _EGLSurface *surface)
+dri2_drm_query_buffer_age(_EGLDriver *drv,
+ _EGLDisplay *disp, _EGLSurface *surface)
{
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
@@ -389,8 +389,8 @@ dri2_query_buffer_age(_EGLDriver *drv,
}
static _EGLImage *
-dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
- EGLClientBuffer buffer, const EGLint *attr_list)
+dri2_drm_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
+ EGLClientBuffer buffer, const EGLint *attr_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct gbm_dri_bo *dri_bo = gbm_dri_bo((struct gbm_bo *) buffer);
@@ -426,7 +426,7 @@ dri2_drm_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
switch (target) {
case EGL_NATIVE_PIXMAP_KHR:
- return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list);
+ return dri2_drm_create_image_khr_pixmap(disp, ctx, buffer, attr_list);
default:
return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list);
}
@@ -502,10 +502,10 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
dri2_dpy->gbm_dri->lookup_image = dri2_lookup_egl_image;
dri2_dpy->gbm_dri->lookup_user_data = disp;
- dri2_dpy->gbm_dri->get_buffers = dri2_get_buffers;
- dri2_dpy->gbm_dri->flush_front_buffer = dri2_flush_front_buffer;
- dri2_dpy->gbm_dri->get_buffers_with_format = dri2_get_buffers_with_format;
- dri2_dpy->gbm_dri->image_get_buffers = dri_image_get_buffers;
+ dri2_dpy->gbm_dri->get_buffers = dri2_drm_get_buffers;
+ dri2_dpy->gbm_dri->flush_front_buffer = dri2_drm_flush_front_buffer;
+ dri2_dpy->gbm_dri->get_buffers_with_format = dri2_drm_get_buffers_with_format;
+ dri2_dpy->gbm_dri->image_get_buffers = dri2_drm_image_get_buffers;
dri2_dpy->gbm_dri->base.base.surface_lock_front_buffer = lock_front_buffer;
dri2_dpy->gbm_dri->base.base.surface_release_buffer = release_buffer;
@@ -536,11 +536,11 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
i + 1, EGL_WINDOW_BIT, attr_list, NULL);
}
- drv->API.CreateWindowSurface = dri2_create_window_surface;
- drv->API.DestroySurface = dri2_destroy_surface;
- drv->API.SwapBuffers = dri2_swap_buffers;
+ drv->API.CreateWindowSurface = dri2_drm_create_window_surface;
+ drv->API.DestroySurface = dri2_drm_destroy_surface;
+ drv->API.SwapBuffers = dri2_drm_swap_buffers;
drv->API.CreateImageKHR = dri2_drm_create_image_khr;
- drv->API.QueryBufferAge = dri2_query_buffer_age;
+ drv->API.QueryBufferAge = dri2_drm_query_buffer_age;
disp->Extensions.EXT_buffer_age = EGL_TRUE;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index d56630c4072..aea2793a63b 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -114,9 +114,9 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
static _EGLSurface *
-dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
- _EGLConfig *conf, EGLNativeWindowType window,
- const EGLint *attrib_list)
+dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
+ _EGLConfig *conf, EGLNativeWindowType window,
+ const EGLint *attrib_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
@@ -180,15 +180,15 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
static _EGLSurface *
-dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
- _EGLConfig *conf, EGLNativeWindowType window,
- const EGLint *attrib_list)
+dri2_wl_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLConfig *conf, EGLNativeWindowType window,
+ const EGLint *attrib_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
_EGLSurface *surf;
- surf = dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
- window, attrib_list);
+ surf = dri2_wl_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
+ window, attrib_list);
if (surf != NULL)
drv->API.SwapInterval(drv, disp, surf, dri2_dpy->default_swap_interval);
@@ -200,7 +200,7 @@ dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
* Called via eglDestroySurface(), drv->API.DestroySurface().
*/
static EGLBoolean
-dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
+dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
@@ -240,7 +240,7 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
}
static void
-dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
+dri2_wl_release_buffers(struct dri2_egl_surface *dri2_surf)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
@@ -369,7 +369,7 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
(dri2_surf->base.Width != dri2_surf->wl_win->width ||
dri2_surf->base.Height != dri2_surf->wl_win->height)) {
- dri2_release_buffers(dri2_surf);
+ dri2_wl_release_buffers(dri2_surf);
dri2_surf->base.Width = dri2_surf->wl_win->width;
dri2_surf->base.Height = dri2_surf->wl_win->height;
@@ -399,10 +399,10 @@ update_buffers(struct dri2_egl_surface *dri2_surf)
}
static __DRIbuffer *
-dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+dri2_wl_get_buffers_with_format(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
int i, j;
@@ -436,10 +436,10 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
}
static __DRIbuffer *
-dri2_get_buffers(__DRIdrawable * driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+dri2_wl_get_buffers(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
{
unsigned int *attachments_with_format;
__DRIbuffer *buffer;
@@ -458,10 +458,10 @@ dri2_get_buffers(__DRIdrawable * driDrawable,
}
buffer =
- dri2_get_buffers_with_format(driDrawable,
- width, height,
- attachments_with_format, count,
- out_count, loaderPrivate);
+ dri2_wl_get_buffers_with_format(driDrawable,
+ width, height,
+ attachments_with_format, count,
+ out_count, loaderPrivate);
free(attachments_with_format);
@@ -488,7 +488,7 @@ image_get_buffers(__DRIdrawable *driDrawable,
}
static void
-dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
+dri2_wl_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
(void) driDrawable;
(void) loaderPrivate;
@@ -498,7 +498,7 @@ static const __DRIimageLoaderExtension image_loader_extension = {
.base = { __DRI_IMAGE_LOADER, 1 },
.getBuffers = image_get_buffers,
- .flushFrontBuffer = dri2_flush_front_buffer,
+ .flushFrontBuffer = dri2_wl_flush_front_buffer,
};
static void
@@ -567,11 +567,11 @@ create_wl_buffer(struct dri2_egl_surface *dri2_surf)
* Called via eglSwapBuffers(), drv->API.SwapBuffers().
*/
static EGLBoolean
-dri2_swap_buffers_with_damage(_EGLDriver *drv,
- _EGLDisplay *disp,
- _EGLSurface *draw,
- const EGLint *rects,
- EGLint n_rects)
+dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
+ _EGLDisplay *disp,
+ _EGLSurface *draw,
+ const EGLint *rects,
+ EGLint n_rects)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
@@ -661,8 +661,8 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv,
}
static EGLint
-dri2_query_buffer_age(_EGLDriver *drv,
- _EGLDisplay *disp, _EGLSurface *surface)
+dri2_wl_query_buffer_age(_EGLDriver *drv,
+ _EGLDisplay *disp, _EGLSurface *surface)
{
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);
@@ -675,15 +675,15 @@ dri2_query_buffer_age(_EGLDriver *drv,
}
static EGLBoolean
-dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
+dri2_wl_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
- return dri2_swap_buffers_with_damage (drv, disp, draw, NULL, 0);
+ return dri2_wl_swap_buffers_with_damage (drv, disp, draw, NULL, 0);
}
static struct wl_buffer *
-dri2_create_wayland_buffer_from_image_wl(_EGLDriver *drv,
- _EGLDisplay *disp,
- _EGLImage *img)
+dri2_wl_create_wayland_buffer_from_image_wl(_EGLDriver *drv,
+ _EGLDisplay *disp,
+ _EGLImage *img)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_image *dri2_img = dri2_egl_image(img);
@@ -756,7 +756,7 @@ bad_format:
}
static int
-dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
+dri2_wl_authenticate(_EGLDisplay *disp, uint32_t id)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
int ret = 0;
@@ -780,7 +780,7 @@ dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
* Called via eglTerminate(), drv->API.Terminate().
*/
static EGLBoolean
-dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
+dri2_wl_terminate(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
@@ -899,7 +899,7 @@ static const struct wl_registry_listener registry_listener = {
};
static EGLBoolean
-dri2_swap_interval(_EGLDriver *drv,
+dri2_wl_swap_interval(_EGLDriver *drv,
_EGLDisplay *disp,
_EGLSurface *surf,
EGLint interval)
@@ -915,7 +915,7 @@ dri2_swap_interval(_EGLDriver *drv,
}
static void
-dri2_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
+dri2_wl_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
{
GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;
@@ -953,7 +953,7 @@ dri2_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
}
static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
- .authenticate = dri2_wayland_authenticate,
+ .authenticate = dri2_wl_authenticate,
};
EGLBoolean
@@ -970,16 +970,16 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
loader_set_logger(_eglLog);
- drv->API.CreateWindowSurface = dri2_create_window_surface;
- drv->API.DestroySurface = dri2_destroy_surface;
- drv->API.SwapBuffers = dri2_swap_buffers;
- drv->API.SwapBuffersWithDamageEXT = dri2_swap_buffers_with_damage;
- drv->API.SwapInterval = dri2_swap_interval;
- drv->API.Terminate = dri2_terminate;
- drv->API.QueryBufferAge = dri2_query_buffer_age;
+ drv->API.CreateWindowSurface = dri2_wl_create_window_surface;
+ drv->API.DestroySurface = dri2_wl_destroy_surface;
+ drv->API.SwapBuffers = dri2_wl_swap_buffers;
+ drv->API.SwapBuffersWithDamageEXT = dri2_wl_swap_buffers_with_damage;
+ drv->API.SwapInterval = dri2_wl_swap_interval;
+ drv->API.Terminate = dri2_wl_terminate;
+ drv->API.QueryBufferAge = dri2_wl_query_buffer_age;
drv->API.CreateWaylandBufferFromImageWL =
- dri2_create_wayland_buffer_from_image_wl;
+ dri2_wl_create_wayland_buffer_from_image_wl;
dri2_dpy = calloc(1, sizeof *dri2_dpy);
if (!dri2_dpy)
@@ -1025,10 +1025,10 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
dri2_dpy->dri2_loader_extension.base.version = 3;
- dri2_dpy->dri2_loader_extension.getBuffers = dri2_get_buffers;
- dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_flush_front_buffer;
+ dri2_dpy->dri2_loader_extension.getBuffers = dri2_wl_get_buffers;
+ dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_wl_flush_front_buffer;
dri2_dpy->dri2_loader_extension.getBuffersWithFormat =
- dri2_get_buffers_with_format;
+ dri2_wl_get_buffers_with_format;
dri2_dpy->extensions[0] = &dri2_dpy->dri2_loader_extension.base;
dri2_dpy->extensions[1] = &image_loader_extension.base;
@@ -1041,7 +1041,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
if (!dri2_create_screen(disp))
goto cleanup_driver;
- dri2_setup_swap_interval(dri2_dpy);
+ dri2_wl_setup_swap_interval(dri2_dpy);
/* The server shouldn't advertise WL_DRM_CAPABILITY_PRIME if the driver
* doesn't have createImageFromFds, since we're using the same driver on
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index b5df0f990c8..eb1565013fc 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -176,9 +176,9 @@ swrastGetImage(__DRIdrawable * read,
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
static _EGLSurface *
-dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
- _EGLConfig *conf, EGLNativeWindowType native_window,
- const EGLint *attrib_list)
+dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
+ _EGLConfig *conf, EGLNativeWindowType native_window,
+ const EGLint *attrib_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
@@ -271,15 +271,15 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
static _EGLSurface *
-dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
- _EGLConfig *conf, EGLNativeWindowType window,
- const EGLint *attrib_list)
+dri2_x11_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLConfig *conf, EGLNativeWindowType window,
+ const EGLint *attrib_list)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
_EGLSurface *surf;
- surf = dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
- window, attrib_list);
+ surf = dri2_x11_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
+ window, attrib_list);
if (surf != NULL) {
/* When we first create the DRI2 drawable, its swap interval on the
* server side is 1.
@@ -294,24 +294,24 @@ dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
}
static _EGLSurface *
-dri2_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
- _EGLConfig *conf, EGLNativePixmapType pixmap,
- const EGLint *attrib_list)
+dri2_x11_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLConfig *conf, EGLNativePixmapType pixmap,
+ const EGLint *attrib_list)
{
- return dri2_create_surface(drv, disp, EGL_PIXMAP_BIT, conf,
- pixmap, attrib_list);
+ return dri2_x11_create_surface(drv, disp, EGL_PIXMAP_BIT, conf,
+ pixmap, attrib_list);
}
static _EGLSurface *
-dri2_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
- _EGLConfig *conf, const EGLint *attrib_list)
+dri2_x11_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLConfig *conf, const EGLint *attrib_list)
{
- return dri2_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
- XCB_WINDOW_NONE, attrib_list);
+ return dri2_x11_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
+ XCB_WINDOW_NONE, attrib_list);
}
static EGLBoolean
-dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
+dri2_x11_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
@@ -345,8 +345,8 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
* \c DRI2GetBuffers or \c DRI2GetBuffersWithFormat.
*/
static void
-dri2_process_buffers(struct dri2_egl_surface *dri2_surf,
- xcb_dri2_dri2_buffer_t *buffers, unsigned count)
+dri2_x11_process_buffers(struct dri2_egl_surface *dri2_surf,
+ xcb_dri2_dri2_buffer_t *buffers, unsigned count)
{
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
@@ -386,10 +386,10 @@ dri2_process_buffers(struct dri2_egl_surface *dri2_surf,
}
static __DRIbuffer *
-dri2_get_buffers(__DRIdrawable * driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+dri2_x11_get_buffers(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
struct dri2_egl_display *dri2_dpy =
@@ -411,7 +411,7 @@ dri2_get_buffers(__DRIdrawable * driDrawable,
*out_count = reply->count;
dri2_surf->base.Width = *width = reply->width;
dri2_surf->base.Height = *height = reply->height;
- dri2_process_buffers(dri2_surf, buffers, *out_count);
+ dri2_x11_process_buffers(dri2_surf, buffers, *out_count);
free(reply);
@@ -419,10 +419,10 @@ dri2_get_buffers(__DRIdrawable * driDrawable,
}
static __DRIbuffer *
-dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
- int *width, int *height,
- unsigned int *attachments, int count,
- int *out_count, void *loaderPrivate)
+dri2_x11_get_buffers_with_format(__DRIdrawable * driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate)
{
struct dri2_egl_surface *dri2_surf = loaderPrivate;
struct dri2_egl_display *dri2_dpy =
@@ -449,7 +449,7 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
dri2_surf->base.Width = *width = reply->width;
dri2_surf->base.Height = *height = reply->height;
*out_count = reply->count;
- dri2_process_buffers(dri2_surf, buffers, *out_count);
+ dri2_x11_process_buffers(dri2_surf, buffers, *out_count);
free(reply);
@@ -457,7 +457,7 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
}
static void
-dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
+dri2_x11_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
{
(void) driDrawable;
@@ -473,7 +473,7 @@ dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
}
static char *
-dri2_strndup(const char *s, int length)
+dri2_x11_strndup(const char *s, int length)
{
char *d;
@@ -488,7 +488,7 @@ dri2_strndup(const char *s, int length)
}
static EGLBoolean
-dri2_connect(struct dri2_egl_display *dri2_dpy)
+dri2_x11_connect(struct dri2_egl_display *dri2_dpy)
{
xcb_xfixes_query_version_reply_t *xfixes_query;
xcb_xfixes_query_version_cookie_t xfixes_query_cookie;
@@ -556,14 +556,14 @@ dri2_connect(struct dri2_egl_display *dri2_dpy)
driver_name = xcb_dri2_connect_driver_name (connect);
dri2_dpy->driver_name =
- dri2_strndup(driver_name,
- xcb_dri2_connect_driver_name_length (connect));
+ dri2_x11_strndup(driver_name,
+ xcb_dri2_connect_driver_name_length(connect));
device_name = xcb_dri2_connect_device_name (connect);
dri2_dpy->device_name =
- dri2_strndup(device_name,
- xcb_dri2_connect_device_name_length (connect));
+ dri2_x11_strndup(device_name,
+ xcb_dri2_connect_device_name_length(connect));
if (dri2_dpy->device_name == NULL || dri2_dpy->driver_name == NULL) {
free(dri2_dpy->device_name);
@@ -600,7 +600,7 @@ dri2_x11_authenticate(_EGLDisplay *disp, uint32_t id)
}
static EGLBoolean
-dri2_authenticate(_EGLDisplay *disp)
+dri2_x11_local_authenticate(_EGLDisplay *disp)
{
#ifdef HAVE_LIBDRM
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
@@ -620,8 +620,8 @@ dri2_authenticate(_EGLDisplay *disp)
}
static EGLBoolean
-dri2_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
- _EGLDisplay *disp)
+dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
+ _EGLDisplay *disp)
{
xcb_screen_iterator_t s;
xcb_depth_iterator_t d;
@@ -724,8 +724,8 @@ dri2_copy_region(_EGLDriver *drv, _EGLDisplay *disp,
}
static int64_t
-dri2_swap_buffers_msc(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
- int64_t msc, int64_t divisor, int64_t remainder)
+dri2_x11_swap_buffers_msc(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
+ int64_t msc, int64_t divisor, int64_t remainder)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
@@ -777,13 +777,13 @@ dri2_swap_buffers_msc(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
}
static EGLBoolean
-dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
+dri2_x11_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
if (dri2_dpy->dri2) {
- return dri2_swap_buffers_msc(drv, disp, draw, 0, 0, 0) != -1;
+ return dri2_x11_swap_buffers_msc(drv, disp, draw, 0, 0, 0) != -1;
} else {
assert(dri2_dpy->swrast);
@@ -793,8 +793,9 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
}
static EGLBoolean
-dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
- EGLint numRects, const EGLint *rects)
+dri2_x11_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp,
+ _EGLSurface *draw,
+ EGLint numRects, const EGLint *rects)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
@@ -822,7 +823,7 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
}
static EGLBoolean
-dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
+dri2_x11_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
EGLint x, EGLint y, EGLint width, EGLint height)
{
const EGLint rect[4] = { x, y, width, height };
@@ -830,11 +831,12 @@ dri2_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
if (x < 0 || y < 0 || width < 0 || height < 0)
_eglError(EGL_BAD_PARAMETER, "eglPostSubBufferNV");
- return dri2_swap_buffers_region(drv, disp, draw, 1, rect);
+ return dri2_x11_swap_buffers_region(drv, disp, draw, 1, rect);
}
static EGLBoolean
-dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint interval)
+dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
+ EGLint interval)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
@@ -853,8 +855,8 @@ dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint
}
static EGLBoolean
-dri2_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
- EGLNativePixmapType native_target)
+dri2_x11_copy_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
+ EGLNativePixmapType native_target)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
@@ -998,12 +1000,12 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
- drv->API.CreateWindowSurface = dri2_create_window_surface;
- drv->API.CreatePixmapSurface = dri2_create_pixmap_surface;
- drv->API.CreatePbufferSurface = dri2_create_pbuffer_surface;
- drv->API.DestroySurface = dri2_destroy_surface;
- drv->API.SwapBuffers = dri2_swap_buffers;
- drv->API.CopyBuffers = dri2_copy_buffers;
+ drv->API.CreateWindowSurface = dri2_x11_create_window_surface;
+ drv->API.CreatePixmapSurface = dri2_x11_create_pixmap_surface;
+ drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
+ drv->API.DestroySurface = dri2_x11_destroy_surface;
+ drv->API.SwapBuffers = dri2_x11_swap_buffers;
+ drv->API.CopyBuffers = dri2_x11_copy_buffers;
drv->API.SwapBuffersRegionNOK = NULL;
drv->API.CreateImageKHR = NULL;
@@ -1044,7 +1046,7 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
goto cleanup_driver;
if (dri2_dpy->conn) {
- if (!dri2_add_configs_for_visuals(dri2_dpy, disp))
+ if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp))
goto cleanup_configs;
}
@@ -1074,7 +1076,7 @@ dri2_initialize_x11_swrast(_EGLDriver *drv, _EGLDisplay *disp)
}
static void
-dri2_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
+dri2_x11_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
{
GLint vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1;
int arbitrary_max_interval = 1000;
@@ -1124,16 +1126,16 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy;
- drv->API.CreateWindowSurface = dri2_create_window_surface;
- drv->API.CreatePixmapSurface = dri2_create_pixmap_surface;
- drv->API.CreatePbufferSurface = dri2_create_pbuffer_surface;
- drv->API.DestroySurface = dri2_destroy_surface;
- drv->API.SwapBuffers = dri2_swap_buffers;
- drv->API.CopyBuffers = dri2_copy_buffers;
+ drv->API.CreateWindowSurface = dri2_x11_create_window_surface;
+ drv->API.CreatePixmapSurface = dri2_x11_create_pixmap_surface;
+ drv->API.CreatePbufferSurface = dri2_x11_create_pbuffer_surface;
+ drv->API.DestroySurface = dri2_x11_destroy_surface;
+ drv->API.SwapBuffers = dri2_x11_swap_buffers;
+ drv->API.CopyBuffers = dri2_x11_copy_buffers;
drv->API.CreateImageKHR = dri2_x11_create_image_khr;
- drv->API.SwapBuffersRegionNOK = dri2_swap_buffers_region;
- drv->API.PostSubBufferNV = dri2_post_sub_buffer;
- drv->API.SwapInterval = dri2_swap_interval;
+ drv->API.SwapBuffersRegionNOK = dri2_x11_swap_buffers_region;
+ drv->API.PostSubBufferNV = dri2_x11_post_sub_buffer;
+ drv->API.SwapInterval = dri2_x11_swap_interval;
dri2_dpy = calloc(1, sizeof *dri2_dpy);
if (!dri2_dpy)
@@ -1152,7 +1154,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
}
if (dri2_dpy->conn) {
- if (!dri2_connect(dri2_dpy))
+ if (!dri2_x11_connect(dri2_dpy))
goto cleanup_conn;
}
@@ -1177,22 +1179,22 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
}
if (dri2_dpy->conn) {
- if (!dri2_authenticate(disp))
+ if (!dri2_x11_local_authenticate(disp))
goto cleanup_fd;
}
if (dri2_dpy->dri2_minor >= 1) {
dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
dri2_dpy->dri2_loader_extension.base.version = 3;
- dri2_dpy->dri2_loader_extension.getBuffers = dri2_get_buffers;
- dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_flush_front_buffer;
+ dri2_dpy->dri2_loader_extension.getBuffers = dri2_x11_get_buffers;
+ dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_x11_flush_front_buffer;
dri2_dpy->dri2_loader_extension.getBuffersWithFormat =
- dri2_get_buffers_with_format;
+ dri2_x11_get_buffers_with_format;
} else {
dri2_dpy->dri2_loader_extension.base.name = __DRI_DRI2_LOADER;
dri2_dpy->dri2_loader_extension.base.version = 2;
- dri2_dpy->dri2_loader_extension.getBuffers = dri2_get_buffers;
- dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_flush_front_buffer;
+ dri2_dpy->dri2_loader_extension.getBuffers = dri2_x11_get_buffers;
+ dri2_dpy->dri2_loader_extension.flushFrontBuffer = dri2_x11_flush_front_buffer;
dri2_dpy->dri2_loader_extension.getBuffersWithFormat = NULL;
}
@@ -1206,7 +1208,12 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
if (!dri2_create_screen(disp))
goto cleanup_fd;
- dri2_setup_swap_interval(dri2_dpy);
+ dri2_x11_setup_swap_interval(dri2_dpy);
+
+ if (dri2_dpy->conn) {
+ if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp))
+ goto cleanup_configs;
+ }
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.NOK_swap_region = EGL_TRUE;
@@ -1218,7 +1225,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
#endif
if (dri2_dpy->conn) {
- if (!dri2_add_configs_for_visuals(dri2_dpy, disp))
+ if (!dri2_x11_add_configs_for_visuals(dri2_dpy, disp))
goto cleanup_configs;
}