linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Subject: [PATCH 3.14 43/76] [media] bttv: Width must be a multiple of 16 when capturing planar formats
Date: Sun, 10 Apr 2016 11:36:51 -0700	[thread overview]
Message-ID: <20160410183517.634371150@linuxfoundation.org> (raw)
In-Reply-To: <20160410183516.090999097@linuxfoundation.org>

3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hans de Goede <hdegoede@redhat.com>

commit 5c915c68763889f0183a1cc61c84bb228b60124a upstream.

On my bttv card "Hauppauge WinTV [card=10]" capturing in YV12 fmt at max
size results in a solid green rectangle being captured (all colors 0 in
YUV).

This turns out to be caused by max-width (924) not being a multiple of 16.

We've likely never hit this problem before since normally xawtv / tvtime,
etc. will prefer packed pixel formats. But when using a video card which
is using xf86-video-modesetting + glamor, only planar XVideo fmts are
available, and xawtv will chose a matching capture format to avoid needing
to do conversion, triggering the solid green window problem.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/pci/bt8xx/bttv-driver.c |   26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -2333,6 +2333,19 @@ static int bttv_g_fmt_vid_overlay(struct
 	return 0;
 }
 
+static void bttv_get_width_mask_vid_cap(const struct bttv_format *fmt,
+					unsigned int *width_mask,
+					unsigned int *width_bias)
+{
+	if (fmt->flags & FORMAT_FLAGS_PLANAR) {
+		*width_mask = ~15; /* width must be a multiple of 16 pixels */
+		*width_bias = 8;   /* nearest */
+	} else {
+		*width_mask = ~3; /* width must be a multiple of 4 pixels */
+		*width_bias = 2;  /* nearest */
+	}
+}
+
 static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
 						struct v4l2_format *f)
 {
@@ -2342,6 +2355,7 @@ static int bttv_try_fmt_vid_cap(struct f
 	enum v4l2_field field;
 	__s32 width, height;
 	__s32 height2;
+	unsigned int width_mask, width_bias;
 	int rc;
 
 	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
@@ -2374,9 +2388,9 @@ static int bttv_try_fmt_vid_cap(struct f
 	width = f->fmt.pix.width;
 	height = f->fmt.pix.height;
 
+	bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias);
 	rc = limit_scaled_size_lock(fh, &width, &height, field,
-			       /* width_mask: 4 pixels */ ~3,
-			       /* width_bias: nearest */ 2,
+			       width_mask, width_bias,
 			       /* adjust_size */ 1,
 			       /* adjust_crop */ 0);
 	if (0 != rc)
@@ -2409,6 +2423,7 @@ static int bttv_s_fmt_vid_cap(struct fil
 	struct bttv_fh *fh = priv;
 	struct bttv *btv = fh->btv;
 	__s32 width, height;
+	unsigned int width_mask, width_bias;
 	enum v4l2_field field;
 
 	retval = bttv_switch_type(fh, f->type);
@@ -2423,9 +2438,10 @@ static int bttv_s_fmt_vid_cap(struct fil
 	height = f->fmt.pix.height;
 	field = f->fmt.pix.field;
 
+	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
+	bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias);
 	retval = limit_scaled_size_lock(fh, &width, &height, f->fmt.pix.field,
-			       /* width_mask: 4 pixels */ ~3,
-			       /* width_bias: nearest */ 2,
+			       width_mask, width_bias,
 			       /* adjust_size */ 1,
 			       /* adjust_crop */ 1);
 	if (0 != retval)
@@ -2433,8 +2449,6 @@ static int bttv_s_fmt_vid_cap(struct fil
 
 	f->fmt.pix.field = field;
 
-	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
-
 	/* update our state informations */
 	fh->fmt              = fmt;
 	fh->cap.field        = f->fmt.pix.field;

  parent reply	other threads:[~2016-04-10 19:19 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-10 18:36 [PATCH 3.14 00/76] 3.14.66-stable review Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 01/76] target: Drop incorrect ABORT_TASK put for completed commands Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 02/76] USB: serial: add Google simple serial SubClass support Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 04/76] KVM: fix spin_lock_init order on x86 Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 05/76] KVM: VMX: avoid guest hang on invalid invept instruction Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 06/76] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 07/76] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 08/76] x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt() Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 09/76] x86/iopl: Fix iopl capability check on Xen PV Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 10/76] sg: fix dxferp in from_to case Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 11/76] aacraid: Fix memory leak in aac_fib_map_free Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 12/76] be2iscsi: set the boot_kset pointer to NULL in case of failure Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 13/76] usb: retry reset if a device times out Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 14/76] usb: hub: fix a typo in hub_port_init() leading to wrong logic Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 15/76] USB: uas: Reduce can_queue to MAX_CMNDS Greg Kroah-Hartman
2016-04-11 11:52   ` Jiri Slaby
2016-04-12 14:14     ` Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 16/76] USB: cdc-acm: more sanity checking Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 17/76] USB: iowarrior: fix oops with malicious USB descriptors Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 18/76] USB: usb_driver_claim_interface: add sanity checking Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 19/76] USB: mct_u232: add sanity checking in probe Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 20/76] USB: digi_acceleport: do sanity checking for the number of ports Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 21/76] USB: cypress_m8: add endpoint sanity check Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 22/76] USB: serial: cp210x: Adding GE Healthcare Device ID Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 23/76] USB: serial: ftdi_sio: Add support for ICP DAS I-756xU devices Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 25/76] [media] pwc: Add USB id for Philips Spc880nc webcam Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 26/76] Input: powermate - fix oops with malicious USB descriptors Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 27/76] ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk() Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 28/76] ALSA: usb-audio: Add sanity checks for endpoint accesses Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 29/76] ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk() Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 30/76] ALSA: usb-audio: Fix double-free in error paths after snd_usb_add_audio_stream() call Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 31/76] Bluetooth: btusb: Add new AR3012 ID 13d3:3395 Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 32/76] Bluetooth: btusb: Add a new AR3012 ID 04ca:3014 Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 33/76] Bluetooth: btusb: Add a new AR3012 ID 13d3:3472 Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 34/76] crypto: ccp - Add hash state import and export support Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 35/76] crypto: ccp - Limit the amount of information exported Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 36/76] crypto: ccp - Dont assume export/import areas are aligned Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 37/76] crypto: ccp - memset request context to zero during import Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 38/76] HID: logitech: fix Dual Action gamepad support Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 39/76] net: irda: Fix use-after-free in irtty_open() Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 40/76] 8250: use callbacks to access UART_DLL/UART_DLM Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 41/76] [media] saa7134: Fix bytesperline not being set correctly for planar formats Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 42/76] [media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect Greg Kroah-Hartman
2016-04-10 18:36 ` Greg Kroah-Hartman [this message]
2016-04-10 18:36 ` [PATCH 3.14 44/76] [media] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 45/76] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41 Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 46/76] ALSA: hda - Fix unconditional GPIO toggle via automute Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 47/76] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 48/76] bcache: fix cache_set_flush() NULL pointer dereference on OOM Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 49/76] watchdog: rc32434_wdt: fix ioctl error handling Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 50/76] Bluetooth: Add new AR3012 ID 0489:e095 Greg Kroah-Hartman
2016-04-10 18:36 ` [PATCH 3.14 51/76] splice: handle zero nr_pages in splice_to_pipe() Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 52/76] xtensa: ISS: dont hang if stdin EOF is reached Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 53/76] xtensa: clear all DBREAKC registers on start Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 54/76] xfs: fix two memory leaks in xfs_attr_list.c error paths Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 55/76] md/raid5: Compare apples to apples (or sectors to sectors) Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 56/76] md: multipath: dont hardcopy bio in .make_request path Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 57/76] fs/coredump: prevent fsuid=0 dumps into user-controlled directories Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 58/76] rapidio/rionet: fix deadlock on SMP Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 59/76] ipr: Fix out-of-bounds null overwrite Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 60/76] ipr: Fix regression when loading firmware Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 61/76] drm/radeon: Dont drop DP 2.7 Ghz link setup on some cards Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 62/76] tracing: Have preempt(irqs)off trace preempt disabled functions Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 63/76] tracing: Fix crash from reading trace_pipe with sendfile Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 64/76] tracing: Fix trace_printk() to print when not using bprintk() Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 65/76] bitops: Do not default to __clear_bit() for __clear_bit_unlock() Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 66/76] scripts/coccinelle: modernize & Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 67/76] kbuild/mkspec: fix grub2 installkernel issue Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 68/76] target: Fix target_release_cmd_kref shutdown comp leak Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 69/76] Input: ims-pcu - sanity check against missing interfaces Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 70/76] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 71/76] ocfs2/dlm: fix race between convert and recovery Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 72/76] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 73/76] mtd: onenand: fix deadlock in onenand_block_markbad Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 74/76] sched/cputime: Fix steal time accounting vs. CPU hotplug Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 75/76] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2 Greg Kroah-Hartman
2016-04-11  7:01   ` Jiri Slaby
2016-04-12 14:14     ` Greg Kroah-Hartman
2016-04-10 18:37 ` [PATCH 3.14 76/76] perf/x86/intel: Fix PEBS data source interpretation on Nehalem/Westmere Greg Kroah-Hartman
2016-04-10 20:01 ` [PATCH 3.14 00/76] 3.14.66-stable review Guenter Roeck
2016-04-10 20:38   ` Greg Kroah-Hartman
2016-04-11  3:14 ` Guenter Roeck
2016-04-12 14:14   ` Greg Kroah-Hartman
2016-04-11 17:27 ` shuahkh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160410183517.634371150@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=hans.verkuil@cisco.com \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).