[vlc-commits] display: do not set the window size (twice)
Rémi Denis-Courmont
git at videolan.org
Sun Sep 2 16:26:32 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 2 17:12:28 2018 +0300| [3bfe59da91a692097453bd0fa4a2405ef92d39d0] | committer: Rémi Denis-Courmont
display: do not set the window size (twice)
This avoids calling the window from the display, which is inefficient
and prone to deadlocks or event loops.
Also fixes #9931.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3bfe59da91a692097453bd0fa4a2405ef92d39d0
---
src/video_output/display.c | 35 -----------------------------------
src/video_output/display.h | 2 --
src/video_output/video_output.c | 20 --------------------
3 files changed, 57 deletions(-)
diff --git a/src/video_output/display.c b/src/video_output/display.c
index d23e757619..5861018ade 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -593,29 +593,6 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
}
}
-static void VoutDisplayFitWindow(vout_display_t *vd, bool default_size)
-{
- vout_display_owner_sys_t *osys = vd->owner.sys;
- vout_display_cfg_t cfg = osys->cfg;
-
- if (!cfg.is_display_filled)
- return;
-
- cfg.display.width = 0;
- if (default_size) {
- cfg.display.height = 0;
- } else {
- cfg.zoom.num = 1;
- cfg.zoom.den = 1;
- }
-
- unsigned display_width;
- unsigned display_height;
- vout_display_GetDefaultDisplaySize(&display_width, &display_height,
- &vd->source, &cfg);
- vout_SetDisplayWindowSize(osys->vout, display_width, display_height);
-}
-
static void VoutDisplayCropRatio(int *left, int *top, int *right, int *bottom,
const video_format_t *source,
unsigned num, unsigned den)
@@ -663,10 +640,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN,
is_fullscreen) == VLC_SUCCESS) {
osys->cfg.is_fullscreen = is_fullscreen;
-
- if (!is_fullscreen)
- vout_SetDisplayWindowSize(osys->vout, osys->width_saved,
- osys->height_saved);
} else
msg_Err(vd, "Failed to set fullscreen");
}
@@ -679,8 +652,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
}
#endif
- bool fit_window = false;
-
if (osys->ch_sar) {
if (osys->sar.num > 0 && osys->sar.den > 0) {
vd->source.i_sar_num = osys->sar.num;
@@ -691,7 +662,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
}
vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT);
- fit_window = true;
osys->sar.num = vd->source.i_sar_num;
osys->sar.den = vd->source.i_sar_den;
osys->ch_sar = false;
@@ -740,7 +710,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
video_format_Print(VLC_OBJECT(vd), "SOURCE ", &osys->source);
video_format_Print(VLC_OBJECT(vd), "CROPPED", &vd->source);
vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP);
- fit_window = true;
osys->crop.left = left - osys->source.i_x_offset;
osys->crop.top = top - osys->source.i_y_offset;
/* FIXME for right/bottom we should keep the 'type' border vs window */
@@ -753,9 +722,6 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
osys->ch_crop = false;
}
- if (fit_window)
- VoutDisplayFitWindow(vd, false);
-
if (allow_reset_pictures
&& atomic_exchange(&osys->reset_pictures, false)) {
if (vout_display_Control(vd, VOUT_DISPLAY_RESET_PICTURES)) {
@@ -883,7 +849,6 @@ void vout_SetDisplayZoom(vout_display_t *vd, unsigned num, unsigned den)
osys->cfg.zoom.num = num;
osys->cfg.zoom.den = den;
vout_display_Control(vd, VOUT_DISPLAY_CHANGE_ZOOM, &osys->cfg);
- VoutDisplayFitWindow(vd, true);
}
void vout_SetDisplayAspect(vout_display_t *vd, unsigned dar_num, unsigned dar_den)
diff --git a/src/video_output/display.h b/src/video_output/display.h
index 875981e1a9..8d75df3a83 100644
--- a/src/video_output/display.h
+++ b/src/video_output/display.h
@@ -32,6 +32,4 @@ vout_display_t *vout_NewSplitter(vout_thread_t *vout,
/* FIXME should not be there */
void vout_SendDisplayEventMouse(vout_thread_t *, const vlc_mouse_t *);
-void vout_SetDisplayWindowSize(vout_thread_t *, unsigned, unsigned);
-
void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 22a0cb4de6..56281a815d 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -701,26 +701,6 @@ static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg)
cfg->align.vertical = VOUT_DISPLAY_ALIGN_BOTTOM;
}
-void vout_SetDisplayWindowSize(vout_thread_t *vout,
- unsigned width, unsigned height)
-{
- vout_window_t *window;
-
- /* BEWARE of lock inversion and infinite recursion!
- * This acquires the window lock but gets called from the display code.
- * This function should raelly not exist. Instead, the window size should
- * be adjusted on A.R., crop, fill and zoom changes *before*, and
- * separately from, the corresponding display update controls.
- */
- vlc_mutex_lock(&vout->p->window_lock);
- window = vout->p->window;
- if (window != NULL)
- /* Request a resize of the window. If it fails, there is nothing to do.
- * If it succeeds, the window will emit a resize event later. */
- vout_window_SetSize(window, width, height);
- vlc_mutex_unlock(&vout->p->window_lock);
-}
-
/* */
static int FilterRestartCallback(vlc_object_t *p_this, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval,
More information about the vlc-commits
mailing list