mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
egl: inline DRI_CORE usage
Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30472>
This commit is contained in:
parent
85bf0892f6
commit
7732f1aa5d
9 changed files with 47 additions and 50 deletions
|
|
@ -306,22 +306,21 @@ dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
|
|||
}
|
||||
|
||||
void
|
||||
dri2_get_shifts_and_sizes(const __DRIcoreExtension *core,
|
||||
const __DRIconfig *config, int *shifts,
|
||||
dri2_get_shifts_and_sizes(const __DRIconfig *config, int *shifts,
|
||||
unsigned int *sizes)
|
||||
{
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_RED_SHIFT,
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_RED_SHIFT,
|
||||
(unsigned int *)&shifts[0]);
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_GREEN_SHIFT,
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_GREEN_SHIFT,
|
||||
(unsigned int *)&shifts[1]);
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_BLUE_SHIFT,
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_BLUE_SHIFT,
|
||||
(unsigned int *)&shifts[2]);
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_ALPHA_SHIFT,
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_ALPHA_SHIFT,
|
||||
(unsigned int *)&shifts[3]);
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_RED_SIZE, &sizes[0]);
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_GREEN_SIZE, &sizes[1]);
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_BLUE_SIZE, &sizes[2]);
|
||||
core->getConfigAttrib(config, __DRI_ATTRIB_ALPHA_SIZE, &sizes[3]);
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_RED_SIZE, &sizes[0]);
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_GREEN_SIZE, &sizes[1]);
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_BLUE_SIZE, &sizes[2]);
|
||||
driGetConfigAttrib(config, __DRI_ATTRIB_ALPHA_SIZE, &sizes[3]);
|
||||
}
|
||||
|
||||
enum pipe_format
|
||||
|
|
@ -353,7 +352,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config,
|
|||
bind_to_texture_rgba = 0;
|
||||
|
||||
for (int i = 0; i < __DRI_ATTRIB_MAX; ++i) {
|
||||
if (!dri2_dpy->core->indexConfigAttrib(dri_config, i, &attrib, &value))
|
||||
if (!driIndexConfigAttrib(dri_config, i, &attrib, &value))
|
||||
break;
|
||||
|
||||
switch (attrib) {
|
||||
|
|
@ -937,7 +936,7 @@ dri2_setup_extensions(_EGLDisplay *disp)
|
|||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
const __DRIextension **extensions;
|
||||
|
||||
extensions = dri2_dpy->core->getExtensions(dri2_dpy->dri_screen_render_gpu);
|
||||
extensions = driGetExtensions(dri2_dpy->dri_screen_render_gpu);
|
||||
|
||||
if (dri2_dpy->image_driver || dri2_dpy->dri2) {
|
||||
if (!loader_bind_extensions(dri2_dpy, dri2_core_extensions,
|
||||
|
|
@ -1114,11 +1113,11 @@ dri2_display_destroy(_EGLDisplay *disp)
|
|||
if (dri2_dpy->vtbl && dri2_dpy->vtbl->close_screen_notify)
|
||||
dri2_dpy->vtbl->close_screen_notify(disp);
|
||||
|
||||
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen_render_gpu);
|
||||
driDestroyScreen(dri2_dpy->dri_screen_render_gpu);
|
||||
|
||||
if (dri2_dpy->dri_screen_display_gpu &&
|
||||
dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu)
|
||||
dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen_display_gpu);
|
||||
driDestroyScreen(dri2_dpy->dri_screen_display_gpu);
|
||||
}
|
||||
if (dri2_dpy->fd_display_gpu >= 0 &&
|
||||
dri2_dpy->fd_render_gpu != dri2_dpy->fd_display_gpu)
|
||||
|
|
@ -1473,10 +1472,9 @@ static EGLBoolean
|
|||
dri2_destroy_context(_EGLDisplay *disp, _EGLContext *ctx)
|
||||
{
|
||||
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
|
||||
if (_eglPutContext(ctx)) {
|
||||
dri2_dpy->core->destroyContext(dri2_ctx->dri_context);
|
||||
driDestroyContext(dri2_ctx->dri_context);
|
||||
free(dri2_ctx);
|
||||
}
|
||||
|
||||
|
|
@ -1634,7 +1632,7 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf, _EGLSurface *rsurf,
|
|||
old_dri2_dpy->vtbl->set_shared_buffer_mode(old_disp, old_dsurf, false);
|
||||
}
|
||||
|
||||
old_dri2_dpy->core->unbindContext(old_cctx);
|
||||
driUnbindContext(old_cctx);
|
||||
|
||||
if (old_dsurf)
|
||||
dri2_surf_update_fence_fd(old_ctx, old_disp, old_dsurf);
|
||||
|
|
@ -1645,10 +1643,10 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf, _EGLSurface *rsurf,
|
|||
cctx = (dri2_ctx) ? dri2_ctx->dri_context : NULL;
|
||||
|
||||
if (cctx) {
|
||||
if (!dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) {
|
||||
if (!driBindContext(cctx, ddraw, rdraw)) {
|
||||
_EGLContext *tmp_ctx;
|
||||
|
||||
/* dri2_dpy->core->bindContext failed. We cannot tell for sure why, but
|
||||
/* driBindContext failed. We cannot tell for sure why, but
|
||||
* setting the error to EGL_BAD_MATCH is surely better than leaving it
|
||||
* as EGL_SUCCESS.
|
||||
*/
|
||||
|
|
@ -1674,8 +1672,8 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf, _EGLSurface *rsurf,
|
|||
(old_rsurf) ? dri2_dpy->vtbl->get_dri_drawable(old_rsurf) : NULL;
|
||||
cctx = (old_ctx) ? dri2_egl_context(old_ctx)->dri_context : NULL;
|
||||
|
||||
/* undo the previous dri2_dpy->core->unbindContext */
|
||||
if (dri2_dpy->core->bindContext(cctx, ddraw, rdraw)) {
|
||||
/* undo the previous driUnbindContext */
|
||||
if (driBindContext(cctx, ddraw, rdraw)) {
|
||||
if (old_dsurf && _eglSurfaceInSharedBufferMode(old_dsurf) &&
|
||||
old_dri2_dpy->vtbl->set_shared_buffer_mode) {
|
||||
old_dri2_dpy->vtbl->set_shared_buffer_mode(old_disp, old_dsurf,
|
||||
|
|
@ -1699,7 +1697,7 @@ dri2_make_current(_EGLDisplay *disp, _EGLSurface *dsurf, _EGLSurface *rsurf,
|
|||
|
||||
_eglLog(_EGL_WARNING, "DRI2: failed to rebind the previous context");
|
||||
} else {
|
||||
/* dri2_dpy->core->bindContext succeeded, so take a reference on the
|
||||
/* driBindContext succeeded, so take a reference on the
|
||||
* dri2_dpy. This prevents dri2_dpy from being reinitialized when a
|
||||
* EGLDisplay is terminated and then initialized again while a
|
||||
* context is still bound. See dri2_initialize() for a more in depth
|
||||
|
|
|
|||
|
|
@ -500,8 +500,7 @@ __DRIimage *
|
|||
dri2_lookup_egl_image_validated(void *image, void *data);
|
||||
|
||||
void
|
||||
dri2_get_shifts_and_sizes(const __DRIcoreExtension *core,
|
||||
const __DRIconfig *config, int *shifts,
|
||||
dri2_get_shifts_and_sizes(const __DRIconfig *config, int *shifts,
|
||||
unsigned int *sizes);
|
||||
|
||||
enum pipe_format
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include "loader.h"
|
||||
#include "loader_dri_helper.h"
|
||||
#include "platform_android.h"
|
||||
#include "dri_util.h"
|
||||
|
||||
static __DRIimage *
|
||||
droid_create_image_from_buffer_info(
|
||||
|
|
@ -421,7 +422,7 @@ droid_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
|||
dri2_surf->dri_image_front = NULL;
|
||||
}
|
||||
|
||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||
driDestroyDrawable(dri2_surf->dri_drawable);
|
||||
|
||||
close_in_fence_fd(dri2_surf);
|
||||
dri2_fini_surface(surf);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "egl_dri2.h"
|
||||
#include "kopper_interface.h"
|
||||
#include "loader.h"
|
||||
#include "dri_util.h"
|
||||
|
||||
static __DRIimage *
|
||||
device_alloc_image(struct dri2_egl_display *dri2_dpy,
|
||||
|
|
@ -155,12 +156,11 @@ cleanup_surface:
|
|||
static EGLBoolean
|
||||
device_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
||||
|
||||
device_free_images(dri2_surf);
|
||||
|
||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||
driDestroyDrawable(dri2_surf->dri_drawable);
|
||||
|
||||
dri2_fini_surface(surf);
|
||||
free(dri2_surf);
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "egldevice.h"
|
||||
#include "eglglobals.h"
|
||||
#include "loader.h"
|
||||
#include "dri_util.h"
|
||||
|
||||
static struct gbm_bo *
|
||||
lock_front_buffer(struct gbm_surface *_surf)
|
||||
|
|
@ -200,10 +201,9 @@ dri2_drm_create_pixmap_surface(_EGLDisplay *disp, _EGLConfig *conf,
|
|||
static EGLBoolean
|
||||
dri2_drm_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
||||
|
||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||
driDestroyDrawable(dri2_surf->dri_drawable);
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
|
||||
if (dri2_surf->color_buffers[i].bo)
|
||||
|
|
@ -317,7 +317,7 @@ dri2_drm_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
|
|||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
|
||||
|
||||
if (!dri2_dpy->flush) {
|
||||
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable);
|
||||
driSwapBuffers(dri2_surf->dri_drawable);
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include "kopper_interface.h"
|
||||
#include "loader.h"
|
||||
#include "loader_dri_helper.h"
|
||||
#include "dri_util.h"
|
||||
|
||||
static __DRIimage *
|
||||
surfaceless_alloc_image(struct dri2_egl_display *dri2_dpy,
|
||||
|
|
@ -151,12 +152,11 @@ cleanup_surface:
|
|||
static EGLBoolean
|
||||
surfaceless_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
||||
|
||||
surfaceless_free_images(dri2_surf);
|
||||
|
||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||
driDestroyDrawable(dri2_surf->dri_drawable);
|
||||
|
||||
dri2_fini_surface(surf);
|
||||
free(dri2_surf);
|
||||
|
|
|
|||
|
|
@ -848,7 +848,7 @@ dri2_wl_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
|||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
||||
|
||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||
driDestroyDrawable(dri2_surf->dri_drawable);
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
|
||||
if (dri2_surf->color_buffers[i].wl_buffer)
|
||||
|
|
@ -2713,12 +2713,12 @@ dri2_wl_kopper_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw,
|
|||
if (dri2_dpy->kopper)
|
||||
dri2_dpy->kopper->swapBuffersWithDamage(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY, n_rects, rects);
|
||||
else
|
||||
dri2_dpy->core->swapBuffersWithDamage(dri2_surf->dri_drawable, n_rects, rects);
|
||||
driSwapBuffersWithDamage(dri2_surf->dri_drawable, n_rects, rects);
|
||||
} else {
|
||||
if (dri2_dpy->kopper)
|
||||
dri2_dpy->kopper->swapBuffers(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY);
|
||||
else
|
||||
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable);
|
||||
driSwapBuffers(dri2_surf->dri_drawable);
|
||||
}
|
||||
|
||||
dri2_surf->current = dri2_surf->back;
|
||||
|
|
@ -2738,7 +2738,6 @@ static EGLBoolean
|
|||
dri2_wl_swrast_swap_buffers_with_damage(_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);
|
||||
|
||||
if (!dri2_surf->wl_win)
|
||||
|
|
@ -2761,9 +2760,9 @@ dri2_wl_swrast_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw,
|
|||
dri2_surf->base.Height, dst, dri2_surf);
|
||||
|
||||
if (n_rects)
|
||||
dri2_dpy->core->swapBuffersWithDamage(dri2_surf->dri_drawable, n_rects, rects);
|
||||
driSwapBuffersWithDamage(dri2_surf->dri_drawable, n_rects, rects);
|
||||
else
|
||||
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable);
|
||||
driSwapBuffers(dri2_surf->dri_drawable);
|
||||
|
||||
dri2_surf->current = dri2_surf->back;
|
||||
dri2_surf->back = NULL;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
#include "loader.h"
|
||||
#include "platform_x11.h"
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
#include "dri_util.h"
|
||||
|
||||
#ifdef HAVE_DRI3
|
||||
#include "platform_x11_dri3.h"
|
||||
|
|
@ -514,7 +515,7 @@ dri2_x11_create_surface(_EGLDisplay *disp, EGLint type, _EGLConfig *conf,
|
|||
return &dri2_surf->base;
|
||||
|
||||
cleanup_dri_drawable:
|
||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||
driDestroyDrawable(dri2_surf->dri_drawable);
|
||||
cleanup_pixmap:
|
||||
if (type == EGL_PBUFFER_BIT)
|
||||
xcb_free_pixmap(dri2_dpy->conn, dri2_surf->drawable);
|
||||
|
|
@ -571,7 +572,7 @@ dri2_x11_destroy_surface(_EGLDisplay *disp, _EGLSurface *surf)
|
|||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
|
||||
|
||||
dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
|
||||
driDestroyDrawable(dri2_surf->dri_drawable);
|
||||
|
||||
if (dri2_dpy->dri2) {
|
||||
#ifdef HAVE_X11_DRI2
|
||||
|
|
@ -982,7 +983,7 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
|
|||
int shifts[4];
|
||||
unsigned int sizes[4];
|
||||
|
||||
dri2_get_shifts_and_sizes(dri2_dpy->core, config, shifts, sizes);
|
||||
dri2_get_shifts_and_sizes(config, shifts, sizes);
|
||||
|
||||
if (memcmp(shifts, rgb_shifts, sizeof(rgb_shifts)) != 0 ||
|
||||
memcmp(sizes, rgb_sizes, sizeof(rgb_sizes)) != 0) {
|
||||
|
|
@ -1117,7 +1118,7 @@ dri2_x11_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
|
|||
return EGL_TRUE;
|
||||
} else if (!dri2_dpy->flush) {
|
||||
/* aka the swrast path, which does the swap in the gallium driver. */
|
||||
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable);
|
||||
driSwapBuffers(dri2_surf->dri_drawable);
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1188,12 +1189,12 @@ dri2_x11_kopper_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw,
|
|||
if (dri2_dpy->kopper)
|
||||
dri2_dpy->kopper->swapBuffersWithDamage(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY, numRects, rects);
|
||||
else
|
||||
dri2_dpy->core->swapBuffersWithDamage(dri2_surf->dri_drawable, numRects, rects);
|
||||
driSwapBuffersWithDamage(dri2_surf->dri_drawable, numRects, rects);
|
||||
} else {
|
||||
if (dri2_dpy->kopper)
|
||||
dri2_dpy->kopper->swapBuffers(dri2_surf->dri_drawable, __DRI2_FLUSH_INVALIDATE_ANCILLARY);
|
||||
else
|
||||
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable);
|
||||
driSwapBuffers(dri2_surf->dri_drawable);
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
|
@ -1202,12 +1203,11 @@ static EGLBoolean
|
|||
dri2_x11_swap_buffers_with_damage(_EGLDisplay *disp, _EGLSurface *draw,
|
||||
const EGLint *rects, EGLint numRects)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
|
||||
if (numRects)
|
||||
dri2_dpy->core->swapBuffersWithDamage(dri2_surf->dri_drawable, numRects, rects);
|
||||
driSwapBuffersWithDamage(dri2_surf->dri_drawable, numRects, rects);
|
||||
else
|
||||
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable);
|
||||
driSwapBuffers(dri2_surf->dri_drawable);
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1251,7 +1251,7 @@ dri2_x11_copy_buffers(_EGLDisplay *disp, _EGLSurface *surf,
|
|||
* okay-ish on swrast because those aren't invalidating the back buffer on
|
||||
* swap.
|
||||
*/
|
||||
dri2_dpy->core->swapBuffers(dri2_surf->dri_drawable);
|
||||
driSwapBuffers(dri2_surf->dri_drawable);
|
||||
}
|
||||
|
||||
gc = xcb_generate_id(dri2_dpy->conn);
|
||||
|
|
|
|||
|
|
@ -593,7 +593,7 @@ wgl_make_current(_EGLDisplay *disp, _EGLSurface *dsurf, _EGLSurface *rsurf,
|
|||
rdraw = (old_rsurf) ? wgl_egl_surface(old_rsurf)->fb : NULL;
|
||||
cctx = (old_ctx) ? wgl_egl_context(old_ctx)->ctx : NULL;
|
||||
|
||||
/* undo the previous wgl_dpy->core->unbindContext */
|
||||
/* undo the previous _eglBindContext */
|
||||
if (stw_make_current(ddraw, rdraw, cctx)) {
|
||||
return _eglError(egl_error, "eglMakeCurrent");
|
||||
}
|
||||
|
|
@ -612,7 +612,7 @@ wgl_make_current(_EGLDisplay *disp, _EGLSurface *dsurf, _EGLSurface *rsurf,
|
|||
|
||||
_eglLog(_EGL_WARNING, "wgl: failed to rebind the previous context");
|
||||
} else {
|
||||
/* wgl_dpy->core->bindContext succeeded, so take a reference on the
|
||||
/* _eglBindContext succeeded, so take a reference on the
|
||||
* wgl_dpy. This prevents wgl_dpy from being reinitialized when a
|
||||
* EGLDisplay is terminated and then initialized again while a
|
||||
* context is still bound. See wgl_initialize() for a more in depth
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue