suggested offset properties + qxl support
Subsystems (4)
Dave Airlie
maintainerThere was some discussion on spice irc channel somewhere last week about how best to take note of the x/y offsets that were suggested by the hosts into the guests, so that the guest can configured the monitors in the same layout as they are on the host side.
I think initially the kernel needs to just propogate the values to userspace, so I've created two properties. The X server and desktop environments should start to use these properties to set things correctly.
Dave.
_______________________________________________
Spice-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/spice-devel
Dave Airlie
maintainerPATCH 1/2 drm: add properties for suggested x/y offset for connectors.
From: Dave Airlie <[email protected]>
Virtual GPUs would like to give the guest some indication where on the screen the outputs are layed out. So far we only provide modes, these properties could be exposed to userspace so the desktop environment could use them as hints to set the correct offsets.
--- Documentation/DocBook/drm.tmpl | 17 ++++++++++++++++- drivers/gpu/drm/drm_crtc.c | 24 ++++++++++++++++++++++++ include/drm/drm_crtc.h | 5 +++++ 3 files changed, 45 insertions(+), 1 deletion(-)
Documentation/DocBook/drm.tmpl +16 -1
@@ -2507,7 +2507,7 @@ void intel_crt_init(struct drm_device *dev) <td valign="top" >Description/Restrictions</td> </tr> <tr> - <td rowspan="21" valign="top" >DRM</td> + <td rowspan="23" valign="top" >DRM</td> <td rowspan="2" valign="top" >Generic</td> <td valign="top" >“EDID”</td> <td valign="top" >BLOB | IMMUTABLE</td>
@@ -2638,6 +2638,21 @@ void intel_crt_init(struct drm_device *dev) <td valign="top" >TBD</td> </tr> <tr> + <td rowspan="2" valign="top" >Virtual GPU</td> + <td valign="top" >“suggested X”</td> + <td valign="top" >RANGE</td> + <td valign="top" >Min=0, Max=0xffffffff</td> + <td valign="top" >Connector</td> + <td valign="top" >property to suggest an X offset for a connector</td> + </tr> + <tr> + <td valign="top" >“suggested Y”</td> + <td valign="top" >RANGE</td> + <td valign="top" >Min=0, Max=0xffffffff</td> + <td valign="top" >Connector</td> + <td valign="top" >property to suggest an Y offset for a connector</td> + </tr> + <tr> <td rowspan="3" valign="top" >Optional</td> <td valign="top" >“scaling mode”</td> <td valign="top" >ENUM</td>
drivers/gpu/drm/drm_crtc.c +24 -0
@@ -1535,6 +1535,30 @@ int drm_mode_create_dirty_info_property(struct drm_device *dev) }EXPORT_SYMBOL (drm_mode_create_dirty_info_property); +/** +* drm_mode_create_suggested_offset_properties - create suggests offset properties +* @dev: DRM device +* +* Create the the suggested x/y offset property for connectors. +*/ +int drm_mode_create_suggested_offset_properties (struct drm_device *dev) +{ +if (dev->mode_config.suggested_x_property && dev->mode_config.suggested_y_property) +return 0 ; + + dev->mode_config.suggested_x_property = +drm_property_create_range (dev,DRM_MODE_PROP_IMMUTABLE ,"suggested_x" ,0 ,0xffffffff ); + + dev->mode_config.suggested_y_property = +drm_property_create_range (dev,DRM_MODE_PROP_IMMUTABLE ,"suggested_y" ,0 ,0xffffffff ); + +if (dev->mode_config.suggested_x_property ==NULL || + dev->mode_config.suggested_y_property ==NULL ) +return -ENOMEM ; +return 0 ; +} +EXPORT_SYMBOL (drm_mode_create_suggested_offset_properties); +static int drm_mode_group_init (struct drm_device *dev,struct drm_mode_group *group) {uint32_t total_objects =0 ;
include/drm/drm_crtc.h +5 -0
@@ -851,6 +851,10 @@ struct drm_mode_config {struct drm_property *aspect_ratio_property;struct drm_property *dirty_info_property; +/* properties for virtual machine layout */ +struct drm_property *suggested_x_property; +struct drm_property *suggested_y_property; +/* dumb ioctl parameters */ uint32_t preferred_depth, prefer_shadow;
@@ -1046,6 +1050,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formatsextern int drm_mode_create_scaling_mode_property (struct drm_device *dev);extern int drm_mode_create_aspect_ratio_property (struct drm_device *dev);extern int drm_mode_create_dirty_info_property (struct drm_device *dev); +extern int drm_mode_create_suggested_offset_properties (struct drm_device *dev);extern int drm_mode_connector_attach_encoder (struct drm_connector *connector,struct drm_encoder *encoder);
Signature · 6 lines
1.9.3 _______________________________________________ Spice-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/spice-devel
Dave Airlie
maintainerPATCH 2/2 drm/qxl: use suggested x/y offset properties to pass guest prefs
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This passes the guest preferences for a where to place the outputs through to userspace. Userspace would need to be updated to take note of this information, X server and GNOME.
--- drivers/gpu/drm/qxl/qxl_display.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/qxl/qxl_display.c +28 -0
@@ -100,14 +100,37 @@ static int qxl_display_copy_rom_client_monitors_config(struct qxl_device *qdev)return 0 ; } +static void qxl_update_offset_props (struct qxl_device *qdev) +{ +struct drm_device *dev = qdev->ddev; +struct drm_connector *connector; +struct qxl_output *output; +struct qxl_head *head; + +list_for_each_entry (connector, &dev->mode_config.connector_list, head) { + output =drm_connector_to_qxl_output (connector); + + head = &qdev->client_monitors_config->heads[output->index]; + +drm_object_property_set_value (&connector->base, + dev->mode_config.suggested_x_property, head->x); +drm_object_property_set_value (&connector->base, + dev->mode_config.suggested_y_property, head->y); + } +} +void qxl_display_read_client_monitors_config (struct qxl_device *qdev) { +struct drm_device *dev = qdev->ddev;while (qxl_display_copy_rom_client_monitors_config (qdev)) {qxl_io_log (qdev,"failed crc check for client_monitors_config," " retrying\n" ); } +drm_modeset_lock_all (dev); +qxl_update_offset_props (qdev); +drm_modeset_unlock_all (dev);if (!drm_helper_hpd_irq_event (qdev->ddev)) {/* notify that the monitor configuration changed, to adjust at the arbitrary resolution */
@@ -951,6 +974,10 @@ static int qdev_output_init(struct drm_device *dev, int num_output)drm_object_attach_property (&connector->base, qdev->hotplug_mode_update_property,0 ); +drm_object_attach_property (&connector->base, + dev->mode_config.suggested_x_property,0 ); +drm_object_attach_property (&connector->base, + dev->mode_config.suggested_y_property,0 );drm_connector_register (connector);return 0 ; }
@@ -1064,6 +1091,7 @@ int qxl_modeset_init(struct qxl_device *qdev) qdev->ddev->mode_config.fb_base = qdev->vram_base; +drm_mode_create_suggested_offset_properties (qdev->ddev);qxl_mode_create_hotplug_mode_update_property (qdev);for (i =0 ; i < qxl_num_crtc; ++i) {
Signature · 6 lines
1.9.3 _______________________________________________ Spice-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/spice-devel