Implementing the X Server
Posted: Sat May 14, 2022 2:10 pm
Does anyone here know of any tutorial/good resources for implementing the X server? Has anyone here done so?
Thanks
Thanks
The Place to Start for Operating System Developers
https://f.osdev.org/
I did extensive research and couldn't find anything, so I just asked in case I missed something.nullplan wrote:Still asking for tutorials?
I am looking to implement it from scratch, as a sort of learning excercise. My understanding was that the OS provided a network stack.iansjack wrote:Are you looking to implement it from scratch rather than porting it? In the latter case the source code is freely available - in the former you surely wouldn't want to follow a tutorial.
Presumably you have already implemented a TCP/IP stack?
You misunderstand. I wasn't asking if you had found any, I was asking why you with your multiple years of OS dev experience had not yet moved on to reading documentation instead of looking for someone else who read it, and then transcribed their understanding into an incomplete and possibly incorrect tutorial.PavelCheckov wrote:I did extensive research and couldn't find anything, so I just asked in case I missed something.
Bresenham's algorithm, but before you get there, you need a host of other things in place. For example, you need an idea of how to represent your clients in memory (on the frame buffer). X11 is a memory-conservative protocol, and allows the server to get by with remembering pretty much only coordinates of each window, but that is already a computationally interesting proposition. If a foreground window is moved, you need to tell the window that was moved where it was moved to, but you also need to tell all the windows behind it to update their contents. So how do you best determine which windows where behind it? Quadtrees may be a good answer here, but require a lot of thought to use well.PavelCheckov wrote:I am more interested in how X actually goes from XDrawLine to an actual line of pixels on screen.
It would still save me quite a bit of time in understanding the basics.nullplan wrote:You misunderstand. I wasn't asking if you had found any, I was asking why you with your multiple years of OS dev experience had not yet moved on to reading documentation instead of looking for someone else who read it, and then transcribed their understanding into an incomplete and possibly incorrect tutorial.
I figured that much out, I was more referring to actually displaying the pixel on the screen.nullplan wrote:Bresenham's algorithm
You probably should've started with that as your question; it can get frustrating when people ask broad questions like "how to implement an X server" because there is no simple answer and it is unclear at what level the question is aimed. (You have a bit of a history of asking such questions; I don't think you realise how frustrating it can be). If you ask the right question to begin with, it's better for everyone.PavelCheckov wrote:I figured that much out, I was more referring to actually displaying the pixel on the screen.
Thank you, I will keep that in mind when asking future questions. I apologize.davmac314 wrote:You probably should've started with that as your question; it can get frustrating when people ask broad questions like "how to implement an X server" because there is no simple answer and it is unclear at what level the question is aimed. (You have a bit of a history of asking such questions; I don't think you realise how frustrating it can be). If you ask the right question to begin with, it's better for everyone.PavelCheckov wrote:I figured that much out, I was more referring to actually displaying the pixel on the screen.
With that said, on Linux for instance this can be done via the framebuffer device (documentation is available, but not very comprehensive. I suggest searching for a examples).
Classic case of an x-y problem.davmac314 wrote:You probably should've started with that as your question; it can get frustrating when people ask broad questions like "how to implement an X server" because there is no simple answer and it is unclear at what level the question is aimed. (You have a bit of a history of asking such questions; I don't think you realise how frustrating it can be). If you ask the right question to begin with, it's better for everyone.
The closest I can think of is that someone implemented an Xlib compatibility layer for Haiku. They skipped the "build an X server" part by translating Xlib calls to Haiku's graphics API.Ringding wrote:I doubt that anyone was crazy enough to implement an X server during the last 3 decades, even large corporations. Everyone would just fork the Xorg code. I will likely be proven wrong quickly, but the point is that this would be a monstrous undertaking that you probably don’t want to get yourself into.
Thanks! Also, I noticed people referring to me as "Pavel", which I just want to put on the record is my username based on Checkov from Star Trek, because some people on here have assumed I'm Russian and that I don't speak English, neither of which are true (Slava Ukraini!).Voldemort wrote:Hi Pavel,
This seems like a well documented project which might help you in your quest.
https://github.com/ghaerr/microwindows
If you style yourself after a character, you should expect as much, Mr. Checkov. Do you know where I can find any nuclear wessels?PavelCheckov wrote:Thanks! Also, I noticed people referring to me as "Pavel", which I just want to put on the record is my username based on Checkov from Star Trek