Commit 66660d4c authored by Dave Airlie's avatar Dave Airlie

drm: add connector info/property for non-desktop displays [v2]

This adds the infrastructure needed to quirk displays
using edid and to mark them a non-desktop.

A non-desktop display is one which shouldn't normally be included
as a part of a desktop environment.

This is meant to cover head mounted devices like HTC Vive.

v2: Change description from non-standard to non-desktop, add docs
Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

fixup docs
parent 1cee3bce
...@@ -234,6 +234,10 @@ int drm_connector_init(struct drm_device *dev, ...@@ -234,6 +234,10 @@ int drm_connector_init(struct drm_device *dev,
config->link_status_property, config->link_status_property,
0); 0);
drm_object_attach_property(&connector->base,
config->non_desktop_property,
0);
if (drm_core_check_feature(dev, DRIVER_ATOMIC)) { if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
drm_object_attach_property(&connector->base, config->prop_crtc_id, 0); drm_object_attach_property(&connector->base, config->prop_crtc_id, 0);
} }
...@@ -763,6 +767,10 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, ...@@ -763,6 +767,10 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name,
* value of link-status is "GOOD". If something fails during or after modeset, * value of link-status is "GOOD". If something fails during or after modeset,
* the kernel driver may set this to "BAD" and issue a hotplug uevent. Drivers * the kernel driver may set this to "BAD" and issue a hotplug uevent. Drivers
* should update this value using drm_mode_connector_set_link_status_property(). * should update this value using drm_mode_connector_set_link_status_property().
* non_desktop:
* Indicates the output should be ignored for purposes of displaying a
* standard desktop environment or console. This is most likely because
* the output device is not rectilinear.
* *
* Connectors also have one standardized atomic property: * Connectors also have one standardized atomic property:
* *
...@@ -811,6 +819,11 @@ int drm_connector_create_standard_properties(struct drm_device *dev) ...@@ -811,6 +819,11 @@ int drm_connector_create_standard_properties(struct drm_device *dev)
return -ENOMEM; return -ENOMEM;
dev->mode_config.link_status_property = prop; dev->mode_config.link_status_property = prop;
prop = drm_property_create_bool(dev, DRM_MODE_PROP_IMMUTABLE, "non-desktop");
if (!prop)
return -ENOMEM;
dev->mode_config.non_desktop_property = prop;
return 0; return 0;
} }
...@@ -1194,6 +1207,10 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, ...@@ -1194,6 +1207,10 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
if (edid) if (edid)
size = EDID_LENGTH * (1 + edid->extensions); size = EDID_LENGTH * (1 + edid->extensions);
drm_object_property_set_value(&connector->base,
dev->mode_config.non_desktop_property,
connector->display_info.non_desktop);
ret = drm_property_replace_global_blob(dev, ret = drm_property_replace_global_blob(dev,
&connector->edid_blob_ptr, &connector->edid_blob_ptr,
size, size,
......
...@@ -82,6 +82,8 @@ ...@@ -82,6 +82,8 @@
#define EDID_QUIRK_FORCE_6BPC (1 << 10) #define EDID_QUIRK_FORCE_6BPC (1 << 10)
/* Force 10bpc */ /* Force 10bpc */
#define EDID_QUIRK_FORCE_10BPC (1 << 11) #define EDID_QUIRK_FORCE_10BPC (1 << 11)
/* Non desktop display (i.e. HMD) */
#define EDID_QUIRK_NON_DESKTOP (1 << 12)
struct detailed_mode_closure { struct detailed_mode_closure {
struct drm_connector *connector; struct drm_connector *connector;
...@@ -4393,7 +4395,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector, ...@@ -4393,7 +4395,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
} }
static void drm_add_display_info(struct drm_connector *connector, static void drm_add_display_info(struct drm_connector *connector,
struct edid *edid) struct edid *edid, u32 quirks)
{ {
struct drm_display_info *info = &connector->display_info; struct drm_display_info *info = &connector->display_info;
...@@ -4407,6 +4409,8 @@ static void drm_add_display_info(struct drm_connector *connector, ...@@ -4407,6 +4409,8 @@ static void drm_add_display_info(struct drm_connector *connector,
info->max_tmds_clock = 0; info->max_tmds_clock = 0;
info->dvi_dual = false; info->dvi_dual = false;
info->non_desktop = !!(quirks & EDID_QUIRK_NON_DESKTOP);
if (edid->revision < 3) if (edid->revision < 3)
return; return;
...@@ -4627,7 +4631,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) ...@@ -4627,7 +4631,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
* To avoid multiple parsing of same block, lets parse that map * To avoid multiple parsing of same block, lets parse that map
* from sink info, before parsing CEA modes. * from sink info, before parsing CEA modes.
*/ */
drm_add_display_info(connector, edid); drm_add_display_info(connector, edid, quirks);
/* /*
* EDID spec says modes should be preferred in this order: * EDID spec says modes should be preferred in this order:
......
...@@ -284,6 +284,11 @@ struct drm_display_info { ...@@ -284,6 +284,11 @@ struct drm_display_info {
* @hdmi: advance features of a HDMI sink. * @hdmi: advance features of a HDMI sink.
*/ */
struct drm_hdmi_info hdmi; struct drm_hdmi_info hdmi;
/**
* @non_desktop: Non desktop display (HMD).
*/
bool non_desktop;
}; };
int drm_display_info_set_bus_formats(struct drm_display_info *info, int drm_display_info_set_bus_formats(struct drm_display_info *info,
......
...@@ -728,6 +728,13 @@ struct drm_mode_config { ...@@ -728,6 +728,13 @@ struct drm_mode_config {
*/ */
struct drm_property *suggested_y_property; struct drm_property *suggested_y_property;
/**
* @non_desktop_property: Optional connector property with a hint
* that device isn't a standard display, and the console/desktop,
* should not be displayed on it.
*/
struct drm_property *non_desktop_property;
/* dumb ioctl parameters */ /* dumb ioctl parameters */
uint32_t preferred_depth, prefer_shadow; uint32_t preferred_depth, prefer_shadow;
......
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