Relationship between Linux clients, servers, and Window managers

Source: Internet
Author: User

The embedded Linux Chinese site has found that many Linux beginners encounter some concepts when learning about Linux graphics, such: x, X11, xfree86, WM, Kde, gnome, QT, QT/e, qtopia, directfb, framebuffer, and graphics card driver. Understanding the relationship between them is very important for us to learn. The purpose of this article is to clarify these concepts and their relationships.

I. Relationship between Linux operating systems and graphics

Linux does not have an image interface. The image interface of Linux is implemented only by applications in Linux. The image interface is not part of Linux. Linux is just a command line-based operating system. The Linux Kernel provides a display device driver for the graphic interface in Linux.

Ii. Concepts of X

X is the protocol, just like HTTP and IP. This concept is confusing for many beginners and even those who have been learning Linux for a certain period of time. When an X-based application needs to run and display content, it is connected to the X server, start to talk to the server using the X protocol. For example, if an X client needs to output a circle on the screen, it uses the X protocol to say to the X server: Hello! I need to draw a circle on the screen. The X application is only responsible for telling the X server where the screen is located to draw a circle in what color, and the specific "painting" action, such as how the circle is generated, the X server is responsible for directing the video card with the driver of any video card. The X server is also responsible for capturing keyboard and mouse movements. If the left mouse button captured by the X server is pressed, he tells the X application: Dear mr. application, I find that the mouse is pressed. Do you have any instructions? Assume that X Application
The sequence is designed to draw a square on the screen after you press the mouse to the left, the X application will say to the X server: Please draw another square, of course, he will tell the server where to draw a square in what color, but he will not care how to draw it-that is the server thing.

Iii. Concepts of X11 and x11r6

X11 indicates version 11th of the X protocol. X11r6 is the sixth release of version 11th of X protocol.

4. What is xfree86?

Xfree86 is the x11r6 executable program of X Windows server. With the protocol, specific software is required to implement the Protocol. Xfree86 is the on-screen display task submitted by X application according to the X protocol. Xfree86 is not the only software that implements the X protocol, but a free X server software that implements the X protocol. Some even have X servers running on Windows, so that you can run an X application on Linux and then display it on another Windows system. But xfree86 is the most commonly used in Linux. However, Xorg is widely used in Linux distributions.

Xfree86 includes X server, Font, a terminal program under X (xterm), a simple window manager (TWM), and many useful gadgets, displays the output driver and many input modules including the keyboard and mouse.

5. WM (Window Manager)

In the Red Hat system, you can set startup Level 3, enter the command line terminal, and then run:

# Startx

Start the image interface. You can see the same and complete image interface operation environment. Maximize, minimize, move, and close the window. Press CTRL + ALT + backspace to return to the character interface. Input:

# Xinit

Start the image page again. What do you see? You see an xterm (a terminal program running under X ). And cannot be moved. However, you can enter the command in this xterm to open the X application. If you enter:

# Kill

Open the browser. What is the difference between the browser and the normal one? He is in the middle of the screen, can not move, can not be minimized, can not maximize, no border.

Why is the same X application so different? Because we also started a WM (Window Manager) when we started the image interface with startx. If you started KDE with Kde, you started gnome with Gnome. However, WM is not started when you use xinit to start the image interface.

The window manager is used to maximize, minimize, move, and close the window. These are not handled by X servers. If you use xinit to start the image interface and enter TWM in xterm, what will happen?

Xterm is added with a border, which allows you to move, maximize, and minimize this xterm. TWM is the window manager in xfree86. It is a simple and simple window manager, but it has all the features of the window manager.

Vi. KDE and gnome

KDE and gnome are the most common image interface operating environments in Linux. They are not only as simple as Window managers, but also KDE is short for K desktop environment, there are many supporting applications and convenient desktop environments, such as the taskbar, Start Menu, and desktop icon. Gnome is short for the GNU network object model environment. It is the same as KDE and is also a powerful integrated environment.

VII. QT, QT/E, and qtopia

Trolltec has many QT products, such as QT, QT/E, and qtopia. It is currently owned by Nokia.

Qt refers to all desktop versions of QT, such as QT/X11, QT windows, and QT Mac. Since QT was first popular in Linux with Kde, it is generally considered that QT is based on QT/X11 in Linux. QT is a complete C ++ application development framework. It contains a class library and a tool for cross-platform development and internationalization. Qt APIs are the same on all supported platforms, and QT tools are used in the same way on these platforms. Therefore, the development and deployment of QT applications are irrelevant to the platform. In a desktop system, QT is usually an application that complies with the X protocol and requires the support of the X server.

QT/E is the QT version used for Embedded Linux systems. The dependencies of X lib are removed from QT/E and directly work on frame buffer. Therefore, the processing efficiency of applications is relatively high. It can run as long as there is a framebuffer device, without the support of the X server. However, its operation also involves the concept of servers and clients. Run the QT/e program before the server is started. You need to add "-qws" to start the server. For example:

#./Hello-qws

After qt4, QT/e changed its name to qtopia core and was integrated into qtopia.

QT/E is run by the frame buffer device. It is concise and efficient. However, engineers who know about the frame buffer device will find that the frame buffer device cannot implement hardware acceleration. This also limits the development of graphics solutions based on framebuffer devices. In fact, xfree86 on the desktop does not support framebuffer devices by default. xfree86 directly operates the video card and makes full use of the video card acceleration function (the next topic will introduce the video card acceleration content ). Xserver is compatible with the most compatible display cards. Generally, more than 80% of display cards on the market can be supported by this server. However, sometimes some graphics cards cannot be properly set. Frame
Buffer mode to support the display. The xfree86 frame buffer server (xf86_fbdev) is used ). You need to modify the xfree86 configuration file/etc/X11/xf86config and add the VGA = xxx function to/etc/grub. conf.

Qtopia is a comprehensive application development platform for Embedded Linux. It is also a user interface for Linux-based PDA (Personal Digital Assistant), smart phone (smartphone), and other mobile devices.

8. directfb and video card acceleration driver

First, directfb is similar to xfree86 on the desktop. The xfree86 In the desktop does not require the frame buffer device, whereas directfb does.

Video Card acceleration requires multiple graphics Functions in the embedded GUI, including drawing and copying. Many of these functions require a large amount of data transmission (shape copy), or a large number of numerical operations (picturesque spline ). If these functions are implemented by pure software, it will take a lot of CPU time and need to transmit a lot of data, thus affecting the graphics performance. Many graphics chips have a graphics processor that can implement some graphics Functions on the hardware. The graphic library supporting hardware acceleration can implement these graphics Functions through a graphics processor, which reduces the CPU burden, reduces the data transmission time on the bus, and improves the graphic performance.

The directfb project is part of the open source program promoted by convergence, Germany. It is a small, powerful, flexible, and easy-to-use graphics system specially designed to meet embedded device requirements, and try to become a new graphic standard built on the Linux framebuffer device. Based on framebuffer, it provides graphic acceleration, input device processing and extraction, transparent windows, and multiple display layers, which can provide better support for the embedded system GUI. Compared with General Embedded GUI systems, it has a very simple and efficient architecture and hardware graphics acceleration function.

Directfb depends on the existing kernel interface, that is, the frame buffer device (/dev/FB), to access the graphics processor. That is to say, direetfb needs a working frame buffer driver. The Linux kernel has a dedicated frame buffer driver to support certain graphics processors. For unsupported graphics processors, the kernel provides VE-SA frame buffering (which has some limitations ). Directfb uses the frame buffer device to do the following:

◆ Set the video working mode (resolution, color depth, timing)

◆ Ing video memory

If a video card is supported by CFB and the image processor's frame buffer driver is also available in the Linux kernel, directfb uses the frame buffer device to do the following extra work:

◆ Map the memory I/O port (this step is required if the acceleration driver is implemented in the user space. If it is implemented in the kernel space, no ing is required, but a corresponding driver interface is required. You can also write a new driver to implement the acceleration function)

◆ Disable the self-contained acceleration function of the frame buffer driver

Directfb acceleration Driver (control register access mapped to user space) the graphics processor I/O port that accesses the graphics memory ing submits commands to the graphics processor, and the graphics card implements the corresponding commands. That is to say, the real hardware acceleration is completely implemented in the user space. In this way, directfb can provide maximum hardware graphics acceleration for its supported graphics processors. These acceleration functions require the support of the graphics card controller. Some embedded display controllers do not have corresponding functions. An external video card is required.

The upper-level APL supports directfb, including xdirectfb, directfbgl, GTK +, dfbterm, dfbsee, dfbpoint, mythtv, QT on directfb, and SDL.

Directfb also requires a window manager. Directfb adopts a modular design and does not rely on a specific window manager. As long as the specific window manager implements the function defined in corewmfuncs in directfb, it can be mounted to directfb for running. Directfb comes with two window manager: Default and unique. You can use WM = xxx in the configuration file to select which one is used as the current window manager.

Through the above eight aspects, the concepts and relationships of X, X11, xfree86, WM, Kde, gnome, QT, QT/e, qtopia, directfb, framebuffer, and video card driver are introduced.

Note: This article is from the Lupa open-source community and is corrected by Chen oukan for an error in the description of the X11 version. I would like to thank the original author for providing us with such a valuable technical article.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.