aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/test/test-media
blob: 144dcc9df4f1695bda2de62ff5d87c31590cfca5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
#!/bin/bash

# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright 2019 Cisco Systems, Inc. and/or its affiliates. All rights reserved.

vivid=0
vim2m=0
vimc=0
vicodec=0
cec=0
cecpwr=--skip-test-standby-resume
kmemleak=0
dmesg=0
unload=0
unbind_time=1
reunbind_time=9
rmmod_time=1
kobj_rel=0

if [ -f /proc/config.gz ]; then
	if cat /proc/config.gz | gunzip |grep -q CONFIG_DEBUG_KOBJECT_RELEASE=y ; then
		kobj_rel=1
	fi
elif [ -f .config ]; then
	if grep -q CONFIG_DEBUG_KOBJECT_RELEASE=y .config ; then
		kobj_rel=1
	fi
fi

if [ $kobj_rel -eq 1 ]; then
	echo Detected CONFIG_DEBUG_KOBJECT_RELEASE=y
	unbind_time=10
	reunbind_time=14
	rmmod_time=5
fi

cur_lvl=`cut -c 1-2 /proc/sys/kernel/printk`
dmesg -n notice

if [ -z "$1" ]; then
	echo "usage: test-media [options] test-targets"
	echo
	echo Run as root.
	echo
	echo Options:
	echo "-unload: unload any media modules before testing"
	echo "-kmemleak: enable memory leak scan"
	echo "-dmesg: run dmesg at the end"
	echo
	echo Test Targets:
	echo "vivid: test the vivid driver"
	echo "vim2m: test the vim2m driver"
	echo "vimc: test the vimc driver"
	echo "vicodec: test the vicodec driver"
	echo "cec: adds the vivid CEC compliance tests, 'cec-pwr' adds the CEC standby/wakeup tests."
	echo "all: equals 'vivid vim2m vimc vicodec cec cec-pwr'"
	echo "mc: equals 'vivid vim2m vimc vicodec'"
	exit 0
fi

if [ `id -u` -ne 0 ]; then
	echo "$0 must be run as root"
	exit -1
fi

while [ ! -z "$1" ]; do
	case "$1" in
	-unload)
		unload=1
		;;
	-dmesg)
		dmesg=1
		;;
	-kmemleak)
		if [ -f /sys/kernel/debug/kmemleak ]; then
			kmemleak=1
		else
			echo /sys/kernel/debug/kmemleak not found, disable memleak testing
		fi
		;;
	all)
		vivid=1
		vim2m=1
		vimc=1
		vicodec=1
		cec=1
		cecpwr=
		;;
	mc)
		vivid=1
		vim2m=1
		vimc=1
		vicodec=1
		;;
	vivid)
		vivid=1
		;;
	vim2m)
		vim2m=1
		;;
	vimc)
		vimc=1
		;;
	vicodec)
		vicodec=1
		;;
	cec)
		cec=1
		;;
	cec-pwr)
		cecpwr=
		;;
	esac
	shift
done

if [ $unload -eq 1 ]; then
	test-media-unload.pl
	dmesg -n notice
fi

if [ $kmemleak -eq 1 ]; then
	echo clear >/sys/kernel/debug/kmemleak
fi

rmmod vivid 2&>/dev/null
modprobe vivid n_devs=3 multiplanar=1,2,2 #allocators=0,1,1
sleep 1

tmp=`mktemp`

if ! v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-cap ; then
	echo "FAIL: the vivid module failed to load" | tee -a $tmp
	echo "Grand Total for vivid: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
	echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
	exit 0
fi

v4l2-ctl -z platform:vivid-000 -d vivid-000-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24
v4l2-ctl -z platform:vivid-000 -d vivid-000-vid-out -o1 -x width=3840,height=2160,pixelformat=NV24
v4l2-ctl -z platform:vivid-001 -d vivid-001-vid-cap -i3 -v width=3840,height=2160,pixelformat=NM16
v4l2-ctl -z platform:vivid-001 -d vivid-001-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16
v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24
v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16

echo

if [ $vivid -eq 1 ]; then
	dmesg -n notice
	echo
	echo vivid compliance tests, contiguous planes
	echo
	date
	stdbuf -oL v4l2-compliance -m platform:vivid-000 -z platform:vivid-002 -e vivid-002-vid-cap -P -s10 -a 2>&1 | tee -a $tmp
	echo
	echo vivid compliance tests, non-contiguous planes
	echo
	date
	stdbuf -oL v4l2-compliance -m platform:vivid-001 -z platform:vivid-002 -e vivid-002-vid-out -P -s10 -a 2>&1 | tee -a $tmp
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
fi

if [ $cec -eq 1 ]; then
	dmesg -n notice
	echo
	echo vivid cec compliance tests
	echo
	if ! cec-ctl -D vivid -a vivid-000-vid-cap0 >/dev/null ; then
		echo "FAIL: the vivid module had no cec support" | tee -a $tmp
		echo "Grand Total for vivid cec: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
		exit 0
	fi
	cec-ctl -D vivid -a vivid-000-vid-cap0 --tv
	sleep 1
	cec-ctl -D vivid -a vivid-000-vid-out0 --playback
	sleep 1
	trap 'kill $f0 $f1 2>/dev/null' INT
	cec-follower -s -D vivid -a vivid-000-vid-cap0 2>&1 >/dev/null &
	f0=$!
	cec-follower -s -D vivid -a vivid-000-vid-out0 2>&1 >/dev/null &
	f1=$!
	date
	# Once vivid is properly handling Arbitration Lost situation, then
	# we can add back the -A option for the cec-compliance commands.
	stdbuf -oL cec-compliance -D vivid -a vivid-000-vid-cap0 -r4 -t10 $cecpwr 2>&1 | tee -a $tmp
	sleep 5
	date
	stdbuf -oL cec-compliance -D vivid -a vivid-000-vid-out0 -r0 -t10 $cecpwr 2>&1 | tee -a $tmp
	kill $f0
	kill $f1
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	vivid=1
fi

if [ $vivid -eq 1 ]; then
	echo
	echo unbind vivid
	echo
	echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
	sleep $unbind_time
	echo
	echo rebind vivid
	echo
	echo -n vivid.0 >/sys/bus/platform/drivers/vivid/bind
	sleep 1
	echo
	echo second unbind vivid
	echo
	for i in `v4l2-ctl -z platform:vivid-000 --list-devices`; do
		let "t = 1 + $RANDOM / 4096"
		echo $i: sleep ${t}s
		sleep $t <$i &
	done
	sleep 1
	echo
	echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
	sleep $reunbind_time
	echo
	echo rmmod vivid
	echo
	rmmod vivid
	sleep $rmmod_time

	if [ $kmemleak -eq 1 ]; then
		echo
		echo kmemleak results for vivid:
		echo
		echo scan >/sys/kernel/debug/kmemleak
		cat /sys/kernel/debug/kmemleak
		echo
		echo end of kmemleak results
		echo
	fi

	modprobe vivid n_devs=3 multiplanar=1,2,2 #allocators=0,1,1
	sleep 1

	v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24
	v4l2-ctl -z platform:vivid-002 -d vivid-002-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16

	if [ $kmemleak -eq 1 ]; then
		echo clear >/sys/kernel/debug/kmemleak
	fi
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
fi

if [ $vim2m -eq 1 ]; then
	rmmod vim2m 2&>/dev/null
	modprobe vim2m
	sleep 1
	dmesg -n notice
	echo

	if ! v4l2-ctl -z platform:vim2m ; then
		echo "FAIL: the vim2m module failed to load" | tee -a $tmp
		echo "Grand Total for vim2m: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
		rmmod vivid
		exit 0
	fi

	echo vim2m compliance tests
	echo
	date
	stdbuf -oL v4l2-compliance -m platform:vim2m -z platform:vivid-002 -e vivid-002-vid-cap -s10 -P -a 2>&1 | tee -a $tmp
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo unbind vim2m
	echo
	echo -n vim2m.0 >/sys/bus/platform/drivers/vim2m/unbind
	sleep $unbind_time
	echo
	echo rebind vim2m
	echo
	echo -n vim2m.0 >/sys/bus/platform/drivers/vim2m/bind
	sleep 1
	echo
	echo second unbind vim2m
	echo
	for i in `v4l2-ctl -z platform:vim2m --list-devices`; do
		let "t = 1 + $RANDOM / 4096"
		echo $i: sleep ${t}s
		sleep $t <$i &
	done
	sleep 1
	echo
	echo -n vim2m.0 >/sys/bus/platform/drivers/vim2m/unbind
	sleep $reunbind_time
	echo
	echo rmmod vim2m
	echo
	rmmod vim2m
	sleep $rmmod_time
	if [ $kmemleak -eq 1 ]; then
		echo
		echo kmemleak results for vim2m:
		echo
		echo scan >/sys/kernel/debug/kmemleak
		cat /sys/kernel/debug/kmemleak
		echo
		echo end of kmemleak results
		echo clear >/sys/kernel/debug/kmemleak
	fi
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
fi

