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

Commit 03be7005 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'topic/drm-misc-2015-03-10' of git://anongit.freedesktop.org/drm-intel into drm-next

Another pile of misc drm patches all over, mostly polish for atomic. Last
minute rebase was to avoid the broken merge.

* tag 'topic/drm-misc-2015-03-10' of git://anongit.freedesktop.org/drm-intel:
  drm: Check in setcrtc if the primary plane supports the fb pixel format
  drm: Lighten sysfs connector 'status'
  drm/plane-helper: unexport drm_primary_helper_create_plane
  drm: Share plane pixel format check code between legacy and atomic
  drm: Fix trivial typos in comments
  drm/dp: add DPCD definitions from eDP 1.4
  drm/dp: add DPCD definitions from DP 1.1 and 1.2a
  drm: Fixup racy refcounting in plane_force_disable
  drm/i915: Rotation property is now handled in DRM core
  drm: Complete moving rotation property to core
  drm/dp: add DPCD definitions from eDP 1.2
  drm/dp: indentation and ordering cleanups
  drm/atomic-helper: Fix kerneldoc for prepare_planes
  drm: Remove redundant code in the getencoder ioctl
parents 3a656b54 7eb5f302
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -450,6 +450,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
		*val = state->src_w;
	} else if (property == config->prop_src_h) {
		*val = state->src_h;
	} else if (property == config->rotation_property) {
		*val = state->rotation;
	} else if (plane->funcs->atomic_get_property) {
		return plane->funcs->atomic_get_property(plane, state, property, val);
	} else {
@@ -473,7 +475,7 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
		struct drm_plane_state *state)
{
	unsigned int fb_width, fb_height;
	unsigned int i;
	int ret;

	/* either *both* CRTC and FB must be set, or neither */
	if (WARN_ON(state->crtc && !state->fb)) {
@@ -495,13 +497,11 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
	}

