Skip to content

Commit

Permalink
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Browse files Browse the repository at this point in the history
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (31 commits)
  gma500: Fix suspend/resume functions
  drm/exynos: fixed pm feature for fimd module.
  MAINTAINERS: added maintainer entry for Exynos DRM Driver.
  drm/exynos: fixed build dependency for DRM_EXYNOS_FIMD
  drm/exynos: fix build dependency for DRM_EXYNOS_HDMI
  drm/exynos: use release_mem_region instead of release_resource
  agp: fix scratch page cleanup
  drm/i915: fixup forcewake spinlock fallout in drpc debugfs function
  drm/i915: debugfs: show semaphore registers also on gen7
  drm/i915: allow userspace forcewake references also on gen7
  drm/i915: Re-enable gen7 RC6 and GPU turbo after resume.
  drm/i915: Correct debugfs printout for RC1e.
  Revert "drm/i915: Work around gen7 BLT ring synchronization issues."
  drm/i915: rip out the HWSTAM missed irq workaround
  drm/i915: paper over missed irq issues with force wake voodoo
  drm/i915: Hold gt_lock across forcewake register reads
  drm/i915: Hold gt_lock during reset
  drm/i915: Move reset forcewake processing to gen6_do_reset
  drm/i915: protect force_wake_(get|put) with the gt_lock
  drm/i915: convert force_wake_get to func pointer in the gpu reset code
  ...
  • Loading branch information
Linus Torvalds committed Jan 27, 2012
2 parents ea9f7a6 + 2d8357e commit acb42a3
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 265 deletions.
3 changes: 3 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2350,6 +2350,9 @@ F: include/drm/i915*

DRM DRIVERS FOR EXYNOS
M: Inki Dae <inki.dae@samsung.com>
M: Joonyoung Shim <jy0922.shim@samsung.com>
M: Seung-Woo Kim <sw0312.kim@samsung.com>
M: Kyungmin Park <kyungmin.park@samsung.com>
L: dri-devel@lists.freedesktop.org
S: Supported
F: drivers/gpu/drm/exynos
Expand Down
12 changes: 6 additions & 6 deletions drivers/char/agp/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)

err_out:
if (bridge->driver->needs_scratch_page) {
void *va = page_address(bridge->scratch_page_page);
struct page *page = bridge->scratch_page_page;

bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP);
bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE);
bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_UNMAP);
bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_FREE);
}
if (got_gatt)
bridge->driver->free_gatt_table(bridge);
Expand All @@ -221,10 +221,10 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)

if (bridge->driver->agp_destroy_page &&
bridge->driver->needs_scratch_page) {
void *va = page_address(bridge->scratch_page_page);
struct page *page = bridge->scratch_page_page;

bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_UNMAP);
bridge->driver->agp_destroy_page(va, AGP_PAGE_DESTROY_FREE);
bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_UNMAP);
bridge->driver->agp_destroy_page(page, AGP_PAGE_DESTROY_FREE);
}
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/exynos/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ config DRM_EXYNOS

config DRM_EXYNOS_FIMD
tristate "Exynos DRM FIMD"
depends on DRM_EXYNOS
depends on DRM_EXYNOS && !FB_S3C
default n
help
Choose this option if you want to use Exynos FIMD for DRM.
If M is selected, the module will be called exynos_drm_fimd

config DRM_EXYNOS_HDMI
tristate "Exynos DRM HDMI"
depends on DRM_EXYNOS
depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_TV
help
Choose this option if you want to use Exynos HDMI for DRM.
If M is selected, the module will be called exynos_drm_hdmi
109 changes: 59 additions & 50 deletions drivers/gpu/drm/exynos/exynos_drm_fimd.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ static void fimd_dpms(struct device *subdrv_dev, int mode)
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
pm_runtime_put_sync(subdrv_dev);
if (!ctx->suspended)
pm_runtime_put_sync(subdrv_dev);
break;
default:
DRM_DEBUG_KMS("unspecified mode %d\n", mode);
Expand Down Expand Up @@ -734,6 +735,46 @@ static void fimd_clear_win(struct fimd_context *ctx, int win)
writel(val, ctx->regs + SHADOWCON);
}

