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

Commit 2958cf0e authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'topic/drm-misc-2016-05-08' of git://anongit.freedesktop.org/drm-intel into drm-next

Refcounting is hard, so here's a quick pull request with the one-liner to
fix up i915. Otherwise just a few other small things I picked up. Plus the
regression fix from Marten for rmfb behaviour that lingered around forever
since no testers. Feel free to cherry-pick that over to drm-fixes, but
given that there's not many who seemed to have cared, meh.

* tag 'topic/drm-misc-2016-05-08' of git://anongit.freedesktop.org/drm-intel:
  drm/i915: Correctly refcount connectors in hw state readou
  drm/panel: Flesh out kerneldoc
  drm: Add gpu.tmpl docbook to MAINTAINERS entry
  drm/core: Do not preserve framebuffer on rmfb, v4.
  drm: Fix up markup fumble
  drm/fb_helper: Fix a few typos
parents fd50c3a0 8863dc7f
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -1682,6 +1682,12 @@ void intel_crt_init(struct drm_device *dev)
      </sect3>
      </sect3>
!Edrivers/gpu/drm/drm_bridge.c
!Edrivers/gpu/drm/drm_bridge.c
    </sect2>
    </sect2>
    <sect2>
      <title>Panel Helper Reference</title>
!Iinclude/drm/drm_panel.h
!Edrivers/gpu/drm/drm_panel.c
!Pdrivers/gpu/drm/drm_panel.c drm panel
    </sect2>
  </sect1>
  </sect1>


  <!-- Internals: kms properties -->
  <!-- Internals: kms properties -->
+1 −0
Original line number Original line Diff line number Diff line
@@ -3765,6 +3765,7 @@ T: git git://people.freedesktop.org/~airlied/linux
S:	Maintained
S:	Maintained
F:	drivers/gpu/drm/
F:	drivers/gpu/drm/
F:	drivers/gpu/vga/
F:	drivers/gpu/vga/
F:	Documentation/DocBook/gpu.*
F:	include/drm/
F:	include/drm/
F:	include/uapi/drm/
F:	include/uapi/drm/


+56 −7
Original line number Original line Diff line number Diff line
@@ -3462,6 +3462,24 @@ int drm_mode_addfb2(struct drm_device *dev,
	return 0;
	return 0;
}
}


struct drm_mode_rmfb_work {
	struct work_struct work;
	struct list_head fbs;
};

static void drm_mode_rmfb_work_fn(struct work_struct *w)
{
	struct drm_mode_rmfb_work *arg = container_of(w, typeof(*arg), work);

	while (!list_empty(&arg->fbs)) {
		struct drm_framebuffer *fb =
			list_first_entry(&arg->fbs, typeof(*fb), filp_head);

		list_del_init(&fb->filp_head);
		drm_framebuffer_remove(fb);
	}
}

/**
/**
 * drm_mode_rmfb - remove an FB from the configuration
 * drm_mode_rmfb - remove an FB from the configuration
 * @dev: drm device for the ioctl
 * @dev: drm device for the ioctl
@@ -3502,10 +3520,27 @@ int drm_mode_rmfb(struct drm_device *dev,
	list_del_init(&fb->filp_head);
	list_del_init(&fb->filp_head);
	mutex_unlock(&file_priv->fbs_lock);
	mutex_unlock(&file_priv->fbs_lock);


	/* we now own the reference that was stored in the fbs list */
	/* drop the reference we picked up in framebuffer lookup */
	drm_framebuffer_unreference(fb);
	drm_framebuffer_unreference(fb);


	/* drop the reference we picked up in framebuffer lookup */
	/*
	 * we now own the reference that was stored in the fbs list
	 *
	 * drm_framebuffer_remove may fail with -EINTR on pending signals,
	 * so run this in a separate stack as there's no way to correctly
	 * handle this after the fb is already removed from the lookup table.
	 */
	if (drm_framebuffer_read_refcount(fb) > 1) {
		struct drm_mode_rmfb_work arg;

		INIT_WORK_ONSTACK(&arg.work, drm_mode_rmfb_work_fn);
		INIT_LIST_HEAD(&arg.fbs);
		list_add_tail(&fb->filp_head, &arg.fbs);

		schedule_work(&arg.work);
		flush_work(&arg.work);
		destroy_work_on_stack(&arg.work);
	} else
		drm_framebuffer_unreference(fb);
		drm_framebuffer_unreference(fb);


	return 0;
	return 0;
