From a251c89d377e518de0fdc8816f402b901422a361 Mon Sep 17 00:00:00 2001 From: Eleni Maria Stea Date: Thu, 20 May 2021 08:53:42 +0300 Subject: [PATCH] all? --- codecamp.tex | 112 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 50 insertions(+), 62 deletions(-) diff --git a/codecamp.tex b/codecamp.tex index 447ba56..74d1fb3 100644 --- a/codecamp.tex +++ b/codecamp.tex @@ -546,16 +546,17 @@ program} \vspace{0.3cm} - \begin{block}{Requirements to use shared context/textures in \textbf{WebKit}:} + \begin{block}{What would we need to change in \textbf{WebKit} for + shared context to work?} \begin{itemize} - \item We should use the \textbf{ANGLE EGL/OpenGL backend in + \item Force the \textbf{ANGLE EGL/OpenGL backend in WebGL2} to match the main Graphics Pipeline API/driver (both contexts should be OpenGL or GLESv2 and from the same driver!) \item We'd need an \textbf{ANGLE extension} to allow passing native shared context to ANGLE's eglCreateContext instead of ANGLE shared context. - \item We should never move WebGL2 and Graphics Pipeline in + \item We should never split WebGL2 and Graphics Pipeline in different processes. Shared contexts should be created by the same process! (\textbf{Reason we've rejected this method}). @@ -627,19 +628,7 @@ program} OpenGL context between native EGL and ANGLE EGL using \texttt{EGL\_ANGLE\_native\_shared\_context}:} - \vspace{0.2cm} - \begin{itemize} - \item \tiny{We'd pass the native EGL context (created by the native system - driver) as {\color{black}shared context} to the - native OpenGL context that is created {\color{black}in the ANGLE - OpenGL backend} using the native system driver!} - \item \tiny{We'd need use the {\color{black}new EGL attribute - (\texttt{EGL\_NATIVE\_SHARED\_CONTEXT\_ANGLE})} to let ANGLE know - that the shared context \textit{\color{coolblack}is not ANGLE but native} - context!} - \end{itemize} - \vspace{-0.2cm} - + \vspace{0.5cm} \begin{table}[t] \centering \begin{tabular}{l} @@ -663,20 +652,16 @@ program} \setbeamercolor{block body}{bg=white} \begin{center} - \begin{block}{\tiny{Extension - \texttt{EGL\_NATIVE\_SHARED\_CONTEXT\_ANGLE}:}} + \begin{block}{\tiny{What happens inside ANGLE + (with \texttt{EGL\_NATIVE\_SHARED\_CONTEXT\_ANGLE}):}} \vspace{0.2cm} \tiny{ \begin{table}[h] \centering - Worked on the extension implementation (draft state, there are - bugs).\\ \begin{tabular}{l} - \\ - \textbf{Concept:}\\ \begin{adjustbox}{max width=\textwidth} \adjustbox{valign=t}{\includegraphics[scale=0.2]{data/shared_ctx3.png}} - \end{adjustbox}\\ + \end{adjustbox} \end{tabular} \end{table} } @@ -778,27 +763,29 @@ program} \setbeamercolor{block body}{bg=white} \setbeamertemplate{itemize/enumerate body begin}{\tiny} - \begin{block}{\scriptsize{How the kernel DMA buffers would help us avoid copying - the WebGL texture data?}} - - \begin{center} - \begin{itemize} - \item Each texture is backed by a Linux kernel dma\_buffer. - \item Multiple textures can use the same dma buffer as backing - storage if they meet some requirements. - \item We can export the file descriptor of one buffer from one - driver and use it to access the buffer from the other - driver. - \item So we can export the fd that corresponds to the compositor - texture, import it in WebGL when we create the render target - and when the WebGL texture is filled, the compositor texture - will be also filled, as they share the backing storage! - \end{itemize} - \end{center} - \end{block} - - \begin{block}{\scriptsize{EGL and GL extensions that can be used for that - purpose:}} +% \begin{comment} +% \begin{block}{\scriptsize{How the kernel DMA buffers would help us avoid copying +% the WebGL texture data?}} +% +% \begin{center} +% \begin{itemize} +% \item Each texture is backed by a Linux kernel dma\_buffer. +% \item Multiple textures can use the same dma buffer as backing +% storage if they meet some requirements. +% \item We can export the file descriptor of one buffer from one +% driver and use it to access the buffer from the other +% driver. +% \item So we can export the fd that corresponds to the compositor +% texture, import it in WebGL when we create the render target +% and when the WebGL texture is filled, the compositor texture +% will be also filled, as they share the backing storage! +% \end{itemize} +% \end{center} +% \end{block} +% \end{comment} + + \begin{block}{\scriptsize{EGL and GL extensions to share content across + drivers using dma\_buf buffers:}} \begin{center} \begin{itemize} \item @@ -819,6 +806,21 @@ program} \end{itemize} \end{center} \end{block} + \begin{block}{\scriptsize{Example Programs:}} + \begin{center} + \begin{itemize} + \item Associating two textures with the contents of the same + buffer without copy taking place.\\ + Blog post: \url{https://eleni.mutantstargoat.com/hikiko/egl-dma-1/} \\ + Code: \url{https://gistof.com/dma-egl-version} + \item Sharing texture data between ANGLE and the native system + driver using DMA buffers and EGL. \\ + Blog post: \url{https://eleni.mutantstargoat.com/hikiko/angle-dma/}\\ + Code: \url{https://gistof.com/dmaangleeglversion} + \end{itemize} + \end{center} + \end{block} + \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -829,30 +831,16 @@ program} \setbeamercolor{block body}{bg=white}{\scriptsize} \setbeamertemplate{itemize/enumerate body begin}{\tiny} - \begin{block}{\scriptsize{I've written an example:}} - \begin{center} - \begin{itemize} - \item First using two native EGL contexts\\ - Blog post: \url{https://eleni.mutantstargoat.com/hikiko/egl-dma-1/} \\ - Code: \url{https://gistof.com/dma-egl-version} - \item Then using a native EGL context and a context created from - ANGLE\\ - Blog post: \url{https://eleni.mutantstargoat.com/hikiko/angle-dma/}\\ - Code: \url{https://gistof.com/dmaangleeglversion} - \end{itemize} - \end{center} - \end{block} - \vspace{-0.3cm} \begin{block}{\scriptsize{Snippet from the exporter:}} - \vspace{-0.1cm} \tiny{ \begin{table}[t] \centering \begin{tabular}{l} {\color{coolblack}Exporting a dma buffer from a texture \texttt{texA}:}\\ + \\ \begin{adjustbox}{max width=\textwidth} - \adjustbox{valign=t}{\includegraphics[height=4cm]{data/dma_export_and_struct.png}} + \adjustbox{valign=t}{\includegraphics[height=6.5cm]{data/dma_export_and_struct.png}} \end{adjustbox}\\ \end{tabular} \end{table} @@ -895,14 +883,13 @@ program} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} - \frametitle{Test program} + \frametitle{Final test program (WORKS!)} \begin{block}{\scriptsize{An exporter-importer that uses ANGLE and native EGL}} \setbeamertemplate{itemize/enumerate body begin}{\scriptsize} \begin{itemize} \itemsep0.3cm - \itemsep0.2cm \item First context is EGL/OpenGL like the one in main graphics pipeline. \item Second is ANGLE with EGL/GLESv2 backend like the one in @@ -947,6 +934,7 @@ program} pipeline in two processes. (Žan Doberšek)}}} \vspace{0.5cm} + \setbeamercolor{block body}{bg=white}{\scriptsize} \begin{block}{Can we still use shared DMA buffers?} \footnotesize{ -- 1.7.10.4