static int fimd_power_on(struct fimd_context *ctx, bool enable)
{
struct exynos_drm_subdrv *subdrv = &ctx->subdrv;
struct device *dev = subdrv->manager.dev;

DRM_DEBUG_KMS("%s\n", __FILE__);

if (enable != false && enable != true)
return -EINVAL;

if (enable) {
int ret;

ret = clk_enable(ctx->bus_clk);
if (ret < 0)
return ret;

ret = clk_enable(ctx->lcd_clk);
if (ret < 0) {
clk_disable(ctx->bus_clk);
return ret;
}

ctx->suspended = false;

/* if vblank was enabled status, enable it again. */
if (test_and_clear_bit(0, &ctx->irq_flags))
fimd_enable_vblank(dev);

fimd_apply(dev);
} else {
clk_disable(ctx->lcd_clk);
clk_disable(ctx->bus_clk);

ctx->suspended = true;
}

return 0;
}

static int __devinit fimd_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand Down Expand Up @@ -911,39 +952,30 @@ static int __devexit fimd_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int fimd_suspend(struct device *dev)
{
int ret;
struct fimd_context *ctx = get_fimd_context(dev);

if (pm_runtime_suspended(dev))
return 0;

ret = pm_runtime_suspend(dev);
if (ret < 0)
return ret;

return 0;
/*
* do not use pm_runtime_suspend(). if pm_runtime_suspend() is
* called here, an error would be returned by that interface
* because the usage_count of pm runtime is more than 1.
*/
return fimd_power_on(ctx, false);
}

static int fimd_resume(struct device *dev)
{
int ret;

ret = pm_runtime_resume(dev);
if (ret < 0) {
DRM_ERROR("failed to resume runtime pm.\n");
return ret;
}

pm_runtime_disable(dev);

ret = pm_runtime_set_active(dev);
if (ret < 0) {
DRM_ERROR("failed to active runtime pm.\n");
pm_runtime_enable(dev);
pm_runtime_suspend(dev);
return ret;
}
struct fimd_context *ctx = get_fimd_context(dev);

pm_runtime_enable(dev);
/*
* if entered to sleep when lcd panel was on, the usage_count
* of pm runtime would still be 1 so in this case, fimd driver
* should be on directly not drawing on pm runtime interface.
*/
if (!pm_runtime_suspended(dev))
return fimd_power_on(ctx, true);

return 0;
}
Expand All @@ -956,39 +988,16 @@ static int fimd_runtime_suspend(struct device *dev)

DRM_DEBUG_KMS("%s\n", __FILE__);

clk_disable(ctx->lcd_clk);
clk_disable(ctx->bus_clk);

ctx->suspended = true;
return 0;
return fimd_power_on(ctx, false);
}

static int fimd_runtime_resume(struct device *dev)
{
struct fimd_context *ctx = get_fimd_context(dev);
int ret;

DRM_DEBUG_KMS("%s\n", __FILE__);

ret = clk_enable(ctx->bus_clk);
if (ret < 0)
return ret;

ret = clk_enable(ctx->lcd_clk);
if (ret < 0) {
clk_disable(ctx->bus_clk);
return ret;
}

ctx->suspended = false;

/* if vblank was enabled status, enable it again. */
if (test_and_clear_bit(0, &ctx->irq_flags))
fimd_enable_vblank(dev);

fimd_apply(dev);

return 0;
return fimd_power_on(ctx, true);
}
#endif

Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/exynos/exynos_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,8 +1116,8 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
err_iomap:
iounmap(hdata->regs);
err_req_region:
release_resource(hdata->regs_res);
kfree(hdata->regs_res);
release_mem_region(hdata->regs_res->start,
resource_size(hdata->regs_res));
err_resource:
hdmi_resources_cleanup(hdata);
err_data:
Expand Down Expand Up @@ -1145,8 +1145,8 @@ static int __devexit hdmi_remove(struct platform_device *pdev)

iounmap(hdata->regs);

release_resource(hdata->regs_res);
kfree(hdata->regs_res);
release_mem_region(hdata->regs_res->start,
resource_size(hdata->regs_res));

/* hdmiphy i2c driver */
i2c_del_driver(&hdmiphy_driver);
Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/gma500/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ static int psbfb_pan(struct fb_var_screeninfo *var, struct fb_info *info)

