[SeaBIOS] [PATCH 2/3] bochsvga: Implement vbe 15h function

Hiroshi Miura miurahr at linux.com
Tue Sep 18 02:28:49 CEST 2012


On 2012.09.16 17:46, Kevin O'Connor wrote:
> On Sun, Sep 16, 2012 at 01:03:18PM +0900, Hiroshi Miura wrote:
>> This patch adds the ability for the Bochs VGA ROM to return information
>> about a HD wide monitor.
>>
>> It is constructed from defitions at run time.
>>
> [...]
>> --- /dev/null
>> +++ b/vgasrc/bochsedid.c
>> @@ -0,0 +1,147 @@
>> +// VESA VBE EDID capability for virtual display
>> +//
>> +// Copyright (C) 2012  Hiroshi Miura <miurahr at linux.com>
>> +//
>> +// This file may be distributed under the terms of the GNU LGPLv3 license.
>> +
>> +#include "vbe.h" // VBE_CAPABILITY_8BIT_DAC
>> +#include "biosvar.h" // GET_GLOBAL
>> +#include "util.h" // dprintf
>> +#include "config.h" // CONFIG_*
>> +#include "bochsedid.h"
>> +
>> +int bochs_get_ddc_capabilities(u16 unit)
>> +{
>> +    if (unit != 0)
>> +        return -1;
>> +
>> +    return (1 << 8) | VBE_DDC1_PROTOCOL_SUPPORTED;
>> +}
>> +
[snip]
>> +
>> +int bochs_read_edid_block0(u16 unit, u16 block, u16 seg, void *data, u8 next)
>> +{
>> +    struct edid_info  *info = data;
>> +    int i;
>> +
>> +    memset_far(seg, info, 0, sizeof(*info));
[snip]
>> +    /* ext */
>> +    SET_FARVAR(seg, info->extensions, next);
>> +
>> +    /* checksum */
>> +    u8 sum = -checksum_far(get_global_seg(), info, sizeof(info));
>> +    SET_FARVAR(seg, info->checksum, sum);
>> +
>> +    return 0;
>> +}
>> +
>> +int bochs_read_edid(u16 unit, u16 block, u16 seg, void *data)
>> +{
>> +    if (unit != 0)
>> +        return -1;
>> +
>> +    switch (block) {
>> +    case 0:
>> +        return bochs_read_edid_block0(unit, block, seg, data, 0);
>> +    default:
>> +        return -1;
>> +    }
>> +}
> The patch looks okay to me.
>
> Out of curiousity, though, why not populate the edid block at init?
> Something like:
>
> struct edid_info BochsEDID VAR16;
>
> void bochs_setup_edid(void) {
>     ...
> }
>
> int bochs_read_edid(u16 unit, u16 block, u16 seg, void *data)
> {
>     if (unit != 0 || block != 0)
>         return -1;
>
>     memcpy_far(seg, data, get_global_seg(), &BochsEDID, sizeof(BochsEDID));
>     return 0;
> }

I think we need runtime generation of EDID when supporting following cases;

(a) terminal service
-Assume  that we use qemu-kvm and seabios/vgabios for Terminal service, (as same as Windows Server).
-Thin client that run VNC client connect.
-qemu may want to ask guest that new (virtual) display is connected and update its resolution.
  --qemu may trigger guest OS as if your note-PC triggered when connecting projector.
  --Guest OS request EDID of new (virtual) display
  -- seabios/vgabios ask qemu about preferable resolution.
  -- seabios/vgabios return EDID that offer resolution that is good for client.

(b) vnc client resolution change
- vnc client change its resolution.
- qemu may ask guest OS refresh its resolution.
- Seabios/vgabios report a preferred resolution as EDID.

If we don't need such feature (in future), populating the edid block at init is ok.

As Gred suggest me, we can add bochs api that offer preferable resolution, and use it for
above scenario, that may be  great.

I'm sorry I don't know how trigger guest os from host  when VNC client connect
or change its resolution.

Hiroshi




More information about the SeaBIOS mailing list