summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/devvga.c
AgeCommit message (Collapse)Author
2022-08-18devvga: fix race condition between writes to vgactlqwx
to reproduce: for(i in `{seq 10}) echo softscreen off >/dev/vgactl
2020-12-27devvga: implement screen tilting, remove panning and overlayscinap_lenrek
Tilting allows using left/right rotated or invetrted display orientation. This can be changed at runtime such as: echo tilt right > /dev/vgactl This removes the old panning and vga overlays as they are only implemented with some ancient vga controllers.
2020-09-13kernel: massive pci code rewritecinap_lenrek
The new pci code is moved to port/pci.[hc] and shared by all ports. Each port has its own PCI controller implementation, providing the pcicfgrw*() functions for low level pci config space access. The locking for pcicfgrw*() is now done by the caller (only port/pci.c). Device drivers now need to include "../port/pci.h" in addition to "io.h". The new code now checks bridge windows and membars, while enumerating the bus, giving the pc driver a chance to re-assign them. This is needed because some UEFI implementations fail to assign the bars for some devices, so we need to do it outselfs. (See pcireservemem()). While working on this, it was discovered that the pci code assimed the smallest I/O bar size is 16 (pcibarsize()), which is wrong. I/O bars can be as small as 4 bytes. Bit 1 in an I/O bar is also reserved and should be masked off, making the port mask: port = bar & ~3;
2020-06-06devvga: use 64-bit physical addresses for framebuffercinap_lenrek
2020-04-10kernel: cleanup the software mouse cursor messcinap_lenrek
The swcursor used a 32x32 image for saving/restoring screen contents for no reason. Add a doflush argument to swcursorhide(), so that disabling software cursor with a double buffered softscreen is properly hidden. The doflush parameter should be set to 0 in all other cases as swcursordraw() will flushes both (current and previours) locations. Make sure swcursorinit() and swcursorhide() clear the visibility flag, even when gscreen is nil. Remove the cursor locking and just do everything within the drawlock. All cursor functions such as curson(), cursoff() and setcursor() will be called drawlock locked. This also means &cursor can be read. Fix devmouse cursor reads and writes. We now have the global cursor variable that is only modified under the drawlock. So copy under drawlock. Move the pc software cursor implementation into vgasoft driver, so screen.c does not need to handle it as a special case. Remove unused functions such as drawhasclients().
2018-08-25devvga: disable cursor on shutdown avoiding graphics glitches on rebootcinap_lenrek
2018-02-25kernel: properly handle bad attach specifierscinap_lenrek
- only accept decimal for numeric device id's - exclude negative device id's - device id's out of range yield Enodev
2017-12-23devvga: removing #v/vgabios, use /dev/realmodemem insteadcinap_lenrek
2017-12-03devvga: properly handle physical screen size and panningcinap_lenrek
- remove arbitrary limits on screen size, just check with badrect() - post resize when physgscreenr is changed (actualsize ctl command) - preserve physgscreenr across softscreen flag toggle - honor panning flag on resize - fix nil dereference in panning ctl command when scr->gscreen == nil - use clipr when drawing vga plan 9 console (vgascreenwin())
2017-04-02devvga: remove unused copy of checkport() functioncinap_lenrek
2017-04-02devvga: fix mistakecinap_lenrek
2017-04-02devvga: include hwgc in vgactl filecinap_lenrek
2017-03-18devmouse: refactor screen blanking logiccinap_lenrek
devmouse controls the screen blanking timeout, so move the code there avoiding cross calls between modules. the only function that needs to be provided is blankscreen(), which gets called with drawlock locked. the blank timeout is set thru /dev/mousectl now, so kernels without devvga can set it. blanking now only happens while /dev/mouse is read. so this avoids accidentally blanking the screen on cpu servers that do not have a mouse to unblank it.
2015-08-02pc, pc64: set *bootscreen= when framebuffer changescinap_lenrek
add bootscreenconf(VGAscr *) function, that is called whenever the framebuffer configuration is changed by devvga. that way, we can pass the current setting of the framebuffer to the new kernel when using /dev/reboot.
2015-01-16devvga: use uintptr for VGAscr.paddr and VGAscr.storagecinap_lenrek
some vga drivers use virtual addresses in VGAscr.storage, so has to be uintptr sized for amd64.
2015-01-03devvga: disable hardware blanking when switching drivers, check softscreencinap_lenrek
we have to reset hwblank when switching drivers to prevent the generic vgablank() to be called by blankscreen(). remove code setting hwblank from vga drivers as devvga will always force hwblank to be 1 or 0 depending on if the driver provides a native blanking routine. set hwaccel to 1 when the driver provides native fill and scroll routines independent of softscreen being disabled. this allows hw acceleration to be used when softscreen gets switched off.
2015-01-02devvga: better way to prevent blank hwaccel racecinap_lenrek
don't hold drawlock duing vga enable and disable, but just zero the function pointers under drawlock *before* disabling the vga device. holding the drawlock while calling out into enable and disable is not a good idea. with vgavesa, this might deadlock when userspace realemu tries to print in a rio window with vgavesa.
2015-01-02vgavesa: get rid of the vesa kproccinap_lenrek
in 9front, screen blanking is always initiated from process context, so there is no need for a kproc anymore. care has been taken for the race between vesadisable() and vesablank() by acquiering the drawlock prior calling scr->dev->enable() and scr->dev->disable(). this also has the side effect of accelerated fills and scrolls not being called during device disable.
2014-12-26vga, vesa: revert. this needs to be in aux/vga insteadftrvxmtrx
2014-12-26vga, vesa: scaling modesftrvxmtrx
At least on some NVIDIA cards the default scaling mode makes black borders visible on all sides, even on native resolution. This patch adds a generic "scaling MODE" command to vgactl and adds support for it on VESA through NVIDIA VBE OEM extension. It hasn't been tested on any other video cards, but shouldn't break anything as the scaling mode is only set on write to vgactl.
2013-04-14reduce software cursor flickeringcinap_lenrek
the software cursor starts flickering and reacts bumby if a process spends most of its time with drawlock acquired because the timer interrupt thats supposed to redraw the cursor fails to acquire the lock at the time the timer fires. instead of trying to draw the cursor on the screen from a timer interrupt 30 times per second, devmouse now creates a process calling cursoron() and cursoroff() when the cursor needs to be redrawn. this allows the swcursor to schedule a redraw while holding the drawlock in swcursoravoid() and cursoron()/cursoroff() are now able to wait for a qlock (drawlock) because they get called from process context. the overall responsiveness is also improved with this change as the cursor redraw rate isnt limited to 30 times a second anymore.
2013-01-03devvga: check if screen is setup before accepting hwgc vgactlcinap_lenrek
2013-01-02vga: make kernel vga drivers more stupidcinap_lenrek
previously, we had to maintain 3 sets of pci vid/did's: 1) in /lib/vgadb for detection 2) in the userspace driver in aux/vga 3) in the kernel mode driver this change makes the kernel mode driver more dumb in the cases where possible. we let userspace do the pci enumeration and if needed, it can set the pci address of the vga card. kernel mode drivers can assume to get the right pci device passed in scr->pci for enable() and linear() functions and just do very basic sanity checking before mapping framebuffer and mmio regions. vgalinearpciid() was removed as userspace is responsible to pick pci device. theres a new vgactl message "pcidev" where userspace can set the bus address. we initialize scr->pci in vgareset() to the first pci graphics card found. this should cover cases when an old aux/vga binary is used that doesnt use the new pcidev message. userspace drivers will now use the pci device that got a match from /lib/vgadb and skip ther own enumeration. this way, vga cards can be made to work by simply adding an entry in vgadb with no need to modify userspace or kernelspace drivers. this is not always possible if the driver derives information from the specific card model.
2012-07-18revert every commit, for great justice!cinap_lenrek
2012-07-18fixglenda
2012-07-18all your base are belong to usaiju
2012-07-18vga: softscreencinap_lenrek
allow the shadow framebuffer (softscreen) to be used with any vga driver, not just vesa. this removes the ugly scr->paddr = 0 hack employed by vesa driver to force softscreen and adds a softscreen vgactl message that can switch the feature on and off at runtime. softscreen can greatly improve graphics performance when bus reads are slow even tho it disables hardware acceleration.
2011-12-12kernel: fix inproper use of malloc/smalloccinap_lenrek
2011-08-23implement vesa screenblanking (issue #36)cinap_lenrek
2011-05-17reset screenimage in devvga "drawinit" command to account for actualsizecinap_lenrek
2011-04-11vesa-changescinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen