• Jonathon Jongsma's avatar
    Send display_id down to the vdagentd daemon · 5ad18905
    Jonathon Jongsma authored
    Add a display_id field to the structure that we use to send down the
    list of guest display resolutions to the vdagentd daemon. This allows us
    to map the spice display id to the proper X display for determining
    mouse locations, etc.
    
    In the case where we have an mjpeg plugin running in the streaming
    agent, we have two spice displays representing the same guest display.
    In that scenario, the session agent may maintain the following guest
    output mapping:
     spice channel 0 (QXL) => X output 0
     spice channel 1 (streaming-agent) => X output 0
    
    While this is not necessarily a supported scenario, it would be nice if
    the cursor input worked properly in this case. The root problem is that
    when the session agent sends down the guest xorg resolutions to the
    system daemon, it simply loops through the list of xorg displays, and
    for each X display it looks up the first spice display ID associated
    with it and sends that down to the daemon. In the scenario mentioned
    above, since there is only a single X display configured (albeit
    represented by two different spice displays), we would send down a
    single display resolution to the system daemon:
     - { width=1280, height=1024, x=0, y=0, display_id=0 }
    
    Notice that there is no entry for display_id=1. When the agent receives
    a cursor input message for display channel 1, that message will get
    passed to the systemn daemon, which will attempt to look up display_id 1
    in order to convert the event coordinates to global coordinates. Finding
    no entry for display_id=1, the mouse events do not work.
    
    In this patch, when we want to send the guest resolutions down to the
    system daemon, we still loop through the list of X outputs, but for each
    output we also loop through the guest output mapping table and send a
    resolution structure down to the daemon for each registered output
    mapping.  This means that in the previously mentioned scenario, we would
    send down the following information:
     - { width=1280, height=1024, x=0, y=0, display_id=0 }
     - { width=1280, height=1024, x=0, y=0, display_id=1 }
    
     This means that when the client sends a mouse event for display_id=1,
     the system daemon knows the coordinates of the guest display associated
     with that ID and can process the mouse event properly.
    Acked-by: Lukáš Hrázký's avatarLukáš Hrázký <lhrazky@redhat.com>
    Signed-off-by: default avatarJonathon Jongsma <jjongsma@redhat.com>
    5ad18905
vdagentd-proto.h 2.24 KB