Re: [PATCH v12 3/5] dt-bindings: drm/bridge: Document sn65dsi86 bridge bindings
Quoting spa...@codeaurora.org (2018-06-24 21:56:05) > On 2018-06-22 06:42, Stephen Boyd wrote: > > Quoting Sandeep Panda (2018-06-21 05:32:07) > >> + clock rate must be 12 MHz, 19.2 MHz, 26 MHz, 27 MHz or 38.4 > >> MHz. > >> + > >> +- data-lanes: See ../../media/video-interface.txt > >> +- lane-polarities: See ../../media/video-interface.txt > > > > We need another property for suspend-gpios function of GPIO1. I suppose > > for the other GPIOs we don't need anything like this because they're > > output functions only? GPIO4 can do PWM and I guess if pwm is used in > > DT > > from here then the driver can mux that out of gpio4 properly. I have no > > idea how the hsync and vsync GPIOs would work though. I see that GPIO3 > > can do DSIA hsync or vsync and GPIO2 can do DSIA vsync and I would > > guess > > those are in output mode only. Maybe that's just another property on > > this node to indicate if we should mux out the function or not. Usually > > that's done from pinctrl though. I don't have a use case for those > > functions but I do care about suspend gpios so at least add that one > > please. > > I was thinking of adding gpio1 (suspend-gpio) documentation when we add > support for PSR feature. Since for PSR we will be using this > suspoend-gpio. > Ok sure, but I don't see any harm in adding it now. I'm fine with waiting for the binding update when the PSR patches come if you feel like adding it now will delay something. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [linux-sunxi] Re: [PATCH v2 11/27] drm/sun4i: tcon: Add support for tcon-top gate
Dne četrtek, 21. junij 2018 ob 17:35:45 CEST je Jernej Škrabec napisal(a): > Dne četrtek, 21. junij 2018 ob 03:23:27 CEST je Chen-Yu Tsai napisal(a): > > On Thu, Jun 21, 2018 at 3:37 AM, Jernej Škrabec > > wrote: > > > Dne sobota, 16. junij 2018 ob 07:48:38 CEST je Chen-Yu Tsai napisal(a): > > >> On Sat, Jun 16, 2018 at 1:33 AM, Jernej Škrabec > > >> > > > > > > wrote: > > >> > Dne petek, 15. junij 2018 ob 19:13:17 CEST je Chen-Yu Tsai napisal(a): > > >> >> On Sat, Jun 16, 2018 at 12:41 AM, Jernej Škrabec > > >> >> > > >> >> wrote: > > >> >> > Hi, > > >> >> > > > >> >> > Dne petek, 15. junij 2018 ob 10:31:10 CEST je Maxime Ripard > > napisal(a): > > >> >> >> Hi, > > >> >> >> > > >> >> >> On Tue, Jun 12, 2018 at 10:00:20PM +0200, Jernej Skrabec wrote: > > >> >> >> > TV TCONs connected to TCON TOP have to enable additional gate > > >> >> >> > in > > >> >> >> > order > > >> >> >> > to work. > > >> >> >> > > > >> >> >> > Add support for such TCONs. > > >> >> >> > > > >> >> >> > Signed-off-by: Jernej Skrabec > > >> >> >> > --- > > >> >> >> > > > >> >> >> > drivers/gpu/drm/sun4i/sun4i_tcon.c | 11 +++ > > >> >> >> > drivers/gpu/drm/sun4i/sun4i_tcon.h | 4 > > >> >> >> > 2 files changed, 15 insertions(+) > > >> >> >> > > > >> >> >> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c > > >> >> >> > b/drivers/gpu/drm/sun4i/sun4i_tcon.c index > > >> >> >> > 08747fc3ee71..0afb5a94a414 > > >> >> >> > 100644 > > >> >> >> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c > > >> >> >> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c > > >> >> >> > @@ -688,6 +688,16 @@ static int sun4i_tcon_init_clocks(struct > > >> >> >> > device > > >> >> >> > *dev, > > >> >> >> > > > >> >> >> > dev_err(dev, "Couldn't get the TCON bus clock\n"); > > >> >> >> > return PTR_ERR(tcon->clk); > > >> >> >> > > > >> >> >> > } > > >> >> >> > > > >> >> >> > + > > >> >> >> > + if (tcon->quirks->has_tcon_top_gate) { > > >> >> >> > + tcon->top_clk = devm_clk_get(dev, "tcon-top"); > > >> >> >> > + if (IS_ERR(tcon->top_clk)) { > > >> >> >> > + dev_err(dev, "Couldn't get the TCON TOP bus > > >> >> >> > clock\n"); > > >> >> >> > + return PTR_ERR(tcon->top_clk); > > >> >> >> > + } > > >> >> >> > + clk_prepare_enable(tcon->top_clk); > > >> >> >> > + } > > >> >> >> > + > > >> >> >> > > >> >> >> Is it required for the TCON itself to operate, or does the TCON > > >> >> >> requires the TCON TOP, which in turn requires that clock to be > > >> >> >> functional? > > >> >> >> > > >> >> >> I find it quite odd to have a clock that isn't meant for a > > >> >> >> particular > > >> >> >> device to actually be wired to another device. I'm not saying > > >> >> >> this > > >> >> >> isn't the case, but it would be a first. > > >> >> > > > >> >> > Documentation doesn't say much about that gate. I did few tests > > >> >> > and > > >> >> > TCON > > >> >> > registers can be read and written even if TCON TOP TV TCON gate is > > >> >> > disabled. However, there is no image, as expected. > > >> >> > > >> >> The R40 manual does include it in the diagram, on page 504. There's > > >> >> also > > >> >> a > > >> >> mux to select whether the clock comes directly from the CCU or the > > >> >> TV > > >> >> encoder (a feedback mode?). I assume this is the gate you are > > >> >> referring > > >> >> to > > >> >> here, in which case it is not a bus clock, but rather the TCON > > >> >> module > > >> >> or > > >> >> channel clock, strangely routed. > > >> >> > > >> >> > More interestingly, I enabled test pattern directly in TCON to > > >> >> > eliminate > > >> >> > influence of the mixer. As soon as I disabled that gate, test > > >> >> > pattern > > >> >> > on > > >> >> > HDMI screen was gone, which suggest that this gate influences > > >> >> > something > > >> >> > inside TCON. > > >> >> > > > >> >> > Another test I did was that I moved enable/disable gate code to > > >> >> > sun4i_tcon_channel_set_status() and it worked just as well. > > >> >> > > > >> >> > I'll ask AW engineer what that gate actually does, but from what I > > >> >> > saw, > > >> >> > I > > >> >> > would say that most appropriate location to enable/disable TCON > > >> >> > TOP > > >> >> > TV > > >> >> > TCON > > >> >> > gate is TCON driver. Alternatively, TCON TOP driver could check if > > >> >> > any > > >> >> > TV > > >> >> > TCON is in use and enable appropriate gate. However, that doesn't > > >> >> > sound > > >> >> > right to me for some reason. > > >> >> > > >> >> If what I said above it true, then yes, the appropriate location to > > >> >> enable > > >> >> it is the TCON driver, but moreover, the representation of the clock > > >> >> tree > > >> >> should be fixed such that the TCON takes the clock from the TCON TOP > > >> >> as > > >> >> its > > >> >> channel/ module clock instead. That way you don't need this patch, > > >> >> but > > >> >> you'd add another for all the clock rout
Re: [PATCH v12 3/5] dt-bindings: drm/bridge: Document sn65dsi86 bridge bindings
On 2018-06-22 06:42, Stephen Boyd wrote: Quoting Sandeep Panda (2018-06-21 05:32:07) diff --git a/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.txt b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.txt new file mode 100644 index ..c8b8f018356f --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/ti,sn65dsi86.txt @@ -0,0 +1,86 @@ +SN65DSI86 DSI to eDP bridge chip + + +This is the binding for Texas Instruments SN65DSI86 bridge. +http://www.ti.com/general/docs/lit/getliterature.tsp?genericPartNumber=sn65dsi86&fileType=pdf + +Required properties: +- compatible: Must be "ti,sn65dsi86" +- reg: i2c address of the chip, 0x2d as per datasheet +- enable-gpios: OF device-tree gpio specification for bridge_en pin (active high) + +- vccio-supply: A 1.8V supply that powers up the digital IOs. +- vpll-supply: A 1.8V supply that powers up the displayport PLL. +- vcca-supply: A 1.2V supply that powers up the analog circuits. +- vcc-supply: A 1.2V supply that powers up the digital core. + +Optional properties: +- interrupts-extended: Specifier for the SN65DSI86 interrupt line. + +- ddc-i2c-bus: phandle of the I2C controller used for DDC EDID probing + +- gpio-controller: Marks the device has a GPIO controller. +- #gpio-cells: Should be two. The first cell is the pin number and + the second cell is used to specify flags. + See ../../gpio/gpio.txt for more information. +- #pwm-cells : Should be one. See ../../pwm/pwm.txt for description of + the cell formats. + +- clock-names: should be "refclk" +- clocks: Specification for input reference clock. The reference + clock rate must be 12 MHz, 19.2 MHz, 26 MHz, 27 MHz or 38.4 MHz. + +- data-lanes: See ../../media/video-interface.txt +- lane-polarities: See ../../media/video-interface.txt We need another property for suspend-gpios function of GPIO1. I suppose for the other GPIOs we don't need anything like this because they're output functions only? GPIO4 can do PWM and I guess if pwm is used in DT from here then the driver can mux that out of gpio4 properly. I have no idea how the hsync and vsync GPIOs would work though. I see that GPIO3 can do DSIA hsync or vsync and GPIO2 can do DSIA vsync and I would guess those are in output mode only. Maybe that's just another property on this node to indicate if we should mux out the function or not. Usually that's done from pinctrl though. I don't have a use case for those functions but I do care about suspend gpios so at least add that one please. I was thinking of adding gpio1 (suspend-gpio) documentation when we add support for PSR feature. Since for PSR we will be using this suspoend-gpio. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v2 1/1] drm/panel: Add support for Olimex LCD-OLinuXino panel
This patch adds Olimex Ltd. LCD-OLinuXino bridge panel driver. The panel is used with different LCDs (currently from 480x272 to 1280x800). Small EEPROM chip is used for identification, which holds some factory data and timing requirements. Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Changed lcd_olinuxino_funcs to static const .../display/panel/olimex,lcd-olinuxino.txt | 42 +++ MAINTAINERS| 6 + drivers/gpu/drm/panel/Kconfig | 10 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c | 360 + 5 files changed, 419 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.txt create mode 100644 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c diff --git a/Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.txt b/Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.txt new file mode 100644 index 000..a89f9c8 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.txt @@ -0,0 +1,42 @@ +Binding for Olimex Ltd. LCD-OLinuXino bridge panel. + +This device can be used as bridge between a host controller and LCD panels. +Currently supported LCDs are: + - LCD-OLinuXino-4.3TS + - LCD-OLinuXino-5 + - LCD-OLinuXino-7 + - LCD-OLinuXino-10 + +The panel itself contains: + - AT24C16C EEPROM holding panel identification and timing requirements + - AR1021 resistive touch screen controller (optional) + - FT5x6 capacitive touch screnn controller (optional) + - GT911/GT928 capacitive touch screen controller (optional) + +The above chips share same I2C bus. The EEPROM is factory preprogrammed with +device information (id, serial, etc.) and timing requirements. + +Touchscreen bingings can be found in these files: + - input/touchscreen/goodix.txt + - input/touchscreen/edt-ft5x06.txt + - input/touchscreen/ar1021.txt + +Required properties: + - compatible: should be "olimex,lcd-olinuxino" + - reg: address of the configuration EEPROM, should be <0x50> + - power-supply: phandle of the regulator that provides the supply voltage + +Optional properties: + - enable-gpios: GPIO pin to enable or disable the panel + - backlight: phandle of the backlight device attacked to the panel + +Example: +&i2c2 { + panel@50 { + compatible = "olimex,lcd-olinuxino"; + reg = <0x50>; + power-supply = <®_vcc5v0>; + enable-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; + backlight = <&backlight>; + }; +}; diff --git a/MAINTAINERS b/MAINTAINERS index 624c3fd..30343f1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4557,6 +4557,12 @@ S: Supported F: drivers/gpu/drm/nouveau/ F: include/uapi/drm/nouveau_drm.h +DRM DRIVER FOR OLIMEX LCD-OLINUXINO PANELS +M: Stefan Mavrodiev +S: Maintained +F: drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c +F: Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.txt + DRM DRIVER FOR PERVASIVE DISPLAYS REPAPER PANELS M: Noralf Trønnes S: Maintained diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 25682ff..0292994 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -81,6 +81,16 @@ config DRM_PANEL_LG_LG4573 Say Y here if you want to enable support for LG4573 RGB panel. To compile this driver as a module, choose M here. +config DRM_PANEL_OLIMEX_LCD_OLINUXINO + tristate "Olimex LCD-OLinuXino panel" + depends on OF + depends on I2C + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for Olimex Ltd. + LCD-OLinuXino panel. The panel is used with different sizes LCDs, + from 480x272 to 1280x800, and 24 bit per pixel. + config DRM_PANEL_ORISETECH_OTM8009A tristate "Orise Technology otm8009a 480x800 dsi 2dl panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index f26efc1..185027f 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o +obj-$(CONFIG_DRM_PANEL_OLIMEX_LCD_OLINUXINO) += panel-olimex-lcd-olinuxino.o obj-$(CONFIG_DRM_PANEL_ORISETECH_OTM8009A) += panel-orisetech-otm8009a.o obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += panel-raspberrypi-touchscreen.o diff --git a/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c b/drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c new file mode 1
Re: [PATCH V3 5/7] backlight: qcom-wled: Add support for WLED4 peripheral
On 2018-06-23 04:39, Bjorn Andersson wrote: On Wed 20 Jun 04:00 PDT 2018, kgu...@codeaurora.org wrote: On 2018-06-20 10:44, Bjorn Andersson wrote: > On Tue 19 Jun 04:13 PDT 2018, Kiran Gunda wrote: > > > WLED4 peripheral is present on some PMICs like pmi8998 and > > pm660l. It has a different register map and configurations > > are also different. Add support for it. > > > > Signed-off-by: Kiran Gunda > > --- > > drivers/video/backlight/qcom-wled.c | 635 > > > > 1 file changed, 503 insertions(+), 132 deletions(-) > > Split this further into a patch that does structural preparation of > WLED3 support and then an addition of WLED4, the mixture makes parts of > this patch almost impossible to review. Please find some comments below. > Sure. I will split it in the next series. Thanks! > > > > diff --git a/drivers/video/backlight/qcom-wled.c > > b/drivers/video/backlight/qcom-wled.c > [..] > > > > /* WLED3 sink registers */ > > #define WLED3_SINK_REG_SYNC 0x47 > > Drop the 3 from this if it's common between the two. > > > -#define WLED3_SINK_REG_SYNC_MASK0x07 > > +#define WLED3_SINK_REG_SYNC_MASKGENMASK(2, 0) > > +#define WLED4_SINK_REG_SYNC_MASKGENMASK(3, 0) > > #define WLED3_SINK_REG_SYNC_LED1BIT(0) > > #define WLED3_SINK_REG_SYNC_LED2BIT(1) > > #define WLED3_SINK_REG_SYNC_LED3BIT(2) > > +#define WLED4_SINK_REG_SYNC_LED4BIT(3) > > #define WLED3_SINK_REG_SYNC_ALL 0x07 > > +#define WLED4_SINK_REG_SYNC_ALL 0x0f > > #define WLED3_SINK_REG_SYNC_CLEAR 0x00 > > > [..] > > +static int wled4_set_brightness(struct wled *wled, u16 brightness) > > Afaict this is identical to wled3_set_brightness() with the exception > that there's a minimum brightness and the base address for the > brightness registers are different. > > I would suggest that you add a min_brightness to wled and that you > figure out a way to carry the brightness base register address; and by > that you squash these two functions. > There are four different parameters. 1) minimum brightness 2) WLED base addresses 3) Brightness base addresses 4) the brightness sink registers address offsets also different for wled 3 and wled4. (in wled3 0x40, 0x42, 0x44, where as in wled4 0x57, 0x67, 0x77, 0x87). Sorry, I must have gotten lost in the defines, I see the difference between the two register layouts now. If you retain the old mechanism of doing the math openly in the function this would have been obvious. Irrelevant to this patch, but wled5 has some more extra registers to set the brightness. Keeping this in mind, it is better to have separate functions? Otherwise we will have to use the version checks in the wled_set_brightness function, if we have the common function. Okay, so it sounds reasonable to split this out to some degree. Regards, Bjorn -- Thanks for that ! To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/5] drm/amdgpu: add independent DMA-buf export v3
On Fri, Jun 22, 2018 at 03:39:25PM +0200, Christian König wrote: > Am 18.06.2018 um 10:28 schrieb Daniel Vetter: > > On Fri, Jun 01, 2018 at 02:00:20PM +0200, Christian König wrote: > > > The caching of SGT's done by the DRM code is actually quite harmful and > > > should probably removed altogether in the long term. > > Hm, why is it harmful? We've done it because it's expensive, and people > > started screaming about the overhead ... hence the caching. > > It's a bad idea because it artificially extends the lifetime of the mapping, > which is exactly what we want to avoid when we create the mappings > dynamically and only as long as necessary. > > And actually checking the mail history I could only find indicators that > people thought it would help. I haven't found any evidence that anybody > actually checked if that helps or not. Hm, I do have some memories of people being really upset about the constantly rewriting of IOMMU pagetables. This was for display-only drivers where forcing everyone to have their own private caching implementation is a bit silly. > > Doing an amdgpu copypasta seems like working around issues in shared code. > > Completely agree, but I don't want to push that policy to everybody just > yet. > > When we find that this is really the right direction I can convert Radeon as > well, move more component functionality logic into common code and when > that's done rip out this middle layer because it just becomes superfluous. I expect upset people if we remove the mapping caching. Maybe we should change it to not cache the mapping if the exporter has the dynamic unbinding stuff supported? Or maybe even when both exporter and importer have it supported. Wrt the midlayer: That's because nvidia blob + EXPORT_SYMBOL_GPL :-) Cheers, Daniel > > Christian. > > > -Daniel > > > > > Start by providing a separate DMA-buf export implementation in amdgpu. > > > This is > > > also a prerequisite of unpinned DMA-buf handling. > > > > > > v2: fix unintended recursion, remove debugging leftovers > > > v3: split out from unpinned DMA-buf work > > > > > > Signed-off-by: Christian König > > > --- > > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - > > > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 - > > > drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 73 > > > ++- > > > 3 files changed, 32 insertions(+), 43 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > > index 2d7500921c0b..93dc57d74fc2 100644 > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > > @@ -373,7 +373,6 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj, > > > void amdgpu_gem_object_close(struct drm_gem_object *obj, > > > struct drm_file *file_priv); > > > unsigned long amdgpu_gem_timeout(uint64_t timeout_ns); > > > -struct sg_table *amdgpu_gem_prime_get_sg_table(struct drm_gem_object > > > *obj); > > > struct drm_gem_object * > > > amdgpu_gem_prime_import_sg_table(struct drm_device *dev, > > >struct dma_buf_attachment *attach, > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > > index b0bf2f24da48..270b8ad927ea 100644 > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > > @@ -907,7 +907,6 @@ static struct drm_driver kms_driver = { > > > .gem_prime_export = amdgpu_gem_prime_export, > > > .gem_prime_import = amdgpu_gem_prime_import, > > > .gem_prime_res_obj = amdgpu_gem_prime_res_obj, > > > - .gem_prime_get_sg_table = amdgpu_gem_prime_get_sg_table, > > > .gem_prime_import_sg_table = amdgpu_gem_prime_import_sg_table, > > > .gem_prime_vmap = amdgpu_gem_prime_vmap, > > > .gem_prime_vunmap = amdgpu_gem_prime_vunmap, > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c > > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c > > > index a156b3891a3f..0c5a75b06648 100644 > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c > > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c > > > @@ -32,14 +32,6 @@ > > > static const struct dma_buf_ops amdgpu_dmabuf_ops; > > > -struct sg_table *amdgpu_gem_prime_get_sg_table(struct drm_gem_object > > > *obj) > > > -{ > > > - struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); > > > - int npages = bo->tbo.num_pages; > > > - > > > - return drm_prime_pages_to_sg(bo->tbo.ttm->pages, npages); > > > -} > > > - > > > void *amdgpu_gem_prime_vmap(struct drm_gem_object *obj) > > > { > > > struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); > > > @@ -132,23 +124,17 @@ amdgpu_gem_prime_import_sg_table(struct drm_device > > > *dev, > > > return ERR_PTR(ret); > > > } > > > -static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, > > > - struct dma_
Re: [PATCH v2] dma-buf/fence: Take refcount on the module that owns the fence
On Fri, Jun 22, 2018 at 11:08:48AM +0100, Chris Wilson wrote: > Quoting Gustavo Padovan (2018-06-22 11:04:16) > > Hi Akhil, > > > > On Fri, 2018-06-22 at 15:10 +0530, Akhil P Oommen wrote: > > > Each fence object holds function pointers of the module that > > > initialized > > > it. Allowing the module to unload before this fence's release is > > > catastrophic. So, keep a refcount on the module until the fence is > > > released. > > > > > > Signed-off-by: Akhil P Oommen > > > --- > > > Changes in v2: > > > - added description for the new function parameter. > > > > > > drivers/dma-buf/dma-fence.c | 16 +--- > > > include/linux/dma-fence.h | 10 -- > > > 2 files changed, 21 insertions(+), 5 deletions(-) > > > > > > diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma- > > > fence.c > > > index 4edb9fd..2aaa44e 100644 > > > --- a/drivers/dma-buf/dma-fence.c > > > +++ b/drivers/dma-buf/dma-fence.c > > > @@ -18,6 +18,7 @@ > > > * more details. > > > */ > > > > > > +#include > > > #include > > > #include > > > #include > > > @@ -168,6 +169,7 @@ void dma_fence_release(struct kref *kref) > > > { > > > struct dma_fence *fence = > > > container_of(kref, struct dma_fence, refcount); > > > + struct module *module = fence->owner; > > > > > > trace_dma_fence_destroy(fence); > > > > > > @@ -178,6 +180,8 @@ void dma_fence_release(struct kref *kref) > > > fence->ops->release(fence); > > > else > > > dma_fence_free(fence); > > > + > > > + module_put(module); > > > } > > > EXPORT_SYMBOL(dma_fence_release); > > > > > > @@ -541,6 +545,7 @@ struct default_wait_cb { > > > > > > /** > > > * dma_fence_init - Initialize a custom fence. > > > + * @module: [in]the module that calls this API > > > * @fence: [in]the fence to initialize > > > * @ops: [in]the dma_fence_ops for operations on this > > > fence > > > * @lock:[in]the irqsafe spinlock to use for locking > > > this fence > > > @@ -556,8 +561,9 @@ struct default_wait_cb { > > > * to check which fence is later by simply using dma_fence_later. > > > */ > > > void > > > -dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops > > > *ops, > > > -spinlock_t *lock, u64 context, unsigned seqno) > > > +_dma_fence_init(struct module *module, struct dma_fence *fence, > > > + const struct dma_fence_ops *ops, spinlock_t *lock, > > > + u64 context, unsigned seqno) > > > { > > > BUG_ON(!lock); > > > BUG_ON(!ops || !ops->wait || !ops->enable_signaling || > > > @@ -571,7 +577,11 @@ struct default_wait_cb { > > > fence->seqno = seqno; > > > fence->flags = 0UL; > > > fence->error = 0; > > > + fence->owner = module; > > > + > > > + if (!try_module_get(module)) > > > + fence->owner = NULL; > > > > > > trace_dma_fence_init(fence); > > > } > > > -EXPORT_SYMBOL(dma_fence_init); > > > +EXPORT_SYMBOL(_dma_fence_init); > > > > Do we still need to export the symbol, it won't be called from outside > > anymore? Other than that looks good to me: > > There's a big drawback in that a module reference is often insufficient, > and that a reference on the driver (or whatever is required for the > lifetime of the fence) will already hold the module reference. > > Considering that we want a few 100k fences in flight per second, is > there no other way to only export a fence with a module reference? We'd need to make the timeline a full-blown object (Maarten owes me one for that design screw-up), and then we could stuff all these things in there. And I think that's the right fix, since try_module_get for every dma_fence_init just ain't cool really :-) -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH] mm, oom: distinguish blockable mode for mmu notifiers
On Fri 22-06-18 16:09:06, Felix Kuehling wrote: > On 2018-06-22 11:24 AM, Michal Hocko wrote: > > On Fri 22-06-18 17:13:02, Christian König wrote: > >> Hi Michal, > >> > >> [Adding Felix as well] > >> > >> Well first of all you have a misconception why at least the AMD graphics > >> driver need to be able to sleep in an MMU notifier: We need to sleep > >> because > >> we need to wait for hardware operations to finish and *NOT* because we need > >> to wait for locks. > >> > >> I'm not sure if your flag now means that you generally can't sleep in MMU > >> notifiers any more, but if that's the case at least AMD hardware will break > >> badly. In our case the approach of waiting for a short time for the process > >> to be reaped and then select another victim actually sounds like the right > >> thing to do. > > Well, I do not need to make the notifier code non blocking all the time. > > All I need is to ensure that it won't sleep if the flag says so and > > return -EAGAIN instead. > > > > So here is what I do for amdgpu: > > In the case of KFD we also need to take the DQM lock: > > amdgpu_mn_invalidate_range_start_hsa -> amdgpu_amdkfd_evict_userptr -> > kgd2kfd_quiesce_mm -> kfd_process_evict_queues -> evict_process_queues_cpsch > > So we'd need to pass the blockable parameter all the way through that > call chain. Thanks, I have missed that part. So I guess I will start with something similar to intel-gfx and back off when the current range needs some treatment. So this on top. Does it look correct? diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c index d138a526feff..e2d422b3eb0b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c @@ -266,6 +266,11 @@ static int amdgpu_mn_invalidate_range_start_hsa(struct mmu_notifier *mn, struct amdgpu_mn_node *node; struct amdgpu_bo *bo; + if (!blockable) { + amdgpu_mn_read_unlock(); + return -EAGAIN; + } + node = container_of(it, struct amdgpu_mn_node, it); it = interval_tree_iter_next(it, start, end); -- Michal Hocko SUSE Labs ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] drm/etnaviv: Fix driver unregistering
Hi Fabio, On Sun, 2018-06-24 at 19:40 -0300, Fabio Estevam wrote: > From: Fabio Estevam > > Russell King reported: > > "When removing and reloading the etnaviv module, the following splat > occurs: > > sysfs: cannot create duplicate filename '/devices/platform/etnaviv' > CPU: 0 PID: 1471 Comm: modprobe Not tainted 4.17.0+ #1608 > Hardware name: Marvell Dove (Cubox) > Backtrace: > [] (dump_backtrace) from [] (show_stack+0x18/0x1c) > r6:ef033e38 r5:ee07b340 r4:edb9d000 r3: > [] (show_stack) from [] (dump_stack+0x20/0x28) > [] (dump_stack) from [] (sysfs_warn_dup+0x5c/0x70) > [] (sysfs_warn_dup) from [] > (sysfs_create_dir_ns+0x90/0x98) > ..." > > Commit 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem > DT node") introduced DRM registration via > platform_device_register_simple(), but missed to call > platform_device_unregister() inside etnaviv_exit(). > > Fix the problem by calling platform_device_unregister() inside > etnaviv_exit(). While at it, also rearrange the function calls > in the exit path to make them happen in the opposite order of > registration. > > Tested on a imx6-sabresd board. > > Cc: > Fixes: 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT > node") > Reported-by: Russell King > Signed-off-by: Fabio Estevam > --- > Changes since v1: > - Make the exit path symmetrical to the init path by calling > platform_device_unregister() inside for_each_compatible_node() > > drivers/gpu/drm/etnaviv/etnaviv_drv.c | 18 -- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c > b/drivers/gpu/drm/etnaviv/etnaviv_drv.c > index e5013a9..626ad8b 100644 > --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c > +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c > @@ -631,6 +631,8 @@ static struct platform_driver etnaviv_platform_driver = { > }, > }; > > +static struct platform_device *etnaviv_drm; > + > static int __init etnaviv_init(void) > { > int ret; > @@ -654,7 +656,8 @@ static int __init etnaviv_init(void) > if (!of_device_is_available(np)) > continue; > > - platform_device_register_simple("etnaviv", -1, NULL, 0); > + etnaviv_drm = platform_device_register_simple("etnaviv", -1, > + NULL, 0); If there are multiple vivante,gc device nodes, this overwrites etnaviv_drm with each additional device after the first one. Also, it would be better to store NULL instead of the error value. > of_node_put(np); > break; > } > @@ -665,8 +668,19 @@ module_init(etnaviv_init); > > static void __exit etnaviv_exit(void) > { > - platform_driver_unregister(&etnaviv_gpu_driver); > + struct device_node *np; > + > + for_each_compatible_node(np, NULL, "vivante,gc") { > + if (!of_device_is_available(np)) > + continue; > + > + platform_device_unregister(etnaviv_drm); If there are multiple vivante,gc nodes, this will try to unregister the last device multiple times. Also, this will break if the pointer contains an error value. > + of_node_put(np); > + break; > + } > + > platform_driver_unregister(&etnaviv_platform_driver); > + platform_driver_unregister(&etnaviv_gpu_driver); > } > module_exit(etnaviv_exit); > regards Philipp ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [linux-sunxi] Re: [PATCH v2 11/27] drm/sun4i: tcon: Add support for tcon-top gate
On Mon, Jun 25, 2018 at 3:58 PM, Jernej Škrabec wrote: > Dne ponedeljek, 25. junij 2018 ob 05:51:41 CEST je Chen-Yu Tsai napisal(a): >> On Mon, Jun 25, 2018 at 3:52 AM, Jernej Škrabec >> >> wrote: >> > Dne četrtek, 21. junij 2018 ob 17:35:45 CEST je Jernej Škrabec napisal(a): >> >> Dne četrtek, 21. junij 2018 ob 03:23:27 CEST je Chen-Yu Tsai napisal(a): >> >> > On Thu, Jun 21, 2018 at 3:37 AM, Jernej Škrabec >> >> > >> >> >> >> wrote: >> >> > > Dne sobota, 16. junij 2018 ob 07:48:38 CEST je Chen-Yu Tsai > napisal(a): >> >> > >> On Sat, Jun 16, 2018 at 1:33 AM, Jernej Škrabec >> >> > >> >> >> > > >> >> > > wrote: >> >> > >> > Dne petek, 15. junij 2018 ob 19:13:17 CEST je Chen-Yu Tsai >> > >> > napisal(a): >> >> > >> >> On Sat, Jun 16, 2018 at 12:41 AM, Jernej Škrabec >> >> > >> >> >> >> > >> >> wrote: >> >> > >> >> > Hi, >> >> > >> >> > >> >> > >> >> > Dne petek, 15. junij 2018 ob 10:31:10 CEST je Maxime Ripard >> >> >> >> napisal(a): >> >> > >> >> >> Hi, >> >> > >> >> >> >> >> > >> >> >> On Tue, Jun 12, 2018 at 10:00:20PM +0200, Jernej Skrabec > wrote: >> >> > >> >> >> > TV TCONs connected to TCON TOP have to enable additional >> >> > >> >> >> > gate >> >> > >> >> >> > in >> >> > >> >> >> > order >> >> > >> >> >> > to work. >> >> > >> >> >> > >> >> > >> >> >> > Add support for such TCONs. >> >> > >> >> >> > >> >> > >> >> >> > Signed-off-by: Jernej Skrabec >> >> > >> >> >> > --- >> >> > >> >> >> > >> >> > >> >> >> > drivers/gpu/drm/sun4i/sun4i_tcon.c | 11 +++ >> >> > >> >> >> > drivers/gpu/drm/sun4i/sun4i_tcon.h | 4 >> >> > >> >> >> > 2 files changed, 15 insertions(+) >> >> > >> >> >> > >> >> > >> >> >> > diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c >> >> > >> >> >> > b/drivers/gpu/drm/sun4i/sun4i_tcon.c index >> >> > >> >> >> > 08747fc3ee71..0afb5a94a414 >> >> > >> >> >> > 100644 >> >> > >> >> >> > --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c >> >> > >> >> >> > +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c >> >> > >> >> >> > @@ -688,6 +688,16 @@ static int >> >> > >> >> >> > sun4i_tcon_init_clocks(struct >> >> > >> >> >> > device >> >> > >> >> >> > *dev, >> >> > >> >> >> > >> >> > >> >> >> > dev_err(dev, "Couldn't get the TCON bus >> >> > >> >> >> > clock\n"); >> >> > >> >> >> > return PTR_ERR(tcon->clk); >> >> > >> >> >> > >> >> > >> >> >> > } >> >> > >> >> >> > >> >> > >> >> >> > + >> >> > >> >> >> > + if (tcon->quirks->has_tcon_top_gate) { >> >> > >> >> >> > + tcon->top_clk = devm_clk_get(dev, "tcon-top"); >> >> > >> >> >> > + if (IS_ERR(tcon->top_clk)) { >> >> > >> >> >> > + dev_err(dev, "Couldn't get the TCON TOP >> >> > >> >> >> > bus >> >> > >> >> >> > clock\n"); >> >> > >> >> >> > + return PTR_ERR(tcon->top_clk); >> >> > >> >> >> > + } >> >> > >> >> >> > + clk_prepare_enable(tcon->top_clk); >> >> > >> >> >> > + } >> >> > >> >> >> > + >> >> > >> >> >> >> >> > >> >> >> Is it required for the TCON itself to operate, or does the >> >> > >> >> >> TCON >> >> > >> >> >> requires the TCON TOP, which in turn requires that clock to be >> >> > >> >> >> functional? >> >> > >> >> >> >> >> > >> >> >> I find it quite odd to have a clock that isn't meant for a >> >> > >> >> >> particular >> >> > >> >> >> device to actually be wired to another device. I'm not saying >> >> > >> >> >> this >> >> > >> >> >> isn't the case, but it would be a first. >> >> > >> >> > >> >> > >> >> > Documentation doesn't say much about that gate. I did few tests >> >> > >> >> > and >> >> > >> >> > TCON >> >> > >> >> > registers can be read and written even if TCON TOP TV TCON gate >> >> > >> >> > is >> >> > >> >> > disabled. However, there is no image, as expected. >> >> > >> >> >> >> > >> >> The R40 manual does include it in the diagram, on page 504. >> >> > >> >> There's >> >> > >> >> also >> >> > >> >> a >> >> > >> >> mux to select whether the clock comes directly from the CCU or >> >> > >> >> the >> >> > >> >> TV >> >> > >> >> encoder (a feedback mode?). I assume this is the gate you are >> >> > >> >> referring >> >> > >> >> to >> >> > >> >> here, in which case it is not a bus clock, but rather the TCON >> >> > >> >> module >> >> > >> >> or >> >> > >> >> channel clock, strangely routed. >> >> > >> >> >> >> > >> >> > More interestingly, I enabled test pattern directly in TCON to >> >> > >> >> > eliminate >> >> > >> >> > influence of the mixer. As soon as I disabled that gate, test >> >> > >> >> > pattern >> >> > >> >> > on >> >> > >> >> > HDMI screen was gone, which suggest that this gate influences >> >> > >> >> > something >> >> > >> >> > inside TCON. >> >> > >> >> > >> >> > >> >> > Another test I did was that I moved enable/disable gate code to >> >> > >> >> > sun4i_tcon_channel_set_status() and it worked just as well. >> >> > >> >> > >> >> > >> >> > I'll ask AW engineer what that gate actually does, but from >> >> > >> >> > what I >> >> > >> >> > saw, >> >> > >> >> > I >> >> > >> >> > would say th
Re: [PATCH 1/4] dma-buf: add dma_buf_(un)map_attachment_locked variants v2
On Fri, Jun 22, 2018 at 04:11:00PM +0200, Christian König wrote: > Add function variants which can be called with the reservation lock > already held. > > v2: reordered, add lockdep asserts, fix kerneldoc > > Signed-off-by: Christian König > --- > drivers/dma-buf/dma-buf.c | 57 > +++ > include/linux/dma-buf.h | 5 + > 2 files changed, 62 insertions(+) > > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > index 852a3928ee71..dc94e76e2e2a 100644 > --- a/drivers/dma-buf/dma-buf.c > +++ b/drivers/dma-buf/dma-buf.c > @@ -606,6 +606,40 @@ void dma_buf_detach(struct dma_buf *dmabuf, struct > dma_buf_attachment *attach) > } > EXPORT_SYMBOL_GPL(dma_buf_detach); > > +/** > + * dma_buf_map_attachment_locked - Maps the buffer into _device_ address > space > + * with the reservation lock held. Is a wrapper for map_dma_buf() of the > + * This here looks mangled (and the blank line wreaks the resulting html). With that fixed. Reviewed-by: Daniel Vetter > + * Returns the scatterlist table of the attachment; > + * dma_buf_ops. > + * @attach: [in]attachment whose scatterlist is to be returned > + * @direction: [in]direction of DMA transfer > + * > + * Returns sg_table containing the scatterlist to be returned; returns > ERR_PTR > + * on error. May return -EINTR if it is interrupted by a signal. > + * > + * A mapping must be unmapped by using dma_buf_unmap_attachment_locked(). > Note > + * that the underlying backing storage is pinned for as long as a mapping > + * exists, therefore users/importers should not hold onto a mapping for undue > + * amounts of time. > + */ > +struct sg_table * > +dma_buf_map_attachment_locked(struct dma_buf_attachment *attach, > + enum dma_data_direction direction) > +{ > + struct sg_table *sg_table; > + > + might_sleep(); > + reservation_object_assert_held(attach->dmabuf->resv); > + > + sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction); > + if (!sg_table) > + sg_table = ERR_PTR(-ENOMEM); > + > + return sg_table; > +} > +EXPORT_SYMBOL_GPL(dma_buf_map_attachment_locked); > + > /** > * dma_buf_map_attachment - Returns the scatterlist table of the attachment; > * mapped into _device_ address space. Is a wrapper for map_dma_buf() of the > @@ -639,6 +673,29 @@ struct sg_table *dma_buf_map_attachment(struct > dma_buf_attachment *attach, > } > EXPORT_SYMBOL_GPL(dma_buf_map_attachment); > > +/** > + * dma_buf_unmap_attachment_locked - unmaps the buffer with reservation lock > + * held, should deallocate the associated scatterlist. Is a wrapper for > + * unmap_dma_buf() of dma_buf_ops. > + * @attach: [in]attachment to unmap buffer from > + * @sg_table:[in]scatterlist info of the buffer to unmap > + * @direction: [in]direction of DMA transfer > + * > + * This unmaps a DMA mapping for @attached obtained by > + * dma_buf_map_attachment_locked(). > + */ > +void dma_buf_unmap_attachment_locked(struct dma_buf_attachment *attach, > + struct sg_table *sg_table, > + enum dma_data_direction direction) > +{ > + might_sleep(); > + reservation_object_assert_held(attach->dmabuf->resv); > + > + attach->dmabuf->ops->unmap_dma_buf(attach, sg_table, > + direction); > +} > +EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment_locked); > + > /** > * dma_buf_unmap_attachment - unmaps and decreases usecount of the > buffer;might > * deallocate the scatterlist associated. Is a wrapper for unmap_dma_buf() of > diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h > index 991787a03199..a25e754ae2f7 100644 > --- a/include/linux/dma-buf.h > +++ b/include/linux/dma-buf.h > @@ -384,8 +384,13 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags); > struct dma_buf *dma_buf_get(int fd); > void dma_buf_put(struct dma_buf *dmabuf); > > +struct sg_table *dma_buf_map_attachment_locked(struct dma_buf_attachment *, > +enum dma_data_direction); > struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *, > enum dma_data_direction); > +void dma_buf_unmap_attachment_locked(struct dma_buf_attachment *, > + struct sg_table *, > + enum dma_data_direction); > void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *, > enum dma_data_direction); > int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, > -- > 2.14.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/4] dma-buf: lock the reservation object during (un)map_dma_buf v2
On Fri, Jun 22, 2018 at 04:11:01PM +0200, Christian König wrote: > First step towards unpinned DMA buf operation. > > I've checked the DRM drivers to potential locking of the reservation > object, but essentially we need to audit all implementations of the > dma_buf _ops for this to work. > > v2: reordered > > Signed-off-by: Christian König Reviewed-by: Daniel Vetter > --- > drivers/dma-buf/dma-buf.c | 9 ++--- > include/linux/dma-buf.h | 4 > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > index dc94e76e2e2a..49f23b791eb8 100644 > --- a/drivers/dma-buf/dma-buf.c > +++ b/drivers/dma-buf/dma-buf.c > @@ -665,7 +665,9 @@ struct sg_table *dma_buf_map_attachment(struct > dma_buf_attachment *attach, > if (WARN_ON(!attach || !attach->dmabuf)) > return ERR_PTR(-EINVAL); > > - sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction); > + reservation_object_lock(attach->dmabuf->resv, NULL); > + sg_table = dma_buf_map_attachment_locked(attach, direction); > + reservation_object_unlock(attach->dmabuf->resv); > if (!sg_table) > sg_table = ERR_PTR(-ENOMEM); > > @@ -715,8 +717,9 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment > *attach, > if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) > return; > > - attach->dmabuf->ops->unmap_dma_buf(attach, sg_table, > - direction); > + reservation_object_lock(attach->dmabuf->resv, NULL); > + dma_buf_unmap_attachment_locked(attach, sg_table, direction); > + reservation_object_unlock(attach->dmabuf->resv); > } > EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment); > > diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h > index a25e754ae2f7..024658d1f22e 100644 > --- a/include/linux/dma-buf.h > +++ b/include/linux/dma-buf.h > @@ -118,6 +118,8 @@ struct dma_buf_ops { >* any other kind of sharing that the exporter might wish to make >* available to buffer-users. >* > + * This is called with the dmabuf->resv object locked. > + * >* Returns: >* >* A &sg_table scatter list of or the backing storage of the DMA buffer, > @@ -138,6 +140,8 @@ struct dma_buf_ops { >* It should also unpin the backing storage if this is the last mapping >* of the DMA buffer, it the exporter supports backing storage >* migration. > + * > + * This is called with the dmabuf->resv object locked. >*/ > void (*unmap_dma_buf)(struct dma_buf_attachment *, > struct sg_table *, > -- > 2.14.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v7 00/29] Add support for mediatek SOC MT2712
On Wed, Jun 20, 2018 at 04:19:02PM +0800, Stu Hsieh wrote: > This patch add support for the Mediatek MT2712 DISP subsystem. > MT2712 is base on MT8173, there are some difference as following: > MT2712 support three disp output(two ovl and one rdma) > > Change in v6: > - Update commit message for the patch > "drm/mediatek: Update the definition of connection from RDMA1 to DPI0" Just a drive-by comment on the mediatek driver: As far as I can see mtk_drm_gem.c reimplements the cma helpers as a copypaste job. Any reasons why you're not using the normal cma helpers? Thanks, Daniel > > Stu Hsieh (29): > drm/mediatek: update dt-bindings for mt2712 > drm/mediatek: support maximum 64 mutex mod > drm/mediatek: add ddp component AAL1 > drm/mediatek: add ddp component OD1 > drm/mediatek: add ddp component PWM1 > drm/mediatek: add ddp component PWM2 > drm/mediatek: add component DPI1 > drm/mediatek: add component DSI2 > drm/mediatek: add component DSI3 > drm/mediatek: add the DSI1 for component init condition > drm/mediatek: add connection from OD1 to RDMA1 > drm/mediatek: Update the definition of connection from RDMA1 to DPI0 > drm/mediatek: add connection from RDMA0 to DPI0 > drm/mediatek: add connection from RDMA0 to DSI2 > drm/mediatek: add connection from RDMA0 to DSI3 > drm/mediatek: add connection from RDMA1 to DPI1 > drm/mediatek: add connection from RDMA1 to DSI1 > drm/mediatek: add connection from RDMA1 to DSI2 > drm/mediatek: add connection from RDMA1 to DSI3 > drm/mediatek: add connection from RDMA2 to DPI0 > drm/mediatek: add connection from RDMA2 to DPI1 > drm/mediatek: add connection from RDMA2 to DSI1 > drm/mediatek: add connection from RDMA2 to DSI2 > drm/mediatek: add connection from RDMA2 to DSI3 > drm/mediatek: add DPI1 support for mutex > drm/mediatek: add DSI2 support for mutex > drm/mediatek: add DSI3 support for mutex > drm/mediatek: add third ddp path > drm/mediatek: Add support for mediatek SOC MT2712 > > .../bindings/display/mediatek/mediatek,disp.txt| 2 +- > drivers/gpu/drm/mediatek/mtk_drm_crtc.c| 3 + > drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 235 > ++--- > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c| 15 +- > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h| 10 +- > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 47 - > drivers/gpu/drm/mediatek/mtk_drm_drv.h | 5 +- > 7 files changed, 274 insertions(+), 43 deletions(-) > > -- > 2.12.5 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 0/9] Exynos DRM IPP fixes
Hi Marek, 2018년 06월 07일 20:06에 Marek Szyprowski 이(가) 쓴 글: > Dear all, > > This patchset is a result of running various tests of Exynos DRM IPP > modules. It turned out that some drivers incorrectly interpreted > real buffer width (calculated from buffer pitch), had swapped horizontal > and vertial flips or used incorrect variant of the YUV modes. This > patchset fixes those issues. This patchset had been reviewed and verified already on review.tizen.org so merged to exynos-drm-fixes. Thanks, Inki Dae > > Best regards > Marek Szyprowski > Samsung R&D Institute Poland > > Andrzej Pietrasiewicz (1): > drm/exynos: scaler: Reset hardware before starting the operation > > Marek Szyprowski (8): > drm/exynos: ipp: Rework checking for the correct buffer formats > drm/exynos: rotator: Fix DRM_MODE_REFLECT_{X,Y} interpretation > drm/exynos: scaler: Fix support for YUV420, YUV422 and YUV444 modes > drm/exynos: gsc: Use real buffer width for configuring the hardware > drm/exynos: gsc: Increase Exynos5433 buffer width alignment to 16 > pixels > drm/exynos: gsc: Fix DRM_MODE_REFLECT_{X,Y} interpretation > drm/exynos: gsc: Fix support for NV16/61, YUV420/YVU420 and YUV422 > modes > drm/exynos: fimc: Use real buffer width for configuring the hardware > > drivers/gpu/drm/exynos/exynos_drm_fimc.c| 17 +-- > drivers/gpu/drm/exynos/exynos_drm_gsc.c | 51 + > drivers/gpu/drm/exynos/exynos_drm_ipp.c | 108 +++- > drivers/gpu/drm/exynos/exynos_drm_rotator.c | 4 +- > drivers/gpu/drm/exynos/exynos_drm_scaler.c | 44 ++-- > drivers/gpu/drm/exynos/regs-gsc.h | 1 + > 6 files changed, 136 insertions(+), 89 deletions(-) > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/4] dma-buf: lock the reservation object during (un)map_dma_buf v2
On Mon, Jun 25, 2018 at 10:22:31AM +0200, Daniel Vetter wrote: > On Fri, Jun 22, 2018 at 04:11:01PM +0200, Christian König wrote: > > First step towards unpinned DMA buf operation. > > > > I've checked the DRM drivers to potential locking of the reservation > > object, but essentially we need to audit all implementations of the > > dma_buf _ops for this to work. > > > > v2: reordered > > > > Signed-off-by: Christian König > > Reviewed-by: Daniel Vetter Ok I did review drivers a bit, but apparently not well enough by far. i915 CI is unhappy: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9400/fi-whl-u/igt@gem_mmap_...@basic-small-bo-tiledx.html So yeah inserting that lock in there isn't the most trivial thing :-/ I kinda assume that other drivers will have similar issues, e.g. omapdrm's use of dev->struct_mutex also very much looks like it'll result in a new locking inversion. -Daniel > > > --- > > drivers/dma-buf/dma-buf.c | 9 ++--- > > include/linux/dma-buf.h | 4 > > 2 files changed, 10 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c > > index dc94e76e2e2a..49f23b791eb8 100644 > > --- a/drivers/dma-buf/dma-buf.c > > +++ b/drivers/dma-buf/dma-buf.c > > @@ -665,7 +665,9 @@ struct sg_table *dma_buf_map_attachment(struct > > dma_buf_attachment *attach, > > if (WARN_ON(!attach || !attach->dmabuf)) > > return ERR_PTR(-EINVAL); > > > > - sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction); > > + reservation_object_lock(attach->dmabuf->resv, NULL); > > + sg_table = dma_buf_map_attachment_locked(attach, direction); > > + reservation_object_unlock(attach->dmabuf->resv); > > if (!sg_table) > > sg_table = ERR_PTR(-ENOMEM); > > > > @@ -715,8 +717,9 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment > > *attach, > > if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) > > return; > > > > - attach->dmabuf->ops->unmap_dma_buf(attach, sg_table, > > - direction); > > + reservation_object_lock(attach->dmabuf->resv, NULL); > > + dma_buf_unmap_attachment_locked(attach, sg_table, direction); > > + reservation_object_unlock(attach->dmabuf->resv); > > } > > EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment); > > > > diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h > > index a25e754ae2f7..024658d1f22e 100644 > > --- a/include/linux/dma-buf.h > > +++ b/include/linux/dma-buf.h > > @@ -118,6 +118,8 @@ struct dma_buf_ops { > > * any other kind of sharing that the exporter might wish to make > > * available to buffer-users. > > * > > +* This is called with the dmabuf->resv object locked. > > +* > > * Returns: > > * > > * A &sg_table scatter list of or the backing storage of the DMA buffer, > > @@ -138,6 +140,8 @@ struct dma_buf_ops { > > * It should also unpin the backing storage if this is the last mapping > > * of the DMA buffer, it the exporter supports backing storage > > * migration. > > +* > > +* This is called with the dmabuf->resv object locked. > > */ > > void (*unmap_dma_buf)(struct dma_buf_attachment *, > > struct sg_table *, > > -- > > 2.14.1 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 107012] [PATCH] Radeon SI driver not architecture safe, crashes on ppc64[el]
https://bugs.freedesktop.org/show_bug.cgi?id=107012 --- Comment #6 from Michel Dänzer --- Please send patches like this directly to the mesa-dev mailing list for review. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 10/14] drm/i915: Populate possible_crtcs correctly
On Thu, Jun 21, 2018 at 06:26:04PM -0700, Dhinakaran Pandiyan wrote: > On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote: > > From: Ville Syrjälä > > > > Don't advertize non-exisiting crtcs in the encoder possible_crtcs > > bitmask. > > > How do we end up advertising non-existing CRTCs? encoder->crtc_mask > seems to be populated in the encoder init functions based on possible > pipes. Do you mean pipe and crtc->index can potentially differ? No. Just that we may sometimes set BIT(PIPE_C) in crtc_mask when there are only two pipes on the device. > > > > Signed-off-by: Ville Syrjälä > > --- > > drivers/gpu/drm/i915/intel_display.c | 17 - > > 1 file changed, 16 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_display.c > > b/drivers/gpu/drm/i915/intel_display.c > > index b095899d68a9..3fa9da714403 100644 > > --- a/drivers/gpu/drm/i915/intel_display.c > > +++ b/drivers/gpu/drm/i915/intel_display.c > > @@ -13959,6 +13959,20 @@ static int intel_encoder_clones(struct > > intel_encoder *encoder) > > return index_mask; > > } > > > > +static int intel_encoder_crtcs(struct intel_encoder *encoder) > > +{ > > + struct drm_device *dev = encoder->base.dev; > > + struct intel_crtc *crtc; > > + int index_mask = 0; > > + > > + for_each_intel_crtc(dev, crtc) { > > + if (encoder->crtc_mask & BIT(crtc->pipe)) > > + index_mask |= drm_crtc_mask(&crtc->base); > > + } > > + > > + return index_mask; > > +} > > + > > static bool has_edp_a(struct drm_i915_private *dev_priv) > > { > > if (!IS_MOBILE(dev_priv)) > > @@ -14211,7 +14225,8 @@ static void intel_setup_outputs(struct > > drm_i915_private *dev_priv) > > intel_psr_init(dev_priv); > > > > for_each_intel_encoder(&dev_priv->drm, encoder) { > > - encoder->base.possible_crtcs = encoder->crtc_mask; > > + encoder->base.possible_crtcs = > > + intel_encoder_crtcs(encoder); > > encoder->base.possible_clones = > > intel_encoder_clones(encoder); > > } -- Ville Syrjälä Intel ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 03/24] clk: sunxi-ng: r40: Export video PLLs
On Mon, Jun 25, 2018 at 8:02 PM, Jernej Skrabec wrote: > Video PLLs need to be referenced in R40 DT as possible HDMI PHY parent. > > Export them. > > Reviewed-by: Rob Herring > Signed-off-by: Jernej Skrabec Reviewed-by: Chen-Yu Tsai ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 102372] [dc] [kabini] Errors during startup - X doesn't start
https://bugs.freedesktop.org/show_bug.cgi?id=102372 --- Comment #14 from Alex Deucher --- (In reply to Lyude Paul from comment #13) > Poke: this should be reverted, as mentioned in IRC enabling DC has > unfortunately broken the displays on this TONGA GPU as well. GPU info: > > [AMD/ATI] Tonga PRO [Radeon R9 285/380] [1002:6939] (rev f1) Tonga is a different generation of display hardware so is unrelated to this. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH] mm, oom: distinguish blockable mode for mmu notifiers
On Mon 25-06-18 10:01:03, Michal Hocko wrote: > On Fri 22-06-18 16:09:06, Felix Kuehling wrote: > > On 2018-06-22 11:24 AM, Michal Hocko wrote: > > > On Fri 22-06-18 17:13:02, Christian König wrote: > > >> Hi Michal, > > >> > > >> [Adding Felix as well] > > >> > > >> Well first of all you have a misconception why at least the AMD graphics > > >> driver need to be able to sleep in an MMU notifier: We need to sleep > > >> because > > >> we need to wait for hardware operations to finish and *NOT* because we > > >> need > > >> to wait for locks. > > >> > > >> I'm not sure if your flag now means that you generally can't sleep in MMU > > >> notifiers any more, but if that's the case at least AMD hardware will > > >> break > > >> badly. In our case the approach of waiting for a short time for the > > >> process > > >> to be reaped and then select another victim actually sounds like the > > >> right > > >> thing to do. > > > Well, I do not need to make the notifier code non blocking all the time. > > > All I need is to ensure that it won't sleep if the flag says so and > > > return -EAGAIN instead. > > > > > > So here is what I do for amdgpu: > > > > In the case of KFD we also need to take the DQM lock: > > > > amdgpu_mn_invalidate_range_start_hsa -> amdgpu_amdkfd_evict_userptr -> > > kgd2kfd_quiesce_mm -> kfd_process_evict_queues -> evict_process_queues_cpsch > > > > So we'd need to pass the blockable parameter all the way through that > > call chain. > > Thanks, I have missed that part. So I guess I will start with something > similar to intel-gfx and back off when the current range needs some > treatment. So this on top. Does it look correct? > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c > index d138a526feff..e2d422b3eb0b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c > @@ -266,6 +266,11 @@ static int amdgpu_mn_invalidate_range_start_hsa(struct > mmu_notifier *mn, > struct amdgpu_mn_node *node; > struct amdgpu_bo *bo; > > + if (!blockable) { > + amdgpu_mn_read_unlock(); > + return -EAGAIN; > + } > + > node = container_of(it, struct amdgpu_mn_node, it); > it = interval_tree_iter_next(it, start, end); Ble, just noticed that half of the change didn't get to git index... This is what I have commit c4701b36ac2802b903db3d05cf77c030fccce3a8 Author: Michal Hocko Date: Mon Jun 25 15:24:03 2018 +0200 fold me - amd gpu notifiers can sleep deeper in the callchain (evict_process_queues_cpsch on a lock and amdgpu_mn_invalidate_node on unbound timeout) make sure we bail out when we have an intersecting range for starter diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c index d138a526feff..3399a4a927fb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c @@ -225,6 +225,11 @@ static int amdgpu_mn_invalidate_range_start_gfx(struct mmu_notifier *mn, while (it) { struct amdgpu_mn_node *node; + if (!blockable) { + amdgpu_mn_read_unlock(rmn); + return -EAGAIN; + } + node = container_of(it, struct amdgpu_mn_node, it); it = interval_tree_iter_next(it, start, end); @@ -266,6 +271,11 @@ static int amdgpu_mn_invalidate_range_start_hsa(struct mmu_notifier *mn, struct amdgpu_mn_node *node; struct amdgpu_bo *bo; + if (!blockable) { + amdgpu_mn_read_unlock(rmn); + return -EAGAIN; + } + node = container_of(it, struct amdgpu_mn_node, it); it = interval_tree_iter_next(it, start, end); -- Michal Hocko SUSE Labs ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/msm/dsi: initialize postdiv_lock before use for 10nm pll
postdiv_lock spinlock was used before initialization for 10nm pll. It causes following spin_bug: "BUG: spinlock bad magic on CPU#0". Initialize spinlock before its usage. Signed-off-by: Rajesh Yadav --- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c index dbf601f..6c3ed1b 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c @@ -798,6 +798,8 @@ struct msm_dsi_pll *msm_dsi_pll_10nm_init(struct platform_device *pdev, int id) return ERR_PTR(-ENOMEM); } + spin_lock_init(&pll_10nm->postdiv_lock); + pll = &pll_10nm->base; pll->min_rate = 10UL; pll->max_rate = 35UL; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 00/12] drm: Add generic fbdev emulation
Den 18.06.2018 16.17, skrev Noralf Trønnes: This patchset adds generic fbdev emulation for drivers that supports GEM based dumb buffers which support .gem_prime_vmap and gem_prime_mmap. An API is begun to support in-kernel clients in general. Notable changes since version 1: - Rework client unregister code. I've used reference counting to manage the fact that both the client itself and the driver through drm_dev_unregister() can release the client. The client is now released using drm_client_put() instead of drm_client_free(). - fbdev: Use a shadow buffer for framebuffers that have a dirty callback. This makes the fbdev client truly generic and useable for all drivers. There's a blitting penalty, but this is generic emulation after all. The reason for needing a shadow buffer is that deferred I/O only works with kmalloc/vmalloc buffers and not with shmem buffers (page->lru/mapping). - Let tinydrm use the full fbdev client Noralf. Changes since version 1: - Make it possible to embed struct drm_client_dev and drop the private pointer - Use kref reference counting to control client release since both the client and the driver can release. - Add comment about using dma-buf as a possibility with some rework - Move buffer NULL check to drm_client_framebuffer_delete() - Move client name to struct drm_client_dev - Move up drm_dev_get/put calls to make them more visible - Move drm_client_dev.list definition to later patch that makes use of it - Embed drm_client at the beginning of drm_fb_helper to avoid a fragile transitional kfree hack in drm_client_release() - Set owner in drm_fbdev_fb_ops - Add kerneldoc to drm_fb_helper_generic_probe() - Remove unused functions - Change name drm_client_funcs.lastclose -> .restore - Change name drm_client_funcs.remove -> .unregister - Rework unregister code - tinydrm: Use drm_fbdev_generic_setup() and remove drm_fb_cma_fbdev_init_with_funcs() David Herrmann (1): drm: provide management functions for drm_file Noralf Trønnes (11): drm/file: Don't set master on in-kernel clients drm: Make ioctls available for in-kernel clients Patches 1-3 applied to drm-misc-next. Thanks for reviewing! Noralf. drm: Begin an API for in-kernel clients drm/fb-helper: Add generic fbdev emulation .fb_probe function drm/pl111: Set .gem_prime_vmap and .gem_prime_mmap drm/cma-helper: Use the generic fbdev emulation drm/client: Add client callbacks drm/debugfs: Add internal client debugfs file drm/fb-helper: Finish the generic fbdev emulation drm/tinydrm: Use drm_fbdev_generic_setup() drm/cma-helper: Remove drm_fb_cma_fbdev_init_with_funcs() Documentation/gpu/drm-client.rst| 12 + Documentation/gpu/index.rst | 1 + drivers/gpu/drm/Makefile| 2 +- drivers/gpu/drm/drm_client.c| 435 drivers/gpu/drm/drm_crtc_internal.h | 19 +- drivers/gpu/drm/drm_debugfs.c | 7 + drivers/gpu/drm/drm_drv.c | 8 + drivers/gpu/drm/drm_dumb_buffers.c | 33 ++- drivers/gpu/drm/drm_fb_cma_helper.c | 380 +++- drivers/gpu/drm/drm_fb_helper.c | 330 - drivers/gpu/drm/drm_file.c | 304 ++- drivers/gpu/drm/drm_framebuffer.c | 42 ++- drivers/gpu/drm/drm_internal.h | 2 + drivers/gpu/drm/drm_ioctl.c | 4 +- drivers/gpu/drm/drm_probe_helper.c | 3 + drivers/gpu/drm/pl111/pl111_drv.c | 2 + drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 3 +- drivers/gpu/drm/tinydrm/ili9225.c | 1 - drivers/gpu/drm/tinydrm/mi0283qt.c | 1 - drivers/gpu/drm/tinydrm/st7586.c| 1 - drivers/gpu/drm/tinydrm/st7735r.c | 1 - include/drm/drm_client.h| 156 ++ include/drm/drm_device.h| 21 ++ include/drm/drm_fb_cma_helper.h | 6 - include/drm/drm_fb_helper.h | 38 +++ 25 files changed, 1298 insertions(+), 514 deletions(-) create mode 100644 Documentation/gpu/drm-client.rst create mode 100644 drivers/gpu/drm/drm_client.c create mode 100644 include/drm/drm_client.h ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 199749] amdgpu on Ryzen 2400G freeze randomly
https://bugzilla.kernel.org/show_bug.cgi?id=199749 --- Comment #16 from Andrey Grodzovsky (andrey.grodzov...@amd.com) --- What kernel version are you using ? We can try and figure out what was the last commands in HW before you experienced the page fault. You can clone and install our register analyzer from here - https://cgit.freedesktop.org/amd/umr/ Then launch your X with ENV variable GALLIUM_DDEBUG=always to dump all the 3D commands into files in ~/ddebug_dumps/ Run your workload. After you again experience the GPU page fault please provide the following outputs sudo umr -lb sudo umr -O verbose,follow_ib -R gfx[.] sudo umr -O bits -wa sudo umr -O many,bits -r*.*.mmGRBM_STATUS sudo umr -O many,bits -r *.*.HEADER_DUMP sudo umr -O many,bits -r *.*.CP_EOP -- You are receiving this mail because: You are watching the assignee of the bug. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v12 3/5] dt-bindings: drm/bridge: Document sn65dsi86 bridge bindings
On Mon, Jun 25, 2018 at 12:06:49AM -0700, Stephen Boyd wrote: > Quoting spa...@codeaurora.org (2018-06-24 21:56:05) > > On 2018-06-22 06:42, Stephen Boyd wrote: > > > Quoting Sandeep Panda (2018-06-21 05:32:07) > > >> + clock rate must be 12 MHz, 19.2 MHz, 26 MHz, 27 MHz or 38.4 > > >> MHz. > > >> + > > >> +- data-lanes: See ../../media/video-interface.txt > > >> +- lane-polarities: See ../../media/video-interface.txt > > > > > > We need another property for suspend-gpios function of GPIO1. I suppose > > > for the other GPIOs we don't need anything like this because they're > > > output functions only? GPIO4 can do PWM and I guess if pwm is used in > > > DT > > > from here then the driver can mux that out of gpio4 properly. I have no > > > idea how the hsync and vsync GPIOs would work though. I see that GPIO3 > > > can do DSIA hsync or vsync and GPIO2 can do DSIA vsync and I would > > > guess > > > those are in output mode only. Maybe that's just another property on > > > this node to indicate if we should mux out the function or not. Usually > > > that's done from pinctrl though. I don't have a use case for those > > > functions but I do care about suspend gpios so at least add that one > > > please. > > > > I was thinking of adding gpio1 (suspend-gpio) documentation when we add > > support for PSR feature. Since for PSR we will be using this > > suspoend-gpio. > > > > Ok sure, but I don't see any harm in adding it now. I'm fine with > waiting for the binding update when the PSR patches come if you feel > like adding it now will delay something. Please make the binding complete as possible now. Rob ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/gma500: Replace drm_gem_object_unreference_unlocked with put function
This patch unifies the naming of DRM functions for reference counting of struct drm_gem_object. The resulting code is more aligned with the rest of the Linux kernel interfaces. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/gma500/framebuffer.c | 2 +- drivers/gpu/drm/gma500/gem.c | 2 +- drivers/gpu/drm/gma500/gma_display.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c index 8fa4ef192c1e..2f00a37684a2 100644 --- a/drivers/gpu/drm/gma500/framebuffer.c +++ b/drivers/gpu/drm/gma500/framebuffer.c @@ -517,7 +517,7 @@ static int psb_fbdev_destroy(struct drm_device *dev, struct psb_fbdev *fbdev) drm_framebuffer_cleanup(&psbfb->base); if (psbfb->base.obj[0]) - drm_gem_object_unreference_unlocked(psbfb->base.obj[0]); + drm_gem_object_put_unlocked(psbfb->base.obj[0]); return 0; } diff --git a/drivers/gpu/drm/gma500/gem.c b/drivers/gpu/drm/gma500/gem.c index 131239759a75..913bf4c256fa 100644 --- a/drivers/gpu/drm/gma500/gem.c +++ b/drivers/gpu/drm/gma500/gem.c @@ -93,7 +93,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size, return ret; } /* We have the initial and handle reference but need only one now */ - drm_gem_object_unreference_unlocked(&r->gem); + drm_gem_object_put_unlocked(&r->gem); *handlep = handle; return 0; } diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index c8f071c47daf..015dc9f9348d 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c @@ -353,7 +353,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem); psb_gtt_unpin(gt); - drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj); + drm_gem_object_put_unlocked(gma_crtc->cursor_obj); gma_crtc->cursor_obj = NULL; } return 0; @@ -429,7 +429,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, if (gma_crtc->cursor_obj) { gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem); psb_gtt_unpin(gt); - drm_gem_object_unreference_unlocked(gma_crtc->cursor_obj); + drm_gem_object_put_unlocked(gma_crtc->cursor_obj); } gma_crtc->cursor_obj = obj; @@ -437,7 +437,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc, return ret; unref_cursor: - drm_gem_object_unreference_unlocked(obj); + drm_gem_object_put_unlocked(obj); return ret; } -- 2.14.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH i-g-t v2 1/7] igt: lib/igt_crc: Split out CRC functionality
On Fri, Jul 14, 2017 at 04:18:50PM +0100, Liviu Dudau wrote: > From: Brian Starkey > > Separate out the CRC code for better compartmentalisation. Should ease > the addition of more/different CRC sources in the future. > > Signed-off-by: Brian Starkey Needs adjustements to gtkdoc I assume, plus a proper intro text for igt_crc.c. With that, and assuming you didn't change the code: Acked-by: Daniel Vetter > --- > lib/Makefile.sources | 2 + > lib/igt_chamelium.h | 1 + > lib/igt_crc.c | 563 > ++ > lib/igt_crc.h | 125 + > lib/igt_debugfs.c | 547 > lib/igt_debugfs.h | 81 -- > tests/chamelium.c | 1 + > tests/kms_atomic_transition.c | 1 + > tests/kms_ccs.c | 1 + > tests/kms_chv_cursor_fail.c | 1 + > tests/kms_crtc_background_color.c | 1 + > tests/kms_cursor_crc.c| 1 + > tests/kms_cursor_legacy.c | 1 + > tests/kms_draw_crc.c | 1 + > tests/kms_fbc_crc.c | 1 + > tests/kms_flip_tiling.c | 1 + > tests/kms_frontbuffer_tracking.c | 1 + > tests/kms_mmap_write_crc.c| 1 + > tests/kms_mmio_vs_cs_flip.c | 1 + > tests/kms_pipe_color.c| 1 + > tests/kms_pipe_crc_basic.c| 1 + > tests/kms_plane.c | 1 + > tests/kms_plane_lowres.c | 1 + > tests/kms_plane_multiple.c| 1 + > tests/kms_plane_scaling.c | 1 + > tests/kms_pwrite_crc.c| 1 + > tests/kms_rotation_crc.c | 1 + > tests/kms_universal_plane.c | 1 + > tools/intel_display_crc.c | 1 + > 29 files changed, 714 insertions(+), 628 deletions(-) > create mode 100644 lib/igt_crc.c > create mode 100644 lib/igt_crc.h > > diff --git a/lib/Makefile.sources b/lib/Makefile.sources > index 53fdb54c..cfba15c9 100644 > --- a/lib/Makefile.sources > +++ b/lib/Makefile.sources > @@ -11,6 +11,8 @@ lib_source_list = \ > igt_debugfs.h \ > igt_aux.c \ > igt_aux.h \ > + igt_crc.c \ > + igt_crc.h \ > igt_edid_template.h \ > igt_gt.c\ > igt_gt.h\ > diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h > index 81322ad2..ea5abc2e 100644 > --- a/lib/igt_chamelium.h > +++ b/lib/igt_chamelium.h > @@ -31,6 +31,7 @@ > #endif > > #include "igt.h" > +#include "igt_crc.h" > #include > > struct chamelium; > diff --git a/lib/igt_crc.c b/lib/igt_crc.c > new file mode 100644 > index ..91a0b5a8 > --- /dev/null > +++ b/lib/igt_crc.c > @@ -0,0 +1,563 @@ > +/* > + * Copyright © 2013 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > DEALINGS > + * IN THE SOFTWARE. > + * > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "igt_aux.h" > +#include "igt_crc.h" > +#include "igt_core.h" > +#include "igt_debugfs.h" > +#include "igt_kms.h" > + > +/** > + * igt_assert_crc_equal: > + * @a: first pipe CRC value > + * @b: second pipe CRC value > + * > + * Compares two CRC values and fails the testcase if they don't match with > + * igt_fail(). Note that due to CRC collisions CRC based testcase can only > + * assert that CRCs match, never that they are different. Otherwise there > might > + * be random testcase failures when different screen contents end up with the > + * same CRC by chance. > + */ > +void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b) > +{ > + int i; > + > + for (i = 0; i < a->n_words; i++) > + igt_assert_eq_u32(a->crc[i], b->crc[i]); > +} > + > +/** > + * igt_crc_to_string: > + * @
Re: [PATCH 1/2] sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf
Acked-by: Christian König Am 25.06.2018 08:45 schrieb Gerd Hoffmann : Atomic mapping interface for dmabufs will be removed. Signed-off-by: Gerd Hoffmann --- samples/vfio-mdev/mbochs.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index 2960e26c6e..aa25cda21d 100644 --- a/samples/vfio-mdev/mbochs.c +++ b/samples/vfio-mdev/mbochs.c @@ -803,15 +803,6 @@ static void mbochs_release_dmabuf(struct dma_buf *buf) mutex_unlock(&mdev_state->ops_lock); } -static void *mbochs_kmap_atomic_dmabuf(struct dma_buf *buf, - unsigned long page_num) -{ - struct mbochs_dmabuf *dmabuf = buf->priv; - struct page *page = dmabuf->pages[page_num]; - - return kmap_atomic(page); -} - static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num) { struct mbochs_dmabuf *dmabuf = buf->priv; @@ -824,7 +815,6 @@ static struct dma_buf_ops mbochs_dmabuf_ops = { .map_dma_buf = mbochs_map_dmabuf, .unmap_dma_buf= mbochs_unmap_dmabuf, .release = mbochs_release_dmabuf, - .map_atomic = mbochs_kmap_atomic_dmabuf, .map = mbochs_kmap_dmabuf, .mmap = mbochs_mmap_dmabuf, }; -- 2.9.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 00/24] Add support for R40 HDMI pipeline
On Mon, Jun 25, 2018 at 02:02:40PM +0200, Jernej Skrabec wrote: > This series adds support for R40 HDMI pipeline. It is a bit special > than other already supported pipelines because it has additional unit > called TCON TOP responsible for relationship configuration between > mixers, TCONs and HDMI. Additionally, it has additional gates for DSI > and TV TCONs, TV encoder clock settings and pin muxing between LCD > and TV encoders. > > However, it seems that TCON TOP will become a norm, since newer > Allwinner SoCs like H6 also have this unit. > > I tested different possible configurations: > - mixer0 <> TCON-TV0 <> HDMI > - mixer0 <> TCON-TV1 <> HDMI > - mixer1 <> TCON-TV0 <> HDMI > - mixer1 <> TCON-TV1 <> HDMI > > Please review. This looks all fine by me, thanks! I'd still like some more review (by Chen-Yu and Rob) before applying it, but you can add my Acked-by for the next round if needed. Maxime -- Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PULL] drm-intel-next
Hi Dave, Here goes another pull request for 4.19. Highlights here to Ice Lake Display enabling, and to preparation for full-ppgtt enabling for older gens, and to hangcheck and gpu reset improvements in general. drm-intel-next-2018-06-20: Chris is doing many reworks that allow us to get full-ppgtt supported on all platforms back to HSW. As well many other fix and improvements, Including: - Use GEM suspend when aborting initialization (Chris) - Change i915_gem_fault to return vm_fault_t (Chris) - Expand VMA to Non gem object entities (Chris) - Improve logs for load failure, but quite logging on fault injection to avoid noise on CI (Chris) - Other page directory handling fixes and improvements for gen6 (Chris) - Other gtt clean-up removing redundancies and unused checks (Chris) - Reorder aliasing ppgtt fini (Chris) - Refactor of unsetting obg->mm.pages (Chris) - Apply batch location restrictions before pinning (Chris) - Ringbuffer fixes for context restore (Chris) - Execlist fixes on freeing error pointer on allocation error (Chris) - Make closing request flush mandatory (Chris) - Move GEM sanitize from resume_early to resume (Chris) - Improve debug dumps (Chris) - Silent compiler for selftest (Chris) - Other execlists changes to improve hangcheck and reset. - Many gtt page directory fixes and improvements (Chris) - Reorg context workarounds (Chris) - Avoid ERR_PTR dereference on selftest (Chris) Other GEM related work: - Stop trying to reset GPU if reset failed (Mika) - Add HW workaround for KBL to fix GPU reset (Mika) - Fix context ban and hang accounting for client (Mika) - Fixes on OA perf (Michel, Jani) - Refactor on GuC log mechanisms (Piotr) - Enable provoking vertex fix on Gen9 system (Kenneth) More ICL patches for Display enabling: - ICL - 10-bit support for HDMI (RK) - ICL - Start adding TBT PLL (Paulo) - ICL - DDI HDMK level selection (Manasi) - ICL - GMBUS GPIO pin mapping fix (Mahesh) - ICL - Adding DP_AUX_E support (James) - ICL - Display interrupts handling (DK) Other display fixes and improvements: - Fix sprite destination color keying on SKL+ (Ville) - Fixes and improvements on PCH detection, specially for non PCH systems (Jani) - Document PCH_NOP (Lucas) - Allow DBLSCAN user modes with eDP/LVDS/DSI (Ville) - Opregion and ACPI cleanup and organization (Jani) - Kill delays when activation psr (Rodrigo) - ...and a consequent fix of the psr activation flow (DK) - Fix HDMI infoframe setting (Imre) - Fix Display interrupts and modes on old gens (Ville) - Start switching to kernel unsigned int types (Jani) - Introduction to Amber Lake and Whiskey Lake platforms (Jose) - Audio clock fixes for HBR3 (RK) - Standardize i915_reg.h definitions according to our doc and checkpatch (Paulo) - Remove unused timespec_to_jiffies_timeout function (Arnd) - Increase the scope of PSR wake fix for other VBTs out there (Vathsala) - Improve debug msgs with prop name/id (Ville) - Other clean up on unecessary cursor size defines (Ville) - Enforce max hdisplay/hblank_start limits on HSW/BDW (Ville) - Make ELD pointers constant (Jani) - Fix for PSR VBT parse (Colin) - Add warn about unsupported CDCLK rates (Imre) Thanks, Rodrigo. The following changes since commit 14c3f8425080a1ff97df7b81f7c339bf42c427a3: drm/i915: Update DRIVER_DATE to 20180606 (2018-06-06 15:10:47 -0700) are available in the Git repository at: git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-next-2018-06-20 for you to fetch changes up to e1cacec9d50d7299893eeab2d895189f3db625da: drm/i915: Update DRIVER_DATE to 20180620 (2018-06-20 14:10:48 -0700) Chris is doing many reworks that allow us to get full-ppgtt supported on all platforms back to HSW. As well many other fix and improvements, Including: - Use GEM suspend when aborting initialization (Chris) - Change i915_gem_fault to return vm_fault_t (Chris) - Expand VMA to Non gem object entities (Chris) - Improve logs for load failure, but quite logging on fault injection to avoid noise on CI (Chris) - Other page directory handling fixes and improvements for gen6 (Chris) - Other gtt clean-up removing redundancies and unused checks (Chris) - Reorder aliasing ppgtt fini (Chris) - Refactor of unsetting obg->mm.pages (Chris) - Apply batch location restrictions before pinning (Chris) - Ringbuffer fixes for context restore (Chris) - Execlist fixes on freeing error pointer on allocation error (Chris) - Make closing request flush mandatory (Chris) - Move GEM sanitize from resume_early to resume (Chris) - Improve debug dumps (Chris) - Silent compiler for selftest (Chris) - Other execlists changes to improve hangcheck and reset. - Many gtt page directory fixes and improvements (Chris) - Reorg context workarounds (Chris) - Avoid ERR_PTR dereference on selftest (Chris) Other GEM related work: - Stop trying to reset GPU if reset failed (Mika) - Add HW workaround for KBL to fix GPU reset (Mika) - Fix context ban and hang acc
[PATCH] drm/vkms: Add vblank events simulated by hrtimers
This commit adds regular vblank events simulated through hrtimers, which is a feature required by VKMS to mimic real hardware. In this sense, this commit adopts a default frequency of 60Hz for vblank interval. Finally, this commit implements handlers for some of the atomic and vblank hooks. Signed-off-by: Rodrigo Siqueira --- Note: - This patch depends on the patchset "drm/vkms: Updates to meet basic kms_flip requirements" link: https://lists.freedesktop.org/archives/dri-devel/2018-June/180823.html drivers/gpu/drm/vkms/vkms_crtc.c | 90 +++- drivers/gpu/drm/vkms/vkms_drv.c | 6 +++ drivers/gpu/drm/vkms/vkms_drv.h | 9 3 files changed, 103 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c index 84cc05506b09..73aae129c37d 100644 --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c @@ -10,6 +10,52 @@ #include #include +static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) +{ + struct vkms_output *output = container_of(timer, struct vkms_output, + vblank_hrtimer); + struct drm_crtc *crtc = &output->crtc; + unsigned long flags; + int ret_overrun; + bool ret; + + ret = drm_crtc_handle_vblank(&output->crtc); + if (!ret) + DRM_ERROR("vkms failure on handling vblank"); + + spin_lock_irqsave(&crtc->dev->event_lock, flags); + if (output->event) { + drm_crtc_send_vblank_event(crtc, output->event); + drm_crtc_vblank_put(crtc); + output->event = NULL; + } + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); + + ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer, + output->period_ns); + + return HRTIMER_RESTART; +} + +static int vkms_enable_vblank(struct drm_crtc *crtc) +{ + struct vkms_output *out = drm_crtc_to_vkms_output(crtc); + + hrtimer_init(&out->vblank_hrtimer, CLOCK_REALTIME, HRTIMER_MODE_ABS); + out->vblank_hrtimer.function = &vkms_vblank_simulate; + out->period_ns = ktime_set(0, DEFAULT_VBLANK_NS); + hrtimer_start(&out->vblank_hrtimer, out->period_ns, HRTIMER_MODE_ABS); + + return 0; +} + +static void vkms_disable_vblank(struct drm_crtc *crtc) +{ + struct vkms_output *out = drm_crtc_to_vkms_output(crtc); + + hrtimer_cancel(&out->vblank_hrtimer); +} + static const struct drm_crtc_funcs vkms_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .destroy= drm_crtc_cleanup, @@ -17,6 +63,8 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { .reset = drm_atomic_helper_crtc_reset, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, + .enable_vblank = vkms_enable_vblank, + .disable_vblank = vkms_disable_vblank, }; static int vkms_crtc_atomic_check(struct drm_crtc *crtc, @@ -27,12 +75,50 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc, static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) +{ + drm_crtc_vblank_on(crtc); +} + +static void vkms_crtc_atomic_begin(struct drm_crtc *crtc, + struct drm_crtc_state *old_s) +{ + struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc); + + if (crtc->state->event) { + crtc->state->event->pipe = drm_crtc_index(crtc); + WARN_ON(drm_crtc_vblank_get(crtc) != 0); + + vkms_output->event = crtc->state->event; + crtc->state->event = NULL; + } +} + +static void vkms_crtc_atomic_flush(struct drm_crtc *crtc, + struct drm_crtc_state *old_crtc_state) +{ + struct drm_pending_vblank_event *event = crtc->state->event; + + if (!event) + return; + + crtc->state->event = NULL; + + spin_lock_irq(&crtc->dev->event_lock); + if (drm_crtc_vblank_get(crtc)) + drm_crtc_send_vblank_event(crtc, event); + spin_unlock_irq(&crtc->dev->event_lock); +} + +static void vkms_crtc_commit(struct drm_crtc *crtc) { } static const struct drm_crtc_helper_funcs vkms_crtc_helper_funcs = { - .atomic_check = vkms_crtc_atomic_check, - .atomic_enable = vkms_crtc_atomic_enable, + .atomic_check = vkms_crtc_atomic_check, + .atomic_enable = vkms_crtc_atomic_enable, + .atomic_flush = vkms_crtc_atomic_flush, + .atomic_begin = vkms_crtc_atomic_begin, + .commit = vkms_crtc_commit, }; int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/driver
Re: [PATCH v3 04/24] dt-bindings: display: sunxi-drm: Add TCON TOP description
On Mon, Jun 25, 2018 at 02:02:44PM +0200, Jernej Skrabec wrote: > TCON TOP main purpose is to configure whole display pipeline. It > determines relationships between mixers and TCONs, selects source TCON > for HDMI, muxes LCD and TV encoder GPIO output, selects TV encoder > clock source and contains additional TV TCON and DSI gates. > > Signed-off-by: Jernej Skrabec > --- > .../bindings/display/sunxi/sun4i-drm.txt | 56 +++ > include/dt-bindings/clock/sun8i-tcon-top.h| 11 > 2 files changed, 67 insertions(+) > create mode 100644 include/dt-bindings/clock/sun8i-tcon-top.h Reviewed-by: Rob Herring ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 02/10] xf86drm: introduce drm_device_has_rdev() helper
From: Emil Velikov Currently we match the opened drmDevice fd with each drmDevice we process. Move that after all the devices are processed and folded, via the drm_device_has_rdev(). This makes the code easier to follow and allows us to unify the massive process loop across drmGetDevice2 and drmGetDevices2. That in itself is coming with a later commit. Signed-off-by: Emil Velikov --- xf86drm.c | 34 +- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index e1bbbe99..cbc0a408 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3705,6 +3705,21 @@ drm_device_validate_flags(uint32_t flags) return (flags & ~DRM_DEVICE_GET_PCI_REVISION); } +static bool +drm_device_has_rdev(drmDevicePtr device, dev_t find_rdev) +{ +struct stat sbuf; + +for (int i = 0; i < DRM_NODE_MAX; i++) { +if (device->available_nodes & 1 << i) { +if (stat(device->nodes[i], &sbuf) == 0 && +sbuf.st_rdev == find_rdev) +return true; +} +} +return false; +} + /** * Get information about the opened drm device * @@ -3889,21 +3904,22 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) local_devices = temp; } -/* store target at local_devices[0] for ease to use below */ -if (find_rdev == sbuf.st_rdev && i) { -local_devices[i] = local_devices[0]; -local_devices[0] = d; -} -else -local_devices[i] = d; +local_devices[i] = d; i++; } node_count = i; drmFoldDuplicatedDevices(local_devices, node_count); -*device = local_devices[0]; -drmFreeDevices(&local_devices[1], node_count - 1); +for (i = 0; i < node_count; i++) { +if (!local_devices[i]) +continue; + +if (drm_device_has_rdev(local_devices[i], find_rdev)) +*device = local_devices[i]; +else +drmFreeDevice(&local_devices[i]); +} closedir(sysdir); free(local_devices); -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 05/10] xf86drm: introduce a get_real_pci_path() helper
From: Emil Velikov Introduce a helper which gets the real sysfs path for the given pci device. In other words, instead opening the /sys/dev/char/*/device symlink, we opt for the actual /sys/devices/pci*/*/ It folds three (nearly identical) snprintf's and paves the way of adding extra devices (see next patch) a piece of pie. Signed-off-by: Emil Velikov --- xf86drm.c | 62 --- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index d4810740..8ccd528f 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -2992,16 +2992,37 @@ static int drmParseSubsystemType(int maj, int min) #endif } +static char * +get_real_pci_path(int maj, int min) +{ +char path[PATH_MAX + 1]; +char *real_path = malloc(PATH_MAX); + +if (!real_path) +return NULL; + +snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min); +if (!realpath(path, real_path)) { +free(real_path); +return NULL; +} + +return real_path; +} + static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info) { #ifdef __linux__ unsigned int domain, bus, dev, func; -char path[PATH_MAX + 1], *value; +char *real_path, *value; int num; -snprintf(path, sizeof(path), "/sys/dev/char/%d:%d/device", maj, min); +real_path = get_real_pci_path(maj, min); +if (!real_path) +return -ENOENT; -value = sysfs_uevent_get(path, "PCI_SLOT_NAME"); +value = sysfs_uevent_get(real_path, "PCI_SLOT_NAME"); +free(real_path); if (!value) return -ENOENT; @@ -3114,24 +3135,32 @@ static int parse_separate_sysfs_files(int maj, int min, "subsystem_vendor", "subsystem_device", }; -char path[PATH_MAX + 1]; +char path[PATH_MAX + 1], *real_path; unsigned int data[ARRAY_SIZE(attrs)]; FILE *fp; int ret; +real_path = get_real_pci_path(maj, min); +if (!real_path) +return -ENOENT; + for (unsigned i = ignore_revision ? 1 : 0; i < ARRAY_SIZE(attrs); i++) { -snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/%s", maj, min, - attrs[i]); +snprintf(path, PATH_MAX, "%s/%s", real_path, attrs[i]); fp = fopen(path, "r"); -if (!fp) +if (!fp) { +free(real_path); return -errno; +} ret = fscanf(fp, "%x", &data[i]); fclose(fp); -if (ret != 1) +if (ret != 1) { +free(real_path); return -errno; +} } +free(real_path); device->revision_id = ignore_revision ? 0xff : data[0] & 0xff; device->vendor_id = data[1] & 0x; @@ -3145,19 +3174,28 @@ static int parse_separate_sysfs_files(int maj, int min, static int parse_config_sysfs_file(int maj, int min, drmPciDeviceInfoPtr device) { -char path[PATH_MAX + 1]; +char path[PATH_MAX + 1], *real_path; unsigned char config[64]; int fd, ret; -snprintf(path, PATH_MAX, "/sys/dev/char/%d:%d/device/config", maj, min); +real_path = get_real_pci_path(maj, min); +if (!real_path) +return -ENOENT; + +snprintf(path, PATH_MAX, "%s/config", real_path); fd = open(path, O_RDONLY); -if (fd < 0) +if (fd < 0) { +free(real_path); return -errno; +} ret = read(fd, config, sizeof(config)); close(fd); -if (ret < 0) +if (ret < 0) { +free(real_path); return -errno; +} +free(real_path); device->vendor_id = config[0] | (config[1] << 8); device->device_id = config[2] | (config[3] << 8); -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 01/10] xf86drm: drmGetDevice2: error out if the fd has unknown subsys
From: Emil Velikov Currently one can open() any /dev node. If it's unknown drmParseSubsystemType() will return an error. Track that and bail as needed. Signed-off-by: Emil Velikov --- xf86drm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xf86drm.c b/xf86drm.c index 87c216cf..e1bbbe99 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3814,6 +3814,8 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) return -EINVAL; subsystem_type = drmParseSubsystemType(maj, min); +if (subsystem_type < 0) +return subsystem_type; local_devices = calloc(max_count, sizeof(drmDevicePtr)); if (local_devices == NULL) -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 04/10] xf86drm: Allocate drmDevicePtr's on stack
From: Emil Velikov Currently we dynamically allocate 16 pointers and reallocate more as needed. Instead, allocate the maximum number (256) on stack - the number is small enough and is unlikely to change in the foreseeable future. This allows us to simplify the error handling and even shed a few bytes off the final binary. Signed-off-by: Emil Velikov --- xf86drm.c | 64 ++- 1 file changed, 6 insertions(+), 58 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index 114cf855..d4810740 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3846,7 +3846,7 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) return 0; #else -drmDevicePtr *local_devices; +drmDevicePtr local_devices[256]; drmDevicePtr d; DIR *sysdir; struct dirent *dent; @@ -3854,7 +3854,6 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) int subsystem_type; int maj, min; int ret, i, node_count; -int max_count = 16; dev_t find_rdev; if (drm_device_validate_flags(flags)) @@ -3877,15 +3876,9 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) if (subsystem_type < 0) return subsystem_type; -local_devices = calloc(max_count, sizeof(drmDevicePtr)); -if (local_devices == NULL) -return -ENOMEM; - sysdir = opendir(DRM_DIR_NAME); -if (!sysdir) { -ret = -errno; -goto free_locals; -} +if (!sysdir) +return -errno; i = 0; while ((dent = readdir(sysdir))) { @@ -3893,16 +3886,6 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) if (ret) continue; -if (i >= max_count) { -drmDevicePtr *temp; - -max_count += 16; -temp = realloc(local_devices, max_count * sizeof(drmDevicePtr)); -if (!temp) -goto free_devices; -local_devices = temp; -} - local_devices[i] = d; i++; } @@ -3921,18 +3904,9 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) } closedir(sysdir); -free(local_devices); if (*device == NULL) return -ENODEV; return 0; - -free_devices: -drmFreeDevices(local_devices, i); -closedir(sysdir); - -free_locals: -free(local_devices); -return ret; #endif } @@ -3968,25 +3942,18 @@ int drmGetDevice(int fd, drmDevicePtr *device) */ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices) { -drmDevicePtr *local_devices; +drmDevicePtr local_devices[256]; drmDevicePtr device; DIR *sysdir; struct dirent *dent; int ret, i, node_count, device_count; -int max_count = 16; if (drm_device_validate_flags(flags)) return -EINVAL; -local_devices = calloc(max_count, sizeof(drmDevicePtr)); -if (local_devices == NULL) -return -ENOMEM; - sysdir = opendir(DRM_DIR_NAME); -if (!sysdir) { -ret = -errno; -goto free_locals; -} +if (!sysdir) +return -errno; i = 0; while ((dent = readdir(sysdir))) { @@ -3994,16 +3961,6 @@ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices) if (ret) continue; -if (i >= max_count) { -drmDevicePtr *temp; - -max_count += 16; -temp = realloc(local_devices, max_count * sizeof(drmDevicePtr)); -if (!temp) -goto free_devices; -local_devices = temp; -} - local_devices[i] = device; i++; } @@ -4025,16 +3982,7 @@ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices) } closedir(sysdir); -free(local_devices); return device_count; - -free_devices: -drmFreeDevices(local_devices, i); -closedir(sysdir); - -free_locals: -free(local_devices); -return ret; } /** -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 09/10] drmdevice: convert the tabbed output into a tree
From: Emil Velikov Making the output a little bit easier to parse by human beings. Signed-off-by: Emil Velikov --- tests/drmdevice.c | 78 +++ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/tests/drmdevice.c b/tests/drmdevice.c index 0d75836f..e9e9d7f1 100644 --- a/tests/drmdevice.c +++ b/tests/drmdevice.c @@ -36,67 +36,67 @@ static void print_device_info(drmDevicePtr device, int i, bool print_revision) { printf("device[%i]\n", i); -printf("\tavailable_nodes %04x\n", device->available_nodes); -printf("\tnodes\n"); +printf("+->available_nodes %#04x\n", device->available_nodes); +printf("+->nodes\n"); for (int j = 0; j < DRM_NODE_MAX; j++) if (device->available_nodes & 1 << j) -printf("\t\tnodes[%d] %s\n", j, device->nodes[j]); +printf("| +->nodes[%d] %s\n", j, device->nodes[j]); -printf("\tbustype %04x\n", device->bustype); -printf("\tbusinfo\n"); +printf("+->bustype %04x\n", device->bustype); +printf("+->businfo\n"); if (device->bustype == DRM_BUS_PCI) { -printf("\t\tpci\n"); -printf("\t\t\tdomain\t%04x\n",device->businfo.pci->domain); -printf("\t\t\tbus\t%02x\n", device->businfo.pci->bus); -printf("\t\t\tdev\t%02x\n", device->businfo.pci->dev); -printf("\t\t\tfunc\t%1u\n", device->businfo.pci->func); - -printf("\tdeviceinfo\n"); -printf("\t\tpci\n"); -printf("\t\t\tvendor_id\t%04x\n", device->deviceinfo.pci->vendor_id); -printf("\t\t\tdevice_id\t%04x\n", device->deviceinfo.pci->device_id); -printf("\t\t\tsubvendor_id\t%04x\n", device->deviceinfo.pci->subvendor_id); -printf("\t\t\tsubdevice_id\t%04x\n", device->deviceinfo.pci->subdevice_id); +printf("| +->pci\n"); +printf("| +->domain %04x\n",device->businfo.pci->domain); +printf("| +->bus%02x\n", device->businfo.pci->bus); +printf("| +->dev%02x\n", device->businfo.pci->dev); +printf("| +->func %1u\n", device->businfo.pci->func); + +printf("+->deviceinfo\n"); +printf("+->pci\n"); +printf(" +->vendor_id %04x\n", device->deviceinfo.pci->vendor_id); +printf(" +->device_id %04x\n", device->deviceinfo.pci->device_id); +printf(" +->subvendor_id %04x\n", device->deviceinfo.pci->subvendor_id); +printf(" +->subdevice_id %04x\n", device->deviceinfo.pci->subdevice_id); if (print_revision) -printf("\t\t\trevision_id\t%02x\n", device->deviceinfo.pci->revision_id); +printf(" +->revision_id %02x\n", device->deviceinfo.pci->revision_id); else -printf("\t\t\trevision_id\tIGNORED\n"); +printf(" +->revision_id IGNORED\n"); } else if (device->bustype == DRM_BUS_USB) { -printf("\t\tusb\n"); -printf("\t\t\tbus\t%03u\n", device->businfo.usb->bus); -printf("\t\t\tdev\t%03u\n", device->businfo.usb->dev); - -printf("\tdeviceinfo\n"); -printf("\t\tusb\n"); -printf("\t\t\tvendor\t%04x\n", device->deviceinfo.usb->vendor); -printf("\t\t\tproduct\t%04x\n", device->deviceinfo.usb->product); +printf("| +->usb\n"); +printf("| +->bus %03u\n", device->businfo.usb->bus); +printf("| +->dev %03u\n", device->businfo.usb->dev); + +printf("+->deviceinfo\n"); +printf(" +->usb\n"); +printf(" +->vendor %04x\n", device->deviceinfo.usb->vendor); +printf(" +->product %04x\n", device->deviceinfo.usb->product); } else if (device->bustype == DRM_BUS_PLATFORM) { char **compatible = device->deviceinfo.platform->compatible; -printf("\t\tplatform\n"); -printf("\t\t\tfullname\t%s\n", device->businfo.platform->fullname); +printf("| +->platform\n"); +printf("| +->fullname\t%s\n", device->businfo.platform->fullname); -printf("\tdeviceinfo\n"); -printf("\t\tplatform\n"); -printf("\t\t\tcompatible\n"); +printf("+->deviceinfo\n"); +printf(" +->platform\n"); +printf(" +->compatible\n"); while (*compatible) { -printf("\t\t\t\t%s\n", *compatible); +printf("%s\n", *compatible); compatible++; } } else if (device->bustype == DRM_BUS_HOST1X) { char **compatible = device->deviceinfo.platform->compatible; -printf("\t\thost1x\n"); -printf("\t\t\tfullname\t%s\n", device->businfo.host1x->fullname); +printf("| +->host1x\n"); +printf("| +->fullname\t%s\n", device->businfo.host1x->fullname); -printf("\tdeviceinfo\n"); -printf("\t\tplatform\n"); -printf("\t\t\tcompatible\n"); +printf("+->deviceinfo\n"); +printf(" +->platform\n"); +prin
[PATCH libdrm 07/10] tests/drmdevices: install alongside other utilities
From: Emil Velikov It's mildly useful program, to ship it when the user wants the "tests" installed. Obviously the "tests" in the name is a misnomer. Signed-off-by: Emil Velikov --- tests/Makefile.am | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 0355a925..b72c24f9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -43,5 +43,10 @@ TESTS = \ random check_PROGRAMS = \ - $(TESTS) \ - drmdevice + $(TESTS) + +if HAVE_INSTALL_TESTS +bin_PROGRAMS = drmdevice +else +check_PROGRAMS += drmdevice +endif -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 06/10] xf86drm: Add drmDevice support for virtio_gpu
From: Emil Velikov The GPU almost exclusively lives on the PCI bus, so we expose it as a normal PCI one. This allows any existing drmDevice users to work without any changes. One could wonder why a separate typeset is not introduced, alike say host1x. Unlike host1x the PCI/platform distinction for virtio provides no extra information. Plus needed we can add the separate set at a later stage. Here are a couple of 'features' that virtio seems to be missing: - provides extra information on top the plaform devices - supports a range of GPU devices - is considered hardware description (DT) Signed-off-by: Emil Velikov --- xf86drm.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xf86drm.c b/xf86drm.c index 8ccd528f..b847ea26 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -2954,6 +2954,9 @@ sysfs_uevent_get(const char *path, const char *fmt, ...) } #endif +/* Little white lie to avoid major rework of the existing code */ +#define DRM_BUS_VIRTIO 0x10 + static int drmParseSubsystemType(int maj, int min) { #ifdef __linux__ @@ -2983,6 +2986,9 @@ static int drmParseSubsystemType(int maj, int min) if (strncmp(name, "/host1x", 7) == 0) return DRM_BUS_HOST1X; +if (strncmp(name, "/virtio", 7) == 0) +return DRM_BUS_VIRTIO; + return -EINVAL; #elif defined(__OpenBSD__) return DRM_BUS_PCI; @@ -2996,7 +3002,7 @@ static char * get_real_pci_path(int maj, int min) { char path[PATH_MAX + 1]; -char *real_path = malloc(PATH_MAX); +char *term, *real_path = malloc(PATH_MAX); if (!real_path) return NULL; @@ -3007,6 +3013,10 @@ get_real_pci_path(int maj, int min) return NULL; } +term = strrchr(real_path, '/'); +if (term && strncmp(term, "/virtio", 7) == 0) +*term = 0; + return real_path; } @@ -3744,6 +3754,7 @@ process_device(drmDevicePtr *device, const char *d_name, switch (subsystem_type) { case DRM_BUS_PCI: +case DRM_BUS_VIRTIO: return drmProcessPciDevice(device, node, node_type, maj, min, fetch_deviceinfo, flags); case DRM_BUS_USB: -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 03/10] xf86drm: Fold drmDevice processing into process_device() helper
From: Emil Velikov Don't the duplicate (nearly) identical code across the two call sites. It improves legibility and the diff stat seems nice. Signed-off-by: Emil Velikov --- xf86drm.c | 159 ++ 1 file changed, 51 insertions(+), 108 deletions(-) diff --git a/xf86drm.c b/xf86drm.c index cbc0a408..114cf855 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -3676,6 +3676,52 @@ free_device: return ret; } +static int +process_device(drmDevicePtr *device, const char *d_name, + int req_subsystem_type, + bool fetch_deviceinfo, uint32_t flags) +{ +struct stat sbuf; +char node[PATH_MAX + 1]; +int node_type, subsystem_type; +unsigned int maj, min; + +node_type = drmGetNodeType(d_name); +if (node_type < 0) +return -1; + +snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, d_name); +if (stat(node, &sbuf)) +return -1; + +maj = major(sbuf.st_rdev); +min = minor(sbuf.st_rdev); + +if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) +return -1; + +subsystem_type = drmParseSubsystemType(maj, min); +if (req_subsystem_type != -1 && req_subsystem_type != subsystem_type) +return -1; + +switch (subsystem_type) { +case DRM_BUS_PCI: +return drmProcessPciDevice(device, node, node_type, maj, min, + fetch_deviceinfo, flags); +case DRM_BUS_USB: +return drmProcessUsbDevice(device, node, node_type, maj, min, + fetch_deviceinfo, flags); +case DRM_BUS_PLATFORM: +return drmProcessPlatformDevice(device, node, node_type, maj, min, +fetch_deviceinfo, flags); +case DRM_BUS_HOST1X: +return drmProcessHost1xDevice(device, node, node_type, maj, min, + fetch_deviceinfo, flags); +default: +return -1; + } +} + /* Consider devices located on the same bus as duplicate and fold the respective * entries into a single one. * @@ -3805,8 +3851,7 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) DIR *sysdir; struct dirent *dent; struct stat sbuf; -char node[PATH_MAX + 1]; -int node_type, subsystem_type; +int subsystem_type; int maj, min; int ret, i, node_count; int max_count = 16; @@ -3844,55 +3889,9 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device) i = 0; while ((dent = readdir(sysdir))) { -node_type = drmGetNodeType(dent->d_name); -if (node_type < 0) -continue; - -snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, dent->d_name); -if (stat(node, &sbuf)) -continue; - -maj = major(sbuf.st_rdev); -min = minor(sbuf.st_rdev); - -if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) -continue; - -if (drmParseSubsystemType(maj, min) != subsystem_type) -continue; - -switch (subsystem_type) { -case DRM_BUS_PCI: -ret = drmProcessPciDevice(&d, node, node_type, maj, min, true, flags); -if (ret) -continue; - -break; - -case DRM_BUS_USB: -ret = drmProcessUsbDevice(&d, node, node_type, maj, min, true, flags); -if (ret) -continue; - -break; - -case DRM_BUS_PLATFORM: -ret = drmProcessPlatformDevice(&d, node, node_type, maj, min, true, flags); -if (ret) -continue; - -break; - -case DRM_BUS_HOST1X: -ret = drmProcessHost1xDevice(&d, node, node_type, maj, min, true, flags); -if (ret) -continue; - -break; - -default: +ret = process_device(&d, dent->d_name, subsystem_type, true, flags); +if (ret) continue; -} if (i >= max_count) { drmDevicePtr *temp; @@ -3973,10 +3972,6 @@ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices) drmDevicePtr device; DIR *sysdir; struct dirent *dent; -struct stat sbuf; -char node[PATH_MAX + 1]; -int node_type, subsystem_type; -int maj, min; int ret, i, node_count, device_count; int max_count = 16; @@ -3995,61 +3990,9 @@ int drmGetDevices2(uint32_t flags, drmDevicePtr devices[], int max_devices) i = 0; while ((dent = readdir(sysdir))) { -node_type = drmGetNodeType(dent->d_name); -if (node_type < 0) -continue; - -snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, dent->d_name); -if (stat(node, &sbuf)) -continue; - -maj = major(sbuf.st_rdev); -min = minor(sbuf.st_rdev); - -if (maj != DRM_MAJOR || !S_ISCHR(sbuf.st_mode)) -continue; - -subsystem_type = drmParseSubsystemType(maj, min); - -if (subsystem
[PATCH libdrm 10/10] drmdevice: print the correct host1x information
From: Emil Velikov While fairly close, the host1x and platform are two separate things. Signed-off-by: Emil Velikov --- tests/drmdevice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/drmdevice.c b/tests/drmdevice.c index e9e9d7f1..97ce8ff9 100644 --- a/tests/drmdevice.c +++ b/tests/drmdevice.c @@ -86,13 +86,13 @@ print_device_info(drmDevicePtr device, int i, bool print_revision) compatible++; } } else if (device->bustype == DRM_BUS_HOST1X) { -char **compatible = device->deviceinfo.platform->compatible; +char **compatible = device->deviceinfo.host1x->compatible; printf("| +->host1x\n"); printf("| +->fullname\t%s\n", device->businfo.host1x->fullname); printf("+->deviceinfo\n"); -printf(" +->platform\n"); +printf(" +->host1x\n"); printf(" +->compatible\n"); while (*compatible) { -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH libdrm 08/10] tests/drmdevice: add a couple of printf headers
From: Emil Velikov Add a few printf statements, which should make the output easier to parse. Signed-off-by: Emil Velikov --- tests/drmdevice.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/drmdevice.c b/tests/drmdevice.c index 9dd5098a..0d75836f 100644 --- a/tests/drmdevice.c +++ b/tests/drmdevice.c @@ -112,12 +112,15 @@ main(void) drmDevicePtr device; int fd, ret, max_devices; +printf("--- Checking the number of DRM device available ---\n"); max_devices = drmGetDevices2(0, NULL, 0); if (max_devices <= 0) { printf("drmGetDevices2() has returned %d\n", max_devices); return -1; } +printf("--- Devices reported %d ---\n", max_devices); + devices = calloc(max_devices, sizeof(drmDevicePtr)); if (devices == NULL) { @@ -125,6 +128,7 @@ main(void) return -1; } +printf("--- Retrieving devices information (PCI device revision is ignored) ---\n"); ret = drmGetDevices2(0, devices, max_devices); if (ret < 0) { printf("drmGetDevices2() returned an error %d\n", ret); @@ -137,13 +141,14 @@ main(void) for (int j = 0; j < DRM_NODE_MAX; j++) { if (devices[i]->available_nodes & 1 << j) { -printf("Opening device %d node %s\n", i, devices[i]->nodes[j]); +printf("--- Opening device node %s ---\n", devices[i]->nodes[j]); fd = open(devices[i]->nodes[j], O_RDONLY | O_CLOEXEC, 0); if (fd < 0) { printf("Failed - %s (%d)\n", strerror(errno), errno); continue; } +printf("--- Retrieving device info, for node %s ---\n", devices[i]->nodes[j]); if (drmGetDevice2(fd, DRM_DEVICE_GET_PCI_REVISION, &device) == 0) { print_device_info(device, i, true); drmFreeDevice(&device); -- 2.18.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/vkms: Add vblank events simulated by hrtimers
On Mon, Jun 25, 2018 at 02:19:22PM -0300, Rodrigo Siqueira wrote: > This commit adds regular vblank events simulated through hrtimers, which > is a feature required by VKMS to mimic real hardware. In this sense, > this commit adopts a default frequency of 60Hz for vblank interval. > Finally, this commit implements handlers for some of the atomic and > vblank hooks. > > Signed-off-by: Rodrigo Siqueira > --- > Note: > - This patch depends on the patchset "drm/vkms: Updates to meet basic > kms_flip requirements" > link: > https://lists.freedesktop.org/archives/dri-devel/2018-June/180823.html > > drivers/gpu/drm/vkms/vkms_crtc.c | 90 +++- > drivers/gpu/drm/vkms/vkms_drv.c | 6 +++ > drivers/gpu/drm/vkms/vkms_drv.h | 9 > 3 files changed, 103 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c > b/drivers/gpu/drm/vkms/vkms_crtc.c > index 84cc05506b09..73aae129c37d 100644 > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > @@ -10,6 +10,52 @@ > #include > #include > > +static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) > +{ > + struct vkms_output *output = container_of(timer, struct vkms_output, > + vblank_hrtimer); > + struct drm_crtc *crtc = &output->crtc; > + unsigned long flags; > + int ret_overrun; > + bool ret; > + > + ret = drm_crtc_handle_vblank(&output->crtc); > + if (!ret) > + DRM_ERROR("vkms failure on handling vblank"); > + > + spin_lock_irqsave(&crtc->dev->event_lock, flags); > + if (output->event) { > + drm_crtc_send_vblank_event(crtc, output->event); > + drm_crtc_vblank_put(crtc); > + output->event = NULL; > + } > + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); > + > + ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer, > + output->period_ns); > + > + return HRTIMER_RESTART; > +} > + > +static int vkms_enable_vblank(struct drm_crtc *crtc) > +{ > + struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > + > + hrtimer_init(&out->vblank_hrtimer, CLOCK_REALTIME, HRTIMER_MODE_ABS); > + out->vblank_hrtimer.function = &vkms_vblank_simulate; > + out->period_ns = ktime_set(0, DEFAULT_VBLANK_NS); Don't you want the vblank interval to roughly match the crtc timings the user asked for? > + hrtimer_start(&out->vblank_hrtimer, out->period_ns, HRTIMER_MODE_ABS); > + > + return 0; > +} > + > +static void vkms_disable_vblank(struct drm_crtc *crtc) > +{ > + struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > + > + hrtimer_cancel(&out->vblank_hrtimer); > +} > + > static const struct drm_crtc_funcs vkms_crtc_funcs = { > .set_config = drm_atomic_helper_set_config, > .destroy= drm_crtc_cleanup, > @@ -17,6 +63,8 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { > .reset = drm_atomic_helper_crtc_reset, > .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, > .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, > + .enable_vblank = vkms_enable_vblank, > + .disable_vblank = vkms_disable_vblank, > }; > > static int vkms_crtc_atomic_check(struct drm_crtc *crtc, > @@ -27,12 +75,50 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc, > > static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, > struct drm_crtc_state *old_state) > +{ > + drm_crtc_vblank_on(crtc); > +} > + > +static void vkms_crtc_atomic_begin(struct drm_crtc *crtc, > +struct drm_crtc_state *old_s) > +{ > + struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc); > + > + if (crtc->state->event) { > + crtc->state->event->pipe = drm_crtc_index(crtc); > + WARN_ON(drm_crtc_vblank_get(crtc) != 0); > + > + vkms_output->event = crtc->state->event; > + crtc->state->event = NULL; > + } > +} > + > +static void vkms_crtc_atomic_flush(struct drm_crtc *crtc, > +struct drm_crtc_state *old_crtc_state) > +{ > + struct drm_pending_vblank_event *event = crtc->state->event; > + > + if (!event) > + return; > + > + crtc->state->event = NULL; > + > + spin_lock_irq(&crtc->dev->event_lock); > + if (drm_crtc_vblank_get(crtc)) > + drm_crtc_send_vblank_event(crtc, event); > + spin_unlock_irq(&crtc->dev->event_lock); > +} > + > +static void vkms_crtc_commit(struct drm_crtc *crtc) > { > } > > static const struct drm_crtc_helper_funcs vkms_crtc_helper_funcs = { > - .atomic_check = vkms_crtc_atomic_check, > - .atomic_enable = vkms_crtc_atomic_enable, > + .atomic_check = vkms_crtc_atomic_check, > + .atomic_e
[Bug 102646] Screen flickering under amdgpu-experimental [buggy auto power profile]
https://bugs.freedesktop.org/show_bug.cgi?id=102646 --- Comment #29 from Hadrien Lacour --- For what it's worth, the problem seems gone since I switched from 4.16.16 to 4.17.2 (with CONFIG_DRM_AMD_DC=y). -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 10/14] drm/i915: Populate possible_crtcs correctly
On Mon, 2018-06-25 at 14:10 +0300, Ville Syrjälä wrote: > On Thu, Jun 21, 2018 at 06:26:04PM -0700, Dhinakaran Pandiyan wrote: > > > > On Fri, 2018-06-15 at 19:49 +0300, Ville Syrjala wrote: > > > > > > From: Ville Syrjälä > > > > > > Don't advertize non-exisiting crtcs in the encoder possible_crtcs > > > bitmask. > > > > > How do we end up advertising non-existing CRTCs? encoder->crtc_mask > > seems to be populated in the encoder init functions based on > > possible > > pipes. Do you mean pipe and crtc->index can potentially differ? > No. Just that we may sometimes set BIT(PIPE_C) in crtc_mask when > there are only two pipes on the device. > Got it, thanks. Since crtc_mask seems to be initialized based on the platform, we should probably warn if we find out a bit is set incorrectly. With or without that, this patch is Reviewed-by: Dhinakaran Pandiyan > > > > > > > > > > > > Signed-off-by: Ville Syrjälä > > > --- > > > drivers/gpu/drm/i915/intel_display.c | 17 - > > > 1 file changed, 16 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/i915/intel_display.c > > > b/drivers/gpu/drm/i915/intel_display.c > > > index b095899d68a9..3fa9da714403 100644 > > > --- a/drivers/gpu/drm/i915/intel_display.c > > > +++ b/drivers/gpu/drm/i915/intel_display.c > > > @@ -13959,6 +13959,20 @@ static int intel_encoder_clones(struct > > > intel_encoder *encoder) > > > return index_mask; > > > } > > > > > > +static int intel_encoder_crtcs(struct intel_encoder *encoder) > > > +{ > > > + struct drm_device *dev = encoder->base.dev; > > > + struct intel_crtc *crtc; > > > + int index_mask = 0; > > > + > > > + for_each_intel_crtc(dev, crtc) { > > > + if (encoder->crtc_mask & BIT(crtc->pipe)) > > > + index_mask |= drm_crtc_mask(&crtc- > > > >base); > > > + } > > > + > > > + return index_mask; > > > +} > > > + > > > static bool has_edp_a(struct drm_i915_private *dev_priv) > > > { > > > if (!IS_MOBILE(dev_priv)) > > > @@ -14211,7 +14225,8 @@ static void intel_setup_outputs(struct > > > drm_i915_private *dev_priv) > > > intel_psr_init(dev_priv); > > > > > > for_each_intel_encoder(&dev_priv->drm, encoder) { > > > - encoder->base.possible_crtcs = encoder- > > > >crtc_mask; > > > + encoder->base.possible_crtcs = > > > + intel_encoder_crtcs(encoder); > > > encoder->base.possible_clones = > > > intel_encoder_clones(encoder); > > > } ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] drm/etnaviv: Fix driver unregistering
Hi Philipp, On Mon, Jun 25, 2018 at 5:02 AM, Philipp Zabel wrote: >> +static struct platform_device *etnaviv_drm; >> + >> static int __init etnaviv_init(void) >> { >> int ret; >> @@ -654,7 +656,8 @@ static int __init etnaviv_init(void) >> if (!of_device_is_available(np)) >> continue; >> >> - platform_device_register_simple("etnaviv", -1, NULL, 0); >> + etnaviv_drm = platform_device_register_simple("etnaviv", -1, >> + NULL, 0); > > If there are multiple vivante,gc device nodes, this overwrites > etnaviv_drm with each additional device after the first one. In fact there are multiple vivante,gc device nodes, but platform_device_register_simple() is only called once as expected. I will make this clear and will also check for the error code on platform_device_register_simple(). Thanks ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v5 0/3] drm/panel: Add Ilitek ILI9881c controller driver
On Tue, May 29, 2018 at 11:49:13AM +0200, Maxime Ripard wrote: > Hi, > > Here is the next version of the patches to add the support for the Ilitek > ILI9881c panel controller. > > This used to be a part of the larger DSI support series for the Allwinner > SoCs whose patches have been since merged and are obviously not part of > this series anymore. > > Let me know what you think, > Maxime Applied the two first patches, with Linus' Reviewed-By and Daniel's Acked-by as discussed on IRC. Maxime -- Maxime Ripard, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCHv2 3/9] dt-bindings: display/ti: add am65x-dss bindings
On Mon, Jun 18, 2018 at 04:22:36PM +0300, Tomi Valkeinen wrote: > Add DT bindings for Texas Instruments AM65x SoC Display Subsystem. The > DSS7 on AM65x SoC has two video ports (DPI and OLDI) and two video > pipelines. > > Signed-off-by: Jyri Sarha > Signed-off-by: Tomi Valkeinen > Cc: devicet...@vger.kernel.org > --- > .../bindings/display/ti/ti,am6-dss.txt | 16 > 1 file changed, 16 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/display/ti/ti,am6-dss.txt > > diff --git a/Documentation/devicetree/bindings/display/ti/ti,am6-dss.txt > b/Documentation/devicetree/bindings/display/ti/ti,am6-dss.txt > new file mode 100644 > index ..3466f095fb84 > --- /dev/null > +++ b/Documentation/devicetree/bindings/display/ti/ti,am6-dss.txt > @@ -0,0 +1,16 @@ > +Texas Instruments AM65x Display Subsystem > +== > + > +Required properties: > +- compatible: "ti,am65x-dss", "ti,am6-dss" Why do you need 2 compatibles? What's the difference for the 'x' in 'am65x'? > +- reg: address and length of the register spaces for DSS submodules > +- reg-names: "common", "vidl1", "vid", "ovr1", "ovr2", "vp1", "vp2" > +- clocks: phandle to fclk, vp1, and vp2 clocks > +- clock-names: "fck", "vp1", "vp2" fck or fclk? > +- interrupts: phandle to the DISPC interrupt > +- syscon: phandle to syscon device handling OLDI_PWRDN_TX (partition 1 of > + AM654 CTRL MMR0) > + > +The DSS outputs are described using the device graphs as documented in > +Documentation/devicetree/bindings/graph.txt. AM6 DSS has a DPI output as > port 0 > +and an OLDI output as port 1. What's OLDI? > -- > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. > Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki > > -- > To unsubscribe from this list: send the line "unsubscribe devicetree" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 1/2] drm/etnaviv: Check for platform_device_register_simple() failure
From: Fabio Estevam platform_device_register_simple() may fail, so we should better check its return value and propagate it in the case of error. Cc: Fixes: 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT node") Signed-off-by: Fabio Estevam --- Changes since v2: - Newly introduced in this version drivers/gpu/drm/etnaviv/etnaviv_drv.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index e5013a9..ac23c0f 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -631,6 +631,8 @@ static struct platform_driver etnaviv_platform_driver = { }, }; +static struct platform_device *etnaviv_drm; + static int __init etnaviv_init(void) { int ret; @@ -644,7 +646,7 @@ static int __init etnaviv_init(void) ret = platform_driver_register(&etnaviv_platform_driver); if (ret != 0) - platform_driver_unregister(&etnaviv_gpu_driver); + goto unregister_gpu_driver; /* * If the DT contains at least one available GPU device, instantiate @@ -653,12 +655,22 @@ static int __init etnaviv_init(void) for_each_compatible_node(np, NULL, "vivante,gc") { if (!of_device_is_available(np)) continue; - - platform_device_register_simple("etnaviv", -1, NULL, 0); + etnaviv_drm = platform_device_register_simple("etnaviv", -1, + NULL, 0); + if (IS_ERR(etnaviv_drm)) { + ret = PTR_ERR(etnaviv_drm); + goto unregister_platform_driver; + } of_node_put(np); break; } + return 0; + +unregister_platform_driver: + platform_driver_unregister(&etnaviv_platform_driver); +unregister_gpu_driver: + platform_driver_unregister(&etnaviv_gpu_driver); return ret; } module_init(etnaviv_init); -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 2/2] drm/etnaviv: Fix driver unregistering
From: Fabio Estevam Russell King reported: "When removing and reloading the etnaviv module, the following splat occurs: sysfs: cannot create duplicate filename '/devices/platform/etnaviv' CPU: 0 PID: 1471 Comm: modprobe Not tainted 4.17.0+ #1608 Hardware name: Marvell Dove (Cubox) Backtrace: [] (dump_backtrace) from [] (show_stack+0x18/0x1c) r6:ef033e38 r5:ee07b340 r4:edb9d000 r3: [] (show_stack) from [] (dump_stack+0x20/0x28) [] (dump_stack) from [] (sysfs_warn_dup+0x5c/0x70) [] (sysfs_warn_dup) from [] (sysfs_create_dir_ns+0x90/0x98) ..." Commit 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT node") introduced DRM registration via platform_device_register_simple(), but missed to call platform_device_unregister() inside etnaviv_exit(). Fix the problem by calling platform_device_unregister() inside etnaviv_exit(). While at it, also rearrange the function calls in the exit path to make them happen in the opposite order of registration. Tested on a imx6-sabresd board. Cc: Fixes: 246774d17fc0 ("drm/etnaviv: remove the need for a gpu-subsystem DT node") Reported-by: Russell King Signed-off-by: Fabio Estevam --- Changes since v2: - Add a 'available_gpu' bool variable to indicate that an available "vivante,gc" has been found drivers/gpu/drm/etnaviv/etnaviv_drv.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index ac23c0f..9044bf9 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -632,6 +632,7 @@ static struct platform_driver etnaviv_platform_driver = { }; static struct platform_device *etnaviv_drm; +static bool available_gpu; static int __init etnaviv_init(void) { @@ -655,6 +656,7 @@ static int __init etnaviv_init(void) for_each_compatible_node(np, NULL, "vivante,gc") { if (!of_device_is_available(np)) continue; + available_gpu = true; etnaviv_drm = platform_device_register_simple("etnaviv", -1, NULL, 0); if (IS_ERR(etnaviv_drm)) { @@ -677,8 +679,10 @@ module_init(etnaviv_init); static void __exit etnaviv_exit(void) { - platform_driver_unregister(&etnaviv_gpu_driver); + if (available_gpu) + platform_device_unregister(etnaviv_drm); platform_driver_unregister(&etnaviv_platform_driver); + platform_driver_unregister(&etnaviv_gpu_driver); } module_exit(etnaviv_exit); -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/1] drm/panel: Add support for Olimex LCD-OLinuXino panel
On Mon, Jun 25, 2018 at 09:44:35AM +0300, Stefan Mavrodiev wrote: > This patch adds Olimex Ltd. LCD-OLinuXino bridge panel driver. The > panel is used with different LCDs (currently from 480x272 to 1280x800). > Small EEPROM chip is used for identification, which holds some > factory data and timing requirements. > > Signed-off-by: Stefan Mavrodiev > --- > Changes for v2: > - Changed lcd_olinuxino_funcs to static const > > .../display/panel/olimex,lcd-olinuxino.txt | 42 +++ If there are further changes, please split to a separate patch. Otherwise, Reviewed-by: Rob Herring > MAINTAINERS| 6 + > drivers/gpu/drm/panel/Kconfig | 10 + > drivers/gpu/drm/panel/Makefile | 1 + > drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c | 360 > + > 5 files changed, 419 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/display/panel/olimex,lcd-olinuxino.txt > create mode 100644 drivers/gpu/drm/panel/panel-olimex-lcd-olinuxino.c ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/5] pci: export pcie_get_speed_cap and pcie_get_width_cap
So drivers can use them. This can be used to replace duplicate code in the drm subsystem. Signed-off-by: Alex Deucher --- drivers/pci/pci.c | 2 ++ include/linux/pci.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 97acba712e4e..22adaf35b136 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5222,6 +5222,7 @@ enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev) return PCI_SPEED_UNKNOWN; } +EXPORT_SYMBOL(pcie_get_speed_cap); /** * pcie_get_width_cap - query for the PCI device's link width capability @@ -5240,6 +5241,7 @@ enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev) return PCIE_LNK_WIDTH_UNKNOWN; } +EXPORT_SYMBOL(pcie_get_width_cap); /** * pcie_bandwidth_capable - calculate a PCI device's link bandwidth capability diff --git a/include/linux/pci.h b/include/linux/pci.h index 340029b2fb38..6e0c0803b241 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -261,6 +261,9 @@ enum pci_bus_speed { PCI_SPEED_UNKNOWN = 0xff, }; +enum pci_bus_speed pcie_get_speed_cap(struct pci_dev *dev); +enum pcie_link_width pcie_get_width_cap(struct pci_dev *dev); + struct pci_cap_saved_data { u16 cap_nr; boolcap_extended; -- 2.13.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/5] drm/amdgpu: update amd_pcie.h to include gen4 speeds
Internal header used by the driver to specify pcie gen speeds of the asic and chipset. Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/include/amd_pcie.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/include/amd_pcie.h b/drivers/gpu/drm/amd/include/amd_pcie.h index 5eb895fd98bf..9cb9ceb4d74d 100644 --- a/drivers/gpu/drm/amd/include/amd_pcie.h +++ b/drivers/gpu/drm/amd/include/amd_pcie.h @@ -27,6 +27,7 @@ #define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN10x0001 #define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN20x0002 #define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN30x0004 +#define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN40x0008 #define CAIL_PCIE_LINK_SPEED_SUPPORT_MASK0x #define CAIL_PCIE_LINK_SPEED_SUPPORT_SHIFT 16 @@ -34,6 +35,7 @@ #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 0x0001 #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2 0x0002 #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3 0x0004 +#define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN4 0x0008 #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_MASK 0x #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_SHIFT 0 -- 2.13.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/5] drm: use core pcie functionality for pcie gen/width
This series exports some pcie helper functions for use by drivers and fixes up the amdgpu and radeon drivers to use this core functionality rather than the duplicated functionality in the drm. Finally we remove the drm helpers since the duplicate the pcie functionality of the core. This also adds proper pcie gen4 detection for amdgpu. Alex Deucher (5): pci: export pcie_get_speed_cap and pcie_get_width_cap drm/amdgpu: update amd_pcie.h to include gen4 speeds drm/amdgpu: use pcie functions for link width and speed drm/radeon: use pcie functions for link width drm: drop drm_pcie_get_speed_cap_mask and drm_pcie_get_max_link_width drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 83 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c| 7 ++- drivers/gpu/drm/amd/amdgpu/ci_dpm.c| 3 +- drivers/gpu/drm/amd/amdgpu/si_dpm.c| 3 +- drivers/gpu/drm/amd/include/amd_pcie.h | 2 + drivers/gpu/drm/drm_pci.c | 58 - drivers/gpu/drm/radeon/ci_dpm.c| 20 +-- drivers/gpu/drm/radeon/cik.c | 22 drivers/gpu/drm/radeon/r600_dpm.c | 4 +- drivers/gpu/drm/radeon/radeon.h| 4 ++ drivers/gpu/drm/radeon/si.c| 22 drivers/gpu/drm/radeon/si_dpm.c| 20 +-- drivers/pci/pci.c | 2 + include/drm/drm_pci.h | 7 --- include/linux/pci.h| 3 ++ 15 files changed, 132 insertions(+), 128 deletions(-) -- 2.13.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 3/5] drm/amdgpu: use pcie functions for link width and speed
Use the newly exported pci functions to get the link width and speed rather than using the drm duplicated versions. Also query the GPU link caps directly rather than hardcoding them. Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 83 +- drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c| 7 ++- drivers/gpu/drm/amd/amdgpu/ci_dpm.c| 3 +- drivers/gpu/drm/amd/amdgpu/si_dpm.c| 3 +- 4 files changed, 65 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 6e5284e6c028..b70f44022813 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3290,8 +3290,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, */ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev) { - u32 mask; - int ret; + struct pci_dev *pdev; + enum pci_bus_speed speed_cap; + enum pcie_link_width link_width; if (amdgpu_pcie_gen_cap) adev->pm.pcie_gen_mask = amdgpu_pcie_gen_cap; @@ -3309,27 +3310,61 @@ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev) } if (adev->pm.pcie_gen_mask == 0) { - ret = drm_pcie_get_speed_cap_mask(adev->ddev, &mask); - if (!ret) { - adev->pm.pcie_gen_mask = (CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 | + /* asic caps */ + pdev = adev->pdev; + speed_cap = pcie_get_speed_cap(pdev); + if (speed_cap == PCI_SPEED_UNKNOWN) { + adev->pm.pcie_gen_mask |= (CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2 | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3); - - if (mask & DRM_PCIE_SPEED_25) - adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1; - if (mask & DRM_PCIE_SPEED_50) - adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2; - if (mask & DRM_PCIE_SPEED_80) - adev->pm.pcie_gen_mask |= CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3; } else { - adev->pm.pcie_gen_mask = AMDGPU_DEFAULT_PCIE_GEN_MASK; + if (speed_cap == PCIE_SPEED_16_0GT) + adev->pm.pcie_gen_mask |= (CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 | + CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2 | + CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3 | + CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN4); + else if (speed_cap == PCIE_SPEED_8_0GT) + adev->pm.pcie_gen_mask |= (CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 | + CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2 | + CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3); + else if (speed_cap == PCIE_SPEED_5_0GT) + adev->pm.pcie_gen_mask |= (CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 | + CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2); + else + adev->pm.pcie_gen_mask |= CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1; + } + /* platform caps */ + pdev = adev->ddev->pdev->bus->self; + speed_cap = pcie_get_speed_cap(pdev); + if (speed_cap == PCI_SPEED_UNKNOWN) { + adev->pm.pcie_gen_mask |= (CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1 | + CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2); + } else { + if (speed_cap == PCIE_SPEED_16_0GT) + adev->pm.pcie_gen_mask |= (CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1 | + CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 | + CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 | + CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4); + else if (speed_cap == PCIE_SPEED_8_0GT) + adev->pm.pcie_gen_mask |= (CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1 | + CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 | + CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3); + else if (speed_cap == PCIE_SPEED_5_0GT) +
[PATCH 5/5] drm: drop drm_pcie_get_speed_cap_mask and drm_pcie_get_max_link_width
These functions duplicated functionality which was ultimately added to the pci core. All users of these functions have been ported to using the newly exposed pci functionality. These functions are no longer used, so drop them. Signed-off-by: Alex Deucher --- drivers/gpu/drm/drm_pci.c | 58 --- include/drm/drm_pci.h | 7 -- 2 files changed, 65 deletions(-) diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 4db9c515b74f..896e42a34895 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c @@ -326,64 +326,6 @@ int drm_legacy_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) } EXPORT_SYMBOL(drm_legacy_pci_init); -int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *mask) -{ - struct pci_dev *root; - u32 lnkcap, lnkcap2; - - *mask = 0; - if (!dev->pdev) - return -EINVAL; - - root = dev->pdev->bus->self; - - /* we've been informed via and serverworks don't make the cut */ - if (root->vendor == PCI_VENDOR_ID_VIA || - root->vendor == PCI_VENDOR_ID_SERVERWORKS) - return -EINVAL; - - pcie_capability_read_dword(root, PCI_EXP_LNKCAP, &lnkcap); - pcie_capability_read_dword(root, PCI_EXP_LNKCAP2, &lnkcap2); - - if (lnkcap2) { /* PCIe r3.0-compliant */ - if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_2_5GB) - *mask |= DRM_PCIE_SPEED_25; - if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_5_0GB) - *mask |= DRM_PCIE_SPEED_50; - if (lnkcap2 & PCI_EXP_LNKCAP2_SLS_8_0GB) - *mask |= DRM_PCIE_SPEED_80; - } else {/* pre-r3.0 */ - if (lnkcap & PCI_EXP_LNKCAP_SLS_2_5GB) - *mask |= DRM_PCIE_SPEED_25; - if (lnkcap & PCI_EXP_LNKCAP_SLS_5_0GB) - *mask |= (DRM_PCIE_SPEED_25 | DRM_PCIE_SPEED_50); - } - - DRM_INFO("probing gen 2 caps for device %x:%x = %x/%x\n", root->vendor, root->device, lnkcap, lnkcap2); - return 0; -} -EXPORT_SYMBOL(drm_pcie_get_speed_cap_mask); - -int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw) -{ - struct pci_dev *root; - u32 lnkcap; - - *mlw = 0; - if (!dev->pdev) - return -EINVAL; - - root = dev->pdev->bus->self; - - pcie_capability_read_dword(root, PCI_EXP_LNKCAP, &lnkcap); - - *mlw = (lnkcap & PCI_EXP_LNKCAP_MLW) >> 4; - - DRM_INFO("probing mlw for device %x:%x = %x\n", root->vendor, root->device, lnkcap); - return 0; -} -EXPORT_SYMBOL(drm_pcie_get_max_link_width); - #else void drm_pci_agp_destroy(struct drm_device *dev) {} diff --git a/include/drm/drm_pci.h b/include/drm/drm_pci.h index 674599025d7d..8181e9e7cf1d 100644 --- a/include/drm/drm_pci.h +++ b/include/drm/drm_pci.h @@ -58,11 +58,4 @@ static inline int drm_get_pci_dev(struct pci_dev *pdev, } #endif -#define DRM_PCIE_SPEED_25 1 -#define DRM_PCIE_SPEED_50 2 -#define DRM_PCIE_SPEED_80 4 - -int drm_pcie_get_speed_cap_mask(struct drm_device *dev, u32 *speed_mask); -int drm_pcie_get_max_link_width(struct drm_device *dev, u32 *mlw); - #endif /* _DRM_PCI_H_ */ -- 2.13.6 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 4/5] drm/radeon: use pcie functions for link width
This is the last user of drm_pcie_get_speed_cap_mask. Use the pci version so we can drop drm_pcie_get_speed_cap_mask. Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/ci_dpm.c | 20 +++- drivers/gpu/drm/radeon/cik.c | 22 -- drivers/gpu/drm/radeon/r600_dpm.c | 4 ++-- drivers/gpu/drm/radeon/radeon.h | 4 drivers/gpu/drm/radeon/si.c | 22 -- drivers/gpu/drm/radeon/si_dpm.c | 20 +++- 6 files changed, 60 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index b9302c918271..d587779a80b4 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c @@ -5676,19 +5676,29 @@ int ci_dpm_init(struct radeon_device *rdev) u16 data_offset, size; u8 frev, crev; struct ci_power_info *pi; + enum pci_bus_speed speed_cap; + struct pci_dev *root = rdev->pdev->bus->self; int ret; - u32 mask; pi = kzalloc(sizeof(struct ci_power_info), GFP_KERNEL); if (pi == NULL) return -ENOMEM; rdev->pm.dpm.priv = pi; - ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); - if (ret) + speed_cap = pcie_get_speed_cap(root); + if (speed_cap == PCI_SPEED_UNKNOWN) { pi->sys_pcie_mask = 0; - else - pi->sys_pcie_mask = mask; + } else { + if (speed_cap == PCIE_SPEED_8_0GT) + pi->sys_pcie_mask = RADEON_PCIE_SPEED_25 | + RADEON_PCIE_SPEED_50 | + RADEON_PCIE_SPEED_80; + else if (speed_cap == PCIE_SPEED_5_0GT) + pi->sys_pcie_mask = RADEON_PCIE_SPEED_25 | + RADEON_PCIE_SPEED_50; + else + pi->sys_pcie_mask = RADEON_PCIE_SPEED_25; + } pi->force_pcie_gen = RADEON_PCIE_GEN_INVALID; pi->pcie_gen_performance.max = RADEON_PCIE_GEN1; diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 7c73bc7e2f85..ebce4601a305 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c @@ -9499,9 +9499,10 @@ int cik_set_vce_clocks(struct radeon_device *rdev, u32 evclk, u32 ecclk) static void cik_pcie_gen3_enable(struct radeon_device *rdev) { struct pci_dev *root = rdev->pdev->bus->self; + enum pci_bus_speed speed_cap; int bridge_pos, gpu_pos; - u32 speed_cntl, mask, current_data_rate; - int ret, i; + u32 speed_cntl, current_data_rate; + int i; u16 tmp16; if (pci_is_root_bus(rdev->pdev->bus)) @@ -9516,23 +9517,24 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev) if (!(rdev->flags & RADEON_IS_PCIE)) return; - ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask); - if (ret != 0) + speed_cap = pcie_get_speed_cap(root); + if (speed_cap == PCI_SPEED_UNKNOWN) return; - if (!(mask & (DRM_PCIE_SPEED_50 | DRM_PCIE_SPEED_80))) + if ((speed_cap != PCIE_SPEED_8_0GT) && + (speed_cap != PCIE_SPEED_5_0GT)) return; speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); current_data_rate = (speed_cntl & LC_CURRENT_DATA_RATE_MASK) >> LC_CURRENT_DATA_RATE_SHIFT; - if (mask & DRM_PCIE_SPEED_80) { + if (speed_cap == PCIE_SPEED_8_0GT) { if (current_data_rate == 2) { DRM_INFO("PCIE gen 3 link speeds already enabled\n"); return; } DRM_INFO("enabling PCIE gen 3 link speeds, disable with radeon.pcie_gen2=0\n"); - } else if (mask & DRM_PCIE_SPEED_50) { + } else if (speed_cap == PCIE_SPEED_5_0GT) { if (current_data_rate == 1) { DRM_INFO("PCIE gen 2 link speeds already enabled\n"); return; @@ -9548,7 +9550,7 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev) if (!gpu_pos) return; - if (mask & DRM_PCIE_SPEED_80) { + if (speed_cap == PCIE_SPEED_8_0GT) { /* re-try equalization if gen3 is not already enabled */ if (current_data_rate != 2) { u16 bridge_cfg, gpu_cfg; @@ -9636,9 +9638,9 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev) pci_read_config_word(rdev->pdev, gpu_pos + PCI_EXP_LNKCTL2, &tmp16); tmp16 &= ~0xf; - if (mask & DRM_PCIE_SPEED_80) + if (speed_cap == PCIE_SPEED_8_0GT) tmp16 |= 3; /* gen3 */ - else if (mask & DRM_PCIE_SPEED_50) + else if (speed_cap == PCIE_SPEED_5_0GT) tmp16 |= 2; /* gen2 */ else tmp16 |= 1; /* gen1 */ diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/dr
[Bug 107021] AMDGPU crash when Power Management switches off screen
https://bugs.freedesktop.org/show_bug.cgi?id=107021 --- Comment #1 from dwagner --- I have experienced the same symptom with plain X11 and xlock disabling the screen. And this wasn't a new bug - have seen this behaviour at least a year ago already. Given that I could work-around this by configuring X11 to not disable the screen, I did not bother to create a seperate bug report on this (especially given the much more grave system-crash-inducing instabilities that plague this driver :-( ) -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 102322] System crashes after "[drm] IP block:gmc_v8_0 is hung!" / [drm] IP block:sdma_v3_0 is hung!
https://bugs.freedesktop.org/show_bug.cgi?id=102322 --- Comment #5 from dwagner --- Just for the record: To rule out my personally compiled kernels are somehow "more buggy than what others compile", I tried the current Arch-Linux-supplied Linux 4.17.2-1-ARCH kernel. Survives about 5 minutes of Firefox-browsing between crashes with: Jun 20 00:01:11 ryzen kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring sdma0 timeout, last signaled seq=1895, last em> Jun 20 00:01:11 ryzen kernel: [drm] IP block:gmc_v8_0 is hung! (4.13.* did at least survive days.) -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 102322] System crashes after "[drm] IP block:gmc_v8_0 is hung!" / [drm] IP block:sdma_v3_0 is hung!
https://bugs.freedesktop.org/show_bug.cgi?id=102322 --- Comment #6 from Andrey Grodzovsky --- Verify you are using latest AMD firmware and up to date MESA/LLVM Firmware here (amdgpu folder) - https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/ Andrey -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 102322] System crashes after "[drm] IP block:gmc_v8_0 is hung!" / [drm] IP block:sdma_v3_0 is hung!
https://bugs.freedesktop.org/show_bug.cgi?id=102322 --- Comment #7 from dwagner --- (In reply to Andrey Grodzovsky from comment #6) > Verify you are using latest AMD firmware and up to date MESA/LLVM Firmware: pacman -Q linux-firmware linux-firmware 20180606.d114732-1 ll /usr/lib/firmware/amdgpu/vega10_vce.bin -rw-r--r-- 1 root root 165344 Jun 7 08:01 /usr/lib/firmware/amdgpu/vega10_vce.bin MESA: pacman -Q mesa mesa 18.1.2-1 LLVM: pacman -Q llvm-libs llvm-libs 6.0.0-4 Is this new enough? BTW: In a forum somebody asked what the dmesg output on crash looked like if I enabled amdgpu.gpu_recovery=1 - the result is a few lines more of output, but still a fatal system crash: Jun 26 00:50:09 ryzen kernel: [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx timeout, last signaled seq=12277, last emitted seq=12279 Jun 26 00:50:09 ryzen kernel: [drm] IP block:gmc_v8_0 is hung! Jun 26 00:50:09 ryzen kernel: [drm] IP block:gfx_v8_0 is hung! Jun 26 00:50:09 ryzen kernel: amdgpu :0a:00.0: GPU reset begin! Jun 26 00:50:15 ryzen kernel: [drm:drm_atomic_helper_wait_for_flip_done [drm_kms_helper]] *ERROR* [CRTC:42:crtc-0] flip_done timed out Jun 26 00:50:15 ryzen kernel: [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:42:crtc-0] flip_done timed out Jun 26 00:50:25 ryzen kernel: [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [PLANE:40:plane-4] flip_done timed out -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 4/4] drm/amdgpu: Dynamically probe for ATIF handle
The other day I was testing one of the HP laptops at my office with an i915/amdgpu hybrid setup and noticed that hotplugging was non-functional on almost all of the display outputs. I eventually discovered that all of the external outputs were connected to the amdgpu device instead of i915, and that the hotplugs weren't being detected so long as the GPU was in runtime suspend. After some talking with folks at AMD, I learned that amdgpu is actually supposed to support hotplug detection in runtime suspend so long as the OEM has implemented it properly in the firmware. On this HP ZBook 15 G4 (the machine in question), amdgpu wasn't managing to find the ATIF handle at all despite the fact that I could see acpi events being sent in response to any hotplugging. After going through dumps of the firmware, I discovered that this machine did in fact support ATIF, but that it's ATIF method lived in an entirely different namespace than this device's handle (the device handle was \_SB_.PCI0.PEG0.PEGP, but ATIF lives in ATPX's handle at \_SB_.PCI0.GFX0). So, fix this by probing ATPX's ACPI parent's namespace if we can't find ATIF elsewhere, along with storing a pointer to the proper handle to use for ATIF and using that instead of the device's handle. This fixes HPD detection while in runtime suspend for this ZBook! Signed-off-by: Lyude Paul --- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 80 +--- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c index 22c7e8ec0b9a..b0d7978c475d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -65,6 +65,8 @@ struct amdgpu_atif_functions { }; struct amdgpu_atif { + acpi_handle handle; + struct amdgpu_atif_notifications notifications; struct amdgpu_atif_functions functions; struct amdgpu_atif_notification_cfg notification_cfg; @@ -83,8 +85,9 @@ struct amdgpu_atif { * Executes the requested ATIF function (all asics). * Returns a pointer to the acpi output buffer. */ -static union acpi_object *amdgpu_atif_call(acpi_handle handle, int function, - struct acpi_buffer *params) +static union acpi_object *amdgpu_atif_call(struct amdgpu_atif *atif, + int function, + struct acpi_buffer *params) { acpi_status status; union acpi_object atif_arg_elements[2]; @@ -107,7 +110,8 @@ static union acpi_object *amdgpu_atif_call(acpi_handle handle, int function, atif_arg_elements[1].integer.value = 0; } - status = acpi_evaluate_object(handle, "ATIF", &atif_arg, &buffer); + status = acpi_evaluate_object(atif->handle, NULL, &atif_arg, + &buffer); /* Fail only if calling the method fails and ATIF is supported */ if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { @@ -178,15 +182,14 @@ static void amdgpu_atif_parse_functions(struct amdgpu_atif_functions *f, u32 mas * (all asics). * returns 0 on success, error on failure. */ -static int amdgpu_atif_verify_interface(acpi_handle handle, - struct amdgpu_atif *atif) +static int amdgpu_atif_verify_interface(struct amdgpu_atif *atif) { union acpi_object *info; struct atif_verify_interface output; size_t size; int err = 0; - info = amdgpu_atif_call(handle, ATIF_FUNCTION_VERIFY_INTERFACE, NULL); + info = amdgpu_atif_call(atif, ATIF_FUNCTION_VERIFY_INTERFACE, NULL); if (!info) return -EIO; @@ -213,6 +216,36 @@ static int amdgpu_atif_verify_interface(acpi_handle handle, return err; } +static acpi_handle amdgpu_atif_probe_handle(acpi_handle dhandle) +{ + acpi_handle handle = NULL; + char acpi_method_name[255] = { 0 }; + struct acpi_buffer buffer = { sizeof(acpi_method_name), acpi_method_name }; + acpi_status status; + + /* First check the device handle */ + status = acpi_get_handle(dhandle, "ATIF", &handle); + if (ACPI_SUCCESS(status)) + goto out; + + /* Some vendors stick the ATIF methods in the same namespace as the +* ATPX methods +*/ + if (amdgpu_has_atpx()) { + status = acpi_get_handle(amdgpu_atpx_get_dhandle(), "ATIF", +&handle); + if (ACPI_SUCCESS(status)) + goto out; + } + + DRM_DEBUG_DRIVER("No ATIF handle found\n"); + return NULL; +out: + acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); + DRM_DEBUG_DRIVER("Found ATIF handle %s\n", acpi_method_name); + return handle; +} + /** * amdgpu_atif_get_notification_params - determine notify configuration * @@ -225,15 +258,16 @@ static int amdgpu_atif_verify_interface(acpi_handle handle,
[PATCH 2/4] drm/amdgpu: s/disp_detetion_ports/disp_detection_ports/
Signed-off-by: Lyude Paul --- drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 1ae5ae8c45a4..717cc5a90313 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c @@ -32,7 +32,7 @@ struct amdgpu_atpx_functions { bool switch_start; bool switch_end; bool disp_connectors_mapping; - bool disp_detetion_ports; + bool disp_detection_ports; }; struct amdgpu_atpx { @@ -156,7 +156,7 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas f->switch_start = mask & ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED; f->switch_end = mask & ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED; f->disp_connectors_mapping = mask & ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED; - f->disp_detetion_ports = mask & ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED; + f->disp_detection_ports = mask & ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED; } /** -- 2.17.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/4] drm/amdgpu: Make struct amdgpu_atif private to amdgpu_acpi.c
Currently, there is nothing in amdgpu that actually uses these structs other than amdgpu_acpi.c. Additionally, since we're about to start saving the correct ACPI handle to use for calling ATIF in this struct this saves us from having to handle making sure that the acpi_handle (and by proxy, the type definition for acpi_handle and all of the other acpi headers) doesn't need to be included within the amdgpu_drv struct itself. This follows the example set by amdgpu_atpx_handler.c. Signed-off-by: Lyude Paul --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 40 +- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 54 ++-- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index c8b605f3dc05..e7e70518748a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -188,6 +188,7 @@ struct amdgpu_job; struct amdgpu_irq_src; struct amdgpu_fpriv; struct amdgpu_bo_va_mapping; +struct amdgpu_atif; enum amdgpu_cp_irq { AMDGPU_CP_IRQ_GFX_EOP = 0, @@ -1246,43 +1247,6 @@ struct amdgpu_vram_scratch { /* * ACPI */ -struct amdgpu_atif_notification_cfg { - bool enabled; - int command_code; -}; - -struct amdgpu_atif_notifications { - bool display_switch; - bool expansion_mode_change; - bool thermal_state; - bool forced_power_state; - bool system_power_state; - bool display_conf_change; - bool px_gfx_switch; - bool brightness_change; - bool dgpu_display_event; -}; - -struct amdgpu_atif_functions { - bool system_params; - bool sbios_requests; - bool select_active_disp; - bool lid_state; - bool get_tv_standard; - bool set_tv_standard; - bool get_panel_expansion_mode; - bool set_panel_expansion_mode; - bool temperature_change; - bool graphics_device_types; -}; - -struct amdgpu_atif { - struct amdgpu_atif_notifications notifications; - struct amdgpu_atif_functions functions; - struct amdgpu_atif_notification_cfg notification_cfg; - struct amdgpu_encoder *encoder_for_bl; -}; - struct amdgpu_atcs_functions { bool get_ext_state; bool pcie_perf_req; @@ -1430,7 +1394,7 @@ struct amdgpu_device { #if defined(CONFIG_DEBUG_FS) struct dentry *debugfs_regs[AMDGPU_DEBUGFS_MAX_COMPONENTS]; #endif - struct amdgpu_atif atif; + struct amdgpu_atif *atif; struct amdgpu_atcs atcs; struct mutexsrbm_mutex; /* GRBM index mutex. Protects concurrent access to GRBM index */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c index 8fa850a070e0..22c7e8ec0b9a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -34,6 +34,43 @@ #include "amd_acpi.h" #include "atom.h" +struct amdgpu_atif_notification_cfg { + bool enabled; + int command_code; +}; + +struct amdgpu_atif_notifications { + bool display_switch; + bool expansion_mode_change; + bool thermal_state; + bool forced_power_state; + bool system_power_state; + bool display_conf_change; + bool px_gfx_switch; + bool brightness_change; + bool dgpu_display_event; +}; + +struct amdgpu_atif_functions { + bool system_params; + bool sbios_requests; + bool select_active_disp; + bool lid_state; + bool get_tv_standard; + bool set_tv_standard; + bool get_panel_expansion_mode; + bool set_panel_expansion_mode; + bool temperature_change; + bool graphics_device_types; +}; + +struct amdgpu_atif { + struct amdgpu_atif_notifications notifications; + struct amdgpu_atif_functions functions; + struct amdgpu_atif_notification_cfg notification_cfg; + struct amdgpu_encoder *encoder_for_bl; +}; + /* Call the ATIF method */ /** @@ -292,7 +329,7 @@ static int amdgpu_atif_get_sbios_requests(acpi_handle handle, static int amdgpu_atif_handler(struct amdgpu_device *adev, struct acpi_bus_event *event) { - struct amdgpu_atif *atif = &adev->atif; + struct amdgpu_atif *atif = adev->atif; struct atif_sbios_requests req; acpi_handle handle; int count; @@ -303,7 +340,8 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev, if (strcmp(event->device_class, ACPI_VIDEO_CLASS) != 0) return NOTIFY_DONE; - if (!atif->notification_cfg.enabled || + if (!atif || + !atif->notification_cfg.enabled || event->type != atif->notification_cfg.command_code) /* Not our event */ return NOTIFY_DONE; @@ -642,7 +680,7 @@ static int amdgpu_acpi_event(struct notifier_block *nb, int amdgpu_acpi_init(struct amd
[PATCH 3/4] drm/amdgpu: Add amdgpu_atpx_get_dhandle()
Since it seems that some vendors are storing the ATIF ACPI methods under the same handle that ATPX lives under instead of the device's own handle, we're going to need to be able to retrieve this handle later so we can probe for ATIF there. Signed-off-by: Lyude Paul --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 6 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index e7e70518748a..06401f0cde6d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1819,6 +1819,12 @@ static inline bool amdgpu_atpx_dgpu_req_power_for_displays(void) { return false; static inline bool amdgpu_has_atpx(void) { return false; } #endif +#if defined(CONFIG_VGA_SWITCHEROO) && defined(CONFIG_ACPI) +void *amdgpu_atpx_get_dhandle(void); +#else +static inline void *amdgpu_atpx_get_dhandle(void) { return NULL; } +#endif + /* * KMS */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 717cc5a90313..8a46073f0778 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c @@ -90,6 +90,12 @@ bool amdgpu_atpx_dgpu_req_power_for_displays(void) { return amdgpu_atpx_priv.atpx.dgpu_req_power_for_displays; } +#if defined(CONFIG_ACPI) +void *amdgpu_atpx_get_dhandle(void) { + return amdgpu_atpx_priv.dhandle; +} +#endif + /** * amdgpu_atpx_call - call an ATPX method * -- 2.17.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 0/4] Fix HPD detection in runtime suspend
Does what it says on the label, more information in the patches Lyude Paul (4): drm/amdgpu: Make struct amdgpu_atif private to amdgpu_acpi.c drm/amdgpu: s/disp_detetion_ports/disp_detection_ports/ drm/amdgpu: Add amdgpu_atpx_get_dhandle() drm/amdgpu: Dynamically probe for ATIF handle drivers/gpu/drm/amd/amdgpu/amdgpu.h | 46 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 132 +++--- .../gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 10 +- 3 files changed, 125 insertions(+), 63 deletions(-) -- 2.17.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/vkms: Add vblank events simulated by hrtimers
On 06/25, Ville Syrjälä wrote: > On Mon, Jun 25, 2018 at 02:19:22PM -0300, Rodrigo Siqueira wrote: > > This commit adds regular vblank events simulated through hrtimers, which > > is a feature required by VKMS to mimic real hardware. In this sense, > > this commit adopts a default frequency of 60Hz for vblank interval. > > Finally, this commit implements handlers for some of the atomic and > > vblank hooks. > > > > Signed-off-by: Rodrigo Siqueira > > --- > > Note: > > - This patch depends on the patchset "drm/vkms: Updates to meet basic > > kms_flip requirements" > > link: > > https://lists.freedesktop.org/archives/dri-devel/2018-June/180823.html > > > > drivers/gpu/drm/vkms/vkms_crtc.c | 90 +++- > > drivers/gpu/drm/vkms/vkms_drv.c | 6 +++ > > drivers/gpu/drm/vkms/vkms_drv.h | 9 > > 3 files changed, 103 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c > > b/drivers/gpu/drm/vkms/vkms_crtc.c > > index 84cc05506b09..73aae129c37d 100644 > > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > > @@ -10,6 +10,52 @@ > > #include > > #include > > > > +static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) > > +{ > > + struct vkms_output *output = container_of(timer, struct vkms_output, > > + vblank_hrtimer); > > + struct drm_crtc *crtc = &output->crtc; > > + unsigned long flags; > > + int ret_overrun; > > + bool ret; > > + > > + ret = drm_crtc_handle_vblank(&output->crtc); > > + if (!ret) > > + DRM_ERROR("vkms failure on handling vblank"); > > + > > + spin_lock_irqsave(&crtc->dev->event_lock, flags); > > + if (output->event) { > > + drm_crtc_send_vblank_event(crtc, output->event); > > + drm_crtc_vblank_put(crtc); > > + output->event = NULL; > > + } > > + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); > > + > > + ret_overrun = hrtimer_forward_now(&output->vblank_hrtimer, > > + output->period_ns); > > + > > + return HRTIMER_RESTART; > > +} > > + > > +static int vkms_enable_vblank(struct drm_crtc *crtc) > > +{ > > + struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > > + > > + hrtimer_init(&out->vblank_hrtimer, CLOCK_REALTIME, HRTIMER_MODE_ABS); > > + out->vblank_hrtimer.function = &vkms_vblank_simulate; > > + out->period_ns = ktime_set(0, DEFAULT_VBLANK_NS); > > Don't you want the vblank interval to roughly match the crtc timings the > user asked for? Hi, We want to provide interactions with users by allowing them to specify the Vblank interval (and maybe other things); I hardcoded it for simplicity sake since my focus now it is simulates real hardware and later virtual hardware. However, IMHO the best way to provide this interaction in the VKMS is via sysfs; another option could be use a module parameter especified during the load, but I'm not sure if this is a good approach. Thanks for your feedback Best Regards, Rodrigo Siqueira > > + hrtimer_start(&out->vblank_hrtimer, out->period_ns, HRTIMER_MODE_ABS); > > + > > + return 0; > > +} > > + > > +static void vkms_disable_vblank(struct drm_crtc *crtc) > > +{ > > + struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > > + > > + hrtimer_cancel(&out->vblank_hrtimer); > > +} > > + > > static const struct drm_crtc_funcs vkms_crtc_funcs = { > > .set_config = drm_atomic_helper_set_config, > > .destroy= drm_crtc_cleanup, > > @@ -17,6 +63,8 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { > > .reset = drm_atomic_helper_crtc_reset, > > .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, > > .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, > > + .enable_vblank = vkms_enable_vblank, > > + .disable_vblank = vkms_disable_vblank, > > }; > > > > static int vkms_crtc_atomic_check(struct drm_crtc *crtc, > > @@ -27,12 +75,50 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc, > > > > static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, > > struct drm_crtc_state *old_state) > > +{ > > + drm_crtc_vblank_on(crtc); > > +} > > + > > +static void vkms_crtc_atomic_begin(struct drm_crtc *crtc, > > + struct drm_crtc_state *old_s) > > +{ > > + struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc); > > + > > + if (crtc->state->event) { > > + crtc->state->event->pipe = drm_crtc_index(crtc); > > + WARN_ON(drm_crtc_vblank_get(crtc) != 0); > > + > > + vkms_output->event = crtc->state->event; > > + crtc->state->event = NULL; > > + } > > +} > > + > > +static void vkms_crtc_atomic_flush(struct drm_crtc *crtc, > > + struct drm_crtc_state *old_crtc_state) > > +{ > > + s
Re: [PATCH 2/2] i2c: algos: bit: mention our experience about initial states
On Sat, Jun 16, 2018 at 10:37:57PM +0900, Wolfram Sang wrote: > So, if somebody wants to re-implement this in the future, we pinpoint to > a problem case. > > Signed-off-by: Wolfram Sang Applied to for-current, thanks! ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/2] Revert "i2c: algo-bit: init the bus to a known state"
On Sat, Jun 16, 2018 at 10:37:56PM +0900, Wolfram Sang wrote: > This reverts commit 3e5f06bed72fe72166a6778f630241a893f67799. As per > bugzilla #200045, this caused a regression. I don't really see a way to > fix it without having the hardware. So, revert the patch and I will fix > the issue I was seeing originally in the i2c-gpio driver itself. I > couldn't find new users of this algorithm since, so there should be no > one depending on the new behaviour. > > Reported-by: Sergey Larin > Fixes: 3e5f06bed72f ("i2c: algo-bit: init the bus to a known state") > Signed-off-by: Wolfram Sang Applied to for-current, thanks! ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 05/10] drm/amdgpu_dm/crc: Implement verify_crc_source callback
This patch implements "verify_crc_source" callback function for AMD drm driver. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 4 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 16 3 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index a1dd49545a5b..95aec2903add 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2565,6 +2565,7 @@ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { .atomic_duplicate_state = dm_crtc_duplicate_state, .atomic_destroy_state = dm_crtc_destroy_state, .set_crc_source = amdgpu_dm_crtc_set_crc_source, + .verify_crc_source = amdgpu_dm_crtc_verify_crc_source, .enable_vblank = dm_enable_vblank, .disable_vblank = dm_disable_vblank, }; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index d5aa89ad5571..79b0a16652b9 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -263,9 +263,13 @@ amdgpu_dm_remove_sink_from_freesync_module(struct drm_connector *connector); #ifdef CONFIG_DEBUG_FS int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, size_t *values_cnt); +int amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, +const char *src_name, +size_t *values_cnt); void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc); #else #define amdgpu_dm_crtc_set_crc_source NULL +#define amdgpu_dm_crtc_verify_crc_source NULL #define amdgpu_dm_crtc_handle_crc_irq(x) #endif diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c index 52f2c01349e3..dfcca594d52a 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c @@ -46,6 +46,22 @@ static enum amdgpu_dm_pipe_crc_source dm_parse_crc_source(const char *source) return AMDGPU_DM_PIPE_CRC_SOURCE_INVALID; } +int +amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, const char *src_name, +size_t *values_cnt) +{ + enum amdgpu_dm_pipe_crc_source source = dm_parse_crc_source(src_name); + + if (source < 0) { + DRM_DEBUG_DRIVER("Unknown CRC source %s for CRTC%d\n", +src_name, crtc->index); + return -EINVAL; + } + + *values_cnt = 3; + return 0; +} + int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, size_t *values_cnt) { -- 2.16.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 01/10] drm: crc: Introduce verify_crc_source callback
This patch adds a new callback function "verify_crc_source" which will be used during setting the crc source in control node and while opening data node for crc reading. This will help in avoiding setting of wrong string for source. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/drm_debugfs_crc.c | 15 +++ include/drm/drm_crtc.h| 15 +++ 2 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 9f8312137cad..c6a725b79ac6 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -87,6 +87,8 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf, struct drm_crtc *crtc = m->private; struct drm_crtc_crc *crc = &crtc->crc; char *source; + size_t values_cnt; + int ret = 0; if (len == 0) return 0; @@ -104,6 +106,12 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf, if (source[len] == '\n') source[len] = '\0'; + if (crtc->funcs->verify_crc_source) { + ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt); + if (ret) + return ret; + } + spin_lock_irq(&crc->lock); if (crc->opened) { @@ -167,6 +175,13 @@ static int crtc_crc_open(struct inode *inode, struct file *filep) return ret; } + if (crtc->funcs->verify_crc_source) { + ret = crtc->funcs->verify_crc_source(crtc, crc->source, +&values_cnt); + if (ret) + return ret; + } + spin_lock_irq(&crc->lock); if (!crc->opened) crc->opened = true; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 23eddbccab10..1a6dcbf91744 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -661,6 +661,21 @@ struct drm_crtc_funcs { */ int (*set_crc_source)(struct drm_crtc *crtc, const char *source, size_t *values_cnt); + /** +* @verify_crc_source: +* +* verifies the source of CRC checksums of frames before setting the +* source for CRC and during crc open. +* +* This callback is optional if the driver does not support any CRC +* generation functionality. +* +* RETURNS: +* +* 0 on success or a negative error code on failure. +*/ + int (*verify_crc_source)(struct drm_crtc *crtc, const char *source, +size_t *values_cnt); /** * @atomic_print_state: -- 2.16.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 03/10] drm: crc: Introduce get_crc_sources callback
This patch implements a callback function "get_crc_sources" which will be called during read of control node. It is an optional callback function and if driver implements this callback, driver should print list of available CRC sources in seq_file privided as an input to the callback. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/drm_debugfs_crc.c | 3 +++ include/drm/drm_crtc.h| 10 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 2b4a737c5aeb..2751d124387d 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -68,6 +68,9 @@ static int crc_control_show(struct seq_file *m, void *data) { struct drm_crtc *crtc = m->private; + if (crtc->funcs->get_crc_sources) + crtc->funcs->get_crc_sources(m, crtc); + seq_printf(m, "%s\n", crtc->crc.source); return 0; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index bae432469616..b3824f92c190 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -690,6 +690,16 @@ struct drm_crtc_funcs { * 0 on success or a negative error code on failure. */ int (*pre_crc_read)(struct drm_crtc *crtc); + /** +* @get_crc_sources: +* +* prints a list of available valid sources for CRC generation on +* seq_file +* +* This callback is optional if the driver does not support exporting of +* possible CRC sources list +*/ + void (*get_crc_sources)(struct seq_file *m, struct drm_crtc *crtc); /** * @atomic_print_state: -- 2.16.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 02/10] drm: crc: Introduce pre_crc_read function
This patch implements a callback function "pre_crc_read" which will be called before crc read. In this function driver can implement and preparation work required for successfully reading CRC data. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/drm_debugfs_crc.c | 8 include/drm/drm_crtc.h| 14 ++ 2 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index c6a725b79ac6..2b4a737c5aeb 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -278,6 +278,14 @@ static ssize_t crtc_crc_read(struct file *filep, char __user *user_buf, return 0; } + if (crtc->funcs->pre_crc_read) { + ret = crtc->funcs->pre_crc_read(crtc); + if (ret) { + spin_unlock_irq(&crc->lock); + return ret; + } + } + /* Nothing to read? */ while (crtc_crc_data_count(crc) == 0) { if (filep->f_flags & O_NONBLOCK) { diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 1a6dcbf91744..bae432469616 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -676,6 +676,20 @@ struct drm_crtc_funcs { */ int (*verify_crc_source)(struct drm_crtc *crtc, const char *source, size_t *values_cnt); + /** +* @pre_crc_read: +* +* Driver callback for performing any preparation work required by +* driver before reading CRC +* +* This callback is optional if the driver does not support CRC +* generation or no prework is required before reading the crc +* +* RETURNS: +* +* 0 on success or a negative error code on failure. +*/ + int (*pre_crc_read)(struct drm_crtc *crtc); /** * @atomic_print_state: -- 2.16.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 07/10] drm/i915/crc: implement verify_crc_source callback
This patch implements verify_crc_source callback function introduced earlier in this series. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/i915/intel_display.c | 1 + drivers/gpu/drm/i915/intel_drv.h | 3 + drivers/gpu/drm/i915/intel_pipe_crc.c | 108 ++ 3 files changed, 112 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3709fa1b6318..c0eb752b0901 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -12893,6 +12893,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { .atomic_duplicate_state = intel_crtc_duplicate_state, .atomic_destroy_state = intel_crtc_destroy_state, .set_crc_source = intel_crtc_set_crc_source, + .verify_crc_source = intel_crtc_verify_crc_source, }; struct wait_rps_boost { diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 578346b8d7e2..64e13adad9f5 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -2154,10 +2154,13 @@ int intel_pipe_crc_create(struct drm_minor *minor); #ifdef CONFIG_DEBUG_FS int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, size_t *values_cnt); +int intel_crtc_verify_crc_source(struct drm_crtc *crtc, +const char *source_name, size_t *values_cnt); void intel_crtc_disable_pipe_crc(struct intel_crtc *crtc); void intel_crtc_enable_pipe_crc(struct intel_crtc *crtc); #else #define intel_crtc_set_crc_source NULL +#define intel_crtc_verify_crc_source NULL static inline void intel_crtc_disable_pipe_crc(struct intel_crtc *crtc) { } diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c index 39a4e4edda07..a37521380f94 100644 --- a/drivers/gpu/drm/i915/intel_pipe_crc.c +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c @@ -913,6 +913,114 @@ int intel_pipe_crc_create(struct drm_minor *minor) return 0; } +static int i8xx_crc_source_valid(struct drm_i915_private *dev_priv, +const enum intel_pipe_crc_source source) +{ + switch (source) { + case INTEL_PIPE_CRC_SOURCE_PIPE: + case INTEL_PIPE_CRC_SOURCE_NONE: + return 0; + default: + return -EINVAL; + } +} + +static int i9xx_crc_source_valid(struct drm_i915_private *dev_priv, +const enum intel_pipe_crc_source source) +{ + switch (source) { + case INTEL_PIPE_CRC_SOURCE_PIPE: + case INTEL_PIPE_CRC_SOURCE_TV: + case INTEL_PIPE_CRC_SOURCE_DP_B: + case INTEL_PIPE_CRC_SOURCE_DP_C: + case INTEL_PIPE_CRC_SOURCE_DP_D: + case INTEL_PIPE_CRC_SOURCE_NONE: + return 0; + default: + return -EINVAL; + } +} + +static int vlv_crc_source_valid(struct drm_i915_private *dev_priv, + const enum intel_pipe_crc_source source) +{ + switch (source) { + case INTEL_PIPE_CRC_SOURCE_PIPE: + case INTEL_PIPE_CRC_SOURCE_DP_B: + case INTEL_PIPE_CRC_SOURCE_DP_C: + case INTEL_PIPE_CRC_SOURCE_DP_D: + case INTEL_PIPE_CRC_SOURCE_NONE: + return 0; + default: + return -EINVAL; + } +} + +static int ilk_crc_source_valid(struct drm_i915_private *dev_priv, + const enum intel_pipe_crc_source source) +{ + switch (source) { + case INTEL_PIPE_CRC_SOURCE_PIPE: + case INTEL_PIPE_CRC_SOURCE_PLANE1: + case INTEL_PIPE_CRC_SOURCE_PLANE2: + case INTEL_PIPE_CRC_SOURCE_NONE: + return 0; + default: + return -EINVAL; + } +} + +static int ivb_crc_source_valid(struct drm_i915_private *dev_priv, + const enum intel_pipe_crc_source source) +{ + switch (source) { + case INTEL_PIPE_CRC_SOURCE_PIPE: + case INTEL_PIPE_CRC_SOURCE_PLANE1: + case INTEL_PIPE_CRC_SOURCE_PLANE2: + case INTEL_PIPE_CRC_SOURCE_PF: + case INTEL_PIPE_CRC_SOURCE_NONE: + return 0; + default: + return -EINVAL; + } +} + +static int +intel_is_valid_crc_source(struct drm_i915_private *dev_priv, + const enum intel_pipe_crc_source source) +{ + if (IS_GEN2(dev_priv)) + return i8xx_crc_source_valid(dev_priv, source); + else if (INTEL_GEN(dev_priv) < 5) + return i9xx_crc_source_valid(dev_priv, source); + else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) + return vlv_crc_source_valid(dev_priv, source); + else if (IS_GEN5(dev_priv) || IS_GEN6(dev_priv)) + return ilk_crc_source_valid(dev_priv, source); + else + return ivb_crc_source_valid(dev_priv, source); +} + +int inte
[PATCH 04/10] drm/rockchip/crc: Implement verify_crc_source callback
This patch implements "verify_crc_source" callback function for rockchip drm driver. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 21 + 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index c9222119767d..ea4884ac4cb0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1138,12 +1138,32 @@ static int vop_crtc_set_crc_source(struct drm_crtc *crtc, return ret; } + +static int +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, + size_t *values_cnt) +{ + if ((source_name && strcmp(source_name, "auto") == 0) || !source_name) { + *values_cnt = 3; + return 0; + } + + return -EINVAL; +} + #else static int vop_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, size_t *values_cnt) { return -ENODEV; } + +static int +vop_crtc_verify_crc_source(struct drm_crtc *crtc, const char *source_name, + size_t *values_cnt) +{ + return -ENODEV; +} #endif static const struct drm_crtc_funcs vop_crtc_funcs = { @@ -1156,6 +1176,7 @@ static const struct drm_crtc_funcs vop_crtc_funcs = { .enable_vblank = vop_crtc_enable_vblank, .disable_vblank = vop_crtc_disable_vblank, .set_crc_source = vop_crtc_set_crc_source, + .verify_crc_source = vop_crtc_verify_crc_source, }; static void vop_fb_unref_worker(struct drm_flip_work *work, void *val) -- 2.16.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 09/10] drm/crc: Cleanup crtc_crc_open function
This patch make changes to allocate crc-entries buffer before enabling CRC generation. It moves all the failure check early in the function before setting the source or memory allocation. Now set_crc_source takes only two variable input, values_cnt we already gets as part of verify_crc_source. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 4 +- drivers/gpu/drm/drm_debugfs_crc.c | 52 +- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_pipe_crc.c | 4 +- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 5 +-- drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 6 +-- include/drm/drm_crtc.h | 3 +- 8 files changed, 30 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 79b0a16652b9..a7a5551fee1b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -261,8 +261,7 @@ amdgpu_dm_remove_sink_from_freesync_module(struct drm_connector *connector); /* amdgpu_dm_crc.c */ #ifdef CONFIG_DEBUG_FS -int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, - size_t *values_cnt); +int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name); int amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, const char *src_name, size_t *values_cnt); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c index dfcca594d52a..e7ad528f5853 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c @@ -62,8 +62,7 @@ amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, const char *src_name, return 0; } -int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, - size_t *values_cnt) +int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) { struct dm_crtc_state *crtc_state = to_dm_crtc_state(crtc->state); struct dc_stream_state *stream_state = crtc_state->stream; @@ -99,7 +98,6 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, return -EINVAL; } - *values_cnt = 3; /* Reset crc_skipped on dm state */ crtc_state->crc_skip_count = 0; return 0; diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 2751d124387d..834bc7ee5550 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -109,11 +109,9 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf, if (source[len] == '\n') source[len] = '\0'; - if (crtc->funcs->verify_crc_source) { - ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt); - if (ret) - return ret; - } + ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt); + if (ret) + return ret; spin_lock_irq(&crc->lock); @@ -178,12 +176,15 @@ static int crtc_crc_open(struct inode *inode, struct file *filep) return ret; } - if (crtc->funcs->verify_crc_source) { - ret = crtc->funcs->verify_crc_source(crtc, crc->source, -&values_cnt); - if (ret) - return ret; - } + ret = crtc->funcs->verify_crc_source(crtc, crc->source, &values_cnt); + if (ret) + return ret; + + if (WARN_ON(values_cnt > DRM_MAX_CRC_NR)) + return -EINVAL; + + if (WARN_ON(values_cnt == 0)) + return -EINVAL; spin_lock_irq(&crc->lock); if (!crc->opened) @@ -195,30 +196,22 @@ static int crtc_crc_open(struct inode *inode, struct file *filep) if (ret) return ret; - ret = crtc->funcs->set_crc_source(crtc, crc->source, &values_cnt); - if (ret) - goto err; - - if (WARN_ON(values_cnt > DRM_MAX_CRC_NR)) { - ret = -EINVAL; - goto err_disable; - } - - if (WARN_ON(values_cnt == 0)) { - ret = -EINVAL; - goto err_disable; - } - entries = kcalloc(DRM_CRC_ENTRIES_NR, sizeof(*entries), GFP_KERNEL); if (!entries) { ret = -ENOMEM; - goto err_disable; + goto err; } spin_lock_irq(&crc->lock); crc->entries = entries;
[PATCH 06/10] drm/rcar-du/crc: Implement verify_crc_source callback
This patch implements "verify_crc_source" callback function for rcar drm driver. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 40 ++ 1 file changed, 40 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 15dc9caa128b..24eeaa7e14d7 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -756,6 +756,45 @@ static void rcar_du_crtc_disable_vblank(struct drm_crtc *crtc) rcrtc->vblank_enable = false; } +static int rcar_du_crtc_verify_crc_source(struct drm_crtc *crtc, + const char *source_name, + size_t *values_cnt) +{ + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); + unsigned int index = 0; + unsigned int i; + int ret; + + /* +* Parse the source name. Supported values are "plane%u" to compute the +* CRC on an input plane (%u is the plane ID), and "auto" to compute the +* CRC on the composer (VSP) output. +*/ + if (!source_name || !strcmp(source_name, "auto")) { + goto out; + } else if (strstarts(source_name, "plane")) { + ret = kstrtouint(source_name + strlen("plane"), 10, &index); + if (ret < 0) + return ret; + + for (i = 0; i < rcrtc->vsp->num_planes; ++i) { + if (index == rcrtc->vsp->planes[i].plane.base.id) { + index = i; + break; + } + } + + if (i >= rcrtc->vsp->num_planes) + return -EINVAL; + } else { + return -EINVAL; + } + +out: + *values_cnt = 1; + return 0; +} + static int rcar_du_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, size_t *values_cnt) @@ -861,6 +900,7 @@ static const struct drm_crtc_funcs crtc_funcs_gen3 = { .enable_vblank = rcar_du_crtc_enable_vblank, .disable_vblank = rcar_du_crtc_disable_vblank, .set_crc_source = rcar_du_crtc_set_crc_source, + .verify_crc_source = rcar_du_crtc_verify_crc_source, }; /* - -- 2.16.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 10/10] Revert "drm: crc: Wait for a frame before returning from open()"
This reverts commit e8fa5671183c80342d520ad81d14fa79a9d4a680. Don't wait for first CRC during crtc_crc_open. It avoids one frame wait during open. If application want to wait after read call, it can use poll/read blocking read() call. Suggested-by: Ville Syrjälä Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org Cc: Tomeu Vizoso --- drivers/gpu/drm/drm_debugfs_crc.c | 16 1 file changed, 16 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 834bc7ee5550..69ec2728727e 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -211,24 +211,8 @@ static int crtc_crc_open(struct inode *inode, struct file *filep) if (ret) goto err; - spin_lock_irq(&crc->lock); - /* -* Only return once we got a first frame, so userspace doesn't have to -* guess when this particular piece of HW will be ready to start -* generating CRCs. -*/ - ret = wait_event_interruptible_lock_irq(crc->wq, - crtc_crc_data_count(crc), - crc->lock); - spin_unlock_irq(&crc->lock); - - if (ret) - goto err_disable; - return 0; -err_disable: - crtc->funcs->set_crc_source(crtc, NULL); err: spin_lock_irq(&crc->lock); crtc_crc_cleanup(crc); -- 2.16.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 06/10] drm/rcar-du/crc: Implement verify_crc_source callback
Cc: Laurent Pinchart On 6/26/2018 11:52 AM, Mahesh Kumar wrote: This patch implements "verify_crc_source" callback function for rcar drm driver. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 40 ++ 1 file changed, 40 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 15dc9caa128b..24eeaa7e14d7 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -756,6 +756,45 @@ static void rcar_du_crtc_disable_vblank(struct drm_crtc *crtc) rcrtc->vblank_enable = false; } +static int rcar_du_crtc_verify_crc_source(struct drm_crtc *crtc, + const char *source_name, + size_t *values_cnt) +{ + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc); + unsigned int index = 0; + unsigned int i; + int ret; + + /* +* Parse the source name. Supported values are "plane%u" to compute the +* CRC on an input plane (%u is the plane ID), and "auto" to compute the +* CRC on the composer (VSP) output. +*/ + if (!source_name || !strcmp(source_name, "auto")) { + goto out; + } else if (strstarts(source_name, "plane")) { + ret = kstrtouint(source_name + strlen("plane"), 10, &index); + if (ret < 0) + return ret; + + for (i = 0; i < rcrtc->vsp->num_planes; ++i) { + if (index == rcrtc->vsp->planes[i].plane.base.id) { + index = i; + break; + } + } + + if (i >= rcrtc->vsp->num_planes) + return -EINVAL; + } else { + return -EINVAL; + } + +out: + *values_cnt = 1; + return 0; +} + static int rcar_du_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, size_t *values_cnt) @@ -861,6 +900,7 @@ static const struct drm_crtc_funcs crtc_funcs_gen3 = { .enable_vblank = rcar_du_crtc_enable_vblank, .disable_vblank = rcar_du_crtc_disable_vblank, .set_crc_source = rcar_du_crtc_set_crc_source, + .verify_crc_source = rcar_du_crtc_verify_crc_source, }; /* - ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 00/10] Improve crc-core driver interface
Cc:dri-devel@lists.freedesktop.org On 6/26/2018 11:52 AM, Mahesh Kumar wrote: This series improves crc-core <-> driver interface. This series adds following functionality in the crc-core - Now control node will print all the available sources if implemented by driver along with current source. - Setting of sorce will fail if provided source is not supported - cleanup of crtc_crc_open function first allocate memory before enabling CRC generation - Don't block open() call instead wait in crc read call. Following IGT will fail due to crc-core <-> driver interface change igt@kms_pipe_crc_basic@bad-source ig@kms_pipe_crc_basic@nonblocking-crc-pipe-X ig@kms_pipe_crc_basic@nonblocking-crc-pipe-X-frame-sequence In nonblocking crc tests we'll get lesser crc's due to skipping crc AMD/Rockchip/rcar code path is not validated and need inputs Changes: - Add dri-devel in Cc Mahesh Kumar (10): drm: crc: Introduce verify_crc_source callback drm: crc: Introduce pre_crc_read function drm: crc: Introduce get_crc_sources callback drm/rockchip/crc: Implement verify_crc_source callback drm/amdgpu_dm/crc: Implement verify_crc_source callback drm/rcar-du/crc: Implement verify_crc_source callback drm/i915/crc: implement verify_crc_source callback drm/i915/crc: implement get_crc_sources callback drm/crc: Cleanup crtc_crc_open function Revert "drm: crc: Wait for a frame before returning from open()" drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 20 +++- drivers/gpu/drm/drm_debugfs_crc.c | 62 ++- drivers/gpu/drm/i915/intel_display.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 8 +- drivers/gpu/drm/i915/intel_pipe_crc.c | 124 - drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 45 +++- drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 27 - include/drm/drm_crtc.h | 42 ++- 10 files changed, 288 insertions(+), 50 deletions(-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/10] drm/crc: Cleanup crtc_crc_open function
Cc: Laurent Pinchart On 6/26/2018 11:52 AM, Mahesh Kumar wrote: This patch make changes to allocate crc-entries buffer before enabling CRC generation. It moves all the failure check early in the function before setting the source or memory allocation. Now set_crc_source takes only two variable input, values_cnt we already gets as part of verify_crc_source. Signed-off-by: Mahesh Kumar Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 4 +- drivers/gpu/drm/drm_debugfs_crc.c | 52 +- drivers/gpu/drm/i915/intel_drv.h | 3 +- drivers/gpu/drm/i915/intel_pipe_crc.c | 4 +- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 5 +-- drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 6 +-- include/drm/drm_crtc.h | 3 +- 8 files changed, 30 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 79b0a16652b9..a7a5551fee1b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -261,8 +261,7 @@ amdgpu_dm_remove_sink_from_freesync_module(struct drm_connector *connector); /* amdgpu_dm_crc.c */ #ifdef CONFIG_DEBUG_FS -int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, - size_t *values_cnt); +int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name); int amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, const char *src_name, size_t *values_cnt); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c index dfcca594d52a..e7ad528f5853 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c @@ -62,8 +62,7 @@ amdgpu_dm_crtc_verify_crc_source(struct drm_crtc *crtc, const char *src_name, return 0; } -int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, - size_t *values_cnt) +int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name) { struct dm_crtc_state *crtc_state = to_dm_crtc_state(crtc->state); struct dc_stream_state *stream_state = crtc_state->stream; @@ -99,7 +98,6 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name, return -EINVAL; } - *values_cnt = 3; /* Reset crc_skipped on dm state */ crtc_state->crc_skip_count = 0; return 0; diff --git a/drivers/gpu/drm/drm_debugfs_crc.c b/drivers/gpu/drm/drm_debugfs_crc.c index 2751d124387d..834bc7ee5550 100644 --- a/drivers/gpu/drm/drm_debugfs_crc.c +++ b/drivers/gpu/drm/drm_debugfs_crc.c @@ -109,11 +109,9 @@ static ssize_t crc_control_write(struct file *file, const char __user *ubuf, if (source[len] == '\n') source[len] = '\0'; - if (crtc->funcs->verify_crc_source) { - ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt); - if (ret) - return ret; - } + ret = crtc->funcs->verify_crc_source(crtc, source, &values_cnt); + if (ret) + return ret; spin_lock_irq(&crc->lock); @@ -178,12 +176,15 @@ static int crtc_crc_open(struct inode *inode, struct file *filep) return ret; } - if (crtc->funcs->verify_crc_source) { - ret = crtc->funcs->verify_crc_source(crtc, crc->source, -&values_cnt); - if (ret) - return ret; - } + ret = crtc->funcs->verify_crc_source(crtc, crc->source, &values_cnt); + if (ret) + return ret; + + if (WARN_ON(values_cnt > DRM_MAX_CRC_NR)) + return -EINVAL; + + if (WARN_ON(values_cnt == 0)) + return -EINVAL; spin_lock_irq(&crc->lock); if (!crc->opened) @@ -195,30 +196,22 @@ static int crtc_crc_open(struct inode *inode, struct file *filep) if (ret) return ret; - ret = crtc->funcs->set_crc_source(crtc, crc->source, &values_cnt); - if (ret) - goto err; - - if (WARN_ON(values_cnt > DRM_MAX_CRC_NR)) { - ret = -EINVAL; - goto err_disable; - } - - if (WARN_ON(values_cnt == 0)) { - ret = -EINVAL; - goto err_disable; - } - entries = kcalloc(DRM_CRC_ENTRIES_NR, sizeof(*entries), GFP_KERNEL); if (!entries) { ret = -ENOMEM; - goto err_disable; + goto err; }