Abstract:This paper presents a method to transplant Android's graphic system, SurfaceFlinger, to run on desktop Linux distribution's X Window System. SurfaceFlinger running on X can make UI of the Android applications, running as native processes in the desktop Android runtime, show in a window of X. Using Mesa as the OpenGL ES implementation and making Mesa EGL compatible with Android's native window, together with gralloc.drm.so module, the Android UI rendering process and SurfaceFlinger's graphic compositing process can be implemented by using the GPU for hardware acceleration. In addition, using X11's DRI2 extension to coordinate window of SurfaceFlinger with X Server's DDX driver, can avoid graphic buffer coping from GPU's dedicated memory to the system memory. In our experiment, the third-party 3D benchmark software San-Angeles can achieve 60FPS on variety GPUs. Compared with the existing method, the architecture of our method is more concise, efficient, and supportive of hardware acceleration.