Commit 5bb2bbf5 authored by Dave Airlie's avatar Dave Airlie

drm: add properties for suggested x/y offset for connectors. (v2)

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.

v2: rename properties to be more consistent.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent baf698b0
...@@ -2539,7 +2539,7 @@ void intel_crt_init(struct drm_device *dev) ...@@ -2539,7 +2539,7 @@ void intel_crt_init(struct drm_device *dev)
<td valign="top" >Description/Restrictions</td> <td valign="top" >Description/Restrictions</td>
</tr> </tr>
<tr> <tr>
<td rowspan="21" valign="top" >DRM</td> <td rowspan="23" valign="top" >DRM</td>
<td rowspan="3" valign="top" >Generic</td> <td rowspan="3" valign="top" >Generic</td>
<td valign="top" >“EDID”</td> <td valign="top" >“EDID”</td>
<td valign="top" >BLOB | IMMUTABLE</td> <td valign="top" >BLOB | IMMUTABLE</td>
...@@ -2677,6 +2677,21 @@ void intel_crt_init(struct drm_device *dev) ...@@ -2677,6 +2677,21 @@ void intel_crt_init(struct drm_device *dev)
<td valign="top" >TBD</td> <td valign="top" >TBD</td>
</tr> </tr>
<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 rowspan="3" valign="top" >Optional</td>
<td valign="top" >“scaling mode”</td> <td valign="top" >“scaling mode”</td>
<td valign="top" >ENUM</td> <td valign="top" >ENUM</td>
......
...@@ -1529,6 +1529,30 @@ int drm_mode_create_dirty_info_property(struct drm_device *dev) ...@@ -1529,6 +1529,30 @@ int drm_mode_create_dirty_info_property(struct drm_device *dev)
} }
EXPORT_SYMBOL(drm_mode_create_dirty_info_property); 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) static int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
{ {
uint32_t total_objects = 0; uint32_t total_objects = 0;
......
...@@ -1038,6 +1038,10 @@ struct drm_mode_config { ...@@ -1038,6 +1038,10 @@ struct drm_mode_config {
struct drm_property *aspect_ratio_property; struct drm_property *aspect_ratio_property;
struct drm_property *dirty_info_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 */ /* dumb ioctl parameters */
uint32_t preferred_depth, prefer_shadow; uint32_t preferred_depth, prefer_shadow;
...@@ -1231,6 +1235,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, ...@@ -1231,6 +1235,7 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev,
extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); extern 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_aspect_ratio_property(struct drm_device *dev);
extern int drm_mode_create_dirty_info_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, extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
struct drm_encoder *encoder); struct drm_encoder *encoder);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment