Skip to content

Commit

Permalink
add --no-dmabuf option
Browse files Browse the repository at this point in the history
  • Loading branch information
ammen99 committed Aug 23, 2023
1 parent 7a0411c commit 1adc491
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions manpage/wf-recorder.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
.Op Fl c, -codec Ar output_codec
.Op Fl r, -framerate Ar framerate
.Op Fl d, -device Ar encoding_device
.Op Fl -no-dmabuf
.Op Fl D, -no-damage
.Op Fl f Ar filename.ext
.Op Fl F Ar filter_string
Expand Down Expand Up @@ -88,6 +89,11 @@ Use the
option in addition to the vaapi options to convert the
data in software, before sending it to the GPU.
.Pp
.It Fl -no-dmabuf
By default, wf-recorder will try to use only GPU buffers and copies if using a GPU encoder.
However, this can cause issues on some systems.
In such cases, this option will disable the GPU copy and force a CPU one.
.Pp
.It Fl D , -no-damage
By default, wf-recorder will request a new frame from the compositor
only when the screen updates. This results in a much smaller output
Expand Down
14 changes: 13 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,10 @@ Use Ctrl+C to stop.)");
Some drivers report support for rgb0 data for vaapi input but
really only support yuv.
--no-dmabuf By default, wf-recorder will try to use only GPU buffers and copies if
using a GPU encoder. However, this can cause issues on some systems. In such
cases, this option will disable the GPU copy and force a CPU one.
-D, --no-damage By default, wf-recorder will request a new frame from the compositor
only when the screen updates. This results in a much smaller output
file, which however has a variable refresh rate. When this option is
Expand Down Expand Up @@ -891,6 +895,7 @@ int main(int argc, char *argv[])

constexpr const char* default_cmdline_output = "interactive";
std::string cmdline_output = default_cmdline_output;
bool force_no_dmabuf = false;

struct option opts[] = {
{ "output", required_argument, NULL, 'o' },
Expand All @@ -906,6 +911,7 @@ int main(int argc, char *argv[])
{ "sample-rate", required_argument, NULL, 'R' },
{ "sample-format", required_argument, NULL, 'X' },
{ "device", required_argument, NULL, 'd' },
{ "no-dmabuf", no_argument, NULL, '&' },
{ "filter", required_argument, NULL, 'F' },
{ "log", no_argument, NULL, 'l' },
{ "audio", optional_argument, NULL, 'a' },
Expand Down Expand Up @@ -1012,6 +1018,10 @@ int main(int argc, char *argv[])
parse_codec_opts(params.audio_codec_options, optarg);
break;

case '&':
force_no_dmabuf = true;
break;

default:
printf("Unsupported command line argument %s\n", optarg);
}
Expand Down Expand Up @@ -1044,9 +1054,11 @@ int main(int argc, char *argv[])
}

// check we use same device as compositor
if (!params.hw_device.empty() && params.hw_device == drm_device_name)
if (!params.hw_device.empty() && params.hw_device == drm_device_name && !force_no_dmabuf)
{
use_dmabuf = true;
} else if (force_no_dmabuf) {
std::cout << "Disabling DMA-BUF as requested on command line" << std::endl;
} else {
std::cout << "compositor running on different device, disabling DMA-BUF" << std::endl;
}
Expand Down

0 comments on commit 1adc491

Please sign in to comment.