summaryrefslogtreecommitdiffstats
path: root/video/out/vo_drm.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_wlshm, vo_drm: set image size with mp_image_set_sizeMichael Forney2020-05-171-2/+1
| | | | | | | | | | The image w and h members must match params.w and params.h, so should not be changed directly. The helper function mp_image_set_size is designed for this purpose, so just use that instead. This prevents an assertion error with the rewritten draw_bmp. Fixes #7721.
* vo_drm, wo_wlshm: mention that it's software scalingwm42020-02-111-1/+1
| | | | (But does anyone even read --vo=help output?)
* vo_drm: replace drmModeAddFB usage with drmModeAddFB2Anton Kindestam2019-12-071-7/+13
| | | | | | drmModeAddFB is legacy, and might not pick the pixel format you expect, depending on your driver. Use drmModeAddFB2 which specifies this explicitly using a fourcc.
* drm: avoid division by 0 in drm_pflip_cb with bad driversAnton Kindestam2019-12-071-0/+1
| | | | | | | | | | | | | | Seems like some drivers only increment msc every other page flip when running in interlaced mode (I'm looking at you nouveau). I.e. it seems to be incremented at the frame rate, rather than the field rate. Obviously we can't work with this, so shame the driver and bail. On intel this isn't an issue, as msc is incremented at field rate there. This means presentation feedback won't work correctly in interlaced modes with those drivers, but who in their right mind uses an interlaced mode these days, anyway?
* vo_drm: fix potentially broken capability checksfan52019-12-071-2/+3
| | | | If the capability is available it may still be 0 to signal absence of support.
* sws_utils: shuffle around some shitwm42019-10-311-2/+2
| | | | | | | | | | | Purpose uncertain. I guess it's slightly better, maybe. The move of the sws/zimg options from VO opts (vo_opt_list) to the top-level option list is tricky. VO opts have some helper code in vo.c, that sends VOCTRL_SET_PANSCAN to the VO on every VO opts change. That's because updating certain VO options used to be this way (and not just the panscan option). This isn't needed anymore for sws/zimg options, so explicitly move them away.
* vo_drm: allow use of zimgwm42019-10-251-0/+1
|
* vo_drm: fix flickering when setting pan/scanAnton Kindestam2019-09-291-4/+0
| | | | | | | | Turns out clearing all frambuffers in reconfig isn't such a great idea when you also end up here when setting pan/scan. I guess this is just a leftover from a previous iteration of vo_drm where doing this made sense.
* vo_drm: support controlling swapchain depth using swapchain-depth optionAnton Kindestam2019-09-281-10/+13
|
* drm: refactor page_flipped callbackAnton Kindestam2019-09-281-55/+6
| | | | | Avoid duplicating the same callback function in both context_drm_egl and vo_drm.
* vo_drm: Implement N-buffering and presentation feedbackAnton Kindestam2019-09-281-39/+215
| | | | | | | | | | | Swapchain depth currently hard-coded to 3 (4 buffers). As we now avoid redrawing on repeat frames (we simply requeue the same fb again), this should give a nice performance boost when playing videos with a lower FPS than the display FPS in video-sync=display-resample mode. Presentation feedback has also been implemented to help counter the significant amounts of jitter we would otherwise be seeing.
* vo_drm: fix more than 2 buffersAnton Kindestam2019-09-281-1/+1
| | | | Now we can increase BUF_COUNT. Yay.
* vo_drm: 30bpp supportAnton Kindestam2019-09-221-8/+53
|
* drm_common: Add proper help option to drm-modeAnton Kindestam2019-05-041-1/+1
| | | | | | | This was implemented by using OPT_STRING_VALIDATE for drm-mode, instead of OPT_INT. Using a string here also prepares for future additions to drm-mode that aim to allow specifying a mode by its resolution.
* drm_common: Add option to toggle use of atomic modesettingAnton Kindestam2019-05-041-5/+4
| | | | | | It is useful when debugging to be able to force atomic off, or as a workaround if atomic breaks for some user. Legacy modesetting is less likely to break by virtue of being a less complex API.
* drm: rename plane options to better, invariant, namesAnton Kindestam2018-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | This commit bumps the libmpv version to 1.102 drm-osd-plane -> drm-draw-plane drm-video-plane -> drm-drmprime-video-plane drm-osd-size -> drm-draw-surface-size "draw plane", as in the plane that OpenGL draws to, whether it be video + OSD or just OSD. "drmprime video plane", as in the plane used for hwdec video imported via drmprime. "draw surface size", as in the size of the surface used for the draw plane The new names are invariant whether or not hwdec_drmprime_drm is being used or not. The original naming was very confusing, as when doing regular rendering (swdec or vaapi) the video would be displayed on the "OSD plane", and the "Video plane" would remain unused.
* context_drm_egl: Fix CRTC setup and release code when using atomicAnton Kindestam2018-07-091-3/+3
| | | | | | | | | | The previous code did not save enough information about the old state, and could end up changing what plane the fbcon:s FB got attached to, or in worse case causing a blank screen (observed in some multi-screen setups on Sandy Bridge). In addition refactor the handling of drmModeModeInfo property blobs to not leak, as well as enable reuse of already created blobs.
* drm/atomic: refactor planes namesLongChair2018-05-011-1/+2
| | | | | | | | We are currently using primary / overlay planes drm objects, assuming that primary plane is osd and overlay plane is video. This commit is doing two things : - replace the primary / overlay planes members with osd and video planes member without the assumption - Add two more options to determine which one of the primary / overlay is associated to osd / video. - It will default osd to overlay and video to primary if unspecified
* vo_drm: Fix pageflip errors on VT switchAnton Kindestam2018-02-261-2/+5
| | | | | | | | crtc_setup gets called on VT reacquire as well as during normal setup. When called during VT reacquire p->front_buf might not be 0, so the maths was wrong, and could cause array OOB errors. Use mathematically correct (for negative numbers) modulo to always pick the farthest away buffer (should work even for larger values of BUF_COUNT).
* drm_vo: pixel aspect from --monitoraspectMarco Migliori2018-02-211-1/+7
| | | | | | | | | | | | | | | | | When pixels are non-square, the appropriate value of vo->monitor_par is necessary to determine the destination rectangle, which in turn tells how to scale the video along the x and y axis. Before this commit, the drm driver only used --monitorpixelaspect. For example, to play a video with the right aspect on a 4:3 screen and 640:400 pixels, --monitorpixelaspect=5:6 had to be given. With this commit, vo->monitor_par is determined from the size of the screen in pixels and the --monitoraspect parameter. The latter is usually easier to determine than --monitorpixelaspect, since it is simply the proportion between the width and the height of the screen, in most cases 16:9 or 4:3. If --monitoraspect is not given, --monitorpixelaspect is used if given, otherwise pixel aspect is assumed 1:1.
* vo_drm: support --monitorpixelaspectMarco Migliori2018-02-111-0/+2
| | | | | | | | | | This commit allows for video to be shown with the right aspect even when pixels are not square in the selected drm mode. For example, if drm mode 5 is "640x400", the right aspect on a 4:3 monitor is obtained by mpv --vo=drm --drm-mode=5 --monitorpixelaspect=5:6 ... Other vo's seem to make this parameter change the size of the window, but in the drm vo this is fixed, being as large as the screen.
* vo_drm: reset last input image on reconfigMarco Migliori2018-02-111-0/+3
| | | | | | | | | | | | | | | | | | The last image is stored in vo->priv->last_input to be used when redrawing a frame is necessary (control: VOCTRL_REDRAW_FRAME). At the beginning it is NULL, so a redraw request has no effect since draw_image ignores calls with image=NULL. When using --force-window the size of the image may change without the vo structure being re-created. Before this commit, the size of vo->priv->last_input could become inconsistent with the cropping rectangle vo->priv->src_rc, which could trigger an assert in mp_image_crop_rc(). Even if it did not, the last image of a video remained on the screen when the next file in the playlist had no video (e.g., it was an mp3 without an embedded cover). This commit deallocates and resets to NULL the image vo->priv->last_input when reconfiguring video.
* vo_drm: make the osd as large as the screenMarco Migliori2018-02-111-18/+18
| | | | | | | | | | | | | | | | | | | | Before this commit, the drm vo drew the osd over the scaled image, and then copied the result onto the framebuffer, shifted. This made the frame centered, but forced the osd to be only as large as the image. This was inconsistent with other vo's, covered the image with the progress indicator even when a black band was at the top of the screen, made the progress indicator wrap on narrow videos, etc. The change is to always use an image as large as the screen. The frame is copied scaled and shifted to it, and the osd drawn over it. The result is finally copied to the framebuffer without any shift, since it is already as large as it. Technically, cur_frame is an image as large as the screen and cur_frame_cropped is a dummy reference to it, cropped to the size of the scaled video. This way, copying the scaled image to cur_frame_cropped positions the image in the right place in cur_frame, which can then have the osd added to it and copied to the framebuffer.
* sws_utils: don't force callers to provide option structwm42018-01-181-1/+1
| | | | | | | mp_sws_set_from_cmdline() has the only purpose to respect the --sws- command line options. Instead of forcing callers to get the option struct containing these, let callers pass mpv_global, and get it from the option core code directly. This avoids minor annoyances later on.
* video : Move drm options to substruct.Lionel CHAZALLON2017-10-231-1/+3
| | | | | This allows to group them and most of all query the group config when needed and when we don't have the access to vo.
* Add DRM_PRIME Format Handling and Display for RockChip MPP decodersLionel CHAZALLON2017-10-231-1/+1
| | | | | | | | | | | This commit allows to use the AV_PIX_FMT_DRM_PRIME newly introduced format in ffmpeg that allows decoders to provide an AVDRMFrameDescriptor struct. That struct holds dmabuf fds and information allowing zerocopy rendering using KMS / DRM Atomic. This has been tested on RockChip ROCK64 device.
* vo_drm: fallback to vo_wait_default if VT switcher is not availablerslovers2017-06-081-0/+2
| | | | | | | | | | | | | | | | | | | When the drm video output is used under VT with a terminal multiplexer like screen, the VT_SETMODE ioctl call will fail since the controlling terminal is a pseudoterminal instead of a real one, thus the VT switcher will be unavailable. The problem is, the wait_events function inside vo_drm.c will test for this, and will do nothing if the switcher is not active. Normally, this would not be noticed, however, when you pause a video, or if you're playing multiple image files, mpv will suddenly start busy waiting on a single core. I confirmed this by building mpv with gprof support, in a few seconds, wait_events got called about 90 million times. So I added a fallback, when the VT switcher is not availble, just use the vo_wait_default function. I tested it and it's working well so far.
* vo_drm: remove 2 redundant include statementswm42017-01-091-2/+0
| | | | They're already pulled in by drm_common.h.
* drm: include <poll.h> instead of <sys/poll.h>wm42017-01-091-1/+1
| | | | | | | I'm not sure what systems have <sys/poll.h> (maybe there are historical reasons why some would), but POSIX defines <poll.h>. Although this code is full of highly OS specific calls (like ioctl()), there's no reason not to use the more standard include path.
* options: remove deprecated sub-option handling for --vo and --aowm42016-11-251-1/+0
| | | | | | | | Long planned. Leads to some sanity. There still are some rather gross things. Especially g_groups is ugly, and a hack that can hopefully be removed. (There is a plan for it, but whether it's implemented depends on how much energy is left.)
* vo_drm: change CLI options + refactorsrr-2016-10-071-51/+23
| | | | | | | | | | - Change connector selection to accept human readable names (such as eDP-1, HDMI-A-2) rather than arbitrary numbers. - Change GPU selection to accept GPU number rather than device paths. - Merge connector and GPU selection into one --drm-connector. - Add support for --drm-connector=help. - Add support for --drm-* in EGL backend. - Refactor KMS; reduce state sharing across drm_common.
* vo_drm: fix segfault when using invalid cardrr-2016-10-061-2/+2
|
* vo_drm: refactor getting display fpsrr-2016-10-041-5/+1
| | | | | | | | Reduces code duplication between OpenGL backend and DRM VO. (The control() for OpenGL backend isn't sufficiently similar to the VO's control() to consider merging it as a whole - I extracted only the FPS code.)
* vo_drm: provide display fpsrr-2016-09-261-2/+13
|
* vo: remove unused VOCTRL_GET_PANSCANwm42016-09-081-2/+0
| | | | | | It was used to determine whether the VO supports VOCTRL_SET_PANSCAN. With all those changes to property semantics this became unnecessary, and its only use was dropped at some point.
* options: deprecate suboptions for the remaining AO/VOswm42016-09-051-0/+1
|
* vo_opengl: allow backends to provide callbacks for custom event loopswm42016-07-201-4/+1
| | | | | | | Until now, this has been either handled over vo.event_fd (which should go away), or by putting event handling on a separate thread. The backends which do the latter do it for a reason and won't need this, but X11 and Wayland will, in order to get rid of event_fd.
* Change GPL/LGPL dual-licensed files to LGPLwm42016-01-191-12/+7
| | | | | | | | | | | Do this to make the license situation less confusing. This change should be of no consequence, since LGPL is compatible with GPL anyway, and making it LGPL-only does not restrict the use with GPL code. Additionally, the wording implies that this is allowed, and that we can just remove the GPL part.
* video: switch from using display aspect to sample aspectwm42015-12-191-2/+2
| | | | | | | | | | | | | | | | MPlayer traditionally always used the display aspect ratio, e.g. 16:9, while FFmpeg uses the sample (aka pixel) aspect ratio. Both have a bunch of advantages and disadvantages. Actually, it seems using sample aspect ratio is generally nicer. The main reason for the change is making mpv closer to how FFmpeg works in order to make life easier. It's also nice that everything uses integer fractions instead of floats now (except --video-aspect option/property). Note that there is at least 1 user-visible change: vf_dsize now does not set the display size, only the display aspect ratio. This is because the image_params d_w/d_h fields did not just set the display aspect, but also the size (except in encoding mode).
* vo_drm: relicense to LGPLrr-2015-11-081-4/+5
| | | | | Also removed authorship information (as per convention seen in other files)
* vo_drm: use bool rather than integer return valuesrr-2015-11-081-36/+23
| | | | | Since the errors weren't used for anything other than simple success/fail checks, I simplified things a bit.
* vo_drm: move initialization to drm_commonrr-2015-11-081-219/+75
| | | | | Makes KMS initialization procedures reusable so that they can be used by the upcoming DRM EGL adapter.
* vo_drm: show osd in audio only modePaul B Mahol2015-10-291-8/+13
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* video/out: remove an unused parameterwm42015-10-031-2/+2
| | | | | | | | | | | This parameter has been unused for years (the last flag was removed in commit d658b115). Get rid of it. This affects the general VO API, as well as the vo_opengl backend API, so it touches a lot of files. The VOFLAGs are still used to control OpenGL context creation, so move them to the OpenGL backend code.
* vo_drm: make VT switching non mandatoryrr-2015-06-281-11/+20
|
* vo_drm: fixed crashes with --profile=pseudo-guiMarcin Kurczewski2015-06-131-1/+1
|
* vo_drm: fix not using BUF_COUNTMarcin Kurczewski2015-05-291-5/+4
|
* vo_drm: fix centering with regard to strideMarcin Kurczewski2015-05-291-13/+16
|
* vo_drm: Expose mode ID option to usersMarcin Kurczewski2015-05-281-10/+19
|
* vo_drm: Fix resolution not restored after exitingMarcin Kurczewski2015-05-281-1/+1
|
* vo_drm: Fix stride problem for certain devicesMarcin Kurczewski2015-05-281-1/+1
|
* vo_drm: allow changing video rectangle settingswm42015-05-081-0/+6
| | | | | | | | | Now among other things panscan can be changed during playback. Unfortunately, it flickers. The issue is that reconfig() clears the framebuffer. Removing the clearing shows that the "unused" parts of the picture are not cleared - even though OSD could render there. As such, this is a separate issue.
* vo_drm: don't mutate the current frame when clamping for panscanwm42015-05-081-3/+4
| | | | | | When running with --panscan=1, this could crash - because the current frame was reduced in size each time the image was redrawn, which would result in a failed assertion the second time it's drawn.
* vo_drm: zero screen buffers in reconfig function.akemi-san2015-04-271-0/+4
|
* vo_drm: add window screenshots supportMarcin Kurczewski2015-04-261-0/+3
|
* vo_drm: fix return value for void functionMarcin Kurczewski2015-04-211-1/+1
|
* vo_drm: fix coding style to adhere to guidelinesMarcin Kurczewski2015-04-211-4/+6
|
* vo_drm: fix releasing VT if received signal twiceMarcin Kurczewski2015-04-211-0/+3
| | | | | | If user switched terminals frantically, mpv could get SIGUSR1 twice in a row, which, up until now, resulted in destroying CRTC twice. This caused it to segfault. After this fix, double SIGUSR1 should be ignored.
* vo_drm: add vertical syncMarcin Kurczewski2015-04-211-5/+45
|
* vo_drm: extract vt_switcher to drm_commonMarcin Kurczewski2015-04-191-132/+38
|
* vo_drm: disable VT switcher for non-Linux systemsMarcin Kurczewski2015-04-191-2/+3
|
* vo_drm: fix logging problems with connectorsMarcin Kurczewski2015-04-181-1/+1
| | | | | | | Logging was meant to be silenced only when user uses connector auto-detection feature. If user supplies connector ID manually, he should see exact reason why connecting to this specific connector failed.
* vo_drm: fix VT behavior with auxiliary screensMarcin Kurczewski2015-04-181-2/+4
| | | | Fixes #1828
* vo_drm: fix VT switchingMarcin Kurczewski2015-04-181-55/+229
| | | | Fixes #1827
* vo_drm: add KMS/DRM renderer supportMarcin Kurczewski2015-04-161-0/+513
Signed-off-by: wm4 <wm4@nowhere>