\documentclass[aspectratio=169,obeyspaces,spaces,hyphens,dvipsnames]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}% http://ctan.org/pkg/lm
\usepackage{minted}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage[normalem]{ulem}

\mode<presentation>
\usetheme{Bootlin}

\def\signed #1{{\leavevmode\unskip\nobreak\hfil\penalty50\hskip2em
  \hbox{}\nobreak\hfil(#1)
  \parfillskip=0pt \finalhyphendemerits=0 \endgraf}}

\newsavebox\mybox
\newenvironment{aquote}[1]
  {\savebox\mybox{#1}\begin{quotation}}
  {\signed{\usebox\mybox}\end{quotation}}

\title{Hotplug DRM pipeline components on non-discoverable video busses}
\authors{Luca Ceresoli}
\email{luca.ceresoli@bootlin.com}
\slidesurl{https://bootlin.com/pub/conferences/}
\institute{Bootlin}
\conference{Linux Plumbers Conference 2024}

\begin{document}

\addtocontents{toc}{\protect\setcounter{tocdepth}{-1}}
\section{Hotplug DRM pipeline components on non-discoverable video busses}
\addtocontents{toc}{\protect\setcounter{tocdepth}{2}}

\begin{frame}{Luca Ceresoli}
  \begin{itemize}
  \item Embedded Linux engineer at Bootlin
    \begin{itemize}
    \item Embedded Linux {\bf expertise}
    \item {\bf Development}, consulting and training
    \item Strong open-source focus
    \end{itemize}
  \item Linux kernel device driver developer
  \item Bootloaders, Buildroot and Yocto integration
  \item Open-source contributor
  \item Living in {\bf Bergamo}, Italy
  \end{itemize}
  {\small \url{https://bootlin.com/company/staff/luca-ceresoli/}}
\end{frame}

\subsection{Context}

\begin{frame}{Goal}
  \begin{itemize}
  \item A healthcare product, advanced hardware prototype, to be launched in 2025
  \item Classic ARM64 embedded system, using device tree
    \begin{itemize}
    \item Works standalone with basic features
    \end{itemize}
  \item Has a connector for an add-on to extend features
    \begin{itemize}
    \item Proprietary connector
    \item Hot-pluggable by user at any moment
    \item Connector uses non-discoverable busses (I2C, MIPI DSI,
      interrupts)
    \item DSI-to-LVDS bridge on the add-on
    \end{itemize}
  \end{itemize}
  \vspace{0.3cm}
  \centering\includegraphics[height=0.38\textheight]{hardware-diagram.pdf}
\end{frame}

\begin{frame}{Overall solution}
  \begin{itemize}
  \item Device tree + Adding HW = {\bf device tree overlays}
    \begin{itemize}
    \item Discussion next Friday
    \item ``Runtime hotplug on non-discoverable busses with device tree overlays''
    \item \url{https://lpc.events/event/18/contributions/1696/}
    \end{itemize}
  \item v4: \url{https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-0-bc4dfee61be6@bootlin.com/}
  \end{itemize}
\end{frame}

\subsection{Proposed approach: the hotplug bridge}

\begin{frame}{The hotplug bridge}
  \begin{itemize}
  \item Main issue with DRM: pipeline is assumed to be immutable (except
    panel/display after DRM connector)
  \item Card needed to be always present
  \item Idea: add a decoupling {\bf ``hotplug bridge''}
  \end{itemize}
\end{frame}

\begin{frame}[fragile]{The hotplug bridge}
  \centering\includegraphics[width=0.80\textwidth]{drm-diagram1.pdf}

  \begin{block}{}
    \fontsize{7}{7}\selectfont
    \begin{minted}{shell}
  # modetest -c | grep -i '^[a-z0-9]'
  Connectors:
  id    encoder status          name        size (mm)     modes   encoders
  38    0       disconnected    DSI-1       0x0           0       37
                                                                                                                                                                                                      .
    \end{minted}
  \end{block}
\end{frame}

\begin{frame}[fragile]{The hotplug bridge}
  \centering\includegraphics[width=0.80\textwidth]{drm-diagram2.pdf}

  \begin{block}{}
    \fontsize{7}{7}\selectfont
    \begin{minted}{shell}
  # modetest -c | grep -i '^[a-z0-9]'
  Connectors:
  id    encoder status          name        size (mm)     modes   encoders
  38    0       disconnected    DSI-1       0x0           0       37
  39    0       connected       LVDS-1      344x194       1       37
    \end{minted}
  \end{block}
\end{frame}

\begin{frame}{The hotplug bridge}
  \begin{itemize}
  \item The hotplug bridge is not a chip, it just ``represents'' the physical connector
  \item Fully decouples fixed and removable sections
  \item Existing bridge drivers work unmodified
    \begin{itemize}
    \item Not aware of hotplug
    \end{itemize}
  \item Self-contained, only small additions to DRM core
    (\href{https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-2-bc4dfee61be6@bootlin.com/}{patch 2},
     \href{https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-3-bc4dfee61be6@bootlin.com/}{patch 3})
  \item DRM card always available
  \end{itemize}
\end{frame}

\begin{frame}{Current status}
  \begin{itemize}
  \item \href{https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-4-bc4dfee61be6@bootlin.com/}{patch 4}
    adds the \code{hotplug-drm-bridge} driver
  \item Ongoing discussion after
    \href{https://lore.kernel.org/all/20240510-hotplug-drm-bridge-v2-0-ec32f2c66d56@bootlin.com/\#r}{Sima's review of v2}
    \begin{itemize}
    \item Many changes requested
    \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}{Work in progress}
  \begin{itemize}
  \item Added dynamic LVDS DRM connector [v3]
    \begin{itemize}
    \item Added/removed on hot(un)plug, like DP MST
    \end{itemize}
  \item No DRM bridge notifiers [small step in v4]
    \begin{itemize}
    \item Added \code{bridge_event_notify()} to \kstruct{drm_bridge_funcs}
      (\href{https://lore.kernel.org/all/20240917-hotplug-drm-bridge-v4-2-bc4dfee61be6@bootlin.com/}{patch 2})
    \end{itemize}
  \item Working on other aspects
  \end{itemize}
\end{frame}

\begin{frame}{Open issues}
  \begin{itemize}
  \item Clarifications needed
  \item What should be moved to the DRM / bridge core?
  \item Should the hotplug bridge exist (as a \kstruct{drm_bridge})?
    \begin{itemize}
    \item If not, how to keep the card existing when there is no add-on?
    \item Bridges don't expect next bridge to disappear
    \end{itemize}
  \item Lifetime, refcounting, ownership issues
    \begin{itemize}
    \item DRM bridges have no lifetime management or refcounting
    \item Let removable bridges be ``owned'' by the dynamic DRM connector to
      reuse its ones
    \item Need to add refcounting to bridges anyway?
    \end{itemize}
  \item Bridge removal during atomic updates
  \end{itemize}
\end{frame}

\questionslide

\end{document}
