forked from luck/tmp_suning_uos_patched
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
This commit is contained in:
commit
2958cf0ee2
|
@ -1671,17 +1671,23 @@ void intel_crt_init(struct drm_device *dev)
|
|||
!Pdrivers/gpu/drm/drm_crtc.c Tile group
|
||||
</sect2>
|
||||
<sect2>
|
||||
<title>Bridges</title>
|
||||
<title>Bridges</title>
|
||||
<sect3>
|
||||
<title>Overview</title>
|
||||
<title>Overview</title>
|
||||
!Pdrivers/gpu/drm/drm_bridge.c overview
|
||||
</sect3>
|
||||
<sect3>
|
||||
<title>Default bridge callback sequence</title>
|
||||
<title>Default bridge callback sequence</title>
|
||||
!Pdrivers/gpu/drm/drm_bridge.c bridge callbacks
|
||||
</sect3>
|
||||
!Edrivers/gpu/drm/drm_bridge.c
|
||||
</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>
|
||||
|
||||
<!-- Internals: kms properties -->
|
||||
|
|
|
@ -3765,6 +3765,7 @@ T: git git://people.freedesktop.org/~airlied/linux
|
|||
S: Maintained
|
||||
F: drivers/gpu/drm/
|
||||
F: drivers/gpu/vga/
|
||||
F: Documentation/DocBook/gpu.*
|
||||
F: include/drm/
|
||||
F: include/uapi/drm/
|
||||
|
||||
|
|
|
@ -3462,6 +3462,24 @@ int drm_mode_addfb2(struct drm_device *dev,
|
|||
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
|
||||
* @dev: drm device for the ioctl
|
||||
|
@ -3502,12 +3520,29 @@ int drm_mode_rmfb(struct drm_device *dev,
|
|||
list_del_init(&fb->filp_head);
|
||||
mutex_unlock(&file_priv->fbs_lock);
|
||||
|
||||
/* we now own the reference that was stored in the fbs list */
|
||||
drm_framebuffer_unreference(fb);
|
||||
|
||||
/* drop the reference we picked up in framebuffer lookup */
|
||||
drm_framebuffer_unreference(fb);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
return 0;
|
||||
|
||||
fail_unref:
|
||||
|
@ -3657,7 +3692,6 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* drm_fb_release - remove and free the FBs on this file
|
||||
* @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)
|
||||
{
|
||||
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
|
||||
|
@ -3684,10 +3721,22 @@ void drm_fb_release(struct drm_file *priv)
|
|||
* at it any more.
|
||||
*/
|
||||
list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) {
|
||||
list_del_init(&fb->filp_head);
|
||||
if (drm_framebuffer_read_refcount(fb) > 1) {
|
||||
list_move_tail(&fb->filp_head, &arg.fbs);
|
||||
} else {
|
||||
list_del_init(&fb->filp_head);
|
||||
|
||||
/* This drops the fpriv->fbs reference. */
|
||||
drm_framebuffer_unreference(fb);
|
||||
/* This drops the fpriv->fbs reference. */
|
||||
drm_framebuffer_unreference(fb);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2177,8 +2177,8 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper)
|
|||
* cmdline option.
|
||||
*
|
||||
* 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
|
||||
* debug. This can be done by setting the drm_kms_helper.fbdev_emulation=0
|
||||
* first modeset from userspace will crash in the same way, and is even easier
|
||||
* to debug. This can be done by setting the drm_kms_helper.fbdev_emulation=0
|
||||
* kernel cmdline option.
|
||||
*
|
||||
* RETURNS:
|
||||
|
@ -2223,7 +2223,7 @@ EXPORT_SYMBOL(drm_fb_helper_initial_config);
|
|||
* hotplug interrupt).
|
||||
*
|
||||
* 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
|
||||
* not miss any hotplug events.
|
||||
*
|
||||
|
|
|
@ -30,12 +30,36 @@
|
|||
static DEFINE_MUTEX(panel_lock);
|
||||
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)
|
||||
{
|
||||
INIT_LIST_HEAD(&panel->list);
|
||||
}
|
||||
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)
|
||||
{
|
||||
mutex_lock(&panel_lock);
|
||||
|
@ -46,6 +70,12 @@ int drm_panel_add(struct drm_panel *panel)
|
|||
}
|
||||
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)
|
||||
{
|
||||
mutex_lock(&panel_lock);
|
||||
|
@ -54,6 +84,18 @@ void drm_panel_remove(struct drm_panel *panel)
|
|||
}
|
||||
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)
|
||||
{
|
||||
if (panel->connector)
|
||||
|
@ -66,6 +108,15 @@ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector)
|
|||
}
|
||||
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)
|
||||
{
|
||||
panel->connector = NULL;
|
||||
|
@ -76,6 +127,16 @@ int drm_panel_detach(struct drm_panel *panel)
|
|||
EXPORT_SYMBOL(drm_panel_detach);
|
||||
|
||||
#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 *panel;
|
||||
|
|
|
@ -12032,11 +12032,16 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
|
|||
struct intel_connector *connector;
|
||||
|
||||
for_each_intel_connector(dev, connector) {
|
||||
if (connector->base.state->crtc)
|
||||
drm_connector_unreference(&connector->base);
|
||||
|
||||
if (connector->base.encoder) {
|
||||
connector->base.state->best_encoder =
|
||||
connector->base.encoder;
|
||||
connector->base.state->crtc =
|
||||
connector->base.encoder->crtc;
|
||||
|
||||
drm_connector_reference(&connector->base);
|
||||
} else {
|
||||
connector->base.state->best_encoder = NULL;
|
||||
connector->base.state->crtc = NULL;
|
||||
|
|
|
@ -672,7 +672,7 @@ struct drm_connector_helper_funcs {
|
|||
* fixed panel can also manually add specific modes using
|
||||
* drm_mode_probed_add(). Drivers which manually add modes should also
|
||||
* make sure that the @display_info, @width_mm and @height_mm fields of the
|
||||
* struct #drm_connector are filled in.
|
||||
* struct &drm_connector are filled in.
|
||||
*
|
||||
* Virtual drivers that just want some standard VESA mode with a given
|
||||
* resolution can call drm_add_modes_noedid(), and mark the preferred
|
||||
|
|
|
@ -75,6 +75,14 @@ struct drm_panel_funcs {
|
|||
struct display_timing *timings);
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_panel - DRM panel object
|
||||
* @drm: DRM device owning the panel
|
||||
* @connector: DRM connector that the panel is attached to
|
||||
* @dev: parent device of the panel
|
||||
* @funcs: operations that can be performed on the panel
|
||||
* @list: panel entry in registry
|
||||
*/
|
||||
struct drm_panel {
|
||||
struct drm_device *drm;
|
||||
struct drm_connector *connector;
|
||||
|
@ -85,6 +93,17 @@ struct drm_panel {
|
|||
struct list_head list;
|
||||
};
|
||||
|
||||
/**
|
||||
* drm_disable_unprepare - power off a panel
|
||||
* @panel: DRM panel
|
||||
*
|
||||
* Calling this function will completely power off a panel (assert the panel's
|
||||
* reset, turn off power supplies, ...). After this function has completed, it
|
||||
* is usually no longer possible to communicate with the panel until another
|
||||
* call to drm_panel_prepare().
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
static inline int drm_panel_unprepare(struct drm_panel *panel)
|
||||
{
|
||||
if (panel && panel->funcs && panel->funcs->unprepare)
|
||||
|
@ -93,6 +112,16 @@ static inline int drm_panel_unprepare(struct drm_panel *panel)
|
|||
return panel ? -ENOSYS : -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_panel_disable - disable a panel
|
||||
* @panel: DRM panel
|
||||
*
|
||||
* This will typically turn off the panel's backlight or disable the display
|
||||
* drivers. For smart panels it should still be possible to communicate with
|
||||
* the integrated circuitry via any command bus after this call.
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
static inline int drm_panel_disable(struct drm_panel *panel)
|
||||
{
|
||||
if (panel && panel->funcs && panel->funcs->disable)
|
||||
|
@ -101,6 +130,16 @@ static inline int drm_panel_disable(struct drm_panel *panel)
|
|||
return panel ? -ENOSYS : -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_panel_prepare - power on a panel
|
||||
* @panel: DRM panel
|
||||
*
|
||||
* Calling this function will enable power and deassert any reset signals to
|
||||
* the panel. After this has completed it is possible to communicate with any
|
||||
* integrated circuitry via a command bus.
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
static inline int drm_panel_prepare(struct drm_panel *panel)
|
||||
{
|
||||
if (panel && panel->funcs && panel->funcs->prepare)
|
||||
|
@ -109,6 +148,16 @@ static inline int drm_panel_prepare(struct drm_panel *panel)
|
|||
return panel ? -ENOSYS : -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_panel_enable - enable a panel
|
||||
* @panel: DRM panel
|
||||
*
|
||||
* Calling this function will cause the panel display drivers to be turned on
|
||||
* and the backlight to be enabled. Content will be visible on screen after
|
||||
* this call completes.
|
||||
*
|
||||
* Return: 0 on success or a negative error code on failure.
|
||||
*/
|
||||
static inline int drm_panel_enable(struct drm_panel *panel)
|
||||
{
|
||||
if (panel && panel->funcs && panel->funcs->enable)
|
||||
|
@ -117,6 +166,16 @@ static inline int drm_panel_enable(struct drm_panel *panel)
|
|||
return panel ? -ENOSYS : -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_panel_get_modes - probe the available display modes of a panel
|
||||
* @panel: DRM panel
|
||||
*
|
||||
* The modes probed from the panel are automatically added to the connector
|
||||
* that the panel is attached to.
|
||||
*
|
||||
* Return: The number of modes available from the panel on success or a
|
||||
* negative error code on failure.
|
||||
*/
|
||||
static inline int drm_panel_get_modes(struct drm_panel *panel)
|
||||
{
|
||||
if (panel && panel->funcs && panel->funcs->get_modes)
|
||||
|
|
Loading…
Reference in New Issue
Block a user