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

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

Merge tag 'drm-intel-fixes-2014-06-06' of git://anongit.freedesktop.org/drm-intel into drm-next

> Bunch of stuff for 3.16 still:
> - Mipi dsi panel support for byt. Finally! From Shobhit&others. I've
>   squeezed this in since it's a regression compared to vbios and we've
>   been ridiculed about it a bit too often ...
> - connection_mutex deadlock fix in get_connector (only affects i915).
> - Core patches from Matt's primary plane from Matt Roper, I've pushed the
>   i915 stuff to 3.17.
> - vlv power well sequencing fixes from Jesse.
> - Fix for cursor size changes from Chris.
> - agpbusy fixes from Ville.
> - A few smaller things.
>

* tag 'drm-intel-fixes-2014-06-06' of git://anongit.freedesktop.org/drm-intel: (32 commits)
  drm/i915: BDW: Adding missing cursor offsets.
  drm: Fix getconnector connection_mutex locking
  drm/i915/bdw: Only use 2g GGTT for 32b platforms
  drm/i915: Nuke pipe A quirk on i830M
  drm/i915: fix display power sw state reporting
  drm/i915: Always apply cursor width changes
  drm/i915: tell the user if both KMS and UMS are disabled
  drm/plane-helper: Add drm_plane_helper_check_update() (v3)
  drm: Check CRTC compatibility in setplane
  drm/i915: use VBT to determine whether to enumerate the VGA port
  drm/i915: Don't WARN about ring idle bit on gen2
  drm/i915: Silence the WARN if the user tries to GTT mmap an incoherent object
  drm/i915: Move the C3 LP write bit setup to gen3_init_clock_gating() for KMS
  drm/i915: Enable interrupt-based AGPBUSY# enable on 85x
  drm/i915: Flip the sense of AGPBUSY_DIS bit
  drm/i915: Set AGPBUSY# bit in init_clock_gating
  drm/i915/vlv: add pll assertion when disabling DPIO common well
  drm/i915/vlv: move DPIO common reset de-assert into __vlv_set_power_well
  drm/i915/vlv: re-order power wells so DPIO common comes after TX
  drm/i915/vlv: move CRI refclk enable into __vlv_set_power_well
  ...
parents c7560f12 15d24aa5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2178,6 +2178,13 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
		goto out;
	}

	/* Check whether this plane is usable on this CRTC */
	if (!(plane->possible_crtcs & drm_crtc_mask(crtc))) {
		DRM_DEBUG_KMS("Invalid crtc for plane\n");
		ret = -EINVAL;
		goto out;
	}

	fb = drm_framebuffer_lookup(dev, plane_req->fb_id);
	if (!fb) {
		DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
+95 −36
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@

#include <linux/list.h>
#include <drm/drmP.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_rect.h>
#include <drm/drm_plane_helper.h>

@@ -73,6 +74,79 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
	return count;
}

/**
 * drm_plane_helper_check_update() - Check plane update for validity
 * @plane: plane object to update
 * @crtc: owning CRTC of owning plane
 * @fb: framebuffer to flip onto plane
 * @src: source coordinates in 16.16 fixed point
 * @dest: integer destination coordinates
 * @clip: integer clipping coordinates
 * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
 * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
 * @can_position: is it legal to position the plane such that it
 *                doesn't cover the entire crtc?  This will generally
 *                only be false for primary planes.
 * @can_update_disabled: can the plane be updated while the crtc
 *                       is disabled?
 * @visible: output parameter indicating whether plane is still visible after
 *           clipping
 *
 * Checks that a desired plane update is valid.  Drivers that provide
 * their own plane handling rather than helper-provided implementations may
 * still wish to call this function to avoid duplication of error checking
 * code.
 *
 * RETURNS:
 * Zero if update appears valid, error code on failure
 */
int drm_plane_helper_check_update(struct drm_plane *plane,
				    struct drm_crtc *crtc,
				    struct drm_framebuffer *fb,
				    struct drm_rect *src,
				    struct drm_rect *dest,
				    const struct drm_rect *clip,
				    int min_scale,
				    int max_scale,
				    bool can_position,
				    bool can_update_disabled,
				    bool *visible)
{
	int hscale, vscale;

	if (!crtc->enabled && !can_update_disabled) {
		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
		return -EINVAL;
	}

	/* Check scaling */
	hscale = drm_rect_calc_hscale(src, dest, min_scale, max_scale);
	vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale);
	if (hscale < 0 || vscale < 0) {
		DRM_DEBUG_KMS("Invalid scaling of plane\n");
		return -ERANGE;
	}

	*visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
	if (!*visible)
		/*
		 * Plane isn't visible; some drivers can handle this
		 * so we just return success here.  Drivers that can't
		 * (including those that use the primary plane helper's
		 * update function) will return an error from their
		 * update_plane handler.
		 */
		return 0;

	if (!can_position && !drm_rect_equals(dest, clip)) {
		DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
		return -EINVAL;
	}

	return 0;
}
EXPORT_SYMBOL(drm_plane_helper_check_update);