@@ -3657,7 +3692,6 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
	return ret;
	return ret;
}
}



/**
/**
 * drm_fb_release - remove and free the FBs on this file
 * drm_fb_release - remove and free the FBs on this file
 * @priv: drm file for the ioctl
 * @priv: drm file for the ioctl
@@ -3672,6 +3706,9 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
void drm_fb_release(struct drm_file *priv)
void drm_fb_release(struct drm_file *priv)
{
{
	struct drm_framebuffer *fb, *tfb;
	struct drm_framebuffer *fb, *tfb;
	struct drm_mode_rmfb_work arg;

	INIT_LIST_HEAD(&arg.fbs);


	/*
	/*
	 * When the file gets released that means no one else can access the fb
	 * When the file gets released that means no one else can access the fb
@@ -3684,6 +3721,9 @@ void drm_fb_release(struct drm_file *priv)
	 * at it any more.
	 * at it any more.
	 */
	 */
	list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) {
	list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) {
		if (drm_framebuffer_read_refcount(fb) > 1) {
			list_move_tail(&fb->filp_head, &arg.fbs);
		} else {
			list_del_init(&fb->filp_head);
			list_del_init(&fb->filp_head);


			/* This drops the fpriv->fbs reference. */
			/* This drops the fpriv->fbs reference. */
@@ -3691,6 +3731,15 @@ void drm_fb_release(struct drm_file *priv)
		}
		}
	}
	}


	if (!list_empty(&arg.fbs)) {
		INIT_WORK_ONSTACK(&arg.work, drm_mode_rmfb_work_fn);

		schedule_work(&arg.work);
		flush_work(&arg.work);
		destroy_work_on_stack(&arg.work);
	}
}

/**
/**
 * drm_property_create - create a new property type
 * drm_property_create - create a new property type
 * @dev: drm device
 * @dev: drm device
+3 −3
Original line number Original line Diff line number Diff line
@@ -2177,8 +2177,8 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper)
 * cmdline option.
 * cmdline option.
 *
 *
 * The other option is to just disable fbdev emulation since very likely the
 * The other option is to just disable fbdev emulation since very likely the
 * first modest from userspace will crash in the same way, and is even easier to
 * first modeset from userspace will crash in the same way, and is even easier
 * debug. This can be done by setting the drm_kms_helper.fbdev_emulation=0
 * to debug. This can be done by setting the drm_kms_helper.fbdev_emulation=0
 * kernel cmdline option.
 * kernel cmdline option.
 *
 *
 * RETURNS:
 * RETURNS:
@@ -2223,7 +2223,7 @@ EXPORT_SYMBOL(drm_fb_helper_initial_config);
 * hotplug interrupt).
 * hotplug interrupt).
 *
 *
 * Note that drivers may call this even before calling
 * Note that drivers may call this even before calling
 * drm_fb_helper_initial_config but only aftert drm_fb_helper_init. This allows
 * drm_fb_helper_initial_config but only after drm_fb_helper_init. This allows
 * for a race-free fbcon setup and will make sure that the fbdev emulation will
 * for a race-free fbcon setup and will make sure that the fbdev emulation will
 * not miss any hotplug events.
 * not miss any hotplug events.
 *
 *
+61 −0
Original line number Original line Diff line number Diff line
@@ -30,12 +30,36 @@
static DEFINE_MUTEX(panel_lock);
static DEFINE_MUTEX(panel_lock);
static LIST_HEAD(panel_list);
static LIST_HEAD(panel_list);


/**
 * DOC: drm panel
 *
 * The DRM panel helpers allow drivers to register panel objects with a
 * central registry and provide functions to retrieve those panels in display
 * drivers.
 */

