Merge tag 'drm-intel-next-2013-03-23' of git://people.freedesktop.org/~danvet/drm-intel into drm-next
Daniel writes: Highlights: - Imre's for_each_sg_pages rework (now also with the stolen mem backed case fixed with a hack) plus the drm prime sg list coalescing patch from Rahul Sharma. I have some follow-up cleanups pending, already acked by Andrew Morton. - Some prep-work for the crazy no-pch/display-less platform by Ben. - Some vlv patches, by far not all (Jesse et al). - Clean up the HDMI/SDVO #define confusion (Paulo) - gen2-4 vblank fixes from Ville. - Unclaimed register warning fixes for hsw (Paulo). More still to come ... - Complete pageflips which have been stuck in a gpu hang, should prevent stuck gl compositors (Ville). - pm patches for vt-switchless resume (Jesse). Note that the i915 enabling is not (yet) included, that took a bit longer to settle. PM patches are acked by Rafael Wysocki. - Minor fixlets all over from various people. * tag 'drm-intel-next-2013-03-23' of git://people.freedesktop.org/~danvet/drm-intel: (79 commits) drm/i915: Implement WaSwitchSolVfFArbitrationPriority drm/i915: Set the VIC in AVI infoframe for SDVO drm/i915: Kill a strange comment about DPMS functions drm/i915: Correct sandybrige overclocking drm/i915: Introduce GEN7_FEATURES for device info drm/i915: Move num_pipes to intel info drm/i915: fixup pd vs pt confusion in gen6 ppgtt code style nit: Align function parameter continuation properly. drm/i915: VLV doesn't have HDMI on port C drm/i915: DSPFW and BLC regs are in the display offset range drm/i915: set conservative clock gating values on VLV v2 drm/i915: fix WaDisablePSDDualDispatchEnable on VLV v2 drm/i915: add more VLV IDs drm/i915: use VLV DIP routines on VLV v2 drm/i915: add media well to VLV force wake routines v2 drm/i915: don't use plane pipe select on VLV drm: modify pages_to_sg prime helper to create optimized SG table drm/i915: use for_each_sg_page for setting up the gtt ptes drm/i915: create compact dma scatter lists for gem objects drm/i915: handle walking compact dma scatter lists ...
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* Originally from swsusp.
|
||||
*/
|
||||
|
||||
#include <linux/console.h>
|
||||
#include <linux/vt_kern.h>
|
||||
#include <linux/kbd_kern.h>
|
||||
#include <linux/vt.h>
|
||||
@@ -14,8 +15,120 @@
|
||||
|
||||
static int orig_fgconsole, orig_kmsg;
|
||||
|
||||
static DEFINE_MUTEX(vt_switch_mutex);
|
||||
|
||||
struct pm_vt_switch {
|
||||
struct list_head head;
|
||||
struct device *dev;
|
||||
bool required;
|
||||
};
|
||||
|
||||
static LIST_HEAD(pm_vt_switch_list);
|
||||
|
||||
|
||||
/**
|
||||
* pm_vt_switch_required - indicate VT switch at suspend requirements
|
||||
* @dev: device
|
||||
* @required: if true, caller needs VT switch at suspend/resume time
|
||||
*
|
||||
* The different console drivers may or may not require VT switches across
|
||||
* suspend/resume, depending on how they handle restoring video state and
|
||||
* what may be running.
|
||||
*
|
||||
* Drivers can indicate support for switchless suspend/resume, which can
|
||||
* save time and flicker, by using this routine and passing 'false' as
|
||||
* the argument. If any loaded driver needs VT switching, or the
|
||||
* no_console_suspend argument has been passed on the command line, VT
|
||||
* switches will occur.
|
||||
*/
|
||||
void pm_vt_switch_required(struct device *dev, bool required)
|
||||
{
|
||||
struct pm_vt_switch *entry, *tmp;
|
||||
|
||||
mutex_lock(&vt_switch_mutex);
|
||||
list_for_each_entry(tmp, &pm_vt_switch_list, head) {
|
||||
if (tmp->dev == dev) {
|
||||
/* already registered, update requirement */
|
||||
tmp->required = required;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
entry = kmalloc(sizeof(*entry), GFP_KERNEL);
|
||||
if (!entry)
|
||||
goto out;
|
||||
|
||||
entry->required = required;
|
||||
entry->dev = dev;
|
||||
|
||||
list_add(&entry->head, &pm_vt_switch_list);
|
||||
out:
|
||||
mutex_unlock(&vt_switch_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(pm_vt_switch_required);
|
||||
|
||||
/**
|
||||
* pm_vt_switch_unregister - stop tracking a device's VT switching needs
|
||||
* @dev: device
|
||||
*
|
||||
* Remove @dev from the vt switch list.
|
||||
*/
|
||||
void pm_vt_switch_unregister(struct device *dev)
|
||||
{
|
||||
struct pm_vt_switch *tmp;
|
||||
|
||||
mutex_lock(&vt_switch_mutex);
|
||||
list_for_each_entry(tmp, &pm_vt_switch_list, head) {
|
||||
if (tmp->dev == dev) {
|
||||
list_del(&tmp->head);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mutex_unlock(&vt_switch_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(pm_vt_switch_unregister);
|
||||
|
||||
/*
|
||||
* There are three cases when a VT switch on suspend/resume are required:
|
||||
* 1) no driver has indicated a requirement one way or another, so preserve
|
||||
* the old behavior
|
||||
* 2) console suspend is disabled, we want to see debug messages across
|
||||
* suspend/resume
|
||||
* 3) any registered driver indicates it needs a VT switch
|
||||
*
|
||||
* If none of these conditions is present, meaning we have at least one driver
|
||||
* that doesn't need the switch, and none that do, we can avoid it to make
|
||||
* resume look a little prettier (and suspend too, but that's usually hidden,
|
||||
* e.g. when closing the lid on a laptop).
|
||||
*/
|
||||
static bool pm_vt_switch(void)
|
||||
{
|
||||
struct pm_vt_switch *entry;
|
||||
bool ret = true;
|
||||
|
||||
mutex_lock(&vt_switch_mutex);
|
||||
if (list_empty(&pm_vt_switch_list))
|
||||
goto out;
|
||||
|
||||
if (!console_suspend_enabled)
|
||||
goto out;
|
||||
|
||||
list_for_each_entry(entry, &pm_vt_switch_list, head) {
|
||||
if (entry->required)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = false;
|
||||
out:
|
||||
mutex_unlock(&vt_switch_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int pm_prepare_console(void)
|
||||
{
|
||||
if (!pm_vt_switch())
|
||||
return 0;
|
||||
|
||||
orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1);
|
||||
if (orig_fgconsole < 0)
|
||||
return 1;
|
||||
@@ -26,6 +139,9 @@ int pm_prepare_console(void)
|
||||
|
||||
void pm_restore_console(void)
|
||||
{
|
||||
if (!pm_vt_switch())
|
||||
return;
|
||||
|
||||
if (orig_fgconsole >= 0) {
|
||||
vt_move_to_console(orig_fgconsole, 0);
|
||||
vt_kmsg_redirect(orig_kmsg);
|
||||
|
||||
Reference in New Issue
Block a user