From: antirez <an...@in...> - 2001-05-15 09:16:15
|
On Tue, May 15, 2001 at 08:10:54AM +0200, Geert Uytterhoeven wrote: > On Mon, 14 May 2001, James Simmons wrote: > > > The other problem is that without a PACKED_PIXEL display all the > > > userspace currently available will not work. > > > > Their is not much you can do to get around this besides writing a native > > framebuffer :-). A emulation mode is way to slow. In theory you could this > > for atari and ilbm modes but it would go so sloooow. > > I've been thinking about this. I see 2 possible approaches for emulation: > > - Map the fake frame buffer read-only. Trap all write accesses and convert > between packed pixels and native format in the trap handler. Expensive due > to many context switches. > > - Map the fake frame buffer read-only. In the trap handler, make the page > writable and rerun the write. In a timer handler, convert all pages that > are writable and make them read-only again. Faster, but more visible delay > (however, if the timer handler runs sufficiently frequent you won't > notice). This is interesting IMHO. I tried to do something like this (i.e. to convert only the pages modified) using the dirty flag in the physical page, but experimenting problems: Instead to update all the video memory in the timer handler, vga256fb try to run all the pages checking for the dirty bit, if at least one page is dirty update the entire video memory. Then flush the TLB. As you can guess it's brain-dead since it can update just the page that changed, and it flushes all the entry from the TLB, but I stopped here because it works only for the graphic console, and not when I mmap the framebuffer from userspace. (you can see the code in the current vga256fb implementation but it's disabled by default by #ifdef, the feature is called SMARTUPDATE). I investigated a bit, and the problem seems that the dirty flag isn't unique: Both the no_page method or remap_page_range create a new page entry with a _different_ pte. Maybe with some hack I can create different pages entry with the pmd that points to the same pte, but this is broken anyway since not only the dirty flag will be unique, but also all the other flags :( But I guess that with the method you shown it can work, something like: - Map the fake frame buffer read-only. In the trap handler, make the page writable and set a bit in a bitmap. In the timer handler copy all the pages with the associated bit in the bitmap set to the real VGA memory (converting it from linear to planar of course), and remake the modified pages read-only. This is just what vga256fb do, but with the "update-only-the-modified-page" trick, that will save a lot of CPU all the times the only thing modified in the screen is the cursor, or the pointer, or nothing. The problem with this is that for a simple one-line scroll all the pages will be updated, and the trap called xres*yres/PAGE_SIZE times, so you optimized for all the times the console is idle, but it will be probably shower than the current vga256fb implementation for animations and so on. I'll try! cheers, Salvatore -- Salvatore Sanfilippo <an...@in...> http://www.kyuzz.org/antirez finger an...@te... for PGP key 28 52 F5 4A 49 65 34 29 - 1D 1B F6 DA 24 C7 12 BF |