Skip to content

Commit 5259c52

Browse files
committed
Merge branch 'drm-intel-next' of git://people.freedesktop.org/~danvet/drm-intel into drm-next
New feature pile for 3.12! Highlights: - Stereo/3d support for hdmi from Damien, both the drm core bits and the i915 integration. - Manual boost/deboost logic for gpu turbo (Chris) - Fixed up clock readout support for vlv (Chris). - Tons of little fixes and improvements for vlv in general (Chon Minng Lee and Jesse Barnes). - Power well support for the legacy vga plane (Ville). - DP impromevents from Jani. - Improvements to the Haswell modeset sequence (Ville+Paulo). - Haswell DDI improvements, using the VBT for some tuning values and to check the configuration (Paulo). - Tons of other small improvements and fixups. * 'drm-intel-next' of git://people.freedesktop.org/~danvet/drm-intel: (92 commits) drm/i915: Use adjusted_mode in the fastboot hack to disable pfit drm/i915: Add a more detailed comment about the set_base() fastboot hack drm/i915/vlv: Turn off power gate for BIOS-less system. drm/i915/vlv: reset DPIO on load and resume v2 drm/i915: Simplify PSR debugfs drm/i915: Tweak RPS thresholds to more aggressively downclock drm/i915: Boost RPS frequency for CPU stalls drm/i915: Fix __wait_seqno to use true infinite timeouts drm/i915: Add some missing steps to i915_driver_load error path drm/i915: Clean up the ring scaling calculations drm/i915: Don't populate pipe_src_{w,h} multiple times drm/i915: implement the Haswell mode set sequence workaround drm/i915: Disable/enable planes as the first/last thing during modeset on HSW i915/vlv: untangle integrated clock source handling v4 drm/i915: fix typo s/PatherPoint/PantherPoint/ drm/i915: Make intel_resume_power_well() static drm/i915: destroy connector sysfs files earlier drm/i915/dp: do not write DP_TRAINING_PATTERN_SET all the time drm/i915/dp: retry i2c-over-aux seven times on AUX DEFER drm/i915/vlv: reduce GT FIFO error info to a debug message ...
2 parents 6aba5b6 + 967ad7f commit 5259c52

46 files changed

Lines changed: 2268 additions & 1150 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/gpu/drm/drm_crtc.c‎

Lines changed: 66 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,9 @@ static int drm_crtc_convert_umode(struct drm_display_mode *out,
13191319
if (in->clock > INT_MAX || in->vrefresh > INT_MAX)
13201320
return -ERANGE;
13211321

1322+
if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
1323+
return -EINVAL;
1324+
13221325
out->clock = in->clock;
13231326
out->hdisplay = in->hdisplay;
13241327
out->hsync_start = in->hsync_start;
@@ -1581,6 +1584,19 @@ int drm_mode_getcrtc(struct drm_device *dev,
15811584
return ret;
15821585
}
15831586

1587+
static bool drm_mode_expose_to_userspace(const struct drm_display_mode *mode,
1588+
const struct drm_file *file_priv)
1589+
{
1590+
/*
1591+
* If user-space hasn't configured the driver to expose the stereo 3D
1592+
* modes, don't expose them.
1593+
*/
1594+
if (!file_priv->stereo_allowed && drm_mode_is_stereo(mode))
1595+
return false;
1596+
1597+
return true;
1598+
}
1599+
15841600
/**
15851601
* drm_mode_getconnector - get connector configuration
15861602
* @dev: drm device for the ioctl
@@ -1646,7 +1662,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
16461662

16471663
/* delayed so we get modes regardless of pre-fill_modes state */
16481664
list_for_each_entry(mode, &connector->modes, head)
1649-
mode_count++;
1665+
if (drm_mode_expose_to_userspace(mode, file_priv))
1666+
mode_count++;
16501667

16511668
out_resp->connector_id = connector->base.id;
16521669
out_resp->connector_type = connector->connector_type;
@@ -1668,6 +1685,9 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
16681685
copied = 0;
16691686
mode_ptr = (struct drm_mode_modeinfo __user *)(unsigned long)out_resp->modes_ptr;
16701687
list_for_each_entry(mode, &connector->modes, head) {
1688+
if (!drm_mode_expose_to_userspace(mode, file_priv))
1689+
continue;
1690+
16711691
drm_crtc_convert_to_umode(&u_mode, mode);
16721692
if (copy_to_user(mode_ptr + copied,
16731693
&u_mode, sizeof(u_mode))) {
@@ -2042,6 +2062,45 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
20422062
}
20432063
EXPORT_SYMBOL(drm_mode_set_config_internal);
20442064

2065+
/*
2066+
* Checks that the framebuffer is big enough for the CRTC viewport
2067+
* (x, y, hdisplay, vdisplay)
2068+
*/
2069+
static int drm_crtc_check_viewport(const struct drm_crtc *crtc,
2070+
int x, int y,
2071+
const struct drm_display_mode *mode,
2072+
const struct drm_framebuffer *fb)
2073+
2074+
{
2075+
int hdisplay, vdisplay;
2076+
2077+
hdisplay = mode->hdisplay;
2078+
vdisplay = mode->vdisplay;
2079+
2080+
if (drm_mode_is_stereo(mode)) {
2081+
struct drm_display_mode adjusted = *mode;
2082+
2083+
drm_mode_set_crtcinfo(&adjusted, CRTC_STEREO_DOUBLE);
2084+
hdisplay = adjusted.crtc_hdisplay;
2085+
vdisplay = adjusted.crtc_vdisplay;
2086+
}
2087+
2088+
if (crtc->invert_dimensions)
2089+
swap(hdisplay, vdisplay);
2090+
2091+
if (hdisplay > fb->width ||
2092+
vdisplay > fb->height ||
2093+
x > fb->width - hdisplay ||
2094+
y > fb->height - vdisplay) {
2095+
DRM_DEBUG_KMS("Invalid fb size %ux%u for CRTC viewport %ux%u+%d+%d%s.\n",
2096+
fb->width, fb->height, hdisplay, vdisplay, x, y,
2097+
crtc->invert_dimensions ? " (inverted)" : "");
2098+
return -ENOSPC;
2099+
}
2100+
2101+
return 0;
2102+
}
2103+
20452104
/**
20462105
* drm_mode_setcrtc - set CRTC configuration
20472106
* @dev: drm device for the ioctl
@@ -2089,7 +2148,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
20892148
DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);
20902149

20912150
if (crtc_req->mode_valid) {
2092-
int hdisplay, vdisplay;
20932151
/* If we have a mode we need a framebuffer. */
20942152
/* If we pass -1, set the mode with the currently bound fb */
20952153
if (crtc_req->fb_id == -1) {
@@ -2125,23 +2183,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
21252183

21262184
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
21272185

2128-
hdisplay = mode->hdisplay;
2129-
vdisplay = mode->vdisplay;
2130-
2131-
if (crtc->invert_dimensions)
2132-
swap(hdisplay, vdisplay);
2133-
2134-
if (hdisplay > fb->width ||
2135-
vdisplay > fb->height ||
2136-
crtc_req->x > fb->width - hdisplay ||
2137-
crtc_req->y > fb->height - vdisplay) {
2138-
DRM_DEBUG_KMS("Invalid fb size %ux%u for CRTC viewport %ux%u+%d+%d%s.\n",
2139-
fb->width, fb->height,
2140-
hdisplay, vdisplay, crtc_req->x, crtc_req->y,
2141-
crtc->invert_dimensions ? " (inverted)" : "");
2142-
ret = -ENOSPC;
2186+
ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y,
2187+
mode, fb);
2188+
if (ret)
21432189
goto out;
2144-
}
2190+
21452191
}
21462192

21472193
if (crtc_req->count_connectors == 0 && mode) {
@@ -3558,7 +3604,6 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
35583604
struct drm_framebuffer *fb = NULL, *old_fb = NULL;
35593605
struct drm_pending_vblank_event *e = NULL;
35603606
unsigned long flags;
3561-
int hdisplay, vdisplay;
35623607
int ret = -EINVAL;
35633608

35643609
if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS ||
@@ -3590,22 +3635,9 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
35903635
if (!fb)
35913636
goto out;
35923637

3593-
hdisplay = crtc->mode.hdisplay;
3594-
vdisplay = crtc->mode.vdisplay;
3595-
3596-
if (crtc->invert_dimensions)
3597-
swap(hdisplay, vdisplay);
3598-
3599-
if (hdisplay > fb->width ||
3600-
vdisplay > fb->height ||
3601-
crtc->x > fb->width - hdisplay ||
3602-
crtc->y > fb->height - vdisplay) {
3603-
DRM_DEBUG_KMS("Invalid fb size %ux%u for CRTC viewport %ux%u+%d+%d%s.\n",
3604-
fb->width, fb->height, hdisplay, vdisplay, crtc->x, crtc->y,
3605-
crtc->invert_dimensions ? " (inverted)" : "");
3606-
ret = -ENOSPC;
3638+
ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y, &crtc->mode, fb);
3639+
if (ret)
36073640
goto out;
3608-
}
36093641

36103642
if (crtc->fb->pixel_format != fb->pixel_format) {
36113643
DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");

‎drivers/gpu/drm/drm_crtc_helper.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ static void drm_mode_validate_flag(struct drm_connector *connector,
7676
{
7777
struct drm_display_mode *mode;
7878

79-
if (flags == (DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_INTERLACE))
79+
if (flags == (DRM_MODE_FLAG_DBLSCAN | DRM_MODE_FLAG_INTERLACE |
80+
DRM_MODE_FLAG_3D_MASK))
8081
return;
8182

8283
list_for_each_entry(mode, &connector->modes, head) {
@@ -86,6 +87,9 @@ static void drm_mode_validate_flag(struct drm_connector *connector,
8687
if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) &&
8788
!(flags & DRM_MODE_FLAG_DBLSCAN))
8889
mode->status = MODE_NO_DBLESCAN;
90+
if ((mode->flags & DRM_MODE_FLAG_3D_MASK) &&
91+
!(flags & DRM_MODE_FLAG_3D_MASK))
92+
mode->status = MODE_NO_STEREO;
8993
}
9094

9195
return;
@@ -175,6 +179,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
175179
mode_flags |= DRM_MODE_FLAG_INTERLACE;
176180
if (connector->doublescan_allowed)
177181
mode_flags |= DRM_MODE_FLAG_DBLSCAN;
182+
if (connector->stereo_allowed)
183+
mode_flags |= DRM_MODE_FLAG_3D_MASK;
178184
drm_mode_validate_flag(connector, mode_flags);
179185

180186
list_for_each_entry(mode, &connector->modes, head) {

‎drivers/gpu/drm/drm_drv.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
6969
DRM_IOCTL_DEF(DRM_IOCTL_GET_CLIENT, drm_getclient, DRM_UNLOCKED),
7070
DRM_IOCTL_DEF(DRM_IOCTL_GET_STATS, drm_getstats, DRM_UNLOCKED),
7171
DRM_IOCTL_DEF(DRM_IOCTL_GET_CAP, drm_getcap, DRM_UNLOCKED|DRM_RENDER_ALLOW),
72+
DRM_IOCTL_DEF(DRM_IOCTL_SET_CLIENT_CAP, drm_setclientcap, 0),
7273
DRM_IOCTL_DEF(DRM_IOCTL_SET_VERSION, drm_setversion, DRM_MASTER),
7374

7475
DRM_IOCTL_DEF(DRM_IOCTL_SET_UNIQUE, drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY),

0 commit comments

Comments
 (0)