Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l2-tpg: add HDMI Video Guard Band test pattern

This inserts 4 pixels of the RGB color 0xab55ab at the left hand side of
the image. This is only done for 3 or 4 byte RGB pixel formats. The HDMI
TMDS encoding of this pixel value equals the Video Guard Band value as
defined by HDMI (see section 5.2.2.1 in the HDMI 1.3 Specification) that
preceeds the first actual pixel of a video line. If an HDMI receiver
doesn't handle this correctly, then it might keep skipping these Video
Guard Band patterns and end up with a shorter video line. So this is a
nice pattern to test with.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
5a531791 691c3db0

+54
+38
drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
··· 2402 2402 ((params->sav_eav_f ^ vact) << 1) | 2403 2403 (hact ^ vact ^ params->sav_eav_f); 2404 2404 } 2405 + if (tpg->insert_hdmi_video_guard_band) { 2406 + unsigned int i; 2407 + 2408 + switch (tpg->fourcc) { 2409 + case V4L2_PIX_FMT_BGR24: 2410 + case V4L2_PIX_FMT_RGB24: 2411 + for (i = 0; i < 3 * 4; i += 3) { 2412 + vbuf[i] = 0xab; 2413 + vbuf[i + 1] = 0x55; 2414 + vbuf[i + 2] = 0xab; 2415 + } 2416 + break; 2417 + case V4L2_PIX_FMT_RGB32: 2418 + case V4L2_PIX_FMT_ARGB32: 2419 + case V4L2_PIX_FMT_XRGB32: 2420 + case V4L2_PIX_FMT_BGRX32: 2421 + case V4L2_PIX_FMT_BGRA32: 2422 + for (i = 0; i < 4 * 4; i += 4) { 2423 + vbuf[i] = 0x00; 2424 + vbuf[i + 1] = 0xab; 2425 + vbuf[i + 2] = 0x55; 2426 + vbuf[i + 3] = 0xab; 2427 + } 2428 + break; 2429 + case V4L2_PIX_FMT_BGR32: 2430 + case V4L2_PIX_FMT_XBGR32: 2431 + case V4L2_PIX_FMT_ABGR32: 2432 + case V4L2_PIX_FMT_RGBX32: 2433 + case V4L2_PIX_FMT_RGBA32: 2434 + for (i = 0; i < 4 * 4; i += 4) { 2435 + vbuf[i] = 0xab; 2436 + vbuf[i + 1] = 0x55; 2437 + vbuf[i + 2] = 0xab; 2438 + vbuf[i + 3] = 0x00; 2439 + } 2440 + break; 2441 + } 2442 + } 2405 2443 } 2406 2444 2407 2445 static void tpg_fill_plane_pattern(const struct tpg_data *tpg,
+16
include/media/tpg/v4l2-tpg.h
··· 210 210 bool show_square; 211 211 bool insert_sav; 212 212 bool insert_eav; 213 + bool insert_hdmi_video_guard_band; 213 214 214 215 /* Test pattern movement */ 215 216 enum tpg_move_mode mv_hor_mode; ··· 590 589 static inline void tpg_s_insert_eav(struct tpg_data *tpg, bool insert_eav) 591 590 { 592 591 tpg->insert_eav = insert_eav; 592 + } 593 + 594 + /* 595 + * This inserts 4 pixels of the RGB color 0xab55ab at the left hand side of the 596 + * image. This is only done for 3 or 4 byte RGB pixel formats. This pixel value 597 + * equals the Video Guard Band value as defined by HDMI (see section 5.2.2.1 598 + * in the HDMI 1.3 Specification) that preceeds the first actual pixel. If the 599 + * HDMI receiver doesn't handle this correctly, then it might keep skipping 600 + * these Video Guard Band patterns and end up with a shorter video line. So this 601 + * is a nice pattern to test with. 602 + */ 603 + static inline void tpg_s_insert_hdmi_video_guard_band(struct tpg_data *tpg, 604 + bool insert_hdmi_video_guard_band) 605 + { 606 + tpg->insert_hdmi_video_guard_band = insert_hdmi_video_guard_band; 593 607 } 594 608 595 609 void tpg_update_mv_step(struct tpg_data *tpg);