[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Re: Info on OpenJFX architecture
From:       Thiago_Milczarek_Sayão <thiago.sayao () gmail ! com>
Date:       2023-12-26 20:40:48
Message-ID: CAAP_wumjmq5XLs=qADi24tvOFRexWH62+Gd2nKmNaCe2Jmjbcw () mail ! gmail ! com
[Download RAW message or body]

Hi Keerthivasan,

Answers below.

Em ter., 26 de dez. de 2023 =C3=A0s 15:32, Keerthivasan Raghavan <
mail2akash97@gmail.com> escreveu:

> Hi All,
>
> I am a newbie to the desktop/embedded linux graphics and widget toolkit.
>
> The following is a list of questions about how OpenJFX is
> architected/designed/implemented:
>
> * How does openjfx manage the lifecycle of
> windows/surfaces/graphics-context(EGL/OpenGL) to draw into?
> What is the (design and implementation)/architecture of the window system
> abstraction used by OpenJFX?
>   Any links to code snippets inside OpenJFX showing the
> creation/management of an X11-Window/Wayland-Surface would help.
> References:
> * GTK uses GDK(https://docs.gtk.org/gtk4/drawing-model.html) for managing
> windowing abstraction.
> * GLFW, a cross platform (window + graphics context + input) management:
> https://www.glfw.org/
> * Microsoft Windows win32 API:
> https://learn.microsoft.com/en-us/windows/win32/learnwin32/creating-a-win=
dow,
>
>
> https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-cr=
eatewindowexa
>
>
Each platform has its implementation.The abstraction layer is called
"glass". In the case of linux, gtk is used. Pure wayland (without XWayland)
is not supported yet - and, from my experience, gtk will probably not be
used.
Look for glass_window.cpp for the Gtk backend.


> * How are frames created using drawing operations?
> What is the abstraction used to express the content of the frame?
> Any code/design links please.
> References:
> * GTK uses GSK(https://docs.gtk.org/gsk4/) for building the scene graph
> that can be rendered as a frame.
> * Windows reference:
> https://learn.microsoft.com/en-us/windows/win32/learnwin32/your-first-dir=
ect2d-program
>
>
The rendering abstraction layer is called "prism". I'm not sure how the
scene graph is translated into rendering artifacts.
On Linux, GLX is used to glue to OpenGL on a sublayer of prism called
"es2". If Wayland is implemented, it will have to use EGL.
Windows uses direct3d
Mac will use Metal (I think it's under development).



>
> * How is event management done in OpenGFX ?
> Any code/design links please.
> Reference:
> * GTK uses an main eventloop https://docs.gtk.org/glib/main-loop.html .
>

Desktop events originate from glass and it's platform dependent. Those
events are translated into JavaFX event system.
In the case of Linux it also uses GTK eventloop.


>
> * How are widgets drawn ? How are events dispatched to widgets and how do
> widgets react to events ?
> How is the application widget UI state stored and what is the
> corresponding memory management for storing the UI/widget state ?
> Does the UI state get modeled as a scene graph ?
> Any code/design links please.
> Reference:
> *
> https://learn.microsoft.com/en-us/windows/win32/learnwin32/retained-mode-=
versus-immediate-mode
>
>
Widgets are drawn using the scene graph. I think a Node is the basic
element (on the public API).
In the case of Linux, javafx draws directly into the window/surface (that
is passed by glass). This is the case of hardware accelerated rendering. If
software is used, it generates a bitmap buffer that is passed to glass. In
the case of linux, cairo is used.



> Please feel free to reply with code links, design docs, wikis or articles
> of the web.
>
> Thank you,
> Keerthivasan Raghavan
>

[Attachment #3 (text/html)]

<div dir="ltr"><div>Hi  Keerthivasan,</div><div><br></div><div>Answers \
below.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter., \
26 de dez. de 2023 Ã s 15:32, Keerthivasan Raghavan &lt;<a \
href="mailto:mail2akash97@gmail.com">mail2akash97@gmail.com</a>&gt; \
escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span \
style="color:rgb(212,212,212)">Hi All,</span></div><br><div><span \
style="color:rgb(212,212,212)">I am a newbie to the desktop/embedded linux graphics \
and widget toolkit.</span></div><br><div><span style="color:rgb(212,212,212)">The \
following is a list of questions about how OpenJFX is \
architected/designed/implemented:</span></div><br><div><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How does \
openjfx manage the lifecycle of windows/surfaces/graphics-context(EGL/OpenGL) to draw \
into?</span></div><div><span style="color:rgb(212,212,212)">  What is the (design and \
implementation)/architecture of the window system abstraction used by \
OpenJFX?</span></div><div><span style="color:rgb(212,212,212)">   Any links to code \
snippets inside OpenJFX showing the creation/management of an \
X11-Window/Wayland-Surface would help.</span></div><div><span \
style="color:rgb(212,212,212)">  References:</span></div><div><span \
style="color:rgb(212,212,212)">  </span><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> GTK uses \
GDK(<a href="https://docs.gtk.org/gtk4/drawing-model.html" \
target="_blank">https://docs.gtk.org/gtk4/drawing-model.html</a>) for managing \
windowing abstraction.</span></div><div><span style="color:rgb(212,212,212)">  \
</span><span style="color:rgb(103,150,230)">*</span><span \
style="color:rgb(212,212,212)"> GLFW, a cross platform (window + graphics context + \
input) management: <a href="https://www.glfw.org/" \
target="_blank">https://www.glfw.org/</a></span></div><div><span \
style="color:rgb(212,212,212)">  </span><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> \
Microsoft Windows win32 API: <a \
href="https://learn.microsoft.com/en-us/windows/win32/learnwin32/creating-a-window" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/learnwin32/creating-a-window</a>, \
</span></div><div><span style="color:rgb(212,212,212)">                               \
<a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexa" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser \
-createwindowexa</a></span></div><br></div></div></blockquote><div><br></div><div>Each \
platform has its implementation.The abstraction layer is called &quot;glass&quot;. In \
the case of linux, gtk is used. Pure wayland (without XWayland) is not supported yet \
- and, from my experience, gtk will probably not be used.</div><div>Look for \
glass_window.cpp for the Gtk backend.<br></div><div>  </div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How are \
frames created using drawing operations?</span></div><div><span \
style="color:rgb(212,212,212)">  What is the abstraction used to express the content \
of the frame?</span></div><div><span style="color:rgb(212,212,212)">  Any code/design \
links please.</span></div><div><span style="color:rgb(212,212,212)">  \
References:</span></div><div><span style="color:rgb(212,212,212)">  </span><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> GTK uses \
GSK(<a href="https://docs.gtk.org/gsk4/" \
target="_blank">https://docs.gtk.org/gsk4/</a>) for building the scene graph that can \
be rendered as a frame.</span></div><div><span style="color:rgb(212,212,212)">  \
</span><span style="color:rgb(103,150,230)">*</span><span \
style="color:rgb(212,212,212)"> Windows reference: <a \
href="https://learn.microsoft.com/en-us/windows/win32/learnwin32/your-first-direct2d-program" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/learnwin32/your-first- \
direct2d-program</a></span></div><br></div></div></blockquote><div><br></div><div>The \
rendering abstraction layer is called &quot;prism&quot;. I&#39;m not sure how the \
scene graph is translated into rendering artifacts.  </div><div>On Linux, GLX is used \
to glue to OpenGL on a sublayer of prism called &quot;es2&quot;. If Wayland is \
implemented, it will have to use EGL.</div><div>Windows uses direct3d</div><div>Mac \
will use Metal (I think it&#39;s under development).</div><div><br></div><div>  \
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br><div><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How is \
event management done in OpenGFX ?</span></div><div><span \
style="color:rgb(212,212,212)">  Any code/design links please.</span></div><div><span \
style="color:rgb(212,212,212)">  Reference: </span></div><div><span \
style="color:rgb(212,212,212)">  </span><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> GTK uses \
an main eventloop <a href="https://docs.gtk.org/glib/main-loop.html" \
target="_blank">https://docs.gtk.org/glib/main-loop.html</a> \
.</span></div></div></div></blockquote><div><br></div><div>Desktop events originate \
from glass and it&#39;s platform dependent. Those events are translated into JavaFX \
event system.</div><div>In the case of Linux it also uses GTK eventloop.</div><div>  \
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br><div><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How are \
widgets drawn ? How are events dispatched to widgets and how do widgets react to \
events ?</span></div><div><span style="color:rgb(212,212,212)">  How is the \
application widget UI state stored and what is the corresponding memory management \
for storing the UI/widget state ?</span></div><div><span \
style="color:rgb(212,212,212)">  Does the UI state get modeled as a scene graph \
?</span></div><div><span style="color:rgb(212,212,212)">  Any code/design links \
please.</span></div><div><span style="color:rgb(212,212,212)">  Reference: \
</span></div><div><span style="color:rgb(212,212,212)">  </span><span \
style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> <a \
href="https://learn.microsoft.com/en-us/windows/win32/learnwin32/retained-mode-versus-immediate-mode" \
target="_blank">https://learn.microsoft.com/en-us/windows/win32/learnwin32/retained-mode-versus-immediate-mode</a></span></div></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line \
-height:19px;white-space:pre-wrap"><br></div></div></blockquote><div><br></div><div>Widgets \
are drawn using the scene graph. I think a Node is the basic element (on the public \
API).  </div><div>In the case of Linux, javafx draws directly into the window/surface \
(that is passed by glass). This is the case of hardware accelerated rendering. If \
software is used, it generates a bitmap buffer that is passed to glass. In the case \
of linux, cairo is used.</div><div><br></div><div>  </div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap">Please \
feel free to reply with code links, design docs, wikis or articles of the \
web.<br></div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:&quot;Droid \
Sans Mono&quot;,&quot;monospace&quot;,monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br><div><span \
style="color:rgb(212,212,212)">Thank you,</span></div><div><span \
style="color:rgb(212,212,212)">Keerthivasan Raghavan</span></div></div></div> \
</blockquote></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic