Skip to content

Commit 735dc0d

Browse files
committed
Merge branch 'drm-kms-locking' of git://people.freedesktop.org/~danvet/drm-intel into drm-next
The aim of this locking rework is that ioctls which a compositor should be might call for every frame (set_cursor, page_flip, addfb, rmfb and getfb/create_handle) should not be able to block on kms background activities like output detection. And since each EDID read takes about 25ms (in the best case), that always means we'll drop at least one frame. The solution is to add per-crtc locking for these ioctls, and restrict background activities to only use the global lock. Change-the-world type of events (modeset, dpms, ...) need to grab all locks. Two tricky parts arose in the conversion: - A lot of current code assumes that a kms fb object can't disappear while holding the global lock, since the current code serializes fb destruction with it. Hence proper lifetime management using the already created refcounting for fbs need to be instantiated for all ioctls and interfaces/users. - The rmfb ioctl removes the to-be-deleted fb from all active users. But unconditionally taking the global kms lock to do so introduces an unacceptable potential stall point. And obviously changing the userspace abi isn't on the table, either. Hence this conversion opportunistically checks whether the rmfb ioctl holds the very last reference, which guarantees that the fb isn't in active use on any crtc or plane (thanks to the conversion to the new lifetime rules using proper refcounting). Only if this is not the case will the code go through the slowpath and grab all modeset locks. Sane compositors will never hit this path and so avoid the stall, but userspace relying on these semantics will also not break. All these cases are exercised by the newly added subtests for the i-g-t kms_flip, tested on a machine where a full detect cycle takes around 100 ms. It works, and no frames are dropped any more with these patches applied. kms_flip also contains a special case to exercise the above-describe rmfb slowpath. * 'drm-kms-locking' of git://people.freedesktop.org/~danvet/drm-intel: (335 commits) drm/fb_helper: check whether fbcon is bound drm/doc: updates for new framebuffer lifetime rules drm: don't hold crtc mutexes for connector ->detect callbacks drm: only grab the crtc lock for pageflips drm: optimize drm_framebuffer_remove drm/vmwgfx: add proper framebuffer refcounting drm/i915: dump refcount into framebuffer debugfs file drm: refcounting for crtc framebuffers drm: refcounting for sprite framebuffers drm: fb refcounting for dirtyfb_ioctl drm: don't take modeset locks in getfb ioctl drm: push modeset_lock_all into ->fb_create driver callbacks drm: nest modeset locks within fpriv->fbs_lock drm: reference framebuffers which are on the idr drm: revamp framebuffer cleanup interfaces drm: create drm_framebuffer_lookup drm: revamp locking around fb creation/destruction drm: only take the crtc lock for ->cursor_move drm: only take the crtc lock for ->cursor_set drm: add per-crtc locks ...
2 parents bac4b7c + 20c60c3 commit 735dc0d

396 files changed