/**
 * drm_panel_init - initialize a panel
 * @panel: DRM panel
 *
 * Sets up internal fields of the panel so that it can subsequently be added
 * to the registry.
 */
void drm_panel_init(struct drm_panel *panel)
void drm_panel_init(struct drm_panel *panel)
{
{
	INIT_LIST_HEAD(&panel->list);
	INIT_LIST_HEAD(&panel->list);
}
}
EXPORT_SYMBOL(drm_panel_init);
EXPORT_SYMBOL(drm_panel_init);


/**
 * drm_panel_add - add a panel to the global registry
 * @panel: panel to add
 *
 * Add a panel to the global registry so that it can be looked up by display
 * drivers.
 *
 * Return: 0 on success or a negative error code on failure.
 */
int drm_panel_add(struct drm_panel *panel)
int drm_panel_add(struct drm_panel *panel)
{
{
	mutex_lock(&panel_lock);
	mutex_lock(&panel_lock);
@@ -46,6 +70,12 @@ int drm_panel_add(struct drm_panel *panel)
}
}
EXPORT_SYMBOL(drm_panel_add);
EXPORT_SYMBOL(drm_panel_add);


/**
 * drm_panel_remove - remove a panel from the global registry
 * @panel: DRM panel
 *
 * Removes a panel from the global registry.
 */
void drm_panel_remove(struct drm_panel *panel)
void drm_panel_remove(struct drm_panel *panel)
{
{
	mutex_lock(&panel_lock);
	mutex_lock(&panel_lock);
@@ -54,6 +84,18 @@ void drm_panel_remove(struct drm_panel *panel)
}
}
EXPORT_SYMBOL(drm_panel_remove);
EXPORT_SYMBOL(drm_panel_remove);


/**
 * drm_panel_attach - attach a panel to a connector
 * @panel: DRM panel
 * @connector: DRM connector
 *
 * After obtaining a pointer to a DRM panel a display driver calls this
 * function to attach a panel to a connector.
 *
 * An error is returned if the panel is already attached to another connector.
 *
 * Return: 0 on success or a negative error code on failure.
 */
int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
{
{
	if (panel->connector)
	if (panel->connector)
@@ -66,6 +108,15 @@ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
}
}
EXPORT_SYMBOL(drm_panel_attach);
EXPORT_SYMBOL(drm_panel_attach);


/**
 * drm_panel_detach - detach a panel from a connector
 * @panel: DRM panel
 *
 * Detaches a panel from the connector it is attached to. If a panel is not
 * attached to any connector this is effectively a no-op.
 *
 * Return: 0 on success or a negative error code on failure.
 */
int drm_panel_detach(struct drm_panel *panel)
int drm_panel_detach(struct drm_panel *panel)
{
{
	panel->connector = NULL;
	panel->connector = NULL;
@@ -76,6 +127,16 @@ int drm_panel_detach(struct drm_panel *panel)
EXPORT_SYMBOL(drm_panel_detach);
EXPORT_SYMBOL(drm_panel_detach);


#ifdef CONFIG_OF
#ifdef CONFIG_OF
/**
 * of_drm_find_panel - look up a panel using a device tree node
 * @np: device tree node of the panel
 *
 * Searches the set of registered panels for one that matches the given device
 * tree node. If a matching panel is found, return a pointer to it.
 *
 * Return: A pointer to the panel registered for the specified device tree
 * node or NULL if no panel matching the device tree node can be found.
 */
struct drm_panel *of_drm_find_panel(struct device_node *np)
struct drm_panel *of_drm_find_panel(struct device_node *np)
{
{
	struct drm_panel *panel;
	struct drm_panel *panel;
Loading