Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c759606c authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-intel-next-2014-07-25-merged' of...

Merge tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm-intel into drm-next

Final feature pull for 3.17.

drm-intel-next-2014-07-25:
- Ditch UMS support (well just the config option for now)
- Prep work for future platforms (Sonika Jindal, Damien)
- runtime pm/soix fixes (Paulo, Jesse)
- psr tracking improvements, locking fixes, now enabled by default!
- rps fixes for chv (Deepak, Ville)
- drm core patches for rotation support (Ville, Sagar Kamble) - the i915 parts
  unfortunately didn't make it yet
- userptr fixes (Chris)
- minimum backlight brightness (Jani), acked long ago by Matthew Garret on irc -
  I've forgotten about this patch :(

QA is a bit unhappy about the DP MST stuff since it broke hpd testing a
bit, but otherwise looks sane. I've backmerged drm-next to resolve
conflicts with the mst stuff, which means the new tag itself doesn't
contain the overview as usual.

* tag 'drm-intel-next-2014-07-25-merged' of git://anongit.freedesktop.org/drm-intel: (75 commits)
  drm/i915/userptr: Keep spin_lock/unlock in the same block
  drm/i915: Allow overlapping userptr objects
  drm/i915: Ditch UMS config option
  drm/i915: respect the VBT minimum backlight brightness
  drm/i915: extract backlight minimum brightness from VBT
  drm/i915: Replace HAS_PCH_SPLIT which incorrectly lets some platforms in
  drm/i915: Returning from increase/decrease of pllclock when invalid
  drm/i915: Setting legacy palette correctly for different platforms
  drm/i915: Avoid incorrect returning for some platforms
  drm/i915: Writing proper check for reading of pipe status reg
  drm/i915: Returning the right VGA control reg for platforms
  drm/i915: Allowing changing of wm latencies for valid platforms
  drm/i915: Adding HAS_GMCH_DISPLAY macro
  drm/i915: Fix possible overflow when recording semaphore states.
  drm/i915: Do not unmap object unless no other VMAs reference it
  drm/i915: remove plane/cursor/pipe assertions from intel_crtc_disable
  drm/i915: Reorder ctx unref on ppgtt cleanup
  drm/i915/error: Check the potential ctx obj's vm
  drm/i915: Fix printing proper min/min/rpe values in debugfs
  drm/i915: BDW can also detect unclaimed registers
  ...
parents 2ee39452 4dac3edf
Loading
Loading
Loading
Loading
+25 −52
Original line number Diff line number Diff line
@@ -2508,7 +2508,7 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >Description/Restrictions</td>
	</tr>
	<tr>
	<td rowspan="20" valign="top" >DRM</td>
	<td rowspan="21" valign="top" >DRM</td>
	<td rowspan="2" valign="top" >Generic</td>
	<td valign="top" >“EDID”</td>
	<td valign="top" >BLOB | IMMUTABLE</td>
@@ -2639,7 +2639,7 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="2" valign="top" >Optional</td>
	<td rowspan="3" valign="top" >Optional</td>
	<td valign="top" >“scaling mode”</td>
	<td valign="top" >ENUM</td>
	<td valign="top" >{ "None", "Full", "Center", "Full aspect" }</td>
@@ -2647,6 +2647,15 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td valign="top" >"aspect ratio"</td>
	<td valign="top" >ENUM</td>
	<td valign="top" >{ "None", "4:3", "16:9" }</td>
	<td valign="top" >Connector</td>
	<td valign="top" >DRM property to set aspect ratio from user space app.
		This enum is made generic to allow addition of custom aspect
		ratios.</td>
	</tr>
	<tr>
	<td valign="top" >“dirty”</td>
	<td valign="top" >ENUM | IMMUTABLE</td>
	<td valign="top" >{ "Off", "On", "Annotate" }</td>
@@ -2655,7 +2664,7 @@ void intel_crt_init(struct drm_device *dev)
	</tr>
	<tr>
	<td rowspan="21" valign="top" >i915</td>
	<td rowspan="3" valign="top" >Generic</td>
	<td rowspan="2" valign="top" >Generic</td>
	<td valign="top" >"Broadcast RGB"</td>
	<td valign="top" >ENUM</td>
	<td valign="top" >{ "Automatic", "Full", "Limited 16:235" }</td>
@@ -2670,10 +2679,11 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td valign="top" >Standard name as in DRM</td>
	<td valign="top" >Standard type as in DRM</td>
	<td valign="top" >Standard value as in DRM</td>
	<td valign="top" >Standard Object as in DRM</td>
	<td rowspan="1" valign="top" >Plane</td>
	<td valign="top" >“rotation”</td>
	<td valign="top" >BITMASK</td>
	<td valign="top" >{ 0, "rotate-0" }, { 2, "rotate-180" }</td>
	<td valign="top" >Plane</td>
	<td valign="top" >TBD</td>
	</tr>
	<tr>