/**
 * drm_primary_helper_update() - Helper for primary plane update
 * @plane: plane object to update
@@ -121,57 +195,42 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
		.x = src_x >> 16,
		.y = src_y >> 16,
	};
	struct drm_rect src = {
		.x1 = src_x,
		.y1 = src_y,
		.x2 = src_x + src_w,
		.y2 = src_y + src_h,
	};
	struct drm_rect dest = {
		.x1 = crtc_x,
		.y1 = crtc_y,
		.x2 = crtc_x + crtc_w,
		.y2 = crtc_y + crtc_h,
	};
	struct drm_rect clip = {
	const struct drm_rect clip = {
		.x2 = crtc->mode.hdisplay,
		.y2 = crtc->mode.vdisplay,
	};
	struct drm_connector **connector_list;
	int num_connectors, ret;
	bool visible;

	if (!crtc->enabled) {
		DRM_DEBUG_KMS("Cannot update primary plane of a disabled CRTC.\n");
		return -EINVAL;
	}

	/* Disallow subpixel positioning */
	if ((src_x | src_y | src_w | src_h) & SUBPIXEL_MASK) {
		DRM_DEBUG_KMS("Primary plane does not support subpixel positioning\n");
		return -EINVAL;
	}

	/* Primary planes are locked to their owning CRTC */
	if (plane->possible_crtcs != drm_crtc_mask(crtc)) {
		DRM_DEBUG_KMS("Cannot change primary plane CRTC\n");
		return -EINVAL;
	}

	/* Disallow scaling */
	src_w >>= 16;
	src_h >>= 16;
	if (crtc_w != src_w || crtc_h != src_h) {
		DRM_DEBUG_KMS("Can't scale primary plane\n");
		return -EINVAL;
	}

	/* Make sure primary plane covers entire CRTC */
	drm_rect_intersect(&dest, &clip);
	if (dest.x1 != 0 || dest.y1 != 0 ||
	    dest.x2 != crtc->mode.hdisplay || dest.y2 != crtc->mode.vdisplay) {
		DRM_DEBUG_KMS("Primary plane must cover entire CRTC\n");
		return -EINVAL;
	}

	/* Framebuffer must be big enough to cover entire plane */
	ret = drm_crtc_check_viewport(crtc, crtc_x, crtc_y, &crtc->mode, fb);
	ret = drm_plane_helper_check_update(plane, crtc, fb,
					    &src, &dest, &clip,
					    DRM_PLANE_HELPER_NO_SCALING,
					    DRM_PLANE_HELPER_NO_SCALING,
					    false, false, &visible);
	if (ret)
		return ret;

	if (!visible)
		/*
		 * Primary plane isn't visible.  Note that unless a driver
		 * provides their own disable function, this will just
		 * wind up returning -EINVAL to userspace.
		 */
		return plane->funcs->disable_plane(plane);

	/* Find current connectors for CRTC */
	num_connectors = get_connectors_for_crtc(crtc, NULL, 0);
	BUG_ON(num_connectors == 0);
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ i915-y += dvo_ch7017.o \
	  intel_dsi_cmd.o \
	  intel_dsi.o \
	  intel_dsi_pll.o \
	  intel_dsi_panel_vbt.o \
	  intel_dvo.o \
	  intel_hdmi.o \
	  intel_i2c.o \
+5 −1
Original line number Diff line number Diff line
@@ -2353,10 +2353,14 @@ static int i915_display_info(struct seq_file *m, void *unused)

			active = cursor_position(dev, crtc->pipe, &x, &y);
			seq_printf(m, "\tcursor visible? %s, position (%d, %d), addr 0x%08x, active? %s\n",
				   yesno(crtc->cursor_visible),
				   yesno(crtc->cursor_base),
				   x, y, crtc->cursor_addr,
				   yesno(active));
		}

		seq_printf(m, "\tunderrun reporting: cpu=%s pch=%s \n",
			   yesno(!crtc->cpu_fifo_underrun_disabled),
			   yesno(!crtc->pch_fifo_underrun_disabled));
	}

	seq_printf(m, "\n");
+11 −8
Original line number Diff line number Diff line
@@ -321,6 +321,7 @@ static const struct intel_device_info intel_broadwell_m_info = {
	.has_ddi = 1,
	.has_fbc = 1,
	GEN_DEFAULT_PIPEOFFSETS,
	IVB_CURSOR_OFFSETS,
};

static const struct intel_device_info intel_broadwell_gt3d_info = {
@@ -331,6 +332,7 @@ static const struct intel_device_info intel_broadwell_gt3d_info = {
	.has_ddi = 1,
	.has_fbc = 1,
	GEN_DEFAULT_PIPEOFFSETS,
	IVB_CURSOR_OFFSETS,
};

static const struct intel_device_info intel_broadwell_gt3m_info = {
@@ -811,17 +813,17 @@ int i915_reset(struct drm_device *dev)
		}

		/*
		 * FIXME: This is horribly race against concurrent pageflip and
		 * vblank wait ioctls since they can observe dev->irqs_disabled
		 * being false when they shouldn't be able to.
		 * FIXME: This races pretty badly against concurrent holders of
		 * ring interrupts. This is possible since we've started to drop
		 * dev->struct_mutex in select places when waiting for the gpu.
		 */
		drm_irq_uninstall(dev);
		drm_irq_install(dev, dev->pdev->irq);

		/* rps/rc6 re-init is necessary to restore state lost after the
		 * reset and the re-install of drm irq. Skip for ironlake per
		/*
		 * rps/rc6 re-init is necessary to restore state lost after the
		 * reset and the re-install of gt irqs. Skip for ironlake per
		 * previous concerns that it doesn't respond well to some forms
		 * of re-init after reset. */
		 * of re-init after reset.
		 */
		if (INTEL_INFO(dev)->gen > 5)
			intel_reset_gt_powersave(dev);

@@ -1583,6 +1585,7 @@ static int __init i915_init(void)
		driver.get_vblank_timestamp = NULL;
#ifndef CONFIG_DRM_I915_UMS
		/* Silently fail loading to not upset userspace. */
		DRM_DEBUG_DRIVER("KMS and UMS disabled.\n");
		return 0;
#endif
	}
Loading