Commit ecff665f5e3f (drm/ttm: make ttm reservation calls...) causes system hang on Radeon RS780
By simply copy/pasting a big document under LibreOffice my system hangs itself up. Only a hard reset gets it working again. see also: https://bugs.freedesktop.org/show_bug.cgi?id=66551 I've bisected the issue to: commit ecff665f5e3f1c6909353e00b9420e45ae23d995 Author: Maarten Lankhorst Date: Thu Jun 27 13:48:17 2013 +0200 drm/ttm: make ttm reservation calls behave like reservation calls This commit converts the source of the val_seq counter to the ww_mutex api. The reservation objects are converted later, because there is still a lockdep splat in nouveau that has to resolved first. Signed-off-by: Maarten Lankhorst Reviewed-by: Jerome Glisse Signed-off-by: Dave Airlie -- Markus ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Commit ecff665f5e3f (drm/ttm: make ttm reservation calls...) causes system hang on Radeon RS780
Op 10-07-13 11:22, Markus Trippelsdorf schreef: > By simply copy/pasting a big document under LibreOffice my system hangs > itself up. Only a hard reset gets it working again. > see also: https://bugs.freedesktop.org/show_bug.cgi?id=66551 > > I've bisected the issue to: > > commit ecff665f5e3f1c6909353e00b9420e45ae23d995 > Author: Maarten Lankhorst > Date: Thu Jun 27 13:48:17 2013 +0200 > > drm/ttm: make ttm reservation calls behave like reservation calls > > This commit converts the source of the val_seq counter to > the ww_mutex api. The reservation objects are converted later, > because there is still a lockdep splat in nouveau that has to > resolved first. > > Signed-off-by: Maarten Lankhorst > Reviewed-by: Jerome Glisse > Signed-off-by: Dave Airlie Hey, Can you try current head with CONFIG_PROVE_LOCKING set and post the lockdep splat from dmesg, if any? If there is any locking issue lockdep should warn about it. Lockdep will turn itself off after the first splat, so if the lockdep splat happens before running the affected parts those will have to be fixed first. ~Maarten ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Commit ecff665f5e3f (drm/ttm: make ttm reservation calls...) causes system hang on Radeon RS780
On 2013.07.10 at 11:29 +0200, Maarten Lankhorst wrote: > Op 10-07-13 11:22, Markus Trippelsdorf schreef: > > By simply copy/pasting a big document under LibreOffice my system hangs > > itself up. Only a hard reset gets it working again. > > see also: https://bugs.freedesktop.org/show_bug.cgi?id=66551 > > > > I've bisected the issue to: > > > > commit ecff665f5e3f1c6909353e00b9420e45ae23d995 > > Author: Maarten Lankhorst > > Date: Thu Jun 27 13:48:17 2013 +0200 > > > > drm/ttm: make ttm reservation calls behave like reservation calls > > > > This commit converts the source of the val_seq counter to > > the ww_mutex api. The reservation objects are converted later, > > because there is still a lockdep splat in nouveau that has to > > resolved first. > > > > Signed-off-by: Maarten Lankhorst > > Reviewed-by: Jerome Glisse > > Signed-off-by: Dave Airlie > Hey, > > Can you try current head with CONFIG_PROVE_LOCKING set and post the > lockdep splat from dmesg, if any? If there is any locking issue > lockdep should warn about it. Lockdep will turn itself off after the > first splat, so if the lockdep splat happens before running the > affected parts those will have to be fixed first. There was an unrelated EDAC lockdep splat, so I simply disabled it. This is what I get: Jul 10 11:40:44 x4 kernel: Jul 10 11:40:44 x4 kernel: [ BUG: lock held when returning to user space! ] Jul 10 11:40:44 x4 kernel: 3.10.0-08587-g496322b #35 Not tainted Jul 10 11:40:44 x4 kernel: Jul 10 11:40:44 x4 kernel: X/211 is leaving the kernel with locks still held! Jul 10 11:40:44 x4 kernel: 2 locks held by X/211: Jul 10 11:40:44 x4 kernel: #0: (reservation_ww_class_acquire){+.+.+.}, at: [] radeon_bo_list_validate+0x20/0xd0 Jul 10 11:40:44 x4 kernel: #1: (reservation_ww_class_mutex){+.+.+.}, at: [] ttm_eu_reserve_buffers+0x126/0x4b0 Jul 10 11:40:52 x4 kernel: SysRq : Emergency Sync Jul 10 11:40:53 x4 kernel: Emergency Sync complete -- Markus ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Commit ecff665f5e3f (drm/ttm: make ttm reservation calls...) causes system hang on Radeon RS780
Op 10-07-13 11:46, Markus Trippelsdorf schreef: > On 2013.07.10 at 11:29 +0200, Maarten Lankhorst wrote: >> Op 10-07-13 11:22, Markus Trippelsdorf schreef: >>> By simply copy/pasting a big document under LibreOffice my system hangs >>> itself up. Only a hard reset gets it working again. >>> see also: https://bugs.freedesktop.org/show_bug.cgi?id=66551 >>> >>> I've bisected the issue to: >>> >>> commit ecff665f5e3f1c6909353e00b9420e45ae23d995 >>> Author: Maarten Lankhorst >>> Date: Thu Jun 27 13:48:17 2013 +0200 >>> >>> drm/ttm: make ttm reservation calls behave like reservation calls >>> >>> This commit converts the source of the val_seq counter to >>> the ww_mutex api. The reservation objects are converted later, >>> because there is still a lockdep splat in nouveau that has to >>> resolved first. >>> >>> Signed-off-by: Maarten Lankhorst >>> Reviewed-by: Jerome Glisse >>> Signed-off-by: Dave Airlie >> Hey, >> >> Can you try current head with CONFIG_PROVE_LOCKING set and post the >> lockdep splat from dmesg, if any? If there is any locking issue >> lockdep should warn about it. Lockdep will turn itself off after the >> first splat, so if the lockdep splat happens before running the >> affected parts those will have to be fixed first. > There was an unrelated EDAC lockdep splat, so I simply disabled it. > > This is what I get: > > Jul 10 11:40:44 x4 kernel: > Jul 10 11:40:44 x4 kernel: [ BUG: lock held when returning to user space! ] > Jul 10 11:40:44 x4 kernel: 3.10.0-08587-g496322b #35 Not tainted > Jul 10 11:40:44 x4 kernel: > Jul 10 11:40:44 x4 kernel: X/211 is leaving the kernel with locks still held! > Jul 10 11:40:44 x4 kernel: 2 locks held by X/211: > Jul 10 11:40:44 x4 kernel: #0: (reservation_ww_class_acquire){+.+.+.}, at: > [] radeon_bo_list_validate+0x20/0xd0 > Jul 10 11:40:44 x4 kernel: #1: (reservation_ww_class_mutex){+.+.+.}, at: > [] ttm_eu_reserve_buffers+0x126/0x4b0 > Jul 10 11:40:52 x4 kernel: SysRq : Emergency Sync > Jul 10 11:40:53 x4 kernel: Emergency Sync complete > Thanks, exactly what I thought. I missed a backoff somewhere.. Does the below patch fix it? --- diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 0219d26..2020bf4 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -377,6 +377,7 @@ int radeon_bo_list_validate(struct ww_acquire_ctx *ticket, domain = lobj->alt_domain; goto retry; } + ttm_eu_backoff_reservation(ticket, head); return r; } } ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: Commit ecff665f5e3f (drm/ttm: make ttm reservation calls...) causes system hang on Radeon RS780
On 2013.07.10 at 11:56 +0200, Maarten Lankhorst wrote: > Op 10-07-13 11:46, Markus Trippelsdorf schreef: > > On 2013.07.10 at 11:29 +0200, Maarten Lankhorst wrote: > >> Op 10-07-13 11:22, Markus Trippelsdorf schreef: > >>> By simply copy/pasting a big document under LibreOffice my system hangs > >>> itself up. Only a hard reset gets it working again. > >>> see also: https://bugs.freedesktop.org/show_bug.cgi?id=66551 > >>> > >>> I've bisected the issue to: > >>> > >>> commit ecff665f5e3f1c6909353e00b9420e45ae23d995 > >>> Author: Maarten Lankhorst > >>> Date: Thu Jun 27 13:48:17 2013 +0200 > >>> > >>> drm/ttm: make ttm reservation calls behave like reservation calls > >>> > >>> This commit converts the source of the val_seq counter to > >>> the ww_mutex api. The reservation objects are converted later, > >>> because there is still a lockdep splat in nouveau that has to > >>> resolved first. > >>> > >>> Signed-off-by: Maarten Lankhorst > >>> Reviewed-by: Jerome Glisse > >>> Signed-off-by: Dave Airlie > >> Hey, > >> > >> Can you try current head with CONFIG_PROVE_LOCKING set and post the > >> lockdep splat from dmesg, if any? If there is any locking issue > >> lockdep should warn about it. Lockdep will turn itself off after the > >> first splat, so if the lockdep splat happens before running the > >> affected parts those will have to be fixed first. > > There was an unrelated EDAC lockdep splat, so I simply disabled it. > > > > This is what I get: > > > > Jul 10 11:40:44 x4 kernel: > > Jul 10 11:40:44 x4 kernel: [ BUG: lock held when returning to user space! ] > > Jul 10 11:40:44 x4 kernel: 3.10.0-08587-g496322b #35 Not tainted > > Jul 10 11:40:44 x4 kernel: > > Jul 10 11:40:44 x4 kernel: X/211 is leaving the kernel with locks still > > held! > > Jul 10 11:40:44 x4 kernel: 2 locks held by X/211: > > Jul 10 11:40:44 x4 kernel: #0: (reservation_ww_class_acquire){+.+.+.}, at: > > [] radeon_bo_list_validate+0x20/0xd0 > > Jul 10 11:40:44 x4 kernel: #1: (reservation_ww_class_mutex){+.+.+.}, at: > > [] ttm_eu_reserve_buffers+0x126/0x4b0 > > Jul 10 11:40:52 x4 kernel: SysRq : Emergency Sync > > Jul 10 11:40:53 x4 kernel: Emergency Sync complete > > > Thanks, exactly what I thought. I missed a backoff somewhere.. > > Does the below patch fix it? Yes. Thank you for your quick reply. -- Markus ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/radeon: add missing ttm_eu_backoff_reservation to radeon_bo_list_validate
Op 10-07-13 12:03, Markus Trippelsdorf schreef: > On 2013.07.10 at 11:56 +0200, Maarten Lankhorst wrote: >> Op 10-07-13 11:46, Markus Trippelsdorf schreef: >>> On 2013.07.10 at 11:29 +0200, Maarten Lankhorst wrote: Op 10-07-13 11:22, Markus Trippelsdorf schreef: > By simply copy/pasting a big document under LibreOffice my system hangs > itself up. Only a hard reset gets it working again. > see also: https://bugs.freedesktop.org/show_bug.cgi?id=66551 > > I've bisected the issue to: > > commit ecff665f5e3f1c6909353e00b9420e45ae23d995 > Author: Maarten Lankhorst > Date: Thu Jun 27 13:48:17 2013 +0200 > > drm/ttm: make ttm reservation calls behave like reservation calls > > This commit converts the source of the val_seq counter to > the ww_mutex api. The reservation objects are converted later, > because there is still a lockdep splat in nouveau that has to > resolved first. > > Signed-off-by: Maarten Lankhorst > Reviewed-by: Jerome Glisse > Signed-off-by: Dave Airlie Hey, Can you try current head with CONFIG_PROVE_LOCKING set and post the lockdep splat from dmesg, if any? If there is any locking issue lockdep should warn about it. Lockdep will turn itself off after the first splat, so if the lockdep splat happens before running the affected parts those will have to be fixed first. >>> There was an unrelated EDAC lockdep splat, so I simply disabled it. >>> >>> This is what I get: >>> >>> Jul 10 11:40:44 x4 kernel: >>> Jul 10 11:40:44 x4 kernel: [ BUG: lock held when returning to user space! ] >>> Jul 10 11:40:44 x4 kernel: 3.10.0-08587-g496322b #35 Not tainted >>> Jul 10 11:40:44 x4 kernel: >>> Jul 10 11:40:44 x4 kernel: X/211 is leaving the kernel with locks still >>> held! >>> Jul 10 11:40:44 x4 kernel: 2 locks held by X/211: >>> Jul 10 11:40:44 x4 kernel: #0: (reservation_ww_class_acquire){+.+.+.}, at: >>> [] radeon_bo_list_validate+0x20/0xd0 >>> Jul 10 11:40:44 x4 kernel: #1: (reservation_ww_class_mutex){+.+.+.}, at: >>> [] ttm_eu_reserve_buffers+0x126/0x4b0 >>> Jul 10 11:40:52 x4 kernel: SysRq : Emergency Sync >>> Jul 10 11:40:53 x4 kernel: Emergency Sync complete >>> >> Thanks, exactly what I thought. I missed a backoff somewhere.. >> >> Does the below patch fix it? > Yes. Thank you for your quick reply. 8<-- If radeon_cs_parser_relocs fails ttm_eu_backoff_reservation doesn't get called. This left open a bug where ttm_eu_reserve_buffers succeeded but the bo's were not unlocked afterwards: Jul 10 11:40:44 x4 kernel: Jul 10 11:40:44 x4 kernel: [ BUG: lock held when returning to user space! ] Jul 10 11:40:44 x4 kernel: 3.10.0-08587-g496322b #35 Not tainted Jul 10 11:40:44 x4 kernel: Jul 10 11:40:44 x4 kernel: X/211 is leaving the kernel with locks still held! Jul 10 11:40:44 x4 kernel: 2 locks held by X/211: Jul 10 11:40:44 x4 kernel: #0: (reservation_ww_class_acquire){+.+.+.}, at: [] radeon_bo_list_validate+0x20/0xd0 Jul 10 11:40:44 x4 kernel: #1: (reservation_ww_class_mutex){+.+.+.}, at: [] ttm_eu_reserve_buffers+0x126/0x4b0 Jul 10 11:40:52 x4 kernel: SysRq : Emergency Sync Jul 10 11:40:53 x4 kernel: Emergency Sync complete This is a regression caused by commit ecff665f5e. "drm/ttm: make ttm reservation calls behave like reservation calls" Reported-by: Markus Trippelsdorf Tested-by: Markus Trippelsdorf Signed-off-by: Maarten Lankhorst --- diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 0219d26..2020bf4 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c @@ -377,6 +377,7 @@ int radeon_bo_list_validate(struct ww_acquire_ctx *ticket, domain = lobj->alt_domain; goto retry; } + ttm_eu_backoff_reservation(ticket, head); return r; } } ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/rcar-du: Add missing dependency on CMA
Hi Mark, Thanks for the patch. On Wednesday 10 July 2013 11:52:14 Mark Brown wrote: > From: Mark Brown > > The driver uses CMA APIs so won't link if CMA is not being built. > > Signed-off-by: Mark Brown > --- > drivers/gpu/drm/rcar-du/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/rcar-du/Kconfig > b/drivers/gpu/drm/rcar-du/Kconfig index 72887df..e75575a 100644 > --- a/drivers/gpu/drm/rcar-du/Kconfig > +++ b/drivers/gpu/drm/rcar-du/Kconfig > @@ -1,6 +1,6 @@ > config DRM_RCAR_DU > tristate "DRM Support for R-Car Display Unit" > - depends on DRM && ARM > + depends on DRM && ARM && CMA > select DRM_KMS_HELPER > select DRM_KMS_CMA_HELPER > select DRM_GEM_CMA_HELPER Shouldn't we instead make DRM_GEM_CMA_HELPER depend on CMA ? -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/3] drm/edid: Fix constness warning in drm_load_edid_firmware()
drivers/gpu/drm/drm_edid_load.c: In function ‘drm_load_edid_firmware’: drivers/gpu/drm/drm_edid_load.c:245: warning: initialization discards qualifiers from pointer target type drm_get_connector_name() returns a "const char *", hence propagate the const where needed. Signed-off-by: Geert Uytterhoeven --- drivers/gpu/drm/drm_edid_load.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c index a4f5ce1..2c2803f 100644 --- a/drivers/gpu/drm/drm_edid_load.c +++ b/drivers/gpu/drm/drm_edid_load.c @@ -134,7 +134,7 @@ static u8 generic_edid[GENERIC_EDIDS][128] = { }; static u8 *edid_load(struct drm_connector *connector, char *name, - char *connector_name) + const char *connector_name) { const struct firmware *fw; struct platform_device *pdev; @@ -242,7 +242,7 @@ out: int drm_load_edid_firmware(struct drm_connector *connector) { - char *connector_name = drm_get_connector_name(connector); + const char *connector_name = drm_get_connector_name(connector); char *edidname = edid_firmware, *last, *colon; int ret; struct edid *edid; -- 1.7.9.5 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/3] drm/edid: Fix uninitialized return variable in edid_load()
drivers/gpu/drm/drm_edid_load.c: In function ‘edid_load’: drivers/gpu/drm/drm_edid_load.c:141: warning: ‘edid’ may be used uninitialized in this function In some error cases, edid_load() will return the uninitialized variable. Initialize it to NULL to fix this. Signed-off-by: Geert Uytterhoeven --- drivers/gpu/drm/drm_edid_load.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c index 2c2803f..9be3467 100644 --- a/drivers/gpu/drm/drm_edid_load.c +++ b/drivers/gpu/drm/drm_edid_load.c @@ -138,7 +138,7 @@ static u8 *edid_load(struct drm_connector *connector, char *name, { const struct firmware *fw; struct platform_device *pdev; - u8 *fwdata = NULL, *edid, *new_edid; + u8 *fwdata = NULL, *edid = NULL, *new_edid; int fwsize, expected; int builtin = 0, err = 0; int i, valid_extensions = 0; -- 1.7.9.5 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/3] drm/edid: Make edid_load() return a void *
Always use "void *" for arbitrary memory buffers, as this allows to drop casts in assignments. Signed-off-by: Geert Uytterhoeven --- drivers/gpu/drm/drm_edid_load.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c index 9be3467..d1daf34 100644 --- a/drivers/gpu/drm/drm_edid_load.c +++ b/drivers/gpu/drm/drm_edid_load.c @@ -133,7 +133,7 @@ static u8 generic_edid[GENERIC_EDIDS][128] = { }, }; -static u8 *edid_load(struct drm_connector *connector, char *name, +static void *edid_load(struct drm_connector *connector, char *name, const char *connector_name) { const struct firmware *fw; @@ -263,7 +263,7 @@ int drm_load_edid_firmware(struct drm_connector *connector) if (*last == '\n') *last = '\0'; - edid = (struct edid *) edid_load(connector, edidname, connector_name); + edid = edid_load(connector, edidname, connector_name); if (IS_ERR_OR_NULL(edid)) return 0; -- 1.7.9.5 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66767] New: atombios stuck in loop for more than 5secs aborting after suspend to ram
https://bugs.freedesktop.org/show_bug.cgi?id=66767 Priority: medium Bug ID: 66767 Assignee: dri-devel@lists.freedesktop.org Summary: atombios stuck in loop for more than 5secs aborting after suspend to ram Severity: normal Classification: Unclassified OS: All Reporter: johannes.hi...@fem.tu-ilmenau.de Hardware: Other Status: NEW Version: DRI CVS Component: DRM/Radeon Product: DRI With the new dpm code for linux-3.11 I get the following error after S2R resume: [ 1182.615704] [drm:atom_op_jump] *ERROR* atombios stuck in loop for more than 5secs aborting [ 1182.615707] [drm:atom_execute_table_locked] *ERROR* atombios stuck executing CA86 (len 67, WS 0, PS 0) @ 0xCAB5 complete dmesg from the suspend-resume-cycle: [ 1175.956924] PM: Syncing filesystems ... done. [ 1176.064389] Freezing user space processes ... (elapsed 0.001 seconds) done. [ 1176.065709] Freezing remaining freezable tasks ... (elapsed 0.000 seconds) done. [ 1176.066809] Suspending console(s) (use no_console_suspend to debug) [ 1176.078054] sd 0:0:0:0: [sda] Synchronizing SCSI cache [ 1176.078814] sd 0:0:0:0: [sda] Stopping disk [ 1176.719313] [drm:rv770_stop_dpm] *ERROR* Could not force DPM to low. [ 1176.727515] radeon :01:00.0: fence driver on ring 5 use gpu addr 0x0015e418 and cpu addr 0xc9000229d418 [ 1176.914976] radeon :01:00.0: power state changed by ACPI to D3cold [ 1176.915055] PM: suspend of devices complete after 836.927 msecs [ 1176.915224] PM: late suspend of devices complete after 0.167 msecs [ 1176.936919] ehci-pci :00:12.2: System wakeup enabled by ACPI [ 1176.947894] ohci-pci :00:12.0: System wakeup enabled by ACPI [ 1176.947994] PM: noirq suspend of devices complete after 32.756 msecs [ 1176.948042] ACPI: Preparing to enter system sleep state S3 [ 1176.952092] PM: Saving platform NVS memory [ 1176.956159] Disabling non-boot CPUs ... [ 1176.957567] smpboot: CPU 1 is now offline [ 1176.958200] ACPI: Low-level resume complete [ 1176.958240] PM: Restoring platform NVS memory [ 1176.959889] PCI-DMA: Resuming GART IOMMU [ 1176.959890] PCI-DMA: Restoring GART aperture settings [ 1176.960206] Enabling non-boot CPUs ... [ 1176.960247] smpboot: Booting Node 0 Processor 1 APIC 0x1 [ 1176.971296] [Firmware Bug]: cpu 1, try to use APIC500 (LVT offset 0) for vector 0x400, but the register is already in use for vector 0xf9 on another cpu [ 1176.971298] perf: IBS APIC setup failed on cpu #1 [ 1176.973412] process: Switch to broadcast mode on CPU1 [ 1176.973606] CPU1 is up [ 1176.974596] ACPI: Waking up from system sleep state S3 [ 1176.975097] ohci-pci :00:12.0: System wakeup disabled by ACPI [ 1176.986024] ehci-pci :00:12.2: System wakeup disabled by ACPI [ 1177.008185] radeon :01:00.0: power state changed by ACPI to D0 [ 1177.052129] PM: noirq resume of devices complete after 77.225 msecs [ 1177.052251] PM: early resume of devices complete after 0.096 msecs [ 1177.052731] pcieport :00:04.0: System wakeup disabled by ACPI [ 1177.053784] ath: phy0: ASPM enabled: 0x42 [ 1177.054394] snd_hda_intel :01:00.1: irq 45 for MSI/MSI-X [ 1177.055456] [drm] enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0 [ 1177.058107] [drm] PCIE GART of 512M enabled (table at 0x00142000). [ 1177.058253] radeon :01:00.0: WB enabled [ 1177.058256] radeon :01:00.0: fence driver on ring 0 use gpu addr 0x2c00 and cpu addr 0x88011a3a6c00 [ 1177.058258] radeon :01:00.0: fence driver on ring 3 use gpu addr 0x2c0c and cpu addr 0x88011a3a6c0c [ 1177.059773] radeon :01:00.0: fence driver on ring 5 use gpu addr 0x0079b418 and cpu addr 0xc9000329c418 [ 1177.076158] [drm] ring test on 0 succeeded in 1 usecs [ 1177.076216] [drm] ring test on 3 succeeded in 1 usecs [ 1177.273577] [drm] ring test on 5 succeeded in 1 usecs [ 1177.273579] [drm] UVD initialized successfully. [ 1177.273613] [drm] ib test on ring 0 succeeded in 0 usecs [ 1177.273643] [drm] ib test on ring 3 succeeded in 1 usecs [ 1177.289078] usb 2-1: reset high-speed USB device number 2 using ehci-pci [ 1177.445991] [drm] ib test on ring 5 succeeded [ 1177.451139] switching from power state: [ 1177.451141] ui class: none [ 1177.451142] internal class: boot [ 1177.451143] caps: video [ 1177.451145] uvdvclk: 0 dclk: 0 [ 1177.451147] power level 0sclk: 75000 mclk: 8 vddc: 1120 vddci: 0 [ 1177.451148] power level 1sclk: 75000 mclk: 8 vddc: 1120 vddci: 0 [ 1177.451148] power level 2sclk: 75000 mclk: 8 vddc: 1120 vddci: 0 [ 1177.451149] status: c b [ 1177.451150] switching to power state: [ 1177.451150] ui class: performance [ 1177.451151] internal class: none [ 1177.451152] caps: single_disp video [ 1177.451153] uvdvclk: 0 dclk: 0 [ 1177.451154] power level 0
[Bug 66767] atombios stuck in loop for more than 5secs aborting after suspend to ram
https://bugs.freedesktop.org/show_bug.cgi?id=66767 Johannes Hirte changed: What|Removed |Added Hardware|Other |x86-64 (AMD64) OS|All |Linux (All) -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66768] New: UVD decoding of MPEG2 streams doesn't work on CEDAR
https://bugs.freedesktop.org/show_bug.cgi?id=66768 Priority: medium Bug ID: 66768 Assignee: dri-devel@lists.freedesktop.org Summary: UVD decoding of MPEG2 streams doesn't work on CEDAR Severity: normal Classification: Unclassified OS: Linux (All) Reporter: johannes.hi...@fem.tu-ilmenau.de Hardware: x86-64 (AMD64) Status: NEW Version: DRI CVS Component: DRM/Radeon Product: DRI On my system with CEDAR graphics decoding mpeg2 streams with vdpau doesn't work. Only a black window is showed and mplayer2 says: Loading extension-related profile 'vo.vdpau' Playing Fucking_With_Fire-Live_Sao_Paulo.mpg. Detected file format: MPEG-PS (MPEG-2 Program Stream) (libavformat) [mpeg @ 0x7f014dcc1cc0]max_analyze_duration 500 reached at 5005000 [lavf] stream 0: video (mpeg2video), -vid 0 [lavf] stream 1: audio (ac3), -aid 0 [lavf] stream 2: audio (ac3), -aid 1 Load subtitles in . Forced video codec: ffmpeg12vdpau Selected video codec: MPEG-1/2 video (VDPAU acceleration) [libavcodec] Selected audio codec: ATSC A/52A (AC-3) [libavcodec] AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000) AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample) Starting playback... Unsupported PixelFormat xvmcidct (16) Unsupported PixelFormat xvmcmc (15) VIDEO: 720x480 29.970 fps 7500.0 kbps (937.5 kB/s) Aspect ratio is 1.78:1 - scaling to correct movie aspect. VO: [vdpau] 720x480 => 853x480 MPEG2 VDPAU acceleration [vdpau] Compositing window manager detected. Assuming timing info is inaccurate. On a SUMO based system this works correct. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/rcar-du: Add missing dependency on CMA
On Wednesday 10 July 2013 12:07:24 Mark Brown wrote: > On Wed, Jul 10, 2013 at 12:54:40PM +0200, Laurent Pinchart wrote: > > On Wednesday 10 July 2013 11:52:14 Mark Brown wrote: > > > config DRM_RCAR_DU > > > > > > tristate "DRM Support for R-Car Display Unit" > > > > > > - depends on DRM && ARM > > > + depends on DRM && ARM && CMA > > > > > > select DRM_KMS_HELPER > > > select DRM_KMS_CMA_HELPER > > > select DRM_GEM_CMA_HELPER > > > > Shouldn't we instead make DRM_GEM_CMA_HELPER depend on CMA ? > > Sadly select doesn't do the right thing with dependencies - it just ignores > them. OK, my bad. On the other hand, thinking a bit more about this, the DU driver doesn't use the CMA API directly, as there's no CMA API exposed to drivers :-) I've successfully built the driver with CONFIG_CMA disabled. Could you please share the .config that resulted in a link error ? -- Regards, Laurent Pinchart signature.asc Description: This is a digitally signed message part. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/prime: remove cargo-cult locking from map_sg helper
I've checked both implementations (radeon/nouveau) and they both grab the page array from ttm simply by dereferencing it and then wrapping it up with drm_prime_pages_to_sg in the callback and map it with dma_map_sg (in the helper). Only the grabbing of the underlying page array is anything we need to be concerned about, and either those pages are pinned independently, or we're screwed no matter what. And indeed, nouveau/radeon pin the backing storage in their attach/detach functions. The only thing we might claim it does is prevent concurrent mapping of dma_buf attachments. But a) that's not allowed and b) the current code is racy already since it checks whether the sg mapping exists _before_ grabbing the lock. So the dev->struct_mutex locking here does absolutely nothing useful, but only distracts. Remove it. This should also help Maarten's work to eventually pin the backing storage more dynamically by preventing locking inversions around dev->struct_mutex. Cc: Maarten Lankhorst Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_prime.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 85e450e..64a99b3 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -167,8 +167,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, if (WARN_ON(prime_attach->dir != DMA_NONE)) return ERR_PTR(-EBUSY); - mutex_lock(&obj->dev->struct_mutex); - sgt = obj->dev->driver->gem_prime_get_sg_table(obj); if (!IS_ERR(sgt)) { @@ -182,7 +180,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, } } - mutex_unlock(&obj->dev->struct_mutex); return sgt; } -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[RFC PATCH v4 0/2] Introduce buffer synchronization framework
Hi all, This patch set introduces a buffer synchronization framework based on DMA BUF[1] and reservation[2] to use dma-buf resource, and based on ww-mutexes[3] for lock mechanism. The purpose of this framework is to provide not only buffer access control to CPU and CPU, and CPU and DMA, and DMA and DMA but also easy-to-use interfaces for device drivers and user application. In addtion, this patch set suggests a way for enhancing performance. to implement generic user mode interface, we have used fcntl system call[4]. As you know, user application sees a buffer object as a dma-buf file descriptor. So fcntl() call with the file descriptor means to lock some buffer region being managed by the dma-buf object. For more detail, you can refer to the dma-buf-sync.txt in Documentation/ Moreover, we had tried to find how we could utilize limited hardware resources more using buffer synchronization mechanism. And finally, we have realized that it could enhance performance using multi threads with this buffer synchronization mechanism: DMA and CPU works individually so CPU could perform other works while DMA is performing some works, and vise versa. However, in the conventional way, that is not easy to do so because DMA operation is depend on CPU operation, and vice versa. Conventional way: User Kernel - CPU writes something to src send the src to driver-> update DMA register request DMA start(1)---> DMA start <-completion signal(2)-- CPU accesses dst (1) Request DMA start after the CPU access to src buffer is completed. (2) Access dst buffer after DMA access to the dst buffer is completed. On the other hand, if there is something to control buffer access between CPU and DMA? The below shows that: User(thread a) User(thread b)Kernel - send a src to driver--> update DMA register lock the src request DMA start(1)--> CPU acccess to src unlock the srclock src and dst DMA start <-completion signal(2)- lock dst DMA completion CPU access to dst unlock src and dst unlock DST (1) Try to start DMA operation while CPU is accessing the src buffer. (2) Try CPU access to dst buffer while DMA is accessing the dst buffer. This means that CPU or DMA could do more works. In the same way, we could reduce hand shaking overhead between two processes when those processes need to share a shared buffer. There may be other cases that we could reduce overhead as well. References: [1] http://lwn.net/Articles/470339/ [2] http://lwn.net/Articles/532616/ [3] https://patchwork.kernel.org/patch/2625361/ [4] http://linux.die.net/man/2/fcntl Inki Dae (2): dmabuf-sync: Introduce buffer synchronization framework dma-buf: add lock callback for fcntl system call. Documentation/dma-buf-sync.txt | 283 + drivers/base/Kconfig |7 + drivers/base/Makefile |1 + drivers/base/dma-buf.c | 34 ++ drivers/base/dmabuf-sync.c | 661 include/linux/dma-buf.h| 14 + include/linux/dmabuf-sync.h| 132 include/linux/reservation.h|9 + 8 files changed, 1141 insertions(+), 0 deletions(-) create mode 100644 Documentation/dma-buf-sync.txt create mode 100644 drivers/base/dmabuf-sync.c create mode 100644 include/linux/dmabuf-sync.h -- 1.7.5.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[RFC PATCH v4 1/2] dmabuf-sync: Introduce buffer synchronization framework
This patch adds a buffer synchronization framework based on DMA BUF[1] and reservation[2] to use dma-buf resource, and based on ww-mutexes[3] for lock mechanism. The purpose of this framework is to provide not only buffer access control to CPU and DMA but also easy-to-use interfaces for device drivers and user application. This framework can be used for all dma devices using system memory as dma buffer, especially for most ARM based SoCs. Changelog v4: - Add user side interface for buffer synchronization mechanism and update descriptions related to the user side interface. Changelog v3: - remove cache operation relevant codes and update document file. Changelog v2: - use atomic_add_unless to avoid potential bug. - add a macro for checking valid access type. - code clean. The mechanism of this framework has the following steps, 1. Register dmabufs to a sync object - A task gets a new sync object and can add one or more dmabufs that the task wants to access. This registering should be performed when a device context or an event context such as a page flip event is created or before CPU accesses a shared buffer. dma_buf_sync_get(a sync object, a dmabuf); 2. Lock a sync object - A task tries to lock all dmabufs added in its own sync object. Basically, the lock mechanism uses ww-mutex[1] to avoid dead lock issue and for race condition between CPU and CPU, CPU and DMA, and DMA and DMA. Taking a lock means that others cannot access all locked dmabufs until the task that locked the corresponding dmabufs, unlocks all the locked dmabufs. This locking should be performed before DMA or CPU accesses these dmabufs. dma_buf_sync_lock(a sync object); 3. Unlock a sync object - The task unlocks all dmabufs added in its own sync object. The unlock means that the DMA or CPU accesses to the dmabufs have been completed so that others may access them. This unlocking should be performed after DMA or CPU has completed accesses to the dmabufs. dma_buf_sync_unlock(a sync object); 4. Unregister one or all dmabufs from a sync object - A task unregisters the given dmabufs from the sync object. This means that the task dosen't want to lock the dmabufs. The unregistering should be performed after DMA or CPU has completed accesses to the dmabufs or when dma_buf_sync_lock() is failed. dma_buf_sync_put(a sync object, a dmabuf); dma_buf_sync_put_all(a sync object); The described steps may be summarized as: get -> lock -> CPU or DMA access to a buffer/s -> unlock -> put This framework includes the following two features. 1. read (shared) and write (exclusive) locks - A task is required to declare the access type when the task tries to register a dmabuf; READ, WRITE, READ DMA, or WRITE DMA. The below is example codes, struct dmabuf_sync *sync; sync = dmabuf_sync_init(NULL, "test sync"); dmabuf_sync_get(sync, dmabuf, DMA_BUF_ACCESS_R); ... And the below can be used as access types: DMA_BUF_ACCESS_R - CPU will access a buffer for read. DMA_BUF_ACCESS_W - CPU will access a buffer for read or write. DMA_BUF_ACCESS_DMA_R - DMA will access a buffer for read DMA_BUF_ACCESS_DMA_W - DMA will access a buffer for read or write. 2. Mandatory resource releasing - a task cannot hold a lock indefinitely. A task may never try to unlock a buffer after taking a lock to the buffer. In this case, a timer handler to the corresponding sync object is called in five (default) seconds and then the timed-out buffer is unlocked by work queue handler to avoid lockups and to enforce resources of the buffer. The below is how to use for device driver: 1. Allocate and Initialize a sync object: struct dmabuf_sync *sync; sync = dmabuf_sync_init(NULL, "test sync"); ... 2. Add a dmabuf to the sync object when setting up dma buffer relevant registers: dmabuf_sync_get(sync, dmabuf, DMA_BUF_ACCESS_READ); ... 3. Lock all dmabufs of the sync object before DMA or CPU accesses the dmabufs: dmabuf_sync_lock(sync); ... 4. Now CPU or DMA can access all dmabufs locked in step 3. 5. Unlock all dmabufs added in a sync object after DMA or CPU access to these dmabufs is completed: dmabuf_sync_unlock(sync); And call the following functions to release all resources, dmabuf_sync_put_all(sync); dmabuf_sync_fini(sync); You can refer to actual example codes: https://git.kernel.org/cgit/linux/kernel/git/daeinki/drm-exynos.git/ commit/?h=dmabuf-sync&id=4030bdee9bab5841ad32faade
[RFC PATCH v1 2/2] dma-buf: add lock callback for fcntl system call.
This patch adds lock callback to dma buf file operations, and this callback will be called by fcntl system call. With this patch, fcntl system call can be used for buffer synchronization between CPU and CPU, and CPU and DMA in user mode. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/base/dma-buf.c | 34 ++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index fe39120..cd71447 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c @@ -31,6 +31,7 @@ #include #include #include +#include static inline int is_dma_buf_file(struct file *); @@ -82,9 +83,42 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma) return dmabuf->ops->mmap(dmabuf, vma); } +static int dma_buf_lock(struct file *file, int cmd, struct file_lock *fl) +{ + struct dma_buf *dmabuf; + unsigned int type; + bool wait = false; + + if (!is_dma_buf_file(file)) + return -EINVAL; + + dmabuf = file->private_data; + + if ((fl->fl_type & F_UNLCK) == F_UNLCK) { + dmabuf_sync_single_unlock(dmabuf); + return 0; + } + + /* convert flock type to dmabuf sync type. */ + if ((fl->fl_type & F_WRLCK) == F_WRLCK) + type = DMA_BUF_ACCESS_W; + else if ((fl->fl_type & F_RDLCK) == F_RDLCK) + type = DMA_BUF_ACCESS_R; + else + return -EINVAL; + + if (fl->fl_flags & FL_SLEEP) + wait = true; + + /* TODO. the locking to certain region should also be considered. */ + + return dmabuf_sync_single_lock(dmabuf, type, wait); +} + static const struct file_operations dma_buf_fops = { .release= dma_buf_release, .mmap = dma_buf_mmap_internal, + .lock = dma_buf_lock, }; /* -- 1.7.5.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/prime: remove cargo-cult locking from map_sg helper
Op 10-07-13 13:54, Daniel Vetter schreef: > I've checked both implementations (radeon/nouveau) and they both grab > the page array from ttm simply by dereferencing it and then wrapping > it up with drm_prime_pages_to_sg in the callback and map it with > dma_map_sg (in the helper). > > Only the grabbing of the underlying page array is anything we need to > be concerned about, and either those pages are pinned independently, > or we're screwed no matter what. > > And indeed, nouveau/radeon pin the backing storage in their > attach/detach functions. > > The only thing we might claim it does is prevent concurrent mapping of > dma_buf attachments. But a) that's not allowed and b) the current code > is racy already since it checks whether the sg mapping exists _before_ > grabbing the lock. > > So the dev->struct_mutex locking here does absolutely nothing useful, > but only distracts. Remove it. > > This should also help Maarten's work to eventually pin the backing > storage more dynamically by preventing locking inversions around > dev->struct_mutex. This pleases me, but I think it's not thorough enough. if (prime_attach->dir == dir) return prime_attach->sgt; ^ That check must go too. I don't think recursive map_dma_buf is valid. and unmap_dma_buf should set prime_attach->dir = DMA_NONE; again. > Cc: Maarten Lankhorst > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_prime.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c > index 85e450e..64a99b3 100644 > --- a/drivers/gpu/drm/drm_prime.c > +++ b/drivers/gpu/drm/drm_prime.c > @@ -167,8 +167,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct > dma_buf_attachment *attach, > if (WARN_ON(prime_attach->dir != DMA_NONE)) > return ERR_PTR(-EBUSY); > > - mutex_lock(&obj->dev->struct_mutex); > - > sgt = obj->dev->driver->gem_prime_get_sg_table(obj); > > if (!IS_ERR(sgt)) { > @@ -182,7 +180,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct > dma_buf_attachment *attach, > } > } > > - mutex_unlock(&obj->dev->struct_mutex); > return sgt; > } > ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 00/39] clean out drm cruft and hide it better for kms drivers
Hi all, I've figured that it's again time for a bit of (late) drm spring cleanup. This series here consists of a pile of "rip old stuff out" patches interleaved with "disable old cruft for kms drivers and hide it better". Comments, flames and review highly welcome. I'd be especially happy if the arm guys could check whether I haven't badly broken their drivers - compile-testing arm is a pita, so I haven't yet done that. There's a few driver-wide patches included, but the more invasive ones (i.e. changing more than the drm driver vtable) are split out per-driver for easier merging. If no one screams my plan is to rebase this pile on top of -rc1, give it some more testing (check arm, ugh) and then send a pull request to Dave. That should reduce interference with ongoing driver work as much as possible I hope. My drm cruft todo list still has a pile of ideas, but I've figured I need to stop now for 3.12. For those interested further cleanups could include: - setversion/set_busid: All drm core version 1.1 is legacy cruft, kms drivers should never run in this mode. We could clean up the setversion ioclt (and move the drm core version handling into a legacy function) and set up the bus id unconditionally at driver load time. - There's a few more legacy ioctls/subsystems that could be blocked out for kms drivers (but the required git history digging tends to be tedious). Also I think we could more aggressively move legacy cruft setup/teardown code out-of-line from the main code by extracting it into drm_legacy_ functions (like this series here already does for the context and dma stuff). - I think creating a drm_internal.h header for functions not exported to drivers would be useful. That way we could move all the legacy functions out of drmP.h (which are a lot of them), which should make it much clearer what the real drm driver interface actually is. - drm_os_linux.h should just die in fire. - There's a pile of needless indirection around our agp handling, we duplicate the agp core's CONFIG_AGP=n no-oping function handling in large parts, among other stuff. - The drm coherent dma alloc helpers could get ripped out, at least for kms drivers. For ums drivers there's some funny cases where this mapping is exchanged with userspace for e.g. register access. In a least one case (i810.ko) userspace even sets up that mapping, which allows it to crash the kernel at will (since those maps aren't refcounted). Maybe we need to shovel those interfaces into a drm_legacy.ko module to keep them around but make sure that no new driver even thinks about using them. - There's also the matter of the vblank support code, imo that should be split int a ums and a kms part. That'd would allow us to use struct drm_crtc * in interfaces and proper locking (by grabbing crtc->mutex to exclude races with dpms/modesets). If anyone wants to dig around in those areas please poke me. Cheers, Daniel Daniel Vetter (39): drm: remove drm_modctx ioctl and use drm_noop instead drm: kill dev->context_wait drm: remove dev->last_switch drm: kill dev->interrupt_flag and dev->dma_flag drm: kill dev->ctx_start and dev->lck_start drm/radoen: kill radeon_dma_ioctl_kms drm: kill dev->buf_readers and dev->buf_writers drm: remove redundant clears from drm_setup drm/omap: kill firstopen callback drm/radeon: kill firstopen callback for kms driver drm/imx: kill firstopen callback drm/vmwgfx: remove ->firstopen callback drm: don't call ->firstopen for KMS drivers drm: kill dev->driver->set_version drm/radeon: remove DRIVER_HAS_DMA/SG/PCI_DMA from the kms driver drm: fold in drm_sg_alloc into the ioctl drm: hide legacy sg cleanup better from common code drm: disallow legacy sg ioctls for modesetting drivers drm: mark dma setup/teardown as legacy systems drm/nouveau: drop DRIVER_PCI_DMA and DRIVER_SG drm: disallow legacy dma ioctls for modesetting drivers drm: move drm_getsarea into drm_bufs.c drm/bufs: s/drm_order/order_base_2/ drm/r128: s/drm_order/order_base_2/ drm/radeon: s/drm_order/order_base_2/ drm: remove drm_order drm: mark context support as a legacy subsystem drm/vmwgfx: remove redundant clearing of driver->dma_quiescent drm: remove FASYNC support drm: rip out DRIVER_FB_DMA and related code drm: rip out a few unused DRIVER flags drm: remove a bunch of unused #defines from drmP.h drm: rip out drm_core_has_MTRR checks drm: remove the dma_ioctl special-case drm/memory: don't export agp helpers drm: hollow-out GET_CLIENT ioctl drm: no-op out GET_STATS ioctl drm: fix locking in gem debugfs/procfs file drm: remove procfs code, take 2 drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/ast/ast_drv.c| 1 - drivers/gpu/drm/cirrus/cirrus_drv.c | 1 - drivers/gpu/drm/drm_bufs.c | 238 +++ drivers/gpu/drm/drm_context.c| 81 --- drivers/gp
[PATCH 01/39] drm: remove drm_modctx ioctl and use drm_noop instead
It doesn't do anything, so kill the code. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_context.c | 6 -- drivers/gpu/drm/drm_drv.c | 2 +- include/drm/drmP.h| 2 -- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index 725968d..6f9731f 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -342,12 +342,6 @@ int drm_addctx(struct drm_device *dev, void *data, return 0; } -int drm_modctx(struct drm_device *dev, void *data, struct drm_file *file_priv) -{ - /* This does nothing */ - return 0; -} - /** * Get context. * diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 99fcd7c..d668011 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -87,7 +87,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_ADD_CTX, drm_addctx, DRM_AUTH|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_RM_CTX, drm_rmctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF(DRM_IOCTL_MOD_CTX, drm_modctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_MOD_CTX, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_GET_CTX, drm_getctx, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_SWITCH_CTX, drm_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_NEW_CTX, drm_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 12083dc..523e5f2 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1335,8 +1335,6 @@ extern int drm_resctx(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_addctx(struct drm_device *dev, void *data, struct drm_file *file_priv); -extern int drm_modctx(struct drm_device *dev, void *data, - struct drm_file *file_priv); extern int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_switchctx(struct drm_device *dev, void *data, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 02/39] drm: kill dev->context_wait
No one ever waits on this waitqueue, so the wake_up call is wasted. Remove it all. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_context.c | 1 - drivers/gpu/drm/drm_fops.c| 1 - include/drm/drmP.h| 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index 6f9731f..5cc17f3 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -261,7 +261,6 @@ static int drm_context_switch_complete(struct drm_device *dev, when the kernel holds the lock, release that lock here. */ clear_bit(0, &dev->context_flag); - wake_up(&dev->context_wait); return 0; } diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 3a24385..0dcbbdb 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -81,7 +81,6 @@ static int drm_setup(struct drm_device * dev) dev->last_context = 0; dev->last_switch = 0; dev->last_checked = 0; - init_waitqueue_head(&dev->context_wait); dev->if_version = 0; dev->ctx_start = 0; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 523e5f2..4499133 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1133,7 +1133,6 @@ struct drm_device { __volatile__ long context_flag; /**< Context swapping flag */ __volatile__ long interrupt_flag; /**< Interruption handler flag */ __volatile__ long dma_flag; /**< DMA dispatch flag */ - wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ int last_checked; /**< Last context checked for DMA */ int last_context; /**< Last current context */ unsigned long last_switch; /**< jiffies at last context switch */ -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 03/39] drm: remove dev->last_switch
Only ever assigned in the context code for real, with no readers anywhere. Remove it. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_context.c | 1 - drivers/gpu/drm/drm_fops.c| 1 - include/drm/drmP.h| 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index 5cc17f3..224ff96 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -251,7 +251,6 @@ static int drm_context_switch_complete(struct drm_device *dev, struct drm_file *file_priv, int new) { dev->last_context = new;/* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) { DRM_ERROR("Lock isn't held after context switch\n"); diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 0dcbbdb..c14fdc1 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -79,7 +79,6 @@ static int drm_setup(struct drm_device * dev) dev->interrupt_flag = 0; dev->dma_flag = 0; dev->last_context = 0; - dev->last_switch = 0; dev->last_checked = 0; dev->if_version = 0; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 4499133..089e820 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1135,7 +1135,6 @@ struct drm_device { __volatile__ long dma_flag; /**< DMA dispatch flag */ int last_checked; /**< Last context checked for DMA */ int last_context; /**< Last current context */ - unsigned long last_switch; /**< jiffies at last context switch */ /*@} */ struct work_struct work; -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 04/39] drm: kill dev->interrupt_flag and dev->dma_flag
Completely unused, so just remove them. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_fops.c | 2 -- include/drm/drmP.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index c14fdc1..386c304 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -76,8 +76,6 @@ static int drm_setup(struct drm_device * dev) dev->sigdata.lock = NULL; dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; dev->last_context = 0; dev->last_checked = 0; dev->if_version = 0; diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 089e820..1ec806f 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1131,8 +1131,6 @@ struct drm_device { /*@{ */ int irq_enabled;/**< True if irq handler is enabled */ __volatile__ long context_flag; /**< Context swapping flag */ - __volatile__ long interrupt_flag; /**< Interruption handler flag */ - __volatile__ long dma_flag; /**< DMA dispatch flag */ int last_checked; /**< Last context checked for DMA */ int last_context; /**< Last current context */ /*@} */ -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 05/39] drm: kill dev->ctx_start and dev->lck_start
Again completely unused, so just remove it. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_fops.c | 3 --- include/drm/drmP.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 386c304..a3714a0 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -80,9 +80,6 @@ static int drm_setup(struct drm_device * dev) dev->last_checked = 0; dev->if_version = 0; - dev->ctx_start = 0; - dev->lck_start = 0; - dev->buf_async = NULL; init_waitqueue_head(&dev->buf_readers); init_waitqueue_head(&dev->buf_writers); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 1ec806f..0403695 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1170,8 +1170,6 @@ struct drm_device { spinlock_t event_lock; /*@} */ - cycles_t ctx_start; - cycles_t lck_start; struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ wait_queue_head_t buf_readers; /**< Processes waiting to read */ -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 06/39] drm/radoen: kill radeon_dma_ioctl_kms
No need to create a dummy ioctl function to return -EINVAL, since that's what the core already does in the absence of the dma_ioctl callback. So we can safely remove this. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/radeon/radeon_drv.c | 3 --- drivers/gpu/drm/radeon/radeon_kms.c | 10 -- 2 files changed, 13 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index e5419b3..c07b681 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -101,8 +101,6 @@ 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); -int radeon_dma_ioctl_kms(struct drm_device *dev, void *data, -struct drm_file *file_priv); int radeon_gem_object_init(struct drm_gem_object *obj); void radeon_gem_object_free(struct drm_gem_object *obj); int radeon_gem_object_open(struct drm_gem_object *obj, @@ -417,7 +415,6 @@ static struct drm_driver kms_driver = { .gem_free_object = radeon_gem_object_free, .gem_open_object = radeon_gem_object_open, .gem_close_object = radeon_gem_object_close, - .dma_ioctl = radeon_dma_ioctl_kms, .dumb_create = radeon_mode_dumb_create, .dumb_map_offset = radeon_mode_dumb_mmap, .dumb_destroy = radeon_mode_dumb_destroy, diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 49ff3d1..07b0236 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -683,16 +683,6 @@ int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, drmcrtc); } -/* - * IOCTL. - */ -int radeon_dma_ioctl_kms(struct drm_device *dev, void *data, -struct drm_file *file_priv) -{ - /* Not valid in KMS. */ - return -EINVAL; -} - #define KMS_INVALID_IOCTL(name) \ int name(struct drm_device *dev, void *data, struct drm_file *file_priv)\ { \ -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 07/39] drm: kill dev->buf_readers and dev->buf_writers
Again totally unused, so just remove them. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_fops.c | 2 -- include/drm/drmP.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index a3714a0..57e3014 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -81,8 +81,6 @@ static int drm_setup(struct drm_device * dev) dev->if_version = 0; dev->buf_async = NULL; - init_waitqueue_head(&dev->buf_readers); - init_waitqueue_head(&dev->buf_writers); DRM_DEBUG("\n"); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 0403695..6cde924 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1172,8 +1172,6 @@ struct drm_device { /*@} */ struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ - wait_queue_head_t buf_readers; /**< Processes waiting to read */ - wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ struct drm_agp_head *agp; /**< AGP data */ -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 08/39] drm: remove redundant clears from drm_setup
We kzalloc the driver node at init time, so no need to do this again. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_fops.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 57e3014..9610997 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -73,15 +73,6 @@ static int drm_setup(struct drm_device * dev) for (i = 0; i < ARRAY_SIZE(dev->counts); i++) atomic_set(&dev->counts[i], 0); - dev->sigdata.lock = NULL; - - dev->context_flag = 0; - dev->last_context = 0; - dev->last_checked = 0; - dev->if_version = 0; - - dev->buf_async = NULL; - DRM_DEBUG("\n"); /* -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 09/39] drm/omap: kill firstopen callback
KMS drivers really shouldn't need to do anything on firstopen, so kill empty callbacks. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/omapdrm/omap_drv.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 826586f..3f7c78a 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -509,12 +509,6 @@ static int dev_open(struct drm_device *dev, struct drm_file *file) return 0; } -static int dev_firstopen(struct drm_device *dev) -{ - DBG("firstopen: dev=%p", dev); - return 0; -} - /** * lastclose - clean up after all DRM clients have exited * @dev: DRM device @@ -594,7 +588,6 @@ static struct drm_driver omap_drm_driver = { .load = dev_load, .unload = dev_unload, .open = dev_open, - .firstopen = dev_firstopen, .lastclose = dev_lastclose, .preclose = dev_preclose, .postclose = dev_postclose, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 10/39] drm/radeon: kill firstopen callback for kms driver
Again, it does nothing. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/radeon/radeon_drv.c | 2 -- drivers/gpu/drm/radeon/radeon_kms.c | 13 - 2 files changed, 15 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index c07b681..1c2584f 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -81,7 +81,6 @@ #define KMS_DRIVER_PATCHLEVEL 0 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); int radeon_driver_unload_kms(struct drm_device *dev); -int radeon_driver_firstopen_kms(struct drm_device *dev); void radeon_driver_lastclose_kms(struct drm_device *dev); int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv); void radeon_driver_postclose_kms(struct drm_device *dev, @@ -389,7 +388,6 @@ static struct drm_driver kms_driver = { DRIVER_PRIME, .dev_priv_size = 0, .load = radeon_driver_load_kms, - .firstopen = radeon_driver_firstopen_kms, .open = radeon_driver_open_kms, .preclose = radeon_driver_preclose_kms, .postclose = radeon_driver_postclose_kms, diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 07b0236..bd6f1e8 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -449,19 +449,6 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) * Outdated mess for old drm with Xorg being in charge (void function now). */ /** - * radeon_driver_firstopen_kms - drm callback for first open - * - * @dev: drm dev pointer - * - * Nothing to be done for KMS (all asics). - * Returns 0 on success. - */ -int radeon_driver_firstopen_kms(struct drm_device *dev) -{ - return 0; -} - -/** * radeon_driver_firstopen_kms - drm callback for last close * * @dev: drm dev pointer -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 11/39] drm/imx: kill firstopen callback
This thing seems to do some kind of delayed setup. Really, real kms drivers shouldn't do that at all. Either stuff needs to be dynamically hotplugged or the driver setup sequence needs to be fixed. This patch here just moves the setup at the very end of the driver load callback, with the locking adjusted accordingly. v2: Also move the corresponding put from ->lastclose to ->unload. Cc: Sascha Hauer Cc: Greg Kroah-Hartman Signed-off-by: Daniel Vetter --- drivers/staging/imx-drm/imx-drm-core.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 6455305..70f9650 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c @@ -69,28 +69,20 @@ struct imx_drm_connector { struct module *owner; }; -static int imx_drm_driver_firstopen(struct drm_device *drm) -{ - if (!imx_drm_device_get()) - return -EINVAL; - - return 0; -} - static void imx_drm_driver_lastclose(struct drm_device *drm) { struct imx_drm_device *imxdrm = drm->dev_private; if (imxdrm->fbhelper) drm_fbdev_cma_restore_mode(imxdrm->fbhelper); - - imx_drm_device_put(); } static int imx_drm_driver_unload(struct drm_device *drm) { struct imx_drm_device *imxdrm = drm->dev_private; + imx_drm_device_put(); + drm_mode_config_cleanup(imxdrm->drm); drm_kms_helper_poll_fini(imxdrm->drm); @@ -226,8 +218,6 @@ struct drm_device *imx_drm_device_get(void) struct imx_drm_connector *con; struct imx_drm_crtc *crtc; - mutex_lock(&imxdrm->mutex); - list_for_each_entry(enc, &imxdrm->encoder_list, list) { if (!try_module_get(enc->owner)) { dev_err(imxdrm->dev, "could not get module %s\n", @@ -254,8 +244,6 @@ struct drm_device *imx_drm_device_get(void) imxdrm->references++; - mutex_unlock(&imxdrm->mutex); - return imxdrm->drm; unwind_crtc: @@ -447,6 +435,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) */ imxdrm->drm->vblank_disable_allowed = 1; + if (!imx_drm_device_get()) + ret = -EINVAL; + ret = 0; err_init: @@ -794,7 +785,6 @@ static struct drm_driver imx_drm_driver = { .driver_features= DRIVER_MODESET | DRIVER_GEM, .load = imx_drm_driver_load, .unload = imx_drm_driver_unload, - .firstopen = imx_drm_driver_firstopen, .lastclose = imx_drm_driver_lastclose, .gem_free_object= drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 12/39] drm/vmwgfx: remove ->firstopen callback
So if we survey kms drivers there's a bunch of things they commonly do in ->lastclose - delayed processing of vga switcheroo requests (i915, nouveau, radeon) - force-restoring the fbcon (most) - resetting a bunch properties to make fbcon work better (omap) - disabling all outputs (vmwgfx) In short besides the semantically important vga switcheroo stuff they all try very hard to keep fbcon working in case X dies. But none of them try to not do this at driver unload time safe for vmwgfx, and digging through logs I couldn't find any reason for why vmwgfx is special. Since ->firstopen has lots of potential for abuse with kms drivers (like delaying driver setup to pamper over races in the load sequence) it's imo very much worth it to remove this logic so that we can stop using the ->firstopen callback for kms drivers. Also module unloading is rather a debug feature and developers should know how to restore the display to a sane configuration. Cc: Jakob Bornecrantz Signed-off-by: Daniel Vetter --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 18 -- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 - 2 files changed, 19 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 78e2164..3e43578 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -795,29 +795,12 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd, return drm_ioctl(filp, cmd, arg); } -static int vmw_firstopen(struct drm_device *dev) -{ - struct vmw_private *dev_priv = vmw_priv(dev); - dev_priv->is_opened = true; - - return 0; -} - static void vmw_lastclose(struct drm_device *dev) { - struct vmw_private *dev_priv = vmw_priv(dev); struct drm_crtc *crtc; struct drm_mode_set set; int ret; - /** -* Do nothing on the lastclose call from drm_unload. -*/ - - if (!dev_priv->is_opened) - return; - - dev_priv->is_opened = false; set.x = 0; set.y = 0; set.fb = NULL; @@ -1132,7 +1115,6 @@ static struct drm_driver driver = { DRIVER_MODESET, .load = vmw_driver_load, .unload = vmw_driver_unload, - .firstopen = vmw_firstopen, .lastclose = vmw_lastclose, .irq_preinstall = vmw_irq_preinstall, .irq_postinstall = vmw_irq_postinstall, diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 13aeda7..150ec64 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h @@ -324,7 +324,6 @@ struct vmw_private { */ bool stealth; - bool is_opened; bool enable_fb; /** -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 13/39] drm: don't call ->firstopen for KMS drivers
It has way too much potential for driver writers to do stupid things like delayed hw setup because the load sequence is somehow racy (e.g. the imx driver in staging). So don't call it for modesetting drivers, which reduces the complexity of the drm core -> driver interface a notch. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_fops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 9610997..ad58d32 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -51,7 +51,8 @@ static int drm_setup(struct drm_device * dev) int i; int ret; - if (dev->driver->firstopen) { + if (dev->driver->firstopen && + !drm_core_check_feature(dev, DRIVER_MODESET)) { ret = dev->driver->firstopen(dev); if (ret != 0) return ret; -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 14/39] drm: kill dev->driver->set_version
Totally unused, so just rip it out. Anyway, we want drivers to be fully backwards compatible, allowing them to change behaviour is just a recipe for them to break badly. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_ioctl.c | 3 --- include/drm/drmP.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index ffd7a7b..0acf080 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -352,9 +352,6 @@ int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_pri retcode = -EINVAL; goto done; } - - if (dev->driver->set_version) - dev->driver->set_version(dev, sv); } done: diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 6cde924..4a3b23f 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -885,8 +885,6 @@ struct drm_driver { void (*irq_preinstall) (struct drm_device *dev); int (*irq_postinstall) (struct drm_device *dev); void (*irq_uninstall) (struct drm_device *dev); - void (*set_version) (struct drm_device *dev, -struct drm_set_version *sv); /* Master routines */ int (*master_create)(struct drm_device *dev, struct drm_master *master); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 15/39] drm/radeon: remove DRIVER_HAS_DMA/SG/PCI_DMA from the kms driver
Really, this is all old-style stuff and just copy-pasta from the ums driver. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/radeon/radeon_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 1c2584f..81b9baa 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -383,8 +383,8 @@ static const struct file_operations radeon_driver_kms_fops = { static struct drm_driver kms_driver = { .driver_features = - DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | - DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED | DRIVER_GEM | + DRIVER_USE_AGP | DRIVER_USE_MTRR | + DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME, .dev_priv_size = 0, .load = radeon_driver_load_kms, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 16/39] drm: fold in drm_sg_alloc into the ioctl
There's no other caller from driver code, so we can fold this in. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_drv.c | 2 +- drivers/gpu/drm/drm_scatter.c | 13 +++-- include/drm/drmP.h| 3 +-- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index d668011..5993bfc 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -122,7 +122,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_AGP_UNBIND, drm_agp_unbind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), #endif - DRM_IOCTL_DEF(DRM_IOCTL_SG_ALLOC, drm_sg_alloc_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF(DRM_IOCTL_SG_ALLOC, drm_sg_alloc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_SG_FREE, drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF(DRM_IOCTL_WAIT_VBLANK, drm_wait_vblank, DRM_UNLOCKED), diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c index d87f60b..a4a076f 100644 --- a/drivers/gpu/drm/drm_scatter.c +++ b/drivers/gpu/drm/drm_scatter.c @@ -70,8 +70,10 @@ void drm_sg_cleanup(struct drm_sg_mem * entry) # define ScatterHandle(x) (unsigned int)(x) #endif -int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request) +int drm_sg_alloc(struct drm_device *dev, void *data, +struct drm_file *file_priv) { + struct drm_scatter_gather *request = data; struct drm_sg_mem *entry; unsigned long pages, i, j; @@ -181,15 +183,6 @@ int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request) return -ENOMEM; } -int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - struct drm_scatter_gather *request = data; - - return drm_sg_alloc(dev, request); - -} - int drm_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv) { diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 4a3b23f..fb03933 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1565,9 +1565,8 @@ extern int drm_vma_info(struct seq_file *m, void *data); /* Scatter Gather Support (drm_scatter.h) */ extern void drm_sg_cleanup(struct drm_sg_mem * entry); -extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, +extern int drm_sg_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv); -extern int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request); extern int drm_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 18/39] drm: disallow legacy sg ioctls for modesetting drivers
Only the radeon/r128/ati ums drivers use this. Furthermore the cleanup was already only done for UMS drivers. Also a quick check of the ATI ddx git history shows that only the UMS code ever used this facility. So we can safely disallow these pair of ioctls for modesetting drivers. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_scatter.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c index dd8a648..1c78406 100644 --- a/drivers/gpu/drm/drm_scatter.c +++ b/drivers/gpu/drm/drm_scatter.c @@ -87,6 +87,9 @@ int drm_sg_alloc(struct drm_device *dev, void *data, DRM_DEBUG("\n"); + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; @@ -197,6 +200,9 @@ int drm_sg_free(struct drm_device *dev, void *data, struct drm_scatter_gather *request = data; struct drm_sg_mem *entry; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL; -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 17/39] drm: hide legacy sg cleanup better from common code
I've decided that some clear markers for what's legacy dri1/non-gem code is useful. I've opted to use the drm_legacy prefix and then hide all the checks in that function for better readability in the common code. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_drv.c | 7 ++- drivers/gpu/drm/drm_scatter.c | 10 +- include/drm/drmP.h| 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 5993bfc..4817546 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -216,11 +216,8 @@ int drm_lastclose(struct drm_device * dev) dev->agp->acquired = 0; dev->agp->enabled = 0; } - if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg && - !drm_core_check_feature(dev, DRIVER_MODESET)) { - drm_sg_cleanup(dev->sg); - dev->sg = NULL; - } + + drm_legacy_sg_cleanup(dev); /* Clear vma list (only built for debugging) */ list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) { diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c index a4a076f..dd8a648 100644 --- a/drivers/gpu/drm/drm_scatter.c +++ b/drivers/gpu/drm/drm_scatter.c @@ -46,7 +46,7 @@ static inline void *drm_vmalloc_dma(unsigned long size) #endif } -void drm_sg_cleanup(struct drm_sg_mem * entry) +static void drm_sg_cleanup(struct drm_sg_mem * entry) { struct page *page; int i; @@ -64,6 +64,14 @@ void drm_sg_cleanup(struct drm_sg_mem * entry) kfree(entry); } +void drm_legacy_sg_cleanup(struct drm_device *dev) +{ + if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg && + !drm_core_check_feature(dev, DRIVER_MODESET)) { + drm_sg_cleanup(dev->sg); + dev->sg = NULL; + } +} #ifdef _LP64 # define ScatterHandle(x) (unsigned int)((x >> 32) + (x & ((1L << 32) - 1))) #else diff --git a/include/drm/drmP.h b/include/drm/drmP.h index fb03933..0fe9a08 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1564,7 +1564,7 @@ extern int drm_vma_info(struct seq_file *m, void *data); #endif /* Scatter Gather Support (drm_scatter.h) */ -extern void drm_sg_cleanup(struct drm_sg_mem * entry); +extern void drm_legacy_sg_cleanup(struct drm_device *dev); extern int drm_sg_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_sg_free(struct drm_device *dev, void *data, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 19/39] drm: mark dma setup/teardown as legacy systems
And hide the checks a bit better. This was already disallowed for modesetting drivers, so no functinal change here. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_dma.c | 17 +++-- drivers/gpu/drm/drm_drv.c | 4 +--- drivers/gpu/drm/drm_fops.c | 12 +++- include/drm/drmP.h | 4 ++-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c index 495b5fd..8a140a9 100644 --- a/drivers/gpu/drm/drm_dma.c +++ b/drivers/gpu/drm/drm_dma.c @@ -44,10 +44,18 @@ * * Allocate and initialize a drm_device_dma structure. */ -int drm_dma_setup(struct drm_device *dev) +int drm_legacy_dma_setup(struct drm_device *dev) { int i; + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || + drm_core_check_feature(dev, DRIVER_MODESET)) { + return 0; + } + + dev->buf_use = 0; + atomic_set(&dev->buf_alloc, 0); + dev->dma = kzalloc(sizeof(*dev->dma), GFP_KERNEL); if (!dev->dma) return -ENOMEM; @@ -66,11 +74,16 @@ int drm_dma_setup(struct drm_device *dev) * Free all pages associated with DMA buffers, the buffers and pages lists, and * finally the drm_device::dma structure itself. */ -void drm_dma_takedown(struct drm_device *dev) +void drm_legacy_dma_takedown(struct drm_device *dev) { struct drm_device_dma *dma = dev->dma; int i, j; + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA) || + drm_core_check_feature(dev, DRIVER_MODESET)) { + return; + } + if (!dma) return; diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 4817546..5087cfb 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -225,9 +225,7 @@ int drm_lastclose(struct drm_device * dev) kfree(vma); } - if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && - !drm_core_check_feature(dev, DRIVER_MODESET)) - drm_dma_takedown(dev); + drm_legacy_dma_takedown(dev); dev->dev_mapping = NULL; mutex_unlock(&dev->struct_mutex); diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index ad58d32..b293b60 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -61,15 +61,9 @@ static int drm_setup(struct drm_device * dev) atomic_set(&dev->ioctl_count, 0); atomic_set(&dev->vma_count, 0); - if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && - !drm_core_check_feature(dev, DRIVER_MODESET)) { - dev->buf_use = 0; - atomic_set(&dev->buf_alloc, 0); - - i = drm_dma_setup(dev); - if (i < 0) - return i; - } + i = drm_legacy_dma_setup(dev); + if (i < 0) + return i; for (i = 0; i < ARRAY_SIZE(dev->counts); i++) atomic_set(&dev->counts[i], 0); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 0fe9a08..60307d1 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1396,8 +1396,8 @@ extern int drm_mapbufs(struct drm_device *dev, void *data, extern int drm_order(unsigned long size); /* DMA support (drm_dma.h) */ -extern int drm_dma_setup(struct drm_device *dev); -extern void drm_dma_takedown(struct drm_device *dev); +extern int drm_legacy_dma_setup(struct drm_device *dev); +extern void drm_legacy_dma_takedown(struct drm_device *dev); extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf); extern void drm_core_reclaim_buffers(struct drm_device *dev, struct drm_file *filp); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 20/39] drm/nouveau: drop DRIVER_PCI_DMA and DRIVER_SG
The former doesn't do anything without DRIVER_HAVE_DMA (which is force-disabled for kms drivers anyway). The latter isn't used by the (kms) nouveau ddx. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 218a4b5..e990327 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -675,7 +675,7 @@ nouveau_driver_fops = { static struct drm_driver driver = { .driver_features = - DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG | + DRIVER_USE_AGP | DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME, .load = nouveau_drm_load, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 21/39] drm: disallow legacy dma ioctls for modesetting drivers
Now only legacy ums drivers have the DRIVER_HAVE_DMA driver feature flag set, so strictly speaking the modesetting check is redundant. But adding it has the upside that it makes it very clear that the dma support is legacy stuff. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 5a4dbb4..2e560c2 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1305,6 +1305,9 @@ int drm_addbufs(struct drm_device *dev, void *data, struct drm_buf_desc *request = data; int ret; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; @@ -1348,6 +1351,9 @@ int drm_infobufs(struct drm_device *dev, void *data, int i; int count; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; @@ -1427,6 +1433,9 @@ int drm_markbufs(struct drm_device *dev, void *data, int order; struct drm_buf_entry *entry; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; @@ -1472,6 +1481,9 @@ int drm_freebufs(struct drm_device *dev, void *data, int idx; struct drm_buf *buf; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; @@ -1524,6 +1536,9 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_buf_map *request = data; int i; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 22/39] drm: move drm_getsarea into drm_bufs.c
It fiddles the sarea out of the maps which are also handled in drm_bufs.c With this drm_drv.c is a notch more legacy free. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 14 ++ drivers/gpu/drm/drm_drv.c | 15 --- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 2e560c2..6a0ff32 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1615,6 +1615,20 @@ int drm_mapbufs(struct drm_device *dev, void *data, return retcode; } +struct drm_local_map *drm_getsarea(struct drm_device *dev) +{ + struct drm_map_list *entry; + + list_for_each_entry(entry, &dev->maplist, head) { + if (entry->map && entry->map->type == _DRM_SHM && + (entry->map->flags & _DRM_CONTAINS_LOCK)) { + return entry->map; + } + } + return NULL; +} +EXPORT_SYMBOL(drm_getsarea); + /** * Compute size order. Returns the exponent of the smaller power of two which * is greater or equal to given number. diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 5087cfb..f2495e1 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -480,19 +480,4 @@ long drm_ioctl(struct file *filp, DRM_DEBUG("ret = %d\n", retcode); return retcode; } - EXPORT_SYMBOL(drm_ioctl); - -struct drm_local_map *drm_getsarea(struct drm_device *dev) -{ - struct drm_map_list *entry; - - list_for_each_entry(entry, &dev->maplist, head) { - if (entry->map && entry->map->type == _DRM_SHM && - (entry->map->flags & _DRM_CONTAINS_LOCK)) { - return entry->map; - } - } - return NULL; -} -EXPORT_SYMBOL(drm_getsarea); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 23/39] drm/bufs: s/drm_order/order_base_2/
The version offered by the core is ridiculously optimized and does the same thing. So use it. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 6a0ff32..31a971d 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -243,7 +243,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, } map->handle = vmalloc_user(map->size); DRM_DEBUG("%lu %d %p\n", - map->size, drm_order(map->size), map->handle); + map->size, order_base_2(map->size), map->handle); if (!map->handle) { kfree(map); return -ENOMEM; @@ -630,7 +630,7 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) return -EINVAL; count = request->count; - order = drm_order(request->size); + order = order_base_2(request->size); size = 1 << order; alignment = (request->flags & _DRM_PAGE_ALIGN) @@ -800,7 +800,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) return -EPERM; count = request->count; - order = drm_order(request->size); + order = order_base_2(request->size); size = 1 << order; DRM_DEBUG("count=%d, size=%d (%d), order=%d\n", @@ -1002,7 +1002,7 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request return -EPERM; count = request->count; - order = drm_order(request->size); + order = order_base_2(request->size); size = 1 << order; alignment = (request->flags & _DRM_PAGE_ALIGN) @@ -1157,7 +1157,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request return -EPERM; count = request->count; - order = drm_order(request->size); + order = order_base_2(request->size); size = 1 << order; alignment = (request->flags & _DRM_PAGE_ALIGN) @@ -1444,7 +1444,7 @@ int drm_markbufs(struct drm_device *dev, void *data, DRM_DEBUG("%d, %d, %d\n", request->size, request->low_mark, request->high_mark); - order = drm_order(request->size); + order = order_base_2(request->size); if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; entry = &dma->bufs[order]; -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 24/39] drm/r128: s/drm_order/order_base_2/
Again just use the version provided by the linux core. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/r128/r128_cce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c index d4660cf..c451257 100644 --- a/drivers/gpu/drm/r128/r128_cce.c +++ b/drivers/gpu/drm/r128/r128_cce.c @@ -540,7 +540,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init) dev_priv->ring.end = ((u32 *) dev_priv->cce_ring->handle + init->ring_size / sizeof(u32)); dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = drm_order(init->ring_size / 8); + dev_priv->ring.size_l2qw = order_base_2(init->ring_size / 8); dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 25/39] drm/radeon: s/drm_order/order_base_2/
Last driver and pretty obviously a major user of this little function. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/radeon/cik.c | 14 +++--- drivers/gpu/drm/radeon/evergreen.c | 4 ++-- drivers/gpu/drm/radeon/ni.c| 6 +++--- drivers/gpu/drm/radeon/r100.c | 2 +- drivers/gpu/drm/radeon/r600.c | 14 +++--- drivers/gpu/drm/radeon/r600_cp.c | 6 +++--- drivers/gpu/drm/radeon/radeon_cp.c | 6 +++--- drivers/gpu/drm/radeon/si.c| 14 +++--- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index ed1d910..1a8aa89 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -2546,8 +2546,8 @@ static int cik_cp_gfx_resume(struct radeon_device *rdev) /* ring 0 - compute and gfx */ /* Set ring buffer size */ ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX]; - rb_bufsz = drm_order(ring->ring_size / 8); - tmp = (drm_order(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; + rb_bufsz = order_base_2(ring->ring_size / 8); + tmp = (order_base_2(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; #ifdef __BIG_ENDIAN tmp |= BUF_SWAP_32BIT; #endif @@ -2926,7 +2926,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) /* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */ tmp = RREG32(CP_HPD_EOP_CONTROL); tmp &= ~EOP_SIZE_MASK; - tmp |= drm_order(MEC_HPD_SIZE / 8); + tmp |= order_base_2(MEC_HPD_SIZE / 8); WREG32(CP_HPD_EOP_CONTROL, tmp); } cik_srbm_select(rdev, 0, 0, 0, 0); @@ -3041,9 +3041,9 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) ~(QUEUE_SIZE_MASK | RPTR_BLOCK_SIZE_MASK); mqd->queue_state.cp_hqd_pq_control |= - drm_order(rdev->ring[idx].ring_size / 8); + order_base_2(rdev->ring[idx].ring_size / 8); mqd->queue_state.cp_hqd_pq_control |= - (drm_order(RADEON_GPU_PAGE_SIZE/8) << 8); + (order_base_2(RADEON_GPU_PAGE_SIZE/8) << 8); #ifdef __BIG_ENDIAN mqd->queue_state.cp_hqd_pq_control |= BUF_SWAP_32BIT; #endif @@ -3386,7 +3386,7 @@ static int cik_sdma_gfx_resume(struct radeon_device *rdev) WREG32(SDMA0_SEM_WAIT_FAIL_TIMER_CNTL + reg_offset, 0); /* Set ring buffer size in dwords */ - rb_bufsz = drm_order(ring->ring_size / 4); + rb_bufsz = order_base_2(ring->ring_size / 4); rb_cntl = rb_bufsz << 1; #ifdef __BIG_ENDIAN rb_cntl |= SDMA_RB_SWAP_ENABLE | SDMA_RPTR_WRITEBACK_SWAP_ENABLE; @@ -5018,7 +5018,7 @@ static int cik_irq_init(struct radeon_device *rdev) WREG32(INTERRUPT_CNTL, interrupt_cntl); WREG32(IH_RB_BASE, rdev->ih.gpu_addr >> 8); - rb_bufsz = drm_order(rdev->ih.ring_size / 4); + rb_bufsz = order_base_2(rdev->ih.ring_size / 4); ih_rb_cntl = (IH_WPTR_OVERFLOW_ENABLE | IH_WPTR_OVERFLOW_CLEAR | diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index e49059d..b4b5620 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c @@ -2879,8 +2879,8 @@ static int evergreen_cp_resume(struct radeon_device *rdev) RREG32(GRBM_SOFT_RESET); /* Set ring buffer size */ - rb_bufsz = drm_order(ring->ring_size / 8); - tmp = (drm_order(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; + rb_bufsz = order_base_2(ring->ring_size / 8); + tmp = (order_base_2(RADEON_GPU_PAGE_SIZE/8) << 8) | rb_bufsz; #ifdef __BIG_ENDIAN tmp |= BUF_SWAP_32BIT; #endif diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index f30127c..fd9a583 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c @@ -1571,8 +1571,8 @@ static int cayman_cp_resume(struct radeon_device *rdev) /* Set ring buffer size */ ring = &rdev->ring[ridx[i]]; - rb_cntl = drm_order(ring->ring_size / 8); - rb_cntl |= drm_order(RADEON_GPU_PAGE_SIZE/8) << 8; + rb_cntl = order_base_2(ring->ring_size / 8); + rb_cntl |= order_base_2(RADEON_GPU_PAGE_SIZE/8) << 8; #ifdef __BIG_ENDIAN rb_cntl |= BUF_SWAP_32BIT; #endif @@ -1731,7 +1731,7 @@ int cayman_dma_resume(struct radeon_device *rdev) WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL + reg_offset, 0); /* Set ring buffer size in dwords */ - rb_bufsz = drm_order(ring->ring_size / 4); + rb_bufsz = order_base_2(ring->ring_size / 4); rb_cntl = rb_bufsz << 1; #ifdef __BIG_ENDIAN rb_cntl |= DMA_RB_SWAP_ENABLE | DMA_RPTR_WRITEBACK_SWAP_ENABLE; diff --git a/drivers/gpu/drm
[PATCH 26/39] drm: remove drm_order
All users of it are now gone! Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 23 --- include/drm/drmP.h | 1 - 2 files changed, 24 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 31a971d..25f 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1628,26 +1628,3 @@ struct drm_local_map *drm_getsarea(struct drm_device *dev) return NULL; } EXPORT_SYMBOL(drm_getsarea); - -/** - * Compute size order. Returns the exponent of the smaller power of two which - * is greater or equal to given number. - * - * \param size size. - * \return order. - * - * \todo Can be made faster. - */ -int drm_order(unsigned long size) -{ - int order; - unsigned long tmp; - - for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) ; - - if (size & (size - 1)) - ++order; - - return order; -} -EXPORT_SYMBOL(drm_order); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 60307d1..a483ba7 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1393,7 +1393,6 @@ extern int drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv); -extern int drm_order(unsigned long size); /* DMA support (drm_dma.h) */ extern int drm_legacy_dma_setup(struct drm_device *dev); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 27/39] drm: mark context support as a legacy subsystem
So after a lot of digging around in git histories it looks like this has only ever be used by dri1 render clients. Hence we can fully disable the entire thing for modesetting drivers and so greatly reduce the attack surface for potential exploits (or at least tools like trinity ...). Also add the drm_legacy prefix for functions which are called from common code. To further reduce the impact on common code also extract all the ctx release handling into a function (instead of only releasing individual handles) and make ctxbitmap_cleanup return void - it can never fail. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_context.c | 73 ++- drivers/gpu/drm/drm_fops.c| 21 + drivers/gpu/drm/drm_stub.c| 10 ++ include/drm/drmP.h| 7 +++-- 4 files changed, 72 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c index 224ff96..b4fb86d 100644 --- a/drivers/gpu/drm/drm_context.c +++ b/drivers/gpu/drm/drm_context.c @@ -42,10 +42,6 @@ #include -/**/ -/** \name Context bitmap support */ -/*@{*/ - /** * Free a handle from the context bitmap. * @@ -56,13 +52,48 @@ * in drm_device::ctx_idr, while holding the drm_device::struct_mutex * lock. */ -void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle) +static void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle) { + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return; + mutex_lock(&dev->struct_mutex); idr_remove(&dev->ctx_idr, ctx_handle); mutex_unlock(&dev->struct_mutex); } +/**/ +/** \name Context bitmap support */ +/*@{*/ + +void drm_legacy_ctxbitmap_release(struct drm_device *dev, + struct drm_file *file_priv) +{ + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return; + + mutex_lock(&dev->ctxlist_mutex); + if (!list_empty(&dev->ctxlist)) { + struct drm_ctx_list *pos, *n; + + list_for_each_entry_safe(pos, n, &dev->ctxlist, head) { + if (pos->tag == file_priv && + pos->handle != DRM_KERNEL_CONTEXT) { + if (dev->driver->context_dtor) + dev->driver->context_dtor(dev, + pos->handle); + + drm_ctxbitmap_free(dev, pos->handle); + + list_del(&pos->head); + kfree(pos); + --dev->ctx_count; + } + } + } + mutex_unlock(&dev->ctxlist_mutex); +} + /** * Context bitmap allocation. * @@ -90,10 +121,12 @@ static int drm_ctxbitmap_next(struct drm_device * dev) * * Initialise the drm_device::ctx_idr */ -int drm_ctxbitmap_init(struct drm_device * dev) +void drm_legacy_ctxbitmap_init(struct drm_device * dev) { + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return; + idr_init(&dev->ctx_idr); - return 0; } /** @@ -104,7 +137,7 @@ int drm_ctxbitmap_init(struct drm_device * dev) * Free all idr members using drm_ctx_sarea_free helper function * while holding the drm_device::struct_mutex lock. */ -void drm_ctxbitmap_cleanup(struct drm_device * dev) +void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev) { mutex_lock(&dev->struct_mutex); idr_destroy(&dev->ctx_idr); @@ -136,6 +169,9 @@ int drm_getsareactx(struct drm_device *dev, void *data, struct drm_local_map *map; struct drm_map_list *_entry; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + mutex_lock(&dev->struct_mutex); map = idr_find(&dev->ctx_idr, request->ctx_id); @@ -180,6 +216,9 @@ int drm_setsareactx(struct drm_device *dev, void *data, struct drm_local_map *map = NULL; struct drm_map_list *r_list = NULL; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + mutex_lock(&dev->struct_mutex); list_for_each_entry(r_list, &dev->maplist, head) { if (r_list->map @@ -280,6 +319,9 @@ int drm_resctx(struct drm_device *dev, void *data, struct drm_ctx ctx; int i; + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (res->count >= DRM_RESERVED_CONTEXTS) { memset(&ctx, 0, sizeof(ctx)); for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { @@ -310,6 +352,9 @@ int drm_addctx(struct drm_device *dev, void *data, struct drm_ctx_list *ctx_entry; struct drm_ctx *ctx = data; + if (drm_core_check_feature(dev, DRIVER_MODES
[PATCH 28/39] drm/vmwgfx: remove redundant clearing of driver->dma_quiescent
It's kzalloced ... Signed-off-by: Daniel Vetter --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 3e43578..3e75dfa 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1125,7 +1125,6 @@ static struct drm_driver driver = { .disable_vblank = vmw_disable_vblank, .ioctls = vmw_ioctls, .num_ioctls = DRM_ARRAY_SIZE(vmw_ioctls), - .dma_quiescent = NULL, /*vmw_dma_quiescent, */ .master_create = vmw_master_create, .master_destroy = vmw_master_destroy, .master_set = vmw_master_set, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 29/39] drm: remove FASYNC support
So I've stumbled over drm_fasync and wondered what it does. Digging that up is quite a story. First I've had to read up on what this does and ended up being rather bewildered why peopled loved signals so much back in the days that they've created SIGIO just for that ... Then I wondered how this ever works, and what that strange "No-op." comment right above it should mean. After all calling the core fasync helper is pretty obviously not a noop. After reading through the kernels FASYNC implementation I've noticed that signals are only sent out to the processes attached with FASYNC by calling kill_fasync. No merged drm driver has ever done that. After more digging I've found out that the only driver that ever used this is the so called GAMMA driver. I've frankly never heard of such a gpu brand ever before. Now FASYNC seems to not have been the only bad thing with that driver, since Dave Airlie removed it from the drm driver with prejudice: commit 1430163b4bbf7b00367ea1066c1c5fe85dbeefed Author: Dave Airlie Date: Sun Aug 29 12:04:35 2004 + Drop GAMMA DRM from a great height ... Long story short, the drm fasync support seems to be doing absolutely nothing. And the only user of it was never merged into the upstream kernel. And we don't need any fops->fasync callback since the fcntl implementation in the kernel already implements the noop case correctly. So stop this particular cargo-cult and rip it all out. Cc: Dave Airlie Signed-off-by: Daniel Vetter --- drivers/gpu/drm/ast/ast_drv.c| 1 - drivers/gpu/drm/cirrus/cirrus_drv.c | 1 - drivers/gpu/drm/drm_fops.c | 12 drivers/gpu/drm/gma500/psb_drv.c | 1 - drivers/gpu/drm/i810/i810_dma.c | 1 - drivers/gpu/drm/i810/i810_drv.c | 1 - drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/mga/mga_drv.c| 1 - drivers/gpu/drm/mgag200/mgag200_drv.c| 1 - drivers/gpu/drm/nouveau/nouveau_drm.c| 1 - drivers/gpu/drm/omapdrm/omap_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c| 1 - drivers/gpu/drm/r128/r128_drv.c | 1 - drivers/gpu/drm/radeon/radeon_drv.c | 2 -- drivers/gpu/drm/savage/savage_drv.c | 1 - drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 - drivers/gpu/drm/sis/sis_drv.c| 1 - drivers/gpu/drm/tdfx/tdfx_drv.c | 1 - drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 - drivers/gpu/drm/udl/udl_drv.c| 1 - drivers/gpu/drm/via/via_drv.c| 1 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 - drivers/gpu/host1x/drm/drm.c | 1 - include/drm/drmP.h | 3 --- 24 files changed, 38 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index df0d0a0..16050ed 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -190,7 +190,6 @@ static const struct file_operations ast_fops = { .unlocked_ioctl = drm_ioctl, .mmap = ast_mmap, .poll = drm_poll, - .fasync = drm_fasync, #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index 8ecb601..85748f6 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c @@ -85,7 +85,6 @@ static const struct file_operations cirrus_driver_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif - .fasync = drm_fasync, }; static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_USE_MTRR, diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index ca6c946..392ce89 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -365,18 +365,6 @@ out_put_pid: return ret; } -/** No-op. */ -int drm_fasync(int fd, struct file *filp, int on) -{ - struct drm_file *priv = filp->private_data; - struct drm_device *dev = priv->minor->dev; - - DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, - (long)old_encode_dev(priv->minor->device)); - return fasync_helper(fd, filp, on, &dev->buf_async); -} -EXPORT_SYMBOL(drm_fasync); - static void drm_master_release(struct drm_device *dev, struct file *filp) { struct drm_file *file_priv = filp->private_data; diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index bddea58..c9c37ac 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -622,7 +622,6 @@ static const struct file_operations psb_gem_fops = { .unlocked_ioctl = psb_unlocked_ioctl, .mmap = drm_gem_mmap, .poll = drm_poll, - .fasync = drm_fasync, .read = drm_read, }; diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 004ecdf..ef1c9c7 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810
[PATCH 30/39] drm: rip out DRIVER_FB_DMA and related code
No driver ever sets that flag, so good riddance! Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 161 + include/drm/drmP.h | 1 - 2 files changed, 2 insertions(+), 160 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 25f..5f73f0a 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1130,161 +1130,6 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request return 0; } -static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request) -{ - struct drm_device_dma *dma = dev->dma; - struct drm_buf_entry *entry; - struct drm_buf *buf; - unsigned long offset; - unsigned long agp_offset; - int count; - int order; - int size; - int alignment; - int page_order; - int total; - int byte_count; - int i; - struct drm_buf **temp_buflist; - - if (!drm_core_check_feature(dev, DRIVER_FB_DMA)) - return -EINVAL; - - if (!dma) - return -EINVAL; - - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - - count = request->count; - order = order_base_2(request->size); - size = 1 << order; - - alignment = (request->flags & _DRM_PAGE_ALIGN) - ? PAGE_ALIGN(size) : size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - byte_count = 0; - agp_offset = request->agp_start; - - DRM_DEBUG("count: %d\n", count); - DRM_DEBUG("order: %d\n", order); - DRM_DEBUG("size: %d\n", size); - DRM_DEBUG("agp_offset: %lu\n", agp_offset); - DRM_DEBUG("alignment: %d\n", alignment); - DRM_DEBUG("page_order: %d\n", page_order); - DRM_DEBUG("total: %d\n", total); - - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) - return -EINVAL; - - spin_lock(&dev->count_lock); - if (dev->buf_use) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - atomic_inc(&dev->buf_alloc); - spin_unlock(&dev->count_lock); - - mutex_lock(&dev->struct_mutex); - entry = &dma->bufs[order]; - if (entry->buf_count) { - mutex_unlock(&dev->struct_mutex); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; /* May only call once for each order */ - } - - if (count < 0 || count > 4096) { - mutex_unlock(&dev->struct_mutex); - atomic_dec(&dev->buf_alloc); - return -EINVAL; - } - - entry->buflist = kzalloc(count * sizeof(*entry->buflist), - GFP_KERNEL); - if (!entry->buflist) { - mutex_unlock(&dev->struct_mutex); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - - entry->buf_size = size; - entry->page_order = page_order; - - offset = 0; - - while (entry->buf_count < count) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - - buf->offset = (dma->byte_count + offset); - buf->bus_address = agp_offset + offset; - buf->address = (void *)(agp_offset + offset); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - buf->file_priv = NULL; - - buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); - if (!buf->dev_private) { - /* Set count correctly so we free the proper amount. */ - entry->buf_count = count; - drm_cleanup_buf_error(dev, entry); - mutex_unlock(&dev->struct_mutex); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - - DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address); - - offset += alignment; - entry->buf_count++; - byte_count += PAGE_SIZE << page_order; - } - - DRM_DEBUG("byte_count: %d\n", byte_count); - - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * - sizeof(*dma->buflist), GFP_KERNEL); - if (!temp_buflist) { - /* Free the entry because it isn't valid */ - drm_cleanup_buf_error(dev, entry); - mutex_unlock(&dev->struct_mutex); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - dma->buflist
[PATCH 31/39] drm: rip out a few unused DRIVER flags
The gma500 driver somehow set the DRIVER_IRQ_VBL flag, but since there's no code at all to check for this we can kill it. The other two are completely unused. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/gma500/psb_drv.c | 2 +- include/drm/drmP.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index c9c37ac..ce88945 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c @@ -627,7 +627,7 @@ static const struct file_operations psb_gem_fops = { static struct drm_driver driver = { .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | \ - DRIVER_IRQ_VBL | DRIVER_MODESET | DRIVER_GEM , + DRIVER_MODESET | DRIVER_GEM , .load = psb_driver_load, .unload = psb_driver_unload, diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 2084d3d..2a7001f 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -146,9 +146,6 @@ int drm_err(const char *func, const char *format, ...); #define DRIVER_HAVE_DMA0x20 #define DRIVER_HAVE_IRQ0x40 #define DRIVER_IRQ_SHARED 0x80 -#define DRIVER_IRQ_VBL 0x100 -#define DRIVER_DMA_QUEUE 0x200 -#define DRIVER_IRQ_VBL20x800 #define DRIVER_GEM 0x1000 #define DRIVER_MODESET 0x2000 #define DRIVER_PRIME 0x4000 -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 32/39] drm: remove a bunch of unused #defines from drmP.h
Signed-off-by: Daniel Vetter --- include/drm/drmP.h | 9 - 1 file changed, 9 deletions(-) diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 2a7001f..62e9e41 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -164,13 +164,7 @@ int drm_err(const char *func, const char *format, ...); #define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ #define DRM_KERNEL_CONTEXT0 /**< Change drm_resctx if changed */ #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ -#define DRM_LOOPING_LIMIT 500 -#define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */ -#define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */ -#define DRM_FLAG_DEBUG 0x01 - -#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) #define DRM_MAP_HASH_OFFSET 0x1000 /*@}*/ @@ -259,9 +253,6 @@ int drm_err(const char *func, const char *format, ...); #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) -#define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) -#define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) - #define DRM_IF_VERSION(maj, min) (maj << 16 | min) /** -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 33/39] drm: rip out drm_core_has_MTRR checks
The new arch_phys_wc_add/del functions do the right thing both with and without MTRR support in the kernel. So we can drop these additional checks. Cc: Andy Lutomirski Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 13 + drivers/gpu/drm/drm_pci.c | 11 +-- drivers/gpu/drm/drm_stub.c | 2 +- drivers/gpu/drm/drm_vm.c | 3 +-- include/drm/drmP.h | 10 -- 5 files changed, 12 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 5f73f0a..f63133b 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -207,12 +207,10 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, return 0; } - if (drm_core_has_MTRR(dev)) { - if (map->type == _DRM_FRAME_BUFFER || - (map->flags & _DRM_WRITE_COMBINING)) { - map->mtrr = - arch_phys_wc_add(map->offset, map->size); - } + if (map->type == _DRM_FRAME_BUFFER || + (map->flags & _DRM_WRITE_COMBINING)) { + map->mtrr = + arch_phys_wc_add(map->offset, map->size); } if (map->type == _DRM_REGISTERS) { if (map->flags & _DRM_WRITE_COMBINING) @@ -464,8 +462,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) iounmap(map->handle); /* FALLTHROUGH */ case _DRM_FRAME_BUFFER: - if (drm_core_has_MTRR(dev)) - arch_phys_wc_del(map->mtrr); + arch_phys_wc_del(map->mtrr); break; case _DRM_SHM: vfree(map->handle); diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 80c0b2b..9e93ea5 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -276,12 +276,11 @@ static int drm_pci_agp_init(struct drm_device *dev) DRM_ERROR("Cannot initialize the agpgart module.\n"); return -EINVAL; } - if (drm_core_has_MTRR(dev)) { - if (dev->agp) - dev->agp->agp_mtrr = arch_phys_wc_add( - dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size * - 1024 * 1024); + if (dev->agp) { + dev->agp->agp_mtrr = arch_phys_wc_add( + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size * + 1024 * 1024); } } return 0; diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index e7471ef..30cbd62 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -445,7 +445,7 @@ void drm_put_dev(struct drm_device *dev) drm_lastclose(dev); - if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && dev->agp) + if (dev->agp) arch_phys_wc_del(dev->agp->agp_mtrr); if (dev->driver->unload) diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index feb2003..b5c5af7 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c @@ -251,8 +251,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) switch (map->type) { case _DRM_REGISTERS: case _DRM_FRAME_BUFFER: - if (drm_core_has_MTRR(dev)) - arch_phys_wc_del(map->mtrr); + arch_phys_wc_del(map->mtrr); iounmap(map->handle); break; case _DRM_SHM: diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 62e9e41..d933f06 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -75,7 +75,6 @@ #include #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) -#define __OS_HAS_MTRR (defined(CONFIG_MTRR)) struct module; @@ -1220,15 +1219,6 @@ static inline int drm_core_has_AGP(struct drm_device *dev) #define drm_core_has_AGP(dev) (0) #endif -#if __OS_HAS_MTRR -static inline int drm_core_has_MTRR(struct drm_device *dev) -{ - return drm_core_check_feature(dev, DRIVER_USE_MTRR); -} -#else -#define drm_core_has_MTRR(dev) (0) -#endif - static inline void drm_device_set_unplugged(struct drm_device *dev) { smp_wmb(); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 34/39] drm: remove the dma_ioctl special-case
We might as well have a real ioctl function which checks for the callbacks. This seems to be a remnant from back in the days when each drm driver had their own complete ioctl table, with no shared core drm table at all. To make really sure no mis-guided user in a kms driver pops up again explicitly check for that in the new ioctl implementation. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 14 ++ drivers/gpu/drm/drm_drv.c | 6 +- include/drm/drmP.h | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index f63133b..ff7fe80 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1455,6 +1455,20 @@ int drm_mapbufs(struct drm_device *dev, void *data, return retcode; } +int drm_dma_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + struct drm_device_dma *dma = dev->dma; + + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + + if (dev->driver->dma_ioctl) + return dev->driver->dma_ioctl(dev, data, file_priv); + else + return -EINVAL; +} + struct drm_local_map *drm_getsarea(struct drm_device *dev) { struct drm_map_list *entry; diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index f2495e1..b349b5f 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -106,8 +106,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH), - /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ - DRM_IOCTL_DEF(DRM_IOCTL_DMA, NULL, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma_ioctl, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), @@ -415,9 +414,6 @@ long drm_ioctl(struct file *filp, /* Do not trust userspace, use our own definition */ func = ioctl->func; - /* is there a local override? */ - if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) - func = dev->driver->dma_ioctl; if (!func) { DRM_DEBUG("no function\n"); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d933f06..1afa431 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1368,6 +1368,8 @@ extern int drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int drm_dma_ioctl(struct drm_device *dev, void *data, +struct drm_file *file_priv); /* DMA support (drm_dma.h) */ extern int drm_legacy_dma_setup(struct drm_device *dev); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 35/39] drm/memory: don't export agp helpers
They're only used by the agpgart support code in drm_agpgart.c, not by any drivers. I think long-term we should create a drm_internal.h include file with all the various functions only used by the drm core and not exported to drivers, and remove them from drmP.h. Oh, and someone should kill that upper-case P sometimes ;-) But that's all stuff for future patch bombs. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_memory.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/drm_memory.c b/drivers/gpu/drm/drm_memory.c index 126d50e..64e44fa 100644 --- a/drivers/gpu/drm/drm_memory.c +++ b/drivers/gpu/drm/drm_memory.c @@ -86,7 +86,6 @@ void drm_free_agp(DRM_AGP_MEM * handle, int pages) { agp_free_memory(handle); } -EXPORT_SYMBOL(drm_free_agp); /** Wrapper around agp_bind_memory() */ int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start) @@ -99,7 +98,6 @@ int drm_unbind_agp(DRM_AGP_MEM * handle) { return agp_unbind_memory(handle); } -EXPORT_SYMBOL(drm_unbind_agp); #else /* __OS_HAS_AGP */ static inline void *agp_remap(unsigned long offset, unsigned long size, -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 36/39] drm: hollow-out GET_CLIENT ioctl
We not only have debugfs files to do pretty much the equivalent of lsof, we also have an ioctl. Not that compared to lsof this dumps a wee bit more information, but we can still get at that from debugfs easily. I've dug around in mesa, libdrm and ddx histories and the only users seem to be drm/tests/dristat.c and drm/tests/getclients.c. The later is a testcase for the ioctl itself since up to commit b018fcdaa5e8b4eabb8cffda687d4a3c4785 Author: Eric Anholt Date: Thu Nov 22 18:46:54 2007 +1000 drm: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx there was actually no way at all for userspace to enumerate all clients since the kernel just wouldn't tell it when to stop. Which completely broke it's only user, dristat -c. So obviously that ioctl wasn't much use for debugging. Hence I don't see any point in keeping support for a tool which was pretty obviously never really used, and while we have good replacements in the form of equivalent debugfs files. Still, to keep dristat -c from looping forever again stop it early by returning an unconditional -EINVAL. Also add a comment in the code about why. Cc: Eric Anholt Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_ioctl.c | 27 --- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 0acf080..5159fa0 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -216,29 +216,10 @@ int drm_getmap(struct drm_device *dev, void *data, int drm_getclient(struct drm_device *dev, void *data, struct drm_file *file_priv) { - struct drm_client *client = data; - struct drm_file *pt; - int idx; - int i; - - idx = client->idx; - i = 0; - - mutex_lock(&dev->struct_mutex); - list_for_each_entry(pt, &dev->filelist, lhead) { - if (i++ >= idx) { - client->auth = pt->authenticated; - client->pid = pid_vnr(pt->pid); - client->uid = from_kuid_munged(current_user_ns(), pt->uid); - client->magic = pt->magic; - client->iocs = pt->ioctl_count; - mutex_unlock(&dev->struct_mutex); - - return 0; - } - } - mutex_unlock(&dev->struct_mutex); - + /* Hollowed-out getclient ioctl to keep some dead old drm tests/tools +* not breaking completely. Userspace tools stop enumerating one they +* get -EINVAL, hence this is the return value we need to hand back for +* no clients tracked. */ return -EINVAL; } -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 37/39] drm: no-op out GET_STATS ioctl
Again only used by a tests in libdrm and by dristat. Nowadays we have much better tracing tools to get detailed insights into what a drm driver is doing. And for a simple "does it work" kind of question that these stats could answer we have plenty of dmesg debug log spew. So I don't see any use for this stat gathering complexity at all. To be able to gradually drop things start with ripping out the interfaces to it, here the ioctl. To prevent dristat from eating its own stack garbage we can't use the drm_noop ioctl though, since we need to clear the return data with a memset. Cc: Eric Anholt Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_ioctl.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 5159fa0..fbe9219 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -237,21 +237,10 @@ int drm_getstats(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_stats *stats = data; - int i; + /* Clear stats to prevent userspace from eating its stack garbage. */ memset(stats, 0, sizeof(*stats)); - for (i = 0; i < dev->counters; i++) { - if (dev->types[i] == _DRM_STAT_LOCK) - stats->data[i].value = - (file_priv->master->lock.hw_lock ? file_priv->master->lock.hw_lock->lock : 0); - else - stats->data[i].value = atomic_read(&dev->counts[i]); - stats->data[i].type = dev->types[i]; - } - - stats->count = dev->counters; - return 0; } -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 38/39] drm: fix locking in gem debugfs/procfs file
The idr is protected with our spinlock, if we don't hold that nothing prevents the gem objects from disappearing from under us. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_info.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c index d4b20ce..9f8fc4c 100644 --- a/drivers/gpu/drm/drm_info.c +++ b/drivers/gpu/drm/drm_info.c @@ -218,7 +218,11 @@ int drm_gem_name_info(struct seq_file *m, void *data) struct drm_device *dev = node->minor->dev; seq_printf(m, " name size handles refcount\n"); + + spin_lock(&dev->object_name_lock); idr_for_each(&dev->object_name_idr, drm_gem_one_name_info, m); + spin_unlock(&dev->object_name_lock); + return 0; } -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 39/39] drm: remove procfs code, take 2
So almost two years ago I've tried to nuke the procfs code already once before: http://lists.freedesktop.org/archives/dri-devel/2011-October/015707.html The conclusion was that userspace drivers (specifically libdrm device node detection) stopped relying on procfs in 2011. But after some digging it turned out that the drmstat tool in libdrm is still using those files (but only when certain options are set). So we've decided to keep profcs. But I when I've started to dig around again what exactly this tool does I've noticed that it tries to read the "mem", "vm", and "vma" files from procfs. Now as far my git history digging shows "mem" never did anything useful (at least in the version that first showed up in upstream history in 2004) and the file was remove in commit 955b12def42e83287c1bdb1411d99451753c1391 Author: Ben Gamari Date: Tue Feb 17 20:08:49 2009 -0500 drm: Convert proc files to seq_file and introduce debugfs Which means that for over 4 years drmstat has been broken, and no one cared. In my opinion that's proof enough that no one is actually using drmstat, and so that we can savely nuke the procfs support from drm. While at it fix up the error case cleanup for debugfs in drm_get_minor. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_drv.c | 8 -- drivers/gpu/drm/drm_proc.c | 209 - drivers/gpu/drm/drm_stub.c | 32 ++- include/drm/drmP.h | 8 -- 5 files changed, 9 insertions(+), 250 deletions(-) delete mode 100644 drivers/gpu/drm/drm_proc.c diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 801bcaf..3ca730c 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -7,7 +7,7 @@ ccflags-y := -Iinclude/drm drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm_context.o drm_dma.o \ drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ - drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \ + drm_lock.o drm_memory.o drm_stub.o drm_vm.o \ drm_agpsupport.o drm_scatter.o drm_pci.o \ drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ drm_crtc.o drm_modes.o drm_edid.o \ diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index b349b5f..a9f48ff 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -257,13 +257,6 @@ static int __init drm_core_init(void) goto err_p2; } - drm_proc_root = proc_mkdir("dri", NULL); - if (!drm_proc_root) { - DRM_ERROR("Cannot create /proc/dri\n"); - ret = -1; - goto err_p3; - } - drm_debugfs_root = debugfs_create_dir("dri", NULL); if (!drm_debugfs_root) { DRM_ERROR("Cannot create /sys/kernel/debug/dri\n"); @@ -286,7 +279,6 @@ err_p1: static void __exit drm_core_exit(void) { - remove_proc_entry("dri", NULL); debugfs_remove(drm_debugfs_root); drm_sysfs_destroy(); diff --git a/drivers/gpu/drm/drm_proc.c b/drivers/gpu/drm/drm_proc.c deleted file mode 100644 index d7f2324..000 --- a/drivers/gpu/drm/drm_proc.c +++ /dev/null @@ -1,209 +0,0 @@ -/** - * \file drm_proc.c - * /proc support for DRM - * - * \author Rickard E. (Rik) Faith - * \author Gareth Hughes - * - * \par Acknowledgements: - *Matthew J Sottek sent in a patch to fix - *the problem with the proc files not outputting all their information. - */ - -/* - * Created: Mon Jan 11 09:48:47 1999 by fa...@valinux.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#include -#include -#include -#include - -/**
Re: [PATCH] drm/prime: remove cargo-cult locking from map_sg helper
On Wed, Jul 10, 2013 at 2:03 PM, Maarten Lankhorst wrote: > Op 10-07-13 13:54, Daniel Vetter schreef: >> I've checked both implementations (radeon/nouveau) and they both grab >> the page array from ttm simply by dereferencing it and then wrapping >> it up with drm_prime_pages_to_sg in the callback and map it with >> dma_map_sg (in the helper). >> >> Only the grabbing of the underlying page array is anything we need to >> be concerned about, and either those pages are pinned independently, >> or we're screwed no matter what. >> >> And indeed, nouveau/radeon pin the backing storage in their >> attach/detach functions. >> >> The only thing we might claim it does is prevent concurrent mapping of >> dma_buf attachments. But a) that's not allowed and b) the current code >> is racy already since it checks whether the sg mapping exists _before_ >> grabbing the lock. >> >> So the dev->struct_mutex locking here does absolutely nothing useful, >> but only distracts. Remove it. >> >> This should also help Maarten's work to eventually pin the backing >> storage more dynamically by preventing locking inversions around >> dev->struct_mutex. > > This pleases me, but I think it's not thorough enough. > > if (prime_attach->dir == dir) > return prime_attach->sgt; > > ^ That check must go too. I don't think recursive map_dma_buf is valid. > > and unmap_dma_buf should set prime_attach->dir = DMA_NONE; again. So after a bit of irc chatting with Maarten this seems to be more involved. The above check is to cache the dma mapping, but the implementation is bogus in tons of ways: - If direction changes we don't bother with unmaping and freeing the mapping, but simply leak it. - This will break if the dma mapping needs explicit syncing since the helpers don't call sync_to_cpu/sync_to_device anywhere. So I think I'll decline to poke around more in this hornet nest and leave it at the locking removal. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/i915: remove unused members from drm_i915_private
Signed-off-by: Maarten Lankhorst --- diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a416645..d1b1928 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1080,8 +1080,6 @@ typedef struct drm_i915_private { } backlight; /* LVDS info */ - struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ - struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ bool no_aux_handshake; struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */ ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/i915: remove unused members from drm_i915_private
On Wed, Jul 10, 2013 at 02:27:31PM +0200, Maarten Lankhorst wrote: > Signed-off-by: Maarten Lankhorst Queued for -next, thanks for the patch. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66551] System hang on rs780 with latest Linus kernel
https://bugs.freedesktop.org/show_bug.cgi?id=66551 --- Comment #2 from Alex Deucher --- Can you use git to bisect and identify what commit broke your system? -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66551] System hang on rs780 with latest Linus kernel
https://bugs.freedesktop.org/show_bug.cgi?id=66551 octoploid changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from octoploid --- (In reply to comment #2) > Can you use git to bisect and identify what commit broke your system? Already did this see: http://thread.gmane.org/gmane.comp.video.dri.devel/87584 Fixed by: https://patchwork.kernel.org/patch/2825605/ -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66767] atombios stuck in loop for more than 5secs aborting after suspend to ram
https://bugs.freedesktop.org/show_bug.cgi?id=66767 --- Comment #1 from Alex Deucher --- Please attach your full dmesg output. Also, is this a hybrid laptop with multiple GPUs? -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66768] UVD decoding of MPEG2 streams doesn't work on CEDAR
https://bugs.freedesktop.org/show_bug.cgi?id=66768 Alex Deucher changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Alex Deucher --- *** This bug has been marked as a duplicate of bug 66450 *** -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66450] JUNIPER UVD accelerated playback of MPEG 1/2 streams does not work
https://bugs.freedesktop.org/show_bug.cgi?id=66450 Alex Deucher changed: What|Removed |Added CC||johannes.hi...@fem.tu-ilmen ||au.de --- Comment #1 from Alex Deucher --- *** Bug 66768 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/edid: Fix constness warning in drm_load_edid_firmware()
On Wed, Jul 10, 2013 at 7:16 AM, Geert Uytterhoeven wrote: > drivers/gpu/drm/drm_edid_load.c: In function ‘drm_load_edid_firmware’: > drivers/gpu/drm/drm_edid_load.c:245: warning: initialization discards > qualifiers from pointer target type > > drm_get_connector_name() returns a "const char *", hence propagate the > const where needed. > > Signed-off-by: Geert Uytterhoeven For the series: Reviewed-by: Alex Deucher > --- > drivers/gpu/drm/drm_edid_load.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c > index a4f5ce1..2c2803f 100644 > --- a/drivers/gpu/drm/drm_edid_load.c > +++ b/drivers/gpu/drm/drm_edid_load.c > @@ -134,7 +134,7 @@ static u8 generic_edid[GENERIC_EDIDS][128] = { > }; > > static u8 *edid_load(struct drm_connector *connector, char *name, > - char *connector_name) > + const char *connector_name) > { > const struct firmware *fw; > struct platform_device *pdev; > @@ -242,7 +242,7 @@ out: > > int drm_load_edid_firmware(struct drm_connector *connector) > { > - char *connector_name = drm_get_connector_name(connector); > + const char *connector_name = drm_get_connector_name(connector); > char *edidname = edid_firmware, *last, *colon; > int ret; > struct edid *edid; > -- > 1.7.9.5 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/39] drm: remove redundant clears from drm_setup
Hi On Wed, Jul 10, 2013 at 2:11 PM, Daniel Vetter wrote: > We kzalloc the driver node at init time, so no need to do this again. > > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_fops.c | 9 - > 1 file changed, 9 deletions(-) > > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c > index 57e3014..9610997 100644 > --- a/drivers/gpu/drm/drm_fops.c > +++ b/drivers/gpu/drm/drm_fops.c > @@ -73,15 +73,6 @@ static int drm_setup(struct drm_device * dev) > for (i = 0; i < ARRAY_SIZE(dev->counts); i++) > atomic_set(&dev->counts[i], 0); > > - dev->sigdata.lock = NULL; > - > - dev->context_flag = 0; > - dev->last_context = 0; > - dev->last_checked = 0; > - dev->if_version = 0; > - > - dev->buf_async = NULL; > - drm_setup() is called on every first open. I digged through core DRM and noticed that we have a lot of code that cleans up on lastclose and reinitializes on firstopen which is skipped for non-UMS drivers to preserve KMS state if no user keeps DRM node open. I would like to hear a comment in the commit-message which explains why we don't reset "if_version", anymore. Are you sure UMS user-space does not depend on this logic? I have no idea of UMS, but if that reinitialization on lastclose+firstopen is not relied on, I guess we can remove a lot more code. Just wanted to make sure that this is right. Cheers David > DRM_DEBUG("\n"); > > /* > -- > 1.8.3.2 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66450] JUNIPER UVD accelerated playback of MPEG 1/2 streams does not work
https://bugs.freedesktop.org/show_bug.cgi?id=66450 Christian König changed: What|Removed |Added Status|NEW |ASSIGNED --- Comment #2 from Christian König --- The vdpauinfo output is wrong, JUNIPER has an uvd 2.3 block and that can't decode MPEG2 in vld mode. Going to fix that in a minute. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/prime: remove cargo-cult locking from map_sg helper
Hi Daniel, On Wednesday 10 July 2013 13:54:33 Daniel Vetter wrote: > I've checked both implementations (radeon/nouveau) and they both grab > the page array from ttm simply by dereferencing it and then wrapping > it up with drm_prime_pages_to_sg in the callback and map it with > dma_map_sg (in the helper). Have you checked drm_gem_cma_prime_get_sg_table (in drm_gem_cma_helper.c) as well ? > Only the grabbing of the underlying page array is anything we need to > be concerned about, and either those pages are pinned independently, > or we're screwed no matter what. > > And indeed, nouveau/radeon pin the backing storage in their > attach/detach functions. > > The only thing we might claim it does is prevent concurrent mapping of > dma_buf attachments. But a) that's not allowed and b) the current code > is racy already since it checks whether the sg mapping exists _before_ > grabbing the lock. > > So the dev->struct_mutex locking here does absolutely nothing useful, > but only distracts. Remove it. > > This should also help Maarten's work to eventually pin the backing > storage more dynamically by preventing locking inversions around > dev->struct_mutex. > > Cc: Maarten Lankhorst > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_prime.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c > index 85e450e..64a99b3 100644 > --- a/drivers/gpu/drm/drm_prime.c > +++ b/drivers/gpu/drm/drm_prime.c > @@ -167,8 +167,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct > dma_buf_attachment *attach, if (WARN_ON(prime_attach->dir != DMA_NONE)) > return ERR_PTR(-EBUSY); > > - mutex_lock(&obj->dev->struct_mutex); > - > sgt = obj->dev->driver->gem_prime_get_sg_table(obj); > > if (!IS_ERR(sgt)) { > @@ -182,7 +180,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct > dma_buf_attachment *attach, } > } > > - mutex_unlock(&obj->dev->struct_mutex); > return sgt; > } -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66450] JUNIPER UVD accelerated playback of MPEG 1/2 streams does not work
https://bugs.freedesktop.org/show_bug.cgi?id=66450 --- Comment #3 from Christian König --- Created attachment 82275 --> https://bugs.freedesktop.org/attachment.cgi?id=82275&action=edit Possible fix. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 33/39] drm: rip out drm_core_has_MTRR checks
Hi On Wed, Jul 10, 2013 at 2:12 PM, Daniel Vetter wrote: > The new arch_phys_wc_add/del functions do the right thing both with > and without MTRR support in the kernel. So we can drop these > additional checks. > > Cc: Andy Lutomirski > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_bufs.c | 13 + > drivers/gpu/drm/drm_pci.c | 11 +-- > drivers/gpu/drm/drm_stub.c | 2 +- > drivers/gpu/drm/drm_vm.c | 3 +-- > include/drm/drmP.h | 10 -- > 5 files changed, 12 insertions(+), 27 deletions(-) > > diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c > index 5f73f0a..f63133b 100644 > --- a/drivers/gpu/drm/drm_bufs.c > +++ b/drivers/gpu/drm/drm_bufs.c > @@ -207,12 +207,10 @@ static int drm_addmap_core(struct drm_device * dev, > resource_size_t offset, > return 0; > } > > - if (drm_core_has_MTRR(dev)) { > - if (map->type == _DRM_FRAME_BUFFER || > - (map->flags & _DRM_WRITE_COMBINING)) { > - map->mtrr = > - arch_phys_wc_add(map->offset, > map->size); > - } > + if (map->type == _DRM_FRAME_BUFFER || > + (map->flags & _DRM_WRITE_COMBINING)) { > + map->mtrr = > + arch_phys_wc_add(map->offset, map->size); > } > if (map->type == _DRM_REGISTERS) { > if (map->flags & _DRM_WRITE_COMBINING) > @@ -464,8 +462,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct > drm_local_map *map) > iounmap(map->handle); > /* FALLTHROUGH */ > case _DRM_FRAME_BUFFER: > - if (drm_core_has_MTRR(dev)) > - arch_phys_wc_del(map->mtrr); > + arch_phys_wc_del(map->mtrr); > break; > case _DRM_SHM: > vfree(map->handle); > diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c > index 80c0b2b..9e93ea5 100644 > --- a/drivers/gpu/drm/drm_pci.c > +++ b/drivers/gpu/drm/drm_pci.c > @@ -276,12 +276,11 @@ static int drm_pci_agp_init(struct drm_device *dev) > DRM_ERROR("Cannot initialize the agpgart module.\n"); > return -EINVAL; > } > - if (drm_core_has_MTRR(dev)) { > - if (dev->agp) > - dev->agp->agp_mtrr = arch_phys_wc_add( > - dev->agp->agp_info.aper_base, > - dev->agp->agp_info.aper_size * > - 1024 * 1024); > + if (dev->agp) { > + dev->agp->agp_mtrr = arch_phys_wc_add( > + dev->agp->agp_info.aper_base, > + dev->agp->agp_info.aper_size * > + 1024 * 1024); > } > } > return 0; > diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c > index e7471ef..30cbd62 100644 > --- a/drivers/gpu/drm/drm_stub.c > +++ b/drivers/gpu/drm/drm_stub.c > @@ -445,7 +445,7 @@ void drm_put_dev(struct drm_device *dev) > > drm_lastclose(dev); > > - if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && dev->agp) > + if (dev->agp) > arch_phys_wc_del(dev->agp->agp_mtrr); > > if (dev->driver->unload) > diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c > index feb2003..b5c5af7 100644 > --- a/drivers/gpu/drm/drm_vm.c > +++ b/drivers/gpu/drm/drm_vm.c > @@ -251,8 +251,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) > switch (map->type) { > case _DRM_REGISTERS: > case _DRM_FRAME_BUFFER: > - if (drm_core_has_MTRR(dev)) > - arch_phys_wc_del(map->mtrr); > + arch_phys_wc_del(map->mtrr); > iounmap(map->handle); > break; > case _DRM_SHM: > diff --git a/include/drm/drmP.h b/include/drm/drmP.h > index 62e9e41..d933f06 100644 > --- a/include/drm/drmP.h > +++ b/include/drm/drmP.h > @@ -75,7 +75,6 @@ > #include > > #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && > defined(MODULE))) > -#define __OS_HAS_MTRR (defined(CONFIG_MTRR)) > > struct module; > > @@ -1220,15 +1219,6 @@ static inline int drm_core_has_AGP(struct drm_device > *dev) > #define drm_core_has_AGP(dev) (0) > #endif > > -#if __OS_HAS_MTRR > -static inline int drm_core_has_MTRR(struct drm_device *dev) > -{ > - return drm_core_check_feature(dev, DRIVER_USE_MTRR); > -} > -#else > -#define drm_core_has_MTRR(dev) (0) > -#endif > -
[PATCH 0/2] GEM CMA PRIME fixes for v3.11
Hi Dave, These two patches fix compilation breakages in drm-next due to the removal of drm_gem_cma_dmabuf_import() and drm_gem_cma_dmabuf_export() without updating the existing users (I don't blame anyone here, the patch that removed those functions and the patches that made use of them were merged at the same time). Laurent Pinchart (2): drm/rcar-du: Use the GEM PRIME helpers drm/shmobile: Use the GEM PRIME helpers drivers/gpu/drm/rcar-du/rcar_du_drv.c| 9 +++-- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 9 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) -- Regards, Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/2] drm/rcar-du: Use the GEM PRIME helpers
The GEM CMA PRIME import/export helpers have been removed in favor of generic GEM PRIME helpers with GEM CMA low-level operations. Fix the driver accordingly. Reported-by: Mark Brown Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index a4c2007..38a8b52 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -152,8 +152,13 @@ static struct drm_driver rcar_du_driver = { .gem_vm_ops = &drm_gem_cma_vm_ops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import = drm_gem_cma_dmabuf_import, - .gem_prime_export = drm_gem_cma_dmabuf_export, + .gem_prime_import = drm_gem_prime_import, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, + .gem_prime_vmap = drm_gem_cma_prime_vmap, + .gem_prime_vunmap = drm_gem_cma_prime_vunmap, + .gem_prime_mmap = drm_gem_cma_prime_mmap, .dumb_create= rcar_du_dumb_create, .dumb_map_offset= drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_cma_dumb_destroy, -- 1.8.1.5 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/2] drm/shmobile: Use the GEM PRIME helpers
The GEM CMA PRIME import/export helpers have been removed in favor of generic GEM PRIME helpers with GEM CMA low-level operations. Fix the driver accordingly. Reported-by: Mark Brown Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index edc1018..5f83f9a 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c @@ -276,8 +276,13 @@ static struct drm_driver shmob_drm_driver = { .gem_vm_ops = &drm_gem_cma_vm_ops, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_import = drm_gem_cma_dmabuf_import, - .gem_prime_export = drm_gem_cma_dmabuf_export, + .gem_prime_import = drm_gem_prime_import, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, + .gem_prime_vmap = drm_gem_cma_prime_vmap, + .gem_prime_vunmap = drm_gem_cma_prime_vunmap, + .gem_prime_mmap = drm_gem_cma_prime_mmap, .dumb_create= drm_gem_cma_dumb_create, .dumb_map_offset= drm_gem_cma_dumb_map_offset, .dumb_destroy = drm_gem_cma_dumb_destroy, -- 1.8.1.5 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66450] JUNIPER UVD accelerated playback of MPEG 1/2 streams does not work
https://bugs.freedesktop.org/show_bug.cgi?id=66450 --- Comment #4 from Johannes Hirte --- With this patch applied, mplayer2 crashes on mpeg2 file with: Detected file format: MPEG-PS (MPEG-2 Program Stream) (libavformat) [mpeg @ 0x7fa7bec14cc0]max_analyze_duration 500 reached at 5005000 [lavf] stream 0: video (mpeg2video), -vid 0 [lavf] stream 1: audio (ac3), -aid 0 [lavf] stream 2: audio (ac3), -aid 1 Load subtitles in . Forced video codec: ffmpeg12vdpau Selected video codec: MPEG-1/2 video (VDPAU acceleration) [libavcodec] Selected audio codec: ATSC A/52A (AC-3) [libavcodec] AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000) AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample) Starting playback... Unsupported PixelFormat xvmcidct (16) Unsupported PixelFormat xvmcmc (15) VIDEO: 720x480 29.970 fps 7500.0 kbps (937.5 kB/s) Aspect ratio is 1.78:1 - scaling to correct movie aspect. VO: [vdpau] 720x480 => 853x480 MPEG2 VDPAU acceleration [vdpau] Compositing window manager detected. Assuming timing info is inaccurate. MPlayer interrupted by signal 11 in module: check_framedrop -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66450] JUNIPER UVD accelerated playback of MPEG 1/2 streams does not work
https://bugs.freedesktop.org/show_bug.cgi?id=66450 --- Comment #5 from Johannes Hirte --- (In reply to comment #2) > The vdpauinfo output is wrong, JUNIPER has an uvd 2.3 block and that can't > decode MPEG2 in vld mode. So the wikipedia article is wrong? "The UVD 2 features full bitstream decoding of H.264/MPEG-4 AVC, VC-1, as well as MPEG2 video streams, and in addition it also supports dual video stream decoding and Picture-in-Picture mode. This makes UVD2 full BD-Live compliant." http://en.wikipedia.org/wiki/Unified_Video_Decoder#UVD_2 -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 34/39] drm: remove the dma_ioctl special-case
Hi On Wed, Jul 10, 2013 at 2:12 PM, Daniel Vetter wrote: > We might as well have a real ioctl function which checks for the > callbacks. This seems to be a remnant from back in the days when each > drm driver had their own complete ioctl table, with no shared core > drm table at all. > > To make really sure no mis-guided user in a kms driver pops up again > explicitly check for that in the new ioctl implementation. > > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_bufs.c | 14 ++ > drivers/gpu/drm/drm_drv.c | 6 +- > include/drm/drmP.h | 2 ++ > 3 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c > index f63133b..ff7fe80 100644 > --- a/drivers/gpu/drm/drm_bufs.c > +++ b/drivers/gpu/drm/drm_bufs.c > @@ -1455,6 +1455,20 @@ int drm_mapbufs(struct drm_device *dev, void *data, > return retcode; > } > > +int drm_dma_ioctl(struct drm_device *dev, void *data, > + struct drm_file *file_priv) > +{ > + struct drm_device_dma *dma = dev->dma; Unused variable. Cheers David > + > + if (drm_core_check_feature(dev, DRIVER_MODESET)) > + return -EINVAL; > + > + if (dev->driver->dma_ioctl) > + return dev->driver->dma_ioctl(dev, data, file_priv); > + else > + return -EINVAL; > +} > + > struct drm_local_map *drm_getsarea(struct drm_device *dev) > { > struct drm_map_list *entry; > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c > index f2495e1..b349b5f 100644 > --- a/drivers/gpu/drm/drm_drv.c > +++ b/drivers/gpu/drm/drm_drv.c > @@ -106,8 +106,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { > DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH), > DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH), > DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH), > - /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ > - DRM_IOCTL_DEF(DRM_IOCTL_DMA, NULL, DRM_AUTH), > + DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma_ioctl, DRM_AUTH), > > DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, > DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), > > @@ -415,9 +414,6 @@ long drm_ioctl(struct file *filp, > > /* Do not trust userspace, use our own definition */ > func = ioctl->func; > - /* is there a local override? */ > - if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) > - func = dev->driver->dma_ioctl; > > if (!func) { > DRM_DEBUG("no function\n"); > diff --git a/include/drm/drmP.h b/include/drm/drmP.h > index d933f06..1afa431 100644 > --- a/include/drm/drmP.h > +++ b/include/drm/drmP.h > @@ -1368,6 +1368,8 @@ extern int drm_freebufs(struct drm_device *dev, void > *data, > struct drm_file *file_priv); > extern int drm_mapbufs(struct drm_device *dev, void *data, >struct drm_file *file_priv); > +extern int drm_dma_ioctl(struct drm_device *dev, void *data, > +struct drm_file *file_priv); > > /* DMA support (drm_dma.h) */ > extern int drm_legacy_dma_setup(struct drm_device *dev); > -- > 1.8.3.2 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66450] JUNIPER UVD accelerated playback of MPEG 1/2 streams does not work
https://bugs.freedesktop.org/show_bug.cgi?id=66450 --- Comment #6 from Christian König --- (In reply to comment #5) > (In reply to comment #2) > > The vdpauinfo output is wrong, JUNIPER has an uvd 2.3 block and that can't > > decode MPEG2 in vld mode. > > So the wikipedia article is wrong? > > "The UVD 2 features full bitstream decoding of H.264/MPEG-4 AVC, VC-1, as > well as MPEG2 video streams, and in addition it also supports dual video > stream decoding and Picture-in-Picture mode. This makes UVD2 full BD-Live > compliant." > > http://en.wikipedia.org/wiki/Unified_Video_Decoder#UVD_2 Yeah, that is complete nonsense. The MVC comment for UVD 3.0 is wrong also. -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/prime: remove cargo-cult locking from map_sg helper
On Wed, Jul 10, 2013 at 3:46 PM, Laurent Pinchart wrote: > On Wednesday 10 July 2013 13:54:33 Daniel Vetter wrote: >> I've checked both implementations (radeon/nouveau) and they both grab >> the page array from ttm simply by dereferencing it and then wrapping >> it up with drm_prime_pages_to_sg in the callback and map it with >> dma_map_sg (in the helper). > > Have you checked drm_gem_cma_prime_get_sg_table (in drm_gem_cma_helper.c) as > well ? Indeed I've missed to check this one since I've based this branch originally on an older drm-next version without the cma dma-buf stuff. drm_gem_cma_prime_get_sg_table only calls kzalloc and the creates&maps the sg table with dma_get_sgtable. It doesn't touch any gem object state otherwise. So looks safe. I'll amed the commit message a bit. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/prime: remove cargo-cult locking from map_sg helper
I've checked both implementations (radeon/nouveau) and they both grab the page array from ttm simply by dereferencing it and then wrapping it up with drm_prime_pages_to_sg in the callback and map it with dma_map_sg (in the helper). Only the grabbing of the underlying page array is anything we need to be concerned about, and either those pages are pinned independently, or we're screwed no matter what. And indeed, nouveau/radeon pin the backing storage in their attach/detach functions. Since I've created this patch cma prime support for dma_buf was added. drm_gem_cma_prime_get_sg_table only calls kzalloc and the creates&maps the sg table with dma_get_sgtable. It doesn't touch any gem object state otherwise. So the cma helpers also look safe. The only thing we might claim it does is prevent concurrent mapping of dma_buf attachments. But a) that's not allowed and b) the current code is racy already since it checks whether the sg mapping exists _before_ grabbing the lock. So the dev->struct_mutex locking here does absolutely nothing useful, but only distracts. Remove it. This should also help Maarten's work to eventually pin the backing storage more dynamically by preventing locking inversions around dev->struct_mutex. v2: Add analysis for recently added cma helper prime code. Cc: Laurent Pinchart Cc: Maarten Lankhorst Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_prime.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 85e450e..64a99b3 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -167,8 +167,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, if (WARN_ON(prime_attach->dir != DMA_NONE)) return ERR_PTR(-EBUSY); - mutex_lock(&obj->dev->struct_mutex); - sgt = obj->dev->driver->gem_prime_get_sg_table(obj); if (!IS_ERR(sgt)) { @@ -182,7 +180,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach, } } - mutex_unlock(&obj->dev->struct_mutex); return sgt; } -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm: remove FASYNC support
So I've stumbled over drm_fasync and wondered what it does. Digging that up is quite a story. First I've had to read up on what this does and ended up being rather bewildered why peopled loved signals so much back in the days that they've created SIGIO just for that ... Then I wondered how this ever works, and what that strange "No-op." comment right above it should mean. After all calling the core fasync helper is pretty obviously not a noop. After reading through the kernels FASYNC implementation I've noticed that signals are only sent out to the processes attached with FASYNC by calling kill_fasync. No merged drm driver has ever done that. After more digging I've found out that the only driver that ever used this is the so called GAMMA driver. I've frankly never heard of such a gpu brand ever before. Now FASYNC seems to not have been the only bad thing with that driver, since Dave Airlie removed it from the drm driver with prejudice: commit 1430163b4bbf7b00367ea1066c1c5fe85dbeefed Author: Dave Airlie Date: Sun Aug 29 12:04:35 2004 + Drop GAMMA DRM from a great height ... Long story short, the drm fasync support seems to be doing absolutely nothing. And the only user of it was never merged into the upstream kernel. And we don't need any fops->fasync callback since the fcntl implementation in the kernel already implements the noop case correctly. So stop this particular cargo-cult and rip it all out. v2: Kill drm_fasync assignments in rcar (newly added) and imx drivers (somehow I've missed that one in staging). Also drop the reference in the drm DocBook. ARM compile-fail reported by Rob Clark. Cc: Dave Airlie Cc: Laurent Pinchart Cc: Rob Clark Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 1 - drivers/gpu/drm/ast/ast_drv.c| 1 - drivers/gpu/drm/cirrus/cirrus_drv.c | 1 - drivers/gpu/drm/drm_fops.c | 12 drivers/gpu/drm/gma500/psb_drv.c | 1 - drivers/gpu/drm/i810/i810_dma.c | 1 - drivers/gpu/drm/i810/i810_drv.c | 1 - drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/mga/mga_drv.c| 1 - drivers/gpu/drm/mgag200/mgag200_drv.c| 1 - drivers/gpu/drm/nouveau/nouveau_drm.c| 1 - drivers/gpu/drm/omapdrm/omap_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c| 1 - drivers/gpu/drm/r128/r128_drv.c | 1 - drivers/gpu/drm/radeon/radeon_drv.c | 2 -- drivers/gpu/drm/rcar-du/rcar_du_drv.c| 1 - drivers/gpu/drm/savage/savage_drv.c | 1 - drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 - drivers/gpu/drm/sis/sis_drv.c| 1 - drivers/gpu/drm/tdfx/tdfx_drv.c | 1 - drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 - drivers/gpu/drm/udl/udl_drv.c| 1 - drivers/gpu/drm/via/via_drv.c| 1 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 - drivers/gpu/host1x/drm/drm.c | 1 - drivers/staging/imx-drm/imx-drm-core.c | 1 - include/drm/drmP.h | 3 --- 27 files changed, 41 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 4d54ac8..79dd70e 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2498,7 +2498,6 @@ void (*postclose) (struct drm_device *, struct drm_file *); .poll = drm_poll, .read = drm_read, - .fasync = drm_fasync, .llseek = no_llseek, diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index df0d0a0..16050ed 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -190,7 +190,6 @@ static const struct file_operations ast_fops = { .unlocked_ioctl = drm_ioctl, .mmap = ast_mmap, .poll = drm_poll, - .fasync = drm_fasync, #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index 8ecb601..85748f6 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c @@ -85,7 +85,6 @@ static const struct file_operations cirrus_driver_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif - .fasync = drm_fasync, }; static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_USE_MTRR, diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index ca6c946..392ce89 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -365,18 +365,6 @@ out_put_pid: return ret; } -/** No-op. */ -int drm_fasync(int fd, struct file *filp, int on) -{ - struct drm_file *priv = filp->private_data; - struct drm_device *dev = priv->minor->dev; - - DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, - (long)old_encode_dev(priv->minor->device)); - return fasync_helper(fd, filp, on, &dev->b
[PATCH] drm: remove the dma_ioctl special-case
We might as well have a real ioctl function which checks for the callbacks. This seems to be a remnant from back in the days when each drm driver had their own complete ioctl table, with no shared core drm table at all. To make really sure no mis-guided user in a kms driver pops up again explicitly check for that in the new ioctl implementation. v2: Drop the unused variable I've accidentally left in the code, spotted by David Herrmann. Cc: David Herrmann Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_bufs.c | 12 drivers/gpu/drm/drm_drv.c | 6 +- include/drm/drmP.h | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index f63133b..471e051d 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -1455,6 +1455,18 @@ int drm_mapbufs(struct drm_device *dev, void *data, return retcode; } +int drm_dma_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + + if (dev->driver->dma_ioctl) + return dev->driver->dma_ioctl(dev, data, file_priv); + else + return -EINVAL; +} + struct drm_local_map *drm_getsarea(struct drm_device *dev) { struct drm_map_list *entry; diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index f2495e1..b349b5f 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -106,8 +106,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_INFO_BUFS, drm_infobufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_MAP_BUFS, drm_mapbufs, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_FREE_BUFS, drm_freebufs, DRM_AUTH), - /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ - DRM_IOCTL_DEF(DRM_IOCTL_DMA, NULL, DRM_AUTH), + DRM_IOCTL_DEF(DRM_IOCTL_DMA, drm_dma_ioctl, DRM_AUTH), DRM_IOCTL_DEF(DRM_IOCTL_CONTROL, drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), @@ -415,9 +414,6 @@ long drm_ioctl(struct file *filp, /* Do not trust userspace, use our own definition */ func = ioctl->func; - /* is there a local override? */ - if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) - func = dev->driver->dma_ioctl; if (!func) { DRM_DEBUG("no function\n"); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d933f06..1afa431 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1368,6 +1368,8 @@ extern int drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv); +extern int drm_dma_ioctl(struct drm_device *dev, void *data, +struct drm_file *file_priv); /* DMA support (drm_dma.h) */ extern int drm_legacy_dma_setup(struct drm_device *dev); -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/prime: remove cargo-cult locking from map_sg helper
> So after a bit of irc chatting with Maarten this seems to be more > involved. The above check is to cache the dma mapping, but the > implementation is bogus in tons of ways: > - If direction changes we don't bother with unmaping and freeing the > mapping, but simply leak it. > - This will break if the dma mapping needs explicit syncing since the > helpers don't call sync_to_cpu/sync_to_device anywhere. Right, and I believe I signed up for that. > > So I think I'll decline to poke around more in this hornet nest and > leave it at the locking removal. .. and I get the hornet nest :-). Is there a IRC log of what you guys talked about so I don't omit certain pieces of code. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/39] drm: remove redundant clears from drm_setup
On Wed, Jul 10, 2013 at 3:28 PM, David Herrmann wrote: > drm_setup() is called on every first open. I digged through core DRM > and noticed that we have a lot of code that cleans up on lastclose and > reinitializes on firstopen which is skipped for non-UMS drivers to > preserve KMS state if no user keeps DRM node open. I would like to > hear a comment in the commit-message which explains why we don't reset > "if_version", anymore. Are you sure UMS user-space does not depend on > this logic? > > I have no idea of UMS, but if that reinitialization on > lastclose+firstopen is not relied on, I guess we can remove a lot more > code. Just wanted to make sure that this is right. Yeah, you're right. I've been confused a bit with the need_setup logic and though that's only done once. But for ums drivers this seems to be done every time we restart X. I think I'll rework this patch here and shovel stuff around some more. E.g. the buf_async stuff can die with drm_fasync, and I think the re-init is better handled in functions called by drm_lastclose. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/prime: remove cargo-cult locking from map_sg helper
On Wed, Jul 10, 2013 at 5:18 PM, Konrad Rzeszutek Wilk wrote: >> So after a bit of irc chatting with Maarten this seems to be more >> involved. The above check is to cache the dma mapping, but the >> implementation is bogus in tons of ways: >> - If direction changes we don't bother with unmaping and freeing the >> mapping, but simply leak it. >> - This will break if the dma mapping needs explicit syncing since the >> helpers don't call sync_to_cpu/sync_to_device anywhere. > > Right, and I believe I signed up for that. Well, the breakage runs deeper since atm ttm doesn't have any concept of syncing from/to the device dma. Neither has i915. So this little issue here is just the tip of the iceberg ... >> So I think I'll decline to poke around more in this hornet nest and >> leave it at the locking removal. > > .. and I get the hornet nest :-). Is there a IRC log of what you guys talked > about so I don't omit certain pieces of code. The above is pretty much the summary, actually more lines than what we've discussed on irc ;-) It's on #dri-devel though: http://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&show_html=true&highlight_names=&date=2013-07-10 -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 33/39] drm: rip out drm_core_has_MTRR checks
On Wed, Jul 10, 2013 at 3:51 PM, David Herrmann wrote: >> -#if __OS_HAS_MTRR >> -static inline int drm_core_has_MTRR(struct drm_device *dev) >> -{ >> - return drm_core_check_feature(dev, DRIVER_USE_MTRR); >> -} >> -#else >> -#define drm_core_has_MTRR(dev) (0) >> -#endif >> - > > That was the last user of DRIVER_USE_MTRR (apart from drivers setting > it in .driver_features). Any reason to keep it around? Yeah, I guess we could rip things out. Which will also force me to properly audit drivers for the eventual behaviour change this could entail (in case there's an x86 driver which did not ask for an mtrr, but iirc there isn't). -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm: remove FASYNC support
So I've stumbled over drm_fasync and wondered what it does. Digging that up is quite a story. First I've had to read up on what this does and ended up being rather bewildered why peopled loved signals so much back in the days that they've created SIGIO just for that ... Then I wondered how this ever works, and what that strange "No-op." comment right above it should mean. After all calling the core fasync helper is pretty obviously not a noop. After reading through the kernels FASYNC implementation I've noticed that signals are only sent out to the processes attached with FASYNC by calling kill_fasync. No merged drm driver has ever done that. After more digging I've found out that the only driver that ever used this is the so called GAMMA driver. I've frankly never heard of such a gpu brand ever before. Now FASYNC seems to not have been the only bad thing with that driver, since Dave Airlie removed it from the drm driver with prejudice: commit 1430163b4bbf7b00367ea1066c1c5fe85dbeefed Author: Dave Airlie Date: Sun Aug 29 12:04:35 2004 + Drop GAMMA DRM from a great height ... Long story short, the drm fasync support seems to be doing absolutely nothing. And the only user of it was never merged into the upstream kernel. And we don't need any fops->fasync callback since the fcntl implementation in the kernel already implements the noop case correctly. So stop this particular cargo-cult and rip it all out. v2: Kill drm_fasync assignments in rcar (newly added) and imx drivers (somehow I've missed that one in staging). Also drop the reference in the drm DocBook. ARM compile-fail reported by Rob Clark. v3: Move the removal of dev->buf_asnyc assignment in drm_setup to this patch here. Cc: Dave Airlie Cc: Laurent Pinchart Cc: Rob Clark Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 1 - drivers/gpu/drm/ast/ast_drv.c| 1 - drivers/gpu/drm/cirrus/cirrus_drv.c | 1 - drivers/gpu/drm/drm_fops.c | 12 drivers/gpu/drm/gma500/psb_drv.c | 1 - drivers/gpu/drm/i810/i810_dma.c | 1 - drivers/gpu/drm/i810/i810_drv.c | 1 - drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/mga/mga_drv.c| 1 - drivers/gpu/drm/mgag200/mgag200_drv.c| 1 - drivers/gpu/drm/nouveau/nouveau_drm.c| 1 - drivers/gpu/drm/omapdrm/omap_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c| 1 - drivers/gpu/drm/r128/r128_drv.c | 1 - drivers/gpu/drm/radeon/radeon_drv.c | 2 -- drivers/gpu/drm/rcar-du/rcar_du_drv.c| 1 - drivers/gpu/drm/savage/savage_drv.c | 1 - drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 - drivers/gpu/drm/sis/sis_drv.c| 1 - drivers/gpu/drm/tdfx/tdfx_drv.c | 1 - drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 - drivers/gpu/drm/udl/udl_drv.c| 1 - drivers/gpu/drm/via/via_drv.c| 1 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 - drivers/gpu/host1x/drm/drm.c | 1 - drivers/staging/imx-drm/imx-drm-core.c | 1 - include/drm/drmP.h | 3 --- 27 files changed, 41 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 4d54ac8..79dd70e 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2498,7 +2498,6 @@ void (*postclose) (struct drm_device *, struct drm_file *); .poll = drm_poll, .read = drm_read, - .fasync = drm_fasync, .llseek = no_llseek, diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index df0d0a0..16050ed 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -190,7 +190,6 @@ static const struct file_operations ast_fops = { .unlocked_ioctl = drm_ioctl, .mmap = ast_mmap, .poll = drm_poll, - .fasync = drm_fasync, #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index 8ecb601..85748f6 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c @@ -85,7 +85,6 @@ static const struct file_operations cirrus_driver_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif - .fasync = drm_fasync, }; static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_USE_MTRR, diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 14e0bb6..aa846df 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -374,18 +374,6 @@ out_put_pid: return ret; } -/** No-op. */ -int drm_fasync(int fd, struct file *filp, int on) -{ - struct drm_file *priv = filp->private_data; - struct drm_device *dev = priv->minor->dev; - - DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, - (long)old_
[PATCH] drm: remove FASYNC support
So I've stumbled over drm_fasync and wondered what it does. Digging that up is quite a story. First I've had to read up on what this does and ended up being rather bewildered why peopled loved signals so much back in the days that they've created SIGIO just for that ... Then I wondered how this ever works, and what that strange "No-op." comment right above it should mean. After all calling the core fasync helper is pretty obviously not a noop. After reading through the kernels FASYNC implementation I've noticed that signals are only sent out to the processes attached with FASYNC by calling kill_fasync. No merged drm driver has ever done that. After more digging I've found out that the only driver that ever used this is the so called GAMMA driver. I've frankly never heard of such a gpu brand ever before. Now FASYNC seems to not have been the only bad thing with that driver, since Dave Airlie removed it from the drm driver with prejudice: commit 1430163b4bbf7b00367ea1066c1c5fe85dbeefed Author: Dave Airlie Date: Sun Aug 29 12:04:35 2004 + Drop GAMMA DRM from a great height ... Long story short, the drm fasync support seems to be doing absolutely nothing. And the only user of it was never merged into the upstream kernel. And we don't need any fops->fasync callback since the fcntl implementation in the kernel already implements the noop case correctly. So stop this particular cargo-cult and rip it all out. v2: Kill drm_fasync assignments in rcar (newly added) and imx drivers (somehow I've missed that one in staging). Also drop the reference in the drm DocBook. ARM compile-fail reported by Rob Clark. v3: Move the removal of dev->buf_asnyc assignment in drm_setup to this patch here. v4: Actually git add ... tsk. Cc: Dave Airlie Cc: Laurent Pinchart Cc: Rob Clark Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 1 - drivers/gpu/drm/ast/ast_drv.c| 1 - drivers/gpu/drm/cirrus/cirrus_drv.c | 1 - drivers/gpu/drm/drm_fops.c | 14 -- drivers/gpu/drm/gma500/psb_drv.c | 1 - drivers/gpu/drm/i810/i810_dma.c | 1 - drivers/gpu/drm/i810/i810_drv.c | 1 - drivers/gpu/drm/i915/i915_drv.c | 1 - drivers/gpu/drm/mga/mga_drv.c| 1 - drivers/gpu/drm/mgag200/mgag200_drv.c| 1 - drivers/gpu/drm/nouveau/nouveau_drm.c| 1 - drivers/gpu/drm/omapdrm/omap_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c| 1 - drivers/gpu/drm/r128/r128_drv.c | 1 - drivers/gpu/drm/radeon/radeon_drv.c | 2 -- drivers/gpu/drm/rcar-du/rcar_du_drv.c| 1 - drivers/gpu/drm/savage/savage_drv.c | 1 - drivers/gpu/drm/shmobile/shmob_drm_drv.c | 1 - drivers/gpu/drm/sis/sis_drv.c| 1 - drivers/gpu/drm/tdfx/tdfx_drv.c | 1 - drivers/gpu/drm/tilcdc/tilcdc_drv.c | 1 - drivers/gpu/drm/udl/udl_drv.c| 1 - drivers/gpu/drm/via/via_drv.c| 1 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 - drivers/gpu/host1x/drm/drm.c | 1 - drivers/staging/imx-drm/imx-drm-core.c | 1 - include/drm/drmP.h | 3 --- 27 files changed, 43 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 4d54ac8..79dd70e 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2498,7 +2498,6 @@ void (*postclose) (struct drm_device *, struct drm_file *); .poll = drm_poll, .read = drm_read, - .fasync = drm_fasync, .llseek = no_llseek, diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index df0d0a0..16050ed 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -190,7 +190,6 @@ static const struct file_operations ast_fops = { .unlocked_ioctl = drm_ioctl, .mmap = ast_mmap, .poll = drm_poll, - .fasync = drm_fasync, #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index 8ecb601..85748f6 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c @@ -85,7 +85,6 @@ static const struct file_operations cirrus_driver_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = drm_compat_ioctl, #endif - .fasync = drm_fasync, }; static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_USE_MTRR, diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 14e0bb6..d1b4771 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -75,8 +75,6 @@ static int drm_setup(struct drm_device * dev) dev->last_checked = 0; dev->if_version = 0; - dev->buf_async = NULL; - DRM_DEBUG("\n"); /* @@ -374,18 +372,6 @@ out_put_pid: return ret; } -/** No-op. */ -int drm
Re: [PATCH 00/39] clean out drm cruft and hide it better for kms drivers
Hi On Wed, Jul 10, 2013 at 2:11 PM, Daniel Vetter wrote: > Hi all, > > I've figured that it's again time for a bit of (late) drm spring cleanup. This > series here consists of a pile of "rip old stuff out" patches interleaved with > "disable old cruft for kms drivers and hide it better". > > Comments, flames and review highly welcome. I'd be especially happy if the arm > guys could check whether I haven't badly broken their drivers - > compile-testing > arm is a pita, so I haven't yet done that. > > There's a few driver-wide patches included, but the more invasive ones (i.e. > changing more than the drm driver vtable) are split out per-driver for easier > merging. If no one screams my plan is to rebase this pile on top of -rc1, give > it some more testing (check arm, ugh) and then send a pull request to Dave. > That should reduce interference with ongoing driver work as much as possible I > hope. > > My drm cruft todo list still has a pile of ideas, but I've figured I need to > stop now for 3.12. For those interested further cleanups could include: > > - setversion/set_busid: All drm core version 1.1 is legacy cruft, kms drivers > should never run in this mode. We could clean up the setversion ioclt (and > move the drm core version handling into a legacy function) and set up the > bus > id unconditionally at driver load time. > > - There's a few more legacy ioctls/subsystems that could be blocked out for > kms > drivers (but the required git history digging tends to be tedious). Also I > think we could more aggressively move legacy cruft setup/teardown code > out-of-line from the main code by extracting it into drm_legacy_ functions > (like this series here already does for the context and dma stuff). > > - I think creating a drm_internal.h header for functions not exported to > drivers > would be useful. That way we could move all the legacy functions out of > drmP.h > (which are a lot of them), which should make it much clearer what the real > drm > driver interface actually is. Please do that! It also reduces drmP.h and thus I don't have to recompile all drivers once we change legacy core code. > - drm_os_linux.h should just die in fire. > > - There's a pile of needless indirection around our agp handling, we duplicate > the agp core's CONFIG_AGP=n no-oping function handling in large parts, among > other stuff. I have a cleanup patch for AGP setup+teardown which further simplifies drm_fill_in_dev(). See: https://github.com/dvdhrm/linux/commits/drmdev I will rebase the drm_dev_*() helpers once Dave merged your series. > - The drm coherent dma alloc helpers could get ripped out, at least for kms > drivers. For ums drivers there's some funny cases where this mapping is > exchanged with userspace for e.g. register access. In a least one case > (i810.ko) userspace even sets up that mapping, which allows it to crash the > kernel at will (since those maps aren't refcounted). Maybe we need to shovel > those interfaces into a drm_legacy.ko module to keep them around but make > sure > that no new driver even thinks about using them. > > - There's also the matter of the vblank support code, imo that should be split > int a ums and a kms part. That'd would allow us to use struct drm_crtc * in > interfaces and proper locking (by grabbing crtc->mutex to exclude races with > dpms/modesets). > > If anyone wants to dig around in those areas please poke me. > > Cheers, Daniel > > Daniel Vetter (39): > drm: remove drm_modctx ioctl and use drm_noop instead > drm: kill dev->context_wait > drm: remove dev->last_switch > drm: kill dev->interrupt_flag and dev->dma_flag > drm: kill dev->ctx_start and dev->lck_start > drm/radoen: kill radeon_dma_ioctl_kms > drm: kill dev->buf_readers and dev->buf_writers > drm: remove redundant clears from drm_setup > drm/omap: kill firstopen callback > drm/radeon: kill firstopen callback for kms driver > drm/imx: kill firstopen callback > drm/vmwgfx: remove ->firstopen callback > drm: don't call ->firstopen for KMS drivers > drm: kill dev->driver->set_version > drm/radeon: remove DRIVER_HAS_DMA/SG/PCI_DMA from the kms driver > drm: fold in drm_sg_alloc into the ioctl > drm: hide legacy sg cleanup better from common code > drm: disallow legacy sg ioctls for modesetting drivers > drm: mark dma setup/teardown as legacy systems > drm/nouveau: drop DRIVER_PCI_DMA and DRIVER_SG > drm: disallow legacy dma ioctls for modesetting drivers > drm: move drm_getsarea into drm_bufs.c > drm/bufs: s/drm_order/order_base_2/ > drm/r128: s/drm_order/order_base_2/ > drm/radeon: s/drm_order/order_base_2/ > drm: remove drm_order > drm: mark context support as a legacy subsystem > drm/vmwgfx: remove redundant clearing of driver->dma_quiescent > drm: remove FASYNC support > drm: rip out DRIVER_FB_DMA and related code > drm: rip out a few unused DRIVER flags > drm: remove a bunch of unused #defines fr
Re: [PATCH 33/39] drm: rip out drm_core_has_MTRR checks
Hi On Wed, Jul 10, 2013 at 5:22 PM, Daniel Vetter wrote: > On Wed, Jul 10, 2013 at 3:51 PM, David Herrmann wrote: >>> -#if __OS_HAS_MTRR >>> -static inline int drm_core_has_MTRR(struct drm_device *dev) >>> -{ >>> - return drm_core_check_feature(dev, DRIVER_USE_MTRR); >>> -} >>> -#else >>> -#define drm_core_has_MTRR(dev) (0) >>> -#endif >>> - >> >> That was the last user of DRIVER_USE_MTRR (apart from drivers setting >> it in .driver_features). Any reason to keep it around? > > Yeah, I guess we could rip things out. Which will also force me to > properly audit drivers for the eventual behaviour change this could > entail (in case there's an x86 driver which did not ask for an mtrr, > but iirc there isn't). david@david-mb ~/dev/kernel/linux $ for i in drivers/gpu/drm/* ; do if test -d "$i" ; then if ! grep -q USE_MTRR -r $i ; then echo $i ; fi ; fi ; done drivers/gpu/drm/exynos drivers/gpu/drm/gma500 drivers/gpu/drm/i2c drivers/gpu/drm/nouveau drivers/gpu/drm/omapdrm drivers/gpu/drm/qxl drivers/gpu/drm/rcar-du drivers/gpu/drm/shmobile drivers/gpu/drm/tilcdc drivers/gpu/drm/ttm drivers/gpu/drm/udl drivers/gpu/drm/vmwgfx david@david-mb ~/dev/kernel/linux $ So for x86 gma500,nouveau,qxl,udl,vmwgfx don't set DRIVER_USE_MTRR. But I cannot tell whether they break if we call arch_phys_wc_add/del, anyway. At least nouveau seemed to work here, but it doesn't use AGP or drm_bufs, I guess. Cheers David > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/2] drm: rip out dev->last_checked
Only ever re-cleared in drm_setup, otherwise completely unused. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_fops.c | 1 - include/drm/drmP.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index d1b4771..5679971 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -72,7 +72,6 @@ static int drm_setup(struct drm_device * dev) dev->context_flag = 0; dev->last_context = 0; - dev->last_checked = 0; dev->if_version = 0; DRM_DEBUG("\n"); diff --git a/include/drm/drmP.h b/include/drm/drmP.h index d0043b8..374c2f1 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1112,7 +1112,6 @@ struct drm_device { /*@{ */ int irq_enabled;/**< True if irq handler is enabled */ __volatile__ long context_flag; /**< Context swapping flag */ - int last_checked; /**< Last context checked for DMA */ int last_context; /**< Last current context */ /*@} */ -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/2] drm: move dev data clearing from drm_setup to lastclose
We kzalloc this structure, and for real kms devices we should never loose track of things really. But ums/legacy drivers rely on the drm core to clean up a bit of cruft between lastclose and firstopen (i.e. when X is being restarted), so keep this around. But give it a clear drm_legacy_ prefix and conditionalize the code on !DRIVER_MODESET. Cc: David Herrmann Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_drv.c | 27 +++ drivers/gpu/drm/drm_fops.c | 27 +++ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index a9f48ff..7b4fd72 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -171,6 +171,31 @@ static const struct drm_ioctl_desc drm_ioctls[] = { #define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) /** + * drm_legacy_dev_reinit + * + * Reinitializes a legacy/ums drm device in it's lastclose function. + */ +static void drm_legacy_dev_reinit(struct drm_device *dev) +{ + int i; + + if (drm_core_check_feature(dev, DRIVER_MODESET)) + return; + + atomic_set(&dev->ioctl_count, 0); + atomic_set(&dev->vma_count, 0); + + for (i = 0; i < ARRAY_SIZE(dev->counts); i++) + atomic_set(&dev->counts[i], 0); + + dev->sigdata.lock = NULL; + + dev->context_flag = 0; + dev->last_context = 0; + dev->if_version = 0; +} + +/** * Take down the DRM device. * * \param dev DRM device structure. @@ -229,6 +254,8 @@ int drm_lastclose(struct drm_device * dev) dev->dev_mapping = NULL; mutex_unlock(&dev->struct_mutex); + drm_legacy_dev_reinit(dev); + DRM_DEBUG("lastclose completed\n"); return 0; } diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 5679971..59f4592 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c @@ -48,7 +48,6 @@ static int drm_open_helper(struct inode *inode, struct file *filp, static int drm_setup(struct drm_device * dev) { - int i; int ret; if (dev->driver->firstopen && @@ -58,32 +57,12 @@ static int drm_setup(struct drm_device * dev) return ret; } - atomic_set(&dev->ioctl_count, 0); - atomic_set(&dev->vma_count, 0); - - i = drm_legacy_dma_setup(dev); - if (i < 0) - return i; - - for (i = 0; i < ARRAY_SIZE(dev->counts); i++) - atomic_set(&dev->counts[i], 0); - - dev->sigdata.lock = NULL; + ret = drm_legacy_dma_setup(dev); + if (ret < 0) + return ret; - dev->context_flag = 0; - dev->last_context = 0; - dev->if_version = 0; DRM_DEBUG("\n"); - - /* -* The kernel's context could be created here, but is now created -* in drm_dma_enqueue. This is more resource-efficient for -* hardware that does not do DMA, but may mean that -* drm_select_queue fails between the time the interrupt is -* initialized and the time the queues are initialized. -*/ - return 0; } -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 33/39] drm: rip out drm_core_has_MTRR checks
On Wed, Jul 10, 2013 at 5:41 PM, David Herrmann wrote: > On Wed, Jul 10, 2013 at 5:22 PM, Daniel Vetter wrote: >> On Wed, Jul 10, 2013 at 3:51 PM, David Herrmann >> wrote: -#if __OS_HAS_MTRR -static inline int drm_core_has_MTRR(struct drm_device *dev) -{ - return drm_core_check_feature(dev, DRIVER_USE_MTRR); -} -#else -#define drm_core_has_MTRR(dev) (0) -#endif - >>> >>> That was the last user of DRIVER_USE_MTRR (apart from drivers setting >>> it in .driver_features). Any reason to keep it around? >> >> Yeah, I guess we could rip things out. Which will also force me to >> properly audit drivers for the eventual behaviour change this could >> entail (in case there's an x86 driver which did not ask for an mtrr, >> but iirc there isn't). > > david@david-mb ~/dev/kernel/linux $ for i in drivers/gpu/drm/* ; do if > test -d "$i" ; then if ! grep -q USE_MTRR -r $i ; then echo $i ; fi ; > fi ; done > drivers/gpu/drm/exynos > drivers/gpu/drm/gma500 > drivers/gpu/drm/i2c > drivers/gpu/drm/nouveau > drivers/gpu/drm/omapdrm > drivers/gpu/drm/qxl > drivers/gpu/drm/rcar-du > drivers/gpu/drm/shmobile > drivers/gpu/drm/tilcdc > drivers/gpu/drm/ttm > drivers/gpu/drm/udl > drivers/gpu/drm/vmwgfx > david@david-mb ~/dev/kernel/linux $ > > So for x86 gma500,nouveau,qxl,udl,vmwgfx don't set DRIVER_USE_MTRR. > But I cannot tell whether they break if we call arch_phys_wc_add/del, > anyway. At least nouveau seemed to work here, but it doesn't use AGP > or drm_bufs, I guess. Cool, thanks a lot for stitching together the list of drivers to look at. So for real KMS drivers it's the drives responsibility to add an mtrr if it needs one. nouvea, radeon, mgag200, i915 and vmwgfx do that already. Somehow the savage driver also ends up doing that, I have no idea why. Note that gma500 as a pure KMS driver doesn't need MTRR setup since the platforms that it supports all support PAT. So no MTRRs needed to get wc iomappings. The mtrr support in the drm core is all for legacy mappings of garts, framebuffers and registers. All legacy drivers set the USE_MTRR flag, so we're good there. All in all I think we can really just ditch this. I'll update the patch. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/2] drm: rip out drm_core_has_MTRR checks
The new arch_phys_wc_add/del functions do the right thing both with and without MTRR support in the kernel. So we can drop these additional checks. David Herrmann suggest to also kill the DRIVER_USE_MTRR flag since it's now unused, which spurred me to do a bit a better audit of the affected drivers. David helped a lot in that. Quoting our mail discussion: On Wed, Jul 10, 2013 at 5:41 PM, David Herrmann wrote: > On Wed, Jul 10, 2013 at 5:22 PM, Daniel Vetter wrote: >> On Wed, Jul 10, 2013 at 3:51 PM, David Herrmann >> wrote: -#if __OS_HAS_MTRR -static inline int drm_core_has_MTRR(struct drm_device *dev) -{ - return drm_core_check_feature(dev, DRIVER_USE_MTRR); -} -#else -#define drm_core_has_MTRR(dev) (0) -#endif - >>> >>> That was the last user of DRIVER_USE_MTRR (apart from drivers setting >>> it in .driver_features). Any reason to keep it around? >> >> Yeah, I guess we could rip things out. Which will also force me to >> properly audit drivers for the eventual behaviour change this could >> entail (in case there's an x86 driver which did not ask for an mtrr, >> but iirc there isn't). > > david@david-mb ~/dev/kernel/linux $ for i in drivers/gpu/drm/* ; do if > test -d "$i" ; then if ! grep -q USE_MTRR -r $i ; then echo $i ; fi ; > fi ; done > drivers/gpu/drm/exynos > drivers/gpu/drm/gma500 > drivers/gpu/drm/i2c > drivers/gpu/drm/nouveau > drivers/gpu/drm/omapdrm > drivers/gpu/drm/qxl > drivers/gpu/drm/rcar-du > drivers/gpu/drm/shmobile > drivers/gpu/drm/tilcdc > drivers/gpu/drm/ttm > drivers/gpu/drm/udl > drivers/gpu/drm/vmwgfx > david@david-mb ~/dev/kernel/linux $ > > So for x86 gma500,nouveau,qxl,udl,vmwgfx don't set DRIVER_USE_MTRR. > But I cannot tell whether they break if we call arch_phys_wc_add/del, > anyway. At least nouveau seemed to work here, but it doesn't use AGP > or drm_bufs, I guess. Cool, thanks a lot for stitching together the list of drivers to look at. So for real KMS drivers it's the drives responsibility to add an mtrr if it needs one. nouvea, radeon, mgag200, i915 and vmwgfx do that already. Somehow the savage driver also ends up doing that, I have no idea why. Note that gma500 as a pure KMS driver doesn't need MTRR setup since the platforms that it supports all support PAT. So no MTRRs needed to get wc iomappings. The mtrr support in the drm core is all for legacy mappings of garts, framebuffers and registers. All legacy drivers set the USE_MTRR flag, so we're good there. All in all I think we can really just ditch this /endquote v2: Also kill DRIVER_USE_MTRR as suggested by David Herrmann Cc: David Herrmann Cc: Andy Lutomirski Signed-off-by: Daniel Vetter --- drivers/gpu/drm/ast/ast_drv.c | 2 +- drivers/gpu/drm/cirrus/cirrus_drv.c | 2 +- drivers/gpu/drm/drm_bufs.c| 13 + drivers/gpu/drm/drm_pci.c | 11 +-- drivers/gpu/drm/drm_stub.c| 2 +- drivers/gpu/drm/drm_vm.c | 3 +-- drivers/gpu/drm/i810/i810_drv.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 2 +- drivers/gpu/drm/mga/mga_drv.c | 2 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +- drivers/gpu/drm/r128/r128_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 4 ++-- drivers/gpu/drm/savage/savage_drv.c | 2 +- drivers/gpu/drm/sis/sis_drv.c | 2 +- drivers/gpu/drm/tdfx/tdfx_drv.c | 1 - drivers/gpu/drm/via/via_drv.c | 2 +- include/drm/drmP.h| 11 --- 17 files changed, 24 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index 16050ed..3233d7b 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -197,7 +197,7 @@ static const struct file_operations ast_fops = { }; static struct drm_driver driver = { - .driver_features = DRIVER_USE_MTRR | DRIVER_MODESET | DRIVER_GEM, + .driver_features = DRIVER_MODESET | DRIVER_GEM, .dev_priv_size = 0, .load = ast_driver_load, diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c index 85748f6..bedad78 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.c +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c @@ -87,7 +87,7 @@ static const struct file_operations cirrus_driver_fops = { #endif }; static struct drm_driver driver = { - .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_USE_MTRR, + .driver_features = DRIVER_MODESET | DRIVER_GEM, .load = cirrus_driver_load, .unload = cirrus_driver_unload, .fops = &cirrus_driver_fops, diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 5f73f0a..f63133b 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -207,12 +207,10 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, return 0; } - if (drm_core_has_MTRR(dev)) {
[PATCH 2/2] drm/docs: rip out removed driver flags documentation
I've forgotten this and shuffling all the little pieces into the respective patches is rather cumbersome ... Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 29 - 1 file changed, 29 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 79dd70e..94f3abb 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -156,13 +156,6 @@ -DRIVER_USE_MTRR - - Driver uses MTRR interface for mapping memory, the DRM core will - manage MTRR resources. Deprecated. - - - DRIVER_PCI_DMA Driver is capable of PCI DMA, mapping of PCI DMA buffers to @@ -195,28 +188,6 @@ -DRIVER_IRQ_VBL -Unused. Deprecated. - - -DRIVER_DMA_QUEUE - - Should be set if the driver queues DMA requests and completes them - asynchronously. Deprecated. - - - -DRIVER_FB_DMA - - Driver supports DMA to/from the framebuffer, mapping of frambuffer - DMA buffers to userspace will be supported. Deprecated. - - - -DRIVER_IRQ_VBL2 -Unused. Deprecated. - - DRIVER_GEM Driver use the GEM memory manager. -- 1.8.3.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/prime: remove cargo-cult locking from map_sg helper
Op 10-07-13 16:48, Daniel Vetter schreef: > I've checked both implementations (radeon/nouveau) and they both grab > the page array from ttm simply by dereferencing it and then wrapping > it up with drm_prime_pages_to_sg in the callback and map it with > dma_map_sg (in the helper). > > Only the grabbing of the underlying page array is anything we need to > be concerned about, and either those pages are pinned independently, > or we're screwed no matter what. > > And indeed, nouveau/radeon pin the backing storage in their > attach/detach functions. > > Since I've created this patch cma prime support for dma_buf was added. > drm_gem_cma_prime_get_sg_table only calls kzalloc and the creates&maps > the sg table with dma_get_sgtable. It doesn't touch any gem object > state otherwise. So the cma helpers also look safe. > > The only thing we might claim it does is prevent concurrent mapping of > dma_buf attachments. But a) that's not allowed and b) the current code > is racy already since it checks whether the sg mapping exists _before_ > grabbing the lock. > > So the dev->struct_mutex locking here does absolutely nothing useful, > but only distracts. Remove it. > > This should also help Maarten's work to eventually pin the backing > storage more dynamically by preventing locking inversions around > dev->struct_mutex. > > v2: Add analysis for recently added cma helper prime code. > > Cc: Laurent Pinchart > Cc: Maarten Lankhorst > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_prime.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c > index 85e450e..64a99b3 100644 > --- a/drivers/gpu/drm/drm_prime.c > +++ b/drivers/gpu/drm/drm_prime.c > @@ -167,8 +167,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct > dma_buf_attachment *attach, > if (WARN_ON(prime_attach->dir != DMA_NONE)) > return ERR_PTR(-EBUSY); > > - mutex_lock(&obj->dev->struct_mutex); > - > sgt = obj->dev->driver->gem_prime_get_sg_table(obj); > > if (!IS_ERR(sgt)) { > @@ -182,7 +180,6 @@ static struct sg_table *drm_gem_map_dma_buf(struct > dma_buf_attachment *attach, > } > } > > - mutex_unlock(&obj->dev->struct_mutex); > return sgt; > } > acked ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 33/39] drm: rip out drm_core_has_MTRR checks
On Wed, Jul 10, 2013 at 6:27 PM, Andy Lutomirski wrote: > Are all of those codepaths really inaccessible in non-legacy drm > drivers? I didn't try to fully unravel all the ioctls and such, but > it seems like userspace could add bufs and map them. Since the mtrr > code isn't very robust (reference counting? what reference > counting?), I'm a little bit worried that potentially enabling it in > more cases, which your patch does, could be harmful. > > The arch_phys_wc stuff puts a prettier interface on the mtrr code and > turns it off when PAT is available, but the underlying code is still > just as bad. Well, the entire drm bufs stuff isn't refcounted and there are indeed legacy driver that abused this in a completely unsafe way. E.g. for i810.ko the ddx driver in userspace creates a register mapping through the addbuf ioctl, which the kernel driver then uses. With no refcounting at all to prevent an Oops (and I've seen them happen, you simply need to kill X). So I don't think this patch will make matters worse, especially since most drivers set DRIVER_USE_MTRR. The way to fix this up is to holesale block out these unsafe ioctls for kernel modesetting driver, which this series here does for a lot of cases (still a bunch of them left though). There's no way we can fix up the ums drm drivers without breaking userspace :( I haven't yet gotten around to blocking out the addmap ioctls since reviewing existing userspace code will be a real pain. But at least addmap is restrict to CAP_SYS_ADMIN, so not a that grave exploit issue. But I very much plan to do that audit and then disable addmap and friends for kms drivers. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 65723] Xonotic glsl 1.30 broken due to lack of derivatives support in radeonsi
https://bugs.freedesktop.org/show_bug.cgi?id=65723 Michel Dänzer changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #6 from Michel Dänzer --- Fixed in Mesa Git master (requires current LLVM 3.4 snapshot): commit a06ee5a09e7072aab29abac7a3afe7b04b6d6ee6 Author: Michel Dänzer Date: Wed Jun 19 18:14:01 2013 +0200 radeonsi: Handle TGSI_OPCODE_DDX/Y using local memory -- You are receiving this mail because: You are the assignee for the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel