SlideShare a Scribd company logo
Samsung Open Source Group © SAMSUNG Electronics Co.1
Media Resource Sharing Through
The Media Controller API
Korea Linux Forum, October 26th
2015
Shuah Khan
Samsung Open Source Group
shuahkh@osg.samsung.com
Samsung Open Source Group © SAMSUNG Electronics Co.2
Abstract
Media devices have hardware resources that are shared across several
functions. However, media drivers have no knowledge of which resources are
shared. For example, accessing DVB and ALSA at the same time, or the DVB
and V4L analog video at the same time results in video and audio stream
errors.
At the root of this problem is a lack of a common locking mechanism that can
provide access control. As a result, it is necessary to create a locking
construct at the master device level for all drivers that share a device to
facilitate resource sharing. A common managed media device created at the
parent USB device level can function as this locking construct.
In this talk, Shuah will discuss the Managed Media Controller API and how
ALSA and au0828 use it to share media resources. In addition, she will show
how media-ctl/mc_nextgen_test tool can be used to generate media graphs
for a media device.
Samsung Open Source Group © SAMSUNG Electronics Co.3
Agenda ...
● Media Devices
●
Media vs. Multi-function Devices
● Shared Media Functions Nicely - Challenges
● Exclusive Access Use-cases
● About Win-TV HVR 950Q
● Media Controller API
● Managed Media Controller API
● HVR 950Q Drivers with Managed Media Device
● HVR 950Q Device Media Graphs
● HVR 950Q Drivers Sharing Resources
Samsung Open Source Group © SAMSUNG Electronics Co.4
Media Devices ...
Hauppauge Win TV HVR 950Q
Hybrid USB TV Stick
Kworld UB435-Q V3
Hauppauge 80e PCTV HD Mini Stick
Samsung Open Source Group © SAMSUNG Electronics Co.5
Media vs. Multi-function
Devices ...
● A group of independent
devices.
● Each device implements
a function.
● Sharing is not limited to
attach point.
● A single device.
● MFD framework helps
identify functions as
discrete platform
devices.
● Sharing is limited to
attach point – sub-
devices attached to a
shared bus.
Samsung Open Source Group © SAMSUNG Electronics Co.6
Media vs. Multi-function
Devices ...
● Functions can be shared.
● Media drivers have to
coordinate sharing.
● Fine grain locking.
● Leverage non-media drivers.
e.g: snd-usb-audio for audio
function.
● Each function is independent.
● Drivers don't need to
coordinate sharing.
● Fine grain locking.
Samsung Open Source Group © SAMSUNG Electronics Co.7
Sharing Media Functions
Nicely - Challenges ...
● Drivers are unaware of shared resources.
● Drivers don't have a way to ensure exclusive access to
shared resource/function.
– e.g: Starting Digital application disrupts Video streaming.
● Drivers can access/change modes while resource is in
use by another.
● Existing fine grain locks don't ensure exclusive access.
● Existing locks are local to function drivers. No global
locks that span all drivers.
Samsung Open Source Group © SAMSUNG Electronics Co.8
Exclusive Access Use-cases ...
● Starting Digital application ...
– should not disrupt active Video and Audio streams.
● Starting Video application ...
– should not disrupt active Digital and Audio streams.
● Starting Audio application …
– should not disrupt Video and Digital streams.
● Querying current configuration (read only access)
should work.
Samsung Open Source Group © SAMSUNG Electronics Co.9
About Win-TV HVR 950Q ...
Hardware:
– USB bus – attach point
– Tuner on I2C bus
– Audio Processor
– Decoder
– Video
– Digital
– No Radio
– IR receiver (No transmitter)
Samsung Open Source Group © SAMSUNG Electronics Co.10
About Win-TV HVR 950Q ...
Drivers:
– au0828 usb driver
– au0828 dvb extension
– au0828 analog (v4l2) extension
– i2c Hauppauge eeprom decoder driver
– Xceive xc5000 silicon tuner driver
– snd-usb-audio
Samsung Open Source Group © SAMSUNG Electronics Co.11
About Win-TV HVR 950Q ...
Device/Driver view:
USB Device
struct usb_device
USB Device Parent
struct device
Au0828 USB driver
struct au0828_dev
Snd-usb-audio
Au0828 DVB
Au0828 Video
Shared USB Interface
Au8522 Decoder
Xc5000 tuner
Samsung Open Source Group © SAMSUNG Electronics Co.12
Shared Resource Exclusive
Locking ...
Samsung Open Source Group © SAMSUNG Electronics Co.13
Media Controller API ...
● Relational media graph framework
● Media functions/resources represented as
nodes on a graph
● Media Device serves as the root node
● Allows creating links between nodes
● Allows active/inactive links between nodes
● Allows start/stop pipelines between nodes
Samsung Open Source Group © SAMSUNG Electronics Co.14
Managed Media Controller API ...
Media Device as a device resource
● media_device_get_devres()
● media_device_find_devres()
Samsung Open Source Group © SAMSUNG Electronics Co.15
Managed Media Controller API ...
Allows au0828 and snd-usb-audio share media
device
● Media Device is a managed device resource at
the parent USB device.
● Media Device is the root node for the shared
media graph.
● Media Device gets created by either au0828 or
snd-usb-audio – first one to run probe wins.
Samsung Open Source Group © SAMSUNG Electronics Co.16
HVR 950Q drivers with Managed
Media Device ...
Device/Driver view:
USB Device
struct usb_device
USB Device Parent
struct device
Au0828 USB driver
struct au0828_dev
Snd-usb-audio
Au0828 DVB
Au0828 Video
Shared USB Interface
Managed Media
Device on
USB Device Parent
struct device
Shared Media Device
Au8522 Decoder
Xc5000 tuner
Samsung Open Source Group © SAMSUNG Electronics Co.17
Media Controller Entity Notify
API ...
● media_device_register_entity_notify()
● media_device_unregister_entity_notify()
● Enables drivers to register callbacks to take
action as entities get added by other drivers.
Samsung Open Source Group © SAMSUNG Electronics Co.18
Shared Media Graph Creation ...
● Drivers (au0828, and snd-usb-audio) add
entities for their functions.
● Bridge driver (au0828) creates links between
entities via entity_notify API.
Samsung Open Source Group © SAMSUNG Electronics Co.19
HVR 950Q Media Graph ...
Samsung Open Source Group © SAMSUNG Electronics Co.20
Media Controller Enable/Disable
Source handlers ...
● Media Device - enable/disable source handlers.
● Enable source grants access to shared
resource or returns -EBUSY.
● Disable source marks shared resource free.
● Bridge drivers (e.g au0828) implement and
register enable/disable source handlers to
manage access to shared resources.
Samsung Open Source Group © SAMSUNG Electronics Co.21
Audio owns tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.22
Audio releases tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.23
Video owns tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.24
Video releases tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.25
Digital owns tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.26
Digital releases tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.27
Audio owns tuner – Digital
start/stop ...
Samsung Open Source Group © SAMSUNG Electronics Co.28
Audio owns tuner – Video
start/stop ...
Samsung Open Source Group © SAMSUNG Electronics Co.29
Video owns tuner – Audio
start/stop ...
Samsung Open Source Group © SAMSUNG Electronics Co.30
Video owns tuner – Digital
start/stop ...
Samsung Open Source Group © SAMSUNG Electronics Co.31
Digital owns tuner – Audio
start/stop ...
Samsung Open Source Group © SAMSUNG Electronics Co.32
Digital owns tuner – Video
start/stop ...
Samsung Open Source Group © SAMSUNG Electronics Co.33
tvtime owns tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.34
tvtime releases tuner ...
Samsung Open Source Group © SAMSUNG Electronics Co.35
After v4l2-ctl –all run ...
Samsung Open Source Group © SAMSUNG Electronics Co.36
mc_nextgen_test tool ...
Usage: mc_nextgen_test [OPTION...]
A testing tool for the MC next geneneration API
-d, --device=DEVICE media controller device (default: /dev/media0
-D, --dot show in Graphviz format
-e, --entities show entities
-i, --interfaces show pads
-I, --intf-links show interface links
-l, --data-links show data links
-?, --help Give this help list
--usage Give a short usage message
-V, --version Print program version
Samsung Open Source Group © SAMSUNG Electronics Co.37
Links to patches ...
● Update ALSA, and au0828 drivers to use Managed
Media Controller API – patch series links:
– https://www.mail-archive.com/linux-media@vger.kernel
.org/msg92752.html
● Mixer and Control Interface support
– https://www.mail-archive.com/linux-media@vger.kernel
.org/msg93084.html
● mc_nextgen_test tool patch to add ALSA entity
support
– https://www.mail-archive.com/linux-media@vger.kernel
.org/msg93086.html
Samsung Open Source Group © SAMSUNG Electronics Co.38
Links to media graphs ...
● Media graphs generated using
mc_nextgen_test tool at various points during
testing at
– https://drive.google.com/open?id=0B0NIL0BQg-
AlLWE3SzAxazBJWm8
Samsung Open Source Group © SAMSUNG Electronics Co.39
Questions ?
Samsung Open Source Group © SAMSUNG Electronics Co.40
Thank You!
Samsung Open Source Group © SAMSUNG Electronics Co.41
About Kworld ATSC TV Stick ...
● Hardware:
– USB bus – attach point
– Tuner on I2C bus
– Digital TV
– Audio
● Drivers:
– em28xx usb driver
– em28xx dvb extension
– dvb frontend adapter: demux, dvr, net
– tda18212

More Related Content

Similar to Media Resource Sharing Through the Media Controller API

Droidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyDroidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyBenjamin Zores
 
Ubuntu Core 技术详解
Ubuntu Core 技术详解Ubuntu Core 技术详解
Ubuntu Core 技术详解
Rex Tsai
 
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans VerkuilKernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Anne Nicolas
 
ELCE 2010 - State Of Multimedia In 2010 Embedded Linux Devices
ELCE 2010 - State Of Multimedia In 2010 Embedded Linux DevicesELCE 2010 - State Of Multimedia In 2010 Embedded Linux Devices
ELCE 2010 - State Of Multimedia In 2010 Embedded Linux DevicesBenjamin Zores
 
Mobile apps on the big screen
Mobile apps on the big screenMobile apps on the big screen
Mobile apps on the big screenHeinrich Seeger
 
Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment
a8us
 
Building Digital TV Support in Linux
Building Digital TV Support in LinuxBuilding Digital TV Support in Linux
Building Digital TV Support in Linux
Samsung Open Source Group
 
Movi presentation Singapore video tech meetup
Movi presentation Singapore video tech meetupMovi presentation Singapore video tech meetup
Movi presentation Singapore video tech meetup
Lars-Erik M Ravn
 
Droidcon 2013 france - The Growth of Android in Embedded Systems
Droidcon 2013 france - The Growth of Android in Embedded SystemsDroidcon 2013 france - The Growth of Android in Embedded Systems
Droidcon 2013 france - The Growth of Android in Embedded Systems
Benjamin Zores
 
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
Neil Armstrong
 
Userspace drivers-2016
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016
Chris Simmonds
 
DAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generationDAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generation
Infineon4Engineers
 
Android Operating System
Android Operating System Android Operating System
Android Operating System
Sunil Maurya
 
Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012
Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012
Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012
Ryo Jin
 
Changyun Wang Under the Supervision of Dr.Turner
Changyun Wang Under the Supervision of Dr.TurnerChangyun Wang Under the Supervision of Dr.Turner
Changyun Wang Under the Supervision of Dr.TurnerVideoguy
 
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
INFOGAIN PUBLICATION
 
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
INFOGAIN PUBLICATION
 

Similar to Media Resource Sharing Through the Media Controller API (20)

Droidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform AnatomyDroidcon 2013 France - Android Platform Anatomy
Droidcon 2013 France - Android Platform Anatomy
 
Ubuntu Core 技术详解
Ubuntu Core 技术详解Ubuntu Core 技术详解
Ubuntu Core 技术详解
 
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans VerkuilKernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
Kernel Recipes 2017 - HDMI CEC: Status Report - Hans Verkuil
 
ELCE 2010 - State Of Multimedia In 2010 Embedded Linux Devices
ELCE 2010 - State Of Multimedia In 2010 Embedded Linux DevicesELCE 2010 - State Of Multimedia In 2010 Embedded Linux Devices
ELCE 2010 - State Of Multimedia In 2010 Embedded Linux Devices
 
Mobile apps on the big screen
Mobile apps on the big screenMobile apps on the big screen
Mobile apps on the big screen
 
Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment
 
Building Digital TV Support in Linux
Building Digital TV Support in LinuxBuilding Digital TV Support in Linux
Building Digital TV Support in Linux
 
Mktech
MktechMktech
Mktech
 
Movi presentation Singapore video tech meetup
Movi presentation Singapore video tech meetupMovi presentation Singapore video tech meetup
Movi presentation Singapore video tech meetup
 
Droidcon 2013 france - The Growth of Android in Embedded Systems
Droidcon 2013 france - The Growth of Android in Embedded SystemsDroidcon 2013 france - The Growth of Android in Embedded Systems
Droidcon 2013 france - The Growth of Android in Embedded Systems
 
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
Elc Europe 2020 : u-boot- porting and maintaining a bootloader for a multimed...
 
Userspace drivers-2016
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016
 
DAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generationDAVE: Free development platform for XMC code generation
DAVE: Free development platform for XMC code generation
 
Mktech
MktechMktech
Mktech
 
Android Operating System
Android Operating System Android Operating System
Android Operating System
 
Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012
Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012
Tizen IVI - Rusty Lynch (Intel) - Korea Linux Forum 2012
 
Changyun Wang Under the Supervision of Dr.Turner
Changyun Wang Under the Supervision of Dr.TurnerChangyun Wang Under the Supervision of Dr.Turner
Changyun Wang Under the Supervision of Dr.Turner
 
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
 
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
Optimizing the Audio Decoding Based Upon Hardware Capability: An Android NUPl...
 
Mktech
MktechMktech
Mktech
 

More from Samsung Open Source Group

The Complex IoT Equation (and FLOSS solutions)
The Complex IoT Equation (and FLOSS solutions)The Complex IoT Equation (and FLOSS solutions)
The Complex IoT Equation (and FLOSS solutions)
Samsung Open Source Group
 
Easy IoT with JavaScript
Easy IoT with JavaScriptEasy IoT with JavaScript
Easy IoT with JavaScript
Samsung Open Source Group
 
Spawny: A New Approach to Logins
Spawny: A New Approach to LoginsSpawny: A New Approach to Logins
Spawny: A New Approach to Logins
Samsung Open Source Group
 
Rapid SPi Device Driver Development over USB
Rapid SPi Device Driver Development over USBRapid SPi Device Driver Development over USB
Rapid SPi Device Driver Development over USB
Samsung Open Source Group
 
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT DevicesTizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Samsung Open Source Group
 
IoTivity: Smart Home to Automotive and Beyond
IoTivity: Smart Home to Automotive and BeyondIoTivity: Smart Home to Automotive and Beyond
IoTivity: Smart Home to Automotive and Beyond
Samsung Open Source Group
 
IoTivity for Automotive: meta-ocf-automotive tutorial
IoTivity for Automotive: meta-ocf-automotive tutorialIoTivity for Automotive: meta-ocf-automotive tutorial
IoTivity for Automotive: meta-ocf-automotive tutorial
Samsung Open Source Group
 
GENIVI + OCF Cooperation
GENIVI + OCF CooperationGENIVI + OCF Cooperation
GENIVI + OCF Cooperation
Samsung Open Source Group
 
Framework for IoT Interoperability
Framework for IoT InteroperabilityFramework for IoT Interoperability
Framework for IoT Interoperability
Samsung Open Source Group
 
Open Source Metrics to Inform Corporate Strategy
Open Source Metrics to Inform Corporate StrategyOpen Source Metrics to Inform Corporate Strategy
Open Source Metrics to Inform Corporate Strategy
Samsung Open Source Group
 
IoTivity for Automotive IoT Interoperability
IoTivity for Automotive IoT InteroperabilityIoTivity for Automotive IoT Interoperability
IoTivity for Automotive IoT Interoperability
Samsung Open Source Group
 
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...
Samsung Open Source Group
 
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux DeviceAdding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Samsung Open Source Group
 
IoTivity: From Devices to the Cloud
IoTivity: From Devices to the CloudIoTivity: From Devices to the Cloud
IoTivity: From Devices to the Cloud
Samsung Open Source Group
 
SOSCON 2016 JerryScript
SOSCON 2016 JerryScriptSOSCON 2016 JerryScript
SOSCON 2016 JerryScript
Samsung Open Source Group
 
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivityIoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
Samsung Open Source Group
 
Run Your Own 6LoWPAN Based IoT Network
Run Your Own 6LoWPAN Based IoT NetworkRun Your Own 6LoWPAN Based IoT Network
Run Your Own 6LoWPAN Based IoT Network
Samsung Open Source Group
 
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under LinuxPractical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
Samsung Open Source Group
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/LinuxIoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
Samsung Open Source Group
 
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Things
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of ThingsJerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Things
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Things
Samsung Open Source Group
 

More from Samsung Open Source Group (20)

The Complex IoT Equation (and FLOSS solutions)
The Complex IoT Equation (and FLOSS solutions)The Complex IoT Equation (and FLOSS solutions)
The Complex IoT Equation (and FLOSS solutions)
 
Easy IoT with JavaScript
Easy IoT with JavaScriptEasy IoT with JavaScript
Easy IoT with JavaScript
 
Spawny: A New Approach to Logins
Spawny: A New Approach to LoginsSpawny: A New Approach to Logins
Spawny: A New Approach to Logins
 
Rapid SPi Device Driver Development over USB
Rapid SPi Device Driver Development over USBRapid SPi Device Driver Development over USB
Rapid SPi Device Driver Development over USB
 
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT DevicesTizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
Tizen RT: A Lightweight RTOS Platform for Low-End IoT Devices
 
IoTivity: Smart Home to Automotive and Beyond
IoTivity: Smart Home to Automotive and BeyondIoTivity: Smart Home to Automotive and Beyond
IoTivity: Smart Home to Automotive and Beyond
 
IoTivity for Automotive: meta-ocf-automotive tutorial
IoTivity for Automotive: meta-ocf-automotive tutorialIoTivity for Automotive: meta-ocf-automotive tutorial
IoTivity for Automotive: meta-ocf-automotive tutorial
 
GENIVI + OCF Cooperation
GENIVI + OCF CooperationGENIVI + OCF Cooperation
GENIVI + OCF Cooperation
 
Framework for IoT Interoperability
Framework for IoT InteroperabilityFramework for IoT Interoperability
Framework for IoT Interoperability
 
Open Source Metrics to Inform Corporate Strategy
Open Source Metrics to Inform Corporate StrategyOpen Source Metrics to Inform Corporate Strategy
Open Source Metrics to Inform Corporate Strategy
 
IoTivity for Automotive IoT Interoperability
IoTivity for Automotive IoT InteroperabilityIoTivity for Automotive IoT Interoperability
IoTivity for Automotive IoT Interoperability
 
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Thin...
 
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux DeviceAdding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
Adding IEEE 802.15.4 and 6LoWPAN to an Embedded Linux Device
 
IoTivity: From Devices to the Cloud
IoTivity: From Devices to the CloudIoTivity: From Devices to the Cloud
IoTivity: From Devices to the Cloud
 
SOSCON 2016 JerryScript
SOSCON 2016 JerryScriptSOSCON 2016 JerryScript
SOSCON 2016 JerryScript
 
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivityIoT: From Arduino Microcontrollers to Tizen Products using IoTivity
IoT: From Arduino Microcontrollers to Tizen Products using IoTivity
 
Run Your Own 6LoWPAN Based IoT Network
Run Your Own 6LoWPAN Based IoT NetworkRun Your Own 6LoWPAN Based IoT Network
Run Your Own 6LoWPAN Based IoT Network
 
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under LinuxPractical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
Practical Guide to Run an IEEE 802.15.4 Network with 6LoWPAN Under Linux
 
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/LinuxIoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
IoTivity Tutorial: Prototyping IoT Devices on GNU/Linux
 
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Things
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of ThingsJerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Things
JerryScript: An ultra-lighteweight JavaScript Engine for the Internet of Things
 

Recently uploaded

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 

Media Resource Sharing Through the Media Controller API

  • 1. Samsung Open Source Group © SAMSUNG Electronics Co.1 Media Resource Sharing Through The Media Controller API Korea Linux Forum, October 26th 2015 Shuah Khan Samsung Open Source Group shuahkh@osg.samsung.com
  • 2. Samsung Open Source Group © SAMSUNG Electronics Co.2 Abstract Media devices have hardware resources that are shared across several functions. However, media drivers have no knowledge of which resources are shared. For example, accessing DVB and ALSA at the same time, or the DVB and V4L analog video at the same time results in video and audio stream errors. At the root of this problem is a lack of a common locking mechanism that can provide access control. As a result, it is necessary to create a locking construct at the master device level for all drivers that share a device to facilitate resource sharing. A common managed media device created at the parent USB device level can function as this locking construct. In this talk, Shuah will discuss the Managed Media Controller API and how ALSA and au0828 use it to share media resources. In addition, she will show how media-ctl/mc_nextgen_test tool can be used to generate media graphs for a media device.
  • 3. Samsung Open Source Group © SAMSUNG Electronics Co.3 Agenda ... ● Media Devices ● Media vs. Multi-function Devices ● Shared Media Functions Nicely - Challenges ● Exclusive Access Use-cases ● About Win-TV HVR 950Q ● Media Controller API ● Managed Media Controller API ● HVR 950Q Drivers with Managed Media Device ● HVR 950Q Device Media Graphs ● HVR 950Q Drivers Sharing Resources
  • 4. Samsung Open Source Group © SAMSUNG Electronics Co.4 Media Devices ... Hauppauge Win TV HVR 950Q Hybrid USB TV Stick Kworld UB435-Q V3 Hauppauge 80e PCTV HD Mini Stick
  • 5. Samsung Open Source Group © SAMSUNG Electronics Co.5 Media vs. Multi-function Devices ... ● A group of independent devices. ● Each device implements a function. ● Sharing is not limited to attach point. ● A single device. ● MFD framework helps identify functions as discrete platform devices. ● Sharing is limited to attach point – sub- devices attached to a shared bus.
  • 6. Samsung Open Source Group © SAMSUNG Electronics Co.6 Media vs. Multi-function Devices ... ● Functions can be shared. ● Media drivers have to coordinate sharing. ● Fine grain locking. ● Leverage non-media drivers. e.g: snd-usb-audio for audio function. ● Each function is independent. ● Drivers don't need to coordinate sharing. ● Fine grain locking.
  • 7. Samsung Open Source Group © SAMSUNG Electronics Co.7 Sharing Media Functions Nicely - Challenges ... ● Drivers are unaware of shared resources. ● Drivers don't have a way to ensure exclusive access to shared resource/function. – e.g: Starting Digital application disrupts Video streaming. ● Drivers can access/change modes while resource is in use by another. ● Existing fine grain locks don't ensure exclusive access. ● Existing locks are local to function drivers. No global locks that span all drivers.
  • 8. Samsung Open Source Group © SAMSUNG Electronics Co.8 Exclusive Access Use-cases ... ● Starting Digital application ... – should not disrupt active Video and Audio streams. ● Starting Video application ... – should not disrupt active Digital and Audio streams. ● Starting Audio application … – should not disrupt Video and Digital streams. ● Querying current configuration (read only access) should work.
  • 9. Samsung Open Source Group © SAMSUNG Electronics Co.9 About Win-TV HVR 950Q ... Hardware: – USB bus – attach point – Tuner on I2C bus – Audio Processor – Decoder – Video – Digital – No Radio – IR receiver (No transmitter)
  • 10. Samsung Open Source Group © SAMSUNG Electronics Co.10 About Win-TV HVR 950Q ... Drivers: – au0828 usb driver – au0828 dvb extension – au0828 analog (v4l2) extension – i2c Hauppauge eeprom decoder driver – Xceive xc5000 silicon tuner driver – snd-usb-audio
  • 11. Samsung Open Source Group © SAMSUNG Electronics Co.11 About Win-TV HVR 950Q ... Device/Driver view: USB Device struct usb_device USB Device Parent struct device Au0828 USB driver struct au0828_dev Snd-usb-audio Au0828 DVB Au0828 Video Shared USB Interface Au8522 Decoder Xc5000 tuner
  • 12. Samsung Open Source Group © SAMSUNG Electronics Co.12 Shared Resource Exclusive Locking ...
  • 13. Samsung Open Source Group © SAMSUNG Electronics Co.13 Media Controller API ... ● Relational media graph framework ● Media functions/resources represented as nodes on a graph ● Media Device serves as the root node ● Allows creating links between nodes ● Allows active/inactive links between nodes ● Allows start/stop pipelines between nodes
  • 14. Samsung Open Source Group © SAMSUNG Electronics Co.14 Managed Media Controller API ... Media Device as a device resource ● media_device_get_devres() ● media_device_find_devres()
  • 15. Samsung Open Source Group © SAMSUNG Electronics Co.15 Managed Media Controller API ... Allows au0828 and snd-usb-audio share media device ● Media Device is a managed device resource at the parent USB device. ● Media Device is the root node for the shared media graph. ● Media Device gets created by either au0828 or snd-usb-audio – first one to run probe wins.
  • 16. Samsung Open Source Group © SAMSUNG Electronics Co.16 HVR 950Q drivers with Managed Media Device ... Device/Driver view: USB Device struct usb_device USB Device Parent struct device Au0828 USB driver struct au0828_dev Snd-usb-audio Au0828 DVB Au0828 Video Shared USB Interface Managed Media Device on USB Device Parent struct device Shared Media Device Au8522 Decoder Xc5000 tuner
  • 17. Samsung Open Source Group © SAMSUNG Electronics Co.17 Media Controller Entity Notify API ... ● media_device_register_entity_notify() ● media_device_unregister_entity_notify() ● Enables drivers to register callbacks to take action as entities get added by other drivers.
  • 18. Samsung Open Source Group © SAMSUNG Electronics Co.18 Shared Media Graph Creation ... ● Drivers (au0828, and snd-usb-audio) add entities for their functions. ● Bridge driver (au0828) creates links between entities via entity_notify API.
  • 19. Samsung Open Source Group © SAMSUNG Electronics Co.19 HVR 950Q Media Graph ...
  • 20. Samsung Open Source Group © SAMSUNG Electronics Co.20 Media Controller Enable/Disable Source handlers ... ● Media Device - enable/disable source handlers. ● Enable source grants access to shared resource or returns -EBUSY. ● Disable source marks shared resource free. ● Bridge drivers (e.g au0828) implement and register enable/disable source handlers to manage access to shared resources.
  • 21. Samsung Open Source Group © SAMSUNG Electronics Co.21 Audio owns tuner ...
  • 22. Samsung Open Source Group © SAMSUNG Electronics Co.22 Audio releases tuner ...
  • 23. Samsung Open Source Group © SAMSUNG Electronics Co.23 Video owns tuner ...
  • 24. Samsung Open Source Group © SAMSUNG Electronics Co.24 Video releases tuner ...
  • 25. Samsung Open Source Group © SAMSUNG Electronics Co.25 Digital owns tuner ...
  • 26. Samsung Open Source Group © SAMSUNG Electronics Co.26 Digital releases tuner ...
  • 27. Samsung Open Source Group © SAMSUNG Electronics Co.27 Audio owns tuner – Digital start/stop ...
  • 28. Samsung Open Source Group © SAMSUNG Electronics Co.28 Audio owns tuner – Video start/stop ...
  • 29. Samsung Open Source Group © SAMSUNG Electronics Co.29 Video owns tuner – Audio start/stop ...
  • 30. Samsung Open Source Group © SAMSUNG Electronics Co.30 Video owns tuner – Digital start/stop ...
  • 31. Samsung Open Source Group © SAMSUNG Electronics Co.31 Digital owns tuner – Audio start/stop ...
  • 32. Samsung Open Source Group © SAMSUNG Electronics Co.32 Digital owns tuner – Video start/stop ...
  • 33. Samsung Open Source Group © SAMSUNG Electronics Co.33 tvtime owns tuner ...
  • 34. Samsung Open Source Group © SAMSUNG Electronics Co.34 tvtime releases tuner ...
  • 35. Samsung Open Source Group © SAMSUNG Electronics Co.35 After v4l2-ctl –all run ...
  • 36. Samsung Open Source Group © SAMSUNG Electronics Co.36 mc_nextgen_test tool ... Usage: mc_nextgen_test [OPTION...] A testing tool for the MC next geneneration API -d, --device=DEVICE media controller device (default: /dev/media0 -D, --dot show in Graphviz format -e, --entities show entities -i, --interfaces show pads -I, --intf-links show interface links -l, --data-links show data links -?, --help Give this help list --usage Give a short usage message -V, --version Print program version
  • 37. Samsung Open Source Group © SAMSUNG Electronics Co.37 Links to patches ... ● Update ALSA, and au0828 drivers to use Managed Media Controller API – patch series links: – https://www.mail-archive.com/linux-media@vger.kernel .org/msg92752.html ● Mixer and Control Interface support – https://www.mail-archive.com/linux-media@vger.kernel .org/msg93084.html ● mc_nextgen_test tool patch to add ALSA entity support – https://www.mail-archive.com/linux-media@vger.kernel .org/msg93086.html
  • 38. Samsung Open Source Group © SAMSUNG Electronics Co.38 Links to media graphs ... ● Media graphs generated using mc_nextgen_test tool at various points during testing at – https://drive.google.com/open?id=0B0NIL0BQg- AlLWE3SzAxazBJWm8
  • 39. Samsung Open Source Group © SAMSUNG Electronics Co.39 Questions ?
  • 40. Samsung Open Source Group © SAMSUNG Electronics Co.40 Thank You!
  • 41. Samsung Open Source Group © SAMSUNG Electronics Co.41 About Kworld ATSC TV Stick ... ● Hardware: – USB bus – attach point – Tuner on I2C bus – Digital TV – Audio ● Drivers: – em28xx usb driver – em28xx dvb extension – dvb frontend adapter: demux, dvr, net – tda18212