tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
v4l2loopback: unstable-2022-08-05 -> unstable-2023-02-19
betaboon
2 years ago
fc6c5c71
e3802695
+63
-3
2 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
v4l2loopback
default.nix
revert-pr518.patch
+8
-3
pkgs/os-specific/linux/v4l2loopback/default.nix
···
2
3
stdenv.mkDerivation rec {
4
pname = "v4l2loopback";
5
-
version = "unstable-2022-08-05-${kernel.version}";
6
7
src = fetchFromGitHub {
8
owner = "umlaeute";
9
repo = "v4l2loopback";
10
-
rev = "76434ab6f71d5ecbff8a218ff6bed91ea2bf73b8";
11
-
sha256 = "sha256-TdZacRkFAO2HAEbljzXeJ241VcDqSwBECq3bnn7yvBY=";
12
};
0
0
0
0
0
13
14
hardeningDisable = [ "format" "pic" ];
15
···
2
3
stdenv.mkDerivation rec {
4
pname = "v4l2loopback";
5
+
version = "unstable-2023-02-19-${kernel.version}";
6
7
src = fetchFromGitHub {
8
owner = "umlaeute";
9
repo = "v4l2loopback";
10
+
rev = "fb410fc7af40e972058809a191fae9517b9313af";
11
+
hash = "sha256-gLFtR7s+3LUQ0BZxHbmaArHbufuphbtAX99nxJU3c84=";
12
};
13
+
14
+
patches = [
15
+
# fix bug https://github.com/umlaeute/v4l2loopback/issues/535
16
+
./revert-pr518.patch
17
+
];
18
19
hardeningDisable = [ "format" "pic" ];
20
+55
pkgs/os-specific/linux/v4l2loopback/revert-pr518.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/v4l2loopback.c b/v4l2loopback.c
2
+
index 2ab1f76..2514f09 100644
3
+
--- a/v4l2loopback.c
4
+
+++ b/v4l2loopback.c
5
+
@@ -92,17 +92,6 @@ MODULE_LICENSE("GPL");
6
+
} \
7
+
} while (0)
8
+
9
+
-/* TODO: Make sure that function is never interrupted. */
10
+
-static inline int mod_inc(int *number, int mod)
11
+
-{
12
+
- int result;
13
+
- result = (*number + 1) % mod;
14
+
- if (unlikely(result < 0))
15
+
- result += mod;
16
+
- *number = result;
17
+
- return result;
18
+
-}
19
+
-
20
+
static inline void v4l2l_get_timestamp(struct v4l2_buffer *b)
21
+
{
22
+
/* ktime_get_ts is considered deprecated, so use ktime_get_ts64 if possible */
23
+
@@ -1424,8 +1413,9 @@ static int vidioc_reqbufs(struct file *file, void *fh,
24
+
i = dev->write_position;
25
+
list_for_each_entry(pos, &dev->outbufs_list,
26
+
list_head) {
27
+
- dev->bufpos2index[mod_inc(&i, b->count)] =
28
+
+ dev->bufpos2index[i % b->count] =
29
+
pos->buffer.index;
30
+
+ ++i;
31
+
}
32
+
}
33
+
34
+
@@ -1489,9 +1479,10 @@ static void buffer_written(struct v4l2_loopback_device *dev,
35
+
del_timer_sync(&dev->timeout_timer);
36
+
spin_lock_bh(&dev->lock);
37
+
38
+
- dev->bufpos2index[mod_inc(&dev->write_position, dev->used_buffers)] =
39
+
+ dev->bufpos2index[dev->write_position % dev->used_buffers] =
40
+
buf->buffer.index;
41
+
list_move_tail(&buf->list_head, &dev->outbufs_list);
42
+
+ ++dev->write_position;
43
+
dev->reread_count = 0;
44
+
45
+
check_timers(dev);
46
+
@@ -1586,7 +1577,8 @@ static int get_capture_buffer(struct file *file)
47
+
if (dev->write_position >
48
+
opener->read_position + dev->used_buffers)
49
+
opener->read_position = dev->write_position - 1;
50
+
- pos = mod_inc(&opener->read_position, dev->used_buffers);
51
+
+ pos = opener->read_position % dev->used_buffers;
52
+
+ ++opener->read_position;
53
+
}
54
+
timeout_happened = dev->timeout_happened;
55
+
dev->timeout_happened = 0;