[Spice-devel] [PATCH vdagent-win] vdagent: enable disabled monitor with default resolution

Christophe Fergeau cfergeau at redhat.com
Fri Apr 19 02:31:09 PDT 2013


On Thu, Apr 18, 2013 at 11:44:15PM +0300, agilboa at redhat.com wrote:
> On 04/18/2013 09:30 PM, Christophe Fergeau wrote:
> >Hey Arnon,
> >
> >On Thu, Apr 18, 2013 at 08:58:30PM +0300, Arnon Gilboa wrote:
> >>When enabling a disabled monitor, init_dev_mod() "failed to create DC",
> >>and therefore due to the custom resolution received, in set_displays()
> >>"No suitable mode found for display".
> >Looking at init_dev_mode(), I don't really think this is related to the
> >custom resolution. If I'm reading init_dev_mode() properly, the "failed to
> >create DC" error is returned before trying to use the custom resolution. My
> >guess would be that this function fails because the monitor is
> >disabled/turned off.
> sure, but when it's disabled -> you fail to create a DC -> cannot
> set a custom resolution when you enable it.

To my eyes, the root cause is that the monitor is disabled, and the way the
code is laid out does not cope well with disabled monitors.
After reading
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162617%28v=vs.85%29.aspx
I wonder if it would be enough to move the
LONG ret = ChangeDisplaySettingsEx(dev_info.DeviceName, &dev_mode, NULL,
                                   CDS_UPDATEREGISTRY | CDS_NORESET, NULL);

call from set_displays() to before setting the custom resolution with
ExtEscape. This ChangeDisplaySettingsEx call will be done with
DM_POSITION set in dev_mode->dmFields, and the link above says:
"To add a display monitor to a multiple-monitor system programmatically,
set DEVMODE.dmFields to DM_POSITION and specify a position (using
DEVMODE.dmPosition ) for the monitor you are adding " (I read this as 'this
call will enable the monitor')

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130419/547d6df2/attachment.pgp>


More information about the Spice-devel mailing list