[PATCH pciaccess 2/2] vgaarb: read back vga count when setting new decoding

Henry Zhao henry.zhao at oracle.com
Tue Jun 22 12:48:20 PDT 2010


On 06/22/10 03:25, Tiago Vignatti wrote:
> On Tue, Jun 22, 2010 at 04:15:37AM +0200, ext Henry Zhao wrote:
>    
>> On 06/21/10 19:04, Henry Zhao wrote:
>>      
>>> Decode kernel operation can also change vga refcount, so we need to
>>> read back
>>> the information when calling it.
>>>
>>> Signed-off-by: Tiago Vignatti<tiago.vignatti at nokia.com
>>> <http://lists.x.org/mailman/listinfo/xorg-devel>>
>>> ---
>>>   src/common_vgaarb.c |    7 +++++++
>>>   1 files changed, 7 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/src/common_vgaarb.c b/src/common_vgaarb.c
>>> index f09d513..c94b362 100644
>>> --- a/src/common_vgaarb.c
>>> +++ b/src/common_vgaarb.c
>>> @@ -263,6 +263,13 @@ pci_device_vgaarb_decodes(int new_vgaarb_rsrc)
>>>       ret = vgaarb_write(pci_sys->vgaarb_fd, buf, len);
>>>       if (ret == 0)
>>>           dev->vgaarb_rsrc = new_vgaarb_rsrc;
>>> +
>>> +    ret = read(pci_sys->vgaarb_fd, buf, BUFSIZE);
>>> +    if (ret<= 0)
>>> +        return -1;
>>> +
>>> +    parse_string_to_decodes_rsrc(buf,&pci_sys->vga_count, NULL);
>>> +
>>>       return ret;
>>>   }
>>>
>>>        
>> pci_device_vgaarb_decodes() is called from userland
>> xf86VGAarbiterDeviceDecodes(). How can it be related to decode
>> kernel operation ?  Or do we really need to get vga count change
>> every time when making a kernel call ?
>>      
> Not sure I understood what you wanted to say, but maybe this commit answer
> your questions:
>
>    

vga count change from kernel is a result of hotpluging (adding or
removing) vga devices. This is handled by pci_notify(), and eventually
vga_arbiter_add_pci_device() or vga_arbiter_del_pci_device(), which
update vga count.  Although registered clients are notified, but
not X server.  We probably need to explore another way to have
X server notified a more timely.

> http://cgit.freedesktop.org/~vignatti/xserver/commit/?h=vgaarb-fixes&id=f729a7b98535137311ab4cf6abc884bc0d771206
>    

This patch looks good.

Thanks.


-Henry


> Note that it's not applied in upstream.
>
>
> Cheers,
>
>               Tiago
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>    



More information about the xorg-devel mailing list