void psbfb_suspend(struct drm_device *dev)
{
struct drm_framebuffer *fb = 0;
struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct drm_framebuffer *fb;

console_lock();
mutex_lock(&dev->mode_config.mutex);
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct fb_info *info = psbfb->fbdev;
fb_set_suspend(info, 1);
drm_fb_helper_blank(FB_BLANK_POWERDOWN, info);
Expand All @@ -129,12 +129,12 @@ void psbfb_suspend(struct drm_device *dev)

void psbfb_resume(struct drm_device *dev)
{
struct drm_framebuffer *fb = 0;
struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct drm_framebuffer *fb;

console_lock();
mutex_lock(&dev->mode_config.mutex);
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
struct psb_framebuffer *psbfb = to_psb_fb(fb);
struct fb_info *info = psbfb->fbdev;
fb_set_suspend(info, 0);
drm_fb_helper_blank(FB_BLANK_UNBLANK, info);
Expand Down
31 changes: 20 additions & 11 deletions drivers/gpu/drm/i915/i915_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ static const char *cache_level_str(int type)
static void
describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
{
seq_printf(m, "%p: %s%s %8zd %04x %04x %d %d%s%s%s",
seq_printf(m, "%p: %s%s %8zdKiB %04x %04x %d %d%s%s%s",
&obj->base,
get_pin_flag(obj),
get_tiling_flag(obj),
obj->base.size,
obj->base.size / 1024,
obj->base.read_domains,
obj->base.write_domain,
obj->last_rendering_seqno,
Expand Down Expand Up @@ -653,7 +653,7 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data)
seq_printf(m, " Size : %08x\n", ring->size);
seq_printf(m, " Active : %08x\n", intel_ring_get_active_head(ring));
seq_printf(m, " NOPID : %08x\n", I915_READ_NOPID(ring));
if (IS_GEN6(dev)) {
if (IS_GEN6(dev) || IS_GEN7(dev)) {
seq_printf(m, " Sync 0 : %08x\n", I915_READ_SYNC_0(ring));
seq_printf(m, " Sync 1 : %08x\n", I915_READ_SYNC_1(ring));
}
Expand Down Expand Up @@ -1075,16 +1075,21 @@ static int gen6_drpc_info(struct seq_file *m)
struct drm_device *dev = node->minor->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
u32 rpmodectl1, gt_core_status, rcctl1;
unsigned forcewake_count;
int count=0, ret;


ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
return ret;

if (atomic_read(&dev_priv->forcewake_count)) {
seq_printf(m, "RC information inaccurate because userspace "
"holds a reference \n");
spin_lock_irq(&dev_priv->gt_lock);
forcewake_count = dev_priv->forcewake_count;
spin_unlock_irq(&dev_priv->gt_lock);

if (forcewake_count) {
seq_printf(m, "RC information inaccurate because somebody "
"holds a forcewake reference \n");
} else {
/* NB: we cannot use forcewake, else we read the wrong values */
while (count++ < 50 && (I915_READ_NOTRACE(FORCEWAKE_ACK) & 1))
Expand All @@ -1106,7 +1111,7 @@ static int gen6_drpc_info(struct seq_file *m)
seq_printf(m, "SW control enabled: %s\n",
yesno((rpmodectl1 & GEN6_RP_MEDIA_MODE_MASK) ==
GEN6_RP_MEDIA_SW_MODE));
seq_printf(m, "RC6 Enabled: %s\n",
seq_printf(m, "RC1e Enabled: %s\n",
yesno(rcctl1 & GEN6_RC_CTL_RC1e_ENABLE));
seq_printf(m, "RC6 Enabled: %s\n",
yesno(rcctl1 & GEN6_RC_CTL_RC6_ENABLE));
Expand Down Expand Up @@ -1398,9 +1403,13 @@ static int i915_gen6_forcewake_count_info(struct seq_file *m, void *data)
struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
unsigned forcewake_count;

spin_lock_irq(&dev_priv->gt_lock);
forcewake_count = dev_priv->forcewake_count;
spin_unlock_irq(&dev_priv->gt_lock);

seq_printf(m, "forcewake count = %d\n",
atomic_read(&dev_priv->forcewake_count));
seq_printf(m, "forcewake count = %u\n", forcewake_count);

return 0;
}
Expand Down Expand Up @@ -1665,7 +1674,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
struct drm_i915_private *dev_priv = dev->dev_private;
int ret;

if (!IS_GEN6(dev))
if (INTEL_INFO(dev)->gen < 6)
return 0;

ret = mutex_lock_interruptible(&dev->struct_mutex);
Expand All @@ -1682,7 +1691,7 @@ int i915_forcewake_release(struct inode *inode, struct file *file)
struct drm_device *dev = inode->i_private;
struct drm_i915_private *dev_priv = dev->dev_private;

if (!IS_GEN6(dev))
if (INTEL_INFO(dev)->gen < 6)
return 0;

/*
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/i915_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
if (!IS_I945G(dev) && !IS_I945GM(dev))
pci_enable_msi(dev->pdev);

spin_lock_init(&dev_priv->gt_lock);
spin_lock_init(&dev_priv->irq_lock);
spin_lock_init(&dev_priv->error_lock);
spin_lock_init(&dev_priv->rps_lock);
Expand Down
Loading

0 comments on commit acb42a3

Please sign in to comment.