Writing hardware emulation is challenging and far from easy. Therefore, if you really want to do this, I would not start from scratch. In your case, I first start with a simpler one (because many of the libraries are already installed on the guest and host side): Implementing OpenGL transit for regular Linux through qemu. What do you need:
First you add a virtual GPU to qemu, which is also related to adding a new graphics output module that uses OpenGL (qemu still uses SDL). Then you create DRI / DRM drivers in the Linux kernel, which will run on the guest (Android uses its own graphics system, but for learning DRI / DRM in order), as well as in Mesa. On the host side, you should translate what comes from qemu in OpenGL calls. Since the host-side GPU does all the hard work, your DRI / DRM part will be minimal and just build a bridge.
source share