Commit Graph

5207 Commits

Author SHA1 Message Date
Rémi Denis-Courmont 84c253cdd1 window: rename vout_window* to vlc_window*
The baseline windowing code has not been specific to the video output
for a while.
2022-05-16 16:51:03 +00:00
Rémi Denis-Courmont 24246e4efb android: remove reverse NULL check
This code is useless as the window cannot be NULL, and it was already
optimised out.
2022-05-11 06:31:24 +00:00
Rémi Denis-Courmont 3e44f9c9d0 placebo: remove redundant test
Window can no longer be NULL here.
2022-05-10 16:11:27 +00:00
Alexandre Janniaux 3281938202 opengl: vout_helper: remove obsolete comment
vout_display_opengl code has separate prepare() and display(), which
might or might not match vout_display's prepare()/display() calls, now
that the opengl swap() is not done by the vout_display_opengl code.
2022-05-07 14:54:26 +00:00
Alexandre Janniaux 9b7514f9da opengl: display: move render code to prepare()
Now that we splitted the vlc_gl_Swap() call from the rendering, there's
no excuse for starting rendering sooner so that the result starts to be
available when executing display() and will almost be ready for
presentation.

is_dirty is there to indicate whether vlc_gl_MakeCurrent failed and thus
the frame could not be rendered, to avoid swapping undefined content.
2022-05-07 14:54:26 +00:00
Alexandre Janniaux f058e234f8 opengl: move vlc_gl_Swap() to display
The display code is better suited to execute Swap() than the
vout_display_opengl object, since:
 - It actually knows whether it's an on-screen or off-screen
   implementation.
 - It could add code to render more things between swapping.
 - In particular, it could render, but discard the rendering instead of
   swapping depending on the time spent or GPU state/chrono.
2022-05-07 14:54:26 +00:00
Alexandre Janniaux 610c50b1b5 opengl: display: load glFlush from context
Since the vout display work is splitted between prepare() and display(),
the flush is useful to ensure everything has been submitted by the end
of prepare() so that the result can be used in display().
2022-05-07 14:54:26 +00:00
Alexandre Janniaux 61bb942023 egl: allow swapping without current context
The vlc_gl_t API doesn't require the context to be current to call
vlc_gl_Swap(), but EGL needs it. Allowing vlc_gl_Swap from being called
outside of vlc_gl_MakeCurrent/ReleaseCurrent will allow to remove the
MakeCurrent/ReleaseCurrent mechanism and have the OpenGL provider pull
for a frame rendering instead of the code waiting on draw commands for
OpenGL to be ready to render, which is functionnally the same, but will
allow implementations like macosx.m or caopengllayer.m to be a real
OpenGL implementation instead of dummy provider around a display module.
2022-05-07 14:54:26 +00:00
Thomas Guillem 9e85ee741a vdummy: implement the display callback
Otherwise, the vout won't be paced at and will never wait for the clock.

Regression since 3f75f04af6.
2022-05-06 06:08:54 +00:00
Steve Lhomme f7803af508 d3d11: pass a vlc_logger to D3D11_AllocateResourceView()
No need to force the caller to know about its object.
2022-05-04 07:04:47 +00:00
Alexandre Janniaux 28b63bd33e opengl: wgl: use new vtable 2022-05-03 16:15:29 +00:00
Alexandre Janniaux b8450f6001 opengl: vgl: use new vtable 2022-05-03 16:15:29 +00:00
Alexandre Janniaux 704fd7cfc9 opengl: egl: use new vtable 2022-05-03 16:15:29 +00:00
Alexandre Janniaux f9e1d29428 opengl: macosx: use new vtable 2022-05-03 16:15:29 +00:00
Alexandre Janniaux 0cd2612ebe opengl: glx: use new vtable 2022-05-03 16:15:29 +00:00
Alexandre Janniaux 42a6424fd3 opengl: caopengllayer: use new vtable 2022-05-03 16:15:29 +00:00
Alexandre Janniaux cb6cf454b1 opengl: VLCOpenGLES2VideoView: use new vtable 2022-05-03 16:15:29 +00:00
Alexandre Janniaux 251c41d1cf opengl: VLCCVOpenGLProvider: use new vtable 2022-05-03 16:15:29 +00:00
Rémi Denis-Courmont 9c395de77c xdg/shell: get output name name description
Fixes #20571.
2022-05-03 07:31:32 +00:00
Rémi Denis-Courmont 2968881232 xdg/shell: look-up output for fullscreen mode
The existing code was blindly trusting that the provided object name
corresponded to a wl_output object and proxied it. This checks
that the ID corresponds to an already proxied object instead.
2022-05-03 07:31:32 +00:00
Rémi Denis-Courmont 1bcfc02523 xdg/shell: add output_find_by_name() 2022-05-03 07:31:32 +00:00
Rémi Denis-Courmont a93718907b xdg/shell: rationalise output functions
Separate look-up and destruction.
2022-05-03 07:31:32 +00:00
Rémi Denis-Courmont a4467c4971 xdg/shell: report output device from done callback
wl_output protocol versions 2 and larger involve more than one callback
to describe the outputs. The `done` callback indicates that all
callbacks have been invoked.

For backward compatibility with version 1, the `done` callback is
triggered manually, though I doubt that we can meaningfully support
version 1 going forward.
2022-05-03 07:31:32 +00:00
Rémi Denis-Courmont 19abac0f7d vdpau/interop: fix non-reentrant pointers (fixes #26554) 2022-04-29 18:58:25 +00:00
Alexandre Janniaux 2cb6eea124 macosx: rework resizing for vout_display
Rework resizing as a display-only module without windowing.

Since there's no window to resize this component (and it handles resize
internally), we can accept the display size events without changing
the rendering state, and will only react to the internal resize events
from the embedded NSView.

Fix #26846
Refs #25264
2022-04-29 13:07:27 +02:00
Alexandre Janniaux 73c5734144 macosx: disable pending reshape mechanism
The _pendingReshape mechanism was used to avoid redrawing the view if it
has been updated externally, and avoid re-render the view when it's
being drawn already but:
 - `drawRect:` won't be called if we didn't change the window, except
   the first time which will likely trigger a clear.
 - When the window state changes, we were already setting
   _pendingReshape to YES.

Overall, we can let the UI system decide when it requires a re-draw and
react to that instead of trying to workaround when to re-draw.
2022-04-29 13:07:27 +02:00
Alexandre Janniaux 2f21c8687c macosx: ignore DISPLAY_SIZE and handle resize internally
The current vout display module is resizing from its own view and tries
to notify the video view changes to the parent. But it can already
resize, so it doesn't need the core to resize the input picture, and
would already know the size it can render to.

It makes reporting the vout display size from the vout useless, and even
harmful since the display will re-enter itself on resize.
2022-04-29 13:07:27 +02:00
Alexandre Janniaux 34511d4238 macosx.m: remove sys->embed
sys->embed was confusing when the NSView could come from either the
drawable variable or the window provider, and the view is now given
through the display configuration in any case, so it doesn't need to be
stored again.
2022-04-29 13:07:27 +02:00
Alexandre Janniaux e67a8c4ff9 macosx.m: remove drawable code
The drawable NSObject is now provided through the window and the code is
the same both for a vout_window-provided NSObject or a libvlc NSObject
drawable so we can simplify here now.
2022-04-29 13:07:27 +02:00
Alexandre Janniaux b688611d7c macosx.m: use vlc_obj_calloc for sys
This also prevent the leak of sys happening when the wrong type of
window is used when opening the display, and move the test after the
trivial check for window type.
2022-04-29 13:07:27 +02:00
Alexandre Janniaux a478e7bca6 interop_vaapi: fix 420_10BPP format description
VLC_CODEC_VAAPI_420_10BPP is equivalent to VLC_FOURCC_P010 and has a
plane description that is like NV12, so it should not be different from
NV12. Only the bits per component, and so texture storage type is
changing for this format.

It was leading to incorrect or green color rendering with vaapi.
Regression from c344522ff2.

Fixes #26883
2022-04-28 18:03:05 +00:00
Alexandre Janniaux 409cde2f28 libplacebo: utils: fix comparison warnings
../../modules/video_output/libplacebo/utils.c: In function ‘vlc_placebo_DoviMetadata’:
    ../../modules/video_output/libplacebo/utils.c:472:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
      472 |     for (int c = 0; c < ARRAY_SIZE(dst->comp); c++) {
          |                       ^
    ../../modules/video_output/libplacebo/utils.c:486:35: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
      486 |                 for (int k = 0; k < ARRAY_SIZE(cdst->poly_coeffs[i]); k++) {
          |                                   ^
    ../../modules/video_output/libplacebo/utils.c:496:39: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
      496 |                     for (int k = 0; k < ARRAY_SIZE(cdst->mmr_coeffs[i][j]); k++)
          |                                       ^
2022-04-28 15:53:13 +00:00
Marvin Scholz 6bc300f3f2 macosx vouts: Adjust module priorities
This and the previous commit ensure that the new CAOpenGLLayer based
video output is used on macOS 10.14 and higher if the output selection
is set to automatic.

Forward-port from 3.0.x branch.
Cherry-picked from commit bbd1dca5df.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Alexandre Janniaux 514954e217 window_macosx: add embedded drawable submodule
Add an NSObject-drawable window implementation initializing the
vout_window properties from libvlc.

Fixes #26864
2022-04-28 08:08:15 +00:00
Alexandre Janniaux 8de94040f3 caopengllayer: remove drawable code
The display currently requires an NSObject window which is will be
fetched from a drawable window module in next patch. Fetching the
drawable from the display is not necessary anymore.
2022-04-28 08:08:15 +00:00
Alexandre Janniaux bd24889a0b caopengllayer: ignore DISPLAY_SIZE controls
DISPLAY_SIZE controls are emitted by the windowing system to control the
display state, but the caopengllayer display module is handling its own
windowing state without window and doesn't need to react to those events.

Instead, store the new size into the internal vout_display_cfg_t and
avoid trying to report the size to itself.

Fixes #26845
Refs #25264
2022-04-28 08:08:15 +00:00
Alexandre Janniaux 689b64b1aa caopengllayer: inline place picture
Store the current modified vout_display_cfg_t and inline the calls to
vout_display_PlacePicture.

Refs #26845
Refs #25264
2022-04-28 08:08:15 +00:00
Alexandre Janniaux ee1f172073 caopengllayer: remove sys->embed
We don't create an internal window anymore, so we can always use
vd->cfg->window where needed.
2022-04-28 08:08:15 +00:00
Felix Paul Kühne a446af46f9 caopengllayer: fix moving window with mouse
This fixes #24646

Forward-port from 3.0.x branch.
Cherry-picked from commit 7c74e968f4.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Marvin Scholz ad5f35b145 caopengllayer: fix resize handling
use layoutSublayers instead of resizeWithOldSuperlayerSize: as the
resizeWithOldSuperlayerSize: method is not called when compiled with
10.13 SDK, possibly because then the layer is not in a full layer tree
so has no superlayer eventually. So using layoutSublayers feels more
correct to be called when a layout change occurs.

Fix #24559

Forward-port from 3.0.x branch.
Cherry-picked from commit 11591b11c0.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
David Fuhrmann 7a659c6008 caopengllayer: Forward mouse events to other views as well
Other views might need the mouse events as well. Do the analog
logic as in the old macosx vout module.
Fixes steering of fullscreen panel.

fixes #24560

Signed-off-by: Marvin Scholz <epirat07@gmail.com>

Forward-port from 3.0.x branch.
Cherry-picked from commit 4d98f418ee.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Marvin Scholz 9fe5c444eb vout/caopengllayer: Fallback to legacy vout on < 10.14
Forward-port from 3.0.x branch.
Cherry-picked from commit 2272cd45c0.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Marvin Scholz 489e62d1c9 vout/caopengllayer: fix scaling when changing displays
Changing from a retina screen to a non-retina screen changes the
scale of the layer, so from point of view of the OpenGL code, the
size of the surface changes. Therefore we need to signal this change
so that the size is adapted correctly.

This is not a perfect solution as the size event will arrive too late
so for a few frames the wrong size can still be seen before it switches
to the new size. Ideally this would be handled like the live resize
but so far I have not found a good solution for how to do that.

Forward-port from 3.0.x branch.
Cherry-picked from commit 57401f907c.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Marvin Scholz 93c1208914 vout/caopengllayer: fix build with macOS SDKs < 10.14
Forward-port from 3.0.x branch.
Cherry-picked from commit baf1b28219.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Marvin Scholz b7fadee3ac vout/caopengllayer: rewrite most of the module
Rewrites most of the layer vout code to have the same features as the
view based vout. Additionally fixes laggy resizing, fixes CGL context
creation bugs, adds support for CI filters and fixes various memory
management errors.

The CAOpenGLLayer based API is special and different from all other APIs
provided on other OSes as it is not a push-model API but a pull one,
where the OS calls a specific method when a new frame should be rendered.
This makes integration into VLC relatively tricky and the code a bit
harder to follow.
While the API is a pull-model, we can kind of trick it by just forcing
a re-display of the layer in the vouts display function. With views this
would be forbidden as views are supposed to be accessed from the main
thread only, but with layers this is possible if some care is taken.
When forcing the layer to render from a different thread, the implicitly
created CATransaction has to be flushed explicitly, as we do not have a
main loop at the end of which it would be flushed.

We do not force rendering all the time though, as doing that would break
resize animations given that VLC can not know the right time when display
refresh will happen, so resizing would look laggy and have glitches, as
during a resize both the OS and VLC would drive the rendering of the
layer, resulting in unexpected result.
To prevent that, when live resizing starts (the user resizing by dragging
a windows corner), the layer is set into asynchronous rendering mode
which makes the OS drive the rendering loop completely not only for
drawing the resize change. While the layer is in asynchronous mode, we
ignore all update requests from the core, as the layer is anyway updated
continuously by the OS and forcing rendering from another thread would
lead to artifacts. Additionally while in live resize, we do not report
the size changes to the core, as the event takes too long to reach the
vout Control() function, resulting in the layer content being displayed
at the wrong (old) size. Instead we take the current viewport size
as the size and display using that.

Another unusual thing compared to other vouts is that the VLC OpenGL
display functions to update the viewport and aspect ratio are not
called in the Control event handling callback, thats because before
the render callback is called, the OS sets the OpenGL viewport to match
the layer backing store size. So setting it in the Control callback
is useless as it does not make any difference.

Forward-port from 3.0.x branch.
Cherry-picked from commit 879ca61f8c.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>

Noticeable changes:
 - vlc_object_release has been changed into vlc_object_delete
2022-04-28 08:08:15 +00:00
Marvin Scholz e68145e49c vout/caopengllayer: move module descriptor
Forward port from 3.0.x branch.
Cherry-picked from commit 52ee032826.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Marvin Scholz 48c59025f1 vout/caopengllayer: fix crash on close
The CGL context was destroyed too early, so move around the
vout display removal to prevent using the already-gone context.

Forward port from 3.0.x branch.
Cherry-picked from commit 7d1e7f289d.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Marvin Scholz fee7cff954 vout/caopengllayer: remove HDR support
This is anyway not properly supported currently so opting in to it
here does not change anything for the better.

Forward port from 3.0.x branch.
Cherry-picked from commit 4591255d8e.

Signed-off-by: Alexandre Janniaux <ajanni@videolabs.io>
2022-04-28 08:08:15 +00:00
Alexandre Janniaux cdd8a75fb6 caopengllayer: replace sys->embed by vd->cfg->window
sys->embed was used to store the window created from the display in
pre-3.0 design, but now the display is created after the window and the
window is available in vd->cfg->window.

The sys->embed was storing the same pointer in the normal case, but
ironically, it was undefined in the libvlc embedding case and was
leading to crash.
2022-04-28 08:08:15 +00:00
Steve Lhomme b469857dec vlc_threads: remove the thread priority when creating a thread
It is not used in POSIX systems. On other system it probably don't make a
difference anymore, only Windows has actual useful values for
VLC_THREAD_PRIORITY_XXX. The synchronization is more important than having some
threads called more often than others.
2022-04-27 08:16:28 +00:00