[PATCH 4/5] xfree86: vgaarb: fix device decoding interface to send resources type properly

Mark Kettenis mark.kettenis at xs4all.nl
Thu Jun 3 02:42:18 PDT 2010


> From: Tiago Vignatti <tiago.vignatti at nokia.com>
> Date: Thu,  3 Jun 2010 11:34:13 +0300
> 
> Right now, when there is more than one vide card on the machine, we're
> adopting a pessimistic approach and setting all cards to decode VGA legacy
> address.
> 
> Some cards may want to skip the arbitration and the only way to do so is
> through pci_device_vgaarb_decodes. Therefore, send the desired kind of
> resource instead force the worst case.
> 
> Note that xf86VGAarbiterDeviceDecodes is not being used so far by any
> open-source driver. Even so, API break.

Ah, I've wondered about this quite a bit while writing the VGA
arbitration code for the OpenBSD kernel.  The old interface didn't
make much sense to me.  I'm a little bit worried though that none of
the open source drivers uses this yet, since that means it is hard to
test this bit of code.

That said,

Reviewed-by: Mark Kettenis <kettenis at openbsd.org>

>  hw/xfree86/common/xf86VGAarbiter.c |    5 +++--
>  hw/xfree86/common/xf86VGAarbiter.h |    2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c
> index 8890606..776946a 100644
> --- a/hw/xfree86/common/xf86VGAarbiter.c
> +++ b/hw/xfree86/common/xf86VGAarbiter.c
> @@ -138,11 +138,12 @@ xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn)
>  }
>  
>  void
> -xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn)
> +xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc)
>  {
>      if (vga_no_arb)
>  	return;
> -    pci_device_vgaarb_decodes(VGA_ARB_RSRC_LEGACY_MEM | VGA_ARB_RSRC_LEGACY_IO);
> +    pci_device_vgaarb_set_target(pScrn->vgaDev);
> +    pci_device_vgaarb_decodes(rsrc);
>  }
>  
>  Bool
> diff --git a/hw/xfree86/common/xf86VGAarbiter.h b/hw/xfree86/common/xf86VGAarbiter.h
> index 904b6b0..de104a9 100644
> --- a/hw/xfree86/common/xf86VGAarbiter.h
> +++ b/hw/xfree86/common/xf86VGAarbiter.h
> @@ -40,7 +40,7 @@ extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn);
>  
>  /* allow a driver to remove itself from arbiter - really should be
>   * done in the kernel though */
> -extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn);
> +extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc);
>  /* DRI and arbiter are really not possible together,
>   * you really want to remove the card from arbitration if you can */
>  extern _X_EXPORT Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen);


More information about the xorg-devel mailing list