@@ -2805,8 +2815,8 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="3" valign="top" >CDV gma-500</td>
	<td rowspan="3" valign="top" >Generic</td>
	<td rowspan="2" valign="top" >CDV gma-500</td>
	<td rowspan="2" valign="top" >Generic</td>
	<td valign="top" >"Broadcast RGB"</td>
	<td valign="top" >ENUM</td>
	<td valign="top" >{ “Full”, “Limited 16:235” }</td>
@@ -2821,15 +2831,8 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td valign="top" >Standard name as in DRM</td>
	<td valign="top" >Standard type as in DRM</td>
	<td valign="top" >Standard value as in DRM</td>
	<td valign="top" >Standard Object as in DRM</td>
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="20" valign="top" >Poulsbo</td>
	<td rowspan="2" valign="top" >Generic</td>
	<td rowspan="19" valign="top" >Poulsbo</td>
	<td rowspan="1" valign="top" >Generic</td>
	<td valign="top" >“backlight”</td>
	<td valign="top" >RANGE</td>
	<td valign="top" >Min=0, Max=100</td>
@@ -2837,13 +2840,6 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td valign="top" >Standard name as in DRM</td>
	<td valign="top" >Standard type as in DRM</td>
	<td valign="top" >Standard value as in DRM</td>
	<td valign="top" >Standard Object as in DRM</td>
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="17" valign="top" >SDVO-TV</td>
	<td valign="top" >“mode”</td>
	<td valign="top" >ENUM</td>
@@ -3070,7 +3066,7 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="3" valign="top" >i2c/ch7006_drv</td>
	<td rowspan="2" valign="top" >i2c/ch7006_drv</td>
	<td valign="top" >Generic</td>
	<td valign="top" >“scale”</td>
	<td valign="top" >RANGE</td>
@@ -3079,14 +3075,7 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="2" valign="top" >TV</td>
	<td valign="top" >Standard names as in DRM</td>
	<td valign="top" >Standard types as in DRM</td>
	<td valign="top" >Standard Values as in DRM</td>
	<td valign="top" >Standard object as in DRM</td>
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="1" valign="top" >TV</td>
	<td valign="top" >“mode”</td>
	<td valign="top" >ENUM</td>
	<td valign="top" >{ "PAL", "PAL-M","PAL-N"}, ”PAL-Nc"
@@ -3095,7 +3084,7 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="16" valign="top" >nouveau</td>
	<td rowspan="15" valign="top" >nouveau</td>
	<td rowspan="6" valign="top" >NV10 Overlay</td>
	<td valign="top" >"colorkey"</td>
	<td valign="top" >RANGE</td>
@@ -3204,14 +3193,6 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td valign="top" >Generic</td>
	<td valign="top" >Standard name as in DRM</td>
	<td valign="top" >Standard type as in DRM</td>
	<td valign="top" >Standard value as in DRM</td>
	<td valign="top" >Standard Object as in DRM</td>
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="2" valign="top" >omap</td>
	<td rowspan="2" valign="top" >Generic</td>
	<td valign="top" >“rotation”</td>
@@ -3242,7 +3223,7 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="10" valign="top" >radeon</td>
	<td rowspan="9" valign="top" >radeon</td>
	<td valign="top" >DVI-I</td>
	<td valign="top" >“coherent”</td>
	<td valign="top" >RANGE</td>
@@ -3314,14 +3295,6 @@ void intel_crt_init(struct drm_device *dev)
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td valign="top" >Generic</td>
	<td valign="top" >Standard name as in DRM</td>
	<td valign="top" >Standard type as in DRM</td>
	<td valign="top" >Standard value as in DRM</td>
	<td valign="top" >Standard Object as in DRM</td>
	<td valign="top" >TBD</td>
	</tr>
	<tr>
	<td rowspan="3" valign="top" >rcar-du</td>
	<td rowspan="3" valign="top" >Generic</td>
	<td valign="top" >"alpha"</td>
+94 −4
Original line number Diff line number Diff line
@@ -182,6 +182,12 @@ static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] =
	{ DRM_MODE_SCALE_ASPECT, "Full aspect" },
};

static const struct drm_prop_enum_list drm_aspect_ratio_enum_list[] = {
	{ DRM_MODE_PICTURE_ASPECT_NONE, "Automatic" },
	{ DRM_MODE_PICTURE_ASPECT_4_3, "4:3" },
	{ DRM_MODE_PICTURE_ASPECT_16_9, "16:9" },
};

/*
 * Non-global properties, but "required" for certain connectors.
 */
@@ -1462,6 +1468,33 @@ int drm_mode_create_scaling_mode_property(struct drm_device *dev)
}
EXPORT_SYMBOL(drm_mode_create_scaling_mode_property);

