20 Şubat 2020 Perşembe

X11 Window System

X11 Pencere Sistemi Nedir?
Grafik arayüz altyapısıdır. Basitçe iki kısımdan oluşur
1. Display Server
2. Xlib kütüphanesi

Display Server Nedir
Açıklaması şöyle. X11 ağ üzerinden de çalışmak üzere tasarlandığı için istemci-sunucu yapısındadır. Örneğin bir başka bilgisayarda çalışan tarayıcının görüntüsünü kendi bilgisayarımda görebilir. Window terminoloji ile konuşursak Remote Desktep (Uzak Masaüstü) açmış gibi olurum. Farklı olarak karşı bilgisayardaki tüm masaüstü yerine sadece bir uygulamaya erişimin olur. 

Bu yapı yüzünden X11 bir sunucuya ihtiyaç duyar.
A display server or window server is a program whose primary task is to coordinate the input and output of its clients to and from the rest of the operating system, the hardware, and each other. The display server communicates with its clients over the display server protocol, a communications protocol, which can be network-transparent or simply network-capable. For instance Xorg and Wayland are display server communications protocols.
Şeklen şöyle

Display Server Olmak Zorunda mı ?
Eğer sadece yerel bilgisayarda bir şey yapmak istiyorsam, gerekli değil. Açıklaması şöyle
You can display graphics using the Linux frame-buffer interface without X11 or Wayland at all.

The fbida package includes the fbi image viewer, which can run directly on the virtual console. You can't get much more light-weight than that.
DISPLAY Ortam Değişkeni
Açıklaması şöyle
The remote server knows where it has to redirect the X network traffic via the definition of the DISPLAY environment variable which generally points to an X Display server located on your local computer.

The value of the display environment variable is:

hostname:D.S
where:

hostname is the name of the computer where the X server runs. An omitted hostname means the localhost.

D is a sequence number (usually 0). It can be varied if there are multiple displays connected to one computer.

S is the screen number. A display can actually have multiple screens. Usually, there's only one screen though where 0 is the default.
Örnek
Şöyle yaparız. Yerel makinedeki ekranın ne kadar süredir kullanılmadığını gösterir.
DISPLAY=":0" xprintidle
Örnek
Şöyle yaparız.
$xset -display :0 q
...
Monitor is Off
X.Org Nedir
Açıklaması şöyle. Yani X11 pencerece sistemini Linux üzerinde gerçekleştirir.
Most Linux distribution uses X.Org Server which is the free and open-source implementation of the display server for the X Window System (X11) stewarded by the X.Org Foundation.
İsmi Neden X11
Açıklaması şöyle. X protokolünün geliştirilmesine 1984 yılında başlandı. 1987 yılında ise 11. sürümü yayınlandı. İsmi de X11 olarak kaldı.
The X Window System, X11 (X version 11) is a windowing system for bitmap displays, common on Unix-like operating systems, X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting with a mouse and keyboard. X does not mandate the user interface, this is handled by individual programs. As such, the visual styling of X-based environments varies greatly; different programs may present radically different interfaces. X originated at the Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at version 11 (hence "X11") since September 1987.
X11 Script Dizini
X11 scriptleri /etc/X11 dizininde bulunur. X11 yerine ileriki zamanlarda Wayland kullanılacak.
Konuyla ilgili startx komutu yazısına bakabilirsiniz.

Ayrıca X11 İstemcisi yazısına da bakabilirsiniz

Mimari
Mimarisel olarak şöyle.
┌───────────────────────────────────────────────┐
│                       User                    │
│     ┌─────────────────────────────────────────┤
│     │             Application                 │
│     │            ┌──────────┬─────┬─────┬─────┤
│     │            │      ... │ SDL │ GTK │ SDL │
│     │            ├──────────┴─────┴─────┴─────┤
│     │            │            xLib            │
│     │            ├────────────────────────────┤
├─────┴───┬────────┴──┐         X11             │
│   Gnu   │ Libraries │        Server           │
│   Tools │           │                         │
├─────────┘           │                         │ 
├─────────────────────┤                         │
│   Linux (kernel)    │                         │
├─────────────────────┴─────────────────────────┤
│                    Hardware                   │
└───────────────────────────────────────────────┘
X11 User Space' te Çalışır
Açıklaması şöyle.
This runs in user-land (outside of the kernel): it is just another process, with some privileges. The kernel does not get involved, except to give access to the hardware. And providing inter-process communication, so that other processes can talk with the X11 server.
Forwarding
X11 uzaktaki makineye bitmap değil sadece çizim talimatlarını gönderir. Açıklaması şöyle.
The X11 protocol was never meant to handle graphically (in terms of bitmaps/textures) intensive operations. Back in the day when X11 was first designed computer graphics were a lot simpler than they are today.

Basically X11 doesn't send the screen to your computer, but it sends the display-instructions so the X-server on your local computer can re-create the screen on your local system. And this needs to be done on each change/refresh of the display.
So your computer receives a stream of instructions like "draw line in this color from coordinates x,y to (xx,yy), draw rectangle W pixels wide, H pixels high with upper-left corner at (x,y), etc."
The local client isn't really aware what needs to be updated and the remote system has very little information on what the client actually needs, so basically the server must send a lot of redundant information that the client may or may not need.
This is very efficient if the display to be rendered consists of a limited number of simple graphical shapes and only a low refresh frequency (no animations and such) is needed. Which was the case back in the days when X11 was first developed.

But modern GUI's have a lot of eye-candy and much of that needs to be send from the remote system to your client in the form of bitmaps/textures/fonts which take quite a lot of bandwidth. And all sorts of eye-candy includes animated effects requiring frequent updates. And the displays keep getting bigger too, twice as wide/high is 4x the number of pixels.
Açıklaması şöyle.
The reason X11 forwarding is called "X11 forwarding" is because it transports the actual X protocol messages used by applications to render their windows on the "X server" (typically Xorg). Those messages are commands for creating/moving windows, drawing text and graphical primitives (lines/rectangles), drawing bitmaps, etc.

You could say it's conceptually the opposite of "full screen image" protocols such as VNC/RFB. I think it is somewhat comparable to Windows' RDP, which was also made for transporting GDI drawing commands.
X11 Verimsizliği
Ancak zamanla bu durum değişti. Açıklaması şöyle.
Over time this changed, programs started doing the rendering by themselves, and many of those instructions became just "here's a bitmap which I already rendered, put this on screen" – very fast locally, but very slow over the network due to X11 lacking any image compression.

This means programs built using modern toolkits are much slower over networked X11, even if it's something as basic as antialiased fonts.

(In contrast, RDP has adapted over time and includes various forms of image compression such as JPEG and even H.264; you can often notice the compression artifacts while the full image is loading.)


Hiç yorum yok:

Yorum Gönder