NetBSD Problem Report #52588

From rjs@fdy2.co.uk  Sun Oct  1 17:14:49 2017
Return-Path: <rjs@fdy2.co.uk>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4445C7A219
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  1 Oct 2017 17:14:49 +0000 (UTC)
Message-Id: <20171001160057.92DDB30285C@ren.fdy2.co.uk>
Date: Sun,  1 Oct 2017 17:00:57 +0100 (BST)
From: rjs@fdy2.co.uk
Reply-To: rjs@fdy2.co.uk
To: gnats-bugs@NetBSD.org
Subject: Missing features in video(4)
X-Send-Pr-Version: 3.95

>Number:         52588
>Category:       kern
>Synopsis:       Missing features in video(4)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    jmcneill
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 01 17:15:00 +0000 2017
>Closed-Date:    Sun May 15 11:30:22 +0000 2022
>Last-Modified:  Sun May 15 11:30:22 +0000 2022
>Originator:     Robert Swindells
>Release:        NetBSD 8.99.3
>Organization:
	NetBSD
>Environment:


System: NetBSD ren.fdy2.co.uk 8.99.3 NetBSD 8.99.3 (REN) #14: Sun Oct 1 12:31:44 BST 2017 rjs@ren.fdy2.co.uk:/u1/src/sys/arch/amd64/compile/REN amd64
Architecture: x86_64
Machine: amd64
>Description:

Some ioctl commands and the structures used by them are missing from
the emulation of v4l in NetBSD.


>How-To-Repeat:

Build www/firefox package with webrtc option enabled.

>Fix:

Add support for VIDIOC_ENUM_FRAMESIZES and VIDIOC_ENUM_FRAMEINTERVALS
to the kernel.

The header changes required by Firefox are below:

Index: videoio.h
===================================================================
RCS file: /cvsroot/src/sys/sys/videoio.h,v
retrieving revision 1.9
diff -u -r1.9 videoio.h
--- videoio.h	6 Sep 2015 06:01:02 -0000	1.9
+++ videoio.h	1 Oct 2017 12:21:42 -0000
@@ -117,6 +117,12 @@
 	V4L2_CTRL_TYPE_BUTTON
 };

+enum v4l2_frmsizetypes {
+	V4L2_FRMSIZE_TYPE_DISCRETE = 1,
+	V4L2_FRMSIZE_TYPE_CONTINUOUS,
+	V4L2_FRMSIZE_TYPE_STEPWISE
+};
+
 struct v4l2_timecode {
 	uint32_t	type;
 	uint32_t	flags;
@@ -431,6 +437,50 @@
 	uint32_t	reserved[2];
 };

+struct v4l2_frmsize_discrete {
+	uint32_t	width;
+	uint32_t	height;
+};
+
+struct v4l2_frmsize_stepwise {
+	uint32_t	min_width;
+	uint32_t	max_width;
+	uint32_t	step_width;
+	uint32_t	min_height;
+	uint32_t	max_height;
+	uint32_t	step_height;
+};
+
+struct v4l2_frmsizeenum {
+	uint32_t	index;
+	uint32_t	pixel_format;
+	uint32_t	type;
+	union {
+		struct v4l2_frmsize_discrete discrete;
+		struct v4l2_frmsize_stepwise stepwise;
+	};
+	uint32_t	reserved[2];
+};
+
+struct v4l2_frmival_stepwise {
+	struct v4l2_fract	min;
+	struct v4l2_fract	max;
+	struct v4l2_fract	step;
+};
+
+struct v4l2_frmivalenum {
+	uint32_t	index;
+	uint32_t	pixel_format;
+	uint32_t	width;
+	uint32_t	height;
+	uint32_t	type;
+	union {
+		struct v4l2_fract		discrete;
+		struct v4l2_frmival_stepwise	stepwise;
+	};
+	uint32_t	reserved[2];
+};
+
 /* Timecode types */
 #define V4L2_TC_TYPE_24FPS		1
 #define V4L2_TC_TYPE_25FPS		2
@@ -741,6 +791,8 @@
 #define VIDIOC_ENUMAUDOUT	_IOWR('V', 66, struct v4l2_audioout)
 #define VIDIOC_G_PRIORITY	_IOR('V', 67, enum v4l2_priority)
 #define VIDIOC_S_PRIORITY	_IOW('V', 68, enum v4l2_priority)
+#define VIDIOC_ENUM_FRAMESIZES	_IOWR('V', 74, struct v4l2_frmsizeenum)
+#define VIDIOC_ENUM_FRAMEINTERVALS	_IOWR('V', 75, struct v4l2_frmivalenum)

 #ifdef _KERNEL
 #define VIDIOC_QUERYBUF50	_IOWR('V', 9, struct v4l2_buffer50)

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->jmcneill
Responsible-Changed-By: jmcneill@NetBSD.org
Responsible-Changed-When: Mon, 02 Oct 2017 13:44:11 +0000
Responsible-Changed-Why:
take


State-Changed-From-To: open->closed
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Mon, 02 Oct 2017 13:50:01 +0000
State-Changed-Why:
Patch applied, thanks!


From: "Jared D. McNeill" <jmcneill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52588 CVS commit: src/sys/sys
Date: Mon, 2 Oct 2017 13:47:58 +0000

 Module Name:	src
 Committed By:	jmcneill
 Date:		Mon Oct  2 13:47:58 UTC 2017

 Modified Files:
 	src/sys/sys: videoio.h

 Log Message:
 Add definitions required for VIDIOC_ENUM_FRAMESIZES and
 VIDIOC_ENUM_FRAMEINTERVALS ioctl commands, required to build Firefox's
 webrtc support.

 From Robert Swindells in PR# kern/52588


 To generate a diff of this commit:
 cvs rdiff -u -r1.9 -r1.10 src/sys/sys/videoio.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: closed->open
State-Changed-By: rjs@NetBSD.org
State-Changed-When: Tue, 17 Oct 2017 22:03:19 +0000
State-Changed-Why:
The kernel part of this still needs to be done.


State-Changed-From-To: open->closed
State-Changed-By: jmcneill@NetBSD.org
State-Changed-When: Sun, 15 May 2022 11:30:22 +0000
State-Changed-Why:
Supported in video.c r1.38


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.