Lines changed: 10827 additions & 2804 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/DocBook/drm.tmpl‎

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,25 @@ int max_width, max_height;</synopsis>
978978
If the parameters are deemed valid, drivers then create, initialize and
979979
return an instance of struct <structname>drm_framebuffer</structname>.
980980
If desired the instance can be embedded in a larger driver-specific
981-
structure. The new instance is initialized with a call to
982-
<function>drm_framebuffer_init</function> which takes a pointer to DRM
983-
frame buffer operations (struct
984-
<structname>drm_framebuffer_funcs</structname>). Frame buffer operations are
981+
structure. Drivers must fill its <structfield>width</structfield>,
982+
<structfield>height</structfield>, <structfield>pitches</structfield>,
983+
<structfield>offsets</structfield>, <structfield>depth</structfield>,
984+
<structfield>bits_per_pixel</structfield> and
985+
<structfield>pixel_format</structfield> fields from the values passed
986+
through the <parameter>drm_mode_fb_cmd2</parameter> argument. They
987+
should call the <function>drm_helper_mode_fill_fb_struct</function>
988+
helper function to do so.
989+
</para>
990+
991+
<para>
992+
The initailization of the new framebuffer instance is finalized with a
993+
call to <function>drm_framebuffer_init</function> which takes a pointer
994+
to DRM frame buffer operations (struct
995+
<structname>drm_framebuffer_funcs</structname>). Note that this function
996+
publishes the framebuffer and so from this point on it can be accessed
997+
concurrently from other threads. Hence it must be the last step in the
998+
driver's framebuffer initialization sequence. Frame buffer operations
999+
are
9851000
<itemizedlist>
9861001
<listitem>
9871002
<synopsis>int (*create_handle)(struct drm_framebuffer *fb,
@@ -1022,16 +1037,16 @@ int max_width, max_height;</synopsis>
10221037
</itemizedlist>
10231038
</para>
10241039
<para>
1025-
After initializing the <structname>drm_framebuffer</structname>
1026-
instance drivers must fill its <structfield>width</structfield>,
1027-
<structfield>height</structfield>, <structfield>pitches</structfield>,
1028-
<structfield>offsets</structfield>, <structfield>depth</structfield>,
1029-
<structfield>bits_per_pixel</structfield> and
1030-
<structfield>pixel_format</structfield> fields from the values passed
1031-
through the <parameter>drm_mode_fb_cmd2</parameter> argument. They
1032-
should call the <function>drm_helper_mode_fill_fb_struct</function>
1033-
helper function to do so.
1034-
</para>
1040+
The lifetime of a drm framebuffer is controlled with a reference count,
1041+
drivers can grab additional references with
1042+
<function>drm_framebuffer_reference</function> </para> and drop them
1043+
again with <function>drm_framebuffer_unreference</function>. For
1044+
driver-private framebuffers for which the last reference is never
1045+
dropped (e.g. for the fbdev framebuffer when the struct
1046+
<structname>drm_framebuffer</structname> is embedded into the fbdev
1047+
helper struct) drivers can manually clean up a framebuffer at module
1048+
unload time with
1049+
<function>drm_framebuffer_unregister_private</function>.
10351050
</sect2>
10361051
<sect2>
10371052
<title>Output Polling</title>
@@ -1043,6 +1058,22 @@ int max_width, max_height;</synopsis>
10431058
operation.
10441059
</para>
10451060
</sect2>
1061+
<sect2>
1062+
<title>Locking</title>
1063+
<para>
1064+
Beside some lookup structures with their own locking (which is hidden
1065+
behind the interface functions) most of the modeset state is protected
1066+
by the <code>dev-&lt;mode_config.lock</code> mutex and additionally
1067+
per-crtc locks to allow cursor updates, pageflips and similar operations
1068+
to occur concurrently with background tasks like output detection.
1069+
Operations which cross domains like a full modeset always grab all
1070+
locks. Drivers there need to protect resources shared between crtcs with
1071+
additional locking. They also need to be careful to always grab the
1072+
relevant crtc locks if a modset functions touches crtc state, e.g. for
1073+
load detection (which does only grab the <code>mode_config.lock</code>
1074+
to allow concurrent screen updates on live crtcs).
1075+
</para>
1076+
</sect2>
10461077
</sect1>
10471078

10481079
<!-- Internals: kms initialization and cleanup -->
@@ -1609,6 +1640,10 @@ void intel_crt_init(struct drm_device *dev)
16091640
make its properties available to applications.
16101641
</para>
16111642
</sect2>
1643+
<sect2>
1644+
<title>KMS API Functions</title>
1645+
!Edrivers/gpu/drm/drm_crtc.c
1646+
</sect2>
16121647
</sect1>
16131648

16141649
<!-- Internals: kms helper functions -->

‎MAINTAINERS‎

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ S: Maintained
228228
F: drivers/platform/x86/acerhdf.c
229229

230230
ACER WMI LAPTOP EXTRAS
231-
M: Joey Lee <jlee@novell.com>
231+
M: "Lee, Chun-Yi" <jlee@suse.com>
232232
L: platform-driver-x86@vger.kernel.org
233233
S: Maintained
234234
F: drivers/platform/x86/acer-wmi.c
@@ -648,7 +648,7 @@ F: arch/arm/
648648

649649
ARM SUB-ARCHITECTURES
650650
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
651-
S: MAINTAINED
651+
S: Maintained
652652
F: arch/arm/mach-*/
653653
F: arch/arm/plat-*/
654654
T: git git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git
@@ -1351,6 +1351,14 @@ W: http://wireless.kernel.org/en/users/Drivers/ath9k
13511351
S: Supported
13521352
F: drivers/net/wireless/ath/ath9k/
13531353

1354+
WILOCITY WIL6210 WIRELESS DRIVER
1355+
M: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
1356+
L: linux-wireless@vger.kernel.org
1357+
L: wil6210@qca.qualcomm.com
1358+
S: Supported
1359+
W: http://wireless.kernel.org/en/users/Drivers/wil6210
1360+
F: drivers/net/wireless/ath/wil6210/
1361+
13541362
CARL9170 LINUX COMMUNITY WIRELESS DRIVER
13551363
M: Christian Lamparter <chunkeey@googlemail.com>
13561364
L: linux-wireless@vger.kernel.org
@@ -1964,9 +1972,9 @@ S: Maintained
19641972
F: drivers/usb/host/ohci-ep93xx.c
19651973

19661974
CIRRUS LOGIC CS4270 SOUND DRIVER
1967-
M: Timur Tabi <timur@freescale.com>
1975+
M: Timur Tabi <timur@tabi.org>
19681976
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
1969-
S: Supported
1977+
S: Odd Fixes
19701978
F: sound/soc/codecs/cs4270*
19711979

19721980
CLEANCACHE API
@@ -3183,9 +3191,9 @@ F: include/uapi/video/
31833191
F: include/uapi/linux/fb.h
31843192

31853193
FREESCALE DIU FRAMEBUFFER DRIVER
3186-
M: Timur Tabi <timur@freescale.com>
3194+
M: Timur Tabi <timur@tabi.org>
31873195
L: linux-fbdev@vger.kernel.org
3188-
S: Supported
3196+
S: Maintained
31893197
F: drivers/video/fsl-diu-fb.*
31903198

31913199
FREESCALE DMA DRIVER
@@ -3220,9 +3228,8 @@ F: drivers/net/ethernet/freescale/fs_enet/
32203228
F: include/linux/fs_enet_pd.h
32213229

32223230
FREESCALE QUICC ENGINE LIBRARY
3223-
M: Timur Tabi <timur@freescale.com>
32243231
L: linuxppc-dev@lists.ozlabs.org
3225-
S: Supported
3232+
S: Orphan
32263233
F: arch/powerpc/sysdev/qe_lib/
32273234
F: arch/powerpc/include/asm/*qe.h
32283235

@@ -3241,16 +3248,16 @@ S: Maintained
32413248
F: drivers/net/ethernet/freescale/ucc_geth*
32423249

32433250
FREESCALE QUICC ENGINE UCC UART DRIVER
3244-
M: Timur Tabi <timur@freescale.com>
3251+
M: Timur Tabi <timur@tabi.org>
32453252
L: linuxppc-dev@lists.ozlabs.org
3246-
S: Supported
3253+
S: Maintained
32473254
F: drivers/tty/serial/ucc_uart.c
32483255

32493256
FREESCALE SOC SOUND DRIVERS
3250-
M: Timur Tabi <timur@freescale.com>
3257+
M: Timur Tabi <timur@tabi.org>
32513258
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
32523259
L: linuxppc-dev@lists.ozlabs.org
3253-
S: Supported
3260+
S: Maintained
32543261
F: sound/soc/fsl/fsl*
32553262
F: sound/soc/fsl/mpc8610_hpcd.c
32563263

@@ -5077,7 +5084,7 @@ S: Maintained
50775084
F: drivers/media/radio/radio-mr800.c
50785085

50795086
MSI LAPTOP SUPPORT
5080-
M: "Lee, Chun-Yi" <jlee@novell.com>
5087+
M: "Lee, Chun-Yi" <jlee@suse.com>
50815088
L: platform-driver-x86@vger.kernel.org
50825089
S: Maintained
50835090
F: drivers/platform/x86/msi-laptop.c
@@ -5507,8 +5514,7 @@ M: Benoît Cousson <b-cousson@ti.com>
55075514
M: Paul Walmsley <paul@pwsan.com>
55085515
L: linux-omap@vger.kernel.org
55095516
S: Maintained
5510-
F: arch/arm/mach-omap2/omap_hwmod.c
5511-
F: arch/arm/plat-omap/include/plat/omap_hwmod.h
5517+
F: arch/arm/mach-omap2/omap_hwmod.*
55125518

55135519
OMAP HWMOD DATA FOR OMAP4-BASED DEVICES
55145520
M: Benoît Cousson <b-cousson@ti.com>
@@ -7334,7 +7340,7 @@ S: Odd Fixes
73347340
F: drivers/staging/speakup/
73357341

73367342
STAGING - TI DSP BRIDGE DRIVERS
7337-
M: Omar Ramirez Luna <omar.ramirez@ti.com>
7343+
M: Omar Ramirez Luna <omar.ramirez@copitl.com>
73387344
S: Odd Fixes
73397345
F: drivers/staging/tidspbridge/
73407346

@@ -8526,7 +8532,7 @@ F: Documentation/x86/
85268532
F: arch/x86/
85278533

85288534
X86 PLATFORM DRIVERS
8529-
M: Matthew Garrett <mjg@redhat.com>
8535+
M: Matthew Garrett <matthew.garrett@nebula.com>
85308536
L: platform-driver-x86@vger.kernel.org
85318537
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git
85328538
S: Maintained

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
VERSION = 3
22
PATCHLEVEL = 8
33
SUBLEVEL = 0
4-
EXTRAVERSION = -rc3
4+
EXTRAVERSION = -rc4
55
NAME = Terrified Chipmunk
66

77
# *DOCUMENTATION*

‎arch/arm/boot/dts/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
155155
dtb-$(CONFIG_ARCH_ZYNQ) += zynq-zc702.dtb
156156

157157
targets += dtbs
158+
targets += $(dtb-y)
158159
endif
159160

160161
# *.dtb used to be generated in the directory above. Clean out the

‎arch/arm/boot/dts/at91sam9260.dtsi‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,22 @@
306306
};
307307
};
308308

309+
ssc0 {
310+
pinctrl_ssc0_tx: ssc0_tx-0 {
311+
atmel,pins =
312+
<1 16 0x1 0x0 /* PB16 periph A */
313+
1 17 0x1 0x0 /* PB17 periph A */
314+
1 18 0x1 0x0>; /* PB18 periph A */
315+
};
316+
317+
pinctrl_ssc0_rx: ssc0_rx-0 {
318+
atmel,pins =
319+
<1 19 0x1 0x0 /* PB19 periph A */
320+
1 20 0x1 0x0 /* PB20 periph A */
321+
1 21 0x1 0x0>; /* PB21 periph A */
322+
};
323+
};
324+
309325
pioA: gpio@fffff400 {
310326
compatible = "atmel,at91rm9200-gpio";
311327
reg = <0xfffff400 0x200>;
@@ -450,6 +466,8 @@
450466
compatible = "atmel,at91rm9200-ssc";
451467
reg = <0xfffbc000 0x4000>;
452468
interrupts = <14 4 5>;
469+
pinctrl-names = "default";
470+
pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
453471
status = "disabled";
454472
};
455473

‎arch/arm/boot/dts/at91sam9263.dtsi‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,38 @@
271271
};
272272
};
273273

274+
ssc0 {
275+
pinctrl_ssc0_tx: ssc0_tx-0 {
276+
atmel,pins =
277+
<1 0 0x2 0x0 /* PB0 periph B */
278+
1 1 0x2 0x0 /* PB1 periph B */
279+
1 2 0x2 0x0>; /* PB2 periph B */
280+
};
281+
282+
pinctrl_ssc0_rx: ssc0_rx-0 {
283+
atmel,pins =
284+
<1 3 0x2 0x0 /* PB3 periph B */
285+
1 4 0x2 0x0 /* PB4 periph B */
286+
1 5 0x2 0x0>; /* PB5 periph B */
287+
};
288+
};
289+
290+
ssc1 {
291+
pinctrl_ssc1_tx: ssc1_tx-0 {
292+
atmel,pins =
293+
<1 6 0x1 0x0 /* PB6 periph A */
294+
1 7 0x1 0x0 /* PB7 periph A */
295+
1 8 0x1 0x0>; /* PB8 periph A */
296+
};
297+
298+
pinctrl_ssc1_rx: ssc1_rx-0 {
299+
atmel,pins =
300+
<1 9 0x1 0x0 /* PB9 periph A */
301+
1 10 0x1 0x0 /* PB10 periph A */
302+
1 11 0x1 0x0>; /* PB11 periph A */
303+
};
304+
};
305+
274306
pioA: gpio@fffff200 {
275307
compatible = "atmel,at91rm9200-gpio";
276308
reg = <0xfffff200 0x200>;
@@ -368,13 +400,17 @@
368400
compatible = "atmel,at91rm9200-ssc";
369401
reg = <0xfff98000 0x4000>;
370402
interrupts = <16 4 5>;
403+
pinctrl-names = "default";
404+
pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
371405
status = "disabled";
372406
};
373407