/**
 * drm_mode_create_aspect_ratio_property - create aspect ratio property
 * @dev: DRM device
 *
 * Called by a driver the first time it's needed, must be attached to desired
 * connectors.
 *
 * Returns:
 * Zero on success, errno on failure.
 */
int drm_mode_create_aspect_ratio_property(struct drm_device *dev)
{
	if (dev->mode_config.aspect_ratio_property)
		return 0;

	dev->mode_config.aspect_ratio_property =
		drm_property_create_enum(dev, 0, "aspect ratio",
				drm_aspect_ratio_enum_list,
				ARRAY_SIZE(drm_aspect_ratio_enum_list));

	if (dev->mode_config.aspect_ratio_property == NULL)
		return -ENOMEM;

	return 0;
}
EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);

/**
 * drm_mode_create_dirty_property - create dirty property
 * @dev: DRM device
@@ -3476,19 +3509,28 @@ EXPORT_SYMBOL(drm_property_create_enum);
struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
					 int flags, const char *name,
					 const struct drm_prop_enum_list *props,
					 int num_values)
					 int num_props,
					 uint64_t supported_bits)
{
	struct drm_property *property;
	int i, ret;
	int i, ret, index = 0;
	int num_values = hweight64(supported_bits);

	flags |= DRM_MODE_PROP_BITMASK;

	property = drm_property_create(dev, flags, name, num_values);
	if (!property)
		return NULL;
	for (i = 0; i < num_props; i++) {
		if (!(supported_bits & (1ULL << props[i].type)))
			continue;

	for (i = 0; i < num_values; i++) {
		ret = drm_property_add_enum(property, i,
		if (WARN_ON(index >= num_values)) {
			drm_property_destroy(dev, property);
			return NULL;
		}

		ret = drm_property_add_enum(property, index++,
				      props[i].type,
				      props[i].name);
		if (ret) {
@@ -4936,6 +4978,36 @@ int drm_format_vert_chroma_subsampling(uint32_t format)
}
EXPORT_SYMBOL(drm_format_vert_chroma_subsampling);

/**
 * drm_rotation_simplify() - Try to simplify the rotation
 * @rotation: Rotation to be simplified
 * @supported_rotations: Supported rotations
 *
 * Attempt to simplify the rotation to a form that is supported.
 * Eg. if the hardware supports everything except DRM_REFLECT_X
 * one could call this function like this:
 *
 * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
 *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
 *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
 *
 * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
 * transforms the hardware supports, this function may not
 * be able to produce a supported transform, so the caller should
 * check the result afterwards.
 */
unsigned int drm_rotation_simplify(unsigned int rotation,
				   unsigned int supported_rotations)
{
	if (rotation & ~supported_rotations) {
		rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
		rotation = (rotation & ~0xf) | BIT((ffs(rotation & 0xf) + 1) % 4);
	}

	return rotation;
}
EXPORT_SYMBOL(drm_rotation_simplify);

/**
 * drm_mode_config_init - initialize DRM mode_configuration structure
 * @dev: DRM device
@@ -5054,3 +5126,21 @@ void drm_mode_config_cleanup(struct drm_device *dev)
	drm_modeset_lock_fini(&dev->mode_config.connection_mutex);
}
EXPORT_SYMBOL(drm_mode_config_cleanup);

struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
						       unsigned int supported_rotations)
{
	static const struct drm_prop_enum_list props[] = {
		{ DRM_ROTATE_0,   "rotate-0" },
		{ DRM_ROTATE_90,  "rotate-90" },
		{ DRM_ROTATE_180, "rotate-180" },
		{ DRM_ROTATE_270, "rotate-270" },
		{ DRM_REFLECT_X,  "reflect-x" },
		{ DRM_REFLECT_Y,  "reflect-y" },
	};

	return drm_property_create_bitmask(dev, 0, "rotation",
					   props, ARRAY_SIZE(props),
					   supported_rotations);
}
EXPORT_SYMBOL(drm_mode_create_rotation_property);
+8 −2
Original line number Diff line number Diff line
@@ -3776,8 +3776,14 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame,

	frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;

	/* Populate picture aspect ratio from CEA mode list */
	if (frame->video_code > 0)
	/*
	 * Populate picture aspect ratio from either
	 * user input (if specified) or from the CEA mode list.
	 */
	if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
		mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
		frame->picture_aspect = mode->picture_aspect_ratio;
	else if (frame->video_code > 0)
		frame->picture_aspect = drm_get_cea_aspect_ratio(
						frame->video_code);

+140 −0
Original line number Diff line number Diff line
@@ -293,3 +293,143 @@ void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point)
		DRM_DEBUG_KMS("%dx%d%+d%+d\n", w, h, r->x1, r->y1);
}
EXPORT_SYMBOL(drm_rect_debug_print);

