From 7bee923938bc1756110461c916a945979a7c197b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 4 Aug 2024 17:49:42 +0200 Subject: Compressed plane now works, update readme and remove warning --- README.md | 5 +---- TODO | 10 ---------- src/capture/kms.c | 26 -------------------------- 3 files changed, 1 insertion(+), 40 deletions(-) diff --git a/README.md b/README.md index e9ff757..d1851a9 100644 --- a/README.md +++ b/README.md @@ -152,16 +152,13 @@ If you installed GPU Screen Recorder flatpak then you can try installing mesa-ex ## I have an old nvidia GPU that supports nvenc but I get a cuda error when trying to record Newer ffmpeg versions don't support older nvidia cards. Try installing GPU Screen Recorder flatpak from [flathub](https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder) instead. It comes with an older ffmpeg version which might work for your GPU. ## I get a black screen/glitches while live streaming -It seems like ffmpeg earlier than version 6.1 has some type of bug. Install ffmpeg 6.1 and then reinstall GPU Screen Recorder to fix this issue. The flatpak version of GPU Screen Recorder comes with ffmpeg 6.1 so no extra steps are needed. +It seems like ffmpeg earlier than version 6.1 has some type of bug. Install ffmpeg version 6.1 or later and then reinstall GPU Screen Recorder to fix this issue. The flatpak version of GPU Screen Recorder comes with a newer version of ffmpeg so no extra steps are needed. ## I can't play the video in my browser directly or in discord Browsers and discord don't support hevc video codec at the moment. Choose h264 video codec instead with the -k h264 option. Note that websites such as youtube support hevc so there is no need to choose h264 video codec if you intend to upload the video to youtube or if you want to play the video locally or if you intend to edit the video with a video editor. Hevc allows for better video quality (especially at lower file sizes) so hevc (or av1) is recommended for source videos. ## I get a black bar/distorted colors on the right/bottom in the video This is mostly an issue on AMD. For av1 it's a hardware issue, see: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9185. For hevc it's a software issue in the AMD driver that hasn't been fixed yet. This issue happens at certain video resolutions. If you get this issue then a workaround is to record with h264 video codec instead (using the -k h264 option). -## The video is glitched (looks like checkerboard pattern) or black -This is an issue on some intel integrated gpus on wayland caused by power saving option. Right now the only way to fix this is to either record on X11 (maybe only with window capture option) or to record with the `-w portal` option (usually only available on Wayland). -The video can also be black when using software such as prime-run. This is not supported. ## The video doesn't display or has a green/yellow overlay This can happen if your video player is missing the H264/HEVC video codecs. Either install the codecs or use mpv. ## I get stutter in the video diff --git a/TODO b/TODO index 0c87db9..90e4c89 100644 --- a/TODO +++ b/TODO @@ -77,12 +77,6 @@ Use SRC_W and SRC_H for screen plane instead of crtc_w and crtc_h. Make it possible to select which /dev/dri/card* to use, but that requires opengl to also use the same card. Not sure if that is possible for amd, intel and nvidia without using vulkan instead. -Support intel display framebuffer compression (I915_FORMAT_MOD_Y_TILED_CCS modifier) (and other power saving modifiers, see https://trac.ffmpeg.org/ticket/8542). The only fix may be to use desktop portal for recording. This issue doesn't appear on x11 since these modifiers are not used by xorg server. -This issue only appears on some intel iGPUs, such as Intel Iris Xe, see: https://github.com/dec05eba/gpu-screen-recorder-issues/issues/1. - The compression format is described in libdrm/drm_fourcc.h (I915_FORMAT_MOD_Y_TILED_CCS comment). The main surface is plane 0 while plane 1 contains the compression data. - The compression data (plane 1) is 1024x512 pixels and matches the main surface (plane 0) and it's divided into 128Bx32 blocks, - but the data is actually QWORD (bytes) so it's in 64Bx64 tiles (?). - Test if p2 state can be worked around by using pure nvenc api and overwriting cuInit/cuCtxCreate* to not do anything. Cuda might be loaded when using nvenc but it might not be used, with certain record options? (such as h264 p5). nvenc uses cuda when using b frames and rgb->yuv conversion, so convert the image ourselves instead.- @@ -104,8 +98,6 @@ Setup hardware video context so we can query constraints and capabilities for be Use CAP_SYS_NICE in flatpak too on the main gpu screen recorder binary. It makes recording smoother, especially with constant framerate. -Show error when using compressed kms plane which isn't supported. Also do that in the gui. - Modify ffmpeg to accept opengl texture for nvenc encoding. Removes extra buffers and copies. When vulkan encode is added, mention minimum nvidia driver required. (550.54.14?). @@ -146,8 +138,6 @@ Support hevc/av1 for software encoder and hdr support at the same time. Need sup Cleanup pipewire code and add more error checks. -Detect if recording monitor on intel and plane is compressed. In that case give an error and tell the user to use -w portal instead. - Make dbus code and pipewire setup non blocking. Support portal (pipewire) hdr capture when pipewire adds support for it. Maybe use the result of SelectSources and then query the hdr metadata with drm. diff --git a/src/capture/kms.c b/src/capture/kms.c index 5d0aed3..2ca31d4 100644 --- a/src/capture/kms.c +++ b/src/capture/kms.c @@ -253,24 +253,6 @@ static vec2i swap_vec2i(vec2i value) { return value; } -static bool is_plane_compressed(uint64_t modifier) { - switch(modifier) { - case I915_FORMAT_MOD_Y_TILED_CCS: - case I915_FORMAT_MOD_Yf_TILED_CCS: - case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS: - case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS: - case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC: - case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS: - case I915_FORMAT_MOD_4_TILED_DG2_MC_CCS: - case I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC: - case I915_FORMAT_MOD_4_TILED_MTL_RC_CCS: - case I915_FORMAT_MOD_4_TILED_MTL_MC_CCS: - case I915_FORMAT_MOD_4_TILED_MTL_RC_CCS_CC: - return true; - } - return false; -} - static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_conversion *color_conversion) { gsr_capture_kms *self = cap->priv; const bool cursor_texture_id_is_external = self->params.egl->gpu_info.vendor == GSR_GPU_VENDOR_NVIDIA; @@ -320,14 +302,6 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c if(drm_fd->has_hdr_metadata && self->params.hdr && hdr_metadata_is_supported_format(&drm_fd->hdr_metadata)) gsr_kms_set_hdr_metadata(self, drm_fd); - if(is_plane_compressed(drm_fd->modifier)) { - static bool compressed_plane_warning_shown = false; - if(!compressed_plane_warning_shown) { - compressed_plane_warning_shown = true; - fprintf(stderr, "gsr warning: gsr_capture_kms_capture: the monitor plane is compressed. The video will likely be glitched/black. Try recording on X11 instead (maybe capturing a single window) or use the \"-w portal\" capture option on Wayland.\n"); - } - } - // TODO: This causes a crash sometimes on steam deck, why? is it a driver bug? a vaapi pure version doesn't cause a crash. // Even ffmpeg kmsgrab causes this crash. The error is: // amdgpu: Failed to allocate a buffer: -- cgit v1.2.3