When mplayer plays a black window (or: Cinnamon leaking GPU memory)
The incident
All of the sudden, playing videos with Mplayer opened a black window. Sometimes going fullscreen helped, sometimes it didn’t, sometimes with video playing but without OSD. ffplay worked, but somewhat limping.
Setting: Linux Mint 19 on an x86_64, with a couple of fanless GeForce GT 1030 graphics cards and Cinnamon 3.8.9.
Mplayer’s output in this situation:
Playing IHS_1235.MOV. libavformat version 57.83.100 (external) libavformat file format detected. [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f858e2362a0]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol [lavf] stream 0: video (h264), -vid 0 [lavf] stream 1: audio (pcm_s16le), -aid 0, -alang eng VIDEO: [H264] 1920x1080 24bpp 59.940 fps 36067.5 kbps (4402.8 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family libavcodec version 57.107.100 (external) Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264) ========================================================================== Opening audio decoder: [pcm] Uncompressed PCM audio decoder AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000->192000) Selected audio codec: [pcm] afm: pcm (Uncompressed PCM) ========================================================================== AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample) Starting playback... Movie-Aspect is undefined - no prescaling applied. VO: [vdpau] 1920x1080 => 1920x1080 Planar YV12 [vdpau] Error when calling vdp_output_surface_create: The system does not have enough resources to complete the requested operation at this time. [vdpau] Error when calling vdp_output_surface_create: The system does not have enough resources to complete the requested operation at this time. [vdpau] Error when calling vdp_output_surface_create: The system does not have enough resources to complete the requested operation at this time. [vdpau] Error when calling vdp_output_surface_create: The system does not have enough resources to complete the requested operation at this time. [vdpau] Error when calling vdp_presentation_queue_block_until_surface_idle: An invalid handle value was provided. [vdpau] Error when calling vdp_video_mixer_render: An invalid handle value was provided. [vdpau] Error when calling vdp_presentation_queue_display: An invalid handle value was provided. A: 0.2 V: 0.0 A-V: 0.216 ct: 0.000 0/ 0 ??% ??% ??,?% 0 0 [vdpau] Error when calling vdp_presentation_queue_block_until_surface_idle: An invalid handle value was provided. [vdpau] Error when calling vdp_video_mixer_render: An invalid handle value was provided. [vdpau] Error when calling vdp_presentation_queue_block_until_surface_idle: An invalid handle value was provided. [vdpau] Error when calling vdp_video_mixer_render: An invalid handle value was provided. [vdpau] Error when calling vdp_presentation_queue_display: An invalid handle value was provided. [vdpau] Error when calling vdp_presentation_queue_display: An invalid handle value was provided.
And a lot of error messages, with “invalid handle value was provided” all over the place.
What does the graphics card have to say?
Opening Nvidia’s graphical control panel (Nvidia X Server Settings), it turns out that “User Dedicated Memory” stands at 1864 MB out of 1998 MB (93%). No wonder things don’t work.
OK, so who’s eating up all RAM? I have a wild guess, but nothing like getting it black on white:
$ nvidia-smi Sun Apr 14 14:39:40 2019 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 396.37 Driver Version: 396.37 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GT 1030 Off | 00000000:17:00.0 Off | N/A | | 0% 41C P8 N/A / 30W | 1MiB / 2001MiB | 0% Default | +-------------------------------+----------------------+----------------------+ | 1 GeForce GT 1030 Off | 00000000:65:00.0 On | N/A | | 0% 51C P8 N/A / 30W | 1914MiB / 1998MiB | 8% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 1 1803 G /usr/lib/xorg/Xorg 433MiB | | 1 2373 G cinnamon 1310MiB | | 1 54180 G ...uest-channel-token=14764917277860092693 165MiB | | 1 68188 G /usr/bin/nvidia-settings 0MiB | +-----------------------------------------------------------------------------+
(The memory consumptions are at the far right on each line. Scroll to see them)
At that very moment it had slurped quite some CPU RAM as well: 5.7 GB virtual memory allocated and 1.3 GB resident (real RAM). So leaking memory everywhere. That’s after running two months.
The other hog is Google Chrome, by the way, (165 MiB), also after running continuously for two months.
Solution
The solution is surprisingly simple and harmless: Restart Cinammon. Yes, you can do this even if there are a lot of windows open, spread out in different workspaces. They will remain in place, don’t worry.
The somewhat scary option is to request to switch user on the desktop’s GUI, and login as the same user again. Scary, because I get a blank screen with only a cursor pointer. To get out of that situation, Ctrl-Alt-F7 got me a proper login screen. And after logging in, all is fine. I’m not all that sure I’ll get that login screen every time, though.
The safer way is to reset Cinnamon without logging out, but the tabs will be reordered within each workspace. To do this (as I mentioned on another post):
Press ALT-F2, type “r” and Enter. Look away for a few seconds, because what happens next looks like a sudden reboot, but it isn’t. All comes back.
Except that the order of the Windows tabs is reordered. It seems to help to do this before the restart: Go through each of the workspaces, minimize all windows and then open them from the tabs, going from left to right. Helps partially.
And a lot of memory has been freed. Resident CPU RAM went down from 1.3 GB to 256 MB, but even more important:
$ nvidia-smi Sun Apr 14 14:49:19 2019 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 396.37 Driver Version: 396.37 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GT 1030 Off | 00000000:17:00.0 Off | N/A | | 0% 41C P8 N/A / 30W | 1MiB / 2001MiB | 0% Default | +-------------------------------+----------------------+----------------------+ | 1 GeForce GT 1030 Off | 00000000:65:00.0 On | N/A | | 0% 52C P0 N/A / 30W | 701MiB / 1998MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 1 1803 G /usr/lib/xorg/Xorg 498MiB | | 1 2373 G cinnamon 17MiB | | 1 54180 G ...uest-channel-token=14764917277860092693 177MiB | +-----------------------------------------------------------------------------+
That’s a crash diet until the next time. Once a month, I guess.