summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2021-03-19 17:42:36 +1100
committerMatthew Waters <matthew@centricular.com>2021-03-19 19:03:54 +1100
commitd270654c48c19afc3234e126269bf613540b44d8 (patch)
tree6c6dbe776b96f162d6dfe950504c84926c9e89ca /gst-libs
parente1f6c37b46997a8244690b4c85d7f7fcd5307373 (diff)
gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics should be used instead. GCC 11 has started warning about using volatile with atomic operations. https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719 Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/418>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapicontext.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapicontext.h2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder.c4
-rw-r--r--gst-libs/gst/vaapi/gstvaapifilter.c4
-rw-r--r--gst-libs/gst/vaapi/gstvaapiminiobject.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiminiobject.h2
-rw-r--r--gst-libs/gst/vaapi/gstvaapitexture_glx.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiutils_egl.c4
-rw-r--r--gst-libs/gst/vaapi/gstvaapiutils_egl.h2
-rw-r--r--gst-libs/gst/vaapi/gstvaapivalue.c10
-rw-r--r--gst-libs/gst/vaapi/gstvaapiwindow_wayland.c2
11 files changed, 18 insertions, 18 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapicontext.c b/gst-libs/gst/vaapi/gstvaapicontext.c
index 52fd751b..88cd1105 100644
--- a/gst-libs/gst/vaapi/gstvaapicontext.c
+++ b/gst-libs/gst/vaapi/gstvaapicontext.c
@@ -51,7 +51,7 @@ static void
_init_vaapi_context_debug (void)
{
#ifndef GST_DISABLE_GST_DEBUG
- static volatile gsize _init = 0;
+ static gsize _init = 0;
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_debug_vaapi_context, "vaapicontext", 0,
diff --git a/gst-libs/gst/vaapi/gstvaapicontext.h b/gst-libs/gst/vaapi/gstvaapicontext.h
index 820fa639..7117722b 100644
--- a/gst-libs/gst/vaapi/gstvaapicontext.h
+++ b/gst-libs/gst/vaapi/gstvaapicontext.h
@@ -100,7 +100,7 @@ struct _GstVaapiContextInfo
struct _GstVaapiContext
{
/*< private >*/
- volatile gint ref_count;
+ gint ref_count;
GstVaapiDisplay *display;
GstVaapiID object_id;
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c
index 83d26f0f..6c103ace 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder.c
@@ -1822,7 +1822,7 @@ out:
GType
gst_vaapi_encoder_tune_get_type (void)
{
- static volatile gsize g_type = 0;
+ static gsize g_type = 0;
static const GEnumValue encoder_tune_values[] = {
/* *INDENT-OFF* */
@@ -1850,7 +1850,7 @@ gst_vaapi_encoder_tune_get_type (void)
GType
gst_vaapi_encoder_mbbrc_get_type (void)
{
- static volatile gsize g_type = 0;
+ static gsize g_type = 0;
if (g_once_init_enter (&g_type)) {
static const GEnumValue encoder_mbbrc_values[] = {
diff --git a/gst-libs/gst/vaapi/gstvaapifilter.c b/gst-libs/gst/vaapi/gstvaapifilter.c
index a9443e40..e0b3cd5f 100644
--- a/gst-libs/gst/vaapi/gstvaapifilter.c
+++ b/gst-libs/gst/vaapi/gstvaapifilter.c
@@ -38,7 +38,7 @@ struct _GstVaapiFilterOpData
{
GstVaapiFilterOp op;
GParamSpec *pspec;
- volatile gint ref_count;
+ gint ref_count;
guint va_type;
guint va_subtype;
gpointer va_caps;
@@ -550,7 +550,7 @@ op_data_new (GstVaapiFilterOp op, GParamSpec * pspec)
op_data->op = op;
op_data->pspec = pspec;
- op_data->ref_count = 1;
+ g_atomic_int_set (&op_data->ref_count, 1);
op_data->va_buffer = VA_INVALID_ID;
switch (op) {
diff --git a/gst-libs/gst/vaapi/gstvaapiminiobject.c b/gst-libs/gst/vaapi/gstvaapiminiobject.c
index 7b189832..30586b04 100644
--- a/gst-libs/gst/vaapi/gstvaapiminiobject.c
+++ b/gst-libs/gst/vaapi/gstvaapiminiobject.c
@@ -70,7 +70,7 @@ gst_vaapi_mini_object_new (const GstVaapiMiniObjectClass * object_class)
return NULL;
object->object_class = object_class;
- object->ref_count = 1;
+ g_atomic_int_set (&object->ref_count, 1);
object->flags = 0;
return object;
}
diff --git a/gst-libs/gst/vaapi/gstvaapiminiobject.h b/gst-libs/gst/vaapi/gstvaapiminiobject.h
index 778fc07b..52f28636 100644
--- a/gst-libs/gst/vaapi/gstvaapiminiobject.h
+++ b/gst-libs/gst/vaapi/gstvaapiminiobject.h
@@ -120,7 +120,7 @@ struct _GstVaapiMiniObject
{
/*< private >*/
gconstpointer object_class;
- volatile gint ref_count;
+ gint ref_count;
guint flags;
};
diff --git a/gst-libs/gst/vaapi/gstvaapitexture_glx.c b/gst-libs/gst/vaapi/gstvaapitexture_glx.c
index 273afc9b..76f450ad 100644
--- a/gst-libs/gst/vaapi/gstvaapitexture_glx.c
+++ b/gst-libs/gst/vaapi/gstvaapitexture_glx.c
@@ -249,7 +249,7 @@ GstVaapiGLApi
gl_get_curent_api_once ()
{
static GstVaapiGLApi cur_api = GST_VAAPI_GL_API_NONE;
- static volatile gsize _init = 0;
+ static gsize _init = 0;
if (g_once_init_enter (&_init)) {
cur_api = gl_get_current_api (NULL, NULL);
diff --git a/gst-libs/gst/vaapi/gstvaapiutils_egl.c b/gst-libs/gst/vaapi/gstvaapiutils_egl.c
index 0c2a1f5a..99ae37d2 100644
--- a/gst-libs/gst/vaapi/gstvaapiutils_egl.c
+++ b/gst-libs/gst/vaapi/gstvaapiutils_egl.c
@@ -614,7 +614,7 @@ egl_display_thread (gpointer data)
g_cond_broadcast (&display->gl_thread_ready);
g_mutex_unlock (&display->mutex);
- while (!display->gl_thread_cancel) {
+ while (!g_atomic_int_get (&display->gl_thread_cancel)) {
EglMessage *const msg =
g_async_queue_timeout_pop (display->gl_queue, 100000);
@@ -671,7 +671,7 @@ egl_display_init (EglDisplay * display)
static void
egl_display_finalize (EglDisplay * display)
{
- display->gl_thread_cancel = TRUE;
+ g_atomic_int_set (&display->gl_thread_cancel, TRUE);
g_thread_join (display->gl_thread);
g_cond_clear (&display->gl_thread_ready);
g_mutex_clear (&display->mutex);
diff --git a/gst-libs/gst/vaapi/gstvaapiutils_egl.h b/gst-libs/gst/vaapi/gstvaapiutils_egl.h
index abf3735e..20b553ea 100644
--- a/gst-libs/gst/vaapi/gstvaapiutils_egl.h
+++ b/gst-libs/gst/vaapi/gstvaapiutils_egl.h
@@ -120,7 +120,7 @@ struct egl_display_s
GMutex mutex;
GThread *gl_thread;
GCond gl_thread_ready;
- volatile gboolean gl_thread_cancel;
+ gboolean gl_thread_cancel;
GAsyncQueue *gl_queue;
gboolean created;
};
diff --git a/gst-libs/gst/vaapi/gstvaapivalue.c b/gst-libs/gst/vaapi/gstvaapivalue.c
index 1e012133..62e440b6 100644
--- a/gst-libs/gst/vaapi/gstvaapivalue.c
+++ b/gst-libs/gst/vaapi/gstvaapivalue.c
@@ -50,7 +50,7 @@ default_free_func (gpointer data)
GType
gst_vaapi_point_get_type (void)
{
- static volatile gsize g_type = 0;
+ static gsize g_type = 0;
if (g_once_init_enter (&g_type)) {
GType type =
@@ -67,7 +67,7 @@ gst_vaapi_point_get_type (void)
GType
gst_vaapi_rectangle_get_type (void)
{
- static volatile gsize g_type = 0;
+ static gsize g_type = 0;
if (g_once_init_enter (&g_type)) {
GType type =
@@ -85,7 +85,7 @@ gst_vaapi_rectangle_get_type (void)
GType
gst_vaapi_render_mode_get_type (void)
{
- static volatile gsize g_type = 0;
+ static gsize g_type = 0;
static const GEnumValue render_modes[] = {
{GST_VAAPI_RENDER_MODE_OVERLAY,
@@ -108,7 +108,7 @@ gst_vaapi_render_mode_get_type (void)
GType
gst_vaapi_rotation_get_type (void)
{
- static volatile gsize g_type = 0;
+ static gsize g_type = 0;
static const GEnumValue rotation_values[] = {
{GST_VAAPI_ROTATION_0,
@@ -137,7 +137,7 @@ gst_vaapi_rotation_get_type (void)
GType
gst_vaapi_rate_control_get_type (void)
{
- static volatile gsize g_type = 0;
+ static gsize g_type = 0;
static const GEnumValue rate_control_values[] = {
{GST_VAAPI_RATECONTROL_NONE,
diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
index caf1dc63..394a089b 100644
--- a/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
+++ b/gst-libs/gst/vaapi/gstvaapiwindow_wayland.c
@@ -98,7 +98,7 @@ struct _GstVaapiWindowWaylandPrivate
guint is_shown:1;
guint fullscreen_on_show:1;
guint sync_failed:1;
- volatile guint num_frames_pending;
+ guint num_frames_pending;
gint configure_pending;
gboolean need_vpp;
gboolean dmabuf_broken;