	/* Check whether this plane supports the fb pixel format. */
	for (i = 0; i < plane->format_count; i++)
		if (state->fb->pixel_format == plane->format_types[i])
			break;
	if (i == plane->format_count) {
	ret = drm_plane_check_pixel_format(plane, state->fb->pixel_format);
	if (ret) {
		DRM_DEBUG_ATOMIC("Invalid pixel format %s\n",
				 drm_get_format_name(state->fb->pixel_format));
		return -EINVAL;
		return ret;
	}

	/* Give drivers some help against integer overflows */
+2 −2
Original line number Diff line number Diff line
@@ -1096,9 +1096,9 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
 */

/**
 * drm_atomic_helper_prepare_planes - prepare plane resources after commit
 * drm_atomic_helper_prepare_planes - prepare plane resources before commit
 * @dev: DRM device
 * @state: atomic state object with old state structures
 * @state: atomic state object with new state structures
 *
 * This function prepares plane state, specifically framebuffers, for the new
 * configuration. If any failure is encountered this function will call
+41 −20
Original line number Diff line number Diff line
@@ -524,17 +524,6 @@ void drm_framebuffer_reference(struct drm_framebuffer *fb)
}
EXPORT_SYMBOL(drm_framebuffer_reference);

static void drm_framebuffer_free_bug(struct kref *kref)
{
	BUG();
}

static void __drm_framebuffer_unreference(struct drm_framebuffer *fb)
{
	DRM_DEBUG("%p: FB ID: %d (%d)\n", fb, fb->base.id, atomic_read(&fb->refcount.refcount));
	kref_put(&fb->refcount, drm_framebuffer_free_bug);
}

/**
 * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr
 * @fb: fb to unregister
@@ -1319,7 +1308,7 @@ void drm_plane_force_disable(struct drm_plane *plane)
		return;
	}
	/* disconnect the plane from the fb and crtc: */
	__drm_framebuffer_unreference(plane->old_fb);
	drm_framebuffer_unreference(plane->old_fb);
	plane->old_fb = NULL;
	plane->fb = NULL;
	plane->crtc = NULL;
@@ -2285,8 +2274,6 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
	crtc = drm_encoder_get_crtc(encoder);
	if (crtc)
		enc_resp->crtc_id = crtc->base.id;
	else if (encoder->crtc)
		enc_resp->crtc_id = encoder->crtc->base.id;
	else
		enc_resp->crtc_id = 0;
	drm_modeset_unlock(&dev->mode_config.connection_mutex);
@@ -2421,6 +2408,27 @@ int drm_mode_getplane(struct drm_device *dev, void *data,
	return 0;
}

/**
 * drm_plane_check_pixel_format - Check if the plane supports the pixel format
 * @plane: plane to check for format support
 * @format: the pixel format
 *
 * Returns:
 * Zero of @plane has @format in its list of supported pixel formats, -EINVAL
 * otherwise.
 */
int drm_plane_check_pixel_format(const struct drm_plane *plane, u32 format)
{
	unsigned int i;

	for (i = 0; i < plane->format_count; i++) {
		if (format == plane->format_types[i])
			return 0;
	}

	return -EINVAL;
}

/*
 * setplane_internal - setplane handler for internal callers
 *
@@ -2441,7 +2449,6 @@ static int __setplane_internal(struct drm_plane *plane,
{
	int ret = 0;
	unsigned int fb_width, fb_height;
	unsigned int i;

	/* No fb means shut it down */
	if (!fb) {
@@ -2464,13 +2471,10 @@ static int __setplane_internal(struct drm_plane *plane,
	}

	/* Check whether this plane supports the fb pixel format. */
	for (i = 0; i < plane->format_count; i++)
		if (fb->pixel_format == plane->format_types[i])
			break;
	if (i == plane->format_count) {
	ret = drm_plane_check_pixel_format(plane, fb->pixel_format);
	if (ret) {
		DRM_DEBUG_KMS("Invalid pixel format %s\n",
			      drm_get_format_name(fb->pixel_format));
		ret = -EINVAL;
		goto out;
	}

@@ -2794,6 +2798,23 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,

		drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);

		/*
		 * Check whether the primary plane supports the fb pixel format.
		 * Drivers not implementing the universal planes API use a
		 * default formats list provided by the DRM core which doesn't
		 * match real hardware capabilities. Skip the check in that
		 * case.
		 */
		if (!crtc->primary->format_default) {
			ret = drm_plane_check_pixel_format(crtc->primary,
							   fb->pixel_format);
			if (ret) {
				DRM_DEBUG_KMS("Invalid pixel format %s\n",
					drm_get_format_name(fb->pixel_format));
				goto out;
			}
		}

		ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y,
					      mode, fb);
		if (ret)
+2 −2
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay,
		hblank = drm_mode->hdisplay * hblank_percentage /
			 (100 * HV_FACTOR - hblank_percentage);
		hblank -= hblank % (2 * CVT_H_GRANULARITY);
		/* 14. find the total pixes per line */
		/* 14. find the total pixels per line */
		drm_mode->htotal = drm_mode->hdisplay + hblank;
		drm_mode->hsync_end = drm_mode->hdisplay + hblank / 2;
		drm_mode->hsync_start = drm_mode->hsync_end -
@@ -1209,7 +1209,7 @@ EXPORT_SYMBOL(drm_mode_connector_list_update);
 *	<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]
 *
 * The intermediate drm_cmdline_mode structure is required to store additional
 * options from the command line modline like the force-enabel/disable flag.
 * options from the command line modline like the force-enable/disable flag.
 *
 * Returns:
 * True if a valid modeline has been parsed, false otherwise.
+9 −22
Original line number Diff line number Diff line
@@ -344,20 +344,7 @@ const struct drm_plane_funcs drm_primary_helper_funcs = {
};
EXPORT_SYMBOL(drm_primary_helper_funcs);

/**
 * drm_primary_helper_create_plane() - Create a generic primary plane
 * @dev: drm device
 * @formats: pixel formats supported, or NULL for a default safe list
 * @num_formats: size of @formats; ignored if @formats is NULL
 *
 * Allocates and initializes a primary plane that can be used with the primary
 * plane helpers.  Drivers that wish to use driver-specific plane structures or
 * provide custom handler functions may perform their own allocation and
 * initialization rather than calling this function.
 */
struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
						  const uint32_t *formats,
						  int num_formats)
static struct drm_plane *create_primary_plane(struct drm_device *dev)
{
	struct drm_plane *primary;
	int ret;
@@ -366,17 +353,18 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
	if (primary == NULL) {
		DRM_DEBUG_KMS("Failed to allocate primary plane\n");
		return NULL;
	}

	if (formats == NULL) {
		formats = safe_modeset_formats;
		num_formats = ARRAY_SIZE(safe_modeset_formats);
		/*
		 * Remove the format_default field from drm_plane when dropping
		 * this helper.
		 */
		primary->format_default = true;
	}

	/* possible_crtc's will be filled in later by crtc_init */
	ret = drm_universal_plane_init(dev, primary, 0,
				       &drm_primary_helper_funcs,
				       formats, num_formats,
				       safe_modeset_formats,
				       ARRAY_SIZE(safe_modeset_formats),
				       DRM_PLANE_TYPE_PRIMARY);
	if (ret) {
		kfree(primary);
@@ -385,7 +373,6 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,

	return primary;
}
EXPORT_SYMBOL(drm_primary_helper_create_plane);

/**
 * drm_crtc_init - Legacy CRTC initialization function
@@ -404,7 +391,7 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
{
	struct drm_plane *primary;

	primary = drm_primary_helper_create_plane(dev, NULL, 0);
	primary = create_primary_plane(dev);
	return drm_crtc_init_with_planes(dev, crtc, primary, NULL, funcs);
}
EXPORT_SYMBOL(drm_crtc_init);
Loading