aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_drv.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-15 00:19:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-15 00:19:54 -0500
commit049ffa8ab33a63b3bff672d1a0ee6a35ad253fe8 (patch)
tree70f4c684818b1c9871fa800088427e40d260592e /drivers/gpu/drm/msm/msm_drv.c
parentc681427e5ca22925fcc1be76a2e260a11e0a8498 (diff)
parent0846c728e20a0cd1e43fb75a3015f3b176a26466 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is a combo of -next and some -fixes that came in in the intervening time. Highlights: New drivers: ARM Armada driver for Marvell Armada 510 SOCs Intel: Broadwell initial support under a default off switch, Stereo/3D HDMI mode support Valleyview improvements Displayport improvements Haswell fixes initial mipi dsi panel support CRC support for debugging build with CONFIG_FB=n Radeon: enable DPM on a number of GPUs by default secondary GPU powerdown support enable HDMI audio by default Hawaii support Nouveau: dynamic pm code infrastructure reworked, does nothing major yet GK208 modesetting support MSI fixes, on by default again PMPEG improvements pageflipping fixes GMA500: minnowboard SDVO support VMware: misc fixes MSM: prime, plane and rendernodes support Tegra: rearchitected to put the drm driver into the drm subsystem. HDMI and gr2d support for tegra 114 SoC QXL: oops fix, and multi-head fixes DRM core: sysfs lifetime fixes client capability ioctl further cleanups to device midlayer more vblank timestamp fixes" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (789 commits) drm/nouveau: do not map evicted vram buffers in nouveau_bo_vma_add drm/nvc0-/gr: shift wrapping bug in nvc0_grctx_generate_r406800 drm/nouveau/pwr: fix missing mutex unlock in a failure path drm/nv40/therm: fix slowing down fan when pstate undefined drm/nv11-: synchronise flips to vblank, unless async flip requested drm/nvc0-: remove nasty fifo swmthd hack for flip completion method drm/nv10-: we no longer need to create nvsw object on user channels drm/nouveau: always queue flips relative to kernel channel activity drm/nouveau: there is no need to reserve/fence the new fb when flipping drm/nouveau: when bailing out of a pushbuf ioctl, do not remove previous fence drm/nouveau: allow nouveau_fence_ref() to be a noop drm/nvc8/mc: msi rearm is via the nvc0 method drm/ttm: Fix vma page_prot bit manipulation drm/vmwgfx: Fix a couple of compile / sparse warnings and errors drm/vmwgfx: Resource evict fixes drm/edid: compare actual vrefresh for all modes for quirks drm: shmob_drm: Convert to clk_prepare/unprepare drm/nouveau: fix 32-bit build drm/i915/opregion: fix build error on CONFIG_ACPI=n Revert "drm/radeon/audio: don't set speaker allocation on DCE4+" ...
Diffstat (limited to 'drivers/gpu/drm/msm/msm_drv.c')
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c60
1 files changed, 48 insertions, 12 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index b3a2f1629041..86537692e45c 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -187,6 +187,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
187 init_waitqueue_head(&priv->fence_event); 187 init_waitqueue_head(&priv->fence_event);
188 188
189 INIT_LIST_HEAD(&priv->inactive_list); 189 INIT_LIST_HEAD(&priv->inactive_list);
190 INIT_LIST_HEAD(&priv->fence_cbs);
190 191
191 drm_mode_config_init(dev); 192 drm_mode_config_init(dev);
192 193
@@ -539,15 +540,36 @@ int msm_wait_fence_interruptable(struct drm_device *dev, uint32_t fence,
539 return ret; 540 return ret;
540} 541}
541 542
542/* call under struct_mutex */ 543/* called from workqueue */
543void msm_update_fence(struct drm_device *dev, uint32_t fence) 544void msm_update_fence(struct drm_device *dev, uint32_t fence)
544{ 545{
545 struct msm_drm_private *priv = dev->dev_private; 546 struct msm_drm_private *priv = dev->dev_private;
546 547
547 if (fence > priv->completed_fence) { 548 mutex_lock(&dev->struct_mutex);
548 priv->completed_fence = fence; 549 priv->completed_fence = max(fence, priv->completed_fence);
549 wake_up_all(&priv->fence_event); 550
551 while (!list_empty(&priv->fence_cbs)) {
552 struct msm_fence_cb *cb;
553
554 cb = list_first_entry(&priv->fence_cbs,
555 struct msm_fence_cb, work.entry);
556
557 if (cb->fence > priv->completed_fence)
558 break;
559
560 list_del_init(&cb->work.entry);
561 queue_work(priv->wq, &cb->work);
550 } 562 }
563
564 mutex_unlock(&dev->struct_mutex);
565
566 wake_up_all(&priv->fence_event);
567}
568
569void __msm_fence_worker(struct work_struct *work)
570{
571 struct msm_fence_cb *cb = container_of(work, struct msm_fence_cb, work);
572 cb->func(cb);
551} 573}
552 574
553/* 575/*
@@ -650,13 +672,13 @@ static int msm_ioctl_wait_fence(struct drm_device *dev, void *data,
650} 672}
651 673
652static const struct drm_ioctl_desc msm_ioctls[] = { 674static const struct drm_ioctl_desc msm_ioctls[] = {
653 DRM_IOCTL_DEF_DRV(MSM_GET_PARAM, msm_ioctl_get_param, DRM_UNLOCKED|DRM_AUTH), 675 DRM_IOCTL_DEF_DRV(MSM_GET_PARAM, msm_ioctl_get_param, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW),
654 DRM_IOCTL_DEF_DRV(MSM_GEM_NEW, msm_ioctl_gem_new, DRM_UNLOCKED|DRM_AUTH), 676 DRM_IOCTL_DEF_DRV(MSM_GEM_NEW, msm_ioctl_gem_new, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW),
655 DRM_IOCTL_DEF_DRV(MSM_GEM_INFO, msm_ioctl_gem_info, DRM_UNLOCKED|DRM_AUTH), 677 DRM_IOCTL_DEF_DRV(MSM_GEM_INFO, msm_ioctl_gem_info, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW),
656 DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_PREP, msm_ioctl_gem_cpu_prep, DRM_UNLOCKED|DRM_AUTH), 678 DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_PREP, msm_ioctl_gem_cpu_prep, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW),
657 DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_FINI, msm_ioctl_gem_cpu_fini, DRM_UNLOCKED|DRM_AUTH), 679 DRM_IOCTL_DEF_DRV(MSM_GEM_CPU_FINI, msm_ioctl_gem_cpu_fini, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW),
658 DRM_IOCTL_DEF_DRV(MSM_GEM_SUBMIT, msm_ioctl_gem_submit, DRM_UNLOCKED|DRM_AUTH), 680 DRM_IOCTL_DEF_DRV(MSM_GEM_SUBMIT, msm_ioctl_gem_submit, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW),
659 DRM_IOCTL_DEF_DRV(MSM_WAIT_FENCE, msm_ioctl_wait_fence, DRM_UNLOCKED|DRM_AUTH), 681 DRM_IOCTL_DEF_DRV(MSM_WAIT_FENCE, msm_ioctl_wait_fence, DRM_UNLOCKED|DRM_AUTH|DRM_RENDER_ALLOW),
660}; 682};
661 683
662static const struct vm_operations_struct vm_ops = { 684static const struct vm_operations_struct vm_ops = {
@@ -680,7 +702,11 @@ static const struct file_operations fops = {
680}; 702};
681 703
682static struct drm_driver msm_driver = { 704static struct drm_driver msm_driver = {
683 .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET, 705 .driver_features = DRIVER_HAVE_IRQ |
706 DRIVER_GEM |
707 DRIVER_PRIME |
708 DRIVER_RENDER |
709 DRIVER_MODESET,
684 .load = msm_load, 710 .load = msm_load,
685 .unload = msm_unload, 711 .unload = msm_unload,
686 .open = msm_open, 712 .open = msm_open,
@@ -698,6 +724,16 @@ static struct drm_driver msm_driver = {
698 .dumb_create = msm_gem_dumb_create, 724 .dumb_create = msm_gem_dumb_create,
699 .dumb_map_offset = msm_gem_dumb_map_offset, 725 .dumb_map_offset = msm_gem_dumb_map_offset,
700 .dumb_destroy = drm_gem_dumb_destroy, 726 .dumb_destroy = drm_gem_dumb_destroy,
727 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
728 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
729 .gem_prime_export = drm_gem_prime_export,
730 .gem_prime_import = drm_gem_prime_import,
731 .gem_prime_pin = msm_gem_prime_pin,
732 .gem_prime_unpin = msm_gem_prime_unpin,
733 .gem_prime_get_sg_table = msm_gem_prime_get_sg_table,
734 .gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
735 .gem_prime_vmap = msm_gem_prime_vmap,
736 .gem_prime_vunmap = msm_gem_prime_vunmap,
701#ifdef CONFIG_DEBUG_FS 737#ifdef CONFIG_DEBUG_FS
702 .debugfs_init = msm_debugfs_init, 738 .debugfs_init = msm_debugfs_init,
703 .debugfs_cleanup = msm_debugfs_cleanup, 739 .debugfs_cleanup = msm_debugfs_cleanup,