[PATCH] xf86VGAarbiter,vgaHW: Only wrap co-operating VGA drivers

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 12 14:16:58 PDT 2013


On Thu, Sep 12, 2013 at 11:55:57PM +0300, Ville Syrjälä wrote:
> On Thu, Sep 12, 2013 at 12:37:44PM +0100, Chris Wilson wrote:
> > Presently, we wrap every single operation on every driver if the kernel
> > reports that there is more than one VGA capable device in the system.
> > This is irrespective of whether VGA is being used by any driver, and
> > causes a significant performance impact (4-5x) for CPU bound operations.
> > 
> > The approach taken in this patch is to first only enable VGA arbitration
> > for drivers that require VGA resources. This is detected by moving the
> > initialisation from the common xf86 code to the vgaHW module. This is
> > strictly an ABI break as any driver that directly uses VGA (i.e. without
> > using the vgaHW module) will need to make its own declaration of intent.
> > Secondly, we then only wrap the operations with vgaarb get/put for the
> > drivers that require VGA access. If we only have a single driver
> > requring VGA access, we just wrap Enter/LeaveVT and lock the VGA
> > arbiter for the entire duration that the Xserver is active.
> 
> It's not just VGA resource users that are affected. Let's consider a
> case where you have graphics cards A and B. A is pure VGA and needs VGA
> resources, B can do VGA but has a native driver, but it has no special
> way to disable VGA resource decoding other than flipping the PCI command
> register IO/mem space bits. Now if you tell the arbiter to permanently
> assign VGA resources to card A, driver for card B can no longer function.
> 
> So all drivers that don't have a permanent VGA opt out mechanism would
> need to be modified to register w/ the arbiter. But maybe that's OK?

I don't think we care about the situation where card B also has VGA and
tries to use VGA without telling the arbiter. That sounds like the
fundamental reason the aribter exists in the first place.

We do care about the situation where we do have more than one VGA device
in operation and registered with the arbiter. Within the same X server
it functions as before, around each operation we lock the active VGA
device. My question is whether you can have two Xservers run
concurrently using VGA without incurring a VT switch? If not, we make the
optimisation presented here - that is lock the VGA device for the ownership
of the current VT. Otherwise we just drop that portion of the patch, and
only drivers that use VGA are included in the arbitration process (but
the kernel's misleading vga_decode_count will incur extra overhead for a
solitary VGA device paired with a KMS driver).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the xorg-devel mailing list