summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-21 19:43:14 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:35 +0200
commit1a86bb59dfdc68baf0075a14c13a63c219adc08d (patch)
tree8066eb230f4766be13ab4b982ef00d3fd86b4a03
parentf8ab59eacdde31af39f4defeb964adf4de140a50 (diff)
downloadmpv-1a86bb59dfdc68baf0075a14c13a63c219adc08d.tar.bz2
mpv-1a86bb59dfdc68baf0075a14c13a63c219adc08d.tar.xz
m_config: make m_config_cache_update() return more fine grained
Although the new code actually fires update notifications only when needed, m_config_cache_update() itself returned a rather coarse change value, which could indicate change even if none of the cached options were changed. On top of that, some code (like vo_gpu) calls the update function on every frame, which would reconfigure the renderer even on unrelated option changes.
-rw-r--r--options/m_config.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/options/m_config.c b/options/m_config.c
index f7d0b282db..8d66a1955e 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -1296,10 +1296,11 @@ struct m_config_cache *m_config_cache_alloc(void *ta_parent,
return cache;
}
-static void update_options(struct m_config_data *dst, struct m_config_data *src)
+static bool update_options(struct m_config_data *dst, struct m_config_data *src)
{
assert(dst->root == src->root);
+ bool res = false;
dst->ts = src->ts;
// Must be from same root, but they can have arbitrary overlap.
@@ -1316,6 +1317,7 @@ static void update_options(struct m_config_data *dst, struct m_config_data *src)
if (gsrc->ts <= gdst->ts)
continue;
gdst->ts = gsrc->ts;
+ res = true;
for (int i = g->co_index; i < g->co_end_index; i++) {
struct m_config_option *co = &dst->root->opts[i];
@@ -1325,6 +1327,8 @@ static void update_options(struct m_config_data *dst, struct m_config_data *src)
}
}
}
+
+ return res;
}
bool m_config_cache_update(struct m_config_cache *cache)
@@ -1337,9 +1341,9 @@ bool m_config_cache_update(struct m_config_cache *cache)
return false;
pthread_mutex_lock(&shadow->lock);
- update_options(cache->data, shadow->data);
+ bool res = update_options(cache->data, shadow->data);
pthread_mutex_unlock(&shadow->lock);
- return true;
+ return res;
}
void m_config_notify_change_co(struct m_config *config,