loader: Replace usage of mtx_t with simple_mtx_t in loader/loader_dri3_helper.c

This is a prepare for removing _MTX_INITIALIZER_NP.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Acked-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21284>
This commit is contained in:
Yonggang Luo 2022-11-09 14:14:00 +08:00 committed by Marge Bot
parent 6cb5185916
commit 1b91697f09
2 changed files with 8 additions and 6 deletions

View file

@ -37,13 +37,14 @@
#include "loader_dri_helper.h"
#include "loader_dri3_helper.h"
#include "util/macros.h"
#include "util/simple_mtx.h"
#include "drm-uapi/drm_fourcc.h"
/**
* A cached blit context.
*/
struct loader_dri3_blit_context {
mtx_t mtx;
simple_mtx_t mtx;
__DRIcontext *ctx;
__DRIscreen *cur_screen;
const __DRIcoreExtension *core;
@ -51,7 +52,7 @@ struct loader_dri3_blit_context {
/* For simplicity we maintain the cache only for a single screen at a time */
static struct loader_dri3_blit_context blit_context = {
_MTX_INITIALIZER_NP, NULL
SIMPLE_MTX_INITIALIZER, NULL
};
static void
@ -162,7 +163,7 @@ static bool loader_dri3_have_image_blit(const struct loader_dri3_drawable *draw)
static __DRIcontext *
loader_dri3_blit_context_get(struct loader_dri3_drawable *draw)
{
mtx_lock(&blit_context.mtx);
simple_mtx_lock(&blit_context.mtx);
if (blit_context.ctx && blit_context.cur_screen != draw->dri_screen_render_gpu) {
blit_context.core->destroyContext(blit_context.ctx);
@ -186,7 +187,7 @@ loader_dri3_blit_context_get(struct loader_dri3_drawable *draw)
static void
loader_dri3_blit_context_put(void)
{
mtx_unlock(&blit_context.mtx);
simple_mtx_unlock(&blit_context.mtx);
}
/**
@ -2357,12 +2358,12 @@ loader_dri3_swapbuffer_barrier(struct loader_dri3_drawable *draw)
void
loader_dri3_close_screen(__DRIscreen *dri_screen)
{
mtx_lock(&blit_context.mtx);
simple_mtx_lock(&blit_context.mtx);
if (blit_context.ctx && blit_context.cur_screen == dri_screen) {
blit_context.core->destroyContext(blit_context.ctx);
blit_context.ctx = NULL;
}
mtx_unlock(&blit_context.mtx);
simple_mtx_unlock(&blit_context.mtx);
}
/**

View file

@ -27,6 +27,7 @@ if with_platform_x11 and with_dri3
gnu_symbol_visibility : 'hidden',
include_directories : [inc_include, inc_src],
dependencies : [
idep_mesautil,
dep_libdrm, dep_xcb_dri3, dep_xcb_present, dep_xcb_sync, dep_xshmfence,
dep_xcb_xfixes,
],