more drm de-midlayering
Subsystems (22)
cover more drm de-midlayering
Hi all,
This series almost removes drm_bus, the last thing remaining is the ->setversion callback. Unfortunately we can't kill that completely since we need the backwards compat cruft for pci domain bonghits on alpha/ppc.
I've also shot at a few easy marks on the road while at it.
My plan is to tackle the setversion mess in 3.15 with a Gross Hack. And then convert a few drivers to allocate struct drm_device themselves and so complete the demidlayering in the driver load paths. For simplicity that'd probably be udl or the arm drivers due to lack of legacy baggage. That should allow us to ditch drm_usb.c and drm_platform.c from the tree.
My real long-term goal is to eventually use devres.c and similar cool stuff to clean up the setup/teardown hell we have in i915.ko. Hence also why I've deprecated the legacy agp/ums support in i915 in the hope that I'll get to deal with less cruft. Also maybe we can sort out the lifetime issues around sysfs and debugfs at driver/module unload time eventually ... just let me dream ;-)
Also a cleanup from Dan on top. All the little fixes for Wu Fengguang reported are squashed in - he's now also doing some arm builds!
Dan Carpenter (1):
drm: use memdup_user() as a cleanup
Daniel Vetter (49):
drm/rcar: call drm_put_dev directly in the ->remove hook drm/exynos: call drm_put_dev directly from ->remove drm/imx: directly call drm_put_dev in ->remove drm/tilcdc: call drm_put_dev directly from ->remove drm/omap: call drm_put_dev directly in ->remove drm/shmob: call drm_put_dev directly from ->remove hook drm/armada: directly call drm_put_dev in ->remove drm/msm: call drm_put_dev directly in ->remove
drm: rip out drm_platform_exit
drm: restrict the device list for shadow attached drivers drm/bufs: remove handling of _DRM_GEM mappings
drm: kill DRIVER_REQUIRE_AGP
drm: ->agp_init can't fail
drm: rip out drm_core_has_AGP
drm: remove agp_init() bus callback
drm: inline drm_agp_destroy
drm: kill the ->agp_destroy callback
drm: remove global_mutex locking around agp_init
drm: rip out DRM_AGP_MEM and DRM_AGP_KERN
drm: Kill DRM_HZ
drm: Kill DRM_IRQ_ARGS
drm: Kill DRM_WAKUP and DRM_INIT_WAITQUEUE
drm: Kill DRM_COPY_(TO|FROM)_USER
drm: Kill DRM_*MEMORYBARRIER
drm: Kill DRM_SUSER
drm/gma500: Remove dead code
drm/irq: Replace DRM_WAIT_ON with wait_event
drm: Remove DRM_WAIT_ON from all drivers
drm/irq: simplify irq checks in drm_wait_vblank drm/pci: fold in irq_by_busid support
drm/irq: drm_control is a legacy ioctl, so pci devices only drm/irq: remove cargo-culted locking from irq_install/unistall
drm: remove drm_dev_to_irq from drivers
drm: kill drm_bus->bus_type
drm: Rip out totally bogus vga_switcheroo->can_switch locking
drm: rename dev->count_lock to dev->buf_lock
drm/irq: track the irq installed in drm_irq_install in dev->irq drm/irq: Look up the pci irq directly in the drm_control ioctl
drm: pass the irq explicitly to drm_irq_install
drm: remove bus->get_irq implementations
drm: inline drm_pci_set_unique
drm: rip out dev->devname
drm: remove drm_bus->get_name
drm: Remove dev->kdriver
drm/<drivers>: don't set driver->dev_priv_size to 0
drm: store the gem vma offset manager in a typed pointer
drm: rip out dev->ioctl_count tracking
drm: Kill file_priv->ioctl_count tracking
drm: remove dev->vma_count
Documentation/DocBook/drm.tmpl | 10 +-- drivers/gpu/drm/armada/armada_drv.c | 5 +- drivers/gpu/drm/ast/ast_drv.c | 1 - drivers/gpu/drm/cirrus/cirrus_drv.h | 2 +- drivers/gpu/drm/drm_agpsupport.c | 28 ++----- drivers/gpu/drm/drm_buffer.c | 2 +- drivers/gpu/drm/drm_bufs.c | 42 +++++----- drivers/gpu/drm/drm_drv.c | 4 - drivers/gpu/drm/drm_fops.c | 11 +-- drivers/gpu/drm/drm_gem.c | 27 +++---- drivers/gpu/drm/drm_info.c | 22 +++--- drivers/gpu/drm/drm_ioctl.c | 13 +-- drivers/gpu/drm/drm_irq.c | 125 +++++++++++------------------ drivers/gpu/drm/drm_memory.c | 15 ++-- drivers/gpu/drm/drm_pci.c | 132 ++++++++++++++++--------------- drivers/gpu/drm/drm_platform.c | 37 --------- drivers/gpu/drm/drm_stub.c | 25 +----- drivers/gpu/drm/drm_usb.c | 15 ---- drivers/gpu/drm/drm_vm.c | 10 +-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_mixer.c | 6 +- drivers/gpu/drm/gma500/accel_2d.c | 2 +- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/gma500/psb_drv.h | 8 +- drivers/gpu/drm/gma500/psb_intel_drv.h | 5 -- drivers/gpu/drm/gma500/psb_irq.c | 19 +---- drivers/gpu/drm/gma500/psb_irq.h | 2 +- drivers/gpu/drm/i810/i810_dma.c | 4 + drivers/gpu/drm/i810/i810_drv.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 31 ++++++-- drivers/gpu/drm/i915/i915_drv.c | 14 ++-- drivers/gpu/drm/i915/i915_gem.c | 7 +- drivers/gpu/drm/mga/mga_dma.c | 4 +- drivers/gpu/drm/mga/mga_drv.h | 4 +- drivers/gpu/drm/mga/mga_irq.c | 18 +++-- drivers/gpu/drm/mga/mga_state.c | 4 +- drivers/gpu/drm/msm/msm_drv.c | 8 +- drivers/gpu/drm/nouveau/nouveau_dma.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dma.h | 2 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +- drivers/gpu/drm/nouveau/nouveau_vga.c | 7 +- drivers/gpu/drm/omapdrm/omap_debugfs.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 4 +- drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- drivers/gpu/drm/omapdrm/omap_irq.c | 4 +- drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.h | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_irq.c | 4 +- drivers/gpu/drm/r128/r128_cce.c | 4 +- drivers/gpu/drm/r128/r128_drv.h | 4 +- drivers/gpu/drm/r128/r128_irq.c | 2 +- drivers/gpu/drm/r128/r128_state.c | 68 ++++++---------- drivers/gpu/drm/radeon/r300_cmdbuf.c | 8 +- drivers/gpu/drm/radeon/r600_cp.c | 4 +- drivers/gpu/drm/radeon/r600_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_cp.c | 6 +- drivers/gpu/drm/radeon/radeon_cs.c | 10 +-- drivers/gpu/drm/radeon/radeon_device.c | 7 +- drivers/gpu/drm/radeon/radeon_drv.c | 3 +- drivers/gpu/drm/radeon/radeon_drv.h | 2 +- drivers/gpu/drm/radeon/radeon_irq.c | 19 +++-- drivers/gpu/drm/radeon/radeon_irq_kms.c | 6 +- drivers/gpu/drm/radeon/radeon_kms.c | 10 +-- drivers/gpu/drm/radeon/radeon_mem.c | 2 +- drivers/gpu/drm/radeon/radeon_ring.c | 2 +- drivers/gpu/drm/radeon/radeon_state.c | 20 ++--- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 4 +- drivers/gpu/drm/savage/savage_bci.c | 10 +-- drivers/gpu/drm/savage/savage_state.c | 8 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 6 +- drivers/gpu/drm/sis/sis_mm.c | 2 +- drivers/gpu/drm/tegra/bus.c | 12 --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 +- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/via/via_dma.c | 12 +-- drivers/gpu/drm/via/via_dmablit.c | 39 +++++---- drivers/gpu/drm/via/via_drv.h | 2 +- drivers/gpu/drm/via/via_irq.c | 21 +++-- drivers/gpu/drm/via/via_video.c | 18 +++-- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | 2 +- drivers/staging/imx-drm/imx-drm-core.c | 4 +- include/drm/drmP.h | 60 ++++---------- include/drm/drm_agpsupport.h | 33 ++------ include/drm/drm_os_linux.h | 61 -------------- include/uapi/drm/drm.h | 1 - 91 files changed, 485 insertions(+), 717 deletions(-)
Signature · 1 line
1.8.4.3
PATCH 1/50 drm/rcar: call drm_put_dev directly in the ->remove hook
The magic dance drm_platform_exit does is actually a remnant of the old legacy shadow attach support for platform devices. Modern modesetting drm drivers shouldn't do this any more (and usb/pci devices actually don't do this).
--- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/rcar-du/rcar_du_drv.c +3 -1
@@ -224,7 +224,9 @@ static int rcar_du_probe(struct platform_device *pdev)static int rcar_du_remove (struct platform_device *pdev) { -drm_platform_exit (&rcar_du_driver, pdev); +struct rcar_du_device *rcdu =platform_get_drvdata (pdev); + +drm_put_dev (rcdu->ddev);return 0 ; }
Signature · 1 line
1.8.4.3
PATCH 2/50 drm/exynos: call drm_put_dev directly from ->remove
In reply to Daniel VetterI didn't find any user of the driver data yet, so store the drm_device pointer in there.
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +3 -1
@@ -119,6 +119,8 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) drm_vblank_offdelay =VBLANK_OFF_DELAY ; +platform_set_drvdata (dev->platformdev, dev); +return 0 ; err_drm_device:
@@ -296,7 +298,7 @@ static int exynos_drm_platform_probe(struct platform_device *pdev)static int exynos_drm_platform_remove (struct platform_device *pdev) { -drm_platform_exit (&exynos_drm_driver, pdev); +drm_put_dev (platform_get_drvdata (pdev));return 0 ; }
Signature · 1 line
1.8.4.3
PATCH 3/50 drm/imx: directly call drm_put_dev in ->remove
In reply to Daniel VetterAgain no apparent user of the driver data field.
--- drivers/staging/imx-drm/imx-drm-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/staging/imx-drm/imx-drm-core.c +3 -1
@@ -443,6 +443,8 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)if (!imx_drm_device_get ()) ret = -EINVAL ; +platform_set_drvdata (drm->platformdev, drm); + ret =0 ; err_init:
@@ -828,7 +830,7 @@ static int imx_drm_platform_probe(struct platform_device *pdev)static int imx_drm_platform_remove (struct platform_device *pdev) { -drm_platform_exit (&imx_drm_driver, pdev); +drm_put_dev (platform_get_drvdata (pdev));return 0 ; }
Signature · 1 line
1.8.4.3
PATCH 4/50 drm/tilcdc: call drm_put_dev directly from ->remove
In reply to Daniel Vettertilcdc already stores the drm_device in the driver data pointer. So use that.
--- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -594,7 +594,7 @@ static int tilcdc_pdev_probe(struct platform_device *pdev)static int tilcdc_pdev_remove (struct platform_device *pdev) { -drm_platform_exit (&tilcdc_driver, pdev); +drm_put_dev (platform_get_drvdata (pdev));return 0 ; }
Signature · 1 line
1.8.4.3
Re: [PATCH 04/50] drm/tilcdc: call drm_put_dev directly from ->remove
Quoted 5 lines · Daniel Vetter
tilcdc already stores the
drm_devicein the driver data pointer. So use that.Cc Rob Clark <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/tilcdc/tilcdc_drv.c +1
-2@@ -594,7 +594,7 @@ static int tilcdc_pdev_probe(struct platform_device *pdev)static int tilcdc_pdev_remove (struct platform_device *pdev) { -drm_platform_exit (&tilcdc_driver, pdev); +drm_put_dev (platform_get_drvdata (pdev));return 0 ; } --1.8.4.3
PATCH 5/50 drm/omap: call drm_put_dev directly in ->remove
In reply to Daniel VetterAgain omap already sets the driver data pointer to the drm_device.
Also drop the driver unregister call, that should be (and already is) done in the module unload hook.
--- drivers/gpu/drm/omapdrm/omap_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +2 -2
@@ -665,9 +665,9 @@ static int pdev_probe(struct platform_device *device)static int pdev_remove (struct platform_device *device) {DBG ("" ); -drm_platform_exit (&omap_drm_driver, device); -platform_driver_unregister (&omap_dmm_driver); +drm_put_dev (platform_get_drvdata (device)); +return 0 ; }
Signature · 1 line
1.8.4.3
Re: [PATCH 05/50] drm/omap: call drm_put_dev directly in ->remove
Quoted 4 lines · Daniel Vetter
Again omap already sets the driver data pointer to the
drm_device.Also drop the driver unregister call, that should be (and already is) done in the module unload hook.
umm.. there are two devices+drivers at play in there. The dmm/tiler is split out into a different device (mainly just because it's irq and memory resources were associated to a different device). The one that is dropped in omap_drm_fini() is the toplevel drm device, not the *dmm* driver
(for extra fun, use a really small font and try to tell the difference between dmm and drm ;-))
BR,
-R
Quoted 26 lines
Cc Rob Clark <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/omapdrm/omap_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/omapdrm/omap_drv.c +2
-3@@ -665,9 +665,9 @@ static int pdev_probe(struct platform_device *device)static int pdev_remove (struct platform_device *device) {DBG ("" ); -drm_platform_exit (&omap_drm_driver, device); -platform_driver_unregister (&omap_dmm_driver); +drm_put_dev (platform_get_drvdata (device)); +return 0 ; } --1.8.4.3
PATCH 1/1 drm/omap: call drm_put_dev directly in ->remove
Again omap already sets the driver data pointer to the drm_device.
v2: Don't rip out the platform_driver_unregister call for omap_dmm_driver. Pesky difference between drm and dmm ...
--- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
@@ -665,7 +665,7 @@ static int pdev_probe(struct platform_device *device)static int pdev_remove (struct platform_device *device) {DBG ("" ); -drm_platform_exit (&omap_drm_driver, device); +drm_put_dev (platform_get_drvdata (device));platform_driver_unregister (&omap_dmm_driver);return 0 ;
Signature · 1 line
1.8.4.3
Re: [PATCH] drm/omap: call drm_put_dev directly in ->remove
Quoted 7 lines · Daniel Vetter
Again omap already sets the driver data pointer to the
drm_device.v2: Don't rip out the
platform_driver_unregistercall foromap_dmm_driver. Pesky difference between drm and dmm ...Cc Rob Clark <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
looks better, thanks
Quoted 20 lines
--- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/omapdrm/omap_drv.c +1
-2@@ -665,7 +665,7 @@ static int pdev_probe(struct platform_device *device)static int pdev_remove (struct platform_device *device) {DBG ("" ); -drm_platform_exit (&omap_drm_driver, device); +drm_put_dev (platform_get_drvdata (device));platform_driver_unregister (&omap_dmm_driver);return 0 ; --1.8.4.3
PATCH 6/50 drm/shmob: call drm_put_dev directly from ->remove hook
In reply to Daniel VetterWe need to chase one pointer here.
--- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/shmobile/shmob_drm_drv.c +3 -1
@@ -336,7 +336,9 @@ static int shmob_drm_probe(struct platform_device *pdev)static int shmob_drm_remove (struct platform_device *pdev) { -drm_platform_exit (&shmob_drm_driver, pdev); +struct shmob_drm_device *sdev =platform_get_drvdata (pdev); + +drm_put_dev (sdev->ddev);return 0 ; }
Signature · 1 line
1.8.4.3
Re: [PATCH 06/50] drm/shmob: call drm_put_dev directly from ->remove hook
Hi Daniel,
Thank you for the patch.
Quoted 4 lines · On Wednesday 11 December 2013 11:34:27 Daniel Vetter wrote:
We need to chase one pointer here.
Cc Laurent Pinchart <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/shmobile/shmob_drm_drv.cindex015551866b4a..c839c9c89efb100644drivers/gpu/drm/shmobile/shmob_drm_drv.c +3
-1@@ -336,7 +336,9 @@ static int shmob_drm_probe(struct platform_device *pdev)static int shmob_drm_remove (struct platform_device *pdev) { -drm_platform_exit (&shmob_drm_driver, pdev); +struct shmob_drm_device *sdev =platform_get_drvdata (pdev); + +drm_put_dev (sdev->ddev);return 0 ; }
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 7/50 drm/armada: directly call drm_put_dev in ->remove
In reply to Daniel VetterAgain no apparent user of the driver data field.
--- drivers/gpu/drm/armada/armada_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/armada/armada_drv.c +2 -1
@@ -128,6 +128,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)return -ENOMEM ; } +platform_set_drvdata (dev->platformdev, dev); dev->dev_private = priv;/* Get the implementation specific driver data. */
@@ -376,7 +377,7 @@ static int armada_drm_probe(struct platform_device *pdev)static int armada_drm_remove (struct platform_device *pdev) { -drm_platform_exit (&armada_drm_driver, pdev); +drm_put_dev (platform_get_drvdata (pdev));return 0 ; }
Signature · 1 line
1.8.4.3
PATCH 8/50 drm/msm: call drm_put_dev directly in ->remove
In reply to Daniel VetterThe drvdata pointer is already assigned to something useful.
--- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -783,7 +783,7 @@ static int msm_pdev_probe(struct platform_device *pdev)static int msm_pdev_remove (struct platform_device *pdev) { -drm_platform_exit (&msm_driver, pdev); +drm_put_dev (platform_get_drvdata (pdev));return 0 ; }
Signature · 1 line
1.8.4.3
Re: [PATCH 08/50] drm/msm: call drm_put_dev directly in ->remove
Quoted 4 lines · Daniel Vetter
The drvdata pointer is already assigned to something useful.
Cc Rob Clark <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/msm/msm_drv.c +1
-2@@ -783,7 +783,7 @@ static int msm_pdev_probe(struct platform_device *pdev)static int msm_pdev_remove (struct platform_device *pdev) { -drm_platform_exit (&msm_driver, pdev); +drm_put_dev (platform_get_drvdata (pdev));return 0 ; } --1.8.4.3
PATCH 9/50 drm: rip out drm_platform_exit
In reply to Daniel VetterThis very much looks like a remnant of the old legady ums shadow attach days. Now with the last users gone we can rip it out since we won't ever support an ums drm driver again.
--- drivers/gpu/drm/drm_platform.c | 11 ----------- include/drm/drmP.h | 1 - 2 files changed, 12 deletions(-)
drivers/gpu/drm/drm_platform.c +0 -11
@@ -151,14 +151,3 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platforreturn drm_get_platform_dev (platform_device, driver); }EXPORT_SYMBOL (drm_platform_init); - -void drm_platform_exit (struct drm_driver *driver,struct platform_device *platform_device) -{ -struct drm_device *dev, *tmp; -DRM_DEBUG ("\n" ); - -list_for_each_entry_safe (dev, tmp, &driver->device_list, driver_item) -drm_put_dev (dev); -DRM_INFO ("Module unloaded\n" ); -} -EXPORT_SYMBOL (drm_platform_exit);
include/drm/drmP.h +0 -1
@@ -1660,7 +1660,6 @@ extern int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask);/* platform section */ extern int drm_platform_init (struct drm_driver *driver,struct platform_device *platform_device); -extern void drm_platform_exit (struct drm_driver *driver,struct platform_device *platform_device);/* returns true if currently okay to sleep */ static __inline__bool drm_can_sleep (void )
Signature · 1 line
1.8.4.3
PATCH 10/50 drm: restrict the device list for shadow attached drivers
In reply to Daniel VetterThere's really no need for the drm core to keep a list of all devices of a given driver - the linux device model keeps perfect track of this already for us.
The exception is old legacy ums drivers using pci shadow attaching. So rename the lists to make the use case clearer and rip out everything else.
v2: Rebase on top of David Herrmann's drm device register changes. Also drop the bogus dev_set_drvdata for platform drivers that somehow crept into the original version - drivers really should be in full control of that field.
v3: Initialize driver->legacy_dev_list outside of the loop, spotted by David Herrmann.
v4: Rebase on top of the newly created host1x drm_bus for tegra.
--- drivers/gpu/drm/drm_pci.c | 12 ++++++++++-- drivers/gpu/drm/drm_platform.c | 1 - drivers/gpu/drm/drm_stub.c | 4 ---- drivers/gpu/drm/drm_usb.c | 1 - drivers/gpu/drm/tegra/bus.c | 1 - include/drm/drmP.h | 6 +++--- 6 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_pci.c +10 -2
@@ -346,6 +346,11 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, driver->name, driver->major, driver->minor, driver->patchlevel, driver->date, pci_name(pdev), dev->primary->index); +/* No locking needed since shadow-attach is single-threaded since it may +* only be called from the per-driver module init hook. */ +if (!drm_core_check_feature (dev,DRIVER_MODESET )) +list_add_tail (&dev->legacy_dev_list, &driver->legacy_dev_list); +return 0 ; err_pci:
@@ -375,7 +380,6 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)DRM_DEBUG ("\n" ); -INIT_LIST_HEAD (&driver->device_list); driver->kdriver.pci = pdriver; driver->bus = &drm_pci_bus;
@@ -383,6 +387,7 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)return pci_register_driver (pdriver);/* If not using KMS, fall back to stealth mode manual scanning. */ +INIT_LIST_HEAD (&driver->legacy_dev_list);for (i =0 ; pdriver->id_table[i].vendor !=0 ; i++) { pid = &pdriver->id_table[i];
@@ -465,8 +470,11 @@ void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver)if (driver->driver_features &DRIVER_MODESET ) {pci_unregister_driver (pdriver); }else { -list_for_each_entry_safe (dev, tmp, &driver->device_list, driver_item) +list_for_each_entry_safe (dev, tmp, &driver->legacy_dev_list, + legacy_dev_list) {drm_put_dev (dev); +list_del (&dev->legacy_dev_list); + } }DRM_INFO ("Module unloaded\n" ); }
drivers/gpu/drm/drm_platform.c +0 -1
@@ -147,7 +147,6 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platfor driver->kdriver.platform_device = platform_device; driver->bus = &drm_platform_bus; -INIT_LIST_HEAD (&driver->device_list);return drm_get_platform_dev (platform_device, driver); }EXPORT_SYMBOL (drm_platform_init);
drivers/gpu/drm/drm_stub.c +0 -4
@@ -557,8 +557,6 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) goto err_unload; } -list_add_tail (&dev->driver_item, &dev->driver->device_list); - ret =0 ; goto out_unlock;
@@ -608,7 +606,5 @@ void drm_dev_unregister(struct drm_device *dev)drm_unplug_minor (dev->control);drm_unplug_minor (dev->render);drm_unplug_minor (dev->primary); - -list_del (&dev->driver_item); }EXPORT_SYMBOL (drm_dev_unregister);
drivers/gpu/drm/drm_usb.c +0 -1
@@ -63,7 +63,6 @@ int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)int res;DRM_DEBUG ("\n" ); -INIT_LIST_HEAD (&driver->device_list); driver->kdriver.usb = udriver; driver->bus = &drm_usb_bus;
drivers/gpu/drm/tegra/bus.c +0 -1
@@ -46,7 +46,6 @@ int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device)struct drm_device *drm;int ret; -INIT_LIST_HEAD (&driver->device_list); driver->bus = &drm_host1x_bus; drm =drm_dev_alloc (driver, &device->dev);
include/drm/drmP.h +3 -3
@@ -995,8 +995,8 @@ struct drm_driver { } kdriver;struct drm_bus *bus; -/* List of devices hanging off this driver */ -struct list_head device_list; +/* List of devices hanging off this driver with stealth attach. */ +struct list_head legacy_dev_list; };#define DRM_MINOR_UNASSIGNED 0
@@ -1085,7 +1085,7 @@ struct drm_vblank_crtc {* may contain multiple heads. */ struct drm_device { -struct list_head driver_item;/**< list of devices per driver */ +struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ char *devname;/**< For /proc/interrupts */ int if_version;/**< Highest interface version set */
Signature · 1 line
1.8.4.3
PATCH 11/50 drm/bufs: remove handling of _DRM_GEM mappings
In reply to Daniel VetterGone with the new gem vma offset manager from David.
We can also ditch the uapi header definition from the enum since userspace never used this. It ended up in there purely for historical reasons (for reusing the old drm mmap code essentially), not because userspace ever needed it.
--- drivers/gpu/drm/drm_bufs.c | 6 ------ drivers/gpu/drm/drm_vm.c | 3 --- include/uapi/drm/drm.h | 1 - 3 files changed, 10 deletions(-)
drivers/gpu/drm/drm_bufs.c +0 -6
@@ -303,9 +303,6 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,break ; } -case _DRM_GEM: -DRM_ERROR ("tried to addmap GEM object\n" ); -break ;case _DRM_SCATTER_GATHER:if (!dev->sg) {kfree (map);
@@ -483,9 +480,6 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) dmah.size = map->size;__drm_pci_free (dev, &dmah);break ; -case _DRM_GEM: -DRM_ERROR ("tried to rmmap GEM object\n" ); -break ; }kfree (map);
drivers/gpu/drm/drm_vm.c +0 -3
@@ -266,9 +266,6 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) dmah.size = map->size;__drm_pci_free (dev, &dmah);break ; -case _DRM_GEM: -DRM_ERROR ("tried to rmmap GEM object\n" ); -break ; }kfree (map); }
include/uapi/drm/drm.h +0 -1
@@ -181,7 +181,6 @@ enum drm_map_type { _DRM_AGP =3 ,/**< AGP/GART */ _DRM_SCATTER_GATHER =4 ,/**< Scatter/gather memory for PCI DMA */ _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ - _DRM_GEM = 6, /**< GEM object (obsolete) */ };/**
Signature · 1 line
1.8.4.3
PATCH 12/50 drm: kill DRIVER_REQUIRE_AGP
In reply to Daniel VetterOnly the two intel drivers need this and they can easily check for working agp support in their driver ->load callbacks.
This is the only reason why agp initialization could fail, so allows us to rip out a bit of error handling code in the next patch.
--- drivers/gpu/drm/drm_pci.c | 5 ----- drivers/gpu/drm/i810/i810_dma.c | 4 ++++ drivers/gpu/drm/i810/i810_drv.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 5 +++++ drivers/gpu/drm/i915/i915_drv.c | 5 ++--- include/drm/drmP.h | 1 - 6 files changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_pci.c +0 -5
@@ -267,11 +267,6 @@ static int drm_pci_agp_init(struct drm_device *dev)if (drm_core_has_AGP (dev)) {if (drm_pci_device_is_agp (dev)) dev->agp =drm_agp_init (dev); -if (drm_core_check_feature (dev,DRIVER_REQUIRE_AGP ) - && (dev->agp ==NULL )) { -DRM_ERROR ("Cannot initialize the agpgart module.\n" ); -return -EINVAL ; - }if (dev->agp) { dev->agp->agp_mtrr = arch_phys_wc_add( dev->agp->agp_info.aper_base,
drivers/gpu/drm/i810/i810_dma.c +4 -0
@@ -1193,6 +1193,10 @@ static int i810_flip_bufs(struct drm_device *dev, void *data,int i810_driver_load (struct drm_device *dev,unsigned long flags) { +/* Our userspace depends upon the agp mapping support. */ +if (!dev->agp) +return -EINVAL ; +pci_set_master (dev->pdev);return 0 ;
drivers/gpu/drm/i810/i810_drv.c +1 -1
@@ -57,7 +57,7 @@ static const struct file_operations i810_driver_fops = {static struct drm_driver driver = { .driver_features = -DRIVER_USE_AGP |DRIVER_REQUIRE_AGP | +DRIVER_USE_AGP |DRIVER_HAVE_DMA , .dev_priv_size =sizeof (drm_i810_buf_priv_t), .load = i810_driver_load,
drivers/gpu/drm/i915/i915_dma.c +5 -0
@@ -1476,7 +1476,12 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)return -ENODEV ; } +/* UMS needs agp support. */ +if (!drm_core_check_feature (dev,DRIVER_MODESET ) && !dev->agp) +return -EINVAL ; + dev_priv =kzalloc (sizeof (*dev_priv),GFP_KERNEL ); +if (dev_priv ==NULL )return -ENOMEM ;
drivers/gpu/drm/i915/i915_drv.c +2 -3
@@ -833,8 +833,7 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)* (gasp!) to share buffers between X and the client. Hence we need to * keep around the fake agp stuff for gen3, even when kms is enabled. */ if (intel_info->gen !=3 ) { - driver.driver_features &= - ~(DRIVER_USE_AGP |DRIVER_REQUIRE_AGP ); + driver.driver_features &= ~DRIVER_USE_AGP ; }else if (!intel_agp_enabled) {DRM_ERROR ("drm/i915 can't work without intel_agp module!\n" );return -ENODEV ;
@@ -946,7 +945,7 @@ static struct drm_driver driver = {* deal with them for Intel hardware. */ .driver_features = -DRIVER_USE_AGP |DRIVER_REQUIRE_AGP | +DRIVER_USE_AGP |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED |DRIVER_GEM |DRIVER_PRIME | DRIVER_RENDER, .load = i915_driver_load,
include/drm/drmP.h +0 -1
@@ -136,7 +136,6 @@ int drm_err(const char *func, const char *format, ...);/* driver capabilities and requirements mask */ #define DRIVER_USE_AGP 0x1 -#define DRIVER_REQUIRE_AGP 0x2#define DRIVER_PCI_DMA 0x8#define DRIVER_SG 0x10#define DRIVER_HAVE_DMA 0x20
Signature · 1 line
1.8.4.3
PATCH 13/50 drm: ->agp_init can't fail
In reply to Daniel VetterThanks to the removal of REQUIRE_AGP we can use a void return value and shed a bit of complexity.
--- drivers/gpu/drm/drm_pci.c | 3 +-- drivers/gpu/drm/drm_stub.c | 7 ++----- include/drm/drmP.h | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_pci.c +1 -2
@@ -262,7 +262,7 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)return 0 ; } -static int drm_pci_agp_init (struct drm_device *dev) +static void drm_pci_agp_init (struct drm_device *dev) {if (drm_core_has_AGP (dev)) {if (drm_pci_device_is_agp (dev))
@@ -274,7 +274,6 @@ static int drm_pci_agp_init(struct drm_device *dev) 1024 * 1024); } } -return 0 ; }static void drm_pci_agp_destroy (struct drm_device *dev)
drivers/gpu/drm/drm_stub.c +2 -5
@@ -521,11 +521,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)mutex_lock (&drm_global_mutex); -if (dev->driver->bus->agp_init) { - ret = dev->driver->bus->agp_init (dev); -if (ret) - goto out_unlock; - } +if (dev->driver->bus->agp_init) + dev->driver->bus->agp_init (dev);if (drm_core_check_feature (dev,DRIVER_MODESET )) { ret =drm_get_minor (dev, &dev->control,DRM_MINOR_CONTROL );
include/drm/drmP.h +1 -1
@@ -750,7 +750,7 @@ struct drm_bus { struct drm_unique *unique);int (*irq_by_busid)(struct drm_device *dev,struct drm_irq_busid *p);/* hooks that are for PCI */ -int (*agp_init)(struct drm_device *dev); +void (*agp_init)(struct drm_device *dev);void (*agp_destroy)(struct drm_device *dev); };
Signature · 1 line
1.8.4.3
PATCH 14/50 drm: rip out drm_core_has_AGP
In reply to Daniel VetterMost place actually want to just check for dev->agp (most do, but a few don't so this fixes a few potential NULL derefs). The only exception is the agp init code which should check for the AGP driver feature flag.
--- drivers/gpu/drm/drm_agpsupport.c | 2 +- drivers/gpu/drm/drm_bufs.c | 4 ++-- drivers/gpu/drm/drm_memory.c | 9 +++------ drivers/gpu/drm/drm_pci.c | 4 ++-- drivers/gpu/drm/drm_vm.c | 4 ++-- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- include/drm/drm_agpsupport.h | 12 ------------ 7 files changed, 11 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +1 -1
@@ -439,7 +439,7 @@ void drm_agp_clear(struct drm_device *dev) {struct drm_agp_mem *entry, *tempe; -if (!drm_core_has_AGP (dev) || !dev->agp) +if (!dev->agp)return ;if (drm_core_check_feature (dev,DRIVER_MODESET ))return ;
drivers/gpu/drm/drm_bufs.c +2 -2
@@ -261,7 +261,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,struct drm_agp_mem *entry;int valid =0 ; -if (!drm_core_has_AGP (dev)) { +if (!dev->agp) {kfree (map);return -EINVAL ; }
@@ -1390,7 +1390,7 @@ int drm_mapbufs(struct drm_device *dev, void *data,spin_unlock (&dev->count_lock);if (request->count >= dma->buf_count) { -if ((drm_core_has_AGP (dev) && (dma->flags & _DRM_DMA_USE_AGP)) +if ((dev->agp && (dma->flags & _DRM_DMA_USE_AGP)) || (drm_core_check_feature (dev,DRIVER_SG ) && (dma->flags & _DRM_DMA_USE_SG))) {struct drm_local_map *map = dev->agp_buffer_map;
drivers/gpu/drm/drm_memory.c +3 -6
@@ -110,8 +110,7 @@ static inline void *agp_remap(unsigned long offset, unsigned long size,void drm_core_ioremap (struct drm_local_map *map,struct drm_device *dev) { -if (drm_core_has_AGP (dev) && - dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) +if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) map->handle =agp_remap (map->offset, map->size, dev);else map->handle =ioremap (map->offset, map->size);
@@ -120,8 +119,7 @@ EXPORT_SYMBOL(drm_core_ioremap);void drm_core_ioremap_wc (struct drm_local_map *map,struct drm_device *dev) { -if (drm_core_has_AGP (dev) && - dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) +if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) map->handle =agp_remap (map->offset, map->size, dev);else map->handle =ioremap_wc (map->offset, map->size);
@@ -133,8 +131,7 @@ void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)if (!map->handle || !map->size)return ; -if (drm_core_has_AGP (dev) && - dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP) +if (dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)vunmap (map->handle);else iounmap (map->handle);
drivers/gpu/drm/drm_pci.c +2 -2
@@ -264,7 +264,7 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)static void drm_pci_agp_init (struct drm_device *dev) { -if (drm_core_has_AGP (dev)) { +if (drm_core_check_feature (dev,DRIVER_USE_AGP )) {if (drm_pci_device_is_agp (dev)) dev->agp =drm_agp_init (dev);if (dev->agp) {
@@ -278,7 +278,7 @@ static void drm_pci_agp_init(struct drm_device *dev)static void drm_pci_agp_destroy (struct drm_device *dev) { -if (drm_core_has_AGP (dev) && dev->agp) { +if (dev->agp) {arch_phys_wc_del (dev->agp->agp_mtrr);drm_agp_clear (dev);drm_agp_destroy (dev->agp);
drivers/gpu/drm/drm_vm.c +2 -2
@@ -101,7 +101,7 @@ static int drm_do_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)/* * Find the right map */ -if (!drm_core_has_AGP (dev)) +if (!dev->agp) goto vm_fault_error;if (!dev->agp || !dev->agp->cant_use_aperture)
@@ -592,7 +592,7 @@ int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)switch (map->type) {#if !defined(__arm__)case _DRM_AGP: -if (drm_core_has_AGP (dev) && dev->agp->cant_use_aperture) { +if (dev->agp && dev->agp->cant_use_aperture) {/* * On some platforms we can't talk to bus dma address from the CPU, so for * memory of type DRM_AGP, we'll deal with sorting out the real physical
drivers/gpu/drm/radeon/radeon_ttm.c +1 -1
@@ -142,7 +142,7 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->flags =TTM_MEMTYPE_FLAG_MAPPABLE |TTM_MEMTYPE_FLAG_CMA ;#if __OS_HAS_AGPif (rdev->flags &RADEON_IS_AGP ) { -if (!(drm_core_has_AGP (rdev->ddev) && rdev->ddev->agp)) { +if (!rdev->ddev->agp) {DRM_ERROR ("AGP is not enabled for memory type %u\n" , (unsigned )type);return -EINVAL ;
include/drm/drm_agpsupport.h +0 -12
@@ -46,12 +46,6 @@ int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,int drm_agp_bind (struct drm_device *dev,struct drm_agp_binding *request);int drm_agp_bind_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); - -static inline int drm_core_has_AGP (struct drm_device *dev) -{ -return drm_core_check_feature (dev,DRIVER_USE_AGP ); -} -#else /* __OS_HAS_AGP */ static inline void drm_free_agp (DRM_AGP_MEM * handle,int pages)
@@ -183,12 +177,6 @@ static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data, {return -ENODEV ; } - -static inline int drm_core_has_AGP (struct drm_device *dev) -{ -return 0 ; -} -#endif /* __OS_HAS_AGP */ #endif /* _DRM_AGPSUPPORT_H_ */
Signature · 1 line
1.8.4.3
PATCH 15/50 drm: remove agp_init() bus callback
In reply to Daniel VetterThe PCI bus helper is the only user of it. Call it directly before device-registration to get rid of the callback.
Note that all drm_agp_*() calls are locked with the drm-global-mutex so we need to explicitly lock it during initialization. It's not really clear why it's needed, but lets be safe.
v2: Rebase on top of the agp_init interface change.
v3: Remove the rebase-fail where I've accidentally killed the ->irq_by_busid callback a bit too early.
--- drivers/gpu/drm/drm_pci.c | 12 +++++++++--- drivers/gpu/drm/drm_stub.c | 8 +------- include/drm/drmP.h | 1 - 3 files changed, 10 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_pci.c +9 -3
@@ -293,7 +293,6 @@ static struct drm_bus drm_pci_bus = { .set_busid = drm_pci_set_busid, .set_unique = drm_pci_set_unique, .irq_by_busid = drm_pci_irq_by_busid, - .agp_init = drm_pci_agp_init, .agp_destroy = drm_pci_agp_destroy, };
@@ -332,9 +331,13 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,if (drm_core_check_feature (dev,DRIVER_MODESET ))pci_set_drvdata (pdev, dev); +mutex_lock (&drm_global_mutex); +drm_pci_agp_init (dev); +mutex_unlock (&drm_global_mutex); + ret =drm_dev_register (dev, ent->driver_data);if (ret) - goto err_pci; + goto err_agp; DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n", driver->name, driver->major, driver->minor, driver->patchlevel,
@@ -347,7 +350,10 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,return 0 ; -err_pci: +err_agp: +mutex_lock (&drm_global_mutex); +drm_pci_agp_destroy (dev); +mutex_unlock (&drm_global_mutex);pci_disable_device (pdev); err_free:drm_dev_free (dev);
drivers/gpu/drm/drm_stub.c +1 -7
@@ -521,13 +521,10 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)mutex_lock (&drm_global_mutex); -if (dev->driver->bus->agp_init) - dev->driver->bus->agp_init (dev); -if (drm_core_check_feature (dev,DRIVER_MODESET )) { ret =drm_get_minor (dev, &dev->control,DRM_MINOR_CONTROL );if (ret) - goto err_agp; + goto out_unlock; }if (drm_core_check_feature (dev,DRIVER_RENDER ) && drm_rnodes) {
@@ -566,9 +563,6 @@ err_render_node:drm_put_minor (dev->render); err_control_node:drm_put_minor (dev->control); -err_agp: -if (dev->driver->bus->agp_destroy) - dev->driver->bus->agp_destroy (dev); out_unlock:mutex_unlock (&drm_global_mutex);return ret;
include/drm/drmP.h +0 -1
@@ -750,7 +750,6 @@ struct drm_bus { struct drm_unique *unique);int (*irq_by_busid)(struct drm_device *dev,struct drm_irq_busid *p);/* hooks that are for PCI */ -void (*agp_init)(struct drm_device *dev);void (*agp_destroy)(struct drm_device *dev); };
Signature · 1 line
1.8.4.3
PATCH 16/50 drm: inline drm_agp_destroy
In reply to Daniel VetterWrapping a kfree is pointless.
v2: Add a comment to the kerneldoc for drm_agp_init to explain where the kfree happens as requested by David. Note that for modeset drivers agp cleanup is fairly complicated anyway: The drm_agp_clear is a noop and drivers must call drm_agp_release on their own. Which they all seem to do properly.
--- drivers/gpu/drm/drm_agpsupport.c | 18 +++--------------- drivers/gpu/drm/drm_pci.c | 2 +- include/drm/drm_agpsupport.h | 5 ----- 3 files changed, 4 insertions(+), 21 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +3 -15
@@ -393,6 +393,9 @@ int drm_agp_free_ioctl(struct drm_device *dev, void *data,* Gets the drm_agp_t structure which is made available by the agpgart module * via the inter_module_* functions. Creates and initializes a drm_agp_head * structure. +* +* Note that final cleanup of the kmalloced structure is directly done in +* drm_pci_agp_destroy. */ struct drm_agp_head *drm_agp_init (struct drm_device *dev) {
@@ -460,21 +463,6 @@ void drm_agp_clear(struct drm_device *dev) }/** -* drm_agp_destroy - Destroy AGP head -* @dev: DRM device -* -* Destroy resources that were previously allocated via drm_agp_initp. Caller -* must ensure to clean up all AGP resources before calling this. See -* drm_agp_clear(). -* -* Call this to destroy AGP heads allocated via drm_agp_init(). -*/ -void drm_agp_destroy (struct drm_agp_head *agp) -{ -kfree (agp); -} - -/** * Binds a collection of pages into AGP memory at the given offset, returning * the AGP memory structure containing them. *
drivers/gpu/drm/drm_pci.c +1 -1
@@ -281,7 +281,7 @@ static void drm_pci_agp_destroy(struct drm_device *dev)if (dev->agp) {arch_phys_wc_del (dev->agp->agp_mtrr);drm_agp_clear (dev); -drm_agp_destroy (dev->agp); +kfree (dev->agp); dev->agp =NULL ; } }
include/drm/drm_agpsupport.h +0 -5
@@ -20,7 +20,6 @@ DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, uint32_t type);struct drm_agp_head *drm_agp_init (struct drm_device *dev); -void drm_agp_destroy (struct drm_agp_head *agp);void drm_agp_clear (struct drm_device *dev);int drm_agp_acquire (struct drm_device *dev); int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
@@ -76,10 +75,6 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)return NULL ; } -static inline void drm_agp_destroy (struct drm_agp_head *agp) -{ -} -static inline void drm_agp_clear (struct drm_device *dev) { }
Signature · 1 line
1.8.4.3
PATCH 17/50 drm: kill the ->agp_destroy callback
In reply to Daniel VetterCall drm_pci_agp_destroy directly, there's no point in the indirection. Long term we want to shuffle this into each driver's unload logic, but that needs cleared-up drm lifetime rules first.
v2: Add a dummy function for !CONFIG_PCI, spotted my David Herrmann.
v3: Fixup for the coding style police.
--- drivers/gpu/drm/drm_pci.c | 4 ++-- drivers/gpu/drm/drm_stub.c | 4 ++-- include/drm/drmP.h | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_pci.c +2 -2
@@ -276,7 +276,7 @@ static void drm_pci_agp_init(struct drm_device *dev) } } -static void drm_pci_agp_destroy (struct drm_device *dev) +void drm_pci_agp_destroy (struct drm_device *dev) {if (dev->agp) {arch_phys_wc_del (dev->agp->agp_mtrr);
@@ -293,7 +293,6 @@ static struct drm_bus drm_pci_bus = { .set_busid = drm_pci_set_busid, .set_unique = drm_pci_set_unique, .irq_by_busid = drm_pci_irq_by_busid, - .agp_destroy = drm_pci_agp_destroy, };/**
@@ -457,6 +456,7 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) return -1; } +void drm_pci_agp_destroy (struct drm_device *dev) {}#endif EXPORT_SYMBOL (drm_pci_init);
drivers/gpu/drm/drm_stub.c +2 -2
@@ -586,8 +586,8 @@ void drm_dev_unregister(struct drm_device *dev)if (dev->driver->unload) dev->driver->unload (dev); -if (dev->driver->bus->agp_destroy) - dev->driver->bus->agp_destroy (dev); +if (dev->agp) +drm_pci_agp_destroy (dev);drm_vblank_cleanup (dev);
include/drm/drmP.h +1 -3
@@ -749,9 +749,6 @@ struct drm_bus {int (*set_unique)(struct drm_device *dev,struct drm_master *master,struct drm_unique *unique);int (*irq_by_busid)(struct drm_device *dev,struct drm_irq_busid *p); -/* hooks that are for PCI */ -void (*agp_destroy)(struct drm_device *dev); - };/**
@@ -1643,6 +1640,7 @@ static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)return pci_find_capability (dev->pdev,PCI_CAP_ID_AGP ); } +void drm_pci_agp_destroy (struct drm_device *dev);extern int drm_pci_init (struct drm_driver *driver,struct pci_driver *pdriver);extern void drm_pci_exit (struct drm_driver *driver,struct pci_driver *pdriver);
Signature · 1 line
1.8.4.3
PATCH 18/50 drm: remove global_mutex locking around agp_init
In reply to Daniel VetterDavid Herrmann dutifully moved this locking along when moving the agp_init call out of the generic drm_dev_register into the pci specific load helpers.
But afaict there's no need and the reason for that locking has been purely a historical accident - we need the lock around the driver dev node registration to paper over the midlayer init races, and the agp init simply ended up in there. The real fix for all this is of course to delay the dev (and sysfs/debugfs) interface registration until everything is fully set up.
Until then stop the cargo-cult locking from spreading and remove the locking.
--- drivers/gpu/drm/drm_pci.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/drm_pci.c +0 -4
@@ -330,9 +330,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,if (drm_core_check_feature (dev,DRIVER_MODESET ))pci_set_drvdata (pdev, dev); -mutex_lock (&drm_global_mutex);drm_pci_agp_init (dev); -mutex_unlock (&drm_global_mutex); ret =drm_dev_register (dev, ent->driver_data);if (ret)
@@ -350,9 +348,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent,return 0 ; err_agp: -mutex_lock (&drm_global_mutex);drm_pci_agp_destroy (dev); -mutex_unlock (&drm_global_mutex);pci_disable_device (pdev); err_free:drm_dev_free (dev);
Signature · 1 line
1.8.4.3
PATCH 19/50 drm: rip out DRM_AGP_MEM and DRM_AGP_KERN
In reply to Daniel VetterThe <linux/agp_backend.h> header provides dummy functions and fallbacks, so no need for screaming macros.
--- drivers/gpu/drm/drm_agpsupport.c | 8 ++++---- drivers/gpu/drm/drm_memory.c | 6 +++--- include/drm/drmP.h | 5 +++-- include/drm/drm_agpsupport.h | 16 ++++++++-------- include/drm/drm_os_linux.h | 14 -------------- 5 files changed, 18 insertions(+), 31 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +4 -4
@@ -53,7 +53,7 @@*/ int drm_agp_info (struct drm_device *dev,struct drm_agp_info *info) { -DRM_AGP_KERN *kern; +struct agp_kern_info *kern;if (!dev->agp || !dev->agp->acquired)return -EINVAL ;
@@ -198,7 +198,7 @@ int drm_agp_enable_ioctl(struct drm_device *dev, void *data,int drm_agp_alloc (struct drm_device *dev,struct drm_agp_buffer *request) {struct drm_agp_mem *entry; -DRM_AGP_MEM *memory; +struct agp_memory *memory;unsigned long pages;u32 type;
@@ -469,14 +469,14 @@ void drm_agp_clear(struct drm_device *dev)* No reference is held on the pages during this time -- it is up to the * caller to handle that. */ -DRM_AGP_MEM * +struct agp_memory *drm_agp_bind_pages (struct drm_device *dev,struct page **pages,unsigned long num_pages,uint32_t gtt_offset,u32 type) { -DRM_AGP_MEM *mem; +struct agp_memory *mem;int ret, i;DRM_DEBUG ("\n" );
drivers/gpu/drm/drm_memory.c +3 -3
@@ -82,19 +82,19 @@ static void *agp_remap(unsigned long offset, unsigned long size, }/** Wrapper around agp_free_memory() */ -void drm_free_agp (DRM_AGP_MEM * handle,int pages) +void drm_free_agp (struct agp_memory * handle,int pages) {agp_free_memory (handle); }/** Wrapper around agp_bind_memory() */ -int drm_bind_agp (DRM_AGP_MEM * handle,unsigned int start) +int drm_bind_agp (struct agp_memory * handle,unsigned int start) {return agp_bind_memory (handle, start); }/** Wrapper around agp_unbind_memory() */ -int drm_unbind_agp (DRM_AGP_MEM * handle) +int drm_unbind_agp (struct agp_memory * handle) {return agp_unbind_memory (handle); }
include/drm/drmP.h +3 -2
@@ -510,7 +510,7 @@ struct drm_device_dma {*/ struct drm_agp_mem {unsigned long handle;/**< handle */ -DRM_AGP_MEM *memory; +struct agp_memory *memory;unsigned long bound;/**< address */ int pages;struct list_head head;
@@ -522,7 +522,7 @@ struct drm_agp_mem {* \sa drm_agp_init() and drm_device::agp. */ struct drm_agp_head { -DRM_AGP_KERN agp_info;/**< AGP device information */ +struct agp_kern_info agp_info;/**< AGP device information */ struct list_head memory;unsigned long mode;/**< AGP mode */ struct agp_bridge_data *bridge;
@@ -1263,6 +1263,7 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);/* Memory management support (drm_memory.h) */ #include <drm/drm_memory.h> +/* Misc. IOCTL support (drm_ioctl.h) */ extern int drm_irq_by_busid (struct drm_device *dev,void *data,struct drm_file *file_priv);
include/drm/drm_agpsupport.h +8 -8
@@ -10,10 +10,10 @@#if __OS_HAS_AGP -void drm_free_agp (DRM_AGP_MEM * handle,int pages); -int drm_bind_agp (DRM_AGP_MEM * handle,unsigned int start); -int drm_unbind_agp (DRM_AGP_MEM * handle); -DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, +void drm_free_agp (struct agp_memory * handle,int pages); +int drm_bind_agp (struct agp_memory * handle,unsigned int start); +int drm_unbind_agp (struct agp_memory * handle); +struct agp_memory *drm_agp_bind_pages(struct drm_device *dev, struct page **pages, unsigned long num_pages, uint32_t gtt_offset,
@@ -47,21 +47,21 @@ int drm_agp_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);#else /* __OS_HAS_AGP */ -static inline void drm_free_agp (DRM_AGP_MEM * handle,int pages) +static inline void drm_free_agp (struct agp_memory * handle,int pages) { } -static inline int drm_bind_agp (DRM_AGP_MEM * handle,unsigned int start) +static inline int drm_bind_agp (struct agp_memory * handle,unsigned int start) {return -ENODEV ; } -static inline int drm_unbind_agp (DRM_AGP_MEM * handle) +static inline int drm_unbind_agp (struct agp_memory * handle) {return -ENODEV ; } -static inline DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, +static inline struct agp_memory *drm_agp_bind_pages(struct drm_device *dev, struct page **pages, unsigned long num_pages, uint32_t gtt_offset,
include/drm/drm_os_linux.h +0 -14
@@ -51,20 +51,6 @@ static inline void writeq(u64 val, void __iomem *reg)/** IRQ handler arguments and return type and values */ #define DRM_IRQ_ARGS int irq, void *arg -/** AGP types */ -#if __OS_HAS_AGP -#define DRM_AGP_MEM struct agp_memory -#define DRM_AGP_KERN struct agp_kern_info -#else -/* define some dummy types for non AGP supporting kernels */ -struct no_agp_kern { -unsigned long aper_base; -unsigned long aper_size; -}; -#define DRM_AGP_MEM int -#define DRM_AGP_KERN struct no_agp_kern -#endif -/** Other copying of data to kernel space */ #define DRM_COPY_FROM_USER (arg1, arg2, arg3) \ copy_from_user(arg1, arg2, arg3)
Signature · 1 line
1.8.4.3
PATCH 20/50 drm: Kill DRM_HZ
In reply to Daniel VetterWe don't have any userspace interfaces that use HZ as a time unit, so having our own DRM define is useless.
Remove this remnant from the shared drm core days.
--- drivers/gpu/drm/drm_irq.c | 4 ++-- drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- drivers/gpu/drm/gma500/accel_2d.c | 2 +- drivers/gpu/drm/gma500/psb_drv.h | 6 +++--- drivers/gpu/drm/gma500/psb_irq.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/mga/mga_irq.c | 2 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/radeon/radeon_irq.c | 2 +- drivers/gpu/drm/sis/sis_mm.c | 2 +- drivers/gpu/drm/via/via_dmablit.c | 8 ++++---- drivers/gpu/drm/via/via_irq.c | 4 ++-- drivers/gpu/drm/via/via_video.c | 2 +- include/drm/drm_os_linux.h | 2 -- 14 files changed, 20 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_irq.c +2 -2
@@ -960,7 +960,7 @@ void drm_vblank_put(struct drm_device *dev, int crtc)if (atomic_dec_and_test (&dev->vblank[crtc].refcount) && (drm_vblank_offdelay >0 ))mod_timer (&dev->vblank_disable_timer, - jiffies + ((drm_vblank_offdelay *DRM_HZ )/1000 )); + jiffies + ((drm_vblank_offdelay *HZ )/1000 )); }EXPORT_SYMBOL (drm_vblank_put);
@@ -1244,7 +1244,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,DRM_DEBUG ("waiting on vblank count %d, crtc %d\n" , vblwait->request.sequence, crtc); dev->vblank[crtc].last_wait = vblwait->request.sequence; -DRM_WAIT_ON (ret, dev->vblank[crtc].queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, dev->vblank[crtc].queue,3 *HZ , (((drm_vblank_count (dev, crtc) - vblwait->request.sequence) <= (1 <<23 )) || !dev->irq_enabled));
drivers/gpu/drm/exynos/exynos_mixer.c +1 -1
@@ -868,7 +868,7 @@ static void mixer_wait_for_vblank(void *ctx)*/ if (!wait_event_timeout (mixer_ctx->wait_vsync_queue, !atomic_read (&mixer_ctx->wait_vsync_event), -DRM_HZ /20 )) +HZ /20 ))DRM_DEBUG_KMS ("vblank wait timed out.\n" ); }
drivers/gpu/drm/gma500/accel_2d.c +1 -1
@@ -326,7 +326,7 @@ int psbfb_sync(struct fb_info *info)struct psb_framebuffer *psbfb = &fbdev->pfb;struct drm_device *dev = psbfb->base.dev;struct drm_psb_private *dev_priv = dev->dev_private; -unsigned long _end = jiffies +DRM_HZ ; +unsigned long _end = jiffies +HZ ;int busy =0 ;unsigned long flags;
drivers/gpu/drm/gma500/psb_drv.h +3 -3
@@ -212,8 +212,8 @@ enum {#define PSB_HIGH_REG_OFFS 0x0600#define PSB_NUM_VBLANKS 2 -#define PSB_WATCHDOG_DELAY (DRM_HZ * 2) -#define PSB_LID_DELAY (DRM_HZ / 10) +#define PSB_WATCHDOG_DELAY (HZ * 2) +#define PSB_LID_DELAY (HZ / 10)#define MDFLD_PNW_B0 0x04#define MDFLD_PNW_C0 0x08
@@ -232,7 +232,7 @@ enum {#define MDFLD_DSR_RR 45#define MDFLD_DPU_ENABLE (1 << 31)#define MDFLD_DSR_FULLSCREEN (1 << 30) -#define MDFLD_DSR_DELAY (DRM_HZ / MDFLD_DSR_RR) +#define MDFLD_DSR_DELAY (HZ / MDFLD_DSR_RR)#define PSB_PWR_STATE_ON 1#define PSB_PWR_STATE_OFF 2
drivers/gpu/drm/gma500/psb_irq.c +1 -1
@@ -456,7 +456,7 @@ static int psb_vblank_do_wait(struct drm_device *dev, {unsigned int cur_vblank;int ret =0 ; -DRM_WAIT_ON (ret, dev->vblank.queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, dev->vblank.queue,3 *HZ , (((cur_vblank =atomic_read (counter)) - *sequence) <= (1 <<23 ))); *sequence = cur_vblank;
drivers/gpu/drm/i915/i915_dma.c +1 -1
@@ -783,7 +783,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) master_priv->sarea_priv->perf_boxes |=I915_BOX_WAIT ;if (ring->irq_get (ring)) { -DRM_WAIT_ON (ret, ring->irq_queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, ring->irq_queue,3 *HZ ,READ_BREADCRUMB (dev_priv) >= irq_nr); ring->irq_put (ring); }else if (wait_for (READ_BREADCRUMB (dev_priv) >= irq_nr,3000 ))
drivers/gpu/drm/mga/mga_irq.c +1 -1
@@ -128,7 +128,7 @@ int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence)* by about a day rather than she wants to wait for years * using fences. */ -DRM_WAIT_ON (ret, dev_priv->fence_queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, dev_priv->fence_queue,3 *HZ , (((cur_fence =atomic_read (&dev_priv->last_fence_retired)) - *sequence) <= (1 <<23 )));
drivers/gpu/drm/nouveau/nouveau_fence.c +1 -1
@@ -143,7 +143,7 @@ nouveau_fence_emit(struct nouveau_fence *fence, struct nouveau_channel *chan)int ret; fence->channel = chan; - fence->timeout = jiffies + (15 *DRM_HZ ); + fence->timeout = jiffies + (15 *HZ ); fence->sequence = ++fctx->sequence; ret = fctx->emit (fence);
drivers/gpu/drm/radeon/radeon_irq.c +1 -1
@@ -249,7 +249,7 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr) dev_priv->stats.boxes |=RADEON_BOX_WAIT_IDLE ; -DRM_WAIT_ON (ret, dev_priv->swi_queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, dev_priv->swi_queue,3 *HZ ,RADEON_READ (RADEON_LAST_SWI_REG ) >= swi_nr);return ret;
drivers/gpu/drm/sis/sis_mm.c +1 -1
@@ -266,7 +266,7 @@ int sis_idle(struct drm_device *dev)* because its polling frequency is too low. */ - end = jiffies + (DRM_HZ *3 ); + end = jiffies + (HZ *3 );for (i =0 ; i <4 ; ++i) { do {
drivers/gpu/drm/via/via_dmablit.c +4 -4
@@ -363,7 +363,7 @@ via_dmablit_handler(struct drm_device *dev, int engine, int from_irq)via_abort_dmablit (dev, engine); blitq->aborting =1 ; - blitq->end = jiffies +DRM_HZ ; + blitq->end = jiffies +HZ ; }if (!blitq->is_active) {
@@ -372,7 +372,7 @@ via_dmablit_handler(struct drm_device *dev, int engine, int from_irq) blitq->is_active =1 ; blitq->cur = cur; blitq->num_outstanding--; - blitq->end = jiffies +DRM_HZ ; + blitq->end = jiffies +HZ ;if (!timer_pending (&blitq->poll_timer))mod_timer (&blitq->poll_timer, jiffies +1 ); }else {
@@ -436,7 +436,7 @@ via_dmablit_sync(struct drm_device *dev, uint32_t handle, int engine)int ret =0 ;if (via_dmablit_active (blitq, engine, handle, &queue)) { -DRM_WAIT_ON (ret, *queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, *queue,3 *HZ , !via_dmablit_active (blitq, engine, handle,NULL )); } DRM_DEBUG("DMA blit sync handle 0x%x engine %d returned %d\n",
@@ -688,7 +688,7 @@ via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine)while (blitq->num_free ==0 ) {spin_unlock_irqrestore (&blitq->blit_lock, irqsave); -DRM_WAIT_ON (ret, blitq->busy_queue,DRM_HZ , blitq->num_free >0 ); +DRM_WAIT_ON (ret, blitq->busy_queue,HZ , blitq->num_free >0 );if (ret)return (-EINTR == ret) ? -EAGAIN : ret;
drivers/gpu/drm/via/via_irq.c +2 -2
@@ -239,12 +239,12 @@ via_driver_irq_wait(struct drm_device *dev, unsigned int irq, int force_sequence cur_irq = dev_priv->via_irqs + real_irq;if (masks[real_irq][2 ] && !force_sequence) { -DRM_WAIT_ON (ret, cur_irq->irq_queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, cur_irq->irq_queue,3 *HZ , ((VIA_READ (masks[irq][2 ]) & masks[irq][3 ]) == masks[irq][4 ])); cur_irq_sequence =atomic_read (&cur_irq->irq_received); }else { -DRM_WAIT_ON (ret, cur_irq->irq_queue,3 *DRM_HZ , +DRM_WAIT_ON (ret, cur_irq->irq_queue,3 *HZ , (((cur_irq_sequence =atomic_read (&cur_irq->irq_received)) - *sequence) <= (1 <<23 )));
drivers/gpu/drm/via/via_video.c +1 -1
@@ -83,7 +83,7 @@ int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_switch (fx->func) {case VIA_FUTEX_WAIT :DRM_WAIT_ON (ret, dev_priv->decoder_queue[fx->lock], - (fx->ms /10 ) * (DRM_HZ /100 ), *lock != fx->val); + (fx->ms /10 ) * (HZ /100 ), *lock != fx->val);return ret;case VIA_FUTEX_WAKE :DRM_WAKEUP (&(dev_priv->decoder_queue[fx->lock]));
include/drm/drm_os_linux.h +0 -2
@@ -58,8 +58,6 @@ static inline void writeq(u64 val, void __iomem *reg)#define DRM_COPY_TO_USER (arg1, arg2, arg3) \ copy_to_user(arg1, arg2, arg3) -#define DRM_HZ HZ -#define DRM_WAIT_ON ( ret, queue, timeout, condition ) \ do { \ DECLARE_WAITQUEUE(entry, current); \
Signature · 1 line
1.8.4.3
PATCH 21/50 drm: Kill DRM_IRQ_ARGS
In reply to Daniel VetterI've killed them a long time ago in drm/i915, let's get rid of this remnant of shared drm core days for good.
--- drivers/gpu/drm/cirrus/cirrus_drv.h | 2 +- drivers/gpu/drm/gma500/psb_drv.h | 2 +- drivers/gpu/drm/gma500/psb_irq.c | 2 +- drivers/gpu/drm/gma500/psb_irq.h | 2 +- drivers/gpu/drm/mga/mga_drv.h | 2 +- drivers/gpu/drm/mga/mga_irq.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- drivers/gpu/drm/omapdrm/omap_irq.c | 2 +- drivers/gpu/drm/qxl/qxl_drv.h | 2 +- drivers/gpu/drm/qxl/qxl_irq.c | 2 +- drivers/gpu/drm/r128/r128_drv.h | 2 +- drivers/gpu/drm/r128/r128_irq.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.h | 2 +- drivers/gpu/drm/radeon/radeon_irq.c | 2 +- drivers/gpu/drm/radeon/radeon_irq_kms.c | 4 ++-- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- drivers/gpu/drm/via/via_drv.h | 2 +- drivers/gpu/drm/via/via_irq.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | 2 +- include/drm/drmP.h | 2 +- include/drm/drm_os_linux.h | 3 --- 24 files changed, 24 insertions(+), 27 deletions(-)
drivers/gpu/drm/cirrus/cirrus_drv.h +1 -1
@@ -222,7 +222,7 @@ void cirrus_fbdev_fini(struct cirrus_device *cdev);void cirrus_driver_irq_preinstall (struct drm_device *dev);int cirrus_driver_irq_postinstall (struct drm_device *dev);void cirrus_driver_irq_uninstall (struct drm_device *dev); -irqreturn_t cirrus_driver_irq_handler (DRM_IRQ_ARGS ); +irqreturn_t cirrus_driver_irq_handler (int irq,void *arg);/* cirrus_kms.c */ int cirrus_driver_load (struct drm_device *dev,unsigned long flags);
drivers/gpu/drm/gma500/psb_drv.h +1 -1
@@ -769,7 +769,7 @@ extern void psb_mmu_remove_pages(struct psb_mmu_pd *pd,*psb_irq.c */ -extern irqreturn_t psb_irq_handler (DRM_IRQ_ARGS ); +extern irqreturn_t psb_irq_handler (int irq,void *arg);extern int psb_irq_enable_dpst (struct drm_device *dev);extern int psb_irq_disable_dpst (struct drm_device *dev);extern void psb_irq_preinstall (struct drm_device *dev);
drivers/gpu/drm/gma500/psb_irq.c +1 -1
@@ -200,7 +200,7 @@ static void psb_vdc_interrupt(struct drm_device *dev, uint32_t vdc_stat)mid_pipe_event_handler (dev,1 ); } -irqreturn_t psb_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t psb_irq_handler (int irq,void *arg) {struct drm_device *dev = arg;struct drm_psb_private *dev_priv = dev->dev_private;
drivers/gpu/drm/gma500/psb_irq.h +1 -1
@@ -32,7 +32,7 @@ void sysirq_uninit(struct drm_device *dev);void psb_irq_preinstall (struct drm_device *dev);int psb_irq_postinstall (struct drm_device *dev);void psb_irq_uninstall (struct drm_device *dev); -irqreturn_t psb_irq_handler (DRM_IRQ_ARGS ); +irqreturn_t psb_irq_handler (int irq,void *arg);int psb_irq_enable_dpst (struct drm_device *dev);int psb_irq_disable_dpst (struct drm_device *dev);
drivers/gpu/drm/mga/mga_drv.h +1 -1
@@ -186,7 +186,7 @@ extern void mga_disable_vblank(struct drm_device *dev, int crtc);extern u32 mga_get_vblank_counter (struct drm_device *dev,int crtc);extern int mga_driver_fence_wait (struct drm_device *dev,unsigned int *sequence);extern int mga_driver_vblank_wait (struct drm_device *dev,unsigned int *sequence); -extern irqreturn_t mga_driver_irq_handler (DRM_IRQ_ARGS ); +extern irqreturn_t mga_driver_irq_handler (int irq,void *arg);extern void mga_driver_irq_preinstall (struct drm_device *dev);extern int mga_driver_irq_postinstall (struct drm_device *dev);extern void mga_driver_irq_uninstall (struct drm_device *dev);
drivers/gpu/drm/mga/mga_irq.c +1 -1
@@ -47,7 +47,7 @@ u32 mga_get_vblank_counter(struct drm_device *dev, int crtc) } -irqreturn_t mga_driver_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t mga_driver_irq_handler (int irq,void *arg) {struct drm_device *dev = (struct drm_device *) arg;drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private;
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -326,7 +326,7 @@ static void msm_lastclose(struct drm_device *dev) } } -static irqreturn_t msm_irq (DRM_IRQ_ARGS ) +static irqreturn_t msm_irq (int irq,void *arg) {struct drm_device *dev = arg;struct msm_drm_private *priv = dev->dev_private;
drivers/gpu/drm/omapdrm/omap_drv.h +1 -1
@@ -141,7 +141,7 @@ int omap_gem_resume(struct device *dev);int omap_irq_enable_vblank (struct drm_device *dev,int crtc_id);void omap_irq_disable_vblank (struct drm_device *dev,int crtc_id); -irqreturn_t omap_irq_handler (DRM_IRQ_ARGS ); +irqreturn_t omap_irq_handler (int irq,void *arg);void omap_irq_preinstall (struct drm_device *dev);int omap_irq_postinstall (struct drm_device *dev);void omap_irq_uninstall (struct drm_device *dev);
drivers/gpu/drm/omapdrm/omap_irq.c +1 -1
@@ -173,7 +173,7 @@ void omap_irq_disable_vblank(struct drm_device *dev, int crtc_id)dispc_runtime_put (); } -irqreturn_t omap_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t omap_irq_handler (int irq,void *arg) {struct drm_device *dev = (struct drm_device *) arg;struct omap_drm_private *priv = dev->dev_private;
drivers/gpu/drm/qxl/qxl_drv.h +1 -1
@@ -534,7 +534,7 @@ void qxl_debugfs_takedown(struct drm_minor *minor);/* qxl_irq.c */ int qxl_irq_init (struct qxl_device *qdev); -irqreturn_t qxl_irq_handler (DRM_IRQ_ARGS ); +irqreturn_t qxl_irq_handler (int irq,void *arg);/* qxl_fb.c */ int qxl_fb_init (struct qxl_device *qdev);
drivers/gpu/drm/qxl/qxl_irq.c +1 -1
@@ -25,7 +25,7 @@#include "qxl_drv.h" -irqreturn_t qxl_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t qxl_irq_handler (int irq,void *arg) {struct drm_device *dev = (struct drm_device *) arg;struct qxl_device *qdev = (struct qxl_device *)dev->dev_private;
drivers/gpu/drm/r128/r128_drv.h +1 -1
@@ -154,7 +154,7 @@ extern int r128_do_cleanup_cce(struct drm_device *dev);extern int r128_enable_vblank (struct drm_device *dev,int crtc);extern void r128_disable_vblank (struct drm_device *dev,int crtc);extern u32 r128_get_vblank_counter (struct drm_device *dev,int crtc); -extern irqreturn_t r128_driver_irq_handler (DRM_IRQ_ARGS ); +extern irqreturn_t r128_driver_irq_handler (int irq,void *arg);extern void r128_driver_irq_preinstall (struct drm_device *dev);extern int r128_driver_irq_postinstall (struct drm_device *dev);extern void r128_driver_irq_uninstall (struct drm_device *dev);
drivers/gpu/drm/r128/r128_irq.c +1 -1
@@ -44,7 +44,7 @@ u32 r128_get_vblank_counter(struct drm_device *dev, int crtc)return atomic_read (&dev_priv->vbl_received); } -irqreturn_t r128_driver_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t r128_driver_irq_handler (int irq,void *arg) {struct drm_device *dev = (struct drm_device *) arg;drm_r128_private_t *dev_priv = (drm_r128_private_t *) dev->dev_private;
drivers/gpu/drm/radeon/radeon_drv.c +1 -1
@@ -101,7 +101,7 @@ int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,void radeon_driver_irq_preinstall_kms (struct drm_device *dev);int radeon_driver_irq_postinstall_kms (struct drm_device *dev);void radeon_driver_irq_uninstall_kms (struct drm_device *dev); -irqreturn_t radeon_driver_irq_handler_kms (DRM_IRQ_ARGS ); +irqreturn_t radeon_driver_irq_handler_kms (int irq,void *arg);void radeon_gem_object_free (struct drm_gem_object *obj);int radeon_gem_object_open (struct drm_gem_object *obj,struct drm_file *file_priv);
drivers/gpu/drm/radeon/radeon_drv.h +1 -1
@@ -404,7 +404,7 @@ extern void radeon_do_release(struct drm_device * dev);extern u32 radeon_get_vblank_counter (struct drm_device *dev,int crtc);extern int radeon_enable_vblank (struct drm_device *dev,int crtc);extern void radeon_disable_vblank (struct drm_device *dev,int crtc); -extern irqreturn_t radeon_driver_irq_handler (DRM_IRQ_ARGS ); +extern irqreturn_t radeon_driver_irq_handler (int irq,void *arg);extern void radeon_driver_irq_preinstall (struct drm_device * dev);extern int radeon_driver_irq_postinstall (struct drm_device *dev);extern void radeon_driver_irq_uninstall (struct drm_device * dev);
drivers/gpu/drm/radeon/radeon_irq.c +1 -1
@@ -181,7 +181,7 @@ static u32 radeon_acknowledge_irqs(drm_radeon_private_t *dev_priv, u32 *r500_dis* tied to dma at all, this is just a hangover from dri prehistory. */ -irqreturn_t radeon_driver_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t radeon_driver_irq_handler (int irq,void *arg) {struct drm_device *dev = (struct drm_device *) arg; drm_radeon_private_t *dev_priv =
drivers/gpu/drm/radeon/radeon_irq_kms.c +2 -2
@@ -39,13 +39,13 @@/** * radeon_driver_irq_handler_kms - irq handler for KMS * -* @DRM_IRQ_ARGS: args +* @int irq, void *arg: args * * This is the irq handler for the radeon KMS driver (all asics). * radeon_irq_process is a macro that points to the per-asic * irq handler callback. */ -irqreturn_t radeon_driver_irq_handler_kms (DRM_IRQ_ARGS ) +irqreturn_t radeon_driver_irq_handler_kms (int irq,void *arg) {struct drm_device *dev = (struct drm_device *) arg;struct radeon_device *rdev = dev->dev_private;
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -311,7 +311,7 @@ static void tilcdc_lastclose(struct drm_device *dev)drm_fbdev_cma_restore_mode (priv->fbdev); } -static irqreturn_t tilcdc_irq (DRM_IRQ_ARGS ) +static irqreturn_t tilcdc_irq (int irq,void *arg) {struct drm_device *dev = arg;struct tilcdc_drm_private *priv = dev->dev_private;
drivers/gpu/drm/via/via_drv.h +1 -1
@@ -138,7 +138,7 @@ extern u32 via_get_vblank_counter(struct drm_device *dev, int crtc);extern int via_enable_vblank (struct drm_device *dev,int crtc);extern void via_disable_vblank (struct drm_device *dev,int crtc); -extern irqreturn_t via_driver_irq_handler (DRM_IRQ_ARGS ); +extern irqreturn_t via_driver_irq_handler (int irq,void *arg);extern void via_driver_irq_preinstall (struct drm_device *dev);extern int via_driver_irq_postinstall (struct drm_device *dev);extern void via_driver_irq_uninstall (struct drm_device *dev);
drivers/gpu/drm/via/via_irq.c +1 -1
@@ -104,7 +104,7 @@ u32 via_get_vblank_counter(struct drm_device *dev, int crtc)return atomic_read (&dev_priv->vbl_received); } -irqreturn_t via_driver_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t via_driver_irq_handler (int irq,void *arg) {struct drm_device *dev = (struct drm_device *) arg;drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +1 -1
@@ -700,7 +700,7 @@ extern void vmw_execbuf_copy_fence_user(struct vmw_private *dev_priv,* IRQs and wating - vmwgfx_irq.c */ -extern irqreturn_t vmw_irq_handler (DRM_IRQ_ARGS ); +extern irqreturn_t vmw_irq_handler (int irq,void *arg);extern int vmw_wait_seqno (struct vmw_private *dev_priv,bool lazy,uint32_t seqno,bool interruptible,unsigned long timeout);
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c +1 -1
@@ -30,7 +30,7 @@#define VMW_FENCE_WRAP (1 << 24) -irqreturn_t vmw_irq_handler (DRM_IRQ_ARGS ) +irqreturn_t vmw_irq_handler (int irq,void *arg) {struct drm_device *dev = (struct drm_device *)arg;struct vmw_private *dev_priv =vmw_priv (dev);
include/drm/drmP.h +1 -1
@@ -898,7 +898,7 @@ struct drm_driver {/* these have to be filled in */ -irqreturn_t (*irq_handler) (DRM_IRQ_ARGS ); +irqreturn_t (*irq_handler) (int irq,void *arg);void (*irq_preinstall) (struct drm_device *dev);int (*irq_postinstall) (struct drm_device *dev);void (*irq_uninstall) (struct drm_device *dev);
include/drm/drm_os_linux.h +0 -3
@@ -48,9 +48,6 @@ static inline void writeq(u64 val, void __iomem *reg)/** Read/write memory barrier */ #define DRM_MEMORYBARRIER () mb() -/** IRQ handler arguments and return type and values */ -#define DRM_IRQ_ARGS int irq, void *arg -/** Other copying of data to kernel space */ #define DRM_COPY_FROM_USER (arg1, arg2, arg3) \ copy_from_user(arg1, arg2, arg3)
Signature · 1 line
1.8.4.3
PATCH 22/50 drm: Kill DRM_WAKUP and DRM_INIT_WAITQUEUE
In reply to Daniel VetterLess yelling ftw!
--- drivers/gpu/drm/drm_irq.c | 6 +++--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_mixer.c | 4 ++-- drivers/gpu/drm/mga/mga_irq.c | 4 ++-- drivers/gpu/drm/omapdrm/omap_irq.c | 2 +- drivers/gpu/drm/radeon/radeon_irq.c | 4 ++-- drivers/gpu/drm/via/via_dmablit.c | 10 +++++----- drivers/gpu/drm/via/via_irq.c | 4 ++-- drivers/gpu/drm/via/via_video.c | 6 +++--- include/drm/drm_os_linux.h | 3 --- 10 files changed, 21 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_irq.c +3 -3
@@ -368,7 +368,7 @@ int drm_irq_uninstall(struct drm_device *dev)if (dev->num_crtcs) {spin_lock_irqsave (&dev->vbl_lock, irqflags);for (i =0 ; i < dev->num_crtcs; i++) { -DRM_WAKEUP (&dev->vblank[i].queue); +wake_up (&dev->vblank[i].queue); dev->vblank[i].enabled = false; dev->vblank[i].last = dev->driver->get_vblank_counter (dev, i);
@@ -980,7 +980,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc)spin_lock_irqsave (&dev->vbl_lock, irqflags);vblank_disable_and_save (dev, crtc); -DRM_WAKEUP (&dev->vblank[crtc].queue); +wake_up (&dev->vblank[crtc].queue);/* Send any queued vblank events, lest the natives grow disquiet */ seq =drm_vblank_count_and_time (dev, crtc, &now);
@@ -1363,7 +1363,7 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc) crtc, (int) diff_ns); } -DRM_WAKEUP (&dev->vblank[crtc].queue); +wake_up (&dev->vblank[crtc].queue);drm_handle_vblank_events (dev, crtc);spin_unlock_irqrestore (&dev->vblank_time_lock, irqflags);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -1
@@ -954,7 +954,7 @@ static int fimd_probe(struct platform_device *pdev) } ctx->driver_data =drm_fimd_get_driver_data (pdev); -DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue); +init_waitqueue_head (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 ); subdrv = &ctx->subdrv;
drivers/gpu/drm/exynos/exynos_mixer.c +2 -2
@@ -1019,7 +1019,7 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)/* set wait vsync event to zero and wake up queue. */ if (atomic_read (&ctx->wait_vsync_event)) {atomic_set (&ctx->wait_vsync_event,0 ); -DRM_WAKEUP (&ctx->wait_vsync_queue); +wake_up (&ctx->wait_vsync_queue); } }
@@ -1209,7 +1209,7 @@ static int mixer_probe(struct platform_device *pdev) drm_hdmi_ctx->ctx = (void *)ctx; ctx->vp_enabled = drv->is_vp_enabled; ctx->mxr_ver = drv->version; -DRM_INIT_WAITQUEUE (&ctx->wait_vsync_queue); +init_waitqueue_head (&ctx->wait_vsync_queue);atomic_set (&ctx->wait_vsync_event,0 );platform_set_drvdata (pdev, drm_hdmi_ctx);
drivers/gpu/drm/mga/mga_irq.c +2 -2
@@ -79,7 +79,7 @@ irqreturn_t mga_driver_irq_handler(int irq, void *arg)MGA_WRITE (MGA_PRIMEND , prim_end);atomic_inc (&dev_priv->last_fence_retired); -DRM_WAKEUP (&dev_priv->fence_queue); +wake_up (&dev_priv->fence_queue); handled =1 ; }
@@ -151,7 +151,7 @@ int mga_driver_irq_postinstall(struct drm_device *dev) {drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; -DRM_INIT_WAITQUEUE (&dev_priv->fence_queue); +init_waitqueue_head (&dev_priv->fence_queue);/* Turn on soft trap interrupt. Vertical blank interrupts are enabled * in mga_enable_vblank.
drivers/gpu/drm/omapdrm/omap_irq.c +1 -1
@@ -308,7 +308,7 @@ int omap_drm_irq_uninstall(struct drm_device *dev)if (dev->num_crtcs) {spin_lock_irqsave (&dev->vbl_lock, irqflags);for (i =0 ; i < dev->num_crtcs; i++) { -DRM_WAKEUP (&dev->vblank[i].queue); +wake_up (&dev->vblank[i].queue); dev->vblank[i].enabled = false; dev->vblank[i].last = dev->driver->get_vblank_counter (dev, i);
drivers/gpu/drm/radeon/radeon_irq.c +2 -2
@@ -203,7 +203,7 @@ irqreturn_t radeon_driver_irq_handler(int irq, void *arg)/* SW interrupt */ if (stat &RADEON_SW_INT_TEST ) -DRM_WAKEUP (&dev_priv->swi_queue); +wake_up (&dev_priv->swi_queue);/* VBLANK interrupt */ if ((dev_priv->flags &RADEON_FAMILY_MASK ) >=CHIP_RS600 ) {
@@ -354,7 +354,7 @@ int radeon_driver_irq_postinstall(struct drm_device *dev) (drm_radeon_private_t *) dev->dev_private;atomic_set (&dev_priv->swi_emitted,0 ); -DRM_INIT_WAITQUEUE (&dev_priv->swi_queue); +init_waitqueue_head (&dev_priv->swi_queue); dev->max_vblank_count =0x001fffff ;
drivers/gpu/drm/via/via_dmablit.c +5 -5
@@ -338,7 +338,7 @@ via_dmablit_handler(struct drm_device *dev, int engine, int from_irq) blitq->blits[cur]->aborted = blitq->aborting; blitq->done_blit_handle++; -DRM_WAKEUP (blitq->blit_queue + cur); +wake_up (blitq->blit_queue + cur); cur++;if (cur >=VIA_NUM_BLIT_SLOTS )
@@ -521,7 +521,7 @@ via_dmablit_workqueue(struct work_struct *work)spin_unlock_irqrestore (&blitq->blit_lock, irqsave); -DRM_WAKEUP (&blitq->busy_queue); +wake_up (&blitq->busy_queue);via_free_sg_info (dev->pdev, cur_sg);kfree (cur_sg);
@@ -561,8 +561,8 @@ via_init_dmablit(struct drm_device *dev) blitq->aborting =0 ;spin_lock_init (&blitq->blit_lock);for (j =0 ; j <VIA_NUM_BLIT_SLOTS ; ++j) -DRM_INIT_WAITQUEUE (blitq->blit_queue + j); -DRM_INIT_WAITQUEUE (&blitq->busy_queue); +init_waitqueue_head (blitq->blit_queue + j); +init_waitqueue_head (&blitq->busy_queue);INIT_WORK (&blitq->wq, via_dmablit_workqueue);setup_timer (&blitq->poll_timer, via_dmablit_timer, (unsigned long )blitq);
@@ -713,7 +713,7 @@ via_dmablit_release_slot(drm_via_blitq_t *blitq)spin_lock_irqsave (&blitq->blit_lock, irqsave); blitq->num_free++;spin_unlock_irqrestore (&blitq->blit_lock, irqsave); -DRM_WAKEUP (&blitq->busy_queue); +wake_up (&blitq->busy_queue); }/*
drivers/gpu/drm/via/via_irq.c +2 -2
@@ -138,7 +138,7 @@ irqreturn_t via_driver_irq_handler(int irq, void *arg)for (i =0 ; i < dev_priv->num_irqs; ++i) {if (status & cur_irq->pending_mask) {atomic_inc (&cur_irq->irq_received); -DRM_WAKEUP (&cur_irq->irq_queue); +wake_up (&cur_irq->irq_queue); handled =1 ;if (dev_priv->irq_map[drm_via_irq_dma0_td] == i)via_dmablit_handler (dev,0 ,1 );
@@ -287,7 +287,7 @@ void via_driver_irq_preinstall(struct drm_device *dev)atomic_set (&cur_irq->irq_received,0 ); cur_irq->enable_mask = dev_priv->irq_masks[i][0 ]; cur_irq->pending_mask = dev_priv->irq_masks[i][1 ]; -DRM_INIT_WAITQUEUE (&cur_irq->irq_queue); +init_waitqueue_head (&cur_irq->irq_queue); dev_priv->irq_enable_mask |= cur_irq->enable_mask; dev_priv->irq_pending_mask |= cur_irq->pending_mask; cur_irq++;
drivers/gpu/drm/via/via_video.c +3 -3
@@ -36,7 +36,7 @@ void via_init_futex(drm_via_private_t *dev_priv)DRM_DEBUG ("\n" );for (i =0 ; i <VIA_NR_XVMC_LOCKS ; ++i) { -DRM_INIT_WAITQUEUE (&(dev_priv->decoder_queue[i])); +init_waitqueue_head (&(dev_priv->decoder_queue[i]));XVMCLOCKPTR (dev_priv->sarea_priv, i)->lock =0 ; } }
@@ -58,7 +58,7 @@ void via_release_futex(drm_via_private_t *dev_priv, int context)if ((_DRM_LOCKING_CONTEXT (*lock) == context)) {if (_DRM_LOCK_IS_HELD (*lock) && (*lock & _DRM_LOCK_CONT)) { -DRM_WAKEUP (&(dev_priv->decoder_queue[i])); +wake_up (&(dev_priv->decoder_queue[i])); } *lock =0 ; }
@@ -86,7 +86,7 @@ int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_ (fx->ms / 10) * (HZ / 100), *lock != fx->val);return ret;case VIA_FUTEX_WAKE : -DRM_WAKEUP (&(dev_priv->decoder_queue[fx->lock])); +wake_up (&(dev_priv->decoder_queue[fx->lock]));return 0 ; }return 0 ;
include/drm/drm_os_linux.h +0 -3
@@ -78,6 +78,3 @@ do { \__set_current_state (TASK_RUNNING ); \remove_wait_queue (&(queue), &entry); \ }while (0 ) - -#define DRM_WAKEUP ( queue ) wake_up( queue ) -#define DRM_INIT_WAITQUEUE ( queue ) init_waitqueue_head( queue )
Signature · 1 line
1.8.4.3
PATCH 23/50 drm: Kill DRM_COPY_(TO|FROM)_USER
In reply to Daniel VetterLess yelling ftw!
--- drivers/gpu/drm/drm_buffer.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 6 +++--- drivers/gpu/drm/mga/mga_dma.c | 4 ++-- drivers/gpu/drm/mga/mga_state.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 4 ++-- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 ++-- drivers/gpu/drm/r128/r128_cce.c | 4 ++-- drivers/gpu/drm/r128/r128_state.c | 28 ++++++++++++++-------------- drivers/gpu/drm/radeon/r300_cmdbuf.c | 8 ++++---- drivers/gpu/drm/radeon/r600_cp.c | 4 ++-- drivers/gpu/drm/radeon/r600_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_cp.c | 4 ++-- drivers/gpu/drm/radeon/radeon_cs.c | 10 +++++----- drivers/gpu/drm/radeon/radeon_irq.c | 2 +- drivers/gpu/drm/radeon/radeon_kms.c | 10 +++++----- drivers/gpu/drm/radeon/radeon_mem.c | 2 +- drivers/gpu/drm/radeon/radeon_state.c | 18 +++++++++--------- drivers/gpu/drm/savage/savage_bci.c | 4 ++-- drivers/gpu/drm/savage/savage_state.c | 6 +++--- drivers/gpu/drm/via/via_dma.c | 4 ++-- include/drm/drm_os_linux.h | 7 ------- 21 files changed, 64 insertions(+), 71 deletions(-)
drivers/gpu/drm/drm_buffer.c +1 -1
@@ -114,7 +114,7 @@ int drm_buffer_copy_from_user(struct drm_buffer *buf,for (idx =0 ; idx < nr_pages; ++idx) { -if (DRM_COPY_FROM_USER (buf->data[idx], +if (copy_from_user (buf->data[idx], user_data + idx *PAGE_SIZE ,min (PAGE_SIZE , size - idx *PAGE_SIZE ))) { DRM_ERROR("Failed to copy user data (%p) to drm buffer"
drivers/gpu/drm/i915/i915_dma.c +3 -3
@@ -820,7 +820,7 @@ static int i915_irq_emit(struct drm_device *dev, void *data, result =i915_emit_irq (dev);mutex_unlock (&dev->struct_mutex); -if (DRM_COPY_TO_USER (emit->irq_seq, &result,sizeof (int ))) { +if (copy_to_user (emit->irq_seq, &result,sizeof (int ))) {DRM_ERROR ("copy_to_user\n" );return -EFAULT ; }
@@ -1008,8 +1008,8 @@ static int i915_getparam(struct drm_device *dev, void *data,return -EINVAL ; } -if (DRM_COPY_TO_USER (param->value, &value,sizeof (int ))) { -DRM_ERROR ("DRM_COPY_TO_USER failed\n" ); +if (copy_to_user (param->value, &value,sizeof (int ))) { +DRM_ERROR ("copy_to_user failed\n" );return -EFAULT ; }
drivers/gpu/drm/mga/mga_dma.c +2 -2
@@ -1075,10 +1075,10 @@ static int mga_dma_get_buffers(struct drm_device *dev, buf->file_priv = file_priv; -if (DRM_COPY_TO_USER (&d->request_indices[i], +if (copy_to_user (&d->request_indices[i], &buf->idx,sizeof (buf->idx)))return -EFAULT ; -if (DRM_COPY_TO_USER (&d->request_sizes[i], +if (copy_to_user (&d->request_sizes[i], &buf->total,sizeof (buf->total)))return -EFAULT ;
drivers/gpu/drm/mga/mga_state.c +1 -1
@@ -1029,7 +1029,7 @@ static int mga_getparam(struct drm_device *dev, void *data, struct drm_file *filreturn -EINVAL ; } -if (DRM_COPY_TO_USER (param->value, &value,sizeof (int ))) { +if (copy_to_user (param->value, &value,sizeof (int ))) {DRM_ERROR ("copy_to_user\n" );return -EFAULT ; }
drivers/gpu/drm/nouveau/nouveau_gem.c +2 -2
@@ -506,7 +506,7 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli, b->presumed.valid =0 ; relocs++; -if (DRM_COPY_TO_USER (&upbbo[nvbo->pbbo_index].presumed, +if (copy_to_user (&upbbo[nvbo->pbbo_index].presumed, &b->presumed,sizeof (b->presumed)))return -EFAULT ; }
@@ -593,7 +593,7 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)if (!mem)return ERR_PTR (-ENOMEM ); -if (DRM_COPY_FROM_USER (mem, userptr, size)) { +if (copy_from_user (mem, userptr, size)) {u_free (mem);return ERR_PTR (-EFAULT ); }
drivers/gpu/drm/qxl/qxl_ioctl.c +2 -2
@@ -200,7 +200,7 @@ static int qxl_process_single_command(struct qxl_device *qdev,for (i =0 ; i < cmd->relocs_num; ++i) {struct drm_qxl_reloc reloc; -if (DRM_COPY_FROM_USER (&reloc, +if (copy_from_user (&reloc, &((struct drm_qxl_reloc *)(uintptr_t )cmd->relocs)[i],sizeof (reloc))) { ret = -EFAULT ;
@@ -297,7 +297,7 @@ static int qxl_execbuffer_ioctl(struct drm_device *dev, void *data,struct drm_qxl_command *commands = (struct drm_qxl_command *)(uintptr_t )execbuffer->commands; -if (DRM_COPY_FROM_USER (&user_cmd, &commands[cmd_num], +if (copy_from_user (&user_cmd, &commands[cmd_num],sizeof (user_cmd)))return -EFAULT ;
drivers/gpu/drm/r128/r128_cce.c +2 -2
@@ -892,10 +892,10 @@ static int r128_cce_get_buffers(struct drm_device *dev, buf->file_priv = file_priv; -if (DRM_COPY_TO_USER (&d->request_indices[i], &buf->idx, +if (copy_to_user (&d->request_indices[i], &buf->idx,sizeof (buf->idx)))return -EFAULT ; -if (DRM_COPY_TO_USER (&d->request_sizes[i], &buf->total, +if (copy_to_user (&d->request_sizes[i], &buf->total,sizeof (buf->total)))return -EFAULT ;
drivers/gpu/drm/r128/r128_state.c +14 -14
@@ -895,16 +895,16 @@ static int r128_cce_dispatch_write_span(struct drm_device *dev,if (count >4096 || count <=0 )return -EMSGSIZE ; -if (DRM_COPY_FROM_USER (&x, depth->x,sizeof (x))) +if (copy_from_user (&x, depth->x,sizeof (x)))return -EFAULT ; -if (DRM_COPY_FROM_USER (&y, depth->y,sizeof (y))) +if (copy_from_user (&y, depth->y,sizeof (y)))return -EFAULT ; buffer_size = depth->n *sizeof (u32); buffer =kmalloc (buffer_size,GFP_KERNEL );if (buffer ==NULL )return -ENOMEM ; -if (DRM_COPY_FROM_USER (buffer, depth->buffer, buffer_size)) { +if (copy_from_user (buffer, depth->buffer, buffer_size)) {kfree (buffer);return -EFAULT ; }
@@ -916,7 +916,7 @@ static int r128_cce_dispatch_write_span(struct drm_device *dev,kfree (buffer);return -ENOMEM ; } -if (DRM_COPY_FROM_USER (mask, depth->mask, mask_size)) { +if (copy_from_user (mask, depth->mask, mask_size)) {kfree (buffer);kfree (mask);return -EFAULT ;
@@ -999,12 +999,12 @@ static int r128_cce_dispatch_write_pixels(struct drm_device *dev,kfree (x);return -ENOMEM ; } -if (DRM_COPY_FROM_USER (x, depth->x, xbuf_size)) { +if (copy_from_user (x, depth->x, xbuf_size)) {kfree (x);kfree (y);return -EFAULT ; } -if (DRM_COPY_FROM_USER (y, depth->y, xbuf_size)) { +if (copy_from_user (y, depth->y, xbuf_size)) {kfree (x);kfree (y);return -EFAULT ;
@@ -1017,7 +1017,7 @@ static int r128_cce_dispatch_write_pixels(struct drm_device *dev,kfree (y);return -ENOMEM ; } -if (DRM_COPY_FROM_USER (buffer, depth->buffer, buffer_size)) { +if (copy_from_user (buffer, depth->buffer, buffer_size)) {kfree (x);kfree (y);kfree (buffer);
@@ -1033,7 +1033,7 @@ static int r128_cce_dispatch_write_pixels(struct drm_device *dev,kfree (buffer);return -ENOMEM ; } -if (DRM_COPY_FROM_USER (mask, depth->mask, mask_size)) { +if (copy_from_user (mask, depth->mask, mask_size)) {kfree (x);kfree (y);kfree (buffer);
@@ -1107,9 +1107,9 @@ static int r128_cce_dispatch_read_span(struct drm_device *dev,if (count >4096 || count <=0 )return -EMSGSIZE ; -if (DRM_COPY_FROM_USER (&x, depth->x,sizeof (x))) +if (copy_from_user (&x, depth->x,sizeof (x)))return -EFAULT ; -if (DRM_COPY_FROM_USER (&y, depth->y,sizeof (y))) +if (copy_from_user (&y, depth->y,sizeof (y)))return -EFAULT ;BEGIN_RING (7 );
@@ -1162,12 +1162,12 @@ static int r128_cce_dispatch_read_pixels(struct drm_device *dev,kfree (x);return -ENOMEM ; } -if (DRM_COPY_FROM_USER (x, depth->x, xbuf_size)) { +if (copy_from_user (x, depth->x, xbuf_size)) {kfree (x);kfree (y);return -EFAULT ; } -if (DRM_COPY_FROM_USER (y, depth->y, ybuf_size)) { +if (copy_from_user (y, depth->y, ybuf_size)) {kfree (x);kfree (y);return -EFAULT ;
@@ -1524,7 +1524,7 @@ static int r128_cce_stipple(struct drm_device *dev, void *data, struct drm_fileDEV_INIT_TEST_WITH_RETURN (dev_priv); -if (DRM_COPY_FROM_USER (&mask, stipple->mask,32 *sizeof (u32))) +if (copy_from_user (&mask, stipple->mask,32 *sizeof (u32)))return -EFAULT ;RING_SPACE_TEST_WITH_RETURN (dev_priv);
@@ -1622,7 +1622,7 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fireturn -EINVAL ; } -if (DRM_COPY_TO_USER (param->value, &value,sizeof (int ))) { +if (copy_to_user (param->value, &value,sizeof (int ))) {DRM_ERROR ("copy_to_user\n" );return -EFAULT ; }
drivers/gpu/drm/radeon/r300_cmdbuf.c +4 -4
@@ -75,7 +75,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,OUT_RING (CP_PACKET0 (R300_RE_CLIPRECT_TL_0 , nr *2 -1 ));for (i =0 ; i < nr; ++i) { -if (DRM_COPY_FROM_USER +if (copy_from_user (&box, &cmdbuf->boxes[n + i],sizeof (box))) {DRM_ERROR ("copy cliprect faulted\n" );return -EFAULT ;
@@ -928,12 +928,12 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, buf_idx =drm_buffer_pointer_to_dword (cmdbuf->buffer,0 ); *buf_idx *=2 ;/* 8 bytes per buf */ -if (DRM_COPY_TO_USER (ref_age_base + *buf_idx, +if (copy_to_user (ref_age_base + *buf_idx, &dev_priv->scratch_ages[header.scratch.reg],sizeof (u32)))return -EINVAL ; -if (DRM_COPY_FROM_USER (&h_pending, +if (copy_from_user (&h_pending, ref_age_base + *buf_idx +1 ,sizeof (u32)))return -EINVAL ;
@@ -943,7 +943,7 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, h_pending--; -if (DRM_COPY_TO_USER (ref_age_base + *buf_idx +1 , +if (copy_to_user (ref_age_base + *buf_idx +1 , &h_pending,sizeof (u32)))return -EINVAL ;
drivers/gpu/drm/radeon/r600_cp.c +2 -2
@@ -2515,7 +2515,7 @@ int r600_cp_dispatch_texture(struct drm_device *dev, buf =radeon_freelist_get (dev);if (!buf) {DRM_DEBUG ("EAGAIN\n" ); -if (DRM_COPY_TO_USER (tex->image, image,sizeof (*image))) +if (copy_to_user (tex->image, image,sizeof (*image)))return -EFAULT ;return -EAGAIN ; }
@@ -2528,7 +2528,7 @@ int r600_cp_dispatch_texture(struct drm_device *dev, buffer = (u32 *) ((char *)dev->agp_buffer_map->handle + buf->offset); -if (DRM_COPY_FROM_USER (buffer, data, pass_size)) { +if (copy_from_user (buffer, data, pass_size)) {DRM_ERROR ("EFAULT on pad, %d bytes\n" , pass_size);return -EFAULT ; }
drivers/gpu/drm/radeon/r600_cs.c +1 -1
@@ -2386,7 +2386,7 @@ int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp, ib_chunk = &parser.chunks[parser.chunk_ib_idx]; parser.ib.length_dw = ib_chunk->length_dw; *l = parser.ib.length_dw; -if (DRM_COPY_FROM_USER (ib, ib_chunk->user_ptr, ib_chunk->length_dw *4 )) { +if (copy_from_user (ib, ib_chunk->user_ptr, ib_chunk->length_dw *4 )) { r = -EFAULT ;r600_cs_parser_fini (&parser, r);return r;
drivers/gpu/drm/radeon/radeon_cp.c +2 -2
@@ -2020,10 +2020,10 @@ static int radeon_cp_get_buffers(struct drm_device *dev, buf->file_priv = file_priv; -if (DRM_COPY_TO_USER (&d->request_indices[i], &buf->idx, +if (copy_to_user (&d->request_indices[i], &buf->idx,sizeof (buf->idx)))return -EFAULT ; -if (DRM_COPY_TO_USER (&d->request_sizes[i], &buf->total, +if (copy_to_user (&d->request_sizes[i], &buf->total,sizeof (buf->total)))return -EFAULT ;
drivers/gpu/drm/radeon/radeon_cs.c +5 -5
@@ -192,7 +192,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)return -ENOMEM ; } chunk_array_ptr = (uint64_t *)(unsigned long )(cs->chunks); -if (DRM_COPY_FROM_USER (p->chunks_array, chunk_array_ptr, +if (copy_from_user (p->chunks_array, chunk_array_ptr,sizeof (uint64_t )*cs->num_chunks)) {return -EFAULT ; }
@@ -208,7 +208,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)uint32_t __user *cdata; chunk_ptr = (void __user *)(unsigned long )p->chunks_array[i]; -if (DRM_COPY_FROM_USER (&user_chunk, chunk_ptr, +if (copy_from_user (&user_chunk, chunk_ptr,sizeof (struct drm_radeon_cs_chunk ))) {return -EFAULT ; }
@@ -252,7 +252,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)if (p->chunks[i].kdata ==NULL ) {return -ENOMEM ; } -if (DRM_COPY_FROM_USER (p->chunks[i].kdata, cdata, size)) { +if (copy_from_user (p->chunks[i].kdata, cdata, size)) {return -EFAULT ; }if (p->chunks[i].chunk_id ==RADEON_CHUNK_ID_FLAGS ) {
@@ -472,7 +472,7 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser } parser->const_ib.is_const_ib = true; parser->const_ib.length_dw = ib_chunk->length_dw; -if (DRM_COPY_FROM_USER (parser->const_ib.ptr, +if (copy_from_user (parser->const_ib.ptr, ib_chunk->user_ptr, ib_chunk->length_dw *4 ))return -EFAULT ;
@@ -495,7 +495,7 @@ static int radeon_cs_ib_fill(struct radeon_device *rdev, struct radeon_cs_parser parser->ib.length_dw = ib_chunk->length_dw;if (ib_chunk->kdata)memcpy (parser->ib.ptr, ib_chunk->kdata, ib_chunk->length_dw *4 ); -else if (DRM_COPY_FROM_USER (parser->ib.ptr, ib_chunk->user_ptr, ib_chunk->length_dw *4 )) +else if (copy_from_user (parser->ib.ptr, ib_chunk->user_ptr, ib_chunk->length_dw *4 ))return -EFAULT ;return 0 ; }
drivers/gpu/drm/radeon/radeon_irq.c +1 -1
@@ -302,7 +302,7 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr result =radeon_emit_irq (dev); -if (DRM_COPY_TO_USER (emit->irq_seq, &result,sizeof (int ))) { +if (copy_to_user (emit->irq_seq, &result,sizeof (int ))) {DRM_ERROR ("copy_to_user\n" );return -EFAULT ; }
drivers/gpu/drm/radeon/radeon_kms.c +5 -5
@@ -223,7 +223,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) *value = rdev->accel_working;break ;case RADEON_INFO_CRTC_FROM_ID : -if (DRM_COPY_FROM_USER (value, value_ptr,sizeof (uint32_t ))) { +if (copy_from_user (value, value_ptr,sizeof (uint32_t ))) {DRM_ERROR ("copy_from_user %s:%u\n" , __func__, __LINE__);return -EFAULT ; }
@@ -269,7 +269,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)* * When returning, the value is 1 if filp owns hyper-z access, * 0 otherwise. */ -if (DRM_COPY_FROM_USER (value, value_ptr,sizeof (uint32_t ))) { +if (copy_from_user (value, value_ptr,sizeof (uint32_t ))) {DRM_ERROR ("copy_from_user %s:%u\n" , __func__, __LINE__);return -EFAULT ; }
@@ -281,7 +281,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)break ;case RADEON_INFO_WANT_CMASK :/* The same logic as Hyper-Z. */ -if (DRM_COPY_FROM_USER (value, value_ptr,sizeof (uint32_t ))) { +if (copy_from_user (value, value_ptr,sizeof (uint32_t ))) {DRM_ERROR ("copy_from_user %s:%u\n" , __func__, __LINE__);return -EFAULT ; }
@@ -417,7 +417,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) *value = rdev->fastfb_working;break ;case RADEON_INFO_RING_WORKING : -if (DRM_COPY_FROM_USER (value, value_ptr,sizeof (uint32_t ))) { +if (copy_from_user (value, value_ptr,sizeof (uint32_t ))) {DRM_ERROR ("copy_from_user %s:%u\n" , __func__, __LINE__);return -EFAULT ; }
@@ -465,7 +465,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)DRM_DEBUG_KMS ("Invalid request %d\n" , info->request);return -EINVAL ; } -if (DRM_COPY_TO_USER (value_ptr, (char *)value, value_size)) { +if (copy_to_user (value_ptr, (char *)value, value_size)) {DRM_ERROR ("copy_to_user %s:%u\n" , __func__, __LINE__);return -EFAULT ; }
drivers/gpu/drm/radeon/radeon_mem.c +1 -1
@@ -243,7 +243,7 @@ int radeon_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_pif (!block)return -ENOMEM ; -if (DRM_COPY_TO_USER (alloc->region_offset, &block->start, +if (copy_to_user (alloc->region_offset, &block->start,sizeof (int ))) {DRM_ERROR ("copy_to_user\n" );return -EFAULT ;
drivers/gpu/drm/radeon/radeon_state.c +9 -9
@@ -1810,7 +1810,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, }if (!buf) {DRM_DEBUG ("EAGAIN\n" ); -if (DRM_COPY_TO_USER (tex->image, image,sizeof (*image))) +if (copy_to_user (tex->image, image,sizeof (*image)))return -EFAULT ;return -EAGAIN ; }
@@ -1823,7 +1823,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev,#define RADEON_COPY_MT (_buf, _data, _width) \ do { \ - if (DRM_COPY_FROM_USER(_buf, _data, (_width))) {\ + if (copy_from_user(_buf, _data, (_width))) {\ DRM_ERROR("EFAULT on pad, %d bytes\n", (_width)); \ return -EFAULT; \ } \
@@ -2168,7 +2168,7 @@ static int radeon_cp_clear(struct drm_device *dev, void *data, struct drm_file *if (sarea_priv->nbox >RADEON_NR_SAREA_CLIPRECTS ) sarea_priv->nbox =RADEON_NR_SAREA_CLIPRECTS ; -if (DRM_COPY_FROM_USER (&depth_boxes, clear->depth_boxes, +if (copy_from_user (&depth_boxes, clear->depth_boxes, sarea_priv->nbox *sizeof (depth_boxes[0 ])))return -EFAULT ;
@@ -2436,7 +2436,7 @@ static int radeon_cp_texture(struct drm_device *dev, void *data, struct drm_filereturn -EINVAL ; } -if (DRM_COPY_FROM_USER (&image, +if (copy_from_user (&image, (drm_radeon_tex_image_t __user *) tex->image,sizeof (image)))return -EFAULT ;
@@ -2460,7 +2460,7 @@ static int radeon_cp_stipple(struct drm_device *dev, void *data, struct drm_fileLOCK_TEST_WITH_RETURN (dev, file_priv); -if (DRM_COPY_FROM_USER (&mask, stipple->mask,32 *sizeof (u32))) +if (copy_from_user (&mask, stipple->mask,32 *sizeof (u32)))return -EFAULT ;RING_SPACE_TEST_WITH_RETURN (dev_priv);
@@ -2585,13 +2585,13 @@ static int radeon_cp_vertex2(struct drm_device *dev, void *data, struct drm_filedrm_radeon_prim_t prim;drm_radeon_tcl_prim_t tclprim; -if (DRM_COPY_FROM_USER (&prim, &vertex->prim[i],sizeof (prim))) +if (copy_from_user (&prim, &vertex->prim[i],sizeof (prim)))return -EFAULT ;if (prim.stateidx != laststate) {drm_radeon_state_t state; -if (DRM_COPY_FROM_USER (&state, +if (copy_from_user (&state, &vertex->state[prim.stateidx],sizeof (state)))return -EFAULT ;
@@ -2799,7 +2799,7 @@ static int radeon_emit_packet3_cliprect(struct drm_device *dev, do { if (i < cmdbuf->nbox) { - if (DRM_COPY_FROM_USER(&box, &boxes[i], sizeof(box))) + if (copy_from_user(&box, &boxes[i], sizeof(box))) return -EFAULT; /* FIXME The second and subsequent times round * this loop, send a WAIT_UNTIL_3D_IDLE before
@@ -3116,7 +3116,7 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_filreturn -EINVAL ; } -if (DRM_COPY_TO_USER (param->value, &value,sizeof (int ))) { +if (copy_to_user (param->value, &value,sizeof (int ))) {DRM_ERROR ("copy_to_user\n" );return -EFAULT ; }
drivers/gpu/drm/savage/savage_bci.c +2 -2
@@ -990,10 +990,10 @@ static int savage_bci_get_buffers(struct drm_device *dev, buf->file_priv = file_priv; -if (DRM_COPY_TO_USER (&d->request_indices[i], +if (copy_to_user (&d->request_indices[i], &buf->idx,sizeof (buf->idx)))return -EFAULT ; -if (DRM_COPY_TO_USER (&d->request_sizes[i], +if (copy_to_user (&d->request_sizes[i], &buf->total,sizeof (buf->total)))return -EFAULT ;
drivers/gpu/drm/savage/savage_state.c +3 -3
@@ -992,7 +992,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_if (kcmd_addr ==NULL )return -ENOMEM ; -if (DRM_COPY_FROM_USER (kcmd_addr, cmdbuf->cmd_addr, +if (copy_from_user (kcmd_addr, cmdbuf->cmd_addr, cmdbuf->size *8 )) {kfree (kcmd_addr);
@@ -1007,7 +1007,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ goto done; } -if (DRM_COPY_FROM_USER (kvb_addr, cmdbuf->vb_addr, +if (copy_from_user (kvb_addr, cmdbuf->vb_addr, cmdbuf->vb_size)) { ret = -EFAULT ; goto done;
@@ -1022,7 +1022,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ goto done; } -if (DRM_COPY_FROM_USER (kbox_addr, cmdbuf->box_addr, +if (copy_from_user (kbox_addr, cmdbuf->box_addr, cmdbuf->nbox *sizeof (struct drm_clip_rect ))) { ret = -EFAULT ; goto done;
drivers/gpu/drm/via/via_dma.c +2 -2
@@ -273,7 +273,7 @@ static int via_dispatch_cmdbuffer(struct drm_device *dev, drm_via_cmdbuffer_t *cif (cmd->size >VIA_PCI_BUF_SIZE )return -ENOMEM ; -if (DRM_COPY_FROM_USER (dev_priv->pci_buf, cmd->buf, cmd->size)) +if (copy_from_user (dev_priv->pci_buf, cmd->buf, cmd->size))return -EFAULT ;/*
@@ -346,7 +346,7 @@ static int via_dispatch_pci_cmdbuffer(struct drm_device *dev,if (cmd->size >VIA_PCI_BUF_SIZE )return -ENOMEM ; -if (DRM_COPY_FROM_USER (dev_priv->pci_buf, cmd->buf, cmd->size)) +if (copy_from_user (dev_priv->pci_buf, cmd->buf, cmd->size))return -EFAULT ; if ((ret =
include/drm/drm_os_linux.h +0 -7
@@ -48,13 +48,6 @@ static inline void writeq(u64 val, void __iomem *reg)/** Read/write memory barrier */ #define DRM_MEMORYBARRIER () mb() -/** Other copying of data to kernel space */ -#define DRM_COPY_FROM_USER (arg1, arg2, arg3) \ - copy_from_user(arg1, arg2, arg3) -/** Other copying of data from kernel space */ -#define DRM_COPY_TO_USER (arg1, arg2, arg3) \ - copy_to_user(arg1, arg2, arg3) -#define DRM_WAIT_ON ( ret, queue, timeout, condition ) \ do { \ DECLARE_WAITQUEUE(entry, current); \
Signature · 1 line
1.8.4.3
PATCH 24/50 drm: Kill DRM_*MEMORYBARRIER
In reply to Daniel VetterThe real linux interfaces are soooo much easier on the eyes ...
--- drivers/gpu/drm/gma500/psb_irq.c | 2 +- drivers/gpu/drm/mga/mga_drv.h | 2 +- drivers/gpu/drm/nouveau/nouveau_dma.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dma.h | 2 +- drivers/gpu/drm/r128/r128_drv.h | 2 +- drivers/gpu/drm/radeon/radeon_cp.c | 2 +- drivers/gpu/drm/radeon/radeon_ring.c | 2 +- drivers/gpu/drm/savage/savage_bci.c | 6 +++--- drivers/gpu/drm/savage/savage_state.c | 2 +- drivers/gpu/drm/via/via_dma.c | 4 ++-- drivers/gpu/drm/via/via_dmablit.c | 2 +- include/drm/drm_os_linux.h | 7 ------- 12 files changed, 14 insertions(+), 21 deletions(-)
drivers/gpu/drm/gma500/psb_irq.c +1 -1
@@ -253,7 +253,7 @@ irqreturn_t psb_irq_handler(int irq, void *arg)PSB_WVDC32 (vdc_stat,PSB_INT_IDENTITY_R ); (void )PSB_RVDC32 (PSB_INT_IDENTITY_R ); -DRM_READMEMORYBARRIER (); +rmb ();if (!handled)return IRQ_NONE ;
drivers/gpu/drm/mga/mga_drv.h +1 -1
@@ -193,7 +193,7 @@ extern void mga_driver_irq_uninstall(struct drm_device *dev);extern long mga_compat_ioctl (struct file *filp,unsigned int cmd,unsigned long arg); -#define mga_flush_write_combine () DRM_WRITEMEMORYBARRIER() +#define mga_flush_write_combine () wmb()#define MGA_READ8 (reg) DRM_READ8(dev_priv->mmio, (reg))#define MGA_READ (reg) DRM_READ32(dev_priv->mmio, (reg))
drivers/gpu/drm/nouveau/nouveau_dma.c +1 -1
@@ -100,7 +100,7 @@ nv50_dma_push(struct nouveau_channel *chan, struct nouveau_bo *bo, chan->dma.ib_put = (chan->dma.ib_put +1 ) & chan->dma.ib_max; -DRM_MEMORYBARRIER (); +mb ();/* Flush writes. */ nouveau_bo_rd32 (pb,0 );
drivers/gpu/drm/nouveau/nouveau_dma.h +1 -1
@@ -155,7 +155,7 @@ BEGIN_IMC0(struct nouveau_channel *chan, int subc, int mthd, u16 data) }#define WRITE_PUT (val) do { \ - DRM_MEMORYBARRIER(); \ + mb(); \ nouveau_bo_rd32(chan->push.buffer, 0); \ nv_wo32(chan->object, chan->user_put, ((val) << 2) + chan->push.vma.offset); \ } while (0)
drivers/gpu/drm/r128/r128_drv.h +1 -1
@@ -514,7 +514,7 @@ do { \if (R128_VERBOSE ) \DRM_INFO ("COMMIT_RING() tail=0x%06x\n" , \ dev_priv->ring.tail); \ -DRM_MEMORYBARRIER (); \ +mb (); \R128_WRITE (R128_PM4_BUFFER_DL_WPTR , dev_priv->ring.tail); \R128_READ (R128_PM4_BUFFER_DL_WPTR ); \ }while (0 )
drivers/gpu/drm/radeon/radeon_cp.c +1 -1
@@ -2228,7 +2228,7 @@ void radeon_commit_ring(drm_radeon_private_t *dev_priv) dev_priv->ring.tail &= dev_priv->ring.tail_mask; -DRM_MEMORYBARRIER (); +mb ();GET_RING_HEAD ( dev_priv );if ((dev_priv->flags &RADEON_FAMILY_MASK ) >=CHIP_R600 ) {
drivers/gpu/drm/radeon/radeon_ring.c +1 -1
@@ -463,7 +463,7 @@ void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *ring)while (ring->wptr & ring->align_mask) {radeon_ring_write (ring, ring->nop); } -DRM_MEMORYBARRIER (); +mb ();radeon_ring_set_wptr (rdev, ring); }
drivers/gpu/drm/savage/savage_bci.c +3 -3
@@ -49,7 +49,7 @@ savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n)#endif for (i =0 ; i <SAVAGE_DEFAULT_USEC_TIMEOUT ; i++) { -DRM_MEMORYBARRIER (); +mb (); status = dev_priv->status_ptr[0 ];if ((status & mask) < threshold)return 0 ;
@@ -123,7 +123,7 @@ savage_bci_wait_event_shadow(drm_savage_private_t * dev_priv, uint16_t e)int i;for (i =0 ; i <SAVAGE_EVENT_USEC_TIMEOUT ; i++) { -DRM_MEMORYBARRIER (); +mb (); status = dev_priv->status_ptr[1 ];if ((((status &0xffff ) - e) &0xffff ) <=0x7fff || (status &0xffff ) ==0 )
@@ -449,7 +449,7 @@ static void savage_dma_flush(drm_savage_private_t * dev_priv) } } -DRM_MEMORYBARRIER (); +mb ();/* do flush ... */ phys_addr = dev_priv->cmd_dma->offset +
drivers/gpu/drm/savage/savage_state.c +1 -1
@@ -1032,7 +1032,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_/* Make sure writes to DMA buffers are finished before sending * DMA commands to the graphics hardware. */ -DRM_MEMORYBARRIER (); +mb ();/* Coming from user space. Don't know if the Xserver has * emitted wait commands. Assuming the worst. */
drivers/gpu/drm/via/via_dma.c +2 -2
@@ -60,7 +60,7 @@ dev_priv->dma_low +=8 ; \ } -#define via_flush_write_combine () DRM_MEMORYBARRIER() +#define via_flush_write_combine () mb()#define VIA_OUT_RING_QW (w1, w2) do { \ *vb++ = (w1); \
@@ -543,7 +543,7 @@ static void via_cmdbuf_start(drm_via_private_t *dev_priv)VIA_WRITE (VIA_REG_TRANSPACE , pause_addr_hi);VIA_WRITE (VIA_REG_TRANSPACE , pause_addr_lo); -DRM_WRITEMEMORYBARRIER (); +wmb ();VIA_WRITE (VIA_REG_TRANSPACE , command |HC_HAGPCMNT_MASK );VIA_READ (VIA_REG_TRANSPACE );
drivers/gpu/drm/via/via_dmablit.c +1 -1
@@ -217,7 +217,7 @@ via_fire_dmablit(struct drm_device *dev, drm_via_sg_info_t *vsg, int engine)VIA_WRITE (VIA_PCI_DMA_MR0 + engine*0x04 ,VIA_DMA_MR_CM |VIA_DMA_MR_TDIE );VIA_WRITE (VIA_PCI_DMA_BCR0 + engine*0x10 ,0 );VIA_WRITE (VIA_PCI_DMA_DPR0 + engine*0x10 , vsg->chain_start); -DRM_WRITEMEMORYBARRIER (); +wmb ();VIA_WRITE (VIA_PCI_DMA_CSR0 + engine*0x04 ,VIA_DMA_CSR_DE |VIA_DMA_CSR_TS );VIA_READ (VIA_PCI_DMA_CSR0 + engine*0x04 ); }
include/drm/drm_os_linux.h +0 -7
@@ -35,19 +35,12 @@ static inline void writeq(u64 val, void __iomem *reg)#define DRM_WRITE16 (map, offset, val) writew(val, ((void __iomem *)(map)->handle) + (offset))/** Write a dword into a MMIO region */ #define DRM_WRITE32 (map, offset, val) writel(val, ((void __iomem *)(map)->handle) + (offset)) -/** Read memory barrier */ /** Read a qword from a MMIO region - be careful using these unless you really understand them */ #define DRM_READ64 (map, offset) readq(((void __iomem *)(map)->handle) + (offset))/** Write a qword into a MMIO region */ #define DRM_WRITE64 (map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset)) -#define DRM_READMEMORYBARRIER () rmb() -/** Write memory barrier */ -#define DRM_WRITEMEMORYBARRIER () wmb() -/** Read/write memory barrier */ -#define DRM_MEMORYBARRIER () mb() -#define DRM_WAIT_ON ( ret, queue, timeout, condition ) \ do { \ DECLARE_WAITQUEUE(entry, current); \
Signature · 1 line
1.8.4.3
PATCH 25/50 drm: Kill DRM_SUSER
In reply to Daniel VetterChecking directly for the right capability is simpler. Also this rids us of a few places that use DRM_CURRENTPID.
--- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/via/via_dma.c | 4 ++-- include/drm/drm_os_linux.h | 1 - 3 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/ttm/ttm_bo_util.c +1 -1
@@ -593,7 +593,7 @@ int ttm_bo_kmap(struct ttm_buffer_object *bo,if (start_page > bo->num_pages)return -EINVAL ;#if 0 -if (num_pages >1 && !DRM_SUSER (DRM_CURPROC )) +if (num_pages >1 && !capable (CAP_SYS_ADMIN ))return -EPERM ;#endif (void )ttm_mem_io_lock (man, false);
drivers/gpu/drm/via/via_dma.c +2 -2
@@ -234,13 +234,13 @@ static int via_dma_init(struct drm_device *dev, void *data, struct drm_file *filswitch (init->func) {case VIA_INIT_DMA : -if (!DRM_SUSER (DRM_CURPROC )) +if (!capable (CAP_SYS_ADMIN )) retcode = -EPERM ;else retcode =via_initialize (dev, dev_priv, init);break ;case VIA_CLEANUP_DMA : -if (!DRM_SUSER (DRM_CURPROC )) +if (!capable (CAP_SYS_ADMIN )) retcode = -EPERM ;else retcode =via_dma_cleanup (dev);
include/drm/drm_os_linux.h +0 -1
@@ -21,7 +21,6 @@ static inline void writeq(u64 val, void __iomem *reg)/** Current process ID */ #define DRM_CURRENTPID task_pid_nr(current) -#define DRM_SUSER (p) capable(CAP_SYS_ADMIN)#define DRM_UDELAY (d) udelay(d)/** Read a byte from a MMIO region */ #define DRM_READ8 (map, offset) readb(((void __iomem *)(map)->handle) + (offset))
Signature · 1 line
1.8.4.3
PATCH 26/50 drm/gma500: Remove dead code
In reply to Daniel VetterThis has the nice advantage that we'll get rid of a DRM_WAIT_ON user for free.
--- drivers/gpu/drm/gma500/psb_irq.c | 15 --------------- 1 file changed, 15 deletions(-)
drivers/gpu/drm/gma500/psb_irq.c +0 -15
@@ -450,21 +450,6 @@ int psb_irq_disable_dpst(struct drm_device *dev)return 0 ; } -#ifdef PSB_FIXME -static int psb_vblank_do_wait (struct drm_device *dev, -unsigned int *sequence,atomic_t *counter) -{ -unsigned int cur_vblank; -int ret =0 ; -DRM_WAIT_ON (ret, dev->vblank.queue,3 *HZ , - (((cur_vblank =atomic_read (counter)) - - *sequence) <= (1 <<23 ))); - *sequence = cur_vblank; - -return ret; -} -#endif -/* * It is used to enable VBLANK interrupt */
Signature · 1 line
1.8.4.3
Re: [PATCH 26/50] drm/gma500: Remove dead code
Quoted 37 lines · Daniel Vetter
This has the nice advantage that we'll get rid of a
DRM_WAIT_ONuser for free.Cc Patrik Jakobsson <[email protected]>Cc Alan Cox <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/gma500/psb_irq.c | 15 --------------- 1 file changed, 15 deletions(-)drivers/gpu/drm/gma500/psb_irq.c +0
-16@@ -450,21 +450,6 @@ int psb_irq_disable_dpst(struct drm_device *dev)return 0 ; } -#ifdef PSB_FIXME -static int psb_vblank_do_wait (struct drm_device *dev, -unsigned int *sequence,atomic_t *counter) -{ -unsigned int cur_vblank; -int ret =0 ; -DRM_WAIT_ON (ret, dev->vblank.queue,3 *HZ , - (((cur_vblank =atomic_read (counter)) - - *sequence) <= (1 <<23 ))); - *sequence = cur_vblank; - -return ret; -} -#endif -/* * It is used to enable VBLANK interrupt */ --
Quoted 2 lines
1.8.4.3
Yes, that can just go away. Thanks.
PATCH 27/50 drm/irq: Replace DRM_WAIT_ON with wait_event
In reply to Daniel VetterNote that I've dropped the timeout - we don't expect the display hardware to ever hang, and the current code isn't really up to handle this correctly anyway.
The only risk I see is that old user modesetting drivers wreak havoc with themselves by disabling the interrupt support at the wrong time. But then again this means we're running X and will get a signal sooner or later anyway. So it should get out of the loop latest when the user attempts to do a vt switch.
Also extract the condition into a temporary macro for better readability.
--- drivers/gpu/drm/drm_irq.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_irq.c +8 -6
@@ -1244,12 +1244,14 @@ int drm_wait_vblank(struct drm_device *dev, void *data,DRM_DEBUG ("waiting on vblank count %d, crtc %d\n" , vblwait->request.sequence, crtc); dev->vblank[crtc].last_wait = vblwait->request.sequence; -DRM_WAIT_ON (ret, dev->vblank[crtc].queue,3 *HZ , - (((drm_vblank_count (dev, crtc) - - vblwait->request.sequence) <= (1 <<23 )) || - !dev->irq_enabled)); - -if (ret != -EINTR ) { +#define C \ + (((drm_vblank_count(dev, crtc) - vblwait->request.sequence) \ + <= (1 << 23)) || \ + !dev->irq_enabled) + ret =wait_event_interruptible (dev->vblank[crtc].queue,C ); +#undef C + +if (ret ==0 ) {struct timeval now; vblwait->reply.sequence =drm_vblank_count_and_time (dev, crtc, &now);
Signature · 1 line
1.8.4.3
PATCH 28/50 drm: Remove DRM_WAIT_ON from all drivers
In reply to Daniel VetterSince this is all old ums stuff (including the one in the radeon driver) I've just tried to perfectly replicate the existing semantics.
Reinventing wait queue code with semantics that differ from all the standard linux wait functions is just hairy, so now we can get rid of this and so make sure it'll never again be used.
Oh and: via futexes ... *shudder*
--- drivers/gpu/drm/i915/i915_dma.c | 11 +++++++++-- drivers/gpu/drm/mga/mga_irq.c | 12 +++++++++--- drivers/gpu/drm/radeon/radeon_irq.c | 11 ++++++++--- drivers/gpu/drm/via/via_dmablit.c | 23 +++++++++++++++++------ drivers/gpu/drm/via/via_irq.c | 15 ++++++++++----- drivers/gpu/drm/via/via_video.c | 12 +++++++++--- include/drm/drm_os_linux.h | 24 ------------------------ 7 files changed, 62 insertions(+), 46 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +9 -2
@@ -783,8 +783,15 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) master_priv->sarea_priv->perf_boxes |=I915_BOX_WAIT ;if (ring->irq_get (ring)) { -DRM_WAIT_ON (ret, ring->irq_queue,3 *HZ , -READ_BREADCRUMB (dev_priv) >= irq_nr); + ret =wait_event_interruptible_timeout (ring->irq_queue, +READ_BREADCRUMB (dev_priv) >= irq_nr, +3 *HZ ); +if (ret ==0 ) + ret = -EBUSY ; +else if (ret == -ERESTARTSYS ) + ret = -EINTR ; +else + ret =0 ; ring->irq_put (ring); }else if (wait_for (READ_BREADCRUMB (dev_priv) >= irq_nr,3000 )) ret = -EBUSY ;
drivers/gpu/drm/mga/mga_irq.c +9 -3
@@ -128,13 +128,19 @@ int mga_driver_fence_wait(struct drm_device *dev, unsigned int *sequence)* by about a day rather than she wants to wait for years * using fences. */ -DRM_WAIT_ON (ret, dev_priv->fence_queue,3 *HZ , + ret =wait_event_interruptible_timeout (dev_priv->fence_queue, (((cur_fence =atomic_read (&dev_priv->last_fence_retired)) - - *sequence) <= (1 <<23 ))); + - *sequence) <= (1 <<23 )), +3 *HZ ); *sequence = cur_fence; -return ret; +if (ret ==0 ) +return -EBUSY ; +else if (ret == -ERESTARTSYS ) +return -EINTR ; +else +return 0 ; }void mga_driver_irq_preinstall (struct drm_device *dev)
drivers/gpu/drm/radeon/radeon_irq.c +8 -3
@@ -249,10 +249,15 @@ static int radeon_wait_irq(struct drm_device * dev, int swi_nr) dev_priv->stats.boxes |=RADEON_BOX_WAIT_IDLE ; -DRM_WAIT_ON (ret, dev_priv->swi_queue,3 *HZ , -RADEON_READ (RADEON_LAST_SWI_REG ) >= swi_nr); + ret =wait_event_interruptible_timeout (dev_priv->swi_queue, +RADEON_READ (RADEON_LAST_SWI_REG ) >= swi_nr,3 *HZ ); -return ret; +if (ret ==0 ) +return -EBUSY ; +else if (ret == -ERESTARTSYS ) +return -EINTR ; +else +return 0 ; }u32 radeon_get_vblank_counter (struct drm_device *dev,int crtc)
drivers/gpu/drm/via/via_dmablit.c +17 -6
@@ -436,13 +436,19 @@ via_dmablit_sync(struct drm_device *dev, uint32_t handle, int engine)int ret =0 ;if (via_dmablit_active (blitq, engine, handle, &queue)) { -DRM_WAIT_ON (ret, *queue,3 *HZ , - !via_dmablit_active (blitq, engine, handle,NULL )); + ret =wait_event_interruptible_timeout (*queue, + !via_dmablit_active (blitq, engine, handle,NULL ), +3 *HZ ); }DRM_DEBUG ("DMA blit sync handle 0x%x engine %d returned %d\n" , handle, engine, ret); -return ret; +if (ret ==0 ) +return -EBUSY ; +else if (ret == -ERESTARTSYS ) +return -EINTR ; +else +return 0 ; }
@@ -688,9 +694,14 @@ via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine)while (blitq->num_free ==0 ) {spin_unlock_irqrestore (&blitq->blit_lock, irqsave); -DRM_WAIT_ON (ret, blitq->busy_queue,HZ , blitq->num_free >0 ); -if (ret) -return (-EINTR == ret) ? -EAGAIN : ret; + ret =wait_event_interruptible_timeout (blitq->busy_queue, + blitq->num_free >0 ,HZ ); +if (ret ==0 ) +return -EBUSY ; +else if (ret == -ERESTARTSYS ) +return -EAGAIN ; +else +return 0 ;spin_lock_irqsave (&blitq->blit_lock, irqsave); }
drivers/gpu/drm/via/via_irq.c +10 -5
@@ -239,18 +239,23 @@ via_driver_irq_wait(struct drm_device *dev, unsigned int irq, int force_sequence cur_irq = dev_priv->via_irqs + real_irq;if (masks[real_irq][2 ] && !force_sequence) { -DRM_WAIT_ON (ret, cur_irq->irq_queue,3 *HZ , + ret =wait_event_interruptible_timeout (cur_irq->irq_queue, ((VIA_READ (masks[irq][2 ]) & masks[irq][3 ]) == - masks[irq][4 ])); + masks[irq][4 ]),3 *HZ ); cur_irq_sequence =atomic_read (&cur_irq->irq_received); }else { -DRM_WAIT_ON (ret, cur_irq->irq_queue,3 *HZ , + ret =wait_event_interruptible_timeout (cur_irq->irq_queue, (((cur_irq_sequence =atomic_read (&cur_irq->irq_received)) - - *sequence) <= (1 <<23 ))); + *sequence) <= (1 <<23 )),3 *HZ ); } *sequence = cur_irq_sequence; -return ret; +if (ret ==0 ) +return -EBUSY ; +else if (ret == -ERESTARTSYS ) +return -EINTR ; +else +return 0 ; }
drivers/gpu/drm/via/via_video.c +9 -3
@@ -82,9 +82,15 @@ int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_switch (fx->func) {case VIA_FUTEX_WAIT : -DRM_WAIT_ON (ret, dev_priv->decoder_queue[fx->lock], - (fx->ms /10 ) * (HZ /100 ), *lock != fx->val); -return ret; + ret =wait_event_interruptible_timeout (dev_priv->decoder_queue[fx->lock], + *lock != fx->val, + (fx->ms /10 ) * (HZ /100 )); +if (ret ==0 ) +return -EBUSY ; +else if (ret == -ERESTARTSYS ) +return -EINTR ; +else +return 0 ;case VIA_FUTEX_WAKE :wake_up (&(dev_priv->decoder_queue[fx->lock]));return 0 ;
include/drm/drm_os_linux.h +0 -24
@@ -39,27 +39,3 @@ static inline void writeq(u64 val, void __iomem *reg)#define DRM_READ64 (map, offset) readq(((void __iomem *)(map)->handle) + (offset))/** Write a qword into a MMIO region */ #define DRM_WRITE64 (map, offset, val) writeq(val, ((void __iomem *)(map)->handle) + (offset)) - -#define DRM_WAIT_ON ( ret, queue, timeout, condition ) \ -do { \ - DECLARE_WAITQUEUE(entry, current); \ - unsigned long end = jiffies + (timeout); \ - add_wait_queue(&(queue), &entry); \ - \ - for (;;) { \ - __set_current_state(TASK_INTERRUPTIBLE); \ - if (condition) \ - break; \ - if (time_after_eq(jiffies, end)) { \ - ret = -EBUSY; \ - break; \ - } \ - schedule_timeout((HZ/100 > 1) ? HZ/100 : 1); \ - if (signal_pending(current)) { \ - ret = -EINTR; \ - break; \ - } \ - } \ - __set_current_state(TASK_RUNNING); \ - remove_wait_queue(&(queue), &entry); \ -} while (0)
Signature · 1 line
1.8.4.3
Dave Airlie
maintainerRe: [PATCH 28/50] drm: Remove DRM_WAIT_ON from all drivers
Quoted 8 lines · Daniel Vetter
Since this is all old ums stuff (including the one in the radeon driver) I've just tried to perfectly replicate the existing semantics.
Reinventing wait queue code with semantics that differ from all the standard linux wait functions is just hairy, so now we can get rid of this and so make sure it'll never again be used.
Oh and: via futexes ... *shudder*
This one worries me, I've had numerous attempts to rip this out in the past and they always changed semantics on some devices and broke stuff.
The sneaky timeout is essential for a lot of the hardware
http://marc.info/?l=dri-devel&m=111383274225047&w=1
So I think I'd like a few more people to review this one before I go near it again :-)
Dave.
Re: [PATCH 28/50] drm: Remove DRM_WAIT_ON from all drivers
Quoted 14 lines · Dave Airlie
Quoted 8 lines · Daniel Vetter
Since this is all old ums stuff (including the one in the radeon driver) I've just tried to perfectly replicate the existing semantics.
Reinventing wait queue code with semantics that differ from all the standard linux wait functions is just hairy, so now we can get rid of this and so make sure it'll never again be used.
Oh and: via futexes ... *shudder*
This one worries me, I've had numerous attempts to rip this out in the past and they always changed semantics on some devices and broke stuff.
Quoted 6 lines
The sneaky timeout is essential for a lot of the hardware
http://marc.info/?l=dri-devel&m=111383274225047&w=1
So I think I'd like a few more people to review this one before I go near it again :-)
Oh, and I've thought the only tricky stuff is mapping the errno's correctly. I think if we have such cases of racy drivers then the right thing to do is to shovel this macro into drivers and slap a big comment about signalling races on top of that code.
Thomas report doesn't say so, but I guess it's for via. Thomas, do you still have a vague recollection of what this has been about?
Dave, do you want me to just respin this one with via left as-is (and the macro pushed into the via driver)?
Thanks, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 28/50] drm: Remove DRM_WAIT_ON from all drivers
Quoted 20 lines · Daniel Vetter
Quoted 13 lines · Dave Airlie
Quoted 8 lines · Daniel Vetter
Since this is all old ums stuff (including the one in the radeon driver) I've just tried to perfectly replicate the existing semantics.
Reinventing wait queue code with semantics that differ from all the standard linux wait functions is just hairy, so now we can get rid of this and so make sure it'll never again be used.
Oh and: via futexes ... *shudder*
This one worries me, I've had numerous attempts to rip this out in the past and they always changed semantics on some devices and broke stuff.
Quoted 6 lines
The sneaky timeout is essential for a lot of the hardware
So I think I'd like a few more people to review this one before I go near it again :-)
Quoted 7 lines
Oh, and I've thought the only tricky stuff is mapping the errno's correctly. I think if we have such cases of racy drivers then the right thing to do is to shovel this macro into drivers and slap a big comment about signalling races on top of that code.
Thomas report doesn't say so, but I guess it's for via. Thomas, do you still have a vague recollection of what this has been about?
Yes, this was with via, but IIRC there were other drivers affected as well, but OTOH, I think the kernel wait code was fixed for races some time after that....
/Thomas
Quoted 5 lines
Dave, do you want me to just respin this one with via left as-is (and the macro pushed into the via driver)?
Thanks, Daniel
PATCH 29/50 drm/irq: simplify irq checks in drm_wait_vblank
In reply to Daniel VetterChecking for both an irq number _and_ whether it's enabled is redundant. Also this will breakd drivers which do their own irq management and just set dev->irq_enabled once the irq stuff is all set up.
--- drivers/gpu/drm/drm_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_irq.c +1 -1
@@ -1186,7 +1186,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,unsigned int flags, seq, crtc, high_crtc;if (drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) -if ((!drm_dev_to_irq (dev)) || (!dev->irq_enabled)) +if (!dev->irq_enabled)return -EINVAL ;if (vblwait->request.type & _DRM_VBLANK_SIGNAL)
Signature · 1 line
1.8.4.3
Re: [PATCH 29/50] drm/irq: simplify irq checks in drm_wait_vblank
Quoted 4 lines · Daniel Vetter
Checking for both an irq number _and_ whether it's enabled is redundant. Also this will breakd drivers which do their own irq management and just set
dev->irq_enabledonce the irq stuff is all set up.
I don't think it'll break such drivers because they shouldn't have DRIVER_HAVE_IRQ set in the first place.
Quoted 10 lines
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_irq.c +0
-0
drivers/gpu/drm/drm_irq.c int drm_wait_vblank(struct drm_device *dev, void *data, · line 1189
Quoted 5 lines
drivers/gpu/drm/drm_irq.c +1
-1@@ -1186,7 +1186,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,unsigned int flags, seq, crtc, high_crtc;if (drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) -if ((!drm_dev_to_irq (dev)) || (!dev->irq_enabled)) +if (!dev->irq_enabled)
In fact, unbreaking drivers was one of the reasons I added this check a few months back (see commit 03f6509df921 'drm: Allow vblank support without DRIVER_HAVE_IRQ'). At the time I could've probably removed the call to drm_dev_to_irq() as well.
I'm now thinking that perhaps we could remove the DRIVER_HAVE_IRQ check altogether now, given how I've had to explicitly make the Tegra driver set dev->irq_enabled since there are other places that require it to be set (amongst other things the conditional wait further below in the drm_wait_vblank() function). See commit 603f0cc9482e 'drm/tegra:
Explicitly set irq_enabled'.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 29/50] drm/irq: simplify irq checks in drm_wait_vblank
Quoted 8 lines · Thierry Reding
Quoted 4 lines · Daniel Vetter
Checking for both an irq number _and_ whether it's enabled is redundant. Also this will breakd drivers which do their own irq management and just set
dev->irq_enabledonce the irq stuff is all set up.I don't think it'll break such drivers because they shouldn't have
DRIVER_HAVE_IRQset in the first place.
Hm right.
Quoted 21 lines
Quoted 10 lines
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/drm_irq.c +0
-0drivers/gpu/drm/drm_irq.c int drm_wait_vblank(struct drm_device *dev, void *data, · line 1189
Quoted 5 lines
drivers/gpu/drm/drm_irq.c +1
-1@@ -1186,7 +1186,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data,unsigned int flags, seq, crtc, high_crtc;if (drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) -if ((!drm_dev_to_irq (dev)) || (!dev->irq_enabled)) +if (!dev->irq_enabled)In fact, unbreaking drivers was one of the reasons I added this check a few months back (see commit
03f6509df921'drm: Allow vblank support withoutDRIVER_HAVE_IRQ'). At the time I could've probably removed the call todrm_dev_to_irq()as well.
Quoted 6 lines
I'm now thinking that perhaps we could remove the
DRIVER_HAVE_IRQcheck altogether now, given how I've had to explicitly make the Tegra driver setdev->irq_enabledsince there are other places that require it to be set (amongst other things the conditional wait further below in thedrm_wait_vblank()function). See commit603f0cc9482e'drm/tegra:
Explicitly setirq_enabled'.
Yeah, I think I'll respin the patch and also drop the HAVE_IRQ check - this function here really should only care about dev->irq_enabled. And even that is kinda just a curtesy to dri1 drivers, for kms drivers interrupt support should always be available for vblank. Of course the driver can internally enabel/disable the vblank source on demand (like e.g. i915 does). I'll respin the patch.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/1 drm/irq: simplify irq checks in drm_wait_vblank
In reply to Daniel VetterChecking for both an irq number _and_ whether it's enabled is redundant. Originally I've thought the drm_dev_to_irq call would break drivers which do their own irq checking, but those shouldn't have DRIVER_HAVE_IRQ set as Thierry Reding pointed out. But such drivers already need to set dev->irq_enabled for other reasons, so we might as well ditch that check, too.
v2: Also drop the HAVE_IRQ check.
--- drivers/gpu/drm/drm_irq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_irq.c +2 -3
@@ -1185,9 +1185,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data,int ret;unsigned int flags, seq, crtc, high_crtc; -if (drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) -if ((!drm_dev_to_irq (dev)) || (!dev->irq_enabled)) -return -EINVAL ; +if (!dev->irq_enabled) +return -EINVAL ;if (vblwait->request.type & _DRM_VBLANK_SIGNAL)return -EINVAL ;
Signature · 1 line
1.8.4.3
Re: [PATCH] drm/irq: simplify irq checks in drm_wait_vblank
Quoted 7 lines · Daniel Vetter
Checking for both an irq number _and_ whether it's enabled is redundant. Originally I've thought the
drm_dev_to_irqcall would break drivers which do their own irq checking, but those shouldn't haveDRIVER_HAVE_IRQset as Thierry Reding pointed out. But such drivers already need to setdev->irq_enabledfor other reasons, so we might as well ditch that check, too.
Quoted 7 lines
v2: Also drop the
HAVE_IRQcheck.Cc Thierry Reding <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_irq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 30/50 drm/pci: fold in irq_by_busid support
In reply to Daniel VetterThis is a ums-only ioctl, and we've only ever supported ums (at least in upstream) on pci devices. So no point in keeping that piece of legacy logic abstracted within the drm bus driver.
To keep things work without CONFIG_PCI also add a dummy ioctl.
v2: Block the irq_by_busid ioctl for modeset drivers.
--- drivers/gpu/drm/drm_irq.c | 27 --------------------------- drivers/gpu/drm/drm_pci.c | 40 ++++++++++++++++++++++++++++++++++++++-- include/drm/drmP.h | 1 - 3 files changed, 38 insertions(+), 30 deletions(-)
drivers/gpu/drm/drm_irq.c +0 -27
@@ -56,33 +56,6 @@*/ #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 -/** -* Get interrupt from bus id. -* -* \param inode device inode. -* \param file_priv DRM file private. -* \param cmd command. -* \param arg user argument, pointing to a drm_irq_busid structure. -* \return zero on success or a negative number on failure. -* -* Finds the PCI device with the specified bus id and gets its IRQ number. -* This IOCTL is deprecated, and will now return EINVAL for any busid not equal -* to that of the device that this DRM instance attached to. -*/ -int drm_irq_by_busid (struct drm_device *dev,void *data, -struct drm_file *file_priv) -{ -struct drm_irq_busid *p = data; - -if (!dev->driver->bus->irq_by_busid) -return -EINVAL ; - -if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) -return -EINVAL ; - -return dev->driver->bus->irq_by_busid (dev, p); -} -/* * Clear vblank timestamp buffer for a crtc. */
drivers/gpu/drm/drm_pci.c +38 -2
@@ -247,7 +247,6 @@ err:return ret; } -static int drm_pci_irq_by_busid (struct drm_device *dev,struct drm_irq_busid *p) { if ((p->busnum >> 8) != drm_get_pci_domain(dev) ||
@@ -262,6 +261,38 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)return 0 ; } +/** +* Get interrupt from bus id. +* +* \param inode device inode. +* \param file_priv DRM file private. +* \param cmd command. +* \param arg user argument, pointing to a drm_irq_busid structure. +* \return zero on success or a negative number on failure. +* +* Finds the PCI device with the specified bus id and gets its IRQ number. +* This IOCTL is deprecated, and will now return EINVAL for any busid not equal +* to that of the device that this DRM instance attached to. +*/ +int drm_irq_by_busid (struct drm_device *dev,void *data, +struct drm_file *file_priv) +{ +struct drm_irq_busid *p = data; + +if (drm_core_check_feature (dev,DRIVER_MODESET )) +return -EINVAL ; + +/* UMS was only ever support on pci devices. */ +if (WARN_ON (!dev->pdev)) +return -EINVAL ; + +if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) +return -EINVAL ; + +return drm_pci_irq_by_busid (dev, p); +} + +static void drm_pci_agp_init (struct drm_device *dev) {if (drm_core_check_feature (dev,DRIVER_USE_AGP )) {
@@ -292,7 +323,6 @@ static struct drm_bus drm_pci_bus = { .get_name = drm_pci_get_name, .set_busid = drm_pci_set_busid, .set_unique = drm_pci_set_unique, - .irq_by_busid = drm_pci_irq_by_busid, };/**
@@ -453,6 +483,12 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) }void drm_pci_agp_destroy (struct drm_device *dev) {} + +int drm_irq_by_busid (struct drm_device *dev,void *data, +struct drm_file *file_priv) +{ +return -EINVAL ; +}#endif EXPORT_SYMBOL (drm_pci_init);
include/drm/drmP.h +0 -1
@@ -748,7 +748,6 @@ struct drm_bus {int (*set_busid)(struct drm_device *dev,struct drm_master *master);int (*set_unique)(struct drm_device *dev,struct drm_master *master,struct drm_unique *unique); -int (*irq_by_busid)(struct drm_device *dev,struct drm_irq_busid *p); };/**
Signature · 1 line
1.8.4.3
PATCH 31/50 drm/irq: drm_control is a legacy ioctl, so pci devices only
In reply to Daniel VetterThis just adds a correspdonding check, follow-up patches will exploit this.
--- drivers/gpu/drm/drm_irq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_irq.c +8 -8
@@ -386,22 +386,22 @@ int drm_control(struct drm_device *dev, void *data,* this used to be a separate function in drm_dma.h */ +if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) +return 0 ; +if (drm_core_check_feature (dev,DRIVER_MODESET )) +return 0 ; +/* UMS was only ever support on pci devices. */ +if (WARN_ON (!dev->pdev)) +return -EINVAL ;switch (ctl->func) {case DRM_INST_HANDLER : -if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) -return 0 ; -if (drm_core_check_feature (dev,DRIVER_MODESET )) -return 0 ;if (dev->if_version <DRM_IF_VERSION (1 ,2 ) && ctl->irq !=drm_dev_to_irq (dev))return -EINVAL ; +return drm_irq_install (dev);case DRM_UNINST_HANDLER : -if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ )) -return 0 ; -if (drm_core_check_feature (dev,DRIVER_MODESET )) -return 0 ;return drm_irq_uninstall (dev);default :return -EINVAL ;
Signature · 1 line
1.8.4.3
PATCH 32/50 drm/irq: remove cargo-culted locking from irq_install/unistall
In reply to Daniel VetterThe dev->struct_mutex locking in drm_irq.c only protects dev->irq_enabled. Which isn't really much at all and only prevents especially nasty ums userspace from concurrently installing the interrupt handling a few times. Or at least trying.
There are tons of unlocked readers of dev->irqs_enabled in the vblank wait code (and by extension also in the pageflip code since that uses the same vblank timestamp engine).
Real modesetting drivers should ensure that nothing can go haywire with a sane setup teardown sequence. So we only really need this for the drm_control ioctl, everywhere else this will just paper over nastiness.
Note that drm/i915 is a bit specially due to the gem+ums combination. So there we also need to properly protect the entervt and leavevt ioctls. But it's definitely saner to do everything in one go than to drop the lock in-between.
Finally there's the gpu reset code in drm/i915. That one's just race (concurrent userspace calls to for vblank waits of pageflips could spuriously fail). So wrap it up in with a nice comment since fixing this is more involved.
--- drivers/gpu/drm/drm_irq.c | 30 +++++++++++++----------------- drivers/gpu/drm/i915/i915_drv.c | 5 +++++ drivers/gpu/drm/i915/i915_gem.c | 5 +++-- 3 files changed, 21 insertions(+), 19 deletions(-)
drivers/gpu/drm/drm_irq.c +13 -17
@@ -254,20 +254,13 @@ int drm_irq_install(struct drm_device *dev)if (drm_dev_to_irq (dev) ==0 )return -EINVAL ; -mutex_lock (&dev->struct_mutex); -/* Driver must have been initialized */ -if (!dev->dev_private) { -mutex_unlock (&dev->struct_mutex); +if (!dev->dev_private)return -EINVAL ; - } -if (dev->irq_enabled) { -mutex_unlock (&dev->struct_mutex); +if (dev->irq_enabled)return -EBUSY ; - } dev->irq_enabled = true; -mutex_unlock (&dev->struct_mutex);DRM_DEBUG ("irq=%d\n" ,drm_dev_to_irq (dev));
@@ -288,9 +281,7 @@ int drm_irq_install(struct drm_device *dev) sh_flags, irqname, dev);if (ret <0 ) { -mutex_lock (&dev->struct_mutex); dev->irq_enabled = false; -mutex_unlock (&dev->struct_mutex);return ret; }
@@ -302,9 +293,7 @@ int drm_irq_install(struct drm_device *dev) ret = dev->driver->irq_postinstall (dev);if (ret <0 ) { -mutex_lock (&dev->struct_mutex); dev->irq_enabled = false; -mutex_unlock (&dev->struct_mutex);if (!drm_core_check_feature (dev,DRIVER_MODESET ))vga_client_register (dev->pdev,NULL ,NULL ,NULL );free_irq (drm_dev_to_irq (dev), dev);
@@ -330,10 +319,8 @@ int drm_irq_uninstall(struct drm_device *dev)if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ ))return -EINVAL ; -mutex_lock (&dev->struct_mutex); irq_enabled = dev->irq_enabled; dev->irq_enabled = false; -mutex_unlock (&dev->struct_mutex);/* * Wake up any waiters so they don't hang.
@@ -381,6 +368,7 @@ int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv) {struct drm_control *ctl = data; +int ret =0 ;/* if we haven't irq we fallback for compatibility reasons - * this used to be a separate function in drm_dma.h
@@ -400,9 +388,17 @@ int drm_control(struct drm_device *dev, void *data, ctl->irq != drm_dev_to_irq(dev))return -EINVAL ; -return drm_irq_install (dev); +mutex_lock (&dev->struct_mutex); + ret =drm_irq_install (dev); +mutex_unlock (&dev->struct_mutex); + +return ret;case DRM_UNINST_HANDLER : -return drm_irq_uninstall (dev); +mutex_lock (&dev->struct_mutex); + ret =drm_irq_uninstall (dev); +mutex_unlock (&dev->struct_mutex); + +return ret;default :return -EINVAL ; }
drivers/gpu/drm/i915/i915_drv.c +5 -0
@@ -799,6 +799,11 @@ int i915_reset(struct drm_device *dev)return ret; } +/* +* FIXME: This is horribly race against concurrent pageflip and +* vblank wait ioctls since they can observe dev->irqs_disabled +* being false when they shouldn't be able to. +*/ drm_irq_uninstall (dev);drm_irq_install (dev);intel_hpd_init (dev);
drivers/gpu/drm/i915/i915_gem.c +3 -2
@@ -4543,16 +4543,15 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, }BUG_ON (!list_empty (&dev_priv->gtt.base.active_list)); -mutex_unlock (&dev->struct_mutex); ret =drm_irq_install (dev);if (ret) goto cleanup_ringbuffer; +mutex_unlock (&dev->struct_mutex);return 0 ; cleanup_ringbuffer: -mutex_lock (&dev->struct_mutex);i915_gem_cleanup_ringbuffer (dev); dev_priv->ums.mm_suspended =1 ;mutex_unlock (&dev->struct_mutex);
@@ -4567,7 +4566,9 @@ i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,if (drm_core_check_feature (dev,DRIVER_MODESET ))return 0 ; +mutex_lock (&dev->struct_mutex);drm_irq_uninstall (dev); +mutex_unlock (&dev->struct_mutex);return i915_gem_suspend (dev); }
Signature · 1 line
1.8.4.3
PATCH 33/50 drm: remove drm_dev_to_irq from drivers
In reply to Daniel VetterOnly used in some legacy pci drivers, and dereferncing the pci irq is actually shorter ...
Since this removes all users for drm_dev_to_irq from the tree except in drm_irq.c, move the inline helper in there. It'll disappear soon, too.
--- drivers/gpu/drm/drm_irq.c | 5 +++++ drivers/gpu/drm/mga/mga_state.c | 2 +- drivers/gpu/drm/r128/r128_state.c | 2 +- drivers/gpu/drm/radeon/radeon_state.c | 2 +- include/drm/drmP.h | 5 ----- 5 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/drm_irq.c +5 -0
@@ -233,6 +233,11 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state) } } +static inline int drm_dev_to_irq (struct drm_device *dev) +{ +return dev->driver->bus->get_irq (dev); +} +/** * Install IRQ handler. *
drivers/gpu/drm/mga/mga_state.c +1 -1
@@ -1020,7 +1020,7 @@ static int mga_getparam(struct drm_device *dev, void *data, struct drm_file *filswitch (param->param) {case MGA_PARAM_IRQ_NR : - value =drm_dev_to_irq (dev); + value = dev->pdev->irq;break ;case MGA_PARAM_CARD_TYPE : value = dev_priv->chipset;
drivers/gpu/drm/r128/r128_state.c +1 -1
@@ -1616,7 +1616,7 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fiswitch (param->param) {case R128_PARAM_IRQ_NR : - value =drm_dev_to_irq (dev); + value = dev->pdev->irq;break ;default :return -EINVAL ;
drivers/gpu/drm/radeon/radeon_state.c +1 -1
@@ -3054,7 +3054,7 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_filif ((dev_priv->flags &RADEON_FAMILY_MASK ) >=CHIP_R600 ) value =0 ;else - value =drm_dev_to_irq (dev); + value = dev->pdev->irq;break ;case RADEON_PARAM_GART_BASE : value = dev_priv->gart_vm_start;
include/drm/drmP.h +0 -5
@@ -1205,11 +1205,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,return ((dev->driver->driver_features & feature) ?1 :0 ); } -static inline int drm_dev_to_irq (struct drm_device *dev) -{ -return dev->driver->bus->get_irq (dev); -} -static inline void drm_device_set_unplugged (struct drm_device *dev) {smp_wmb ();
Signature · 1 line
1.8.4.3
PATCH 34/50 drm: kill drm_bus->bus_type
In reply to Daniel VetterCompletely unused. Hooray, midlayer mistakes that didn't cause work to undo!
v2: Rebase on top of the recent tegra changes which added a host1x drm bus.
--- drivers/gpu/drm/drm_pci.c | 1 - drivers/gpu/drm/drm_platform.c | 1 - drivers/gpu/drm/drm_usb.c | 1 - drivers/gpu/drm/tegra/bus.c | 1 - include/drm/drmP.h | 6 ------ 5 files changed, 10 deletions(-)
drivers/gpu/drm/drm_pci.c +0 -1
@@ -318,7 +318,6 @@ void drm_pci_agp_destroy(struct drm_device *dev) }static struct drm_bus drm_pci_bus = { - .bus_type =DRIVER_BUS_PCI , .get_irq = drm_pci_get_irq, .get_name = drm_pci_get_name, .set_busid = drm_pci_set_busid,
drivers/gpu/drm/drm_platform.c +0 -1
@@ -123,7 +123,6 @@ err: }static struct drm_bus drm_platform_bus = { - .bus_type =DRIVER_BUS_PLATFORM , .get_irq = drm_platform_get_irq, .get_name = drm_platform_get_name, .set_busid = drm_platform_set_busid,
drivers/gpu/drm/drm_usb.c +0 -1
@@ -52,7 +52,6 @@ static int drm_usb_set_busid(struct drm_device *dev, }static struct drm_bus drm_usb_bus = { - .bus_type =DRIVER_BUS_USB , .get_irq = drm_usb_get_irq, .get_name = drm_usb_get_name, .set_busid = drm_usb_set_busid,
drivers/gpu/drm/tegra/bus.c +0 -1
@@ -37,7 +37,6 @@ static int drm_host1x_set_busid(struct drm_device *dev, }static struct drm_bus drm_host1x_bus = { - .bus_type =DRIVER_BUS_HOST1X , .set_busid = drm_host1x_set_busid, };
include/drm/drmP.h +0 -6
@@ -146,11 +146,6 @@ int drm_err(const char *func, const char *format, ...);#define DRIVER_PRIME 0x4000#define DRIVER_RENDER 0x8000 -#define DRIVER_BUS_PCI 0x1 -#define DRIVER_BUS_PLATFORM 0x2 -#define DRIVER_BUS_USB 0x3 -#define DRIVER_BUS_HOST1X 0x4 -/***********************************************************************/ /** \name Begin the DRM... */ /*@{*/
@@ -742,7 +737,6 @@ struct drm_master {#define DRM_SCANOUTPOS_ACCURATE (1 << 2)struct drm_bus { -int bus_type;int (*get_irq)(struct drm_device *dev);const char *(*get_name)(struct drm_device *dev);int (*set_busid)(struct drm_device *dev,struct drm_master *master);
Signature · 1 line
1.8.4.3
PATCH 35/50 drm: Rip out totally bogus vga_switcheroo->can_switch locking
In reply to Daniel VetterSo I just wanted to add a new field to struct drm_device and accidentally stumbled over something. According to comments dev->open_count is protected by dev->count_lock, but that's totally not the case. It's protected by drm_global_mutex.
Unfortunately the vga switcheroo callbacks took this comment at face value. The problem is that we can't just take the drm_global_mutex because:
- It would lead to a locking inversion with the driver load/unload paths.
- It wouldn't actually protect anything, for that we'd need to wrap the entire vga switcheroo code in the drm_global_mutex. And I'm not sure whether that would actually solve anything.
What we probably want is a try_to_grab_switcheroo reference kind of thing which is used in the driver's ->open callback. Then we could move all that ->can_switch madness into the vga switcheroo core where it really belongs.
But since that would amount to real work take the easy way out and just add a comment. It's definitely not going to make anything worse since doing switcheroo state changes while restarting X just isn't recommended. Even though the delayed switching code does exactly that.
--- drivers/gpu/drm/i915/i915_dma.c | 7 +++++-- drivers/gpu/drm/nouveau/nouveau_vga.c | 7 +++++-- drivers/gpu/drm/radeon/radeon_device.c | 7 +++++-- include/drm/drmP.h | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +5 -2
@@ -1269,9 +1269,12 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)struct drm_device *dev =pci_get_drvdata (pdev);bool can_switch; -spin_lock (&dev->count_lock); +/* +* FIXME: open_count is protected by drm_global_mutex but that would lead to +* locking inversion with the driver load path. And the access here is +* completely racy anyway. So don't bother with locking for now. +*/ can_switch = (dev->open_count ==0 ); -spin_unlock (&dev->count_lock);return can_switch; }
drivers/gpu/drm/nouveau/nouveau_vga.c +5 -2
@@ -64,9 +64,12 @@ nouveau_switcheroo_can_switch(struct pci_dev *pdev)struct drm_device *dev =pci_get_drvdata (pdev);bool can_switch; -spin_lock (&dev->count_lock); +/* +* FIXME: open_count is protected by drm_global_mutex but that would lead to +* locking inversion with the driver load path. And the access here is +* completely racy anyway. So don't bother with locking for now. +*/ can_switch = (dev->open_count ==0 ); -spin_unlock (&dev->count_lock);return can_switch; }
drivers/gpu/drm/radeon/radeon_device.c +5 -2
@@ -1119,9 +1119,12 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)struct drm_device *dev =pci_get_drvdata (pdev);bool can_switch; -spin_lock (&dev->count_lock); +/* +* FIXME: open_count is protected by drm_global_mutex but that would lead to +* locking inversion with the driver load path. And the access here is +* completely racy anyway. So don't bother with locking for now. +*/ can_switch = (dev->open_count ==0 ); -spin_unlock (&dev->count_lock);return can_switch; }
include/drm/drmP.h +1 -1
@@ -1085,7 +1085,7 @@ struct drm_device {/** \name Usage Counters */ /*@{ */ -int open_count;/**< Outstanding files open */ +int open_count;/**< Outstanding files open, protected by drm_global_lock. */ atomic_t ioctl_count;/**< Outstanding IOCTLs pending */ atomic_t vma_count;/**< Outstanding vma areas open */ int buf_use;/**< Buffers in use -- cannot alloc */
Signature · 1 line
1.8.4.3
PATCH 36/50 drm: rename dev->count_lock to dev->buf_lock
In reply to Daniel VetterSince really that's all it protects - legacy horror stories in drm_bufs.c. Since I don't want to waste any more time on this I didn't bother to actually look at what it protects in there, but it's at least contained now.
--- drivers/gpu/drm/drm_bufs.c | 32 ++++++++++++++++---------------- drivers/gpu/drm/drm_stub.c | 2 +- include/drm/drmP.h | 4 +++- 3 files changed, 20 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_bufs.c +16 -16
@@ -656,13 +656,13 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)DRM_DEBUG ("zone invalid\n" );return -EINVAL ; } -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (dev->buf_use) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; }atomic_inc (&dev->buf_alloc); -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);mutex_lock (&dev->struct_mutex); entry = &dma->bufs[order];
@@ -805,13 +805,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) page_order = order -PAGE_SHIFT >0 ? order -PAGE_SHIFT :0 ; total =PAGE_SIZE << page_order; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (dev->buf_use) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; }atomic_inc (&dev->buf_alloc); -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);mutex_lock (&dev->struct_mutex); entry = &dma->bufs[order];
@@ -1015,13 +1015,13 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * requestif (order <DRM_MIN_ORDER || order >DRM_MAX_ORDER )return -EINVAL ; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (dev->buf_use) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; }atomic_inc (&dev->buf_alloc); -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);mutex_lock (&dev->struct_mutex); entry = &dma->bufs[order];
@@ -1175,7 +1175,7 @@ int drm_addbufs(struct drm_device *dev, void *data,* \param arg pointer to a drm_buf_info structure. * \return zero on success or a negative number on failure. * -* Increments drm_device::buf_use while holding the drm_device::count_lock +* Increments drm_device::buf_use while holding the drm_device::buf_lock * lock, preventing of allocating more buffers after this call. Information * about each requested buffer is then copied into user space. */
@@ -1196,13 +1196,13 @@ int drm_infobufs(struct drm_device *dev, void *data,if (!dma)return -EINVAL ; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (atomic_read (&dev->buf_alloc)) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; } ++dev->buf_use;/* Can't allocate more after this call */ -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);for (i =0 , count =0 ; i <DRM_MAX_ORDER +1 ; i++) {if (dma->bufs[i].buf_count)
@@ -1381,13 +1381,13 @@ int drm_mapbufs(struct drm_device *dev, void *data,if (!dma)return -EINVAL ; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (atomic_read (&dev->buf_alloc)) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; } dev->buf_use++;/* Can't allocate more after this call */ -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);if (request->count >= dma->buf_count) { if ((dev->agp && (dma->flags & _DRM_DMA_USE_AGP))
drivers/gpu/drm/drm_stub.c +1 -1
@@ -441,7 +441,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,INIT_LIST_HEAD (&dev->maplist);INIT_LIST_HEAD (&dev->vblank_event_list); -spin_lock_init (&dev->count_lock); +spin_lock_init (&dev->buf_lock);spin_lock_init (&dev->event_lock);mutex_init (&dev->struct_mutex);mutex_init (&dev->ctxlist_mutex);
include/drm/drmP.h +3 -1
@@ -1079,7 +1079,6 @@ struct drm_device {/** \name Locks */ /*@{ */ -spinlock_t count_lock;/**< For inuse, drm_device::open_count, drm_device::buf_use */ struct mutex struct_mutex;/**< For others */ /*@} */
@@ -1088,6 +1087,7 @@ struct drm_device {int open_count;/**< Outstanding files open, protected by drm_global_lock. */ atomic_t ioctl_count;/**< Outstanding IOCTLs pending */ atomic_t vma_count;/**< Outstanding vma areas open */ +spinlock_t buf_lock;/**< For drm_device::buf_use and a few other things. */ int buf_use;/**< Buffers in use -- cannot alloc */ atomic_t buf_alloc;/**< Buffer allocation in progress */ /*@} */
@@ -1118,6 +1118,8 @@ struct drm_device {/** \name Context support */ /*@{ */ bool irq_enabled;/**< True if irq handler is enabled */ +int irq; +__volatile__ long context_flag;/**< Context swapping flag */ int last_context;/**< Last current context */ /*@} */
Signature · 1 line
1.8.4.3
Re: [PATCH 36/50] drm: rename dev->count_lock to dev->buf_lock
On Wed, Dec 11, 2013 at 11:34:57AM +0100, Daniel Vetter wrote:
[...]
Quoted 1 line
include/drm/drmP.h +0
-0
[...]
include/drm/drmP.h struct drm_device { · line 1121
Quoted 5 lines
include/drm/drmP.h +1
-0@@ -1118,6 +1118,8 @@ struct drm_device {/** \name Context support */ /*@{ */ bool irq_enabled;/**< True if irq handler is enabled */ +int irq;
This probably should be in a different patch. I think it belongs in patch 37/50.
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 36/50] drm: rename dev->count_lock to dev->buf_lock
Quoted 8 lines · Thierry Reding
include/drm/drmP.h struct drm_device { · line 1121
Quoted 5 lines
include/drm/drmP.h +1
-0@@ -1118,6 +1118,8 @@ struct drm_device {/** \name Context support */ /*@{ */ bool irq_enabled;/**< True if irq handler is enabled */ +int irq;This probably should be in a different patch. I think it belongs in patch 37/50.
Oops indeed that hunk escaped. I'll respin both patches. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/1 drm: rename dev->count_lock to dev->buf_lock
In reply to Daniel VetterSince really that's all it protects - legacy horror stories in drm_bufs.c. Since I don't want to waste any more time on this I didn't bother to actually look at what it protects in there, but it's at least contained now.
v2: Move the spurious hunk to the right patch (Thierry).
--- drivers/gpu/drm/drm_bufs.c | 32 ++++++++++++++++---------------- drivers/gpu/drm/drm_stub.c | 2 +- include/drm/drmP.h | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_bufs.c +16 -16
@@ -656,13 +656,13 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)DRM_DEBUG ("zone invalid\n" );return -EINVAL ; } -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (dev->buf_use) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; }atomic_inc (&dev->buf_alloc); -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);mutex_lock (&dev->struct_mutex); entry = &dma->bufs[order];
@@ -805,13 +805,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) page_order = order -PAGE_SHIFT >0 ? order -PAGE_SHIFT :0 ; total =PAGE_SIZE << page_order; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (dev->buf_use) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; }atomic_inc (&dev->buf_alloc); -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);mutex_lock (&dev->struct_mutex); entry = &dma->bufs[order];
@@ -1015,13 +1015,13 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * requestif (order <DRM_MIN_ORDER || order >DRM_MAX_ORDER )return -EINVAL ; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (dev->buf_use) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; }atomic_inc (&dev->buf_alloc); -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);mutex_lock (&dev->struct_mutex); entry = &dma->bufs[order];
@@ -1175,7 +1175,7 @@ int drm_addbufs(struct drm_device *dev, void *data,* \param arg pointer to a drm_buf_info structure. * \return zero on success or a negative number on failure. * -* Increments drm_device::buf_use while holding the drm_device::count_lock +* Increments drm_device::buf_use while holding the drm_device::buf_lock * lock, preventing of allocating more buffers after this call. Information * about each requested buffer is then copied into user space. */
@@ -1196,13 +1196,13 @@ int drm_infobufs(struct drm_device *dev, void *data,if (!dma)return -EINVAL ; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (atomic_read (&dev->buf_alloc)) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; } ++dev->buf_use;/* Can't allocate more after this call */ -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);for (i =0 , count =0 ; i <DRM_MAX_ORDER +1 ; i++) {if (dma->bufs[i].buf_count)
@@ -1381,13 +1381,13 @@ int drm_mapbufs(struct drm_device *dev, void *data,if (!dma)return -EINVAL ; -spin_lock (&dev->count_lock); +spin_lock (&dev->buf_lock);if (atomic_read (&dev->buf_alloc)) { -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);return -EBUSY ; } dev->buf_use++;/* Can't allocate more after this call */ -spin_unlock (&dev->count_lock); +spin_unlock (&dev->buf_lock);if (request->count >= dma->buf_count) { if ((dev->agp && (dma->flags & _DRM_DMA_USE_AGP))
drivers/gpu/drm/drm_stub.c +1 -1
@@ -441,7 +441,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,INIT_LIST_HEAD (&dev->maplist);INIT_LIST_HEAD (&dev->vblank_event_list); -spin_lock_init (&dev->count_lock); +spin_lock_init (&dev->buf_lock);spin_lock_init (&dev->event_lock);mutex_init (&dev->struct_mutex);mutex_init (&dev->ctxlist_mutex);
include/drm/drmP.h +1 -1
@@ -1079,7 +1079,6 @@ struct drm_device {/** \name Locks */ /*@{ */ -spinlock_t count_lock;/**< For inuse, drm_device::open_count, drm_device::buf_use */ struct mutex struct_mutex;/**< For others */ /*@} */
@@ -1088,6 +1087,7 @@ struct drm_device {int open_count;/**< Outstanding files open, protected by drm_global_lock. */ atomic_t ioctl_count;/**< Outstanding IOCTLs pending */ atomic_t vma_count;/**< Outstanding vma areas open */ +spinlock_t buf_lock;/**< For drm_device::buf_use and a few other things. */ int buf_use;/**< Buffers in use -- cannot alloc */ atomic_t buf_alloc;/**< Buffer allocation in progress */ /*@} */
Signature · 1 line
1.8.4.3
Re: [PATCH] drm: rename dev->count_lock to dev->buf_lock
Quoted 7 lines · Daniel Vetter
Since really that's all it protects - legacy horror stories in
drm_bufs.c. Since I don't want to waste any more time on this I didn't bother to actually look at what it protects in there, but it's at least contained now.v2: Move the spurious hunk to the right patch (Thierry).
Quoted 7 lines
Cc Thierry Reding <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_bufs.c | 32 ++++++++++++++++---------------- drivers/gpu/drm/drm_stub.c | 2 +- include/drm/drmP.h | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 37/50 drm/irq: track the irq installed in drm_irq_install in dev->irq
In reply to Daniel VetterTo get rid of the dev->bus->get_irq callback we need to pass in the desired irq explicitly into drm_irq_install. To avoid having to do the same for drm_irq_unistall just track it internally. That leaves drivers with less room to botch things up.
--- drivers/gpu/drm/drm_irq.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_irq.c +11 -7
@@ -249,14 +249,16 @@ static inline int drm_dev_to_irq(struct drm_device *dev)*/ int drm_irq_install (struct drm_device *dev) { -int ret; +int ret, irq;unsigned long sh_flags =0 ;char *irqname; + irq =drm_dev_to_irq (dev); +if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ ))return -EINVAL ; -if (drm_dev_to_irq (dev) ==0 ) +if (irq ==0 )return -EINVAL ;/* Driver must have been initialized */
@@ -267,7 +269,7 @@ int drm_irq_install(struct drm_device *dev)return -EBUSY ; dev->irq_enabled = true; -DRM_DEBUG ("irq=%d\n" ,drm_dev_to_irq (dev)); +DRM_DEBUG ("irq=%d\n" , dev->irq);/* Before installing handler */ if (dev->driver->irq_preinstall)
@@ -282,7 +284,7 @@ int drm_irq_install(struct drm_device *dev)else irqname = dev->driver->name; - ret =request_irq (drm_dev_to_irq (dev), dev->driver->irq_handler, + ret =request_irq (dev->irq, dev->driver->irq_handler, sh_flags, irqname, dev);if (ret <0 ) {
@@ -301,7 +303,9 @@ int drm_irq_install(struct drm_device *dev) dev->irq_enabled = false;if (!drm_core_check_feature (dev,DRIVER_MODESET ))vga_client_register (dev->pdev,NULL ,NULL ,NULL ); -free_irq (drm_dev_to_irq (dev), dev); +free_irq (dev->irq, dev); + }else { + dev->irq = irq; }return ret;
@@ -344,7 +348,7 @@ int drm_irq_uninstall(struct drm_device *dev)if (!irq_enabled)return -EINVAL ; -DRM_DEBUG ("irq=%d\n" ,drm_dev_to_irq (dev)); +DRM_DEBUG ("irq=%d\n" , dev->irq);if (!drm_core_check_feature (dev,DRIVER_MODESET ))vga_client_register (dev->pdev,NULL ,NULL ,NULL );
@@ -352,7 +356,7 @@ int drm_irq_uninstall(struct drm_device *dev)if (dev->driver->irq_uninstall) dev->driver->irq_uninstall (dev); -free_irq (drm_dev_to_irq (dev), dev); +free_irq (dev->irq, dev);return 0 ; }
Signature · 1 line
1.8.4.3
PATCH 1/1 drm/irq: track the irq installed in drm_irq_install in dev->irq
To get rid of the dev->bus->get_irq callback we need to pass in the desired irq explicitly into drm_irq_install. To avoid having to do the same for drm_irq_unistall just track it internally. That leaves drivers with less room to botch things up.
v2: Add the hunk lost in an earlier patch to this one (Thierry).
--- drivers/gpu/drm/drm_irq.c | 18 +++++++++++------- include/drm/drmP.h | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_irq.c +11 -7
@@ -249,14 +249,16 @@ static inline int drm_dev_to_irq(struct drm_device *dev)*/ int drm_irq_install (struct drm_device *dev) { -int ret; +int ret, irq;unsigned long sh_flags =0 ;char *irqname; + irq =drm_dev_to_irq (dev); +if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ ))return -EINVAL ; -if (drm_dev_to_irq (dev) ==0 ) +if (irq ==0 )return -EINVAL ;/* Driver must have been initialized */
@@ -267,7 +269,7 @@ int drm_irq_install(struct drm_device *dev)return -EBUSY ; dev->irq_enabled = true; -DRM_DEBUG ("irq=%d\n" ,drm_dev_to_irq (dev)); +DRM_DEBUG ("irq=%d\n" , dev->irq);/* Before installing handler */ if (dev->driver->irq_preinstall)
@@ -282,7 +284,7 @@ int drm_irq_install(struct drm_device *dev)else irqname = dev->driver->name; - ret =request_irq (drm_dev_to_irq (dev), dev->driver->irq_handler, + ret =request_irq (dev->irq, dev->driver->irq_handler, sh_flags, irqname, dev);if (ret <0 ) {
@@ -301,7 +303,9 @@ int drm_irq_install(struct drm_device *dev) dev->irq_enabled = false;if (!drm_core_check_feature (dev,DRIVER_MODESET ))vga_client_register (dev->pdev,NULL ,NULL ,NULL ); -free_irq (drm_dev_to_irq (dev), dev); +free_irq (dev->irq, dev); + }else { + dev->irq = irq; }return ret;
@@ -344,7 +348,7 @@ int drm_irq_uninstall(struct drm_device *dev)if (!irq_enabled)return -EINVAL ; -DRM_DEBUG ("irq=%d\n" ,drm_dev_to_irq (dev)); +DRM_DEBUG ("irq=%d\n" , dev->irq);if (!drm_core_check_feature (dev,DRIVER_MODESET ))vga_client_register (dev->pdev,NULL ,NULL ,NULL );
@@ -352,7 +356,7 @@ int drm_irq_uninstall(struct drm_device *dev)if (dev->driver->irq_uninstall) dev->driver->irq_uninstall (dev); -free_irq (drm_dev_to_irq (dev), dev); +free_irq (dev->irq, dev);return 0 ; }
include/drm/drmP.h +2 -0
@@ -1118,6 +1118,8 @@ struct drm_device {/** \name Context support */ /*@{ */ bool irq_enabled;/**< True if irq handler is enabled */ +int irq; +__volatile__ long context_flag;/**< Context swapping flag */ int last_context;/**< Last current context */ /*@} */
Signature · 1 line
1.8.4.3
Re: [PATCH] drm/irq: track the irq installed in drm_irq_install in dev->irq
Quoted 5 lines · Daniel Vetter
To get rid of the
dev->bus->get_irqcallback we need to pass in the desired irq explicitly intodrm_irq_install. To avoid having to do the same fordrm_irq_unistalljust track it internally. That leaves drivers with less room to botch things up.
Quoted 8 lines
v2: Add the hunk lost in an earlier patch to this one (Thierry).
Cc Thierry Reding <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_irq.c | 18 +++++++++++------- include/drm/drmP.h | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-)
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 38/50 drm/irq: Look up the pci irq directly in the drm_control ioctl
In reply to Daniel VetterIt's only ever called for legacy drivers, which are all pci.
--- drivers/gpu/drm/drm_irq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_irq.c +4 -2
@@ -377,7 +377,7 @@ int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv) {struct drm_control *ctl = data; -int ret =0 ; +int ret =0 , irq;/* if we haven't irq we fallback for compatibility reasons - * this used to be a separate function in drm_dma.h
@@ -393,8 +393,10 @@ int drm_control(struct drm_device *dev, void *data,switch (ctl->func) {case DRM_INST_HANDLER : + irq = dev->pdev->irq; +if (dev->if_version <DRM_IF_VERSION (1 ,2 ) && - ctl->irq !=drm_dev_to_irq (dev)) + ctl->irq != irq)return -EINVAL ;mutex_lock (&dev->struct_mutex);
Signature · 1 line
1.8.4.3
PATCH 39/50 drm: pass the irq explicitly to drm_irq_install
In reply to Daniel VetterUnfortunately this requires a drm-wide change, and I didn't see a sane way around that. Luckily it's fairly simple, we just need to inline the respective get_irq implementation from either drm_pci.c or drm_platform.c.
With that we can now also remove drm_dev_to_irq from drm_irq.c.
--- Documentation/DocBook/drm.tmpl | 10 +--------- drivers/gpu/drm/armada/armada_drv.c | 2 +- drivers/gpu/drm/drm_irq.c | 13 +++---------- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 4 ++-- drivers/gpu/drm/i915/i915_gem.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/qxl/qxl_irq.c | 2 +- drivers/gpu/drm/radeon/radeon_irq_kms.c | 2 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- include/drm/drmP.h | 2 +- 14 files changed, 17 insertions(+), 32 deletions(-)
Documentation/DocBook/drm.tmpl +1 -9
@@ -328,21 +328,13 @@ char *date;</synopsis> <sect4> <title>Managed IRQ Registration</title> <para> - Both the <function>drm_irq_install</function> and - <function>drm_irq_uninstall</function> functions get the device IRQ by - calling <function>drm_dev_to_irq</function>. This inline function will - call a bus-specific operation to retrieve the IRQ number. For platform - devices, <function>platform_get_irq</function>(..., 0) is used to - retrieve the IRQ number. - </para> - <para> <function>drm_irq_install</function> starts by calling the <methodname>irq_preinstall</methodname> driver operation. The operation is optional and must make sure that the interrupt will not get fired by clearing all pending interrupt flags or disabling the interrupt. </para> <para> - The IRQ will then be requested by a call to + The passed-in IRQ will then be requested by a call to <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver feature flag is set, a shared (IRQF_SHARED) IRQ handler will be requested.
drivers/gpu/drm/armada/armada_drv.c +1 -1
@@ -181,7 +181,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)if (ret) goto err_kms; - ret =drm_irq_install (dev); + ret =drm_irq_install (dev,platform_get_irq (dev->platformdev,0 ));if (ret) goto err_kms;
drivers/gpu/drm/drm_irq.c +3 -10
@@ -233,11 +233,6 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state) } } -static inline int drm_dev_to_irq (struct drm_device *dev) -{ -return dev->driver->bus->get_irq (dev); -} -/** * Install IRQ handler. *
@@ -247,14 +242,12 @@ static inline int drm_dev_to_irq(struct drm_device *dev)* \c irq_preinstall() and \c irq_postinstall() functions * before and after the installation. */ -int drm_irq_install (struct drm_device *dev) +int drm_irq_install (struct drm_device *dev,int irq) { -int ret, irq; +int ret;unsigned long sh_flags =0 ;char *irqname; - irq =drm_dev_to_irq (dev); -if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ ))return -EINVAL ;
@@ -400,7 +393,7 @@ int drm_control(struct drm_device *dev, void *data,return -EINVAL ;mutex_lock (&dev->struct_mutex); - ret =drm_irq_install (dev); + ret =drm_irq_install (dev, irq);mutex_unlock (&dev->struct_mutex);return ret;
drivers/gpu/drm/gma500/psb_drv.c +1 -1
@@ -387,7 +387,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)PSB_WVDC32 (0xFFFFFFFF ,PSB_INT_MASK_R );spin_unlock_irqrestore (&dev_priv->irqmask_lock, irqflags); -drm_irq_install (dev); +drm_irq_install (dev, dev->pdev->irq); dev->vblank_disable_allowed = true;
drivers/gpu/drm/i915/i915_dma.c +1 -1
@@ -1317,7 +1317,7 @@ static int i915_load_modeset_init(struct drm_device *dev)if (ret) goto cleanup_vga_switcheroo; - ret =drm_irq_install (dev); + ret =drm_irq_install (dev, dev->pdev->irq);if (ret) goto cleanup_gem_stolen;
drivers/gpu/drm/i915/i915_drv.c +2 -2
@@ -644,7 +644,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)mutex_unlock (&dev->struct_mutex);/* We need working interrupts for modeset enabling ... */ -drm_irq_install (dev); +drm_irq_install (dev, dev->pdev->irq);intel_modeset_init_hw (dev);
@@ -805,7 +805,7 @@ int i915_reset(struct drm_device *dev)* being false when they shouldn't be able to. */ drm_irq_uninstall (dev); -drm_irq_install (dev); +drm_irq_install (dev, dev->pdev->irq);intel_hpd_init (dev); }else {mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -4544,7 +4544,7 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data,BUG_ON (!list_empty (&dev_priv->gtt.base.active_list)); - ret =drm_irq_install (dev); + ret =drm_irq_install (dev, dev->pdev->irq);if (ret) goto cleanup_ringbuffer;mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -228,7 +228,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags) }pm_runtime_get_sync (dev->dev); - ret =drm_irq_install (dev); + ret =drm_irq_install (dev,platform_get_irq (dev->platformdev,0 ));pm_runtime_put_sync (dev->dev);if (ret <0 ) {dev_err (dev->dev,"failed to install IRQ handler\n" );
drivers/gpu/drm/qxl/qxl_irq.c +1 -1
@@ -87,7 +87,7 @@ int qxl_irq_init(struct qxl_device *qdev)atomic_set (&qdev->irq_received_cursor,0 );atomic_set (&qdev->irq_received_io_cmd,0 ); qdev->irq_received_error =0 ; - ret =drm_irq_install (qdev->ddev); + ret =drm_irq_install (qdev->ddev, qdev->ddev->pdev->irq); qdev->ram_header->int_mask =QXL_INTERRUPT_MASK ;if (unlikely (ret !=0 )) {DRM_ERROR ("Failed installing irq: %d\n" , ret);
drivers/gpu/drm/radeon/radeon_irq_kms.c +1 -1
@@ -287,7 +287,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)INIT_WORK (&rdev->reset_work, radeon_irq_reset_work_func); rdev->irq.installed = true; - r =drm_irq_install (rdev->ddev); + r =drm_irq_install (rdev->ddev, rdev->ddev->pdev->irq);if (r) { rdev->irq.installed = false;flush_work (&rdev->hotplug_work);
drivers/gpu/drm/shmobile/shmob_drm_drv.c +1 -1
@@ -185,7 +185,7 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags) goto done; } - ret =drm_irq_install (dev); + ret =drm_irq_install (dev,platform_get_irq (dev->platformdev,0 ));if (ret <0 ) {dev_err (&pdev->dev,"failed to install IRQ handler\n" ); goto done;
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -268,7 +268,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) }pm_runtime_get_sync (dev->dev); - ret =drm_irq_install (dev); + ret =drm_irq_install (dev,platform_get_irq (dev->platformdev,0 ));pm_runtime_put_sync (dev->dev);if (ret <0 ) {dev_err (dev->dev,"failed to install IRQ handler\n" );
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -1
@@ -704,7 +704,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) }if (dev_priv->capabilities &SVGA_CAP_IRQMASK ) { - ret =drm_irq_install (dev); + ret =drm_irq_install (dev, dev->pdev->irq);if (ret !=0 ) {DRM_ERROR ("Failed installing irq: %d\n" , ret); goto out_no_irq;
include/drm/drmP.h +1 -1
@@ -1362,7 +1362,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,/* IRQ support (drm_irq.h) */ extern int drm_control (struct drm_device *dev,void *data,struct drm_file *file_priv); -extern int drm_irq_install (struct drm_device *dev); +extern int drm_irq_install (struct drm_device *dev,int irq);extern int drm_irq_uninstall (struct drm_device *dev);extern int drm_vblank_init (struct drm_device *dev,int num_crtcs);
Signature · 1 line
1.8.4.3
PATCH 40/50 drm: remove bus->get_irq implementations
In reply to Daniel VetterNow that they're all unused we can get rid of them, including the dummy version in drm_usb.c.
--- drivers/gpu/drm/drm_pci.c | 6 ------ drivers/gpu/drm/drm_platform.c | 6 ------ drivers/gpu/drm/drm_usb.c | 6 ------ include/drm/drmP.h | 1 - 4 files changed, 19 deletions(-)
drivers/gpu/drm/drm_pci.c +0 -6
@@ -137,11 +137,6 @@ static int drm_get_pci_domain(struct drm_device *dev)return pci_domain_nr (dev->pdev->bus); } -static int drm_pci_get_irq (struct drm_device *dev) -{ -return dev->pdev->irq; -} -static const char *drm_pci_get_name (struct drm_device *dev) {struct pci_driver *pdriver = dev->driver->kdriver.pci;
@@ -318,7 +313,6 @@ void drm_pci_agp_destroy(struct drm_device *dev) }static struct drm_bus drm_pci_bus = { - .get_irq = drm_pci_get_irq, .get_name = drm_pci_get_name, .set_busid = drm_pci_set_busid, .set_unique = drm_pci_set_unique,
drivers/gpu/drm/drm_platform.c +0 -6
@@ -68,11 +68,6 @@ err_free:return ret; } -static int drm_platform_get_irq (struct drm_device *dev) -{ -return platform_get_irq (dev->platformdev,0 ); -} -static const char *drm_platform_get_name (struct drm_device *dev) {return dev->platformdev->name;
@@ -123,7 +118,6 @@ err: }static struct drm_bus drm_platform_bus = { - .get_irq = drm_platform_get_irq, .get_name = drm_platform_get_name, .set_busid = drm_platform_set_busid, };
drivers/gpu/drm/drm_usb.c +0 -6
@@ -35,11 +35,6 @@ err_free: }EXPORT_SYMBOL (drm_get_usb_dev); -static int drm_usb_get_irq (struct drm_device *dev) -{ -return 0 ; -} -static const char *drm_usb_get_name (struct drm_device *dev) {return "USB" ;
@@ -52,7 +47,6 @@ static int drm_usb_set_busid(struct drm_device *dev, }static struct drm_bus drm_usb_bus = { - .get_irq = drm_usb_get_irq, .get_name = drm_usb_get_name, .set_busid = drm_usb_set_busid, };
include/drm/drmP.h +0 -1
@@ -737,7 +737,6 @@ struct drm_master {#define DRM_SCANOUTPOS_ACCURATE (1 << 2)struct drm_bus { -int (*get_irq)(struct drm_device *dev);const char *(*get_name)(struct drm_device *dev);int (*set_busid)(struct drm_device *dev,struct drm_master *master); int (*set_unique)(struct drm_device *dev, struct drm_master *master,
Signature · 1 line
1.8.4.3
PATCH 41/50 drm: inline drm_pci_set_unique
In reply to Daniel VetterThis is only used for drm versions 1.0, and kms drivers have never been there. So we can appropriately restrict this to legacy and hence pci devices and inline everything.
v2: Make the dummy function actually return something, caught by Wu Fengguang's 0-day tester.
--- drivers/gpu/drm/drm_ioctl.c | 10 +++++++--- drivers/gpu/drm/drm_pci.c | 14 ++++++++++---- include/drm/drmP.h | 5 +++-- 3 files changed, 20 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_ioctl.c +7 -3
@@ -93,7 +93,8 @@ drm_unset_busid(struct drm_device *dev,* Copies the bus id from userspace into drm_device::unique, and verifies that * it matches the device this DRM is attached to (EINVAL otherwise). Deprecated * in interface version 1.1 and will return EBUSY when setversion has requested -* version 1.1 or greater. +* version 1.1 or greater. Also note that KMS is all version 1.1 and later and +* UMS was only ever support on pci devices. */ int drm_setunique (struct drm_device *dev,void *data,struct drm_file *file_priv)
@@ -108,10 +109,13 @@ int drm_setunique(struct drm_device *dev, void *data,if (!u->unique_len || u->unique_len >1024 )return -EINVAL ; -if (!dev->driver->bus->set_unique) +if (drm_core_check_feature (dev,DRIVER_MODESET )) +return 0 ; + +if (WARN_ON (!dev->pdev))return -EINVAL ; - ret = dev->driver->bus->set_unique (dev, master, u); + ret =drm_pci_set_unique (dev, master, u);if (ret) goto err;
drivers/gpu/drm/drm_pci.c +10 -4
@@ -185,9 +185,9 @@ err:return ret; } -static int drm_pci_set_unique (struct drm_device *dev, -struct drm_master *master, -struct drm_unique *u) +int drm_pci_set_unique (struct drm_device *dev, +struct drm_master *master, +struct drm_unique *u) {int domain, bus, slot, func, ret;const char *bus_name;
@@ -315,7 +315,6 @@ void drm_pci_agp_destroy(struct drm_device *dev)static struct drm_bus drm_pci_bus = { .get_name = drm_pci_get_name, .set_busid = drm_pci_set_busid, - .set_unique = drm_pci_set_unique, };/**
@@ -482,6 +481,13 @@ int drm_irq_by_busid(struct drm_device *dev, void *data, {return -EINVAL ; } + +int drm_pci_set_unique (struct drm_device *dev, +struct drm_master *master, +struct drm_unique *u) +{ +return -EINVAL ; +}#endif EXPORT_SYMBOL (drm_pci_init);
include/drm/drmP.h +3 -2
@@ -739,8 +739,6 @@ struct drm_master {struct drm_bus {const char *(*get_name)(struct drm_device *dev);int (*set_busid)(struct drm_device *dev,struct drm_master *master); -int (*set_unique)(struct drm_device *dev,struct drm_master *master, -struct drm_unique *unique); };/**
@@ -1507,6 +1505,9 @@ extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, size_t align);extern void __drm_pci_free (struct drm_device *dev,drm_dma_handle_t * dmah);extern void drm_pci_free (struct drm_device *dev,drm_dma_handle_t * dmah); +extern int drm_pci_set_unique (struct drm_device *dev, +struct drm_master *master, +struct drm_unique *u);/* sysfs support (drm_sysfs.c) */ struct drm_sysfs_class ;
Signature · 1 line
1.8.4.3
PATCH 42/50 drm: rip out dev->devname
In reply to Daniel VetterThis was only ever used to pretty-print the irq driver name. And on kms systems due to set_version bonghits we never set up the prettier name, ever. Which make this a bit pointless.
Also, we can always dig out the driver-instance/irq relationship through other means, so this isn't that useful. So just rip it out to simplify the set_version/set_busid insanity a bit.
Also delete the temporary busname from drm_pci_set_busid, it's now unused.
v2: Rebase on top of the new host1x drm_bus for tegra.
--- drivers/gpu/drm/drm_ioctl.c | 3 --- drivers/gpu/drm/drm_irq.c | 8 +------- drivers/gpu/drm/drm_pci.c | 25 ------------------------- drivers/gpu/drm/drm_platform.c | 11 ----------- drivers/gpu/drm/drm_stub.c | 4 ---- drivers/gpu/drm/tegra/bus.c | 10 ---------- include/drm/drmP.h | 1 - 7 files changed, 1 insertion(+), 61 deletions(-)
drivers/gpu/drm/drm_ioctl.c +0 -3
@@ -72,9 +72,6 @@ static void drm_unset_busid(struct drm_device *dev, struct drm_master *master) { - kfree(dev->devname); - dev->devname =NULL ; - kfree(master->unique); master->unique =NULL ; master->unique_len =0 ;
drivers/gpu/drm/drm_irq.c +1 -7
@@ -246,7 +246,6 @@ int drm_irq_install(struct drm_device *dev, int irq) {int ret;unsigned long sh_flags =0 ; -char *irqname;if (!drm_core_check_feature (dev,DRIVER_HAVE_IRQ ))return -EINVAL ;
@@ -272,13 +271,8 @@ int drm_irq_install(struct drm_device *dev, int irq)if (drm_core_check_feature (dev,DRIVER_IRQ_SHARED )) sh_flags =IRQF_SHARED ; -if (dev->devname) - irqname = dev->devname; -else - irqname = dev->driver->name; - ret =request_irq (dev->irq, dev->driver->irq_handler, - sh_flags, irqname, dev); + sh_flags, dev->driver->name, dev);if (ret <0 ) { dev->irq_enabled = false;
drivers/gpu/drm/drm_pci.c +0 -25
@@ -146,7 +146,6 @@ static const char *drm_pci_get_name(struct drm_device *dev)static int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) {int len, ret; -struct pci_driver *pdriver = dev->driver->kdriver.pci; master->unique_len =40 ; master->unique_size = master->unique_len; master->unique =kmalloc (master->unique_size,GFP_KERNEL );
@@ -168,18 +167,6 @@ static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) }else master->unique_len = len; - dev->devname = -kmalloc (strlen (pdriver->name) + - master->unique_len +2 ,GFP_KERNEL ); - -if (dev->devname ==NULL ) { - ret = -ENOMEM ; - goto err; - } - -sprintf (dev->devname,"%s@%s" , pdriver->name, - master->unique); -return 0 ; err:return ret;
@@ -190,7 +177,6 @@ int drm_pci_set_unique(struct drm_device *dev, struct drm_unique *u) {int domain, bus, slot, func, ret; -const char *bus_name; master->unique_len = u->unique_len; master->unique_size = u->unique_len +1 ;
@@ -207,17 +193,6 @@ int drm_pci_set_unique(struct drm_device *dev, master->unique[master->unique_len] ='\0' ; - bus_name = dev->driver->bus->get_name (dev); - dev->devname =kmalloc (strlen (bus_name) + -strlen (master->unique) +2 ,GFP_KERNEL ); -if (!dev->devname) { - ret = -ENOMEM ; - goto err; - } - -sprintf (dev->devname,"%s@%s" , bus_name, - master->unique); -/* Return error if the busid submitted doesn't match the device's actual * busid. */
drivers/gpu/drm/drm_platform.c +0 -11
@@ -101,17 +101,6 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas goto err; } - dev->devname = -kmalloc (strlen (dev->platformdev->name) + - master->unique_len +2 ,GFP_KERNEL ); - -if (dev->devname ==NULL ) { - ret = -ENOMEM ; - goto err; - } - -sprintf (dev->devname,"%s@%s" , dev->platformdev->name, - master->unique);return 0 ; err:return ret;
drivers/gpu/drm/drm_stub.c +0 -4
@@ -183,9 +183,6 @@ static void drm_master_destroy(struct kref *kref) master->unique_len =0 ; } -kfree (dev->devname); - dev->devname =NULL ; -list_for_each_entry_safe (pt, next, &master->magicfree, head) {list_del (&pt->head);drm_ht_remove_item (&master->magiclist, &pt->hash_item);
@@ -497,7 +494,6 @@ void drm_dev_free(struct drm_device *dev)drm_ctxbitmap_cleanup (dev);drm_ht_remove (&dev->map_hash); -kfree (dev->devname);kfree (dev); }EXPORT_SYMBOL (drm_dev_free);
drivers/gpu/drm/tegra/bus.c +0 -10
@@ -12,9 +12,7 @@ static int drm_host1x_set_busid(struct drm_device *dev, struct drm_master *master) {const char *device =dev_name (dev->dev); -const char *driver = dev->driver->name;const char *bus = dev->dev->bus->name; -int length; master->unique_len =strlen (bus) +1 +strlen (device); master->unique_size = master->unique_len;
@@ -25,14 +23,6 @@ static int drm_host1x_set_busid(struct drm_device *dev,snprintf (master->unique, master->unique_len +1 ,"%s:%s" , bus, device); - length =strlen (driver) +1 + master->unique_len; - - dev->devname =kmalloc (length +1 ,GFP_KERNEL ); -if (!dev->devname) -return -ENOMEM ; - -snprintf (dev->devname, length +1 ,"%s@%s" , driver, master->unique); -return 0 ; }
include/drm/drmP.h +0 -1
@@ -1071,7 +1071,6 @@ struct drm_vblank_crtc {*/ struct drm_device {struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ -char *devname;/**< For /proc/interrupts */ int if_version;/**< Highest interface version set */ /** \name Locks */
Signature · 1 line
1.8.4.3
PATCH 43/50 drm: remove drm_bus->get_name
In reply to Daniel VetterThe only user is the info debugfs file, so we only need something human readable. Now for both pci and platform devices we've used the name of the underlying device driver, which matches the name of the drm driver in all cases. So we can just use that instead.
The exception is usb, which used a generic "USB". Not to harmful with just one usb driver, but better to use "udl", too.
With that converted we can rip out all the ->get_name implementations.
--- drivers/gpu/drm/drm_info.c | 6 ++---- drivers/gpu/drm/drm_pci.c | 7 ------- drivers/gpu/drm/drm_platform.c | 6 ------ drivers/gpu/drm/drm_usb.c | 6 ------ include/drm/drmP.h | 1 - 5 files changed, 2 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_info.c +2 -4
@@ -47,18 +47,16 @@ int drm_name_info(struct seq_file *m, void *data)struct drm_minor *minor = node->minor;struct drm_device *dev = minor->dev;struct drm_master *master = minor->master; -const char *bus_name;if (!master)return 0 ; - bus_name = dev->driver->bus->get_name (dev);if (master->unique) {seq_printf (m,"%s %s %s\n" , - bus_name, + dev->driver->name,dev_name (dev->dev), master->unique); }else {seq_printf (m,"%s %s\n" , - bus_name,dev_name (dev->dev)); + dev->driver->name,dev_name (dev->dev)); }return 0 ; }
drivers/gpu/drm/drm_pci.c +0 -7
@@ -137,12 +137,6 @@ static int drm_get_pci_domain(struct drm_device *dev)return pci_domain_nr (dev->pdev->bus); } -static const char *drm_pci_get_name (struct drm_device *dev) -{ -struct pci_driver *pdriver = dev->driver->kdriver.pci; -return pdriver->name; -} -static int drm_pci_set_busid (struct drm_device *dev,struct drm_master *master) {int len, ret;
@@ -288,7 +282,6 @@ void drm_pci_agp_destroy(struct drm_device *dev) }static struct drm_bus drm_pci_bus = { - .get_name = drm_pci_get_name, .set_busid = drm_pci_set_busid, };
drivers/gpu/drm/drm_platform.c +0 -6
@@ -68,11 +68,6 @@ err_free:return ret; } -static const char *drm_platform_get_name (struct drm_device *dev) -{ -return dev->platformdev->name; -} -static int drm_platform_set_busid (struct drm_device *dev,struct drm_master *master) {int len, ret, id;
@@ -107,7 +102,6 @@ err: }static struct drm_bus drm_platform_bus = { - .get_name = drm_platform_get_name, .set_busid = drm_platform_set_busid, };
drivers/gpu/drm/drm_usb.c +0 -6
@@ -35,11 +35,6 @@ err_free: }EXPORT_SYMBOL (drm_get_usb_dev); -static const char *drm_usb_get_name (struct drm_device *dev) -{ -return "USB" ; -} -static int drm_usb_set_busid (struct drm_device *dev,struct drm_master *master) {
@@ -47,7 +42,6 @@ static int drm_usb_set_busid(struct drm_device *dev, }static struct drm_bus drm_usb_bus = { - .get_name = drm_usb_get_name, .set_busid = drm_usb_set_busid, };
include/drm/drmP.h +0 -1
@@ -737,7 +737,6 @@ struct drm_master {#define DRM_SCANOUTPOS_ACCURATE (1 << 2)struct drm_bus { -const char *(*get_name)(struct drm_device *dev);int (*set_busid)(struct drm_device *dev,struct drm_master *master); };
Signature · 1 line
1.8.4.3
PATCH 44/50 drm: Remove dev->kdriver
In reply to Daniel VetterWith the last patch to ditch the ->get_name callbacks the last user is now gone.
--- drivers/gpu/drm/drm_pci.c | 1 - drivers/gpu/drm/drm_platform.c | 1 - drivers/gpu/drm/drm_usb.c | 1 - include/drm/drmP.h | 5 ----- 4 files changed, 8 deletions(-)
drivers/gpu/drm/drm_pci.c +0 -1
@@ -365,7 +365,6 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)DRM_DEBUG ("\n" ); - driver->kdriver.pci = pdriver; driver->bus = &drm_pci_bus;if (driver->driver_features &DRIVER_MODESET )
drivers/gpu/drm/drm_platform.c +0 -1
@@ -121,7 +121,6 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platfor {DRM_DEBUG ("\n" ); - driver->kdriver.platform_device = platform_device; driver->bus = &drm_platform_bus;return drm_get_platform_dev (platform_device, driver); }
drivers/gpu/drm/drm_usb.c +0 -1
@@ -50,7 +50,6 @@ int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)int res;DRM_DEBUG ("\n" ); - driver->kdriver.usb = udriver; driver->bus = &drm_usb_bus; res =usb_register (udriver);
include/drm/drmP.h +0 -5
@@ -972,11 +972,6 @@ struct drm_driver {const struct drm_ioctl_desc *ioctls;int num_ioctls;const struct file_operations *fops; -union { -struct pci_driver *pci; -struct platform_device *platform_device; -struct usb_driver *usb; - } kdriver;struct drm_bus *bus;/* List of devices hanging off this driver with stealth attach. */
Signature · 1 line
1.8.4.3
PATCH 45/50 drm/<drivers>: don't set driver->dev_priv_size to 0
In reply to Daniel VetterEspecially not on modesetting drivers - this is used to size the driver private structure for legacy drm buffers.
--- drivers/gpu/drm/ast/ast_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/radeon/radeon_drv.c | 1 - 3 files changed, 3 deletions(-)
drivers/gpu/drm/ast/ast_drv.c +0 -1
@@ -198,7 +198,6 @@ static const struct file_operations ast_fops = {static struct drm_driver driver = { .driver_features =DRIVER_MODESET |DRIVER_GEM , - .dev_priv_size =0 , .load = ast_driver_load, .unload = ast_driver_unload,
drivers/gpu/drm/qxl/qxl_drv.c +0 -1
@@ -214,7 +214,6 @@ static struct pci_driver qxl_pci_driver = {static struct drm_driver qxl_driver = { .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED , - .dev_priv_size =0 , .load = qxl_driver_load, .unload = qxl_driver_unload,
drivers/gpu/drm/radeon/radeon_drv.c +0 -1
@@ -522,7 +522,6 @@ static struct drm_driver kms_driver = {DRIVER_USE_AGP |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED |DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER, - .dev_priv_size = 0, .load = radeon_driver_load_kms, .open = radeon_driver_open_kms, .preclose = radeon_driver_preclose_kms,
Signature · 1 line
1.8.4.3
Re: [PATCH 45/50] drm/<drivers>: don't set driver->dev_priv_size to 0
Quoted 4 lines · Daniel Vetter
Especially not on modesetting drivers - this is used to size the driver private structure for legacy drm buffers.
Signed-off-by Daniel Vetter <[email protected]>
I managed to write the same patch one month later, so:
Signature · 1 line
Damien
Quoted 49 lines
--- drivers/gpu/drm/ast/ast_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/radeon/radeon_drv.c | 1 - 3 files changed, 3 deletions(-)drivers/gpu/drm/ast/ast_drv.c +0
-1@@ -198,7 +198,6 @@ static const struct file_operations ast_fops = {static struct drm_driver driver = { .driver_features =DRIVER_MODESET |DRIVER_GEM , - .dev_priv_size =0 , .load = ast_driver_load, .unload = ast_driver_unload,drivers/gpu/drm/qxl/qxl_drv.c +0
-1@@ -214,7 +214,6 @@ static struct pci_driver qxl_pci_driver = {static struct drm_driver qxl_driver = { .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED , - .dev_priv_size =0 , .load = qxl_driver_load, .unload = qxl_driver_unload,drivers/gpu/drm/radeon/radeon_drv.c +0
-1@@ -522,7 +522,6 @@ static struct drm_driver kms_driver = {DRIVER_USE_AGP |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED |DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER, - .dev_priv_size = 0, .load = radeon_driver_load_kms, .open = radeon_driver_open_kms, .preclose = radeon_driver_preclose_kms,Signature · 6 lines
1.8.4.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 46/50 drm: store the gem vma offset manager in a typed pointer
In reply to Daniel VetterThis was hidden in a generic void * dev->mm_private. But only ever used for gem. But thanks to this fake generic pretension no one noticed that Rob's drm drivers are now all broken.
So just give the offset manager a type pointer and fix up msm, omapdrm and tilcdc.
v2: Fixup compile fail.
--- drivers/gpu/drm/drm_gem.c | 27 ++++++++++++--------------- drivers/gpu/drm/gma500/psb_intel_drv.h | 5 ----- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_debugfs.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- include/drm/drmP.h | 14 ++++++-------- 6 files changed, 21 insertions(+), 31 deletions(-)
drivers/gpu/drm/drm_gem.c +12 -15
@@ -91,19 +91,19 @@int drm_gem_init (struct drm_device *dev) { -struct drm_gem_mm *mm; +struct drm_vma_offset_manager *vma_offset_manager;mutex_init (&dev->object_name_lock);idr_init (&dev->object_name_idr); - mm =kzalloc (sizeof (struct drm_gem_mm ),GFP_KERNEL ); -if (!mm) { + vma_offset_manager =kzalloc (sizeof (*vma_offset_manager),GFP_KERNEL ); +if (!vma_offset_manager) {DRM_ERROR ("out of memory\n" );return -ENOMEM ; } - dev->mm_private = mm; -drm_vma_offset_manager_init (&mm->vma_manager, + dev->vma_offset_manager = vma_offset_manager; +drm_vma_offset_manager_init (vma_offset_manager,DRM_FILE_PAGE_OFFSET_START ,DRM_FILE_PAGE_OFFSET_SIZE );
@@ -113,11 +113,10 @@ drm_gem_init(struct drm_device *dev)void drm_gem_destroy (struct drm_device *dev) { -struct drm_gem_mm *mm = dev->mm_private; -drm_vma_offset_manager_destroy (&mm->vma_manager); -kfree (mm); - dev->mm_private =NULL ; +drm_vma_offset_manager_destroy (dev->vma_offset_manager); +kfree (dev->vma_offset_manager); + dev->vma_offset_manager =NULL ; }/**
@@ -374,9 +373,8 @@ void drm_gem_free_mmap_offset(struct drm_gem_object *obj) {struct drm_device *dev = obj->dev; -struct drm_gem_mm *mm = dev->mm_private; -drm_vma_offset_remove (&mm->vma_manager, &obj->vma_node); +drm_vma_offset_remove (dev->vma_offset_manager, &obj->vma_node); }EXPORT_SYMBOL (drm_gem_free_mmap_offset);
@@ -398,9 +396,8 @@ int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size) {struct drm_device *dev = obj->dev; -struct drm_gem_mm *mm = dev->mm_private; -return drm_vma_offset_add (&mm->vma_manager, &obj->vma_node, +return drm_vma_offset_add (dev->vma_offset_manager, &obj->vma_node, size /PAGE_SIZE ); }EXPORT_SYMBOL (drm_gem_create_mmap_offset_size);
@@ -833,7 +830,6 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) {struct drm_file *priv = filp->private_data;struct drm_device *dev = priv->minor->dev; -struct drm_gem_mm *mm = dev->mm_private;struct drm_gem_object *obj;struct drm_vma_offset_node *node;int ret =0 ;
@@ -843,7 +839,8 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)mutex_lock (&dev->struct_mutex); - node =drm_vma_offset_exact_lookup (&mm->vma_manager, vma->vm_pgoff, + node =drm_vma_offset_exact_lookup (dev->vma_offset_manager, + vma->vm_pgoff,vma_pages (vma));if (!node) {mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/gma500/psb_intel_drv.h +0 -5
@@ -250,11 +250,6 @@ extern void psb_intel_sdvo_set_hotplug(struct drm_connector *connector,extern int intelfb_probe (struct drm_device *dev);extern int intelfb_remove (struct drm_device *dev,struct drm_framebuffer *fb); -extern struct drm_framebuffer *psb_intel_framebuffer_create (struct drm_device - *dev,struct -drm_mode_fb_cmd - *mode_cmd, -void *mm_private);extern bool psb_intel_lvds_mode_fixup (struct drm_encoder *encoder,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -415,7 +415,7 @@ static int msm_gem_show(struct drm_device *dev, struct seq_file *m)static int msm_mm_show (struct drm_device *dev,struct seq_file *m) { -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static int msm_fb_show (struct drm_device *dev,struct seq_file *m)
drivers/gpu/drm/omapdrm/omap_debugfs.c +1 -1
@@ -48,7 +48,7 @@ static int mm_show(struct seq_file *m, void *arg) {struct drm_info_node *node = (struct drm_info_node *) m->private;struct drm_device *dev = node->minor->dev; -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static int fb_show (struct seq_file *m,void *arg)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -444,7 +444,7 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg) {struct drm_info_node *node = (struct drm_info_node *) m->private;struct drm_device *dev = node->minor->dev; -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static struct drm_info_list tilcdc_debugfs_list[] = {
include/drm/drmP.h +6 -8
@@ -601,13 +601,6 @@ struct drm_ati_pcigart_info { };/** -* GEM specific mm private for tracking GEM objects -*/ -struct drm_gem_mm { -struct drm_vma_offset_manager vma_manager; -}; - -/** * This structure defines the drm_mm memory object, which will be used by the * DRM for its buffer objects. */
@@ -972,6 +965,11 @@ struct drm_driver {const struct drm_ioctl_desc *ioctls;int num_ioctls;const struct file_operations *fops; +union { +struct pci_driver *pci; +struct platform_device *platform_device; +struct usb_driver *usb; + } kdriver;struct drm_bus *bus;/* List of devices hanging off this driver with stealth attach. */
@@ -1156,7 +1154,6 @@ struct drm_device {struct drm_sg_mem *sg;/**< Scatter gather memory */ unsigned int num_crtcs;/**< Number of CRTCs on this device */ void *dev_private;/**< device private data */ -void *mm_private;struct address_space *dev_mapping;struct drm_sigdata sigdata;/**< For block_all_signals */ sigset_t sigmask;
@@ -1174,6 +1171,7 @@ struct drm_device {/*@{ */ struct mutex object_name_lock;struct idr object_name_idr; +struct drm_vma_offset_manager *vma_offset_manager;/*@} */ int switch_power_state;
Signature · 1 line
1.8.4.3
Re: [PATCH 46/50] drm: store the gem vma offset manager in a typed pointer
Hi Daniel
Quoted 110 lines · Daniel Vetter
This was hidden in a generic void *
dev->mm_private. But only ever used for gem. But thanks to this fake generic pretension no one noticed that Rob's drm drivers are now all broken.So just give the offset manager a type pointer and fix up msm, omapdrm and tilcdc.
v2: Fixup compile fail.
Cc David Herrmann <[email protected]>Cc Rob Clark <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_gem.c | 27 ++++++++++++--------------- drivers/gpu/drm/gma500/psb_intel_drv.h | 5 ----- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_debugfs.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- include/drm/drmP.h | 14 ++++++-------- 6 files changed, 21 insertions(+), 31 deletions(-)drivers/gpu/drm/drm_gem.c +12
-15@@ -91,19 +91,19 @@int drm_gem_init (struct drm_device *dev) { -struct drm_gem_mm *mm; +struct drm_vma_offset_manager *vma_offset_manager;mutex_init (&dev->object_name_lock);idr_init (&dev->object_name_idr); - mm =kzalloc (sizeof (struct drm_gem_mm ),GFP_KERNEL ); -if (!mm) { + vma_offset_manager =kzalloc (sizeof (*vma_offset_manager),GFP_KERNEL ); +if (!vma_offset_manager) {DRM_ERROR ("out of memory\n" );return -ENOMEM ; } - dev->mm_private = mm; -drm_vma_offset_manager_init (&mm->vma_manager, + dev->vma_offset_manager = vma_offset_manager; +drm_vma_offset_manager_init (vma_offset_manager,DRM_FILE_PAGE_OFFSET_START ,DRM_FILE_PAGE_OFFSET_SIZE );@@ -113,11 +113,10 @@ drm_gem_init(struct drm_device *dev)void drm_gem_destroy (struct drm_device *dev) { -struct drm_gem_mm *mm = dev->mm_private; -drm_vma_offset_manager_destroy (&mm->vma_manager); -kfree (mm); - dev->mm_private =NULL ; +drm_vma_offset_manager_destroy (dev->vma_offset_manager); +kfree (dev->vma_offset_manager); + dev->vma_offset_manager =NULL ; }/** @@ -374,9 +373,8 @@ void drm_gem_free_mmap_offset(struct drm_gem_object *obj) {struct drm_device *dev = obj->dev; -struct drm_gem_mm *mm = dev->mm_private; -drm_vma_offset_remove (&mm->vma_manager, &obj->vma_node); +drm_vma_offset_remove (dev->vma_offset_manager, &obj->vma_node); }EXPORT_SYMBOL (drm_gem_free_mmap_offset);@@ -398,9 +396,8 @@ int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size) {struct drm_device *dev = obj->dev; -struct drm_gem_mm *mm = dev->mm_private; -return drm_vma_offset_add (&mm->vma_manager, &obj->vma_node, +return drm_vma_offset_add (dev->vma_offset_manager, &obj->vma_node, size /PAGE_SIZE ); }EXPORT_SYMBOL (drm_gem_create_mmap_offset_size);@@ -833,7 +830,6 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) {struct drm_file *priv = filp->private_data;struct drm_device *dev = priv->minor->dev; -struct drm_gem_mm *mm = dev->mm_private;struct drm_gem_object *obj;struct drm_vma_offset_node *node;int ret =0 ;@@ -843,7 +839,8 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)mutex_lock (&dev->struct_mutex); - node =drm_vma_offset_exact_lookup (&mm->vma_manager, vma->vm_pgoff, + node =drm_vma_offset_exact_lookup (dev->vma_offset_manager, + vma->vm_pgoff,vma_pages (vma));if (!node) {mutex_unlock (&dev->struct_mutex);drivers/gpu/drm/gma500/psb_intel_drv.h +0
-0
drivers/gpu/drm/gma500/psb_intel_drv.h extern void psb_intel_sdvo_set_hotplug(struct drm_connector *connector, · line 257
Quoted 8 lines
drivers/gpu/drm/gma500/psb_intel_drv.h +0
-5@@ -250,11 +250,6 @@ extern void psb_intel_sdvo_set_hotplug(struct drm_connector *connector,extern int intelfb_probe (struct drm_device *dev);extern int intelfb_remove (struct drm_device *dev,struct drm_framebuffer *fb); -extern struct drm_framebuffer *psb_intel_framebuffer_create (struct drm_device - *dev,struct -drm_mode_fb_cmd - *mode_cmd, -void *mm_private);
Where does that come from?
Quoted 61 lines
drivers/gpu/drm/gma500/psb_intel_drv.h +0
-0extern bool psb_intel_lvds_mode_fixup (struct drm_encoder *encoder,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);drivers/gpu/drm/msm/msm_drv.c +1
-1@@ -415,7 +415,7 @@ static int msm_gem_show(struct drm_device *dev, struct seq_file *m)static int msm_mm_show (struct drm_device *dev,struct seq_file *m) { -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static int msm_fb_show (struct drm_device *dev,struct seq_file *m)drivers/gpu/drm/omapdrm/omap_debugfs.c +1
-1@@ -48,7 +48,7 @@ static int mm_show(struct seq_file *m, void *arg) {struct drm_info_node *node = (struct drm_info_node *) m->private;struct drm_device *dev = node->minor->dev; -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static int fb_show (struct seq_file *m,void *arg)drivers/gpu/drm/tilcdc/tilcdc_drv.c +1
-1@@ -444,7 +444,7 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg) {struct drm_info_node *node = (struct drm_info_node *) m->private;struct drm_device *dev = node->minor->dev; -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static struct drm_info_list tilcdc_debugfs_list[] = {include/drm/drmP.h +0
-7@@ -601,13 +601,6 @@ struct drm_ati_pcigart_info { };/** -* GEM specific mm private for tracking GEM objects -*/ -struct drm_gem_mm { -struct drm_vma_offset_manager vma_manager; -}; - -/** * This structure defines the drm_mm memory object, which will be used by the * DRM for its buffer objects. */
include/drm/drmP.h struct drm_driver { · line 972
Quoted 8 lines
include/drm/drmP.h +5
-0@@ -972,6 +965,11 @@ struct drm_driver {const struct drm_ioctl_desc *ioctls;int num_ioctls;const struct file_operations *fops; +union { +struct pci_driver *pci; +struct platform_device *platform_device; +struct usb_driver *usb; + } kdriver;
Ugh? I think you got some rebase issues in the series. Otherwise, this patch looks good.
Thanks
David
Quoted 22 lines
include/drm/drmP.h +1
-2struct drm_bus *bus;/* List of devices hanging off this driver with stealth attach. */ @@ -1156,7 +1154,6 @@ struct drm_device {struct drm_sg_mem *sg;/**< Scatter gather memory */ unsigned int num_crtcs;/**< Number of CRTCs on this device */ void *dev_private;/**< device private data */ -void *mm_private;struct address_space *dev_mapping;struct drm_sigdata sigdata;/**< For block_all_signals */ sigset_t sigmask;@@ -1174,6 +1171,7 @@ struct drm_device {/*@{ */ struct mutex object_name_lock;struct idr object_name_idr; +struct drm_vma_offset_manager *vma_offset_manager;/*@} */ int switch_power_state; --1.8.4.3
PATCH 1/2 drm: store the gem vma offset manager in a typed pointer
This was hidden in a generic void * dev->mm_private. But only ever used for gem. But thanks to this fake generic pretension no one noticed that Rob's drm drivers are now all broken.
So just give the offset manager a type pointer and fix up msm, omapdrm and tilcdc.
v2: Fixup compile fail.
v3: Fixup rebase fail that David spotted.
--- drivers/gpu/drm/drm_gem.c | 27 ++++++++++++--------------- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/omapdrm/omap_debugfs.c | 2 +- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +- include/drm/drmP.h | 9 +-------- 5 files changed, 16 insertions(+), 26 deletions(-)
drivers/gpu/drm/drm_gem.c +12 -15
@@ -91,19 +91,19 @@int drm_gem_init (struct drm_device *dev) { -struct drm_gem_mm *mm; +struct drm_vma_offset_manager *vma_offset_manager;mutex_init (&dev->object_name_lock);idr_init (&dev->object_name_idr); - mm =kzalloc (sizeof (struct drm_gem_mm ),GFP_KERNEL ); -if (!mm) { + vma_offset_manager =kzalloc (sizeof (*vma_offset_manager),GFP_KERNEL ); +if (!vma_offset_manager) {DRM_ERROR ("out of memory\n" );return -ENOMEM ; } - dev->mm_private = mm; -drm_vma_offset_manager_init (&mm->vma_manager, + dev->vma_offset_manager = vma_offset_manager; +drm_vma_offset_manager_init (vma_offset_manager,DRM_FILE_PAGE_OFFSET_START ,DRM_FILE_PAGE_OFFSET_SIZE );
@@ -113,11 +113,10 @@ drm_gem_init(struct drm_device *dev)void drm_gem_destroy (struct drm_device *dev) { -struct drm_gem_mm *mm = dev->mm_private; -drm_vma_offset_manager_destroy (&mm->vma_manager); -kfree (mm); - dev->mm_private =NULL ; +drm_vma_offset_manager_destroy (dev->vma_offset_manager); +kfree (dev->vma_offset_manager); + dev->vma_offset_manager =NULL ; }/**
@@ -374,9 +373,8 @@ void drm_gem_free_mmap_offset(struct drm_gem_object *obj) {struct drm_device *dev = obj->dev; -struct drm_gem_mm *mm = dev->mm_private; -drm_vma_offset_remove (&mm->vma_manager, &obj->vma_node); +drm_vma_offset_remove (dev->vma_offset_manager, &obj->vma_node); }EXPORT_SYMBOL (drm_gem_free_mmap_offset);
@@ -398,9 +396,8 @@ int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size) {struct drm_device *dev = obj->dev; -struct drm_gem_mm *mm = dev->mm_private; -return drm_vma_offset_add (&mm->vma_manager, &obj->vma_node, +return drm_vma_offset_add (dev->vma_offset_manager, &obj->vma_node, size /PAGE_SIZE ); }EXPORT_SYMBOL (drm_gem_create_mmap_offset_size);
@@ -833,7 +830,6 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) {struct drm_file *priv = filp->private_data;struct drm_device *dev = priv->minor->dev; -struct drm_gem_mm *mm = dev->mm_private;struct drm_gem_object *obj;struct drm_vma_offset_node *node;int ret =0 ;
@@ -843,7 +839,8 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)mutex_lock (&dev->struct_mutex); - node =drm_vma_offset_exact_lookup (&mm->vma_manager, vma->vm_pgoff, + node =drm_vma_offset_exact_lookup (dev->vma_offset_manager, + vma->vm_pgoff,vma_pages (vma));if (!node) {mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/msm/msm_drv.c +1 -1
@@ -415,7 +415,7 @@ static int msm_gem_show(struct drm_device *dev, struct seq_file *m)static int msm_mm_show (struct drm_device *dev,struct seq_file *m) { -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static int msm_fb_show (struct drm_device *dev,struct seq_file *m)
drivers/gpu/drm/omapdrm/omap_debugfs.c +1 -1
@@ -48,7 +48,7 @@ static int mm_show(struct seq_file *m, void *arg) {struct drm_info_node *node = (struct drm_info_node *) m->private;struct drm_device *dev = node->minor->dev; -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static int fb_show (struct seq_file *m,void *arg)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +1 -1
@@ -444,7 +444,7 @@ static int tilcdc_mm_show(struct seq_file *m, void *arg) {struct drm_info_node *node = (struct drm_info_node *) m->private;struct drm_device *dev = node->minor->dev; -return drm_mm_dump_table (m, dev->mm_private); +return drm_mm_dump_table (m, &dev->vma_offset_manager->vm_addr_space_mm); }static struct drm_info_list tilcdc_debugfs_list[] = {
include/drm/drmP.h +1 -8
@@ -601,13 +601,6 @@ struct drm_ati_pcigart_info { };/** -* GEM specific mm private for tracking GEM objects -*/ -struct drm_gem_mm { -struct drm_vma_offset_manager vma_manager; -}; - -/** * This structure defines the drm_mm memory object, which will be used by the * DRM for its buffer objects. */
@@ -1156,7 +1149,6 @@ struct drm_device {struct drm_sg_mem *sg;/**< Scatter gather memory */ unsigned int num_crtcs;/**< Number of CRTCs on this device */ void *dev_private;/**< device private data */ -void *mm_private;struct address_space *dev_mapping;struct drm_sigdata sigdata;/**< For block_all_signals */ sigset_t sigmask;
@@ -1174,6 +1166,7 @@ struct drm_device {/*@{ */ struct mutex object_name_lock;struct idr object_name_idr; +struct drm_vma_offset_manager *vma_offset_manager;/*@} */ int switch_power_state;
Signature · 1 line
1.8.4.3
PATCH 2/2 drm/gma500: Remove unused function declaration
--- drivers/gpu/drm/gma500/psb_intel_drv.h | 5 ----- 1 file changed, 5 deletions(-)
drivers/gpu/drm/gma500/psb_intel_drv.h +0 -5
@@ -250,11 +250,6 @@ extern void psb_intel_sdvo_set_hotplug(struct drm_connector *connector,extern int intelfb_probe (struct drm_device *dev);extern int intelfb_remove (struct drm_device *dev,struct drm_framebuffer *fb); -extern struct drm_framebuffer *psb_intel_framebuffer_create (struct drm_device - *dev,struct -drm_mode_fb_cmd - *mode_cmd, -void *mm_private);extern bool psb_intel_lvds_mode_fixup (struct drm_encoder *encoder,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
Signature · 1 line
1.8.4.3
Re: [PATCH 2/2] drm/gma500: Remove unused function declaration
Quoted 23 lines · Daniel Vetter
Cc Patrik Jakobsson <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/gma500/psb_intel_drv.h | 5 ----- 1 file changed, 5 deletions(-)drivers/gpu/drm/gma500/psb_intel_drv.h +0
-6@@ -250,11 +250,6 @@ extern void psb_intel_sdvo_set_hotplug(struct drm_connector *connector,extern int intelfb_probe (struct drm_device *dev);extern int intelfb_remove (struct drm_device *dev,struct drm_framebuffer *fb); -extern struct drm_framebuffer *psb_intel_framebuffer_create (struct drm_device - *dev,struct -drm_mode_fb_cmd - *mode_cmd, -void *mm_private);extern bool psb_intel_lvds_mode_fixup (struct drm_encoder *encoder,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode); --
Quoted 2 lines
1.8.4.3
Dave Airlie
maintainerRe: [PATCH 1/2] drm: store the gem vma offset manager in a typed pointer
In reply to Daniel VetterQuoted 3 lines · Daniel Vetter
This was hidden in a generic void *
dev->mm_private. But only ever used for gem. But thanks to this fake generic pretension no one noticed that Rob's drm drivers are now all broken.
Should this go to fixes?
Or is the problem only introduced in this series?
Dave.
Re: [PATCH 1/2] drm: store the gem vma offset manager in a typed pointer
Quoted 6 lines · Dave Airlie
Quoted 3 lines · Daniel Vetter
This was hidden in a generic void *
dev->mm_private. But only ever used for gem. But thanks to this fake generic pretension no one noticed that Rob's drm drivers are now all broken.Should this go to fixes?
I think should go in fixes probably.. wasn't it broken since vma offset mgr? I guess I don't test debugfs enough.
oh, and:
(sorry, overlooked this thread earlier, even though I think Daniel mentioned the issue on irc)
Quoted 7 lines
Or is the problem only introduced in this series?
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 47/50 drm: rip out dev->ioctl_count tracking
In reply to Daniel VetterNow dev->ioctl_count tries to prevent the device from disappearing if it's still in use. And if we'd actually need this code it would be hopelessly racy and broken.
But luckily the vfs already takes care of this. So we can just rip it out.
--- drivers/gpu/drm/drm_drv.c | 2 -- drivers/gpu/drm/drm_fops.c | 8 +------- include/drm/drmP.h | 1 - 3 files changed, 1 insertion(+), 10 deletions(-)
drivers/gpu/drm/drm_drv.c +0 -2
@@ -315,7 +315,6 @@ long drm_ioctl(struct file *filp,if (drm_device_is_unplugged (dev))return -ENODEV ; -atomic_inc (&dev->ioctl_count); ++file_priv->ioctl_count; if ((nr >= DRM_CORE_IOCTL_COUNT) &&
@@ -410,7 +409,6 @@ long drm_ioctl(struct file *filp,if (kdata != stack_kdata)kfree (kdata); -atomic_dec (&dev->ioctl_count);if (retcode)DRM_DEBUG ("ret = %d\n" , retcode);return retcode;
drivers/gpu/drm/drm_fops.c +1 -7
@@ -392,7 +392,6 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)if (drm_core_check_feature (dev,DRIVER_MODESET ))return ; -atomic_set (&dev->ioctl_count,0 );atomic_set (&dev->vma_count,0 ); dev->sigdata.lock =NULL ;
@@ -578,12 +577,7 @@ int drm_release(struct inode *inode, struct file *filp)*/ if (!--dev->open_count) { -if (atomic_read (&dev->ioctl_count)) { -DRM_ERROR ("Device busy: %d\n" , -atomic_read (&dev->ioctl_count)); - retcode = -EBUSY ; - }else - retcode =drm_lastclose (dev); + retcode =drm_lastclose (dev);if (drm_device_is_unplugged (dev))drm_put_dev (dev); }
include/drm/drmP.h +0 -1
@@ -1073,7 +1073,6 @@ struct drm_device {/** \name Usage Counters */ /*@{ */ int open_count;/**< Outstanding files open, protected by drm_global_lock. */ -atomic_t ioctl_count;/**< Outstanding IOCTLs pending */ atomic_t vma_count;/**< Outstanding vma areas open */ spinlock_t buf_lock;/**< For drm_device::buf_use and a few other things. */ int buf_use;/**< Buffers in use -- cannot alloc */
Signature · 1 line
1.8.4.3
PATCH 48/50 drm: Kill file_priv->ioctl_count tracking
In reply to Daniel VetterIt's racy, and it's only used in debugfs. There are simpler ways to know whether something is going on (like looking at dmesg with full debugging enabled). And they're all much more useful.
So let's just rip this out.
--- drivers/gpu/drm/drm_drv.c | 2 -- drivers/gpu/drm/drm_fops.c | 1 - drivers/gpu/drm/drm_info.c | 6 +++--- include/drm/drmP.h | 1 - 4 files changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_drv.c +0 -2
@@ -315,8 +315,6 @@ long drm_ioctl(struct file *filp,if (drm_device_is_unplugged (dev))return -ENODEV ; - ++file_priv->ioctl_count; -if ((nr >=DRM_CORE_IOCTL_COUNT ) && ((nr <DRM_COMMAND_BASE ) || (nr >=DRM_COMMAND_END ))) goto err_i1;
drivers/gpu/drm/drm_fops.c +0 -1
@@ -232,7 +232,6 @@ static int drm_open_helper(struct inode *inode, struct file *filp, goto out_put_pid; } - priv->ioctl_count =0 ;/* for compatibility root is always authenticated */ priv->always_authenticated =capable (CAP_SYS_ADMIN ); priv->authenticated = priv->always_authenticated;
drivers/gpu/drm/drm_info.c +3 -3
@@ -184,14 +184,14 @@ int drm_clients_info(struct seq_file *m, void *data)struct drm_file *priv;mutex_lock (&dev->struct_mutex); -seq_printf (m,"a dev pid uid magic ioctls\n\n" ); +seq_printf (m,"a dev pid uid magic\n\n" );list_for_each_entry (priv, &dev->filelist, lhead) { -seq_printf (m,"%c %3d %5d %5d %10u %10lu\n" , +seq_printf (m,"%c %3d %5d %5d %10u\n" , priv->authenticated ?'y' :'n' , priv->minor->index,pid_vnr (priv->pid),from_kuid_munged (seq_user_ns (m), priv->uid), - priv->magic, priv->ioctl_count); + priv->magic); }mutex_unlock (&dev->struct_mutex);return 0 ;
include/drm/drmP.h +0 -1
@@ -416,7 +416,6 @@ struct drm_file {struct pid *pid;kuid_t uid;drm_magic_t magic; -unsigned long ioctl_count;struct list_head lhead;struct drm_minor *minor;unsigned long lock_count;
Signature · 1 line
1.8.4.3
PATCH 49/50 drm: remove dev->vma_count
In reply to Daniel VetterThis is just used for a debugfs file, and we can easily reconstruct this number by just walking the list twice. Which isn't really bad for a debugfs file anyway.
So let's rip this out.
There's the other issue that the dev->vmalist itself is a bit useless, since that can be reconstructed with all the memory mapping information from proc. But remove that is a different topic entirely.
--- drivers/gpu/drm/drm_fops.c | 2 -- drivers/gpu/drm/drm_info.c | 10 +++++++--- drivers/gpu/drm/drm_vm.c | 3 --- include/drm/drmP.h | 1 - 4 files changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_fops.c +0 -2
@@ -391,8 +391,6 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)if (drm_core_check_feature (dev,DRIVER_MODESET ))return ; -atomic_set (&dev->vma_count,0 ); - dev->sigdata.lock =NULL ; dev->context_flag =0 ;
drivers/gpu/drm/drm_info.c +7 -3
@@ -232,14 +232,18 @@ int drm_vma_info(struct seq_file *m, void *data)struct drm_device *dev = node->minor->dev;struct drm_vma_entry *pt;struct vm_area_struct *vma; +unsigned long vma_count =0 ;#if defined(__i386__)unsigned int pgprot;#endif mutex_lock (&dev->struct_mutex); -seq_printf (m,"vma use count: %d, high_memory = %pK, 0x%pK\n" , -atomic_read (&dev->vma_count), - high_memory, (void *)(unsigned long )virt_to_phys (high_memory)); +list_for_each_entry (pt, &dev->vmalist, head) + vma_count++; + +seq_printf (m,"vma use count: %lu, high_memory = %pK, 0x%pK\n" , + vma_count, high_memory, + (void *)(unsigned long )virt_to_phys (high_memory));list_for_each_entry (pt, &dev->vmalist, head) { vma = pt->vma;
drivers/gpu/drm/drm_vm.c +0 -3
@@ -220,7 +220,6 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)DRM_DEBUG ("0x%08lx,0x%08lx\n" , vma->vm_start, vma->vm_end - vma->vm_start); -atomic_dec (&dev->vma_count); map = vma->vm_private_data;
@@ -405,7 +404,6 @@ void drm_vm_open_locked(struct drm_device *dev,DRM_DEBUG ("0x%08lx,0x%08lx\n" , vma->vm_start, vma->vm_end - vma->vm_start); -atomic_inc (&dev->vma_count); vma_entry =kmalloc (sizeof (*vma_entry),GFP_KERNEL );if (vma_entry) {
@@ -433,7 +431,6 @@ void drm_vm_close_locked(struct drm_device *dev,DRM_DEBUG ("0x%08lx,0x%08lx\n" , vma->vm_start, vma->vm_end - vma->vm_start); -atomic_dec (&dev->vma_count);list_for_each_entry_safe (pt, temp, &dev->vmalist, head) {if (pt->vma == vma) {
include/drm/drmP.h +0 -1
@@ -1072,7 +1072,6 @@ struct drm_device {/** \name Usage Counters */ /*@{ */ int open_count;/**< Outstanding files open, protected by drm_global_lock. */ -atomic_t vma_count;/**< Outstanding vma areas open */ spinlock_t buf_lock;/**< For drm_device::buf_use and a few other things. */ int buf_use;/**< Buffers in use -- cannot alloc */ atomic_t buf_alloc;/**< Buffer allocation in progress */
Signature · 1 line
1.8.4.3
PATCH 50/50 drm: use memdup_user() as a cleanup
In reply to Daniel VetterFrom: Dan Carpenter <[email protected]>
drivers/gpu/drm/r128/r128_state.c:1014:10-17: WARNING opportunity for memdup_user /c/kernel-tests/src/cocci/drivers/gpu/drm/r128/r128_state.c:1029:9-16: WARNING opportunity for memdup_user /c/kernel-tests/src/cocci/drivers/gpu/drm/r128/r128_state.c:904:10-17: WARNING opportunity for memdup_user /c/kernel-tests/src/cocci/drivers/gpu/drm/r128/r128_state.c:914:9-16: WARNING opportunity for memdup_user
Use memdup_user rather than duplicating its implementation This is a little bit restricted to reduce false positives
Generated by: coccinelle/api/memdup_user.cocci
--- drivers/gpu/drm/r128/r128_state.c | 46 ++++++++++----------------------------- 1 file changed, 12 insertions(+), 34 deletions(-)
drivers/gpu/drm/r128/r128_state.c +12 -34
@@ -901,25 +901,16 @@ static int r128_cce_dispatch_write_span(struct drm_device *dev,return -EFAULT ; buffer_size = depth->n *sizeof (u32); - buffer =kmalloc (buffer_size,GFP_KERNEL ); -if (buffer ==NULL ) -return -ENOMEM ; -if (copy_from_user (buffer, depth->buffer, buffer_size)) { -kfree (buffer); -return -EFAULT ; - } + buffer =memdup_user (depth->buffer, buffer_size); +if (IS_ERR (buffer)) +return PTR_ERR (buffer); mask_size = depth->n *sizeof (u8);if (depth->mask) { - mask =kmalloc (mask_size,GFP_KERNEL ); -if (mask ==NULL ) { + mask =memdup_user (depth->mask, mask_size); +if (IS_ERR (mask)) {kfree (buffer); -return -ENOMEM ; - } -if (copy_from_user (mask, depth->mask, mask_size)) { -kfree (buffer); -kfree (mask); -return -EFAULT ; +return PTR_ERR (mask); }for (i =0 ; i < count; i++, x++) {
@@ -1011,34 +1002,21 @@ static int r128_cce_dispatch_write_pixels(struct drm_device *dev, } buffer_size = depth->n *sizeof (u32); - buffer =kmalloc (buffer_size,GFP_KERNEL ); -if (buffer ==NULL ) { -kfree (x); -kfree (y); -return -ENOMEM ; - } -if (copy_from_user (buffer, depth->buffer, buffer_size)) { + buffer =memdup_user (depth->buffer, buffer_size); +if (IS_ERR (buffer)) {kfree (x);kfree (y); -kfree (buffer); -return -EFAULT ; +return PTR_ERR (buffer); }if (depth->mask) { mask_size = depth->n *sizeof (u8); - mask =kmalloc (mask_size,GFP_KERNEL ); -if (mask ==NULL ) { -kfree (x); -kfree (y); -kfree (buffer); -return -ENOMEM ; - } -if (copy_from_user (mask, depth->mask, mask_size)) { + mask =memdup_user (depth->mask, mask_size); +if (IS_ERR (mask)) {kfree (x);kfree (y);kfree (buffer); -kfree (mask); -return -EFAULT ; +return PTR_ERR (mask); }for (i =0 ; i < count; i++) {
Signature · 1 line
1.8.4.3
The vmwgfx changes are:
Quoted 177 lines · Daniel Vetter
Hi all,
This series almost removes
drm_bus, the last thing remaining is the ->setversion callback. Unfortunately we can't kill that completely since we need the backwards compat cruft for pci domain bonghits on alpha/ppc.I've also shot at a few easy marks on the road while at it.
My plan is to tackle the setversion mess in 3.15 with a Gross Hack. And then convert a few drivers to allocate struct
drm_devicethemselves and so complete the demidlayering in the driver load paths. For simplicity that'd probably be udl or the arm drivers due to lack of legacy baggage. That should allow us to ditchdrm_usb.canddrm_platform.cfrom the tree.My real long-term goal is to eventually use
devres.cand similar cool stuff to clean up the setup/teardown hell we have in i915.ko. Hence also why I've deprecated the legacy agp/ums support in i915 in the hope that I'll get to deal with less cruft. Also maybe we can sort out the lifetime issues around sysfs and debugfs at driver/module unload time eventually ... just let me dream ;-)Also a cleanup from Dan on top. All the little fixes for Wu Fengguang reported are squashed in - he's now also doing some arm builds!
Dan Carpenter (1):
drm: usememdup_user()as a cleanupDaniel Vetter (49):
drm/rcar: calldrm_put_devdirectly in the ->remove hook drm/exynos: calldrm_put_devdirectly from ->remove drm/imx: directly calldrm_put_devin ->remove drm/tilcdc: calldrm_put_devdirectly from ->remove drm/omap: calldrm_put_devdirectly in ->remove drm/shmob: calldrm_put_devdirectly from ->remove hook drm/armada: directly calldrm_put_devin ->remove drm/msm: calldrm_put_devdirectly in ->remove
drm: rip outdrm_platform_exit
drm: restrict the device list for shadow attached drivers drm/bufs: remove handling of_DRM_GEMmappings
drm: killDRIVER_REQUIRE_AGP
drm: ->agp_init can't fail
drm: rip outdrm_core_has_AGP
drm: removeagp_init()bus callback
drm: inlinedrm_agp_destroy
drm: kill the ->agp_destroy callback
drm: removeglobal_mutexlocking aroundagp_init
drm: rip outDRM_AGP_MEMandDRM_AGP_KERN
drm: KillDRM_HZ
drm: KillDRM_IRQ_ARGS
drm: KillDRM_WAKUPandDRM_INIT_WAITQUEUE
drm: Kill DRM_COPY_(TO|FROM)_USER
drm: Kill DRM_*MEMORYBARRIER
drm: KillDRM_SUSER
drm/gma500: Remove dead code
drm/irq: ReplaceDRM_WAIT_ONwithwait_event
drm: RemoveDRM_WAIT_ONfrom all drivers
drm/irq: simplify irq checks indrm_wait_vblankdrm/pci: fold inirq_by_busidsupport
drm/irq:drm_controlis a legacy ioctl, so pci devices only drm/irq: remove cargo-culted locking from irq_install/unistall
drm: removedrm_dev_to_irqfrom drivers
drm: killdrm_bus->bus_type
drm: Rip out totally bogusvga_switcheroo->can_switchlocking
drm: renamedev->count_locktodev->buf_lock
drm/irq: track the irq installed indrm_irq_installindev->irqdrm/irq: Look up the pci irq directly in thedrm_controlioctl
drm: pass the irq explicitly todrm_irq_install
drm: removebus->get_irqimplementations
drm: inlinedrm_pci_set_unique
drm: rip outdev->devname
drm: removedrm_bus->get_name
drm: Removedev->kdriver
drm/<drivers>: don't setdriver->dev_priv_sizeto 0
drm: store the gem vma offset manager in a typed pointer
drm: rip outdev->ioctl_counttracking
drm: Killfile_priv->ioctl_counttracking
drm: removedev->vma_countDocumentation/DocBook/drm.tmpl | 10 +-- drivers/gpu/drm/armada/armada_drv.c | 5 +- drivers/gpu/drm/ast/ast_drv.c | 1 - drivers/gpu/drm/cirrus/cirrus_drv.h | 2 +- drivers/gpu/drm/drm_agpsupport.c | 28 ++----- drivers/gpu/drm/drm_buffer.c | 2 +- drivers/gpu/drm/drm_bufs.c | 42 +++++----- drivers/gpu/drm/drm_drv.c | 4 - drivers/gpu/drm/drm_fops.c | 11 +-- drivers/gpu/drm/drm_gem.c | 27 +++---- drivers/gpu/drm/drm_info.c | 22 +++--- drivers/gpu/drm/drm_ioctl.c | 13 +-- drivers/gpu/drm/drm_irq.c | 125 +++++++++++------------------ drivers/gpu/drm/drm_memory.c | 15 ++-- drivers/gpu/drm/drm_pci.c | 132 ++++++++++++++++--------------- drivers/gpu/drm/drm_platform.c | 37 --------- drivers/gpu/drm/drm_stub.c | 25 +----- drivers/gpu/drm/drm_usb.c | 15 ---- drivers/gpu/drm/drm_vm.c | 10 +-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 4 +- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 2 +- drivers/gpu/drm/exynos/exynos_mixer.c | 6 +- drivers/gpu/drm/gma500/accel_2d.c | 2 +- drivers/gpu/drm/gma500/psb_drv.c | 2 +- drivers/gpu/drm/gma500/psb_drv.h | 8 +- drivers/gpu/drm/gma500/psb_intel_drv.h | 5 -- drivers/gpu/drm/gma500/psb_irq.c | 19 +---- drivers/gpu/drm/gma500/psb_irq.h | 2 +- drivers/gpu/drm/i810/i810_dma.c | 4 + drivers/gpu/drm/i810/i810_drv.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 31 ++++++-- drivers/gpu/drm/i915/i915_drv.c | 14 ++-- drivers/gpu/drm/i915/i915_gem.c | 7 +- drivers/gpu/drm/mga/mga_dma.c | 4 +- drivers/gpu/drm/mga/mga_drv.h | 4 +- drivers/gpu/drm/mga/mga_irq.c | 18 +++-- drivers/gpu/drm/mga/mga_state.c | 4 +- drivers/gpu/drm/msm/msm_drv.c | 8 +- drivers/gpu/drm/nouveau/nouveau_dma.c | 2 +- drivers/gpu/drm/nouveau/nouveau_dma.h | 2 +- drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +- drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +- drivers/gpu/drm/nouveau/nouveau_vga.c | 7 +- drivers/gpu/drm/omapdrm/omap_debugfs.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 4 +- drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- drivers/gpu/drm/omapdrm/omap_irq.c | 4 +- drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.h | 2 +- drivers/gpu/drm/qxl/qxl_ioctl.c | 4 +- drivers/gpu/drm/qxl/qxl_irq.c | 4 +- drivers/gpu/drm/r128/r128_cce.c | 4 +- drivers/gpu/drm/r128/r128_drv.h | 4 +- drivers/gpu/drm/r128/r128_irq.c | 2 +- drivers/gpu/drm/r128/r128_state.c | 68 ++++++---------- drivers/gpu/drm/radeon/r300_cmdbuf.c | 8 +- drivers/gpu/drm/radeon/r600_cp.c | 4 +- drivers/gpu/drm/radeon/r600_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_cp.c | 6 +- drivers/gpu/drm/radeon/radeon_cs.c | 10 +-- drivers/gpu/drm/radeon/radeon_device.c | 7 +- drivers/gpu/drm/radeon/radeon_drv.c | 3 +- drivers/gpu/drm/radeon/radeon_drv.h | 2 +- drivers/gpu/drm/radeon/radeon_irq.c | 19 +++-- drivers/gpu/drm/radeon/radeon_irq_kms.c | 6 +- drivers/gpu/drm/radeon/radeon_kms.c | 10 +-- drivers/gpu/drm/radeon/radeon_mem.c | 2 +- drivers/gpu/drm/radeon/radeon_ring.c | 2 +- drivers/gpu/drm/radeon/radeon_state.c | 20 ++--- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 4 +- drivers/gpu/drm/savage/savage_bci.c | 10 +-- drivers/gpu/drm/savage/savage_state.c | 8 +- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 6 +- drivers/gpu/drm/sis/sis_mm.c | 2 +- drivers/gpu/drm/tegra/bus.c | 12 --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 8 +- drivers/gpu/drm/ttm/ttm_bo_util.c | 2 +- drivers/gpu/drm/via/via_dma.c | 12 +-- drivers/gpu/drm/via/via_dmablit.c | 39 +++++---- drivers/gpu/drm/via/via_drv.h | 2 +- drivers/gpu/drm/via/via_irq.c | 21 +++-- drivers/gpu/drm/via/via_video.c | 18 +++-- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | 2 +- drivers/staging/imx-drm/imx-drm-core.c | 4 +- include/drm/drmP.h | 60 ++++---------- include/drm/drm_agpsupport.h | 33 ++------ include/drm/drm_os_linux.h | 61 -------------- include/uapi/drm/drm.h | 1 - 91 files changed, 485 insertions(+), 717 deletions(-)--
1.8.4.3_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel