mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
egl/dri2: Dispatch eglSwapInterval by display, not driver
Add dri2_egl_display_vtbl::swap_interval, set it for each platform, and let egl_dri2 dispatch eglSwapInterval to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
This commit is contained in:
parent
a218765478
commit
8b9298af0a
7 changed files with 55 additions and 2 deletions
|
|
@ -1013,6 +1013,14 @@ dri2_get_proc_address(_EGLDriver *drv, const char *procname)
|
|||
return dri2_drv->get_proc_address(procname);
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dri2_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
|
||||
EGLint interval)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
||||
return dri2_dpy->vtbl->swap_interval(drv, dpy, surf, interval);
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
|
||||
{
|
||||
|
|
@ -2036,6 +2044,7 @@ _eglBuiltInDriverDRI2(const char *args)
|
|||
dri2_drv->base.API.WaitNative = dri2_wait_native;
|
||||
dri2_drv->base.API.BindTexImage = dri2_bind_tex_image;
|
||||
dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image;
|
||||
dri2_drv->base.API.SwapInterval = dri2_swap_interval;
|
||||
dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr;
|
||||
dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr;
|
||||
#ifdef HAVE_DRM_PLATFORM
|
||||
|
|
|
|||
|
|
@ -86,6 +86,9 @@ struct dri2_egl_driver
|
|||
|
||||
struct dri2_egl_display_vtbl {
|
||||
int (*authenticate)(_EGLDisplay *disp, uint32_t id);
|
||||
|
||||
EGLBoolean (*swap_interval)(_EGLDriver *drv, _EGLDisplay *dpy,
|
||||
_EGLSurface *surf, EGLint interval);
|
||||
};
|
||||
|
||||
struct dri2_egl_display
|
||||
|
|
|
|||
34
src/egl/drivers/dri2/egl_dri2_fallbacks.h
Normal file
34
src/egl/drivers/dri2/egl_dri2_fallbacks.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 2014 Intel Corporation
|
||||
*
|
||||
* 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, sublicense,
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "egltypedefs.h"
|
||||
|
||||
static inline EGLBoolean
|
||||
dri2_fallback_swap_interval(_EGLDriver *drv, _EGLDisplay *dpy,
|
||||
_EGLSurface *surf, EGLint interval)
|
||||
{
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "loader.h"
|
||||
#include "egl_dri2.h"
|
||||
#include "egl_dri2_fallbacks.h"
|
||||
#include "gralloc_drm.h"
|
||||
|
||||
static int
|
||||
|
|
@ -654,6 +655,7 @@ droid_log(EGLint level, const char *msg)
|
|||
|
||||
static struct dri2_egl_display_vtbl droid_display_vtbl = {
|
||||
.authenticate = NULL,
|
||||
.swap_interval = dri2_fallback_swap_interval,
|
||||
};
|
||||
|
||||
EGLBoolean
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "egl_dri2.h"
|
||||
#include "egl_dri2_fallbacks.h"
|
||||
#include "loader.h"
|
||||
|
||||
static struct gbm_bo *
|
||||
|
|
@ -442,6 +443,7 @@ dri2_drm_authenticate(_EGLDisplay *disp, uint32_t id)
|
|||
|
||||
static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
|
||||
.authenticate = dri2_drm_authenticate,
|
||||
.swap_interval = dri2_fallback_swap_interval,
|
||||
};
|
||||
|
||||
EGLBoolean
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <xf86drm.h>
|
||||
|
||||
#include "egl_dri2.h"
|
||||
#include "egl_dri2_fallbacks.h"
|
||||
#include "loader.h"
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
|
@ -958,6 +959,7 @@ dri2_wl_setup_swap_interval(struct dri2_egl_display *dri2_dpy)
|
|||
|
||||
static struct dri2_egl_display_vtbl dri2_wl_display_vtbl = {
|
||||
.authenticate = dri2_wl_authenticate,
|
||||
.swap_interval = dri2_wl_swap_interval,
|
||||
};
|
||||
|
||||
EGLBoolean
|
||||
|
|
@ -978,7 +980,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include "egl_dri2.h"
|
||||
#include "egl_dri2_fallbacks.h"
|
||||
|
||||
static EGLBoolean
|
||||
dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
|
||||
|
|
@ -993,10 +994,12 @@ dri2_x11_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
|
|||
|
||||
static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {
|
||||
.authenticate = NULL,
|
||||
.swap_interval = dri2_fallback_swap_interval,
|
||||
};
|
||||
|
||||
static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {
|
||||
.authenticate = dri2_x11_authenticate,
|
||||
.swap_interval = dri2_x11_swap_interval,
|
||||
};
|
||||
|
||||
static EGLBoolean
|
||||
|
|
@ -1139,7 +1142,6 @@ dri2_initialize_x11_dri2(_EGLDriver *drv, _EGLDisplay *disp)
|
|||
drv->API.CreateImageKHR = dri2_x11_create_image_khr;
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue