• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Linux Kernel and Multimedia
 

Linux Kernel and Multimedia

on

  • 333 views

Linux Kernel Multmedia Subsystem maintainer and Samsung OSG team member Mauro Chehab talks about how the multimedia subsystem is architected and contributed to in the Linux Kernel.

Linux Kernel Multmedia Subsystem maintainer and Samsung OSG team member Mauro Chehab talks about how the multimedia subsystem is architected and contributed to in the Linux Kernel.

Statistics

Views

Total Views
333
Views on SlideShare
333
Embed Views
0

Actions

Likes
1
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Linux Kernel and Multimedia Linux Kernel and Multimedia Presentation Transcript

    • Linux Kernel and Multimídia Mauro Carvalho Chehab Linux Kernel Maintainer of the Media Subsystem Linux Kernel Expert Samsung Open Source Group Aug 17, 2013 Open Source Group – Silicon Valley Not to be used for commercial purpose without getting permission All information, opinions and ideas herein are exclusively the author's own opinion © 2013 SAMSUNG Electronics Co.
    • Linux is Everywhere 2 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • The Linux Kernel Devel Model ● Kernel is the core of the operational system that runs a Linux system ● Its development is dictated by the community, not by someone or some company – If someone (and/or their company) wants a feature, submit a patch ● ● The community reviews the patch. If community is happy, it gets merged The development community is huge and open – – ● All discussions are via mailing lists (generally hosted at vger.kernel.org); IRC (and physical meetings) help to get agreements on more polemic items A new Linux Kernel version is released on every ~2 months – – ● ● After a new release, 2 weeks are used to merge the features for the next one. This period of time is called: “merge window”; A variable period (typically 8 weeks) is used to review the code. After each week, a new release candidate is released (so, about 7 rc's and a final version). Contributions are open to everyone, and patches are publicly reviewed Subsystem maintainers are responsible to collect the accepted patches, do a final review and submit them to Linus Torvards (the creator of Linux). 3 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Development model of the Kernel 4 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Some devel stats on Kernel 3.10 Most active 3.10 developers By changesets By changed lines H Hartley Sweeten 392 2.9% Joe Perches 34561 Jingoo Han 299 2.2% Hans Verkuil 18739 Hans Verkuil 293 2.2% Kent Overstreet 18690 Alex Elder 268 2.0% Larry Finger 17222 Al Viro 205 1.5% Greg Kroah-Hartman 16610 Felipe Balbi 202 1.5% Shawn Guo 12879 Sachin Kamat 192 1.4% Dave Chinner 12838 Laurent Pinchart 174 1.3% Paul Zimmerman 12637 Johan Hovold 159 1.2% H Hartley Sweeten 12518 Mauro Carvalho Chehab 158 1.2% Al Viro 11116 Wei Y ongjun 139 1.0% Andrey Smirnov 11107 Arnd Bergmann 138 1.0% Mauro Carvalho Chehab 9726 Eduardo Valentin 138 1.0% Laurent Pinchart 9258 Axel Lin 112 0.8% Jussi Kivilinna 8960 Lee Jones 111 0.8% Lee Jones 8598 Lars-Peter Clausen 99 0.7% Sylwester Nawrocki 8305 Kuninori Morimoto 98 0.7% Artem Bityutskiy 8094 T ejun Heo 97 0.7% Dave Airlie 7546 Mark Brown 97 0.7% Guenter Roeck 7510 Johannes Berg 96 0.7% Sanjay Lal 7428 Total of 1,374 developers and 13.500 changesets In blue: media developers 5 Open Source Group – Silicon Valley 4.5% 2.4% 2.4% 2.2% 2.2% 1.7% 1.7% 1.6% 1.6% 1.4% 1.4% 1.3% 1.2% 1.2% 1.1% 1.1% 1.0% 1.0% 1.0% 1.0% source: http://lwn.net/Articles/555867/ © 2013 SAMSUNG Electronics Co.
    • How to start contributing ● RTFM: there are several documents inside the Kernel source explaining the proccess: – /Documentation/HOWTO ● – /Documentation/CodingStyle ● – Main view for new developers Describes the coding style used by the Linux Kernel /Documentation/SubmittingPathes e SubmittingDrivers ● General procedures for submittins patches/drivers – It should be noticed that each subsystem may have additional rules – – ● /MAINTAINERS: Show the subsystem maintainers, driver maintainer and mailing lists that should be used to send patches There are two scripts that help to: – Check the coding style (checkpatch.pl) – Check to whom a patch should be sent (get_maintainer.pl) 6 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Kernel API's for media devices ● Video4Linux API (version 2) – – ● For video inputs/outputs and radio, video and analog TV device control Extending it for Software Digital Radio is currently being discussed DVB API (version 5) – ● Remote Controller / Input evdev APIs – ● For Remote Controllers and webcam/grabber buttons The Advanced Linux Sound Architecture (ALSA) – ● For digital TV inputs For audio inputs, outputs, mixers (and sequencers) Media Controller API – To control complex devices with configurable pipelines – Used only on embeeded devices and on UVC (USB Video Class) – Subdev API ● To control each single logical element on complex devices 7 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Example of a new patch Patch summary: Subject: uvc: more buffers Date: Fri, 09 Aug 2013 12:11:36 -0000 main author From: Oliver Neukum <oneukum@suse.de> To: laurent.pinchart@ideasonboard.com , linux-media@vger.kernel.org Driver maintainer This is necessary to let the new generation of cameras from LiteOn used in Haswell ULT notebook operate. Otherwise the images will be truncated. Signed-off-by: Oliver Neukum <oneukum@suse.de> what it does Mailing List of the subsystem Patch description: why it is needed and how was done diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 9e35982..9f1930b 100644 --- a/drivers/media/usb/uvc/uvcvideo.h Patch custodity chain +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -114,9 +114,9 @@ confirming that the pach /* Number of isochronous URBs. */ is GPL plus acks, reviews, #define UVC_URBS 5 Tests, etc. /* Maximum number of packets per URB. */ -#define UVC_MAX_PACKETS 32 +#define UVC_MAX_PACKETS 128 /* Maximum number of video buffers. */ -#define UVC_MAX_VIDEO_BUFFERS 32 Unified diff of +#define UVC_MAX_VIDEO_BUFFERS 128 the changes /* Maximum status buffer size in bytes of interrupt URB. */ #define UVC_MAX_STATUS_SIZE 16 Source:https://patchwork.linuxtv.org/patch/19656/ 9 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Steps for writing/submitting (1) ● 1) Get a copy of the latest development tree: – http://git.linuxtv.org/media_tree.git (for a media patch) ● 2) Write and test the changes ● 3) generate the patch $ git commit -a – write a proper summary, descriptions and add your SOB $ git show > my_changes.patch ● 3) Check if CodingStyle was not violated or if it doesn't have some common mistakes: $ ./script/checkpatch.pl my_changes.patch – ● Fix patch until checkpatch.pl is happy and test it again 4) Send it to the maintainers – Use get_maintainers.pl to know to whom address the email $ ./script/get_maintainers.pl my_changes.patch 10 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Steps for writing/submitting (2) $ ./scripts/get_maintainer.pl /tmp/uvc-more-buffers.patch Laurent Pinchart <laurent.pinchart@ideasonboard.com> (maintainer:USB VIDEO CLASS) Mauro Carvalho Chehab <m.chehab@samsung.com> (maintainer:MEDIA INPUT INFRA...) linux-media@vger.kernel.org (open list:USB VIDEO CLASS) linux-kernel@vger.kernel.org (open list) ● In the specific case of media drivers, don't c/c the maintainer. If everything is ok in the patch, it will appear in a few at patchwork: – ● ● https://patchwork.linuxtv.org/project/linux-media/list/ Also, in general, don't copy LKML (linux-kernel). That's the last resort when there's no specific subsystem mailing list. Stuff not maintained and without any subsystem maintainer should be submitted to Andrew Morton <akpm@linux-foundation.org>. 11 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Now, what happens? ● Wait for people to review it. It may take some time, as Kernel developers are generally busy with other stuff – Everybody can review a patch, including you. ● If you find a problem, write an email describing what you noticed. ● If you tested the patch, reply to it with Tested-by: you <your.email> ● If you reviewed the patch but didn't test, reply to it with Reviewed-by: you <your.email> ● – ● Driver/system maintainers can also reply with Acked-by if they're ok if someone else would review and apply that patch. A patch with reviews/tests will likely flow quicker than one that would depend solely on the driver maintainer to test The driver maintainer will get your patch, test or review and either apply or ask someone else to apply it; ● The patch will be applied by a sub-maintainer or by a subsystem maintainer; ● The subsystem maintainer will send it to Linus on the next merge window. 12 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Some literature ● You should read: – ● The pertinent docs at Kernel source tree, under Documentation/ directory Some books for starting working on Kernel: – Corbet, J; Rubini, A; Kroah-Hartman, Greg, Linux Device Drivers, 3rd edition, O'Reilly, 2005 There's an online version: http://lwn.net/Kernel/LDD3/ Love, Robert, Linux Kernel Development, 3rd edition, Addison-Wesley, 2010 – – – Daniel P. Bovet, Marco Cesati, Understanding the Linux Kernel, 3rd edition, O'Reilly, 2005 – Venkateswaran, Sreekrishnan, Essential Linux Device Drivers, Prentice Hall, 2008 – Web useful resources: ● http://kernelnewbies.org/ ● http://lwn.net – V4L2 articles: ● http://lwn.net/Articles/203924/ 13 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • References on media drivers ● How to get and test the latest drivers: – ● See http://git.linuxtv.org/media_build.git Userspace tools: – Remote controller/V4L/DVD: http://git.linuxtv.org/v4l-utils.git ● Wiki pages: http://linuxtv.org/wiki/ ● Mailing list: linux-media@vger.kernel.org ● IRC channel: irc.freenode.net – channels #v4l and #linuxtv – Can be assessed via http://webchat.freenode.net/ 14 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.
    • Thank you. 15 Open Source Group – Silicon Valley © 2013 SAMSUNG Electronics Co.