/**
 * drm_rect_rotate - Rotate the rectangle
 * @r: rectangle to be rotated
 * @width: Width of the coordinate space
 * @height: Height of the coordinate space
 * @rotation: Transformation to be applied
 *
 * Apply @rotation to the coordinates of rectangle @r.
 *
 * @width and @height combined with @rotation define
 * the location of the new origin.
 *
 * @width correcsponds to the horizontal and @height
 * to the vertical axis of the untransformed coordinate
 * space.
 */
void drm_rect_rotate(struct drm_rect *r,
		     int width, int height,
		     unsigned int rotation)
{
	struct drm_rect tmp;

	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
		tmp = *r;

		if (rotation & BIT(DRM_REFLECT_X)) {
			r->x1 = width - tmp.x2;
			r->x2 = width - tmp.x1;
		}

		if (rotation & BIT(DRM_REFLECT_Y)) {
			r->y1 = height - tmp.y2;
			r->y2 = height - tmp.y1;
		}
	}

	switch (rotation & 0xf) {
	case BIT(DRM_ROTATE_0):
		break;
	case BIT(DRM_ROTATE_90):
		tmp = *r;
		r->x1 = tmp.y1;
		r->x2 = tmp.y2;
		r->y1 = width - tmp.x2;
		r->y2 = width - tmp.x1;
		break;
	case BIT(DRM_ROTATE_180):
		tmp = *r;
		r->x1 = width - tmp.x2;
		r->x2 = width - tmp.x1;
		r->y1 = height - tmp.y2;
		r->y2 = height - tmp.y1;
		break;
	case BIT(DRM_ROTATE_270):
		tmp = *r;
		r->x1 = height - tmp.y2;
		r->x2 = height - tmp.y1;
		r->y1 = tmp.x1;
		r->y2 = tmp.x2;
		break;
	default:
		break;
	}
}
EXPORT_SYMBOL(drm_rect_rotate);

/**
 * drm_rect_rotate_inv - Inverse rotate the rectangle
 * @r: rectangle to be rotated
 * @width: Width of the coordinate space
 * @height: Height of the coordinate space
 * @rotation: Transformation whose inverse is to be applied
 *
 * Apply the inverse of @rotation to the coordinates
 * of rectangle @r.
 *
 * @width and @height combined with @rotation define
 * the location of the new origin.
 *
 * @width correcsponds to the horizontal and @height
 * to the vertical axis of the original untransformed
 * coordinate space, so that you never have to flip
 * them when doing a rotatation and its inverse.
 * That is, if you do:
 *
 * drm_rotate(&r, width, height, rotation);
 * drm_rotate_inv(&r, width, height, rotation);
 *
 * you will always get back the original rectangle.
 */
void drm_rect_rotate_inv(struct drm_rect *r,
			 int width, int height,
			 unsigned int rotation)
{
	struct drm_rect tmp;

	switch (rotation & 0xf) {
	case BIT(DRM_ROTATE_0):
		break;
	case BIT(DRM_ROTATE_90):
		tmp = *r;
		r->x1 = width - tmp.y2;
		r->x2 = width - tmp.y1;
		r->y1 = tmp.x1;
		r->y2 = tmp.x2;
		break;
	case BIT(DRM_ROTATE_180):
		tmp = *r;
		r->x1 = width - tmp.x2;
		r->x2 = width - tmp.x1;
		r->y1 = height - tmp.y2;
		r->y2 = height - tmp.y1;
		break;
	case BIT(DRM_ROTATE_270):
		tmp = *r;
		r->x1 = tmp.y1;
		r->x2 = tmp.y2;
		r->y1 = height - tmp.x2;
		r->y2 = height - tmp.x1;
		break;
	default:
		break;
	}

	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
		tmp = *r;

		if (rotation & BIT(DRM_REFLECT_X)) {
			r->x1 = width - tmp.x2;
			r->x2 = width - tmp.x1;
		}

		if (rotation & BIT(DRM_REFLECT_Y)) {
			r->y1 = height - tmp.y2;
			r->y2 = height - tmp.y1;
		}
	}
}
EXPORT_SYMBOL(drm_rect_rotate_inv);
+0 −12
Original line number Diff line number Diff line
@@ -69,15 +69,3 @@ config DRM_I915_PRELIMINARY_HW_SUPPORT
	  option changes the default for that module option.

	  If in doubt, say "N".

config DRM_I915_UMS
	bool "Enable userspace modesetting on Intel hardware (DEPRECATED)"
	depends on DRM_I915 && BROKEN
	default n
	help
	  Choose this option if you still need userspace modesetting.

	  Userspace modesetting is deprecated for quite some time now, so
	  enable this only if you have ancient versions of the DDX drivers.

	  If in doubt, say "N".
Loading