374408
ssc1: ssc@fff9c000 {
375409
compatible = "atmel,at91rm9200-ssc";
376410
reg = <0xfff9c000 0x4000>;
377411
interrupts = <17 4 5>;
412+
pinctrl-names = "default";
413+
pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
378414
status = "disabled";
379415
};
380416

‎arch/arm/boot/dts/at91sam9g45.dtsi‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,38 @@
290290
};
291291
};
292292

293+
ssc0 {
294+
pinctrl_ssc0_tx: ssc0_tx-0 {
295+
atmel,pins =
296+
<3 0 0x1 0x0 /* PD0 periph A */
297+
3 1 0x1 0x0 /* PD1 periph A */
298+
3 2 0x1 0x0>; /* PD2 periph A */
299+
};
300+
301+
pinctrl_ssc0_rx: ssc0_rx-0 {
302+
atmel,pins =
303+
<3 3 0x1 0x0 /* PD3 periph A */
304+
3 4 0x1 0x0 /* PD4 periph A */
305+
3 5 0x1 0x0>; /* PD5 periph A */
306+
};
307+
};
308+
309+
ssc1 {
310+
pinctrl_ssc1_tx: ssc1_tx-0 {
311+
atmel,pins =
312+
<3 10 0x1 0x0 /* PD10 periph A */
313+
3 11 0x1 0x0 /* PD11 periph A */
314+
3 12 0x1 0x0>; /* PD12 periph A */
315+
};
316+
317+
pinctrl_ssc1_rx: ssc1_rx-0 {
318+
atmel,pins =
319+
<3 13 0x1 0x0 /* PD13 periph A */
320+
3 14 0x1 0x0 /* PD14 periph A */
321+
3 15 0x1 0x0>; /* PD15 periph A */
322+
};
323+
};
324+
293325
pioA: gpio@fffff200 {
294326
compatible = "atmel,at91rm9200-gpio";
295327
reg = <0xfffff200 0x200>;
@@ -425,13 +457,17 @@
425457
compatible = "atmel,at91sam9g45-ssc";
426458
reg = <0xfff9c000 0x4000>;
427459
interrupts = <16 4 5>;
460+
pinctrl-names = "default";
461+
pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>;
428462
status = "disabled";
429463
};
430464

431465
ssc1: ssc@fffa0000 {
432466
compatible = "atmel,at91sam9g45-ssc";
433467
reg = <0xfffa0000 0x4000>;
434468
interrupts = <17 4 5>;
469+
pinctrl-names = "default";
470+
pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>;
435471
status = "disabled";
436472
};
437473

0 commit comments

Comments
 (0)