if [ $vimc -eq 1 ]; then
	rmmod vimc 2&>/dev/null
	modprobe vimc
	sleep 1
	dmesg -n notice

	if ! v4l2-ctl -z platform:vimc -d "Sensor A" ; then
		echo "FAIL: the vimc module failed to load" | tee -a $tmp
		echo "Grand Total for vimc: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
		rmmod vivid
		exit 0
	fi

	media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
	media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
	media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
	media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
	v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
	v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
	v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
	dmesg -n notice
	echo
	echo vimc compliance tests
	echo
	date
	stdbuf -oL v4l2-compliance -m platform:vimc -z platform:vivid-002 -e vivid-002-vid-cap -s10 -P -a 2>&1 | tee -a $tmp
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo unbind vimc
	echo
	echo -n vimc.0 >/sys/bus/platform/drivers/vimc/unbind
	sleep $unbind_time
	echo
	echo rebind vimc
	echo
	echo -n vimc.0 >/sys/bus/platform/drivers/vimc/bind
	sleep 1
	media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
	media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
	media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]'
	media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]'
	v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440
	v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
	v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81
	echo
	echo second unbind vimc
	echo
	for i in `v4l2-ctl -z platform:vimc --list-devices`; do
		let "t = 6 + $RANDOM / 4096"
		echo $i: sleep ${t}s
		sleep $t <$i &
	done
	# There are media controller lifetime issues that will cause a crash if this
	# is enabled. Fixing that is quite a major undertaking so for now disable this
	# test.
	#v4l2-ctl -z platform:vimc -d "Raw Capture 0" --stream-mmap --sleep 5 &
	sleep 1
	for i in /sys/bus/platform/drivers/vimc-*; do
		for j in $i/vimc-*; do
			echo unbind ${j##*/} of $i
			echo -n ${j##*/} >$i/unbind
		 done
	done
	sleep 5
	echo
	echo -n vimc.0 >/sys/bus/platform/drivers/vimc/unbind
	sleep $reunbind_time
	echo
	echo rmmod vimc
	echo
	rmmod vimc vimc_scaler vimc_debayer vimc_capture vimc_sensor vimc_streamer vimc_common
	sleep $rmmod_time
	if [ $kmemleak -eq 1 ]; then
		echo
		echo kmemleak results for vimc:
		echo
		echo scan >/sys/kernel/debug/kmemleak
		cat /sys/kernel/debug/kmemleak
		echo
		echo end of kmemleak results
		echo clear >/sys/kernel/debug/kmemleak
		echo
		echo
		echo
		echo
		echo
		echo
		echo
		echo
	fi
fi

if [ $vicodec -eq 1 ]; then
	tmpdir=`mktemp -d`

	rmmod vicodec 2&>/dev/null
	modprobe vicodec
	sleep 2
	dmesg -n notice
	echo

	if ! v4l2-ctl -z platform:vicodec ; then
		echo "FAIL: the vicodec module failed to load" | tee -a $tmp
		echo "Grand Total for vicodec: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp
		echo "Final Summary: 1, Succeeded: 0, Failed: 1, Warnings: 0"
		rmmod vivid
		exit 0
	fi

	echo vicodec media controller compliance tests
	echo
	date
	stdbuf -oL v4l2-compliance -M platform:vicodec 2>&1 | tee -a $tmp

	echo
	echo vicodec encoder compliance tests
	echo
	stdbuf -oL v4l2-compliance -z platform:vicodec -d stateful-encoder-source -z platform:vivid-002 -e vivid-002-vid-cap -s10 -P -a 2>&1 | tee -a $tmp

	echo
	echo vicodec create test files
	echo

	encful_opts='-z platform:vicodec -d stateful-encoder-source --stream-mmap --stream-out-mmap --stream-out-hor-speed=1'
	v4l2-ctl $encful_opts --stream-count=24 --stream-to-hdr=$tmpdir/comp.hdr.yu12.1280.24
	v4l2-ctl $encful_opts --stream-count=24 --stream-to=$tmpdir/comp.yu12.1280.24
	v4l2-ctl $encful_opts --stream-count=1 --stream-to-hdr=$tmpdir/comp.hdr.yu12.1280.1
	v4l2-ctl $encful_opts --stream-count=1 --stream-to=$tmpdir/comp.yu12.1280.1
	v4l2-ctl $encful_opts --stream-count=2 --stream-to-hdr=$tmpdir/comp.hdr.yu12.1280.2
	v4l2-ctl $encful_opts --stream-count=2 --stream-to=$tmpdir/comp.yu12.1280.2
	v4l2-ctl $encful_opts -x width=1920,height=1080 --set-selection-output target=crop,height=1080 --stream-count=24 --stream-to-hdr=$tmpdir/comp.hdr.yu12.1920.24
	v4l2-ctl $encful_opts -x width=1920,height=1080 --set-selection-output target=crop,height=1080 --stream-count=24 --stream-to=$tmpdir/comp.yu12.1920.24
	v4l2-ctl $encful_opts -x width=1920,height=1080 --set-selection-output target=crop,height=1080 --stream-count=1 --stream-to-hdr=$tmpdir/comp.hdr.yu12.1920.1
	v4l2-ctl $encful_opts -x width=1920,height=1080 --set-selection-output target=crop,height=1080 --stream-count=1 --stream-to=$tmpdir/comp.yu12.1920.1
	v4l2-ctl $encful_opts -x width=1920,height=1080 --set-selection-output target=crop,height=1080 --stream-count=2 --stream-to-hdr=$tmpdir/comp.hdr.yu12.1920.2
	v4l2-ctl $encful_opts -x width=1920,height=1080 --set-selection-output target=crop,height=1080 --stream-count=2 --stream-to=$tmpdir/comp.yu12.1920.2

	cat $tmpdir/comp.hdr.yu12.1280.1 $tmpdir/comp.hdr.yu12.1920.1 >$tmpdir/comp.hdr.yu12.mix.2
	cat $tmpdir/comp.yu12.1280.1 $tmpdir/comp.yu12.1920.1 >$tmpdir/comp.yu12.mix.2
	cat $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 $tmpdir/comp.hdr.yu12.mix.2 >$tmpdir/comp.hdr.yu12.mix.2.12
	cat $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 $tmpdir/comp.yu12.mix.2 >$tmpdir/comp.yu12.mix.2.12
	cat $tmpdir/comp.hdr.yu12.1280.2 $tmpdir/comp.hdr.yu12.1920.2 >$tmpdir/comp.hdr.yu12.mix.4
	cat $tmpdir/comp.yu12.1280.2 $tmpdir/comp.yu12.1920.2 >$tmpdir/comp.yu12.mix.4
	cat $tmpdir/comp.hdr.yu12.mix.4 $tmpdir/comp.hdr.yu12.mix.4 $tmpdir/comp.hdr.yu12.mix.4 $tmpdir/comp.hdr.yu12.mix.4 $tmpdir/comp.hdr.yu12.mix.4 $tmpdir/comp.hdr.yu12.mix.4 >$tmpdir/comp.hdr.yu12.mix.4.6
	cat $tmpdir/comp.yu12.mix.4 $tmpdir/comp.yu12.mix.4 $tmpdir/comp.yu12.mix.4 $tmpdir/comp.yu12.mix.4 $tmpdir/comp.yu12.mix.4 $tmpdir/comp.yu12.mix.4 >$tmpdir/comp.yu12.mix.4.6

	echo
	echo vicodec decoder compliance tests
	echo
	decful_opts='-z platform:vicodec -d stateful-decoder-source -z platform:vivid-002 -e vivid-002-vid-cap'
	stdbuf -oL v4l2-compliance $decful_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.1280.24 -s24 -P -a 2>&1 | tee -a $tmp
	stdbuf -oL v4l2-compliance $decful_opts --stream-from $tmpdir/comp.yu12.1280.24 -s24 -P -a 2>&1 | tee -a $tmp
	stdbuf -oL v4l2-compliance $decful_opts --stream-from-hdr $tmpdir/comp.hdr.yu12.mix.4.6 -s24 -P -a 2>&1 | tee -a $tmp
	stdbuf -oL v4l2-compliance $decful_opts --stream-from $tmpdir/comp.yu12.mix.4.6 -s24 -P -a 2>&1 | tee -a $tmp
	stdbuf -oL v4l2-compliance $decful_opts --stream-from-hdr $tmpdir/comp.hdr.yu12.mix.2.12 -s24 -P -a 2>&1 | tee -a $tmp
	stdbuf -oL v4l2-compliance $decful_opts --stream-from $tmpdir/comp.yu12.mix.2.12 -s24 -P -a 2>&1 | tee -a $tmp

	decful_opts='-z platform:vicodec -d stateful-decoder-source --stream-mmap --stream-out-mmap'
	decless_opts='-z platform:vicodec -d stateless-decoder-source --stream-mmap --stream-out-mmap'
	echo
	echo stateful decode
	echo
	v4l2-ctl $decful_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.1280.24 --stream-to=$tmpdir/raw.yu12.1280.24
	echo
	echo stateless decode
	echo
	v4l2-ctl $decless_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.1280.24 --stream-to=$tmpdir/raw.yu12.1280.24.stateless
	cmp $tmpdir/raw.yu12.1280.24 $tmpdir/raw.yu12.1280.24.stateless

	echo
	echo stateful decode with dynamic resolution changes for every frame
	echo
	v4l2-ctl $decful_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.2.12 --stream-to=$tmpdir/raw.yu12.mix.2.12
	# v4l2-ctl does not yet reallocate buffers if they are too small for the new format
	v4l2-ctl $decless_opts -v width=1920,height=1088 --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.2.12 --stream-to=$tmpdir/raw.yu12.mix.2.12.stateless
	cmp $tmpdir/raw.yu12.mix.2.12 $tmpdir/raw.yu12.mix.2.12.stateless

	echo
	echo stateful decode with dynamic resolution changes for every other frame
	echo
	v4l2-ctl $decful_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.4.6 --stream-to=$tmpdir/raw.yu12.mix.4.6
	# v4l2-ctl does not yet reallocate buffers if they are too small for the new format
	v4l2-ctl $decless_opts -v width=1920,height=1088 --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.4.6 --stream-to=$tmpdir/raw.yu12.mix.4.6.stateless
	cmp $tmpdir/raw.yu12.mix.4.6 $tmpdir/raw.yu12.mix.4.6.stateless

	rm -rf $tmpdir
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo unbind vicodec
	echo
	echo -n vicodec.0 >/sys/bus/platform/drivers/vicodec/unbind
	sleep $unbind_time
	echo
	echo rebind vicodec
	echo
	echo -n vicodec.0 >/sys/bus/platform/drivers/vicodec/bind
	sleep 1
	echo
	echo second unbind vicodec
	echo
	for i in `v4l2-ctl -z platform:vicodec --list-devices`; do
		let "t = 1 + $RANDOM / 4096"
		echo $i: sleep ${t}s
		sleep $t <$i &
	done
	sleep 1
	echo
	echo -n vicodec.0 >/sys/bus/platform/drivers/vicodec/unbind
	sleep $reunbind_time
	echo
	echo rmmod vicodec
	echo
	rmmod vicodec
	sleep $rmmod_time
	if [ $kmemleak -eq 1 ]; then
		echo
		echo kmemleak results for vicodec:
		echo
		echo scan >/sys/kernel/debug/kmemleak
		cat /sys/kernel/debug/kmemleak
		echo
		echo end of kmemleak results
		echo clear >/sys/kernel/debug/kmemleak
	fi
	echo
	echo
	echo
	echo
	echo
	echo
	echo
	echo
fi

date
echo
echo unbind vivid
echo
echo -n vivid.0 >/sys/bus/platform/drivers/vivid/unbind
sleep $unbind_time
echo
echo rmmod vivid
echo
rmmod vivid
sleep $rmmod_time

date
echo
echo Summary:
echo

grep 'Total' $tmp | perl -e '
while (<>) {
	if (/Total/) {
		print;
		$added_nl = /^Grand/ || /\/dev\/cec/;
		printf("\n") if $added_nl;
	}
	next unless /^Total/;
	($succeeded, $failed, $warnings) = /Succeeded: (\d+), Failed: (\d+), Warnings: (\d+)/;
	$tot_succeeded += $succeeded;
	$tot_failed += $failed;
	$tot_warnings += $warnings;
}

printf("\n") unless $added_nl;
printf("Final Summary: %d, Succeeded: %d, Failed: %d, Warnings: %d\n",
	$tot_succeeded + $tot_failed, $tot_succeeded, $tot_failed, $tot_warnings);
'

date
rm -f $tmp

if [ $dmesg -eq 1 ]; then
	echo
	echo -----------------------------------------------------------
	echo
	dmesg
fi

dmesg -n $cur_lvl

Privacy Policy