linux-next: build failure after merge of the drm-misc tree
Hi all, On Thu, 3 Sep 2015 10:49:19 +1000 Stephen Rothwell wrote: > > After merging the drm-misc tree, today's linux-next build (arm > multi_v7_defconfig) failed like this: > > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function > 'mdp5_plane_cleanup_fb': > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:272:26: error: 'fb' redeclared as > different kind of symbol > struct drm_framebuffer *fb = old_state->fb; > ^ > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:267:27: note: previous definition > of 'fb' was here >struct drm_framebuffer *fb, >^ > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: At top level: > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:383:3: warning: initialization from > incompatible pointer type >.cleanup_fb = mdp5_plane_cleanup_fb, >^ > drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:383:3: warning: (near > initialization for 'mdp5_plane_helper_funcs.cleanup_fb') > > Caused by commit > > a317290af0db ("drm/atomic: Make prepare_fb/cleanup_fb only take state, v3") > > Well, that was clearly never build tested :-( > > I have used the drm-misc tree from next-20150902 for today. This is still in today's linux-next :-( -- Cheers, Stephen Rothwellsfr at canb.auug.org.au
[git pull] drm for 4.3
Hi Linus, On Fri, 4 Sep 2015 23:40:53 +0100 (IST) Dave Airlie wrote: > > This is the main pull request for the drm for 4.3. Nouveau is probably the > biggest > amount of changes in here, since it missed 4.2. Highlights below, along with > the usual > bunch of fixes. There are a few minor conflicts with your tree but nothing > you can't handle. All stuff outside drm should have applicable acks. > > The following changes since commit c13dcf9f2d6f5f06ef1bf79ec456df614c5e058b: > > Linux 4.2-rc8 (2015-08-23 20:52:59 -0700) > > are available in the git repository at: > > git://people.freedesktop.org/~airlied/linux drm-next > > for you to fetch changes up to 73bf1b7be7aab60d7c651402441dd0b0b4991098: > > Merge branch 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux > into drm-next (2015-09-05 07:46:09 +1000) This contains 59 commits added since Sept 1 and 56 of those are only appearing in today's linux-next. Not judging, just noting. -- Cheers, Stephen Rothwellsfr at canb.auug.org.au
[git pull] drm for 4.3
On 8 September 2015 at 12:03, Stephen Rothwell wrote: > Hi Linus, > > On Fri, 4 Sep 2015 23:40:53 +0100 (IST) Dave Airlie > wrote: >> >> This is the main pull request for the drm for 4.3. Nouveau is probably the >> biggest >> amount of changes in here, since it missed 4.2. Highlights below, along with >> the usual >> bunch of fixes. There are a few minor conflicts with your tree but nothing >> you can't handle. All stuff outside drm should have applicable acks. >> >> The following changes since commit c13dcf9f2d6f5f06ef1bf79ec456df614c5e058b: >> >> Linux 4.2-rc8 (2015-08-23 20:52:59 -0700) >> >> are available in the git repository at: >> >> git://people.freedesktop.org/~airlied/linux drm-next >> >> for you to fetch changes up to 73bf1b7be7aab60d7c651402441dd0b0b4991098: >> >> Merge branch 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux >> into drm-next (2015-09-05 07:46:09 +1000) > > This contains 59 commits added since Sept 1 and 56 of those are only > appearing in today's linux-next. Not judging, just noting. Is this to be a regular thing? because I know I'd prefer to merge fixes than wait for -rc1 to be an accurate copy of linux-next. Dave.
[git pull] drm for 4.3
Hi Dave, On Tue, 8 Sep 2015 13:01:21 +1000 Dave Airlie wrote: > > Is this to be a regular thing? because I know I'd prefer to merge > fixes than wait for -rc1 to be an accurate copy of linux-next. It happens when I can (almost) keep up with Linus' merge rate (often I can't). It is not an issue and I agree that fixes should just be done as/when needed. That is why I say "not judging, just noting" - I generally don't have the time to figure out if each and every unseen commit is a fix or new feature and/or if it has some possibility of interacting with some other tree in a way that a few days in linux-next may have flushed out. So, if you are happy with what you are doing (and you don't irritate Linus), then I am happy (as long as you don't cause unnecessary extra conflicts in linux-next :-)). -- Cheers, Stephen Rothwellsfr at canb.auug.org.au
linux-next: build failure after merge of the drm-misc tree
Op 08-09-15 om 01:42 schreef Stephen Rothwell: > Hi all, > > On Thu, 3 Sep 2015 10:49:19 +1000 Stephen Rothwell > wrote: >> After merging the drm-misc tree, today's linux-next build (arm >> multi_v7_defconfig) failed like this: >> >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function >> 'mdp5_plane_cleanup_fb': >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:272:26: error: 'fb' redeclared as >> different kind of symbol >> struct drm_framebuffer *fb = old_state->fb; >> ^ >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:267:27: note: previous definition >> of 'fb' was here >>struct drm_framebuffer *fb, >>^ >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: At top level: >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:383:3: warning: initialization >> from incompatible pointer type >>.cleanup_fb = mdp5_plane_cleanup_fb, >>^ >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:383:3: warning: (near >> initialization for 'mdp5_plane_helper_funcs.cleanup_fb') >> >> Caused by commit >> >> a317290af0db ("drm/atomic: Make prepare_fb/cleanup_fb only take state, v3") >> >> Well, that was clearly never build tested :-( >> >> I have used the drm-misc tree from next-20150902 for today. > This is still in today's linux-next :-( > I just got around to making an amend fix patch for it yesterday. Can you fold it into v3 daniel? diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 4d390b699e9a..a0f5ff0ce8dc 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -264,7 +264,6 @@ static int mdp5_plane_prepare_fb(struct drm_plane *plane, } static void mdp5_plane_cleanup_fb(struct drm_plane *plane, - struct drm_framebuffer *fb, const struct drm_plane_state *old_state) { struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
[git pull] drm for 4.3
On 8 September 2015 at 14:04, Stephen Rothwell wrote: > Hi Dave, > > On Tue, 8 Sep 2015 13:01:21 +1000 Dave Airlie wrote: >> >> Is this to be a regular thing? because I know I'd prefer to merge >> fixes than wait for -rc1 to be an accurate copy of linux-next. > > It happens when I can (almost) keep up with Linus' merge rate (often I > can't). It is not an issue and I agree that fixes should just be done > as/when needed. That is why I say "not judging, just noting" - I > generally don't have the time to figure out if each and every unseen > commit is a fix or new feature and/or if it has some possibility of > interacting with some other tree in a way that a few days in linux-next > may have flushed out. > > So, if you are happy with what you are doing (and you don't irritate > Linus), then I am happy (as long as you don't cause unnecessary extra > conflicts in linux-next :-)). > Maybe you could heuristic it by ratio new commits or new lines vs the total size of the -next tree. i.e. 59 commits in a 5000 commit tree is likely not that bad, 59 commits in a 20 commit tree would be bad. Though not sure how you'd tune it! Dave.
[Bug 103271] AMD R9 270X Flickering with DPM Enabled on Linux 4.1 with RadeonSI
https://bugzilla.kernel.org/show_bug.cgi?id=103271 --- Comment #13 from Michel Dänzer --- You should only run "git bisect" for commits which exhibit the same symptoms as described in this report. For commits exhibiting other issues, in particular such that you can't tell whether the problem described in this report occurs or not, you should run "git bisect skip" instead. -- You are receiving this mail because: You are watching the assignee of the bug.
[PATCHv2 0/3] Add initial support for slimport anx78xx
Hi all, The following series add initial support for the Slimport ANX7814 transmitter, a ultra-low power Full-HD (1080p60) transmitter designed for portable device. The driver was originally created and based from the work of Junhua Xia from Analogix. This driver is a refactor of the original driver and fixes different coding style lines, and different errors/warnings reported by checkpatch. Also there were things that I noticed that we need to change like: - Convert the numbered GPIO API to the new descriptor based GPIO API. - Review the DT binding - Add missing MODULE_DEVICE_TABLE(of, ...); - Fix Makefiles and Kconfig to build conditionally. - Use SIMPLE_DEV_PM_OPS() instead of the deprecated i2c .suspend and .resume callbacks. - Move to use managed device resources. - Remove dead/unused code. - And others ... This is series is a first attempt and will have mistake so all comments and suggestions are welcomed. Changes since v1: - As requested by Greg, move from staging to a subsystem. To be honest I'm not sure if gpu/drm/i2c is the proper subsystem for this driver so please feel free to correct me. Best regards, Enric Balletbo i Serra (3): of: Add vendor prefix for Analogix Semiconductor, Inc. devicetree: Add new ANX7814 SlimPort transmitter binding. drm/i2c: anx78xx: Add anx7814 driver support by analogix. .../devicetree/bindings/vendor-prefixes.txt|1 + .../devicetree/bindings/video/anx7814.txt | 22 + drivers/gpu/drm/i2c/Kconfig|2 + drivers/gpu/drm/i2c/Makefile |2 + drivers/gpu/drm/i2c/anx78xx/Kconfig|7 + drivers/gpu/drm/i2c/anx78xx/Makefile |4 + drivers/gpu/drm/i2c/anx78xx/slimport.c | 301 ++ drivers/gpu/drm/i2c/anx78xx/slimport.h | 49 + drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.c | 3335 drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.h | 254 ++ drivers/gpu/drm/i2c/anx78xx/slimport_tx_reg.h | 786 + 11 files changed, 4763 insertions(+) create mode 100644 Documentation/devicetree/bindings/video/anx7814.txt create mode 100644 drivers/gpu/drm/i2c/anx78xx/Kconfig create mode 100644 drivers/gpu/drm/i2c/anx78xx/Makefile create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport.c create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport.h create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.c create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.h create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport_tx_reg.h -- 2.1.0
[PATCHv2 1/3] of: Add vendor prefix for Analogix Semiconductor, Inc.
Analogix Semiconductor develops analog and mixed-signal devices for digital media and communications interconnect applications. Signed-off-by: Enric Balletbo i Serra --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index ac5f0c3..e914a02 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -22,6 +22,7 @@ ampireAmpire Co., Ltd. amsAMS AG amstaosAMS-Taos Inc. apmApplied Micro Circuits Corporation (APM) +analogix Analogix Semiconductor, Inc. aptina Aptina Imaging arasan Arasan Chip Systems armARM Ltd. -- 2.1.0
[PATCHv2 2/3] devicetree: Add new ANX7814 SlimPort transmitter binding.
The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter designed for portable devices. You can add support to your board with current binding. Example: anx7814: anx7814 at 38 { compatible = "analogix,anx7814"; reg = <0x38>; pd-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; reset-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; }; Signed-off-by: Enric Balletbo i Serra --- .../devicetree/bindings/video/anx7814.txt | 22 ++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/video/anx7814.txt diff --git a/Documentation/devicetree/bindings/video/anx7814.txt b/Documentation/devicetree/bindings/video/anx7814.txt new file mode 100644 index 000..a8cc746 --- /dev/null +++ b/Documentation/devicetree/bindings/video/anx7814.txt @@ -0,0 +1,22 @@ +Analogix ANX7814 SlimPort (Full-HD Transmitter) +--- + +The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter +designed for portable devices. + +Required properties: + + - compatible : "analogix,anx7814" + - reg : I2C address of the device + - pd-gpios: Which GPIO to use for power down + - reset-gpios : Which GPIO to use for reset + +Example: + + anx7814: anx7814 at 38 { + compatible = "analogix,anx7814"; + reg = <0x38>; + pd-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; + }; + -- 2.1.0
[PATCHv2 3/3] drm/i2c: anx78xx: Add anx7814 driver support by analogix.
The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter designed for portable devices. This driver adds initial support and supports HDMI to DP pass-through mode. Signed-off-by: Enric Balletbo i Serra --- drivers/gpu/drm/i2c/Kconfig |2 + drivers/gpu/drm/i2c/Makefile |2 + drivers/gpu/drm/i2c/anx78xx/Kconfig |7 + drivers/gpu/drm/i2c/anx78xx/Makefile |4 + drivers/gpu/drm/i2c/anx78xx/slimport.c| 301 +++ drivers/gpu/drm/i2c/anx78xx/slimport.h| 49 + drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.c | 3335 + drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.h | 254 ++ drivers/gpu/drm/i2c/anx78xx/slimport_tx_reg.h | 786 ++ 9 files changed, 4740 insertions(+) create mode 100644 drivers/gpu/drm/i2c/anx78xx/Kconfig create mode 100644 drivers/gpu/drm/i2c/anx78xx/Makefile create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport.c create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport.h create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.c create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport_tx_drv.h create mode 100644 drivers/gpu/drm/i2c/anx78xx/slimport_tx_reg.h diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig index 22c7ed6..e666ccd 100644 --- a/drivers/gpu/drm/i2c/Kconfig +++ b/drivers/gpu/drm/i2c/Kconfig @@ -31,4 +31,6 @@ config DRM_I2C_NXP_TDA998X help Support for NXP Semiconductors TDA998X HDMI encoders. +source "drivers/gpu/drm/i2c/anx78xx/Kconfig" + endmenu diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile index 2c72eb5..0ca15d2 100644 --- a/drivers/gpu/drm/i2c/Makefile +++ b/drivers/gpu/drm/i2c/Makefile @@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o tda998x-y := tda998x_drv.o obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o + +obj-$(CONFIG_DRM_I2C_ANX78XX) += anx78xx/ diff --git a/drivers/gpu/drm/i2c/anx78xx/Kconfig b/drivers/gpu/drm/i2c/anx78xx/Kconfig new file mode 100644 index 000..4862c06 --- /dev/null +++ b/drivers/gpu/drm/i2c/anx78xx/Kconfig @@ -0,0 +1,7 @@ +config DRM_I2C_ANX78XX + tristate "Analogix Slimport transmitter ANX78XX support" + help + Slimport Transmitter is a HD video transmitter chip + over micro-USB connector for smartphone device. + + diff --git a/drivers/gpu/drm/i2c/anx78xx/Makefile b/drivers/gpu/drm/i2c/anx78xx/Makefile new file mode 100644 index 000..e248ee5 --- /dev/null +++ b/drivers/gpu/drm/i2c/anx78xx/Makefile @@ -0,0 +1,4 @@ +obj-${CONFIG_DRM_I2C_ANX78XX} := anx78xx.o + +anx78xx-y := slimport.o +anx78xx-y += slimport_tx_drv.o diff --git a/drivers/gpu/drm/i2c/anx78xx/slimport.c b/drivers/gpu/drm/i2c/anx78xx/slimport.c new file mode 100644 index 000..287562e --- /dev/null +++ b/drivers/gpu/drm/i2c/anx78xx/slimport.c @@ -0,0 +1,301 @@ +/* + * Copyright(c) 2015, Analogix Semiconductor. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "slimport.h" +#include "slimport_tx_drv.h" + +/* HDCP switch for external block */ +/* external_block_en = 1: enable, 0: disable */ +int external_block_en = 1; + +struct i2c_client *anx78xx_client; + +int sp_read_reg_byte(uint8_t slave_addr, uint8_t offset) +{ + int ret = 0; + struct device *dev = &anx78xx_client->dev; + + anx78xx_client->addr = (slave_addr >> 1); + ret = i2c_smbus_read_byte_data(anx78xx_client, offset); + if (ret < 0) { + dev_err(dev, "%s: failed to read i2c addr=%x\n", LOG_TAG, + slave_addr); + return ret; + } + return 0; +} + +int sp_read_reg(uint8_t slave_addr, uint8_t offset, uint8_t *buf) +{ + int ret = 0; + struct device *dev = &anx78xx_client->dev; + + anx78xx_client->addr = (slave_addr >> 1); + ret = i2c_smbus_read_byte_data(anx78xx_client, offset); + if (ret < 0) { + dev_err(dev, "%s: failed to read i2c addr=%x\n", LOG_TAG, + slave_addr); + return ret; + } + *buf = (uint8_t) ret; + + return 0; +} + +int sp_write_reg(uint8_t slave_addr, uint8_t offset, uint8_t value) +{ + int ret = 0; + struct device *dev = &anx78xx_client->dev; + + anx78xx_client->addr = (slave_addr >> 1); + ret = i2c_smbus_write_byte_data(anx78xx_client, offset, value); + if (ret < 0) { +
[Bug 91917] linux-firmware.git should carry most recent firmware for SI, CI et al.
https://bugs.freedesktop.org/show_bug.cgi?id=91917 Bug ID: 91917 Summary: linux-firmware.git should carry most recent firmware for SI, CI et al. Product: DRI Version: unspecified Hardware: All OS: All Status: NEW Severity: trivial Priority: low Component: DRM/Radeon Assignee: dri-devel at lists.freedesktop.org Reporter: kai at dev.carbon-project.org CC: alexdeucher at gmail.com Right now the firmware shipped in <https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/radeon> is older, than what is available from <https://secure.freedesktop.org/~agd5f/radeon_ucode/>. Please consider submitting the most recent firmware files to the linux-firmware repository. For example, the most recent hawaii_ce.bin (<https://secure.freedesktop.org/~agd5f/radeon_ucode/hawaii/hawaii_ce.bin>) is from 2015-06-10, while the linux-firmware repository saw the last update on 2014-08-20 (merge was seven days later). As a MD5 comparison shows, these are not the same files: 9e05820da42549ce9c89d147cf1f8e19 linux-firmware/hawaii_ce.bin 286640da3d90d7b51bdb038b65addc47 p.fd.o/~agd5f/hawaii_ce.bin This update would allow me (and others) to drop custom "update" directories from /lib/firmware as distributions would pick them up. Which in turn would ease testing of new Kernels and Mesa revisions. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/02182ea6/attachment.html>
linux-next: build failure after merge of the drm-misc tree
On Tue, Sep 08, 2015 at 06:48:34AM +0200, Maarten Lankhorst wrote: > Op 08-09-15 om 01:42 schreef Stephen Rothwell: > > Hi all, > > > > On Thu, 3 Sep 2015 10:49:19 +1000 Stephen Rothwell > canb.auug.org.au> wrote: > >> After merging the drm-misc tree, today's linux-next build (arm > >> multi_v7_defconfig) failed like this: > >> > >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function > >> 'mdp5_plane_cleanup_fb': > >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:272:26: error: 'fb' redeclared > >> as different kind of symbol > >> struct drm_framebuffer *fb = old_state->fb; > >> ^ > >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:267:27: note: previous > >> definition of 'fb' was here > >>struct drm_framebuffer *fb, > >>^ > >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: At top level: > >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:383:3: warning: initialization > >> from incompatible pointer type > >>.cleanup_fb = mdp5_plane_cleanup_fb, > >>^ > >> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:383:3: warning: (near > >> initialization for 'mdp5_plane_helper_funcs.cleanup_fb') > >> > >> Caused by commit > >> > >> a317290af0db ("drm/atomic: Make prepare_fb/cleanup_fb only take state, > >> v3") > >> > >> Well, that was clearly never build tested :-( > >> > >> I have used the drm-misc tree from next-20150902 for today. > > This is still in today's linux-next :-( > > > I just got around to making an amend fix patch for it yesterday. Can you fold > it into v3 daniel? Squashed in, thanks. -Daniel > > diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c > b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c > index 4d390b699e9a..a0f5ff0ce8dc 100644 > --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c > +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c > @@ -264,7 +264,6 @@ static int mdp5_plane_prepare_fb(struct drm_plane *plane, > } > > static void mdp5_plane_cleanup_fb(struct drm_plane *plane, > - struct drm_framebuffer *fb, > const struct drm_plane_state *old_state) > { > struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
[PATCH] drm/atomic-helper: Add option to update planes only on active crtc
With drivers supporting runtime pm it's generally not a good idea to touch the hardware when it's off. Add an option to the commit_planes helper to support this case. Note that the helpers already add all planes on a crtc when a modeset happens, hence plane updates will not be lost if drivers set this to true. v2: Check for NULL state->crtc before chasing the pointer. Also check both old and new crtc if there's a switch. Finally just outright disallow switching crtcs for a plane if the plane is in active use, on most hardware that doesn't make sense. v3: Since commit_planes(active_only = true) is for enabling things only after all the crtc are on we should only look at the new crtc to decide whether to call the plane hooks - if the current CRTC isn't on then skip. If the old crtc (when moving a plane) went down then the plane should have been disabled as part of the pipe shutdown work already. For which there's currently no helper really unfortunately. Also move the check for wether a plane gets a new CRTC assigned while still in active use out of this patch. v4: Rebase over exynos changes. Cc: Maarten Lankhorst Cc: Thierry Reding Cc: Laurent Pinchart Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 20 ++-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- drivers/gpu/drm/msm/msm_atomic.c| 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tegra/drm.c | 2 +- include/drm/drm_atomic_helper.h | 3 ++- 8 files changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 9b0c47690ae8..12c25c54309f 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1037,7 +1037,7 @@ int drm_atomic_helper_commit(struct drm_device *dev, drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, state); + drm_atomic_helper_commit_planes(dev, state, false); drm_atomic_helper_commit_modeset_enables(dev, state); @@ -1146,10 +1146,16 @@ fail: } EXPORT_SYMBOL(drm_atomic_helper_prepare_planes); +bool plane_crtc_active(struct drm_plane_state *state) +{ + return state->crtc && state->crtc->state->active; +} + /** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device * @old_state: atomic state object with old state structures + * @active_only: Only commit on active CRTC if set * * This function commits the new plane state using the plane and atomic helper * functions for planes and crtcs. It assumes that the atomic state has already @@ -1164,7 +1170,8 @@ EXPORT_SYMBOL(drm_atomic_helper_prepare_planes); * drm_atomic_helper_commit_planes_on_crtc() instead. */ void drm_atomic_helper_commit_planes(struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *old_state, +bool active_only) { struct drm_crtc *crtc; struct drm_crtc_state *old_crtc_state; @@ -1180,6 +1187,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs || !funcs->atomic_begin) continue; + if (active_only && !crtc->state->active) + continue; + funcs->atomic_begin(crtc, old_crtc_state); } @@ -1191,6 +1201,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs) continue; + if (active_only && !plane_crtc_active(plane->state)) + continue; + /* * Special-case disabling the plane if drivers support it. */ @@ -1210,6 +1223,9 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev, if (!funcs || !funcs->atomic_flush) continue; + if (active_only && !crtc->state->active) + continue; + funcs->atomic_flush(crtc, old_crtc_state); } } diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index c1ed308496a2..632e21e0d1be 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -105,7 +105,7 @@ static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit) atomic_inc(&exynos_crtc->pending_update); } - drm_atomic_helper_commit_planes(dev, state); + drm_atomic_helper_commit_planes(dev, state, false); exynos_atomic_wait_for_commit(state); diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 1ceb4f22dd89..7eb253bc24df 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c
[RFC 0/2] drm/dsi: DSI for devices with different control bus
On 09/07/2015 01:46 PM, Archit Taneja wrote: > Thierry, > > On 08/21/2015 11:39 AM, Archit Taneja wrote: >> >> >> On 08/20/2015 05:18 PM, Thierry Reding wrote: >>> On Thu, Aug 20, 2015 at 09:46:14AM +0530, Archit Taneja wrote: Hi Thierry, Lucas, On 08/19/2015 08:32 PM, Thierry Reding wrote: > On Wed, Aug 19, 2015 at 04:52:24PM +0200, Lucas Stach wrote: >> Am Mittwoch, den 19.08.2015, 16:34 +0200 schrieb Thierry Reding: >>> On Wed, Aug 19, 2015 at 04:17:08PM +0200, Lucas Stach wrote: Hi Thierry, Archit, >> [...] > Perhaps a better way would be to invert this relationship. > According to > your proposal we'd have to have DT like this: > > i2c at ... { > ... > > dsi-device at ... { > ... > dsi-bus = <&dsi>; > ... > }; > > ... > }; > > dsi at ... { > ... > }; > > Inversing the relationship would become something like this: > > i2c at ... { > ... > }; > > dsi at ... { > ... > > peripheral at ... { > ... > i2c-bus = <&i2c>; > ... > }; > > ... > }; > > Both of those aren't fundamentally different, and they both have > the > disavantage of lacking ways to transport configuration data that > the > other bus needs to instantiate the dummy device (such as the reg > property for example, denoting the I2C slave address or the DSI > VC). > > So how about we create two devices in the device tree and fuse > them at > the driver level: > > i2c at ... { > ... > > i2cdsi: dsi-device at ... { > ... > }; > > ... > }; > > dsi at ... { > ... > > peripheral at ... { > ... > control = <&i2cdsi>; > ... > }; > > ... > }; > > This way we'll get both an I2C device and a DSI device that we > can fully > describe using the standard device tree bindings. At driver time > we can > get the I2C device from the phandle in the control property of > the DSI > device and use it to execute I2C transactions. > I don't really like to see that you are inventing yet-another-way to handle devices connected to multiple buses. Devicetree is structured along the control buses, even if the devices are connected to multiple buses, in the DT they are always children of the bus that is used to control their registers from the CPUs perspective. So a DSI encoder that is controlled through i2c is clearly a child of the i2c master controller and only of that one. >>> >>> I think that's a flawed interpretation of what's going on here. The >>> device in fact has two interfaces: one is I2C, the other is DSI. >>> In my >>> opinion that's reason enough to represent it as two logical devices. >>> >> Does it really have 2 control interfaces that are used at the same >> time? >> Or is the DSI connection a passive data bus if the register control >> happens through i2c? > > The interfaces may not be used at the same time, and the DSI interface > may even be crippled, but the device is still addressable from the DSI > host controller, if for nothing else than for routing the video stream. > If you need to model connections between devices that are not reflected through the control bus hierarchy you should really consider using the standardized of-graph bindings. (Documentation/devicetree/bindings/graph.txt) >>> >>> The problem is that the original proposal would instantiate a dummy >>> device, so it wouldn't be represented in DT at all. So unless you >>> do add >>> two logical devices to DT (one for each bus interface), you don't >>> have >>> anything to glue together with an OF graph. >>> >> I see that the having dummy device is the least desirable solution. >> But >> if there is only one control bus to the device I think it should be >> one >> device sitting beneath the control bus. >> >> You can then use of-graph to model the data path between the DSI >> encoder >> and device. > > But you will be
[PATCH] drm/atomic-helper: Add option to update planes only on active crtc
On Tue, Sep 08, 2015 at 12:02:07PM +0200, Daniel Vetter wrote: > With drivers supporting runtime pm it's generally not a good idea to > touch the hardware when it's off. Add an option to the commit_planes > helper to support this case. > > Note that the helpers already add all planes on a crtc when a modeset > happens, hence plane updates will not be lost if drivers set this to > true. > > v2: Check for NULL state->crtc before chasing the pointer. Also check > both old and new crtc if there's a switch. Finally just outright > disallow switching crtcs for a plane if the plane is in active use, on > most hardware that doesn't make sense. > > v3: Since commit_planes(active_only = true) is for enabling things > only after all the crtc are on we should only look at the new crtc to > decide whether to call the plane hooks - if the current CRTC isn't on > then skip. If the old crtc (when moving a plane) went down then the > plane should have been disabled as part of the pipe shutdown work > already. For which there's currently no helper really unfortunately. > Also move the check for wether a plane gets a new CRTC assigned while > still in active use out of this patch. > > v4: Rebase over exynos changes. > > Cc: Maarten Lankhorst > Cc: Thierry Reding > Cc: Laurent Pinchart > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_atomic_helper.c | 20 ++-- > drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- > drivers/gpu/drm/msm/msm_atomic.c| 2 +- > drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- > drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- > drivers/gpu/drm/sti/sti_drv.c | 2 +- > drivers/gpu/drm/tegra/drm.c | 2 +- > include/drm/drm_atomic_helper.h | 3 ++- > 8 files changed, 26 insertions(+), 9 deletions(-) Reviewed-by: Thierry Reding Tested-by: Thierry Reding -- next part -- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/ecb5f32d/attachment.sig>
[PATCH] drm/atomic-helper: Add option to update planes only on active crtc
Hi Daniel, Thank you for the patch. On Tuesday 08 September 2015 12:02:07 Daniel Vetter wrote: > With drivers supporting runtime pm it's generally not a good idea to > touch the hardware when it's off. Add an option to the commit_planes > helper to support this case. > > Note that the helpers already add all planes on a crtc when a modeset > happens, hence plane updates will not be lost if drivers set this to > true. > > v2: Check for NULL state->crtc before chasing the pointer. Also check > both old and new crtc if there's a switch. Finally just outright > disallow switching crtcs for a plane if the plane is in active use, on > most hardware that doesn't make sense. > > v3: Since commit_planes(active_only = true) is for enabling things > only after all the crtc are on we should only look at the new crtc to > decide whether to call the plane hooks - if the current CRTC isn't on > then skip. If the old crtc (when moving a plane) went down then the > plane should have been disabled as part of the pipe shutdown work > already. For which there's currently no helper really unfortunately. > Also move the check for wether a plane gets a new CRTC assigned while > still in active use out of this patch. > > v4: Rebase over exynos changes. > > Cc: Maarten Lankhorst > Cc: Thierry Reding > Cc: Laurent Pinchart > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_atomic_helper.c | 20 ++-- > drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- > drivers/gpu/drm/msm/msm_atomic.c| 2 +- > drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- > drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- > drivers/gpu/drm/sti/sti_drv.c | 2 +- > drivers/gpu/drm/tegra/drm.c | 2 +- > include/drm/drm_atomic_helper.h | 3 ++- > 8 files changed, 26 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c index 9b0c47690ae8..12c25c54309f > 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -1037,7 +1037,7 @@ int drm_atomic_helper_commit(struct drm_device *dev, > > drm_atomic_helper_commit_modeset_disables(dev, state); > > - drm_atomic_helper_commit_planes(dev, state); > + drm_atomic_helper_commit_planes(dev, state, false); > > drm_atomic_helper_commit_modeset_enables(dev, state); > > @@ -1146,10 +1146,16 @@ fail: > } > EXPORT_SYMBOL(drm_atomic_helper_prepare_planes); > > +bool plane_crtc_active(struct drm_plane_state *state) > +{ > + return state->crtc && state->crtc->state->active; > +} > + > /** > * drm_atomic_helper_commit_planes - commit plane state > * @dev: DRM device > * @old_state: atomic state object with old state structures > + * @active_only: Only commit on active CRTC if set > * > * This function commits the new plane state using the plane and atomic > helper > * functions for planes and crtcs. It assumes that the atomic state has > already Following our recent discussion on the subject, I believe some more documentation would be helpful in the form of guidelines for driver developers. Most drivers using the atomic helpers shouldn't need to be notified of plane state update for disabled CRTC, as the DRM core will record the plane state and apply it when the CRTC gets enabled. > @@ -1164,7 +1170,8 @@ > EXPORT_SYMBOL(drm_atomic_helper_prepare_planes); * > drm_atomic_helper_commit_planes_on_crtc() instead. > */ > void drm_atomic_helper_commit_planes(struct drm_device *dev, > - struct drm_atomic_state *old_state) > + struct drm_atomic_state *old_state, > + bool active_only) > { > struct drm_crtc *crtc; > struct drm_crtc_state *old_crtc_state; > @@ -1180,6 +1187,9 @@ void drm_atomic_helper_commit_planes(struct drm_device > *dev, if (!funcs || !funcs->atomic_begin) > continue; > > + if (active_only && !crtc->state->active) > + continue; > + > funcs->atomic_begin(crtc, old_crtc_state); > } > > @@ -1191,6 +1201,9 @@ void drm_atomic_helper_commit_planes(struct drm_device > *dev, if (!funcs) > continue; > > + if (active_only && !plane_crtc_active(plane->state)) > + continue; > + > /* >* Special-case disabling the plane if drivers support it. >*/ > @@ -1210,6 +1223,9 @@ void drm_atomic_helper_commit_planes(struct drm_device > *dev, if (!funcs || !funcs->atomic_flush) > continue; > > + if (active_only && !crtc->state->active) > + continue; > + > funcs->atomic_flush(crtc, old_crtc_state); > } > } > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c > b/drivers/gpu/drm/exynos/exynos_drm_drv.c index c1ed308496a2..632e21e0d1be > 100644 > --- a/dri
[PATCH] drm/atomic-helper: Add option to update planes only on active crtc
On Tue, Sep 08, 2015 at 01:10:58PM +0200, Thierry Reding wrote: > On Tue, Sep 08, 2015 at 12:02:07PM +0200, Daniel Vetter wrote: > > With drivers supporting runtime pm it's generally not a good idea to > > touch the hardware when it's off. Add an option to the commit_planes > > helper to support this case. > > > > Note that the helpers already add all planes on a crtc when a modeset > > happens, hence plane updates will not be lost if drivers set this to > > true. > > > > v2: Check for NULL state->crtc before chasing the pointer. Also check > > both old and new crtc if there's a switch. Finally just outright > > disallow switching crtcs for a plane if the plane is in active use, on > > most hardware that doesn't make sense. > > > > v3: Since commit_planes(active_only = true) is for enabling things > > only after all the crtc are on we should only look at the new crtc to > > decide whether to call the plane hooks - if the current CRTC isn't on > > then skip. If the old crtc (when moving a plane) went down then the > > plane should have been disabled as part of the pipe shutdown work > > already. For which there's currently no helper really unfortunately. > > Also move the check for wether a plane gets a new CRTC assigned while > > still in active use out of this patch. > > > > v4: Rebase over exynos changes. > > > > Cc: Maarten Lankhorst > > Cc: Thierry Reding > > Cc: Laurent Pinchart > > Signed-off-by: Daniel Vetter > > --- > > drivers/gpu/drm/drm_atomic_helper.c | 20 ++-- > > drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 +- > > drivers/gpu/drm/msm/msm_atomic.c| 2 +- > > drivers/gpu/drm/omapdrm/omap_drv.c | 2 +- > > drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 +- > > drivers/gpu/drm/sti/sti_drv.c | 2 +- > > drivers/gpu/drm/tegra/drm.c | 2 +- > > include/drm/drm_atomic_helper.h | 3 ++- > > 8 files changed, 26 insertions(+), 9 deletions(-) > > Reviewed-by: Thierry Reding > Tested-by: Thierry Reding Applied to drm-misc, thanks for the review. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
[PATCH] drm/atomic-helper: Pimp docs with recommendations for rpm drivers
Requested by Laurent. Note that this uses the new markdown support which will only land in kernel 4.4 (for the code snippet). v2: A few spelling fixes I spotted myself. Cc: Laurent Pinchart Reviewed-by: Thierry Reding (v1 on irc) Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 12c25c54309f..bd23b4dc7f43 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -993,6 +993,22 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); * object. This can still fail when e.g. the framebuffer reservation fails. For * now this doesn't implement asynchronous commits. * + * Note that right now this function does not support async commits, and hence + * driver writers must implement their own version for now. Also note that the + * default ordering of how the various stages are called is to match the legacy + * modeset helper library closest. One peculiarity of that is that it doesn't + * mesh well with runtime pm at all. + * + * For drivers supporting runtime PM the recommended sequence is + * + * drm_atomic_helper_commit_modeset_disables(dev, state); + * + * drm_atomic_helper_commit_modeset_enables(dev, state); + * + * drm_atomic_helper_commit_planes(dev, state, true); + * + * See the kerneldoc entries for these three functions for more details. + * * RETURNS * Zero for success or -errno. */ @@ -1168,6 +1184,12 @@ bool plane_crtc_active(struct drm_plane_state *state) * Note that this function does all plane updates across all CRTCs in one step. * If the hardware can't support this approach look at * drm_atomic_helper_commit_planes_on_crtc() instead. + * + * Note that for drivers supporting runtime PM, or which are otherwise unhappy if + * their plane update hooks get called on CRTCs which are off, it is highly + * recommended to set @active_only to true. Setting @active_only to false as the + * default implementation in drm_atomic_helper_commit() does is just done to + * most closely match the behaviour of the legacy helpers. */ void drm_atomic_helper_commit_planes(struct drm_device *dev, struct drm_atomic_state *old_state, -- 2.5.1
[PATCH 00/11] Mixed bag of ioctl and agp cleanups
Hi all, Big thing for sure is deprecating DRM_UNLOCKED for DRIVER_MODESET (i.e. modern drivers) since all of them have their own locking. Besides that a few random things that kind where in the same area/files. Of course kerneldoc is updated too. Feedback highly welcome. Cheers, Daniel Daniel Vetter (11): drm: Remove __OS_HAS_AGP drm/i915: Kill cross-module option depencies drm/i915: Mark debug mod options as _unsafe drm/i915: Remove setparam ioctl drm/i915: Mark getparam ioctl as DRM_UNLOCKED drm: Define a drm_invalid_op ioctl implementation drm/drm_ioctl.c: kerneldoc drm: Enforce unlocked ioctl operation for kms driver ioctls drm/vmwgfx: Stop checking for DRM_UNLOCKED drm/: Drop DRM_UNLOCKED from modeset drivers drm: Remove dummy agp ioctl wrappers Documentation/DocBook/drm.tmpl | 5 +- drivers/gpu/drm/Makefile| 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 +++ drivers/gpu/drm/armada/armada_drv.c | 9 +-- drivers/gpu/drm/drm_agpsupport.c| 4 +- drivers/gpu/drm/drm_bufs.c | 6 +- drivers/gpu/drm/drm_ioc32.c | 6 +- drivers/gpu/drm/drm_ioctl.c | 89 +-- drivers/gpu/drm/drm_memory.c| 6 +- drivers/gpu/drm/drm_vm.c| 8 +-- drivers/gpu/drm/exynos/exynos_drm_drv.c | 20 +++--- drivers/gpu/drm/i915/i915_dma.c | 101 ++ drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/i915_params.c | 30 drivers/gpu/drm/i915/intel_lrc.c| 3 +- drivers/gpu/drm/mga/mga_dma.c | 4 +- drivers/gpu/drm/msm/msm_drv.c | 14 ++-- drivers/gpu/drm/nouveau/nouveau_bo.c| 8 +-- drivers/gpu/drm/nouveau/nouveau_drm.c | 24 +++ drivers/gpu/drm/omapdrm/omap_drv.c | 12 ++-- drivers/gpu/drm/qxl/qxl_ioctl.c | 14 ++-- drivers/gpu/drm/r128/r128_cce.c | 12 ++-- drivers/gpu/drm/radeon/r600_cp.c| 14 ++-- drivers/gpu/drm/radeon/radeon_agp.c | 8 +-- drivers/gpu/drm/radeon/radeon_cp.c | 16 ++--- drivers/gpu/drm/radeon/radeon_kms.c | 124 +++- drivers/gpu/drm/radeon/radeon_ttm.c | 10 +-- drivers/gpu/drm/tegra/drm.c | 28 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 62 +++- include/drm/drmP.h | 2 + include/drm/drm_agpsupport.h| 54 +- 31 files changed, 321 insertions(+), 401 deletions(-) -- 2.5.1
[PATCH 01/11] drm: Remove __OS_HAS_AGP
We already express the drm/agp depencies correctly in Kconfig, so we can rip this remnant from the shared drm core days. Aside: Pretty much all the #ifdefs in radeon/nouveau could be killed if ttm would provide dummy functions. I'm not going to volunteer for that though. v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville Cc: Ville Syrjälä Signed-off-by: Daniel Vetter --- drivers/gpu/drm/Makefile | 3 ++- drivers/gpu/drm/drm_agpsupport.c | 4 ++-- drivers/gpu/drm/drm_bufs.c | 6 +++--- drivers/gpu/drm/drm_ioc32.c | 6 +++--- drivers/gpu/drm/drm_ioctl.c | 2 +- drivers/gpu/drm/drm_memory.c | 6 +++--- drivers/gpu/drm/drm_vm.c | 8 drivers/gpu/drm/mga/mga_dma.c| 4 ++-- drivers/gpu/drm/nouveau/nouveau_bo.c | 8 drivers/gpu/drm/r128/r128_cce.c | 12 ++-- drivers/gpu/drm/radeon/r600_cp.c | 14 +++--- drivers/gpu/drm/radeon/radeon_agp.c | 8 drivers/gpu/drm/radeon/radeon_cp.c | 16 drivers/gpu/drm/radeon/radeon_ttm.c | 10 +- include/drm/drm_agpsupport.h | 6 +++--- 15 files changed, 57 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 45e7719846b1..f458d6e33655 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -6,7 +6,7 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \ drm_context.o drm_dma.o \ drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_lock.o drm_memory.o drm_drv.o drm_vm.o \ - drm_agpsupport.o drm_scatter.o drm_pci.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 \ drm_info.o drm_debugfs.o drm_encoder_slave.o \ @@ -19,6 +19,7 @@ drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o drm-$(CONFIG_PCI) += ati_pcigart.o drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-$(CONFIG_OF) += drm_of.o +drm-$(CONFIG_AGP) += drm_agpsupport.o drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c index 4b2b4aa5033b..4dc85ec7aca1 100644 --- a/drivers/gpu/drm/drm_agpsupport.c +++ b/drivers/gpu/drm/drm_agpsupport.c @@ -36,7 +36,7 @@ #include #include "drm_legacy.h" -#if __OS_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) #include @@ -503,4 +503,4 @@ drm_agp_bind_pages(struct drm_device *dev, } EXPORT_SYMBOL(drm_agp_bind_pages); -#endif /* __OS_HAS_AGP */ +#endif /* CONFIG_AGP */ diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 569064a00693..f1a204d253cc 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -582,7 +582,7 @@ static void drm_cleanup_buf_error(struct drm_device * dev, } } -#if __OS_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) /** * Add AGP buffers for DMA transfers. * @@ -756,7 +756,7 @@ int drm_legacy_addbufs_agp(struct drm_device *dev, return 0; } EXPORT_SYMBOL(drm_legacy_addbufs_agp); -#endif /* __OS_HAS_AGP */ +#endif /* CONFIG_AGP */ int drm_legacy_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *request) @@ -1145,7 +1145,7 @@ int drm_legacy_addbufs(struct drm_device *dev, void *data, if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) return -EINVAL; -#if __OS_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) if (request->flags & _DRM_AGP_BUFFER) ret = drm_legacy_addbufs_agp(dev, request); else diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index ddfa6014c2c2..57676f8d7ecf 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c @@ -720,7 +720,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd, return 0; } -#if __OS_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) typedef struct drm_agp_mode32 { u32 mode; /**< AGP mode */ } drm_agp_mode32_t; @@ -882,7 +882,7 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd, return drm_ioctl(file, DRM_IOCTL_AGP_UNBIND, (unsigned long)request); } -#endif /* __OS_HAS_AGP */ +#endif /* CONFIG_AGP */ typedef struct drm_scatter_gather32 { u32 size; /**< In bytes -- will round to page boundary */ @@ -1090,7 +1090,7 @@ static drm_ioctl_compat_t *drm_compat_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX32)] = compat_drm_getsareactx, [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX32)] = compat_drm_resctx, [DRM_IOCTL_NR(DRM_IOCTL_DMA32)] = compat_drm_dma, -#if __OS_HAS_AGP +#if IS_ENABLED(CONFIG_AGP) [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE32)] = compat_drm_agp_enable, [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO32)] = compat_drm_agp_info,
[PATCH 02/11] drm/i915: Kill cross-module option depencies
Makes it really hard to reason about these since there are dependency loops. Also if you touch them and don't know what you're doing you get to keep all the pieces. v2: Move marking debug module options as _unsafe into a separate patch, as requested by Jani. Cc: Jani Nikula Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c| 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 87862813cfde..92287dfffceb 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -140,7 +140,7 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt) return 0; } - if (INTEL_INFO(dev)->gen >= 8 && i915.enable_execlists) + if (INTEL_INFO(dev)->gen >= 8) return 2; else return has_aliasing_ppgtt ? 1 : 0; diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 28a712e7d2d0..07b316a72c02 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -248,8 +248,7 @@ int intel_sanitize_enable_execlists(struct drm_device *dev, int enable_execlists if (enable_execlists == 0) return 0; - if (HAS_LOGICAL_RING_CONTEXTS(dev) && USES_PPGTT(dev) && - i915.use_mmio_flip >= 0) + if (HAS_LOGICAL_RING_CONTEXTS(dev)) return 1; return 0; -- 2.5.1
[PATCH 03/11] drm/i915: Mark debug mod options as _unsafe
We don't want random people to touch these. Especially true since we've just screwed up SKL by holding it way too long under the preliminary flag because of some ABI issues. And now there's howtos all over the internets about how to set this. Same pretty much for anything else. Cc: Jani Nikula Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_params.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index 05053e2e9ff0..39a8f560fad7 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -62,7 +62,7 @@ MODULE_PARM_DESC(modeset, "Use kernel modesetting [KMS] (0=disable, " "1=on, -1=force vga console preference [default])"); -module_param_named(panel_ignore_lid, i915.panel_ignore_lid, int, 0600); +module_param_named_unsafe(panel_ignore_lid, i915.panel_ignore_lid, int, 0600); MODULE_PARM_DESC(panel_ignore_lid, "Override lid status (0=autodetect, 1=autodetect disabled [default], " "-1=force lid closed, -2=force lid open)"); @@ -85,17 +85,17 @@ MODULE_PARM_DESC(enable_fbc, "Enable frame buffer compression for power savings " "(default: -1 (use per-chip default))"); -module_param_named(lvds_channel_mode, i915.lvds_channel_mode, int, 0600); +module_param_named_unsafe(lvds_channel_mode, i915.lvds_channel_mode, int, 0600); MODULE_PARM_DESC(lvds_channel_mode, "Specify LVDS channel mode " "(0=probe BIOS [default], 1=single-channel, 2=dual-channel)"); -module_param_named(lvds_use_ssc, i915.panel_use_ssc, int, 0600); +module_param_named_unsafe(lvds_use_ssc, i915.panel_use_ssc, int, 0600); MODULE_PARM_DESC(lvds_use_ssc, "Use Spread Spectrum Clock with panels [LVDS/eDP] " "(default: auto from VBT)"); -module_param_named(vbt_sdvo_panel_type, i915.vbt_sdvo_panel_type, int, 0600); +module_param_named_unsafe(vbt_sdvo_panel_type, i915.vbt_sdvo_panel_type, int, 0600); MODULE_PARM_DESC(vbt_sdvo_panel_type, "Override/Ignore selection of SDVO panel mode in the VBT " "(-2=ignore, -1=auto [default], index in VBT BIOS table)"); @@ -103,7 +103,7 @@ MODULE_PARM_DESC(vbt_sdvo_panel_type, module_param_named_unsafe(reset, i915.reset, bool, 0600); MODULE_PARM_DESC(reset, "Attempt GPU resets (default: true)"); -module_param_named(enable_hangcheck, i915.enable_hangcheck, bool, 0644); +module_param_named_unsafe(enable_hangcheck, i915.enable_hangcheck, bool, 0644); MODULE_PARM_DESC(enable_hangcheck, "Periodically check GPU activity for detecting hangs. " "WARNING: Disabling this can cause system wide hangs. " @@ -114,26 +114,26 @@ MODULE_PARM_DESC(enable_ppgtt, "Override PPGTT usage. " "(-1=auto [default], 0=disabled, 1=aliasing, 2=full)"); -module_param_named(enable_execlists, i915.enable_execlists, int, 0400); +module_param_named_unsafe(enable_execlists, i915.enable_execlists, int, 0400); MODULE_PARM_DESC(enable_execlists, "Override execlists usage. " "(-1=auto [default], 0=disabled, 1=enabled)"); -module_param_named(enable_psr, i915.enable_psr, int, 0600); +module_param_named_unsafe(enable_psr, i915.enable_psr, int, 0600); MODULE_PARM_DESC(enable_psr, "Enable PSR (default: false)"); -module_param_named(preliminary_hw_support, i915.preliminary_hw_support, int, 0600); +module_param_named_unsafe(preliminary_hw_support, i915.preliminary_hw_support, int, 0600); MODULE_PARM_DESC(preliminary_hw_support, "Enable preliminary hardware support."); -module_param_named(disable_power_well, i915.disable_power_well, int, 0600); +module_param_named_unsafe(disable_power_well, i915.disable_power_well, int, 0600); MODULE_PARM_DESC(disable_power_well, "Disable the power well when possible (default: true)"); -module_param_named(enable_ips, i915.enable_ips, int, 0600); +module_param_named_unsafe(enable_ips, i915.enable_ips, int, 0600); MODULE_PARM_DESC(enable_ips, "Enable IPS (default: true)"); -module_param_named(fastboot, i915.fastboot, bool, 0600); +module_param_named_unsafe(fastboot, i915.fastboot, bool, 0600); MODULE_PARM_DESC(fastboot, "Try to skip unnecessary mode sets at boot time (default: false)"); @@ -147,7 +147,7 @@ MODULE_PARM_DESC(load_detect_test, "Force-enable the VGA load detect code for testing (default:false). " "For developers only."); -module_param_named(invert_brightness, i915.invert_brightness, int, 0600); +module_param_named_unsafe(invert_brightness, i915.invert_brightness, int, 0600); MODULE_PARM_DESC(invert_brightness, "Invert backlight brightness " "(-1 force normal, 0 machine defaults, 1 force inversion), please " @@ -158,14 +158,14 @@ MODULE_PARM_DESC(invert_brightness, module_param_named(disable_display, i915.disable_display, bool, 0600); MODULE_PARM_DESC(disable_display, "Disable display (default: false)"); -module_param_named(
[PATCH 04/11] drm/i915: Remove setparam ioctl
This was only used for the ums+gem combo, so ripe for removal now that we only have kms code left. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_dma.c | 31 +-- 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index e267bc21b453..b1bcb7e8540a 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -184,35 +184,6 @@ static int i915_getparam(struct drm_device *dev, void *data, return 0; } -static int i915_setparam(struct drm_device *dev, void *data, -struct drm_file *file_priv) -{ - struct drm_i915_private *dev_priv = dev->dev_private; - drm_i915_setparam_t *param = data; - - switch (param->param) { - case I915_SETPARAM_USE_MI_BATCHBUFFER_START: - case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY: - case I915_SETPARAM_ALLOW_BATCHBUFFER: - /* Reject all old ums/dri params. */ - return -ENODEV; - - case I915_SETPARAM_NUM_USED_FENCES: - if (param->value > dev_priv->num_fence_regs || - param->value < 0) - return -EINVAL; - /* Userspace can use first N regs */ - dev_priv->fence_reg_start = param->value; - break; - default: - DRM_DEBUG_DRIVER("unknown parameter %d\n", - param->param); - return -EINVAL; - } - - return 0; -} - static int i915_get_bridge_dev(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -1254,7 +1225,7 @@ const struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_IRQ_EMIT, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_IRQ_WAIT, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_GETPARAM, i915_getparam, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_SETPARAM, i915_setparam, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_SETPARAM, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_ALLOC, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_FREE, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_INIT_HEAP, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), -- 2.5.1
[PATCH 05/11] drm/i915: Mark getparam ioctl as DRM_UNLOCKED
With kms all the data getparam looks at is actually invariant, and certainly not protected by the global kms mutex. With ums all the setup code is already racy as hell, so this won't make things any worse. I've done this change so that all ioctl still used by kms drivers are marked as DRM_UNLOCKED, besides that we obviously don't need it any more in kms mode. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index b1bcb7e8540a..3210a7ad49d6 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -1224,7 +1224,7 @@ const struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_BATCHBUFFER, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_IRQ_EMIT, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_IRQ_WAIT, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_GETPARAM, i915_getparam, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GETPARAM, i915_getparam, DRM_AUTH|DRM_RENDER_ALLOW|DRM_UNLOCKED), DRM_IOCTL_DEF_DRV(I915_SETPARAM, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_ALLOC, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_FREE, drm_noop, DRM_AUTH), -- 2.5.1
[PATCH 06/11] drm: Define a drm_invalid_op ioctl implementation
And use it in radeon to replace all the ioctls no longer valid in kms mode. I plan to also use this later on when nuking the ums support for i915. Note that setting the function pointer in the ioctl table to NULL would amount to the same, but that results in some debug output from the drm_ioctl() function. I've figured it's cleaner to have a special-purpose function. Cc: Alex Deucher Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_ioctl.c | 7 +++ drivers/gpu/drm/radeon/radeon_kms.c | 94 +++-- include/drm/drmP.h | 2 + 3 files changed, 36 insertions(+), 67 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 4d7f2677b2ea..f0b4f581f6ce 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -415,6 +415,13 @@ int drm_noop(struct drm_device *dev, void *data, } EXPORT_SYMBOL(drm_noop); +int drm_invalid_op(struct drm_device *dev, void *data, + struct drm_file *file_priv) +{ + return -EINVAL; +} +EXPORT_SYMBOL(drm_invalid_op); + /** * Copy and IOCTL return string to user space */ diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 4a119c255ba9..03d285b30c83 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -844,74 +844,34 @@ int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, drmcrtc, &drmcrtc->hwmode); } -#define KMS_INVALID_IOCTL(name) \ -static int name(struct drm_device *dev, void *data, struct drm_file\ - *file_priv) \ -{ \ - DRM_ERROR("invalid ioctl with kms %s\n", __func__); \ - return -EINVAL; \ -} - -/* - * All these ioctls are invalid in kms world. - */ -KMS_INVALID_IOCTL(radeon_cp_init_kms) -KMS_INVALID_IOCTL(radeon_cp_start_kms) -KMS_INVALID_IOCTL(radeon_cp_stop_kms) -KMS_INVALID_IOCTL(radeon_cp_reset_kms) -KMS_INVALID_IOCTL(radeon_cp_idle_kms) -KMS_INVALID_IOCTL(radeon_cp_resume_kms) -KMS_INVALID_IOCTL(radeon_engine_reset_kms) -KMS_INVALID_IOCTL(radeon_fullscreen_kms) -KMS_INVALID_IOCTL(radeon_cp_swap_kms) -KMS_INVALID_IOCTL(radeon_cp_clear_kms) -KMS_INVALID_IOCTL(radeon_cp_vertex_kms) -KMS_INVALID_IOCTL(radeon_cp_indices_kms) -KMS_INVALID_IOCTL(radeon_cp_texture_kms) -KMS_INVALID_IOCTL(radeon_cp_stipple_kms) -KMS_INVALID_IOCTL(radeon_cp_indirect_kms) -KMS_INVALID_IOCTL(radeon_cp_vertex2_kms) -KMS_INVALID_IOCTL(radeon_cp_cmdbuf_kms) -KMS_INVALID_IOCTL(radeon_cp_getparam_kms) -KMS_INVALID_IOCTL(radeon_cp_flip_kms) -KMS_INVALID_IOCTL(radeon_mem_alloc_kms) -KMS_INVALID_IOCTL(radeon_mem_free_kms) -KMS_INVALID_IOCTL(radeon_mem_init_heap_kms) -KMS_INVALID_IOCTL(radeon_irq_emit_kms) -KMS_INVALID_IOCTL(radeon_irq_wait_kms) -KMS_INVALID_IOCTL(radeon_cp_setparam_kms) -KMS_INVALID_IOCTL(radeon_surface_alloc_kms) -KMS_INVALID_IOCTL(radeon_surface_free_kms) - - const struct drm_ioctl_desc radeon_ioctls_kms[] = { - DRM_IOCTL_DEF_DRV(RADEON_CP_INIT, radeon_cp_init_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(RADEON_CP_START, radeon_cp_start_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(RADEON_CP_STOP, radeon_cp_stop_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(RADEON_CP_RESET, radeon_cp_reset_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(RADEON_CP_IDLE, radeon_cp_idle_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_CP_RESUME, radeon_cp_resume_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_RESET, radeon_engine_reset_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_FULLSCREEN, radeon_fullscreen_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_SWAP, radeon_cp_swap_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_CLEAR, radeon_cp_clear_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_VERTEX, radeon_cp_vertex_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_INDICES, radeon_cp_indices_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_TEXTURE, radeon_cp_texture_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_STIPPLE, radeon_cp_stipple_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_INDIRECT, radeon_cp_indirect_kms, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(RADEON_VERTEX2, radeon_cp_vertex2_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_CMDBUF, radeon_cp_cmdbuf_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_GETPARAM, radeon_cp_getparam_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_FLIP, radeon_cp_flip_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_ALLOC, radeon_mem_alloc_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_FREE, radeon_mem_free_kms, DRM_AUTH), - DRM_IOCTL_DEF_DRV(RADEON_INIT_HEAP, radeon_mem_init_heap_kms, DRM_AU
[PATCH 07/11] drm/drm_ioctl.c: kerneldoc
As usual pull it into the drm docbook template, too. And again as usual I've decided to only document stuff exported to drivers, so all the old leftover markup from the shared drm repo days lost the magic ** signature. Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 1 + drivers/gpu/drm/drm_ioctl.c| 76 ++ 2 files changed, 55 insertions(+), 22 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 7d10be2a2ba0..cfb43203a6a7 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -3752,6 +3752,7 @@ int num_ioctls; +!Edrivers/gpu/drm/drm_ioctl.c diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index f0b4f581f6ce..75df8ea87cd7 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -40,7 +40,7 @@ static int drm_version(struct drm_device *dev, void *data, struct drm_file *file_priv); -/** +/* * Get the bus id. * * \param inode device inode. @@ -75,7 +75,7 @@ drm_unset_busid(struct drm_device *dev, master->unique_len = 0; } -/** +/* * Set the bus id. * * \param inode device inode. @@ -149,7 +149,7 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv) return 0; } -/** +/* * Get a mapping information. * * \param inode device inode. @@ -201,7 +201,7 @@ static int drm_getmap(struct drm_device *dev, void *data, return 0; } -/** +/* * Get client information. * * \param inode device inode. @@ -244,7 +244,7 @@ static int drm_getclient(struct drm_device *dev, void *data, } } -/** +/* * Get statistics information. * * \param inode device inode. @@ -265,7 +265,7 @@ static int drm_getstats(struct drm_device *dev, void *data, return 0; } -/** +/* * Get device/driver capabilities */ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv) @@ -318,7 +318,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ return 0; } -/** +/* * Set device/driver capabilities */ static int @@ -352,7 +352,7 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv) return 0; } -/** +/* * Setversion ioctl. * * \param inode device inode. @@ -406,7 +406,18 @@ done: return retcode; } -/** No-op ioctl. */ +/** + * drm_noop - DRM no-op ioctl implemntation + * @dev: DRM device for the ioctl + * @data: data pointer for the ioctl + * @file_priv: DRM file for the ioctl call + * + * This no-op implementation for drm ioctls is useful for deprecated + * functionality where we can't return a failure code because existing userspace + * checks the result of the ioctl, but doesn't care about the action. + * + * Always returns successfully with 0. + */ int drm_noop(struct drm_device *dev, void *data, struct drm_file *file_priv) { @@ -415,6 +426,21 @@ int drm_noop(struct drm_device *dev, void *data, } EXPORT_SYMBOL(drm_noop); +/** + * drm_invalid_op - DRM invalid ioctl implemntation + * @dev: DRM device for the ioctl + * @data: data pointer for the ioctl + * @file_priv: DRM file for the ioctl call + * + * This no-op implementation for drm ioctls is useful for deprecated + * functionality where we really don't want to allow userspace to call the ioctl + * any more. This is the case for old ums interfaces for drivers that + * transitioned to kms gradually and so kept the old legacy tables around. This + * only applies to radeon and i915 kms drivers, other drivers shouldn't need to + * use this function. + * + * Always fails with a return value of -EINVAL. + */ int drm_invalid_op(struct drm_device *dev, void *data, struct drm_file *file_priv) { @@ -422,7 +448,7 @@ int drm_invalid_op(struct drm_device *dev, void *data, } EXPORT_SYMBOL(drm_invalid_op); -/** +/* * Copy and IOCTL return string to user space */ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) @@ -445,7 +471,7 @@ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) return 0; } -/** +/* * Get version information * * \param inode device inode. @@ -477,7 +503,7 @@ static int drm_version(struct drm_device *dev, void *data, return err; } -/** +/* * drm_ioctl_permit - Check ioctl permissions against caller * * @flags: ioctl permission flags. @@ -525,7 +551,7 @@ EXPORT_SYMBOL(drm_ioctl_permit); .name = #ioctl \ } -/** Ioctl table */ +/* Ioctl table */ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_VERSION, drm_version, DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_GET_UNIQUE, drm_getunique, 0), @@ -641,16 +667,16 @@ static const struct drm_ioctl_desc drm_ioctls[] = { #define DRM_CORE_IOCTL_COUNT
[PATCH 08/11] drm: Enforce unlocked ioctl operation for kms driver ioctls
With the prep patches for i915 all kms drivers either have DRM_UNLOCKED on all their ioctls. Or the ioctl always directly returns with an invariant return value when in modeset mode. But that's only the case for i915 and radeon. The drm core ioctls are unfortunately too much a mess still to dare this. Follow-up patches will remove DRM_UNLOCKED from all kms drivers to prove that this is indeed the case. Also update the documentation. Signed-off-by: Daniel Vetter --- Documentation/DocBook/drm.tmpl | 4 +++- drivers/gpu/drm/drm_ioctl.c| 6 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index cfb43203a6a7..55dc106686df 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -3747,7 +3747,9 @@ int num_ioctls; DRM_UNLOCKED - The ioctl handler will be called without locking - the DRM global mutex + the DRM global mutex. This is the enforced default for kms drivers + (i.e. using the DRIVER_MODESET flag) and hence shouldn't be used + any more for new drivers. diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 75df8ea87cd7..a5a4aa89b1b4 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -728,6 +728,7 @@ long drm_ioctl(struct file *filp, } retcode = drm_ioctl_permit(ioctl->flags, file_priv); + if (unlikely(retcode)) goto err_i1; @@ -755,7 +756,10 @@ long drm_ioctl(struct file *filp, memset(kdata, 0, usize); } - if (ioctl->flags & DRM_UNLOCKED) + /* Enforce sane locking for kms driver ioctls. Core ioctls are +* too messy still. */ + if (drm_core_check_feature(dev, DRIVER_MODESET) || + (ioctl->flags & DRM_UNLOCKED)) retcode = func(dev, kdata, file_priv); else { mutex_lock(&drm_global_mutex); -- 2.5.1
[PATCH 09/11] drm/vmwgfx: Stop checking for DRM_UNLOCKED
drm core enforces now for DRIVER_MODESET that all ioctls are unlocked. And all the old nasty ones from drm core aren't allowed for modern drivers any more. Hence this is no longer needed. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index e13b20bd9908..2320ba8c5eb1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1068,14 +1068,6 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev, mutex_unlock(&dev->master_mutex); /* -* Taking the drm_global_mutex after the TTM lock might deadlock -*/ - if (!(flags & DRM_UNLOCKED)) { - DRM_ERROR("Refusing locked ioctl access.\n"); - return ERR_PTR(-EDEADLK); - } - - /* * Take the TTM lock. Possibly sleep waiting for the authenticating * master to become master again, or for a SIGTERM if the * authenticating master exits. -- 2.5.1
[PATCH 10/11] drm/: Drop DRM_UNLOCKED from modeset drivers
Just one special case (since i915 lost its ums code, yay): - radeon: Has slots for the old ums ioctls which don't have DRM_UNLOCKED, but all filled with drm_invalid_op. So ok to drop it everywhere. Every other kms driver just has DRM_UNLOCKED for all their ioctls, as they should. v2: admgpu happened, include that one too. And i915 lost its UMS support which means we can change all the i915 ioctls too. v3: Rebased on top of new vmwgfx DX interface extensions. v4: Rebase on top of render-node support in exynos. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 +-- drivers/gpu/drm/armada/armada_drv.c | 9 ++--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 20 - drivers/gpu/drm/i915/i915_dma.c | 72 - drivers/gpu/drm/msm/msm_drv.c | 14 +++ drivers/gpu/drm/nouveau/nouveau_drm.c | 24 +-- drivers/gpu/drm/omapdrm/omap_drv.c | 12 +++--- drivers/gpu/drm/qxl/qxl_ioctl.c | 14 +++ drivers/gpu/drm/radeon/radeon_kms.c | 30 +++--- drivers/gpu/drm/tegra/drm.c | 28 ++--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 54 - 11 files changed, 149 insertions(+), 152 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 22367939ebf1..3648fdca6359 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -685,18 +685,18 @@ int amdgpu_get_vblank_timestamp_kms(struct drm_device *dev, int crtc, } const struct drm_ioctl_desc amdgpu_ioctls_kms[] = { - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), /* KMS */ - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), }; int amdgpu_max_kms_ioctl = ARRAY_SIZE(amdgpu_ioctls_kms); diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 225034b74cda..f73b3e2a772b 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -268,12 +268,9 @@ static void armada_drm_disable_vblank(struct drm_device *dev, int crtc) } static struct drm_ioctl_desc armada_ioctls[] = { - DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl, - DRM_UNLOCKED), - DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, - DRM_UNLOCKED), - DRM_IOCTL_DEF_DRV(ARMADA_GEM_PWRITE, armada_gem_pwrite_ioctl, - DRM_UNLOCKED), + DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0), + DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0), + DRM_IOCTL_DEF_DRV(ARMADA_GEM_PWRITE, armada_gem_pw
[PATCH 11/11] drm: Remove dummy agp ioctl wrappers
They're only used in the drm ioctl table, and there they're excluded when AGP support is disabled. So this is just dead code ripe for removal. Signed-off-by: Daniel Vetter --- include/drm/drm_agpsupport.h | 48 1 file changed, 48 deletions(-) diff --git a/include/drm/drm_agpsupport.h b/include/drm/drm_agpsupport.h index 3d0833c63af2..addf0ea3e158 100644 --- a/include/drm/drm_agpsupport.h +++ b/include/drm/drm_agpsupport.h @@ -105,95 +105,47 @@ static inline int drm_agp_acquire(struct drm_device *dev) return -ENODEV; } -static inline int drm_agp_acquire_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - return -ENODEV; -} - static inline int drm_agp_release(struct drm_device *dev) { return -ENODEV; } -static inline int drm_agp_release_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - return -ENODEV; -} - static inline int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode) { return -ENODEV; } -static inline int drm_agp_enable_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - return -ENODEV; -} - static inline int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info) { return -ENODEV; } -static inline int drm_agp_info_ioctl(struct drm_device *dev, void *data, -struct drm_file *file_priv) -{ - return -ENODEV; -} - static inline int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) { return -ENODEV; } -static inline int drm_agp_alloc_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - return -ENODEV; -} - static inline int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) { return -ENODEV; } -static inline int drm_agp_free_ioctl(struct drm_device *dev, void *data, -struct drm_file *file_priv) -{ - return -ENODEV; -} - static inline int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) { return -ENODEV; } -static inline int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - return -ENODEV; -} - static inline int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) { return -ENODEV; } -static inline int drm_agp_bind_ioctl(struct drm_device *dev, void *data, -struct drm_file *file_priv) -{ - return -ENODEV; -} - #endif /* CONFIG_AGP */ #endif /* _DRM_AGPSUPPORT_H_ */ -- 2.5.1
[PATCH 00/11] Mixed bag of ioctl and agp cleanups
Patches #1, #6, #7, #8 and #10 are Reviewed-by: Christian König . That should be everything touching radeon/amdgpu if I missed something leave me a note. Regards, Christian. On 08.09.2015 13:56, Daniel Vetter wrote: > Hi all, > > Big thing for sure is deprecating DRM_UNLOCKED for DRIVER_MODESET (i.e. modern > drivers) since all of them have their own locking. Besides that a few random > things that kind where in the same area/files. > > Of course kerneldoc is updated too. > > Feedback highly welcome. > > Cheers, Daniel > > Daniel Vetter (11): >drm: Remove __OS_HAS_AGP >drm/i915: Kill cross-module option depencies >drm/i915: Mark debug mod options as _unsafe >drm/i915: Remove setparam ioctl >drm/i915: Mark getparam ioctl as DRM_UNLOCKED >drm: Define a drm_invalid_op ioctl implementation >drm/drm_ioctl.c: kerneldoc >drm: Enforce unlocked ioctl operation for kms driver ioctls >drm/vmwgfx: Stop checking for DRM_UNLOCKED >drm/: Drop DRM_UNLOCKED from modeset drivers >drm: Remove dummy agp ioctl wrappers > > Documentation/DocBook/drm.tmpl | 5 +- > drivers/gpu/drm/Makefile| 3 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 +++ > drivers/gpu/drm/armada/armada_drv.c | 9 +-- > drivers/gpu/drm/drm_agpsupport.c| 4 +- > drivers/gpu/drm/drm_bufs.c | 6 +- > drivers/gpu/drm/drm_ioc32.c | 6 +- > drivers/gpu/drm/drm_ioctl.c | 89 +-- > drivers/gpu/drm/drm_memory.c| 6 +- > drivers/gpu/drm/drm_vm.c| 8 +-- > drivers/gpu/drm/exynos/exynos_drm_drv.c | 20 +++--- > drivers/gpu/drm/i915/i915_dma.c | 101 ++ > drivers/gpu/drm/i915/i915_gem_gtt.c | 2 +- > drivers/gpu/drm/i915/i915_params.c | 30 > drivers/gpu/drm/i915/intel_lrc.c| 3 +- > drivers/gpu/drm/mga/mga_dma.c | 4 +- > drivers/gpu/drm/msm/msm_drv.c | 14 ++-- > drivers/gpu/drm/nouveau/nouveau_bo.c| 8 +-- > drivers/gpu/drm/nouveau/nouveau_drm.c | 24 +++ > drivers/gpu/drm/omapdrm/omap_drv.c | 12 ++-- > drivers/gpu/drm/qxl/qxl_ioctl.c | 14 ++-- > drivers/gpu/drm/r128/r128_cce.c | 12 ++-- > drivers/gpu/drm/radeon/r600_cp.c| 14 ++-- > drivers/gpu/drm/radeon/radeon_agp.c | 8 +-- > drivers/gpu/drm/radeon/radeon_cp.c | 16 ++--- > drivers/gpu/drm/radeon/radeon_kms.c | 124 > +++- > drivers/gpu/drm/radeon/radeon_ttm.c | 10 +-- > drivers/gpu/drm/tegra/drm.c | 28 > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 62 +++- > include/drm/drmP.h | 2 + > include/drm/drm_agpsupport.h| 54 +- > 31 files changed, 321 insertions(+), 401 deletions(-) >
[PATCH] drm/atomic-helper: Pimp docs with recommendations for rpm drivers
Hi Daniel, Thank you for the patch. On Tuesday 08 September 2015 13:52:45 Daniel Vetter wrote: > Requested by Laurent. > > Note that this uses the new markdown support which will only land in > kernel 4.4 (for the code snippet). > > v2: A few spelling fixes I spotted myself. > > Cc: Laurent Pinchart > Reviewed-by: Thierry Reding (v1 on irc) > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/drm_atomic_helper.c | 22 ++ > 1 file changed, 22 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c index 12c25c54309f..bd23b4dc7f43 > 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -993,6 +993,22 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); > * object. This can still fail when e.g. the framebuffer reservation fails. > * For now this doesn't implement asynchronous commits. > * > + * Note that right now this function does not support async commits, and > + * hence driver writers must implement their own version for now. Also note > + * that the default ordering of how the various stages are called is to > + * match the legacy modeset helper library closest. One peculiarity of that > + * is that it doesn't mesh well with runtime pm at all. > + * > + * For drivers supporting runtime PM the recommended sequence is > + * > + * drm_atomic_helper_commit_modeset_disables(dev, state); > + * > + * drm_atomic_helper_commit_modeset_enables(dev, state); > + * > + * drm_atomic_helper_commit_planes(dev, state, true); > + * > + * See the kerneldoc entries for these three functions for more details. > + * > * RETURNS > * Zero for success or -errno. > */ > @@ -1168,6 +1184,12 @@ bool plane_crtc_active(struct drm_plane_state *state) > * Note that this function does all plane updates across all CRTCs in one > * step. If the hardware can't support this approach look at > * drm_atomic_helper_commit_planes_on_crtc() instead. > + * > + * Note that for drivers supporting runtime PM, or which are otherwise > + * unhappy if their plane update hooks get called on CRTCs which are off, > + * it is highly recommended to set @active_only to true. Setting > + * @active_only to false as the default implementation in > + * drm_atomic_helper_commit() does is just done to most closely match > + * the behaviour of the legacy helpers. How about "Plane parameters can be updated by applications while the associated CRTC is disabled. The DRM/KMS core will store the parameters in the plane state, which will be available to the driver when the CRTC is turned on. As a result most drivers don't need to be immediately notified of plane updates for a disabled CRTC. Unless otherwise needed, drivers are advised to set the @active_only parameters to true in order not to receive plane update notifications related to a disabled CRTC." > */ > void drm_atomic_helper_commit_planes(struct drm_device *dev, >struct drm_atomic_state *old_state, -- Regards, Laurent Pinchart
[PATCH v3 1/2] drm/atomic-helper: Implement drm_atomic_helper_duplicate_state()
From: Thierry Reding This function can be used to duplicate an atomic state object. This is useful for example to implement suspend/resume, where the state before suspend can be saved and restored upon resume. v2: move locking to caller, be more explicit about prerequisites v3: explicitly pass lock acquisition context, improve kerneldoc Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_atomic_helper.c | 78 + include/drm/drm_atomic_helper.h | 3 ++ 2 files changed, 81 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 634aa617811b..3232f4b838e4 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2349,6 +2349,84 @@ drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector) EXPORT_SYMBOL(drm_atomic_helper_connector_duplicate_state); /** + * drm_atomic_helper_duplicate_state - duplicate an atomic state object + * @dev: DRM device + * @ctx: lock acquisition context + * + * Makes a copy of the current atomic state by looping over all objects and + * duplicating their respective states. + * + * Note that this treats atomic state as persistent between save and restore. + * Drivers must make sure that this is possible and won't result in confusion + * or erroneous behaviour. + * + * Note that if callers haven't already acquired all modeset locks this might + * return -EDEADLK, which must be handled by calling drm_modeset_backoff(). + * + * Returns: + * A pointer to the copy of the atomic state object on success or an + * ERR_PTR()-encoded error code on failure. + */ +struct drm_atomic_state * +drm_atomic_helper_duplicate_state(struct drm_device *dev, + struct drm_modeset_acquire_ctx *ctx) +{ + struct drm_atomic_state *state; + struct drm_connector *conn; + struct drm_plane *plane; + struct drm_crtc *crtc; + int err = 0; + + state = drm_atomic_state_alloc(dev); + if (!state) + return ERR_PTR(-ENOMEM); + + state->acquire_ctx = ctx; + + drm_for_each_crtc(crtc, dev) { + struct drm_crtc_state *crtc_state; + + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) { + err = PTR_ERR(crtc_state); + goto free; + } + } + + drm_for_each_plane(plane, dev) { + struct drm_plane_state *plane_state; + + plane_state = drm_atomic_get_plane_state(state, plane); + if (IS_ERR(plane_state)) { + err = PTR_ERR(plane_state); + goto free; + } + } + + drm_for_each_connector(conn, dev) { + struct drm_connector_state *conn_state; + + conn_state = drm_atomic_get_connector_state(state, conn); + if (IS_ERR(conn_state)) { + err = PTR_ERR(conn_state); + goto free; + } + } + + /* clear the acquire context so that it isn't accidentally reused */ + state->acquire_ctx = NULL; + +free: + if (err < 0) { + drm_atomic_state_free(state); + state = ERR_PTR(err); + } + + return state; +} +EXPORT_SYMBOL(drm_atomic_helper_duplicate_state); + +/** * __drm_atomic_helper_connector_destroy_state - release connector state * @connector: connector object * @state: connector state object to release diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 4ffe9dca07c4..1547eb43c14a 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -118,6 +118,9 @@ __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, struct drm_connector_state *state); struct drm_connector_state * drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector); +struct drm_atomic_state * +drm_atomic_helper_duplicate_state(struct drm_device *dev, + struct drm_modeset_acquire_ctx *ctx); void __drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, struct drm_connector_state *state); -- 2.5.0
[PATCH v3 2/2] drm/atomic-helper: Implement subsystem-level suspend/resume
From: Thierry Reding Provide subsystem-level suspend and resume helpers that can be used to implement suspend/resume on atomic mode-setting enabled drivers. v2: simplify locking, enhance kerneldoc comments v3: pass lock acquisition context by parameter, improve kerneldoc Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_atomic_helper.c | 165 +++- drivers/gpu/drm/drm_crtc_helper.c | 6 ++ include/drm/drm_atomic_helper.h | 6 ++ 3 files changed, 176 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 3232f4b838e4..31823dc8a406 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1742,6 +1742,164 @@ backoff: EXPORT_SYMBOL(drm_atomic_helper_set_config); /** + * drm_atomic_helper_disable_all - disable all currently active outputs + * @dev: DRM device + * @ctx: lock acquisition context + * + * Loops through all connectors, finding those that aren't turned off and then + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC + * that they are connected to. + * + * This is used for example in suspend/resume to disable all currently active + * functions when suspending. + * + * Note that if callers haven't already acquired all modeset locks this might + * return -EDEADLK, which must be handled by calling drm_modeset_backoff(). + * + * Returns: + * 0 on success or a negative error code on failure. + * + * See also: + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() + */ +int drm_atomic_helper_disable_all(struct drm_device *dev, + struct drm_modeset_acquire_ctx *ctx) +{ + struct drm_connector_state *conn_state; + struct drm_atomic_state *state; + struct drm_connector *conn; + unsigned int i; + int err; + + state = drm_atomic_state_alloc(dev); + if (!state) + return -ENOMEM; + + state->acquire_ctx = ctx; + + drm_for_each_connector(conn, dev) { + struct drm_crtc *crtc = conn->state->crtc; + struct drm_crtc_state *crtc_state; + + if (!crtc || conn->dpms != DRM_MODE_DPMS_ON) + continue; + + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) { + err = PTR_ERR(crtc_state); + goto free; + } + + err = drm_atomic_add_affected_connectors(state, crtc); + if (err < 0) + goto free; + + conn->dpms = DRM_MODE_DPMS_OFF; + crtc_state->active = false; + } + + err = drm_atomic_commit(state); + if (err < 0) { + /* restore DPMS mode */ + for_each_connector_in_state(state, conn, conn_state, i) + conn->dpms = DRM_MODE_DPMS_ON; + + goto free; + } + +free: + if (err < 0) + drm_atomic_state_free(state); + + return err; +} +EXPORT_SYMBOL(drm_atomic_helper_disable_all); + +/** + * drm_atomic_helper_suspend - subsystem-level suspend helper + * @dev: DRM device + * + * Duplicates the current atomic state, disables all active outputs and then + * returns a pointer to the original atomic state to the caller. Drivers can + * pass this pointer to the drm_atomic_helper_resume() helper upon resume to + * restore the output configuration that was active at the time the system + * entered suspend. + * + * Note that it is potentially unsafe to use this. The atomic state object + * returned by this function is assumed to be persistent. Drivers must ensure + * that this holds true. Before calling this function, drivers must make sure + * to suspend fbdev emulation so that nothing can be using the device. + * + * Returns: + * A pointer to a copy of the state before suspend on success or an ERR_PTR()- + * encoded error code on failure. Drivers should store the returned atomic + * state object and pass it to the drm_atomic_helper_resume() helper upon + * resume. + * + * See also: + * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), + * drm_atomic_helper_resume() + */ +struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev) +{ + struct drm_modeset_acquire_ctx ctx; + struct drm_atomic_state *state; + int err; + + drm_modeset_acquire_init(&ctx, 0); + drm_modeset_lock_all_ctx(dev, &ctx); + + state = drm_atomic_helper_duplicate_state(dev, &ctx); + if (IS_ERR(state)) + goto unlock; + + err = drm_atomic_helper_disable_all(dev, &ctx); + if (err < 0) { + drm_atomic_state_free(state); + state = ERR_PTR(err); + goto unlock; + } + +unlock: + drm_modeset_unlock_all_ctx(dev, &ctx); + drm_modeset_acquire_fini(&ctx); + return state; +} +EXPORT_SYM
[PATCH v3 2/2] drm/atomic-helper: Implement subsystem-level suspend/resume
On Tue, Sep 08, 2015 at 03:00:46PM +0200, Thierry Reding wrote: > From: Thierry Reding > > Provide subsystem-level suspend and resume helpers that can be used to > implement suspend/resume on atomic mode-setting enabled drivers. > > v2: simplify locking, enhance kerneldoc comments > v3: pass lock acquisition context by parameter, improve kerneldoc > > Signed-off-by: Thierry Reding > --- > drivers/gpu/drm/drm_atomic_helper.c | 165 > +++- > drivers/gpu/drm/drm_crtc_helper.c | 6 ++ > include/drm/drm_atomic_helper.h | 6 ++ > 3 files changed, 176 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index 3232f4b838e4..31823dc8a406 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -1742,6 +1742,164 @@ backoff: > EXPORT_SYMBOL(drm_atomic_helper_set_config); > > /** > + * drm_atomic_helper_disable_all - disable all currently active outputs > + * @dev: DRM device > + * @ctx: lock acquisition context > + * > + * Loops through all connectors, finding those that aren't turned off and > then > + * turns them off by setting their DPMS mode to OFF and deactivating the CRTC > + * that they are connected to. > + * > + * This is used for example in suspend/resume to disable all currently active > + * functions when suspending. > + * > + * Note that if callers haven't already acquired all modeset locks this might > + * return -EDEADLK, which must be handled by calling drm_modeset_backoff(). > + * > + * Returns: > + * 0 on success or a negative error code on failure. > + * > + * See also: > + * drm_atomic_helper_suspend(), drm_atomic_helper_resume() > + */ > +int drm_atomic_helper_disable_all(struct drm_device *dev, > + struct drm_modeset_acquire_ctx *ctx) > +{ > + struct drm_connector_state *conn_state; > + struct drm_atomic_state *state; > + struct drm_connector *conn; > + unsigned int i; > + int err; > + > + state = drm_atomic_state_alloc(dev); > + if (!state) > + return -ENOMEM; > + > + state->acquire_ctx = ctx; > + > + drm_for_each_connector(conn, dev) { > + struct drm_crtc *crtc = conn->state->crtc; > + struct drm_crtc_state *crtc_state; > + > + if (!crtc || conn->dpms != DRM_MODE_DPMS_ON) > + continue; > + > + crtc_state = drm_atomic_get_crtc_state(state, crtc); > + if (IS_ERR(crtc_state)) { > + err = PTR_ERR(crtc_state); > + goto free; > + } > + > + err = drm_atomic_add_affected_connectors(state, crtc); Just elaborating on what Maarten spotted on irc. You don't need to do this, atomic helpers will do this for you. > + if (err < 0) > + goto free; > + > + conn->dpms = DRM_MODE_DPMS_OFF; No need to touch legacy dpms state, that's again updated for you in drm_atomic_helper_update_legacy_modeset_state. > + crtc_state->active = false; > + } > + > + err = drm_atomic_commit(state); > + if (err < 0) { > + /* restore DPMS mode */ > + for_each_connector_in_state(state, conn, conn_state, i) > + conn->dpms = DRM_MODE_DPMS_ON; Same here. -Daniel > + > + goto free; > + } > + > +free: > + if (err < 0) > + drm_atomic_state_free(state); > + > + return err; > +} > +EXPORT_SYMBOL(drm_atomic_helper_disable_all); > + > +/** > + * drm_atomic_helper_suspend - subsystem-level suspend helper > + * @dev: DRM device > + * > + * Duplicates the current atomic state, disables all active outputs and then > + * returns a pointer to the original atomic state to the caller. Drivers can > + * pass this pointer to the drm_atomic_helper_resume() helper upon resume to > + * restore the output configuration that was active at the time the system > + * entered suspend. > + * > + * Note that it is potentially unsafe to use this. The atomic state object > + * returned by this function is assumed to be persistent. Drivers must ensure > + * that this holds true. Before calling this function, drivers must make sure > + * to suspend fbdev emulation so that nothing can be using the device. > + * > + * Returns: > + * A pointer to a copy of the state before suspend on success or an > ERR_PTR()- > + * encoded error code on failure. Drivers should store the returned atomic > + * state object and pass it to the drm_atomic_helper_resume() helper upon > + * resume. > + * > + * See also: > + * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(), > + * drm_atomic_helper_resume() > + */ > +struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev) > +{ > + struct drm_modeset_acquire_ctx ctx; > + struct drm_atomic_state *state; > + int err; > + > + drm_modeset_acquire_init(&ctx, 0
[Bug 91880] Radeonsi on Grenada cards (r9 390) exceptionally unstable and poorly performing
https://bugs.freedesktop.org/show_bug.cgi?id=91880 --- Comment #7 from Lauri Gustafsson --- I did get Unigine Heaven running with DPM on for a few seconds (before hanging), showing way better frame rates than before. It really seems that - The performance issues are most likely caused by the lack of DPM - DPM for Grenada GPUs is not supported completely Or: - My card has a really weird (stock) VBIOS that Radeon(si?) cannot interpret/work with. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/d91a2674/attachment.html>
[PATCH] drm/atomic-helper: Pimp docs with recommendations for rpm drivers
Requested by Laurent. Note that this uses the new markdown support which will only land in kernel 4.4 (for the code snippet). v2: A few spelling fixes I spotted myself. v3: Big reword for commit_planes() kerneldoc based on a text from Laurent. Cc: Laurent Pinchart Reviewed-by: Thierry Reding (v1 on irc) Acked-by: Laurent Pinchart Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 32 1 file changed, 32 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 12c25c54309f..77d55a935793 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -993,6 +993,22 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks); * object. This can still fail when e.g. the framebuffer reservation fails. For * now this doesn't implement asynchronous commits. * + * Note that right now this function does not support async commits, and hence + * driver writers must implement their own version for now. Also note that the + * default ordering of how the various stages are called is to match the legacy + * modeset helper library closest. One peculiarity of that is that it doesn't + * mesh well with runtime PM at all. + * + * For drivers supporting runtime PM the recommended sequence is + * + * drm_atomic_helper_commit_modeset_disables(dev, state); + * + * drm_atomic_helper_commit_modeset_enables(dev, state); + * + * drm_atomic_helper_commit_planes(dev, state, true); + * + * See the kerneldoc entries for these three functions for more details. + * * RETURNS * Zero for success or -errno. */ @@ -1168,6 +1184,22 @@ bool plane_crtc_active(struct drm_plane_state *state) * Note that this function does all plane updates across all CRTCs in one step. * If the hardware can't support this approach look at * drm_atomic_helper_commit_planes_on_crtc() instead. + * + * Plane parameters can be updated by applications while the associated CRTC is + * disabled. The DRM/KMS core will store the parameters in the plane state, + * which will be available to the driver when the CRTC is turned on. As a result + * most drivers don't need to be immediately notified of plane updates for a + * disabled CRTC. + * + * Unless otherwise needed, drivers are advised to set the @active_only + * parameters to true in order not to receive plane update notifications related + * to a disabled CRTC. This avoids the need to manually ignore plane updates in + * driver code when the driver and/or hardware can't or just don't need to deal + * with updates on disabled CRTCs, for example when supporting runtime PM. + * + * The drm_atomic_helper_commit() default implementation only sets @active_only + * to false to most closely match the behaviour of the legacy helpers. This should + * not be copied blindly by drivers. */ void drm_atomic_helper_commit_planes(struct drm_device *dev, struct drm_atomic_state *old_state, -- 2.5.1
[PATCH v3 1/2] drm/atomic-helper: Implement drm_atomic_helper_duplicate_state()
On Tue, Sep 08, 2015 at 03:00:45PM +0200, Thierry Reding wrote: > From: Thierry Reding > > This function can be used to duplicate an atomic state object. This is > useful for example to implement suspend/resume, where the state before > suspend can be saved and restored upon resume. > > v2: move locking to caller, be more explicit about prerequisites > v3: explicitly pass lock acquisition context, improve kerneldoc > > Signed-off-by: Thierry Reding Applied to drm-misc with 2 tiny spelling fixes in the kerneldoc. Thanks, Daniel > --- > drivers/gpu/drm/drm_atomic_helper.c | 78 > + > include/drm/drm_atomic_helper.h | 3 ++ > 2 files changed, 81 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index 634aa617811b..3232f4b838e4 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -2349,6 +2349,84 @@ drm_atomic_helper_connector_duplicate_state(struct > drm_connector *connector) > EXPORT_SYMBOL(drm_atomic_helper_connector_duplicate_state); > > /** > + * drm_atomic_helper_duplicate_state - duplicate an atomic state object > + * @dev: DRM device > + * @ctx: lock acquisition context > + * > + * Makes a copy of the current atomic state by looping over all objects and > + * duplicating their respective states. > + * > + * Note that this treats atomic state as persistent between save and restore. > + * Drivers must make sure that this is possible and won't result in confusion > + * or erroneous behaviour. > + * > + * Note that if callers haven't already acquired all modeset locks this might > + * return -EDEADLK, which must be handled by calling drm_modeset_backoff(). > + * > + * Returns: > + * A pointer to the copy of the atomic state object on success or an > + * ERR_PTR()-encoded error code on failure. > + */ > +struct drm_atomic_state * > +drm_atomic_helper_duplicate_state(struct drm_device *dev, > + struct drm_modeset_acquire_ctx *ctx) > +{ > + struct drm_atomic_state *state; > + struct drm_connector *conn; > + struct drm_plane *plane; > + struct drm_crtc *crtc; > + int err = 0; > + > + state = drm_atomic_state_alloc(dev); > + if (!state) > + return ERR_PTR(-ENOMEM); > + > + state->acquire_ctx = ctx; > + > + drm_for_each_crtc(crtc, dev) { > + struct drm_crtc_state *crtc_state; > + > + crtc_state = drm_atomic_get_crtc_state(state, crtc); > + if (IS_ERR(crtc_state)) { > + err = PTR_ERR(crtc_state); > + goto free; > + } > + } > + > + drm_for_each_plane(plane, dev) { > + struct drm_plane_state *plane_state; > + > + plane_state = drm_atomic_get_plane_state(state, plane); > + if (IS_ERR(plane_state)) { > + err = PTR_ERR(plane_state); > + goto free; > + } > + } > + > + drm_for_each_connector(conn, dev) { > + struct drm_connector_state *conn_state; > + > + conn_state = drm_atomic_get_connector_state(state, conn); > + if (IS_ERR(conn_state)) { > + err = PTR_ERR(conn_state); > + goto free; > + } > + } > + > + /* clear the acquire context so that it isn't accidentally reused */ > + state->acquire_ctx = NULL; > + > +free: > + if (err < 0) { > + drm_atomic_state_free(state); > + state = ERR_PTR(err); > + } > + > + return state; > +} > +EXPORT_SYMBOL(drm_atomic_helper_duplicate_state); > + > +/** > * __drm_atomic_helper_connector_destroy_state - release connector state > * @connector: connector object > * @state: connector state object to release > diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h > index 4ffe9dca07c4..1547eb43c14a 100644 > --- a/include/drm/drm_atomic_helper.h > +++ b/include/drm/drm_atomic_helper.h > @@ -118,6 +118,9 @@ __drm_atomic_helper_connector_duplicate_state(struct > drm_connector *connector, > struct drm_connector_state *state); > struct drm_connector_state * > drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector); > +struct drm_atomic_state * > +drm_atomic_helper_duplicate_state(struct drm_device *dev, > + struct drm_modeset_acquire_ctx *ctx); > void > __drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, > struct drm_connector_state *state); > -- > 2.5.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
[PATCH] drm: Implement drm_modeset_{,un}lock_all_ctx()
From: Thierry Reding These functions are like drm_modeset_{,un}lock_all(), but they take the lock acquisition context as a parameter rather than storing it in the DRM device's drm_mode_config structure. Implement drm_modeset_{,un}lock_all() in terms of the new function for better code reuse, and add a note to the kerneldoc that new code should use the new functions. Signed-off-by: Thierry Reding --- drivers/gpu/drm/drm_modeset_lock.c | 87 +- include/drm/drm_modeset_lock.h | 4 ++ 2 files changed, 70 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c index fba321ca4344..eddbc3676d5d 100644 --- a/drivers/gpu/drm/drm_modeset_lock.c +++ b/drivers/gpu/drm/drm_modeset_lock.c @@ -56,42 +56,31 @@ */ /** - * drm_modeset_lock_all - take all modeset locks + * drm_modeset_lock_all_ctx - take all modeset locks * @dev: drm device + * @ctx: lock acquisition context * * This function takes all modeset locks, suitable where a more fine-grained * scheme isn't (yet) implemented. Locks must be dropped with * drm_modeset_unlock_all. */ -void drm_modeset_lock_all(struct drm_device *dev) +void drm_modeset_lock_all_ctx(struct drm_device *dev, + struct drm_modeset_acquire_ctx *ctx) { struct drm_mode_config *config = &dev->mode_config; - struct drm_modeset_acquire_ctx *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); - if (WARN_ON(!ctx)) - return; - mutex_lock(&config->mutex); - drm_modeset_acquire_init(ctx, 0); - retry: ret = drm_modeset_lock(&config->connection_mutex, ctx); if (ret) goto fail; + ret = drm_modeset_lock_all_crtcs(dev, ctx); if (ret) goto fail; - WARN_ON(config->acquire_ctx); - - /* now we hold the locks, so now that it is safe, stash the -* ctx for drm_modeset_unlock_all(): -*/ - config->acquire_ctx = ctx; - drm_warn_on_modeset_not_all_locked(dev); return; @@ -101,8 +90,60 @@ fail: drm_modeset_backoff(ctx); goto retry; } +} +EXPORT_SYMBOL(drm_modeset_lock_all_ctx); - kfree(ctx); +/** + * drm_modeset_unlock_all_ctx - drop all modeset locks + * @dev: device + * @ctx: lock acquisition context + * + * This function drop all modeset locks taken by drm_modeset_lock_all. + */ +void drm_modeset_unlock_all_ctx(struct drm_device *dev, + struct drm_modeset_acquire_ctx *ctx) +{ + struct drm_mode_config *config = &dev->mode_config; + + drm_modeset_drop_locks(ctx); + mutex_unlock(&config->mutex); +} +EXPORT_SYMBOL(drm_modeset_unlock_all_ctx); + +/** + * drm_modeset_lock_all - take all modeset locks + * @dev: drm device + * + * This function takes all modeset locks, suitable where a more fine-grained + * scheme isn't (yet) implemented. Locks must be dropped with + * drm_modeset_unlock_all. + * + * This function is deprecated. It allocates a lock acquisition context and + * stores it in drm_mode_config. This facilitate conversion of existing code + * because it removes the need to manually deal with the acquisition context, + * but it is also brittle because the context is global and care must be + * taken not to nest calls. New code should use drm_modeset_lock_all_ctx() + * and pass in the context explicitly. + */ +void drm_modeset_lock_all(struct drm_device *dev) +{ + struct drm_mode_config *config = &dev->mode_config; + struct drm_modeset_acquire_ctx *ctx; + + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + if (WARN_ON(!ctx)) + return; + + drm_modeset_acquire_init(ctx, 0); + drm_modeset_lock_all_ctx(dev, ctx); + + WARN_ON(config->acquire_ctx); + + /* +* We hold the locks now, so it is safe to stash the acquisition +* context for drm_modeset_unlock_all(). +*/ + config->acquire_ctx = ctx; } EXPORT_SYMBOL(drm_modeset_lock_all); @@ -111,6 +152,13 @@ EXPORT_SYMBOL(drm_modeset_lock_all); * @dev: device * * This function drop all modeset locks taken by drm_modeset_lock_all. + * + * This function is deprecated. It uses the lock acquisition context stored + * in drm_mode_config. This facilitate conversion of existing code because it + * removes the need to manually deal with the acquisition context, but it is + * also brittle because the context is global and care must be taken not to + * nest calls. New code should use drm_modeset_unlock_all_ctx() and pass in + * the context explicitly. */ void drm_modeset_unlock_all(struct drm_device *dev) { @@ -121,12 +169,9 @@ void drm_modeset_unlock_all(struct drm_device *dev) return; config->acquire_ctx = NULL; - drm_modeset_drop_locks(ctx); + drm_modeset_unlock_all_ctx(dev, ctx); drm_modeset_acquire_fini(ctx); -
[Bug 91919] Black layout options in libreoffice impress
https://bugs.freedesktop.org/show_bug.cgi?id=91919 Bug ID: 91919 Summary: Black layout options in libreoffice impress Product: Mesa Version: 11.0 Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: normal Priority: medium Component: Drivers/Gallium/radeonsi Assignee: dri-devel at lists.freedesktop.org Reporter: glin at suse.com QA Contact: dri-devel at lists.freedesktop.org Created attachment 118139 --> https://bugs.freedesktop.org/attachment.cgi?id=118139&action=edit Black layout options in libreoffice impress After upgrading mesa to 10.6.0 or later, some graphs in libreoffice impress became black squares. It also happened on some background images so some slides just became totally black. Per my bisect result, the first bad commit is this one: commit cf6f33ee68ca56df1650762634fa9c038359c3ec Author: Eduardo Lima Mitev Date: Thu Mar 12 08:16:09 2015 +0100 mesa: Check for valid PBO access in gl(Compressed)Tex(Sub)Image calls Theoretically, this commit should impact every graphic driver, but I only got this issue on the system with Radeon HD 7770 vga card. The other system with only intel vga card (with mesa 10.6.2) displayed everything as expected, so it's likely to be a bug in the radeonsi driver. I also found a similar issue in a gtk program(*) which draws a white line with cairo but the whole became black after upgrading mesa. Here are the lines suffer the problem: src/core/caret.cpp: void CCaret::DrawInverse() if (m_Cairo == NULL) { m_Cairo = gdk_cairo_create(m_pParent->window); } cairo_set_source_rgb(m_Cairo, 1, 1, 1); cairo_set_operator(m_Cairo, CAIRO_OPERATOR_DIFFERENCE); cairo_rectangle(m_Cairo, m_Pos.x, m_Pos.y, m_Width, m_Height); cairo_fill(m_Cairo); Hope this can help to narrow down the scope. (*) https://github.com/pcman-bbs/pcmanx -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/82574927/attachment.html>
[Bug 91919] Black layout options in libreoffice impress
https://bugs.freedesktop.org/show_bug.cgi?id=91919 Gary Lin changed: What|Removed |Added Attachment #118139|text/plain |image/png mime type|| -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/82e45303/attachment.html>
[PATCH v9 3/6] mm: Introduce VM_LOCKONFAULT
The cost of faulting in all memory to be locked can be very high when working with large mappings. If only portions of the mapping will be used this can incur a high penalty for locking. For the example of a large file, this is the usage pattern for a large statical language model (probably applies to other statical or graphical models as well). For the security example, any application transacting in data that cannot be swapped out (credit card data, medical records, etc). This patch introduces the ability to request that pages are not pre-faulted, but are placed on the unevictable LRU when they are finally faulted in. The VM_LOCKONFAULT flag will be used together with VM_LOCKED and has no effect when set without VM_LOCKED. Setting the VM_LOCKONFAULT flag for a VMA will cause pages faulted into that VMA to be added to the unevictable LRU when they are faulted or if they are already present, but will not cause any missing pages to be faulted in. Exposing this new lock state means that we cannot overload the meaning of the FOLL_POPULATE flag any longer. Prior to this patch it was used to mean that the VMA for a fault was locked. This means we need the new FOLL_MLOCK flag to communicate the locked state of a VMA. FOLL_POPULATE will now only control if the VMA should be populated and in the case of VM_LOCKONFAULT, it will not be set. Signed-off-by: Eric B Munson Acked-by: Michal Hocko Acked-by: Vlastimil Babka Cc: Michal Hocko Cc: Vlastimil Babka Cc: Jonathan Corbet Cc: "Kirill A. Shutemov" Cc: linux-kernel at vger.kernel.org Cc: dri-devel at lists.freedesktop.org Cc: linux-mm at kvack.org Cc: linux-api at vger.kernel.org --- Changes from V8: * Do not expose VM_LOCKONFAULT flag to the rmap code because there is no consumer for this information include/linux/mm.h | 5 + kernel/fork.c | 3 ++- mm/debug.c | 1 + mm/gup.c | 10 -- mm/huge_memory.c | 2 +- mm/hugetlb.c | 4 ++-- mm/mlock.c | 2 +- mm/mmap.c | 2 +- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 8b257c4..b794a00 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -138,6 +138,7 @@ extern unsigned int kobjsize(const void *objp); #define VM_DONTCOPY0x0002 /* Do not copy this vma on fork */ #define VM_DONTEXPAND 0x0004 /* Cannot expand with mremap() */ +#define VM_LOCKONFAULT 0x0008 /* Lock the pages covered when they are faulted in */ #define VM_ACCOUNT 0x0010 /* Is a VM accounted object */ #define VM_NORESERVE 0x0020 /* should the VM suppress accounting */ #define VM_HUGETLB 0x0040 /* Huge TLB Page VM */ @@ -201,6 +202,9 @@ extern unsigned int kobjsize(const void *objp); /* This mask defines which mm->def_flags a process can inherit its parent */ #define VM_INIT_DEF_MASK VM_NOHUGEPAGE +/* This mask is used to clear all the VMA flags used by mlock */ +#define VM_LOCKED_CLEAR_MASK (~(VM_LOCKED | VM_LOCKONFAULT)) + /* * mapping from the currently active vm_flags protection bits (the * low four bits) to a page protection mask.. @@ -2074,6 +2078,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma, #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ #define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */ +#define FOLL_MLOCK 0x1000 /* lock present pages */ typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, void *data); diff --git a/kernel/fork.c b/kernel/fork.c index 7d5f0f1..66a1571 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -454,7 +454,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) tmp->vm_mm = mm; if (anon_vma_fork(tmp, mpnt)) goto fail_nomem_anon_vma_fork; - tmp->vm_flags &= ~(VM_LOCKED|VM_UFFD_MISSING|VM_UFFD_WP); + tmp->vm_flags &= + ~(VM_LOCKED|VM_LOCKONFAULT|VM_UFFD_MISSING|VM_UFFD_WP); tmp->vm_next = tmp->vm_prev = NULL; tmp->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; file = tmp->vm_file; diff --git a/mm/debug.c b/mm/debug.c index 76089dd..25176bb 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -121,6 +121,7 @@ static const struct trace_print_flags vmaflags_names[] = { {VM_GROWSDOWN, "growsdown" }, {VM_PFNMAP, "pfnmap"}, {VM_DENYWRITE, "denywrite" }, + {VM_LOCKONFAULT,"lockonfault" }, {VM_LOCKED, "locked"}, {VM_IO, "io"}, {VM_SEQ_READ, "seqread" }, diff --git a/mm/gup.c b/mm/gup.c index a798293..deafa2c 100644 --- a/m
[PATCH v4 0/22] On-demand device probing
On 7 September 2015 at 22:50, Rob Herring wrote: > On Mon, Sep 7, 2015 at 7:23 AM, Tomeu Vizoso > wrote: >> Hello, >> >> I have a problem with the panel on my Tegra Chromebook taking longer >> than expected to be ready during boot (Stéphane Marchesin reported what >> is basically the same issue in [0]), and have looked into ordered >> probing as a better way of solving this than moving nodes around in the >> DT or playing with initcall levels and linking order. >> >> While reading the thread [1] that Alexander Holler started with his >> series to make probing order deterministic, it occurred to me that it >> should be possible to achieve the same by probing devices as they are >> referenced by other devices. >> >> This basically reuses the information that is already implicit in the >> probe() implementations, saving us from refactoring existing drivers or >> adding information to DTBs. >> >> During review of v1 of this series Linus Walleij suggested that it >> should be the device driver core to make sure that dependencies are >> ready before probing a device. I gave this idea a try [2] but Mark Brown >> pointed out to the logic duplication between the resource acquisition >> and dependency discovery code paths (though I think it's fairly minor). >> >> To address that code duplication I experimented with Arnd's devm_probe >> [3] concept of having drivers declare their dependencies instead of >> acquiring them during probe, and while it worked [4], I don't think we >> end up winning anything when compared to just probing devices on-demand >> from resource getters. >> >> One remaining objection is to the "sprinkling" of calls to >> of_device_probe() in the resource getters of each subsystem, but I think >> it's the right thing to do given that the storage of resources is >> currently subsystem-specific. >> >> We could avoid the above by moving resource storage into the core, but I >> don't think there's a compelling case for that. >> >> I have tested this on boards with Tegra, iMX.6, Exynos, Rockchip and >> OMAP SoCs, and these patches were enough to eliminate all the deferred >> probes (except one in PandaBoard because omap_dma_system doesn't have a >> firmware node as of yet). >> >> Have submitted a branch [5] with only these patches on top of thursday's >> linux-next to kernelci.org and I don't see any issues that could be >> caused by them. For some reason it currently has more passes than the >> version of -next it's based on! >> >> With this series I get the kernel to output to the panel in 0.5s, >> instead of 2.8s. >> >> Regards, >> >> Tomeu >> >> [0] http://lists.freedesktop.org/archives/dri-devel/2014-August/066527.html >> >> [1] https://lkml.org/lkml/2014/5/12/452 >> >> [2] https://lkml.org/lkml/2015/6/17/305 >> >> [3] http://article.gmane.org/gmane.linux.ports.arm.kernel/277689 >> >> [4] https://lkml.org/lkml/2015/7/21/441a >> >> [5] >> https://git.collabora.com/cgit/user/tomeu/linux.git/log/?h=on-demand-probes-v6 >> >> [6] >> http://kernelci.org/boot/all/job/collabora/kernel/v4.2-11902-g25d80c927f8b/ >> >> [7] http://kernelci.org/boot/all/job/next/kernel/next-20150903/ >> >> Changes in v4: >> - Added bus.pre_probe callback so the probes of Primecell devices can be >> deferred if their device IDs cannot be yet read because of the clock >> driver not having probed when they are registered. Maybe this goes >> overboard and the matching information should be in the DT if there is >> one. > > Seems overboard to me or at least a separate problem. It's a separate problem but this was preventing the series from working on a few boards. > Most clocks have > to be setup before the driver model simply because timers depend on > clocks usually. Yes, but in this case the apb clocks for the primecell devices are implemented in a normal platform driver (vexpress_osc_driver), instead of using CLK_OF_DECLARE. Regards, Tomeu > Rob > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 0/9] drm/exynos: rewrite fimg2d error handling
Hello, during the discussion about the last patchset touching the fimg2d code, it became apparent that the error handling for the command submission is currently unsatisfactory. This series rewrites the handling. All functions that submit command buffers now first check if enough space is available and only then proceed to build the command buffers. In particular the command buffer is no longer left in a half-finished state, since parameters passed to the functions are now validated before command submission. For this some validation functions are introduced. This should also increase performance if the bottleneck is the submission part, since adding commands to the buffer is now more lightweight. Last but not least some prefix was added to messages printed by fprintf and printf, and the G2D context struct was moved out of the public header. Please review and let me know if I can improve anything! With best wishes, Tobias Changes since v1: - squashed some of the patches together (suggested by Inki) - changed return value of validate functions (suggested by Inki) - added some more explanatory comments (suggested by Emil) Tobias Jakobi (9): exynos/fimg2d: fix empty buffer handling in g2d_flush() exynos/fimg2d: simplify base address submission in g2d_scale_and_blend() exynos/fimg2d: add g2d_check_space() exynos/fimg2d: add g2d_validate_xyz() functions exynos/fimg2d: remove default case from g2d_get_blend_op() exynos/fimg2d: remove superfluous initialization of g2d_point_val exynos/fimg2d: make g2d_add_cmd() less heavy exynos/fimg2d: add message prefix exynos/fimg2d: remove g2d_context from public header exynos/exynos_fimg2d.c | 376 ++--- exynos/exynos_fimg2d.h | 14 +- 2 files changed, 231 insertions(+), 159 deletions(-) -- 2.0.5
[PATCH v2 1/9] exynos/fimg2d: fix empty buffer handling in g2d_flush()
Empty command buffers are no error, we just don't have anything to do for flushing then. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 24a06d0..4a88e0c 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -191,7 +191,7 @@ static int g2d_flush(struct g2d_context *ctx) struct drm_exynos_g2d_set_cmdlist cmdlist = {0}; if (ctx->cmd_nr == 0 && ctx->cmd_buf_nr == 0) - return -1; + return 0; if (ctx->cmdlist_nr >= G2D_MAX_CMD_LIST_NR) { fprintf(stderr, "Overflow cmdlist.\n"); -- 2.0.5
[PATCH v2 2/9] exynos/fimg2d: simplify base address submission in g2d_scale_and_blend()
Use g2d_add_base_addr() for source and destination base address just like all other calls. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 4a88e0c..85b2317 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -672,12 +672,7 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src, g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL); g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode); - if (dst->buf_type == G2D_IMGBUF_USERPTR) - g2d_add_cmd(ctx, DST_BASE_ADDR_REG | G2D_BUF_USERPTR, - (unsigned long)&dst->user_ptr[0]); - else - g2d_add_cmd(ctx, DST_BASE_ADDR_REG, dst->bo[0]); - + g2d_add_base_addr(ctx, dst, g2d_dst); g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride); g2d_add_cmd(ctx, SRC_SELECT_REG, src->select_mode); @@ -685,12 +680,7 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src, switch (src->select_mode) { case G2D_SELECT_MODE_NORMAL: - if (src->buf_type == G2D_IMGBUF_USERPTR) - g2d_add_cmd(ctx, SRC_BASE_ADDR_REG | G2D_BUF_USERPTR, - (unsigned long)&src->user_ptr[0]); - else - g2d_add_cmd(ctx, SRC_BASE_ADDR_REG, src->bo[0]); - + g2d_add_base_addr(ctx, src, g2d_src); g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride); break; case G2D_SELECT_MODE_FGCOLOR: -- 2.0.5
[PATCH v2 3/9] exynos/fimg2d: add g2d_check_space()
This is going to be used to check if the command buffers have enough space left prior to actual submission of the commands. Use this in g2d_{solid_fill,copy,copy_with_scale}(). For this the parameter validation before buffer space checking so that we can exit early if it fails. Also don't reset the G2D context in this situation since the buffers are not partially submitted anymore. The repeat mode in g2d_copy_with_scale() is checked first to make computation of space easier. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 99 -- 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 85b2317..2e04f4a 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -102,6 +102,23 @@ static unsigned int g2d_get_blend_op(enum e_g2d_op op) } /* + * g2d_check_space - check if command buffers have enough space left. + * + * @ctx: a pointer to g2d_context structure. + * @num_cmds: number of (regular) commands. + * @num_gem_cmds: number of GEM commands. + */ +static unsigned int g2d_check_space(const struct g2d_context *ctx, + unsigned int num_cmds, unsigned int num_gem_cmds) +{ + if (ctx->cmd_nr + num_cmds >= G2D_MAX_CMD_NR || + ctx->cmd_buf_nr + num_gem_cmds >= G2D_MAX_GEM_CMD_NR) + return 1; + else + return 0; +} + +/* * g2d_add_cmd - set given command and value to user side command buffer. * * @ctx: a pointer to g2d_context structure. @@ -302,6 +319,9 @@ g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img, union g2d_bitblt_cmd_val bitblt; union g2d_point_val pt; + if (g2d_check_space(ctx, 7, 1)) + return -ENOSPC; + g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_NORMAL); g2d_add_cmd(ctx, DST_COLOR_MODE_REG, img->color_mode); g2d_add_base_addr(ctx, img, g2d_dst); @@ -355,17 +375,7 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src, { union g2d_rop4_val rop4; union g2d_point_val pt; - unsigned int src_w = 0, src_h = 0, dst_w = 0, dst_h = 0; - - g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR); - g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode); - g2d_add_base_addr(ctx, dst, g2d_dst); - g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride); - - g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL); - g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode); - g2d_add_base_addr(ctx, src, g2d_src); - g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride); + unsigned int src_w, src_h, dst_w, dst_h; src_w = w; src_h = h; @@ -386,10 +396,22 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src, if (w <= 0 || h <= 0) { fprintf(stderr, "invalid width or height.\n"); - g2d_reset(ctx); return -EINVAL; } + if (g2d_check_space(ctx, 11, 2)) + return -ENOSPC; + + g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR); + g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode); + g2d_add_base_addr(ctx, dst, g2d_dst); + g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride); + + g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL); + g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode); + g2d_add_base_addr(ctx, src, g2d_src); + g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride); + pt.val = 0; pt.data.x = src_x; pt.data.y = src_y; @@ -445,23 +467,12 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src, { union g2d_rop4_val rop4; union g2d_point_val pt; - unsigned int scale; + unsigned int scale, repeat_pad; unsigned int scale_x, scale_y; - g2d_add_cmd(ctx, DST_SELECT_REG, G2D_SELECT_MODE_BGCOLOR); - g2d_add_cmd(ctx, DST_COLOR_MODE_REG, dst->color_mode); - g2d_add_base_addr(ctx, dst, g2d_dst); - g2d_add_cmd(ctx, DST_STRIDE_REG, dst->stride); - - g2d_add_cmd(ctx, SRC_SELECT_REG, G2D_SELECT_MODE_NORMAL); - g2d_add_cmd(ctx, SRC_COLOR_MODE_REG, src->color_mode); - - g2d_add_cmd(ctx, SRC_REPEAT_MODE_REG, src->repeat_mode); - if (src->repeat_mode == G2D_REPEAT_MODE_PAD) - g2d_add_cmd(ctx, SRC_PAD_VALUE_REG, dst->color); - - g2d_add_base_addr(ctx, src, g2d_src); - g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride); + /* Sanitize this parameter to facilitate space computation below. */ + if (negative) + negative = 1; if (src_w == dst_w && src_h == dst_h) scale = 0; @@ -471,6 +482,8 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src, scale_y = g2d_get_scaling(src_h, dst_h); } + repeat_pad = src->repeat_mode == G2D_REPEAT_MODE_PAD ? 1 : 0; + if (src_x + src_w > src->width) src_w = src-
[PATCH v2 4/9] exynos/fimg2d: add g2d_validate_xyz() functions
The G2D headers define a number of modes through enums (like e.g. color, select, repeat, etc.). This introduces g2d_validate_select_mode() and g2d_validate_blending_op() which validate a select mode or blending operation respectively. Use this together with g2d_check_space() in g2d_{blend,scale_and_blend}(). For this we move parameter validation to the top and also validate the select mode of the source image and the requested blending operation before starting command submission. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 181 ++--- 1 file changed, 126 insertions(+), 55 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 2e04f4a..9d9359a 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -119,6 +119,54 @@ static unsigned int g2d_check_space(const struct g2d_context *ctx, } /* + * g2d_validate_select_mode - validate select mode. + * + * @mode: the mode to validate + * + * Returns zero for an invalid mode and one otherwise. + */ +static int g2d_validate_select_mode( + enum e_g2d_select_mode mode) +{ + switch (mode) { + case G2D_SELECT_MODE_NORMAL: + case G2D_SELECT_MODE_FGCOLOR: + case G2D_SELECT_MODE_BGCOLOR: + return 1; + } + + return 0; +} + +/* + * g2d_validate_blending_op - validate blending operation. + * + * @operation: the operation to validate + * + * Returns zero for an invalid mode and one otherwise. + */ +static int g2d_validate_blending_op( + enum e_g2d_op operation) +{ + switch (operation) { + case G2D_OP_CLEAR: + case G2D_OP_SRC: + case G2D_OP_DST: + case G2D_OP_OVER: + case G2D_OP_INTERPOLATE: + case G2D_OP_DISJOINT_CLEAR: + case G2D_OP_DISJOINT_SRC: + case G2D_OP_DISJOINT_DST: + case G2D_OP_CONJOINT_CLEAR: + case G2D_OP_CONJOINT_SRC: + case G2D_OP_CONJOINT_DST: + return 1; + } + + return 0; +} + +/* * g2d_add_cmd - set given command and value to user side command buffer. * * @ctx: a pointer to g2d_context structure. @@ -579,7 +627,45 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src, union g2d_point_val pt; union g2d_bitblt_cmd_val bitblt; union g2d_blend_func_val blend; - unsigned int src_w = 0, src_h = 0, dst_w = 0, dst_h = 0; + unsigned int gem_space; + unsigned int src_w, src_h, dst_w, dst_h; + + src_w = w; + src_h = h; + if (src_x + w > src->width) + src_w = src->width - src_x; + if (src_y + h > src->height) + src_h = src->height - src_y; + + dst_w = w; + dst_h = h; + if (dst_x + w > dst->width) + dst_w = dst->width - dst_x; + if (dst_y + h > dst->height) + dst_h = dst->height - dst_y; + + w = MIN(src_w, dst_w); + h = MIN(src_h, dst_h); + + if (w <= 0 || h <= 0) { + fprintf(stderr, "invalid width or height.\n"); + return -EINVAL; + } + + if (!g2d_validate_select_mode(src->select_mode)) { + fprintf(stderr , "invalid select mode for source.\n"); + return -EINVAL; + } + + if (!g2d_validate_blending_op(op)) { + fprintf(stderr , "unsupported blending operation.\n"); + return -EINVAL; + } + + gem_space = src->select_mode == G2D_SELECT_MODE_NORMAL ? 2 : 1; + + if (g2d_check_space(ctx, 12, gem_space)) + return -ENOSPC; bitblt.val = 0; blend.val = 0; @@ -607,32 +693,6 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src, case G2D_SELECT_MODE_BGCOLOR: g2d_add_cmd(ctx, BG_COLOR_REG, src->color); break; - default: - fprintf(stderr , "failed to set src.\n"); - return -EINVAL; - } - - src_w = w; - src_h = h; - if (src_x + w > src->width) - src_w = src->width - src_x; - if (src_y + h > src->height) - src_h = src->height - src_y; - - dst_w = w; - dst_h = h; - if (dst_x + w > dst->width) - dst_w = dst->width - dst_x; - if (dst_y + h > dst->height) - dst_h = dst->height - dst_y; - - w = MIN(src_w, dst_w); - h = MIN(src_h, dst_h); - - if (w <= 0 || h <= 0) { - fprintf(stderr, "invalid width or height.\n"); - g2d_reset(ctx); - return -EINVAL; } bitblt.data.alpha_blend_mode = G2D_ALPHA_BLEND_MODE_ENABLE; @@ -689,9 +749,47 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src, union g2d_point_val pt; union g2d_bitblt_cmd_val bitblt; union g2d_blend_func_val blend; - unsigned int scale; + unsigned int scale, gem_space; unsigned int scale_x, scale_y; + if (src_w == dst_w && src_h
[PATCH v2 5/9] exynos/fimg2d: remove default case from g2d_get_blend_op()
We now validate the blending mode via g2d_validate_mode() prior to feeding it to g2d_get_blend_op(). Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 9d9359a..d7cbb24 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -64,6 +64,11 @@ static unsigned int g2d_get_blend_op(enum e_g2d_op op) val.val = 0; + /* +* The switch statement is missing the default branch since +* we assume that the caller checks the blending operation +* via g2d_validate_blending_op() first. +*/ switch (op) { case G2D_OP_CLEAR: case G2D_OP_DISJOINT_CLEAR: @@ -91,11 +96,6 @@ static unsigned int g2d_get_blend_op(enum e_g2d_op op) SET_BF(val, G2D_COEFF_MODE_SRC_ALPHA, 0, 0, 0, G2D_COEFF_MODE_SRC_ALPHA, 1, 0, 0); break; - default: - fprintf(stderr, "Not support operation(%d).\n", op); - SET_BF(val, G2D_COEFF_MODE_ONE, 0, 0, 0, G2D_COEFF_MODE_ZERO, - 0, 0, 0); - break; } return val.val; -- 2.0.5
[PATCH v2 6/9] exynos/fimg2d: remove superfluous initialization of g2d_point_val
The g2d_point_val union consists of two coordinates of 16 bits. Whenever this union is used though, both coordinates are explicitly set. Hence prior initialization is unnecessary. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 19 --- 1 file changed, 19 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index d7cbb24..fbc77a3 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -380,15 +380,12 @@ g2d_solid_fill(struct g2d_context *ctx, struct g2d_image *img, if (y + h > img->height) h = img->height - y; - pt.val = 0; pt.data.x = x; pt.data.y = y; g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = x + w; pt.data.y = y + h; - g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val); g2d_add_cmd(ctx, SF_COLOR_REG, img->color); @@ -460,20 +457,16 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src, g2d_add_base_addr(ctx, src, g2d_src); g2d_add_cmd(ctx, SRC_STRIDE_REG, src->stride); - pt.val = 0; pt.data.x = src_x; pt.data.y = src_y; g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = src_x + w; pt.data.y = src_y + h; g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val); - pt.val = 0; pt.data.x = dst_x; pt.data.y = dst_y; g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = dst_x + w; pt.data.y = dst_y + h; g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val); @@ -581,20 +574,16 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src, g2d_add_cmd(ctx, SRC_YSCALE_REG, scale_y); } - pt.val = 0; pt.data.x = src_x; pt.data.y = src_y; g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = src_x + src_w; pt.data.y = src_y + src_h; g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val); - pt.val = 0; pt.data.x = dst_x; pt.data.y = dst_y; g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = dst_x + dst_w; pt.data.y = dst_y + dst_h; g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val); @@ -700,20 +689,16 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src, g2d_add_cmd(ctx, BITBLT_COMMAND_REG, bitblt.val); g2d_add_cmd(ctx, BLEND_FUNCTION_REG, blend.val); - pt.val = 0; pt.data.x = src_x; pt.data.y = src_y; g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = src_x + w; pt.data.y = src_y + h; g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val); - pt.val = 0; pt.data.x = dst_x; pt.data.y = dst_y; g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = dst_x + w; pt.data.y = dst_y + h; g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val); @@ -829,20 +814,16 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src, g2d_add_cmd(ctx, BITBLT_COMMAND_REG, bitblt.val); g2d_add_cmd(ctx, BLEND_FUNCTION_REG, blend.val); - pt.val = 0; pt.data.x = src_x; pt.data.y = src_y; g2d_add_cmd(ctx, SRC_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = src_x + src_w; pt.data.y = src_y + src_h; g2d_add_cmd(ctx, SRC_RIGHT_BOTTOM_REG, pt.val); - pt.val = 0; pt.data.x = dst_x; pt.data.y = dst_y; g2d_add_cmd(ctx, DST_LEFT_TOP_REG, pt.val); - pt.val = 0; pt.data.x = dst_x + dst_w; pt.data.y = dst_y + dst_h; g2d_add_cmd(ctx, DST_RIGHT_BOTTOM_REG, pt.val); -- 2.0.5
[PATCH v2 7/9] exynos/fimg2d: make g2d_add_cmd() less heavy
The function currently checks for each added command if an overflow of the corresponding command buffers occurs, but none of the callers ever checks the return value. Since all callers are now converted to use g2d_check_space() simplify the function. (1) The overflow checks become asserts, so they're only active for debug builds. This is fine since g2d_add_cmd() is not part of the public API. (2) Switch the return value to void. (3) Explicitly state that the caller has to check buffer space before calling g2d_add_cmd(). Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 18 +++--- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index fbc77a3..5873fe7 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -172,8 +173,11 @@ static int g2d_validate_blending_op( * @ctx: a pointer to g2d_context structure. * @cmd: command data. * @value: value data. + * + * The caller has to make sure that the commands buffers have enough space + * left to hold the command. Use g2d_check_space() to ensure this. */ -static int g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd, +static void g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd, unsigned long value) { switch (cmd & ~(G2D_BUF_USERPTR)) { @@ -183,28 +187,20 @@ static int g2d_add_cmd(struct g2d_context *ctx, unsigned long cmd, case DST_PLANE2_BASE_ADDR_REG: case PAT_BASE_ADDR_REG: case MASK_BASE_ADDR_REG: - if (ctx->cmd_buf_nr >= G2D_MAX_GEM_CMD_NR) { - fprintf(stderr, "Overflow cmd_gem size.\n"); - return -EINVAL; - } + assert(ctx->cmd_buf_nr < G2D_MAX_GEM_CMD_NR); ctx->cmd_buf[ctx->cmd_buf_nr].offset = cmd; ctx->cmd_buf[ctx->cmd_buf_nr].data = value; ctx->cmd_buf_nr++; break; default: - if (ctx->cmd_nr >= G2D_MAX_CMD_NR) { - fprintf(stderr, "Overflow cmd size.\n"); - return -EINVAL; - } + assert(ctx->cmd_nr < G2D_MAX_CMD_NR); ctx->cmd[ctx->cmd_nr].offset = cmd; ctx->cmd[ctx->cmd_nr].data = value; ctx->cmd_nr++; break; } - - return 0; } /* -- 2.0.5
[PATCH v2 8/9] exynos/fimg2d: add message prefix
Add a prefix to the messages printed to the console via printf() and fprintf() so that one can easily see where the message comes from. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 5873fe7..9746c21 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -42,6 +42,8 @@ #define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MSG_PREFIX "exynos/fimg2d: " + enum g2d_base_addr_reg { g2d_dst = 0, g2d_src @@ -255,7 +257,7 @@ static int g2d_flush(struct g2d_context *ctx) return 0; if (ctx->cmdlist_nr >= G2D_MAX_CMD_LIST_NR) { - fprintf(stderr, "Overflow cmdlist.\n"); + fprintf(stderr, MSG_PREFIX "command list overflow.\n"); return -EINVAL; } @@ -271,7 +273,7 @@ static int g2d_flush(struct g2d_context *ctx) ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST, &cmdlist); if (ret < 0) { - fprintf(stderr, "failed to set cmdlist.\n"); + fprintf(stderr, MSG_PREFIX "failed to set cmdlist.\n"); return ret; } @@ -293,7 +295,7 @@ struct g2d_context *g2d_init(int fd) ctx = calloc(1, sizeof(*ctx)); if (!ctx) { - fprintf(stderr, "failed to allocate context.\n"); + fprintf(stderr, MSG_PREFIX "failed to allocate context.\n"); return NULL; } @@ -301,7 +303,7 @@ struct g2d_context *g2d_init(int fd) ret = drmIoctl(fd, DRM_IOCTL_EXYNOS_G2D_GET_VER, &ver); if (ret < 0) { - fprintf(stderr, "failed to get version.\n"); + fprintf(stderr, MSG_PREFIX "failed to get version.\n"); free(ctx); return NULL; } @@ -309,7 +311,7 @@ struct g2d_context *g2d_init(int fd) ctx->major = ver.major; ctx->minor = ver.minor; - printf("g2d version(%d.%d).\n", ctx->major, ctx->minor); + printf(MSG_PREFIX "G2D version (%d.%d).\n", ctx->major, ctx->minor); return ctx; } @@ -335,7 +337,7 @@ int g2d_exec(struct g2d_context *ctx) ret = drmIoctl(ctx->fd, DRM_IOCTL_EXYNOS_G2D_EXEC, &exec); if (ret < 0) { - fprintf(stderr, "failed to execute.\n"); + fprintf(stderr, MSG_PREFIX "failed to execute.\n"); return ret; } @@ -436,7 +438,7 @@ g2d_copy(struct g2d_context *ctx, struct g2d_image *src, h = MIN(src_h, dst_h); if (w <= 0 || h <= 0) { - fprintf(stderr, "invalid width or height.\n"); + fprintf(stderr, MSG_PREFIX "invalid width or height.\n"); return -EINVAL; } @@ -532,7 +534,7 @@ g2d_copy_with_scale(struct g2d_context *ctx, struct g2d_image *src, dst_h = dst->height - dst_y; if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) { - fprintf(stderr, "invalid width or height.\n"); + fprintf(stderr, MSG_PREFIX "invalid width or height.\n"); return -EINVAL; } @@ -633,17 +635,17 @@ g2d_blend(struct g2d_context *ctx, struct g2d_image *src, h = MIN(src_h, dst_h); if (w <= 0 || h <= 0) { - fprintf(stderr, "invalid width or height.\n"); + fprintf(stderr, MSG_PREFIX "invalid width or height.\n"); return -EINVAL; } if (!g2d_validate_select_mode(src->select_mode)) { - fprintf(stderr , "invalid select mode for source.\n"); + fprintf(stderr , MSG_PREFIX "invalid select mode for source.\n"); return -EINVAL; } if (!g2d_validate_blending_op(op)) { - fprintf(stderr , "unsupported blending operation.\n"); + fprintf(stderr , MSG_PREFIX "unsupported blending operation.\n"); return -EINVAL; } @@ -752,17 +754,17 @@ g2d_scale_and_blend(struct g2d_context *ctx, struct g2d_image *src, dst_h = dst->height - dst_y; if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0) { - fprintf(stderr, "invalid width or height.\n"); + fprintf(stderr, MSG_PREFIX "invalid width or height.\n"); return -EINVAL; } if (!g2d_validate_select_mode(src->select_mode)) { - fprintf(stderr , "invalid select mode for source.\n"); + fprintf(stderr , MSG_PREFIX "invalid select mode for source.\n"); return -EINVAL; } if (!g2d_validate_blending_op(op)) { - fprintf(stderr , "unsupported blending operation.\n"); + fprintf(stderr , MSG_PREFIX "unsupported blending operation.\n"); return -EINVAL; } -- 2.0.5
[PATCH v2 9/9] exynos/fimg2d: remove g2d_context from public header
All functions from the public API only operation on struct g2d_context*, so this shouldn't break too much. Make the context private since we don't want the user to modify its content directly. Also remove the defines that were only used for fields of g2d_context. Signed-off-by: Tobias Jakobi --- exynos/exynos_fimg2d.c | 15 +++ exynos/exynos_fimg2d.h | 14 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 9746c21..e734144 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -44,6 +44,21 @@ #define MSG_PREFIX "exynos/fimg2d: " +#define G2D_MAX_CMD_NR 64 +#define G2D_MAX_GEM_CMD_NR 64 +#define G2D_MAX_CMD_LIST_NR64 + +struct g2d_context { + int fd; + unsigned intmajor; + unsigned intminor; + struct drm_exynos_g2d_cmd cmd[G2D_MAX_CMD_NR]; + struct drm_exynos_g2d_cmd cmd_buf[G2D_MAX_GEM_CMD_NR]; + unsigned intcmd_nr; + unsigned intcmd_buf_nr; + unsigned intcmdlist_nr; +}; + enum g2d_base_addr_reg { g2d_dst = 0, g2d_src diff --git a/exynos/exynos_fimg2d.h b/exynos/exynos_fimg2d.h index 9db0c88..4aa1568 100644 --- a/exynos/exynos_fimg2d.h +++ b/exynos/exynos_fimg2d.h @@ -13,9 +13,6 @@ #ifndef _FIMG2D_H_ #define _FIMG2D_H_ -#define G2D_MAX_CMD_NR 64 -#define G2D_MAX_GEM_CMD_NR 64 -#define G2D_MAX_CMD_LIST_NR64 #define G2D_PLANE_MAX_NR 2 enum e_g2d_color_mode { @@ -289,16 +286,7 @@ struct g2d_image { void*mapped_ptr[G2D_PLANE_MAX_NR]; }; -struct g2d_context { - int fd; - unsigned intmajor; - unsigned intminor; - struct drm_exynos_g2d_cmd cmd[G2D_MAX_CMD_NR]; - struct drm_exynos_g2d_cmd cmd_buf[G2D_MAX_GEM_CMD_NR]; - unsigned intcmd_nr; - unsigned intcmd_buf_nr; - unsigned intcmdlist_nr; -}; +struct g2d_context; struct g2d_context *g2d_init(int fd); void g2d_fini(struct g2d_context *ctx); -- 2.0.5
[Bug 91921] radeon: command stream overflowed with current git
m] size 7299072 [2.214956] [drm] fb depth is 24 [2.214957] [drm]pitch is 6912 [2.215011] fbcon: radeondrmfb (fb0) is primary device -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/d80f73d1/attachment.html>
[Bug 91921] radeon: command stream overflowed with current git
https://bugs.freedesktop.org/show_bug.cgi?id=91921 octoploid changed: What|Removed |Added CC||notasas at gmail.com, ||octoploid at yandex.com --- Comment #1 from octoploid --- Started with: commit fbb423b43380d0e43d14056e96846da412693148 Author: Grazvydas Ignotas Date: Thu Sep 3 01:54:28 2015 +0300 r600g: apply disable workaround on all scissors During review of the "r600g: make all scissor states use single atom" patch Marek Olšák noticed that scissor disable workaround should be applied on all scissor states and not just first one, so let's do so. Signed-off-by: Marek Olšák Reverting the commit above fixes the issue. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/0039e8a5/attachment-0001.html>
[Bug 56659] DRI_PRIME: triangle, rendering inside of which occurs with a noticeable delay
https://bugs.freedesktop.org/show_bug.cgi?id=56659 russianneuromancer at ya.ru changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #8 from russianneuromancer at ya.ru --- Not reproducible anymore. -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/d3819805/attachment.html>
[git pull] drm for 4.3
On Mon, Sep 7, 2015 at 9:56 PM, Dave Airlie wrote: > > i.e. 59 commits in a 5000 commit tree is likely not that bad, 59 > commits in a 20 commit tree would be bad. I think it's about size of the commits. If it's 59 clean oneliner fixes, I don't think it's a big deal. If it's 59 patches that add new functionality, that's a different issue. The size of the base tree is almost entirely irrelevant in that situation. Fixes are ok, new features are not. Linus
[PATCH 5/6] drm/dp: Use I2C_WRITE_STATUS_UPDATE to drain partial I2C_WRITE requests
On Thu, Aug 27, 2015 at 05:23:30PM +0300, ville.syrjala at linux.intel.com wrote: > From: Ville Syrjälä > > When an i2c WRITE gets an i2c defer or short i2c ack reply, we are > supposed to switch the request from I2C_WRITE to I2C_WRITE_STATUS_UPDATE > when we continue to poll for the completion of the request. > > v2: Don't assume DP_AUX_I2C_WRITE is 0 even though it is, to make the > code more obvious to the casual reader (Jani) > > Acked-by: Alex Deucher > Reviewed-by: Jani Nikula > Signed-off-by: Ville Syrjälä Applied patches 1-5 to drm-misc, thanks. Some minor context conflicts in this one here that I resolved by juggling drm_dp_i2c_msg_write_status_update a bit upwards. Thanks, Daniel > --- > drivers/gpu/drm/drm_dp_helper.c | 43 > + > 1 file changed, 39 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c > index ee5cd86..a717f4c 100644 > --- a/drivers/gpu/drm/drm_dp_helper.c > +++ b/drivers/gpu/drm/drm_dp_helper.c > @@ -496,6 +496,27 @@ static int drm_dp_i2c_retry_count(const struct > drm_dp_aux_msg *msg, > return DIV_ROUND_UP(i2c_len, aux_len + AUX_RETRY_INTERVAL); > } > > +static void drm_dp_i2c_msg_set_request(struct drm_dp_aux_msg *msg, > +const struct i2c_msg *i2c_msg) > +{ > + msg->request = (i2c_msg->flags & I2C_M_RD) ? > + DP_AUX_I2C_READ : DP_AUX_I2C_WRITE; > + msg->request |= DP_AUX_I2C_MOT; > +} > + > +static void drm_dp_i2c_msg_write_status_update(struct drm_dp_aux_msg *msg) > +{ > + /* > + * In case of i2c defer or short i2c ack reply to a write, > + * we need to switch to WRITE_STATUS_UPDATE to drain the > + * rest of the message > + */ > + if ((msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_I2C_WRITE) { > + msg->request &= DP_AUX_I2C_MOT; > + msg->request |= DP_AUX_I2C_WRITE_STATUS_UPDATE; > + } > +} > + > /* > * FIXME currently assumes 10 kHz as some real world devices seem > * to require it. We should query/set the speed via DPCD if supported. > @@ -576,6 +597,8 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, > struct drm_dp_aux_msg *msg) >* Both native ACK and I2C ACK replies received. We >* can assume the transfer was successful. >*/ > + if (ret != msg->size) > + drm_dp_i2c_msg_write_status_update(msg); > return ret; > > case DP_AUX_I2C_REPLY_NACK: > @@ -593,6 +616,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, > struct drm_dp_aux_msg *msg) > if (defer_i2c < 7) > defer_i2c++; > usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + > 100); > + drm_dp_i2c_msg_write_status_update(msg); > continue; > > default: > @@ -658,10 +682,7 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, > struct i2c_msg *msgs, > > for (i = 0; i < num; i++) { > msg.address = msgs[i].addr; > - msg.request = (msgs[i].flags & I2C_M_RD) ? > - DP_AUX_I2C_READ : > - DP_AUX_I2C_WRITE; > - msg.request |= DP_AUX_I2C_MOT; > + drm_dp_i2c_msg_set_request(&msg, &msgs[i]); > /* Send a bare address packet to start the transaction. >* Zero sized messages specify an address only (bare >* address) transaction. > @@ -669,6 +690,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, > struct i2c_msg *msgs, > msg.buffer = NULL; > msg.size = 0; > err = drm_dp_i2c_do_msg(aux, &msg); > + > + /* > + * Reset msg.request in case in case it got > + * changed into a WRITE_STATUS_UPDATE. > + */ > + drm_dp_i2c_msg_set_request(&msg, &msgs[i]); > + > if (err < 0) > break; > /* We want each transaction to be as large as possible, but > @@ -681,6 +709,13 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, > struct i2c_msg *msgs, > msg.size = min(transfer_size, msgs[i].len - j); > > err = drm_dp_i2c_drain_msg(aux, &msg); > + > + /* > + * Reset msg.request in case in case it got > + * changed into a WRITE_STATUS_UPDATE. > + */ > + drm_dp_i2c_msg_set_request(&msg, &msgs[i]); > + > if (err < 0) > break; > transfer_size = err; > -- > 2.4.6 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://list
[Intel-gfx] [PATCH 08/11] drm: Enforce unlocked ioctl operation for kms driver ioctls
Hi Daniel, 2015-09-08 Daniel Vetter : > With the prep patches for i915 all kms drivers either have > DRM_UNLOCKED on all their ioctls. Or the ioctl always directly returns > with an invariant return value when in modeset mode. But that's only > the case for i915 and radeon. The drm core ioctls are unfortunately > too much a mess still to dare this. > > Follow-up patches will remove DRM_UNLOCKED from all kms drivers to > prove that this is indeed the case. > > Also update the documentation. > > Signed-off-by: Daniel Vetter > --- > Documentation/DocBook/drm.tmpl | 4 +++- > drivers/gpu/drm/drm_ioctl.c| 6 +- > 2 files changed, 8 insertions(+), 2 deletions(-) Reviewed-by: Gustavo Padovan Gustavo
[Intel-gfx] [PATCH 10/11] drm/: Drop DRM_UNLOCKED from modeset drivers
Hi Daniel, 2015-09-08 Daniel Vetter : > Just one special case (since i915 lost its ums code, yay): > - radeon: Has slots for the old ums ioctls which don't have > DRM_UNLOCKED, but all filled with drm_invalid_op. So ok to drop it > everywhere. > > Every other kms driver just has DRM_UNLOCKED for all their ioctls, as > they should. > > v2: admgpu happened, include that one too. And i915 lost its UMS > support which means we can change all the i915 ioctls too. > > v3: Rebased on top of new vmwgfx DX interface extensions. > > v4: Rebase on top of render-node support in exynos. > > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 +-- > drivers/gpu/drm/armada/armada_drv.c | 9 ++--- > drivers/gpu/drm/exynos/exynos_drm_drv.c | 20 - > drivers/gpu/drm/i915/i915_dma.c | 72 > - > drivers/gpu/drm/msm/msm_drv.c | 14 +++ > drivers/gpu/drm/nouveau/nouveau_drm.c | 24 +-- > drivers/gpu/drm/omapdrm/omap_drv.c | 12 +++--- > drivers/gpu/drm/qxl/qxl_ioctl.c | 14 +++ > drivers/gpu/drm/radeon/radeon_kms.c | 30 +++--- > drivers/gpu/drm/tegra/drm.c | 28 ++--- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 54 - > 11 files changed, 149 insertions(+), 152 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c > index 22367939ebf1..3648fdca6359 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c > @@ -685,18 +685,18 @@ int amdgpu_get_vblank_timestamp_kms(struct drm_device > *dev, int crtc, > } > > const struct drm_ioctl_desc amdgpu_ioctls_kms[] = { > - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_CREATE, amdgpu_gem_create_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_CTX, amdgpu_ctx_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_BO_LIST, amdgpu_bo_list_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > /* KMS */ > - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > - DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, > DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_MMAP, amdgpu_gem_mmap_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_WAIT_IDLE, amdgpu_gem_wait_idle_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_CS, amdgpu_cs_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_INFO, amdgpu_info_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_WAIT_CS, amdgpu_cs_wait_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_METADATA, amdgpu_gem_metadata_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, > DRM_AUTH|DRM_RENDER_ALLOW), > }; > int amdgpu_max_kms_ioctl = ARRAY_SIZE(amdgpu_ioctls_kms); > diff --git a/drivers/gpu/drm/armada/armada_drv.c > b/drivers/gpu/drm/armada/armada_drv.c > index 225034b74cda..f73b3e2a772b 100644 > --- a/drivers/gpu/drm/armada/armada_drv.c > +++ b/drivers/gpu/drm/armada/armada_drv.c > @@ -268,12 +268,9 @@ static void armada_drm_disable_vblank(struct drm_device > *dev, int crtc) > } > > static struct drm_ioctl_desc armada_ioctls[] = { > - DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl, > - DRM_UNLOCKED), > - DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, > - DRM_UNLOCKED), > - DRM_IOCTL_DEF_DRV(ARMADA_GEM_PWRITE, armada_gem_pwrite_ioctl, > - DRM_UNLOCKED), > +
[Bug 91921] radeon: command stream overflowed with current git
https://bugs.freedesktop.org/show_bug.cgi?id=91921 --- Comment #2 from Grazvydas Ignotas --- Created attachment 118156 --> https://bugs.freedesktop.org/attachment.cgi?id=118156&action=edit candidate fix Does this patch help? -- You are receiving this mail because: You are the assignee for the bug. -- next part -- An HTML attachment was scrubbed... URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20150908/8f9ac51f/attachment.html>
[Bug 103271] AMD R9 270X Flickering with DPM Enabled on Linux 4.1 with RadeonSI
https://bugzilla.kernel.org/show_bug.cgi?id=103271 --- Comment #14 from Kevin McCormack --- Michel, thank you for this, I will try to bisect again...it should only take 13 compiles! :/ -- You are receiving this mail because: You are watching the assignee of the bug.
[PATCH libdrm] tests: Add -lm to LDADD for dristat
On Mon, Sep 7, 2015 at 6:02 AM, Michel Dänzer wrote: > From: Michel Dänzer > > Fixes build failure due to unresolved log2. > > Signed-off-by: Michel Dänzer Reviewed-by: Alex Deucher > --- > tests/Makefile.am | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 9a2d932..a511d28 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -33,6 +33,8 @@ check_PROGRAMS = \ > dristat \ > drmstat > > +dristat_LDADD = -lm > + > if HAVE_NOUVEAU > SUBDIRS += nouveau > endif > -- > 2.5.0 > > ___ > dri-devel mailing list > dri-devel at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCHv2 2/3] devicetree: Add new ANX7814 SlimPort transmitter binding.
On 09/08/2015 02:25 AM, Enric Balletbo i Serra wrote: > The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter > designed for portable devices. > > You can add support to your board with current binding. > > Example: > > anx7814: anx7814 at 38 { > compatible = "analogix,anx7814"; > reg = <0x38>; > pd-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; > reset-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; > }; > > Signed-off-by: Enric Balletbo i Serra > --- > .../devicetree/bindings/video/anx7814.txt | 22 > ++ > 1 file changed, 22 insertions(+) > create mode 100644 Documentation/devicetree/bindings/video/anx7814.txt > > diff --git a/Documentation/devicetree/bindings/video/anx7814.txt > b/Documentation/devicetree/bindings/video/anx7814.txt > new file mode 100644 > index 000..a8cc746 > --- /dev/null > +++ b/Documentation/devicetree/bindings/video/anx7814.txt > @@ -0,0 +1,22 @@ > +Analogix ANX7814 SlimPort (Full-HD Transmitter) > +--- > + > +The ANX7814 is an ultra-low power Full-HD (1080p60) SlimPort transmitter > +designed for portable devices. > + > +Required properties: > + > + - compatible: "analogix,anx7814" > + - reg : I2C address of the device > + - pd-gpios : Which GPIO to use for power down > + - reset-gpios : Which GPIO to use for reset > + > +Example: > + > + anx7814: anx7814 at 38 { > + compatible = "analogix,anx7814"; > + reg = <0x38>; > + pd-gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; > + reset-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>; No ports needed for describing data connections? Rob > + }; > + >
[PATCH v4 0/22] On-demand device probing
On 09/08/2015 02:30 AM, Tomeu Vizoso wrote: > On 7 September 2015 at 22:50, Rob Herring wrote: >> On Mon, Sep 7, 2015 at 7:23 AM, Tomeu Vizoso >> wrote: >>> Hello, >>> >>> I have a problem with the panel on my Tegra Chromebook taking longer >>> than expected to be ready during boot (Stéphane Marchesin reported what >>> is basically the same issue in [0]), and have looked into ordered >>> probing as a better way of solving this than moving nodes around in the >>> DT or playing with initcall levels and linking order. >>> >>> While reading the thread [1] that Alexander Holler started with his >>> series to make probing order deterministic, it occurred to me that it >>> should be possible to achieve the same by probing devices as they are >>> referenced by other devices. >>> >>> This basically reuses the information that is already implicit in the >>> probe() implementations, saving us from refactoring existing drivers or >>> adding information to DTBs. >>> >>> During review of v1 of this series Linus Walleij suggested that it >>> should be the device driver core to make sure that dependencies are >>> ready before probing a device. I gave this idea a try [2] but Mark Brown >>> pointed out to the logic duplication between the resource acquisition >>> and dependency discovery code paths (though I think it's fairly minor). >>> >>> To address that code duplication I experimented with Arnd's devm_probe >>> [3] concept of having drivers declare their dependencies instead of >>> acquiring them during probe, and while it worked [4], I don't think we >>> end up winning anything when compared to just probing devices on-demand >>> from resource getters. >>> >>> One remaining objection is to the "sprinkling" of calls to >>> of_device_probe() in the resource getters of each subsystem, but I think >>> it's the right thing to do given that the storage of resources is >>> currently subsystem-specific. >>> >>> We could avoid the above by moving resource storage into the core, but I >>> don't think there's a compelling case for that. >>> >>> I have tested this on boards with Tegra, iMX.6, Exynos, Rockchip and >>> OMAP SoCs, and these patches were enough to eliminate all the deferred >>> probes (except one in PandaBoard because omap_dma_system doesn't have a >>> firmware node as of yet). >>> >>> Have submitted a branch [5] with only these patches on top of thursday's >>> linux-next to kernelci.org and I don't see any issues that could be >>> caused by them. For some reason it currently has more passes than the >>> version of -next it's based on! >>> >>> With this series I get the kernel to output to the panel in 0.5s, >>> instead of 2.8s. >>> >>> Regards, >>> >>> Tomeu >>> >>> [0] http://lists.freedesktop.org/archives/dri-devel/2014-August/066527.html >>> >>> [1] https://lkml.org/lkml/2014/5/12/452 >>> >>> [2] https://lkml.org/lkml/2015/6/17/305 >>> >>> [3] http://article.gmane.org/gmane.linux.ports.arm.kernel/277689 >>> >>> [4] https://lkml.org/lkml/2015/7/21/441a >>> >>> [5] >>> https://git.collabora.com/cgit/user/tomeu/linux.git/log/?h=on-demand-probes-v6 >>> >>> [6] >>> http://kernelci.org/boot/all/job/collabora/kernel/v4.2-11902-g25d80c927f8b/ >>> >>> [7] http://kernelci.org/boot/all/job/next/kernel/next-20150903/ >>> >>> Changes in v4: >>> - Added bus.pre_probe callback so the probes of Primecell devices can be >>> deferred if their device IDs cannot be yet read because of the clock >>> driver not having probed when they are registered. Maybe this goes >>> overboard and the matching information should be in the DT if there is >>> one. >> >> Seems overboard to me or at least a separate problem. > > It's a separate problem but this was preventing the series from > working on a few boards. What is the failure? Not booting? Fixing not working would certainly not be overboard. > >> Most clocks have >> to be setup before the driver model simply because timers depend on >> clocks usually. > > Yes, but in this case the apb clocks for the primecell devices are > implemented in a normal platform driver (vexpress_osc_driver), instead > of using CLK_OF_DECLARE. Okay. Rob
[PATCHv2 1/3] of: Add vendor prefix for Analogix Semiconductor, Inc.
On 09/08/2015 02:25 AM, Enric Balletbo i Serra wrote: > Analogix Semiconductor develops analog and mixed-signal devices for digital > media and communications interconnect applications. > > Signed-off-by: Enric Balletbo i Serra Acked-by: Rob Herring > --- > Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt > b/Documentation/devicetree/bindings/vendor-prefixes.txt > index ac5f0c3..e914a02 100644 > --- a/Documentation/devicetree/bindings/vendor-prefixes.txt > +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt > @@ -22,6 +22,7 @@ ampire Ampire Co., Ltd. > ams AMS AG > amstaos AMS-Taos Inc. > apm Applied Micro Circuits Corporation (APM) > +analogix Analogix Semiconductor, Inc. > aptina Aptina Imaging > arasan Arasan Chip Systems > arm ARM Ltd. >
[PATCH 05/15] vga_switcheroo: Drop client power state VGA_SWITCHEROO_INIT
hda_intel.c:azx_probe() defers initialization of an audio controller on the discrete GPU if the GPU is powered off. The power state of the GPU is determined by calling vga_switcheroo_get_client_state(). vga_switcheroo_get_client_state() returns VGA_SWITCHEROO_INIT if vga_switcheroo is not enabled, i.e. if no second GPU or no handler has registered. This can go wrong in the following scenario: - Driver for the integrated GPU is not loaded. - Driver for the discrete GPU registers with vga_switcheroo, uses driver power control to power down the GPU, handler cuts power to the GPU. - Driver for the audio controller gets loaded after the GPU was powered down, calls vga_switcheroo_get_client_state() which returns VGA_SWITCHEROO_INIT instead of VGA_SWITCHEROO_OFF. - Consequence: azx_probe() tries to initialize the audio controller even though the GPU is powered down. The power state VGA_SWITCHEROO_INIT was introduced by c8e9cf7bb240 ("vga_switcheroo: Add a helper function to get the client state"). It is not apparent what its benefit might be. The idea seems to be to initialize the audio controller even if the power state is VGA_SWITCHEROO_OFF (were vga_switcheroo enabled), but as shown above this can fail. Drop VGA_SWITCHEROO_INIT to solve this. Cc: Takashi Iwai Signed-off-by: Lukas Wunner --- drivers/gpu/vga/vga_switcheroo.c | 2 -- include/linux/vga_switcheroo.h | 5 - 2 files changed, 7 deletions(-) diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 2138162..845e47d 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c @@ -355,8 +355,6 @@ int vga_switcheroo_get_client_state(struct pci_dev *pdev) client = find_client_from_pci(&vgasr_priv.clients, pdev); if (!client) ret = VGA_SWITCHEROO_NOT_FOUND; - else if (!vgasr_priv.active) - ret = VGA_SWITCHEROO_INIT; else ret = client->pwr_state; mutex_unlock(&vgasr_mutex); diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h index 3764991..95bfbeb0 100644 --- a/include/linux/vga_switcheroo.h +++ b/include/linux/vga_switcheroo.h @@ -39,10 +39,6 @@ struct pci_dev; * enum vga_switcheroo_state - client power state * @VGA_SWITCHEROO_OFF: off * @VGA_SWITCHEROO_ON: on - * @VGA_SWITCHEROO_INIT: client has registered with vga_switcheroo but - * vga_switcheroo is not enabled, i.e. no second client or no handler - * has registered. Only used in vga_switcheroo_get_client_state() which - * in turn is only called from hda_intel.c * @VGA_SWITCHEROO_NOT_FOUND: client has not registered with vga_switcheroo. * Only used in vga_switcheroo_get_client_state() which in turn is only * called from hda_intel.c @@ -53,7 +49,6 @@ enum vga_switcheroo_state { VGA_SWITCHEROO_OFF, VGA_SWITCHEROO_ON, /* below are referred only from vga_switcheroo_get_client_state() */ - VGA_SWITCHEROO_INIT, VGA_SWITCHEROO_NOT_FOUND, }; -- 1.8.5.2 (Apple Git-48)