Skip to content

Commit 385b015

Browse files
committed
drop OpenCL
1 parent 5384bc9 commit 385b015

9 files changed

+3
-599
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,3 @@ To use GPU encoding, use a VAAPI codec (for ex. `h264_vaapi`) and specify a GPU
8484
wf-recorder -f test-vaapi.mkv -c h264_vaapi -d /dev/dri/renderD128
8585
```
8686
Some drivers report support for rgb0 data for vaapi input but really only support yuv planar formats. In this case, use the `-t` or `--force-yuv` option in addition to the vaapi options to convert the data to yuv planar data before sending it to the GPU.
87-
88-
The `-e` option attempts to use OpenCL if wf-recorder was built with OpenCL support and `-t` or `--force-yuv` are specified, even without vaapi GPU encoding. Use `-e#` or `--opencl=#` to use a specific OpenCL device, where `#` is one of the devices listed.

manpage/wf-recorder.1

-14
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
.Op Fl c, -codec Ar output_codec
1313
.Op Fl d, -device Ar encoding_device
1414
.Op Fl D, -no-damage
15-
.Op Fl e, -opencl Op Ar opencl_device
1615
.Op Fl f Ar filename.ext
1716
.Op Fl F Ar filter_string
1817
.Op Fl g, -geometry Ar geometry
@@ -85,19 +84,6 @@ file, which however has a variable refresh rate. When this option is
8584
on, wf-recorder does not use this optimization and continuously
8685
records new frames, even if there are no updates on the screen.
8786
.Pp
88-
.It Fl e , -opencl Ar opencl_device
89-
Attempts to use OpenCL if
90-
.Nm
91-
was built with OpenCL support and
92-
.Fl t , -force-yuv
93-
are specified, even without vaapi GPU encoding.
94-
Use
95-
.Fl e , -opencl
96-
.Ar opencl_device
97-
to use a specific OpenCL device, where
98-
.Ar opencl_device
99-
is one of the devices listed.
100-
.Pp
10187
.It Fl f Ar filename.ext
10288
By using the
10389
.Fl f

meson.build

+1-8
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ if pulse.found()
4949
project_sources += 'src/pulse.cpp'
5050
endif
5151

52-
opencl = dependency('OpenCL', required : get_option('opencl'))
53-
54-
if opencl.found()
55-
conf_data.set('HAVE_OPENCL', true)
56-
project_sources += 'src/opencl.cpp'
57-
endif
58-
5952
libavutil = dependency('libavutil')
6053
libavcodec = dependency('libavcodec')
6154
libavformat = dependency('libavformat')
@@ -78,7 +71,7 @@ subdir('proto')
7871
dependencies = [
7972
wayland_client, wayland_protos,
8073
libavutil, libavcodec, libavformat, libavdevice, libavfilter,
81-
wf_protos, threads, pulse, swr, opencl
74+
wf_protos, threads, pulse, swr
8275
]
8376

8477
executable('wf-recorder', project_sources,

meson_options.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
option('default_codec', type: 'string', value: 'libx264', description: 'Codec that will be used by default')
22
option('pulse', type: 'feature', value: 'auto', description: 'Enable Pulseaudio')
3-
option('opencl', type: 'feature', value: 'auto', description: 'Enable OpenCL')

src/frame-writer.cpp

-30
Original file line numberDiff line numberDiff line change
@@ -472,39 +472,9 @@ FrameWriter::FrameWriter(const FrameWriterParams& _params) :
472472
std::exit(-1);
473473
}
474474

475-
#ifndef HAVE_OPENCL
476-
if (params.opencl)
477-
std::cerr << "This version of wf-recorder was built without OpenCL support. Ignoring OpenCL option." << std::endl;
478-
#endif
479-
480475
init_codecs();
481476
}
482477

483-
void FrameWriter::convert_pixels_to_yuv(const uint8_t *pixels,
484-
const uint8_t *formatted_pixels, int stride[])
485-
{
486-
bool y_invert = (pixels != formatted_pixels);
487-
bool converted_with_opencl = false;
488-
489-
#ifdef HAVE_OPENCL
490-
if (params.opencl && params.force_yuv)
491-
{
492-
int r = opencl->do_frame(pixels, encoder_frame,
493-
get_input_format(), y_invert);
494-
495-
converted_with_opencl = (r == 0);
496-
}
497-
#else
498-
/* Silence compiler warning when opencl is disabled */
499-
(void)(y_invert);
500-
#endif
501-
502-
if (!converted_with_opencl)
503-
{
504-
// TODO: remove
505-
}
506-
}
507-
508478
void FrameWriter::encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt)
509479
{
510480
/* send the frame to the encoder */

src/frame-writer.hpp

-21
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ extern "C"
3232

3333
#include "config.h"
3434

35-
#ifdef HAVE_OPENCL
36-
#include <memory>
37-
#include "opencl.hpp"
38-
class OpenCL;
39-
#endif
40-
4135
enum InputFormat
4236
{
4337
INPUT_FORMAT_BGR0,
@@ -66,9 +60,7 @@ struct FrameWriterParams
6660
bool enable_audio;
6761
bool enable_ffmpeg_debug_output;
6862

69-
bool opencl;
7063
bool force_yuv;
71-
int opencl_device;
7264
int bframes;
7365

7466
std::atomic<bool>& write_aborted_flag;
@@ -100,16 +92,6 @@ class FrameWriter
10092
void init_video_filters(AVCodec *codec);
10193
void init_video_stream();
10294

103-
/**
104-
* Convert the given pixels to YUV and store in encoder_frame.
105-
* Calls OpenCL if it is enabled.
106-
*
107-
* @param formatted_pixels contains the same data as pixels but y-inverted
108-
* if the input format requires y-inversion.
109-
*/
110-
void convert_pixels_to_yuv(const uint8_t *pixels,
111-
const uint8_t *formatted_pixels, int stride[]);
112-
11395
void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt);
11496

11597
#ifdef HAVE_PULSE
@@ -136,9 +118,6 @@ class FrameWriter
136118
void add_audio(const void* buffer);
137119
size_t get_audio_buffer_size();
138120

139-
#endif
140-
#ifdef HAVE_OPENCL
141-
std::unique_ptr<OpenCL> opencl;
142121
#endif
143122

144123
~FrameWriter();

src/main.cpp

+2-35
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424

2525
#include "config.h"
2626

27-
#ifdef HAVE_OPENCL
28-
std::unique_ptr<OpenCL> opencl;
29-
#endif
30-
3127
#ifdef HAVE_PULSE
3228
#include "pulse.hpp"
3329
PulseReaderParams pulseParams;
@@ -351,14 +347,6 @@ static void write_loop(FrameWriterParams params)
351347
params.stride = buffer.stride;
352348
frame_writer = std::unique_ptr<FrameWriter> (new FrameWriter(params));
353349

354-
#ifdef HAVE_OPENCL
355-
if (params.opencl && params.force_yuv)
356-
{
357-
frame_writer->opencl = std::move(opencl);
358-
frame_writer->opencl->init(params.width, params.height);
359-
}
360-
#endif
361-
362350
#ifdef HAVE_PULSE
363351
if (params.enable_audio)
364352
{
@@ -590,15 +578,7 @@ Use Ctrl+C to stop.)");
590578
-o, --output Specify the output where the video is to be recorded.
591579
592580
-p, --codec-param Change the codec parameters.
593-
-p <option_name>=<option_value>)");
594-
#ifdef HAVE_OPENCL
595-
printf(R"(
596-
597-
-e, --opencl Use the -e[#] or --opencl[=#] in conjunction with -t or --force-yuv option
598-
to use opencl for gpu accelerated conversion of data to yuv. # is one
599-
of the devices listed when running without specifying #.)");
600-
#endif
601-
printf(R"(
581+
-p <option_name>=<option_value>
602582
603583
-F, --filter Specify the ffmpeg filter string to use. For example,
604584
-F hwupload,scale_vaapi=format=nv12 is used for VAAPI.
@@ -679,8 +659,6 @@ int main(int argc, char *argv[])
679659
params.enable_ffmpeg_debug_output = false;
680660
params.enable_audio = false;
681661
params.force_yuv = false;
682-
params.opencl = false;
683-
params.opencl_device = -1;
684662
params.bframes = -1;
685663

686664
constexpr const char* default_cmdline_output = "interactive";
@@ -700,7 +678,6 @@ int main(int argc, char *argv[])
700678
{ "audio", optional_argument, NULL, 'a' },
701679
{ "help", no_argument, NULL, 'h' },
702680
{ "force-yuv", no_argument, NULL, 't' },
703-
{ "opencl", optional_argument, NULL, 'e' },
704681
{ "bframes", required_argument, NULL, 'b' },
705682
{ "version", no_argument, NULL, 'v' },
706683
{ "no-damage", no_argument, NULL, 'D' },
@@ -710,7 +687,7 @@ int main(int argc, char *argv[])
710687
int c, i;
711688
std::string param;
712689
size_t pos;
713-
while((c = getopt_long(argc, argv, "o:f:m:x:g:c:p:d:b:la::te::hvDF:", opts, &i)) != -1)
690+
while((c = getopt_long(argc, argv, "o:f:m:x:g:c:p:d:b:la::thvDF:", opts, &i)) != -1)
714691
{
715692
switch(c)
716693
{
@@ -772,11 +749,6 @@ int main(int argc, char *argv[])
772749
help();
773750
break;
774751

775-
case 'e':
776-
params.opencl = true;
777-
params.opencl_device = optarg ? atoi(optarg) : -1;
778-
break;
779-
780752
case 'p':
781753
param = optarg;
782754
pos = param.find("=");
@@ -881,11 +853,6 @@ int main(int argc, char *argv[])
881853

882854
printf("selected region %d,%d %dx%d\n", selected_region.x, selected_region.y, selected_region.width, selected_region.height);
883855

884-
#ifdef HAVE_OPENCL
885-
if (params.opencl && params.force_yuv)
886-
opencl = std::unique_ptr<OpenCL> (new OpenCL(params.opencl_device));
887-
#endif
888-
889856
timespec first_frame;
890857
first_frame.tv_sec = -1;
891858

0 commit comments

Comments
 (0)