[Bug 72701] Screen freeze when using radeon driver

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=72701

--- Comment #10 from Alex Deucher  ---
Did manually powering on/off the dGPU via debugfs ever work on your system? 
See the "Forcing the power state of the devices" section of this page:
http://nouveau.freedesktop.org/wiki/Optimus/
for how to test that.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


X.org doesn't start with 3.14: [KMS] drm report modesetting isn't supported

2014-04-01 Thread Bruno Prémont
Hi Justin,

CC-ing dri-devel as more KMS/radeon people will see it there.

On Mon, 31 March 2014 "Justin Piszcz"  wrote:
> Do I need some updated ATI firmware (I believe this might have happened in
> the past)..?
> I booted back to 3.13.6, Xorg starts up fine, but with 3.14 it does not
> start.

Could you include all the drm/kms/radeon related output from your
kernel log as well as your /proc/cmdline?
Also, are /sys/class/drm/card0* entries present with proper contents
(modes, enabled, status attributes present and with sensible values)?

What exact AMD/ATI GPU is present in your system (lspci)?

Are your graphics drivers built-in or built as a module?

Bruno


> Thoughts?
> 
> 3.13.6:
> $ ps auxww|grep X
> root  4368  5.3  0.0 296648 37364 tty7 Ssl+ 18:23   0:00 /usr/bin/X
> :0 vt7 -nolisten tcp
> 
> 3.14:
> [   346.490] (**) ModulePath set to "/usr/lib/xorg/modules"
> [   346.490] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or
> 'vmmouse' will be disabled.
> [   346.490] (WW) Disabling Mouse0
> [   346.490] (WW) Disabling Keyboard0
> [   346.490] (II) [KMS] drm report modesetting isn't supported.
> [   346.490] (EE)
> [   346.490] (EE) Backtrace:
> [   346.490] (EE) 0: Xorg (xorg_backtrace+0x48) [0x7fbbbd731c58]
> [   346.490] (EE) 1: Xorg (0x7fbbbd58a000+0x1ab949) [0x7fbbbd735949]
> [   346.490] (EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0
> (0x7fbbbc3c5000+0xf880) [0x7fbbbc3d4880]
> [   346.490] (EE)
> [   346.490] (EE) Segmentation fault at address 0x0
> [   346.490] (EE)
> Fatal server error:
> [   346.491] (EE) Caught signal 11 (Segmentation fault). Server aborting
> [   346.491] (EE)
> [   346.491] (EE)
> Please consult the The X.Org Foundation support
>at http://wiki.x.org
>  for help.
> [   346.491] (EE) Please also check the log file at "/var/log/Xorg.0.log"
> for additional information.
> [   346.491] (EE)
> 
> Kernel config:
> http://home.comcast.net/~jpiszcz/20140331/3.14.txt
> 
> Kernel diffs:
> 
> $ diff -u config-20140331.1396303540 config-20140320.1395308867 | grep \^+
> +++ config-20140320.1395308867  2014-03-20 05:47:47.508584015 -0400
> +# Linux/x86 3.13.6 Kernel Configuration
> +CONFIG_UIDGID_STRICT_TYPE_CHECKS=y
> +CONFIG_MICROCODE_INTEL_LIB=y
> +# CONFIG_CC_STACKPROTECTOR is not set
> +# CONFIG_SCSI_AIC7XXX_OLD is not set
> +# CONFIG_CPU_THERMAL is not set
> +# CONFIG_GENERIC_PHY is not set
> 
> $ diff -u config-20140331.1396303540 config-20140320.1395308867 | grep \^-
> --- config-20140331.1396303540  2014-03-31 18:05:40.775863929 -0400
> -# Linux/x86 3.14.0 Kernel Configuration
> -CONFIG_HAVE_CC_STACKPROTECTOR=y
> -# CONFIG_CC_STACKPROTECTOR is not set
> -CONFIG_CC_STACKPROTECTOR_NONE=y
> -# CONFIG_CC_STACKPROTECTOR_REGULAR is not set
> -# CONFIG_CC_STACKPROTECTOR_STRONG is not set
> -# CONFIG_ZSMALLOC is not set
> -# CONFIG_NETFILTER_XT_MATCH_IPCOMP is not set
> -# CONFIG_NETFILTER_XT_MATCH_L2TP is not set
> -# CONFIG_GENWQE is not set
> -# CONFIG_I40EVF is not set
> -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
> -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set
> -# CONFIG_I2C_ROBOTFUZZ_OSIF is not set
> -# CONFIG_ACPI_INT3403_THERMAL is not set
> -# CONFIG_DW_WATCHDOG is not set
> -# CONFIG_MFD_MAX14577 is not set
> -# CONFIG_MFD_LP3943 is not set
> -# CONFIG_DRM_I915 is not set
> -# CONFIG_DRM_BOCHS is not set
> -# CONFIG_FB_OPENCORES is not set
> -# CONFIG_USB_MUSB_HDRC is not set
> -# CONFIG_USB_DWC2 is not set
> -# CONFIG_USB_SERIAL_MXUPORT is not set
> -# CONFIG_USB_OTG_FSM is not set
> -# CONFIG_RTC_DRV_ISL12057 is not set
> -# CONFIG_HP_WIRELESS is not set
> -CONFIG_GENERIC_PHY=y
> -# CONFIG_BCM_KONA_USB2_PHY is not set
> -CONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
> -CONFIG_PANIC_TIMEOUT=0
> 
> 
> 
> Justin.


[PATCH 2/2] drm/crtc-helper: don't disable disconnected outputs

2014-04-01 Thread Daniel Vetter
This is the equivalent change in the crtc helpers as done to the i915
modeset infrastructure in

commit b0a2658acb5bf9ca86b4aab011b7106de3af0add
Author: Daniel Vetter 
Date:   Tue Dec 18 09:37:54 2012 +0100

drm/i915: don't disable disconnected outputs

This was originally introduced to make encoder sharing on radone
easier for userspace, but:

- It is policy and as such belongs into userspace. E.g. personally I'm
  fairly annoyed that a flaky cable results in permanent changes of
  the desktop layout, so I'll kick out DEs which do this. Worse if the
  kernel also tries to be clever.

- It's inconsistent: We only kill disconnected outputs on setCrtc
  (which userspace might also call when just changing the
  framebuffer), but not when e.g. we receive a hpd event or in the
  output poll worker.

- It's unexpected behaviour for the userspace driver, at least in the
  intel ddx we've had tons of bugs where the driver fell over and
  killed the X session becuase pageflips/vblanks suddenly stopped
  working. We've had to fix this by wrapping every single setCrtc int
  a big "recover kms state from the kernel again" operation.

- It's suprising for the kernel, too: It took a few mails between Rob,
  Matt and me for them to notice that little dragon wreaking havoc
  with the universal plane framebuffer refcounting.

- Userspace can cope with it and e.g. Gnome already kills disconnected
  outputs and reconfigures the desktop automatically. And since there
  have been no regression reports for the i915 change from over 1 year
  ago I think all other DEs are also ready.

Note that the lines removed in this patch go back to

commit a3a0544b2c84e1d7a2022b558ecf66d8c6a8dd93
Author: Dave Airlie 
Date:   Mon Aug 31 15:16:30 2009 +1000

drm/kms: add explicit encoder disable function and detach harder.

Unfortunately the patch itself doesn't explain a hole lot about why it
was added ...

Cc: Matt Roper 
Cc: Rob Clark 
Cc: Dave Airlie 
Cc: Alex Deucher 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 8108db95e12b..003924025aa7 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -289,8 +289,6 @@ static void __drm_helper_disable_unused_functions(struct 
drm_device *dev)
list_for_each_entry(connector, >mode_config.connector_list, head) {
if (!connector->encoder)
continue;
-   if (connector->status == connector_status_disconnected)
-   connector->encoder = NULL;
}

list_for_each_entry(encoder, >mode_config.encoder_list, head) {
-- 
1.8.5.2



[PATCH 1/2] drm/crtc-helpers: fix dpms on logic

2014-04-01 Thread Daniel Vetter
This was introduced in

commit 25f397a429dfa43f22c278d0119a60a343aa568f
Author: Daniel Vetter 
Date:   Fri Jul 19 18:57:11 2013 +0200

drm/crtc-helper: explicit DPMS on after modeset

but due to a bit of rebase fail on my side the patch actually merged
put one hunk on the wrong side of a break statement. Fix this up.

Reported-by: Dan Carpenter 
Cc: Dan Carpenter 
Cc: Dave Airlie 
Cc: Alex Deucher 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index c0f2d6266070..8108db95e12b 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -695,12 +695,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
if (new_encoder == NULL)
/* don't break so fail path works 
correct */
fail = 1;
-   break;

if (connector->dpms != DRM_MODE_DPMS_ON) {
DRM_DEBUG_KMS("connector dpms not on, 
full mode switch\n");
mode_changed = true;
}
+
+   break;
}
}

-- 
1.8.5.2



[Bug 72701] Screen freeze when using radeon driver

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=72701

--- Comment #9 from klod  ---
Well, it seems so. What can I do to find what the problem is?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH 7/7] exynos/drm: add DT bindings

2014-04-01 Thread Inki Dae
This patch adds bindings for Exynos drm display subsystem.
The bindings describes ports containing a list of phandles
pointing to display controller, image enhancer, and display
interfaces nodes.

Signed-off-by: Inki Dae 
Signed-off-by: Kyungmin Park 
---
 .../bindings/drm/exynos/samsung-exynos-drm.txt |   32 
 1 file changed, 32 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/drm/exynos/samsung-exynos-drm.txt

diff --git 
a/Documentation/devicetree/bindings/drm/exynos/samsung-exynos-drm.txt 
b/Documentation/devicetree/bindings/drm/exynos/samsung-exynos-drm.txt
new file mode 100644
index 000..6f7fae0
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/exynos/samsung-exynos-drm.txt
@@ -0,0 +1,32 @@
+Samsung Exynos DRM master device
+
+
+The Samsung Exynos DRM master device is a virtual device needed to list all
+display controller, image enhancer, and display interface nodes that comprise
+the graphics subsystem.
+
+Required properties:
+- compatible: Should be "samsung,exynos-display-subsystem"
+- ports: Should contain a list of phandles pointing to display controller,
+  image enhancer, and display interface ports.
+
+Examples:
+
+In case of using MIPI-DSI,
+display-subsystem {
+   compatible = "samsung,exynos-display-subsystem";
+   ports = <>, <>;
+};
+
+
+In case of using DisplayPort,
+display-subsystem {
+   compatible = "samsung,exynos-display-subsystem";
+   ports = <>, <>;
+};
+
+In case of using parallel panel,
+display-subsystem {
+   compatible = "samsung,exynos-display-subsystem";
+   ports = <>;
+};
-- 
1.7.9.5



[PATCH 6/7] ARM: dts: exynos4412-trats2: add super device node for exynos drm

2014-04-01 Thread Inki Dae
Signed-off-by: Inki Dae 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/exynos4412-trats2.dts |5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts 
b/arch/arm/boot/dts/exynos4412-trats2.dts
index 53c717b..115b9ed 100644
--- a/arch/arm/boot/dts/exynos4412-trats2.dts
+++ b/arch/arm/boot/dts/exynos4412-trats2.dts
@@ -581,6 +581,11 @@
status = "okay";
};

+   display-subsystem {
+   compatible = "samsung,exynos-display-subsystem";
+   ports = <>, <_0>;
+   };
+
camera {
pinctrl-0 = <_port_b_clk_active>;
pinctrl-names = "default";
-- 
1.7.9.5



[PATCH 5/7] ARM: dts: exynos4210-trats: add super device node for exynos drm

2014-04-01 Thread Inki Dae
Signed-off-by: Inki Dae 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/exynos4210-trats.dts |5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210-trats.dts 
b/arch/arm/boot/dts/exynos4210-trats.dts
index 02c6768..a41c109 100644
--- a/arch/arm/boot/dts/exynos4210-trats.dts
+++ b/arch/arm/boot/dts/exynos4210-trats.dts
@@ -414,6 +414,11 @@
status = "okay";
};

+   display-subsystem {
+   compatible = "samsung,exynos-display-subsystem";
+   ports = <>, <_0>;
+   };
+
camera {
pinctrl-names = "default";
pinctrl-0 = <>;
-- 
1.7.9.5



[PATCH 4/7] ARM: dts: exynos4210-universal: add super device node for exynos drm

2014-04-01 Thread Inki Dae
Signed-off-by: Inki Dae 
Signed-off-by: Kyungmin Park 
---
 arch/arm/boot/dts/exynos4210-universal_c210.dts |5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210-universal_c210.dts 
b/arch/arm/boot/dts/exynos4210-universal_c210.dts
index 0a80a72..5351ac4 100644
--- a/arch/arm/boot/dts/exynos4210-universal_c210.dts
+++ b/arch/arm/boot/dts/exynos4210-universal_c210.dts
@@ -409,6 +409,11 @@
};
};

+   display-subsystem {
+   compatible = "samsung,exynos-display-subsystem";
+   ports = <>;
+   };
+
pwm at 139D {
compatible = "samsung,s5p6440-pwm";
status = "okay";
-- 
1.7.9.5



[PATCH v2 3/7] drm/exynos: register platform driver at each kms sub drivers

2014-04-01 Thread Inki Dae
This patch removes platform_driver_register() calls from
exynos_drm_drv module, and calls module_platform_driver()
at each kms sub drivers instead.

Previous RFC patch,
http://www.spinics.net/lists/dri-devel/msg54672.html

Changelog since RFC patch:
- remove unnecessary platform_driver declarations to each sub driver.

Changelog v2:
- remove unnecessary platform_driver for mipi dsi driver.

Signed-off-by: Inki Dae 
Signed-off-by: Kyungmin Park 
---
 drivers/gpu/drm/exynos/exynos_dp_core.c  |1 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |   64 --
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |6 ---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  |1 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |1 +
 drivers/gpu/drm/exynos/exynos_hdmi.c |1 +
 drivers/gpu/drm/exynos/exynos_mixer.c|1 +
 7 files changed, 5 insertions(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index cb9aa58..bf4996f 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1362,6 +1362,7 @@ struct platform_driver dp_driver = {
.of_match_table = exynos_dp_match,
},
 };
+module_platform_driver(dp_driver);

 MODULE_AUTHOR("Jingoo Han ");
 MODULE_DESCRIPTION("Samsung SoC DP Driver");
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index f065385..c2f444a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -468,33 +468,6 @@ static int exynos_drm_platform_probe(struct 
platform_device *pdev)
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
exynos_drm_driver.num_ioctls = DRM_ARRAY_SIZE(exynos_ioctls);

-#ifdef CONFIG_DRM_EXYNOS_DP
-   ret = platform_driver_register(_driver);
-   if (ret < 0)
-   goto out_dp;
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_DSI
-   ret = platform_driver_register(_driver);
-   if (ret < 0)
-   goto out_dsi;
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_FIMD
-   ret = platform_driver_register(_driver);
-   if (ret < 0)
-   goto out_fimd;
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_HDMI
-   ret = platform_driver_register(_driver);
-   if (ret < 0)
-   goto out_hdmi;
-   ret = platform_driver_register(_driver);
-   if (ret < 0)
-   goto out_mixer;
-#endif
-
 #ifdef CONFIG_DRM_EXYNOS_G2D
ret = platform_driver_register(_driver);
if (ret < 0)
@@ -562,27 +535,6 @@ out_fimc:
 out_g2d:
 #endif

-#ifdef CONFIG_DRM_EXYNOS_HDMI
-   platform_driver_unregister(_driver);
-out_mixer:
-   platform_driver_unregister(_driver);
-out_hdmi:
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_FIMD
-   platform_driver_unregister(_driver);
-out_fimd:
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_DSI
-   platform_driver_unregister(_driver);
-out_dsi:
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_DP
-   platform_driver_unregister(_driver);
-out_dp:
-#endif
return ret;
 }

@@ -609,22 +561,6 @@ static int exynos_drm_platform_remove(struct 
platform_device *pdev)
platform_driver_unregister(_driver);
 #endif

-#ifdef CONFIG_DRM_EXYNOS_HDMI
-   platform_driver_unregister(_driver);
-   platform_driver_unregister(_driver);
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_FIMD
-   platform_driver_unregister(_driver);
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_DSI
-   platform_driver_unregister(_driver);
-#endif
-
-#ifdef CONFIG_DRM_EXYNOS_DP
-   platform_driver_unregister(_driver);
-#endif
component_master_del(>dev, _drm_ops);
return 0;
 }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h 
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 25d562f..2b87eb7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -356,12 +356,6 @@ int exynos_drm_probe_vidi(struct drm_device *dev);
 int exynos_drm_create_enc_conn(struct drm_device *dev,
struct exynos_drm_display *display);

-extern struct platform_driver dp_driver;
-extern struct platform_driver dsi_driver;
-extern struct platform_driver fimd_driver;
-extern struct platform_driver hdmi_driver;
-extern struct platform_driver mixer_driver;
-extern struct platform_driver exynos_drm_common_hdmi_driver;
 extern struct platform_driver vidi_driver;
 extern struct platform_driver g2d_driver;
 extern struct platform_driver fimc_driver;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 8f48f52..0005527 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1546,6 +1546,7 @@ struct platform_driver dsi_driver = {
   .of_match_table = exynos_dsi_of_match,
},
 };
+module_platform_driver(dsi_driver);

 MODULE_AUTHOR("Tomasz Figa ");
 MODULE_AUTHOR("Andrzej Hajda ");
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 

[PATCH 2/7] drm/exynos: dpi: fix hotplug fail issue

2014-04-01 Thread Inki Dae
When connector is created, if connector->polled is
DRM_CONNECTOR_POLL_CONNECT then drm_kms_helper_hotplug_event
function isn't called at drm_helper_hpd_irq_event because the
function will be called only in case of DRM_CONNECTOR_POLL_HPD.

So this patch sets always DRM_CONNECTOR_POLL_HPD flag to
connector->polled of parallel panel driver at connector creation.

Signed-off-by: Inki Dae 
Signed-off-by: Kyungmin Park 
---
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index c1f4b35..ac206e7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -123,10 +123,7 @@ static int exynos_dpi_create_connector(struct 
exynos_drm_display *display,

ctx->encoder = encoder;

-   if (ctx->panel_node)
-   connector->polled = DRM_CONNECTOR_POLL_CONNECT;
-   else
-   connector->polled = DRM_CONNECTOR_POLL_HPD;
+   connector->polled = DRM_CONNECTOR_POLL_HPD;

ret = drm_connector_init(encoder->dev, connector,
 _dpi_connector_funcs,
-- 
1.7.9.5



[PATCH v2 1/7] drm/exynos: add super device support

2014-04-01 Thread Inki Dae
This patch adds super device support to bind sub drivers
using device tree.

For this, you should add a super device node to each machine dt files
like belows,

In case of using MIPI-DSI,
display-subsystem {
compatible = "samsung,exynos-display-subsystem";
ports = <>, <>;
};

In case of using DisplayPort,
display-subsystem {
compatible = "samsung,exynos-display-subsystem";
ports = <>, <>;
};

In case of using Parallel panel,
display-subsystem {
compatible = "samsung,exynos-display-subsystem";
ports = <>;
};

And if you don't add connector device node to ports property,
default parallel panel driver, exynos_drm_dpi module, will be used.

ports property can have the following device nodes,
fimd, mixer, Image Enhancer, MIPI-DSI, eDP, LVDS Bridge, or HDMI

With this patch, we can resolve the probing order issue without
some global lists. So this patch also removes the unnecessary lists and
stuff related to these lists.

Previous RFC patch,
 http://www.spinics.net/lists/dri-devel/msg54671.html

Changelog since RFC patch:
- Register sub drivers and probe them at load(). In case of non sub
  drivers, sub driver probe is needed.
- Enable runtime pm at fimd_probe() instead of fimd_bind(). runtime pm
  should be enabled before iommu device is attached to fimd device.
- Do not return an error with component_master_add fail.
- Remove super device support from mipi dsi driver which was in RFC.
- Add super device support to parallel driver.

Changelog v2:
- Add super device support to mipi dsi driver.
- Bind fimd driver only in case that a drm_panel for parallel panel driver
  is added to panel_list of drm_panel module.
- Change super node name to 'display-subsystem'
  . 'exynos-drm' is specific to Linux so change it to generic name.
- Change propery name of super node to 'ports'
  . crtcs and connectors propery names are also specific to Linux so
change them to generic name.

Signed-off-by: Inki Dae 
Signed-off-by: Kyungmin Park 
---
 drivers/gpu/drm/exynos/exynos_dp_core.c  |   45 ---
 drivers/gpu/drm/exynos/exynos_drm_core.c |  216 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c |   17 +++
 drivers/gpu/drm/exynos/exynos_drm_crtc.h |4 +
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  |   16 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.c  |  202 +++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h  |   73 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  |   38 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   76 ---
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |   61 +++--
 drivers/gpu/drm/exynos/exynos_hdmi.c |   45 ---
 drivers/gpu/drm/exynos/exynos_mixer.c|   54 ++--
 12 files changed, 442 insertions(+), 405 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index a59bca9..cb9aa58 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -969,16 +970,6 @@ static struct drm_connector_helper_funcs 
exynos_dp_connector_helper_funcs = {
.best_encoder = exynos_dp_best_encoder,
 };

-static int exynos_dp_initialize(struct exynos_drm_display *display,
-   struct drm_device *drm_dev)
-{
-   struct exynos_dp_device *dp = display->ctx;
-
-   dp->drm_dev = drm_dev;
-
-   return 0;
-}
-
 static bool find_bridge(const char *compat, struct bridge_init *bridge)
 {
bridge->client = NULL;
@@ -1106,7 +1097,6 @@ static void exynos_dp_dpms(struct exynos_drm_display 
*display, int mode)
 }

 static struct exynos_drm_display_ops exynos_dp_display_ops = {
-   .initialize = exynos_dp_initialize,
.create_connector = exynos_dp_create_connector,
.dpms = exynos_dp_dpms,
 };
@@ -1230,8 +1220,10 @@ static int exynos_dp_dt_parse_panel(struct 
exynos_dp_device *dp)
return 0;
 }

-static int exynos_dp_probe(struct platform_device *pdev)
+static int exynos_dp_bind(struct device *dev, struct device *master, void 
*data)
 {
+   struct platform_device *pdev = to_platform_device(dev);
+   struct drm_device *drm_dev = data;
struct resource *res;
struct exynos_dp_device *dp;

@@ -1293,21 +1285,40 @@ static int exynos_dp_probe(struct platform_device *pdev)
}
disable_irq(dp->irq);

+   dp->drm_dev = drm_dev;
exynos_dp_display.ctx = dp;

platform_set_drvdata(pdev, _dp_display);
-   exynos_drm_display_register(_dp_display);

-   return 0;
+   return exynos_drm_create_enc_conn(drm_dev, _dp_display);
 }

-static int exynos_dp_remove(struct platform_device *pdev)
+static void exynos_dp_unbind(struct device *dev, struct device *master,
+   void *data)
 {

[PATCH v2 0/7] drm/exynos: more cleanup with super device support

2014-04-01 Thread Inki Dae
This patch series cleans up exynos drm framework and kms sub drivers
using the component framework[1].

And this patch series had been posted for RFC[2].

Thanks,
Inki Dae

[1] http://lists.freedesktop.org/archives/dri-devel/2014-January/051249.html
[2] http://comments.gmane.org/gmane.comp.video.dri.devel/101200


Inki Dae (7):
  drm/exynos: add super device support
  drm/exynos: dpi: fix hotplug fail issue
  drm/exynos: register platform driver at each kms sub drivers
  ARM: dts: exynos4210-universal: add super device node for exynos drm
  ARM: dts: exynos4210-trats: add super device node for exynos drm
  ARM: dts: exynos4412-trats2: add super device node for exynos drm
  exynos/drm: add DT bindings

 .../bindings/drm/exynos/samsung-exynos-drm.txt |   32 +++
 arch/arm/boot/dts/exynos4210-trats.dts |5 +
 arch/arm/boot/dts/exynos4210-universal_c210.dts|5 +
 arch/arm/boot/dts/exynos4412-trats2.dts|5 +
 drivers/gpu/drm/exynos/exynos_dp_core.c|   46 ++--
 drivers/gpu/drm/exynos/exynos_drm_core.c   |  216 +++--
 drivers/gpu/drm/exynos/exynos_drm_crtc.c   |   17 ++
 drivers/gpu/drm/exynos/exynos_drm_crtc.h   |4 +
 drivers/gpu/drm/exynos/exynos_drm_dpi.c|   21 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c|  256 
 drivers/gpu/drm/exynos/exynos_drm_drv.h|   79 +++---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c|   39 ++-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |   77 --
 drivers/gpu/drm/exynos/exynos_drm_vidi.c   |   61 +++--
 drivers/gpu/drm/exynos/exynos_hdmi.c   |   46 ++--
 drivers/gpu/drm/exynos/exynos_mixer.c  |   55 -
 16 files changed, 490 insertions(+), 474 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/drm/exynos/samsung-exynos-drm.txt

-- 
1.7.9.5



[PATCH v3 00/12] Add DSI display support for Exynos based boards

2014-04-01 Thread Inki Dae
Hi Andrzej,



2014-03-28 20:52 GMT+09:00 Andrzej Hajda :
> Hi,
>
> This patchset adds drivers and bindings to the following devices:
> - Exynos DSI master,
> - S6E8AA0 DSI panel,
>
> It adds also display support in DTS files for the following boards:
> - Exynos4210/Trats,
> - Exynos4412/Trats2.
>
> The patchset is based on exynos_drm_next branch.
>
> It is the 3rd iteration of the patches, main changes:
> - based on exynos_drm_next branch,
> - added video interface bindings between DSI host and slave,
>   it seems to me to be redundand, and I hope when video interface bindings
>   will be stabilized it can become optional,
> - GPIOs implemented using gpiod framework,
> - removed controversial stuff (toshiba bridge implementation and arndale 
> support),
>   it will be send in another set of patches
>
> Other changes are described in individual patches.
>
> Regards
> Andrzej
>
>
> Andrzej Hajda (12):
>   drm/mipi_dsi: add flags to DSI messages
>   drm/mipi_dsi: create dsi devices only for nodes with reg property
>   drm/exynos: disallow fbdev initialization if no device is connected
>   exynos/dsim: add DT bindings
>   drm/exynos: add DSIM driver
>   panel/s6e8aa0: add DT bindings
>   drm/panel: add S6E8AA0 driver
>   ARM: dts: exynos4: add MIPI DSI Master node
>   ARM: dts: exynos4210-trats: add panel node
>   ARM: dts: exynos4412-trats2: add panel node
>   ARM: dts: exynos4210-trats: enable exynos/fimd node
>   ARM: dts: exynos4412-trats2: enable exynos/fimd node

Picked up this patch series.

Thanks for your contribution,
Inki Dae

>
>  .../devicetree/bindings/panel/samsung,s6e8aa0.txt  |   56 +
>  .../devicetree/bindings/video/exynos_dsim.txt  |   80 +
>  arch/arm/boot/dts/exynos4.dtsi |   14 +
>  arch/arm/boot/dts/exynos4210-trats.dts |   61 +
>  arch/arm/boot/dts/exynos4412-trats2.dts|   70 +
>  drivers/gpu/drm/drm_mipi_dsi.c |6 +-
>  drivers/gpu/drm/exynos/Kconfig |9 +
>  drivers/gpu/drm/exynos/Makefile|1 +
>  drivers/gpu/drm/exynos/exynos_drm_drv.c|   15 +
>  drivers/gpu/drm/exynos/exynos_drm_drv.h|1 +
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c| 1525 
> 
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c  |   21 +
>  drivers/gpu/drm/panel/Kconfig  |7 +
>  drivers/gpu/drm/panel/Makefile |1 +
>  drivers/gpu/drm/panel/panel-s6e8aa0.c  | 1069 ++
>  include/drm/drm_mipi_dsi.h |6 +
>  16 files changed, 2941 insertions(+), 1 deletion(-)
>  create mode 100644 
> Documentation/devicetree/bindings/panel/samsung,s6e8aa0.txt
>  create mode 100644 Documentation/devicetree/bindings/video/exynos_dsim.txt
>  create mode 100644 drivers/gpu/drm/exynos/exynos_drm_dsi.c
>  create mode 100644 drivers/gpu/drm/panel/panel-s6e8aa0.c
>
> --
> 1.8.3.2
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v4] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Vandana Kannan
Populate PAR in infoframe structure. PAR is taken from CEA mode list if
VIC is found. Else, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on
Daniel's review comments.

v3: Removed calculation of PAR for non-CEA modes as per discussion with
Ville.

v4: Added description for the param video_code. Absence of the description
led to a warning while executing "make htmldocs", as reported by
Wu, Fengguang.
Modified commit message.

A separate patch will be submitted to create a property that would enable a
user space app to set aspect ratio for AVI infoframe.

Signed-off-by: Vandana Kannan 
Cc: Jesse Barnes 
Cc: Vijay Purushothaman 
Cc: Ville Syrj?l? 
Cc: intel-gfx at lists.freedesktop.org
Cc: Wu, Fengguang 
Reviewed-by: Jesse Barnes 
---
 drivers/gpu/drm/drm_edid.c | 22 ++
 include/drm/drm_crtc.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index d4e3f9d..b8d6c51 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2452,6 +2452,22 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
*to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);

+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ * @video_code: ID given to each of the CEA modes
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+   /* return picture aspect ratio for video_code - 1 to access the
+* right array element
+   */
+   return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3629,12 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
hdmi_avi_infoframe *frame,
frame->video_code = drm_match_cea_mode(mode);

frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+   /* Populate picture aspect ratio from CEA mode list */
+   if (frame->video_code > 0)
+   frame->picture_aspect = drm_get_cea_aspect_ratio(
+   frame->video_code);
+
frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 27f828c..50dc55a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
-- 
1.9.1



[Bug 73911] Color Banding on radeon

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73911

Alex Deucher  changed:

   What|Removed |Added

  Attachment #93321|0   |1
is obsolete||

--- Comment #20 from Alex Deucher  ---
Created attachment 96751
  --> https://bugs.freedesktop.org/attachment.cgi?id=96751=edit
testing patch

Does this patch help?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/3fed4b8f/attachment.html>


[Bug 76884] Dithering not enabled on 6-bit per channel display

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=76884

Alex Deucher  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #1 from Alex Deucher  ---


*** This bug has been marked as a duplicate of bug 73911 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/c5e7e9c9/attachment.html>


[Bug 73911] Color Banding on radeon

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73911

Alex Deucher  changed:

   What|Removed |Added

 CC||paula at parashep.com

--- Comment #19 from Alex Deucher  ---
*** Bug 76884 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/8628383e/attachment.html>


[Bug 73911] Color Banding on radeon

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=73911

Alex Deucher  changed:

   What|Removed |Added

Summary|Color Banding on R600   |Color Banding on radeon
   |(7660G + 7670M) |

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/fb9eabce/attachment.html>


[Bug 76919] Random junk at the bottom of non-multiple-of-4 compressed textures (original or mipmapped)

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=76919

Darren Salt  changed:

   What|Removed |Added

   Hardware|Other   |x86-64 (AMD64)
 OS|All |Linux (All)
Version|unspecified |10.1

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/91d99836/attachment.html>


[Bug 76919] New: Random junk at the bottom of non-multiple-of-4 compressed textures (original or mipmapped)

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=76919

  Priority: medium
Bug ID: 76919
  Assignee: dri-devel at lists.freedesktop.org
   Summary: Random junk at the bottom of non-multiple-of-4
compressed textures (original or mipmapped)
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: bugspam at moreofthesa.me.uk
  Hardware: Other
Status: NEW
   Version: unspecified
 Component: Drivers/Gallium/r600
   Product: Mesa

Created attachment 96745
  --> https://bugs.freedesktop.org/attachment.cgi?id=96745=edit
Example image (with mipmaps), the height of which triggers the problem

There seems to be a problem with some compressed textures. When the height of
the image (more specifically, of the mipmap level used) is not a multiple of 4,
it appears that the bottom part of the image ? as rendered ? contains random
junk, apparently set at image load time.

The example image will show the problem at its original size. I've also played
with its height (initially 570px): increasing it to a multiple of 4 would
remove the problem if it's rendered using the full-size version, but since when
reduced by one level the height is again not a multiple of 4, the problem
re-appears. Setting the full-size height to 576px moves the problem down
further.

(We're using http://crunch.googlecode.com/svn/trunk/ for image
(de)compression.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/cf3d427c/attachment.html>


[PATCH RFC v2 2/6] drm/i2c: tda998x: Move tda998x to a couple encoder/connector

2014-04-01 Thread Laurent Pinchart
Hi Jean-Fran?ois,

Sorry for the late reply.

On Thursday 27 March 2014 12:34:49 Jean-Francois Moine wrote:
> On Wed, 26 Mar 2014 18:33:09 +0100 Laurent Pinchart wrote:
> > That could work in your case, but I don't really like that.
> > 
> > We need to describe the hardware topology, that might be the only point we
> > all agree on. There are various hardware topologies we need to support
> > with different levels of complexity, and several ways to describe them,
> > also with a wide range of complexities and features.
> > 
> > The more complex the hardware topology, the more complex its description
> > needs to be, and the more complex the code that will parse the
> > description and handle the hardware will be. I don't think there's any
> > doubt here.
>
> But also, the simpler is the topology and the simpler should be its
> description.

I wouldn't put it so strongly. I believe we can slightly relax our 
requirements regarding DT bindings complexity as long as drivers remain 
simple. There's of course no reason to use more complex bindings just for the 
sake of it.

> In your approach, the connections between endpoints are described in the
> components themselves, which makes hard for the DT maintainers to have a
> global understanding of the video subsystem.
> 
> Having the topology described in the master device is clearer, even if it is
> complex.

First of all, let's clarify what a "master device" is. In the "simple-video-
card" example you've proposed the master device is a logical device (with a DT 
node that has no corresponding hardware device). The second approach I can 
think of is to make the IP core that implements the CRTC (which I usually call 
display controller) be the master device. Let's note that the second case 
makes both the link and "global description" DT binding styles possible.

My concern with the "global description" bindings style is that the approach 
only applies to simple hardware and can't be generalized. Now, I'm not too 
concerned about using that approach for simple hardware and a link-based 
approach for more complex hardware. The "slave" components, however, need to 
use a single DT bindings style, regardless of the DT bindings used by the 
master device. That's why I believe we should try to standardize one DT 
bindings style for master devices, even if it results in a slightly more 
complex DT description than strictly needed in some cases.

> > A given device can be integrated in a wide variety of hardware with
> > different complexities. A driver can't thus always assume that the whole
> > composite display device will match a given class of topologies. This is
> > especially true for encoders and connectors, they can be hooked up
> > directly at the output of a very simple display controller, or can be
> > part of a very complex graph. Encoder and connector drivers can't assume
> > much about how they will be integrated. I want to avoid a situation where
> > using an HDMI encoder already supported in mainline with a different SoC
> > will result in having to rewrite the HDMI encoder driver.
> 
> The tda998x chips are simple enough for being used in many boards: one video
> input and one serial digital output. I don't see in which circumstance the
> driver should be rewritten.

It shouldn't, that's the whole point ;-) I wasn't talking about the tda998x 
only, but about encoder drivers in general. I have a display controller in a 
Renesas SoC that has two LVDS encoders that output LVDS signals out of the 
SoC. One LVDS port is connected to an LVDS panel (a connector from a DRM point 
of view), the second one to an LVDS receiver that outputs parallel RGB data to 
an HDMI encoder. The LVDS encoder can't thus assume any particular downstream 
topology and its driver thus can't create DRM encoder and connector instances. 
The same could be true for an HDMI encoder in theory, although an HDMI encoder 
connected on the same board directly to an HDMI decoder that outputs RGB data 
to a panel is probably a case that will be rarely seen in practice.

In the general case an encoder driver can't assume any specific upstream or 
downstream topology. As long as DRM can't expose the real hardware topology to 
userspace, someone needs to decide on how to map the hardware topology to the 
DRM topology exposed to userspace. Encoder drivers can't take that role and 
thus shouldn't create DRM encoder and connector instances themselves.

> > The story is a bit different for display controllers. While the hardware
> > topology outside (and sometimes inside as well) of the SoC can vary, a
> > display controller often approximately implies a given level of
> > complexity. A cheap SoC with a simple display controller will likely not
> > be used to drive a 4k display requiring 4 encoders running in parallel
> > for instance. While I also want to avoid having to make significant
> > changes to a display controller driver when using the SoC on a different
> > board, I believe the 

[PATCH v3] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Vandana Kannan
Populate PAR in infoframe structure. If there is a user setting for PAR, then
that value is set. Else, value is taken from CEA mode list if VIC is found.
Else, PAR is calculated from resolution. If none of these conditions are
satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on
Daniel's review comments.

v3: Removed calculation of PAR for non-CEA modes as per discussion with
Ville.

A separate patch will be submitted to create a property that would enable a
user space app to set aspect ratio for AVI infoframe.

Signed-off-by: Vandana Kannan 
Cc: Jesse Barnes 
Cc: Vijay Purushothaman 
Cc: Ville Syrj?l? 
Cc: intel-gfx at lists.freedesktop.org
Reviewed-by: Jesse Barnes 
---
 drivers/gpu/drm/drm_edid.c | 21 +
 include/drm/drm_crtc.h |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index d4e3f9d..09ece10 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
*to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);

+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+   /* return picture aspect ratio for video_code - 1 to access the
+* right array element
+   */
+   return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,12 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
hdmi_avi_infoframe *frame,
frame->video_code = drm_match_cea_mode(mode);

frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+   /* Populate picture aspect ratio from CEA mode list */
+   if (frame->video_code > 0)
+   frame->picture_aspect = drm_get_cea_aspect_ratio(
+   frame->video_code);
+
frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 27f828c..50dc55a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
-- 
1.9.1



[Bug 72701] Screen freeze when using radeon driver

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=72701

--- Comment #8 from Alex Deucher  ---
(In reply to klod from comment #7)
> I think those patches are applied in 3.14 and 3.13.8, but i still need to
> use radeon.runpm=0 in order to boot with my discrete card.

You have a PX system so those patches are not relevant for you.  It seems runpm
is not working properly on your system. Booting with radeon.runpm=0 reverts
back to the 3.12 behavior (PX dGPUs are not dynamically powered down).

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 72701] Screen freeze when using radeon driver

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=72701

--- Comment #7 from klod  ---
I think those patches are applied in 3.14 and 3.13.8, but i still need to use
radeon.runpm=0 in order to boot with my discrete card.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH v4] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Daniel Vetter
On Tue, Apr 01, 2014 at 09:07:50PM +0530, Vandana Kannan wrote:
> Populate PAR in infoframe structure. PAR is taken from CEA mode list if
> VIC is found. Else, PAR is NONE as per initialization.
> 
> v2: Removed the part which sets PAR according to user input, based on
> Daniel's review comments.
> 
> v3: Removed calculation of PAR for non-CEA modes as per discussion with
> Ville.
> 
> v4: Added description for the param video_code. Absence of the description
> led to a warning while executing "make htmldocs", as reported by
> Wu, Fengguang.
> Modified commit message.
> 
> A separate patch will be submitted to create a property that would enable a
> user space app to set aspect ratio for AVI infoframe.
> 
> Signed-off-by: Vandana Kannan 
> Cc: Jesse Barnes 
> Cc: Vijay Purushothaman 
> Cc: Ville Syrj?l? 
> Cc: intel-gfx at lists.freedesktop.org
> Cc: Wu, Fengguang 
> Reviewed-by: Jesse Barnes 

Applied. btw if I've merged a patch already I prefer a small fixup patch
on top of what I have to squash into the main patch.
-Daniel

> ---
>  drivers/gpu/drm/drm_edid.c | 22 ++
>  include/drm/drm_crtc.h |  1 +
>  2 files changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index d4e3f9d..b8d6c51 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2452,6 +2452,22 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
> *to_match)
>  }
>  EXPORT_SYMBOL(drm_match_cea_mode);
>  
> +/**
> + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
> + * the input VIC from the CEA mode list
> + * @video_code: ID given to each of the CEA modes
> + *
> + * Returns picture aspect ratio
> + */
> +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
> +{
> + /* return picture aspect ratio for video_code - 1 to access the
> +  * right array element
> + */
> + return edid_cea_modes[video_code-1].picture_aspect_ratio;
> +}
> +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
> +
>  /*
>   * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
>   * specific block).
> @@ -3613,6 +3629,12 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
> hdmi_avi_infoframe *frame,
>   frame->video_code = drm_match_cea_mode(mode);
>  
>   frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
> +
> + /* Populate picture aspect ratio from CEA mode list */
> + if (frame->video_code > 0)
> + frame->picture_aspect = drm_get_cea_aspect_ratio(
> + frame->video_code);
> +
>   frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
>   frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
>  
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 27f828c..50dc55a 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device 
> *dev,
>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
>   void *data, struct drm_file *file_priv);
>  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
> +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 
> video_code);
>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
>  extern bool drm_detect_monitor_audio(struct edid *edid);
>  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
> -- 
> 1.9.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[Intel-gfx] [PATCH v3] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Daniel Vetter
On Tue, Apr 01, 2014 at 07:52:21PM +0530, Vandana Kannan wrote:
> Populate PAR in infoframe structure. If there is a user setting for PAR, then
> that value is set. Else, value is taken from CEA mode list if VIC is found.
> Else, PAR is calculated from resolution. If none of these conditions are
> satisfied, PAR is NONE as per initialization.
> 
> v2: Removed the part which sets PAR according to user input, based on
> Daniel's review comments.
> 
> v3: Removed calculation of PAR for non-CEA modes as per discussion with
> Ville.
> 
> A separate patch will be submitted to create a property that would enable a
> user space app to set aspect ratio for AVI infoframe.
> 
> Signed-off-by: Vandana Kannan 
> Cc: Jesse Barnes 
> Cc: Vijay Purushothaman 
> Cc: Ville Syrj?l? 
> Cc: intel-gfx at lists.freedesktop.org
> Reviewed-by: Jesse Barnes 

I've pulled this into my topic/core-stuff branch so it doesn't get lost.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH v2] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Vandana Kannan
On Apr-01-2014 5:04 PM, Ville Syrj?l? wrote:
> On Tue, Apr 01, 2014 at 04:26:59PM +0530, Vandana Kannan wrote:
>> Populate PAR in infoframe structure. If there is a user setting for PAR, then
>> that value is set. Else, value is taken from CEA mode list if VIC is found.
>> Else, PAR is calculated from resolution. If none of these conditions are
>> satisfied, PAR is NONE as per initialization.
>>
>> v2: Removed the part which sets PAR according to user input, based on
>> Daniel's review comments.
>>
>> A separate patch will be submitted to create a property that would enable a
>> user space app to set aspect ratio for AVI infoframe.
>>
>> Signed-off-by: Vandana Kannan 
>> Cc: Jesse Barnes 
>> Cc: Vijay Purushothaman 
>> Cc: Ville Syrj?l? 
>> Cc: intel-gfx at lists.freedesktop.org
>> Reviewed-by: Jesse Barnes 
>> ---
>>  drivers/gpu/drm/drm_edid.c | 29 +
>>  include/drm/drm_crtc.h |  1 +
>>  2 files changed, 30 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index d4e3f9d..fee24d3 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
>> *to_match)
>>  }
>>  EXPORT_SYMBOL(drm_match_cea_mode);
>>  
>> +/**
>> + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
>> + * the input VIC from the CEA mode list
>> + *
>> + * Returns picture aspect ratio
>> + */
>> +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
>> +{
>> +/* return picture aspect ratio for video_code - 1 to access the
>> + * right array element
>> +*/
>> +return edid_cea_modes[video_code-1].picture_aspect_ratio;
>> +}
>> +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
>> +
>>  /*
>>   * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
>>   * specific block).
>> @@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
>> hdmi_avi_infoframe *frame,
>>  frame->video_code = drm_match_cea_mode(mode);
>>  
>>  frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
>> +
>> +/* Populate picture aspect ratio from CEA mode list */
>> +if (frame->video_code > 0)
>> +frame->picture_aspect = drm_get_cea_aspect_ratio(
>> +frame->video_code);
>> +else {
>> +if (!(mode->vdisplay % 3) &&
>> +(((mode->vdisplay * 4) / 3) == mode->hdisplay))
>> +frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
>> +else if (!(mode->vdisplay % 9) &&
>> +(((mode->vdisplay * 16) / 9) == mode->hdisplay))
>> +frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
>> +}
> 
> I'm not sure if providing the PAR for non-CEA modes like this makes
> any real difference. But I guess it can't hurt since you only provide
> it for exact matches.
> 
> But the matches are maybe even a bit too exact. For instance 1366x768
> will not match the 16:9 case. So maybe it should be calculated in a bit
> more relaxed way.
> 
> Or just dropped totally. I'm not sure.
> 
Maybe we can drop it for now (for this patch) and come up with another
patch containing calculations which are more relaxed than the above.
What do you think?
>> +
>>  frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
>>  frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
>>  
>> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
>> index 27f828c..50dc55a 100644
>> --- a/include/drm/drm_crtc.h
>> +++ b/include/drm/drm_crtc.h
>> @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device 
>> *dev,
>>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
>>  void *data, struct drm_file *file_priv);
>>  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
>> +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 
>> video_code);
>>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
>>  extern bool drm_detect_monitor_audio(struct edid *edid);
>>  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
>> -- 
>> 1.9.1
> 



[PULL] Universal plane support

2014-04-01 Thread Matt Roper
Hi,

Here's the latest iteration of the universal planes work, which I believe is
finally ready for merging.  Aside from the minor driver patches to use the
new drm_for_each_legacy_plane() macro for plane loops, these should all have
an r-b from Rob Clark now.

Actual userspace-visibility is currently hidden behind a
drm.universal_planes module parameter so that we can do some experimental
testing of this before flipping it on universally.


Thanks,

Matt



The following changes since commit c32fc9c803f8ed90a7548810de48ca33a3020168:

  Merge tag 'vmwgfx-next-2014-03-28' of 
git://people.freedesktop.org/~thomash/linux into drm-next (2014-03-31 11:29:38 
+1000)

are available in the git repository at:


  git://people.freedesktop.org/~robclark/linux primary-plane

for you to fetch changes up to 6efa1f2f5417e628572a75e667a9d8c63d21bd17:

  drm/doc: Update plane documentation and add plane helper library (2014-04-01 
20:18:29 -0400)


Matt Roper (13):
  drm: Add support for multiple plane types (v2)
  drm/exynos: Restrict plane loops to only operate on overlay planes (v2)
  drm/i915: Restrict plane loops to only operate on overlay planes (v2)
  drm/shmobile: Restrict plane loops to only operate on legacy planes
  drm: Make drm_crtc_check_viewport non-static
  drm: Add primary plane helpers (v3)
  drm: Add drm_universal_plane_init()
  drm: Add drm_crtc_init_with_planes() (v2)
  drm/msm: Switch to universal plane API's
  drm: Replace crtc fb with primary plane fb (v3)
  drm: Remove unused drm_crtc->fb
  drm: Allow userspace to ask for universal plane list (v2)
  drm/doc: Update plane documentation and add plane helper library

Rob Clark (1):
  drm: Add plane type property (v2)

 Documentation/DocBook/drm.tmpl   |  50 +++-
 drivers/gpu/drm/Makefile |   3 +-
 drivers/gpu/drm/armada/armada_crtc.c |  23 +-
 drivers/gpu/drm/ast/ast_mode.c   |  12 +-
 drivers/gpu/drm/bochs/bochs_kms.c|   4 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c |  10 +-
 drivers/gpu/drm/drm_crtc.c   | 189 +++
 drivers/gpu/drm/drm_crtc_helper.c|  20 +-
 drivers/gpu/drm/drm_fb_helper.c  |   9 +-
 drivers/gpu/drm/drm_ioctl.c  |   7 +
 drivers/gpu/drm/drm_plane_helper.c   | 333 +++
 drivers/gpu/drm/drm_stub.c   |   5 +
 drivers/gpu/drm/exynos/exynos_drm_crtc.c |  22 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c  |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_display.c   |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_dp.c|   2 +-
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c  |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_lvds.c  |   2 +-
 drivers/gpu/drm/gma500/gma_display.c |  16 +-
 drivers/gpu/drm/gma500/mdfld_dsi_output.c|   2 +-
 drivers/gpu/drm/gma500/mdfld_intel_display.c |  16 +-
 drivers/gpu/drm/gma500/oaktrail_crtc.c   |  12 +-
 drivers/gpu/drm/gma500/psb_intel_display.c   |   2 +-
 drivers/gpu/drm/gma500/psb_intel_lvds.c  |   2 +-
 drivers/gpu/drm/gma500/psb_intel_sdvo.c  |   2 +-
 drivers/gpu/drm/i915/i915_debugfs.c  |   4 +-
 drivers/gpu/drm/i915/i915_irq.c  |   4 +-
 drivers/gpu/drm/i915/intel_display.c |  62 ++---
 drivers/gpu/drm/i915/intel_dp.c  |   4 +-
 drivers/gpu/drm/i915/intel_overlay.c |   4 +-
 drivers/gpu/drm/i915/intel_pm.c  |  38 +--
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  26 +--
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c |  33 +--
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c|   8 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c |  27 ++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c|   8 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c  |  20 +-
 drivers/gpu/drm/nouveau/dispnv04/dfp.c   |   2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c|   8 +-
 drivers/gpu/drm/nouveau/nv50_display.c   |  17 +-
 drivers/gpu/drm/omapdrm/omap_crtc.c  |  13 +-
 drivers/gpu/drm/omapdrm/omap_fb.c|   2 +-
 drivers/gpu/drm/qxl/qxl_display.c|  10 +-
 drivers/gpu/drm/radeon/atombios_crtc.c   |  20 +-
 drivers/gpu/drm/radeon/r100.c|   4 +-
 drivers/gpu/drm/radeon/radeon_connectors.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_display.c  |   4 +-
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c  |  16 +-
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c   |  10 +-
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c|  16 +-
 drivers/gpu/drm/tegra/dc.c   |  16 +-
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c |   8 +-
 drivers/gpu/drm/udl/udl_modeset.c|   2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  |  14 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |   8 

crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Ville Syrjälä
On Tue, Apr 01, 2014 at 10:22:07AM -0400, Rob Clark wrote:
> On Tue, Apr 1, 2014 at 10:12 AM, Ville Syrj?l?
>  wrote:
> > On Tue, Apr 01, 2014 at 09:54:40AM -0400, Rob Clark wrote:
> >> On Tue, Apr 1, 2014 at 9:40 AM, Daniel Vetter  wrote:
> >> > On Tue, Apr 01, 2014 at 08:40:54AM -0400, Rob Clark wrote:
> >> >> No, not really.  I was just trying to get away with pushing some
> >> >> complexity (for case #1) up to userspace instead of doing it in the
> >> >> kernel.
> >> >
> >> > To clarify: I don't think it makes sense to fully abstract this away in
> >> > the kernel, especially if userspace needs to be aware of the boundary
> >> > between the crtcs so that it can correctly tile up the logical 
> >> > frambuffer.
> >> > But I'm not sure whether trying to make that possible with a generic
> >> > userspace driver is sensible, or whether having a bit of magic glue code
> >> > in the ddx/wayland/hwc part for e.g. msm is the better option, at least 
> >> > in
> >> > the short term.
> >> >
> >> > Since if the set of useable planes actually changes we need to push that
> >> > decision up the stack even further like wayland/hwc currently allow, and
> >> > maybe there's some things we need to fix at that layer first. Once we've
> >> > learned that lesson we can push things down again and add a neat little
> >> > generic kernel interface. At least thus far we've always done a bit of
> >> > prototyping with driver-specific code to learn a few lessons, e.g. the
> >> > various pieces of non-standard plane/overlay in i915.
> >>
> >> right, things like 'STATUS' property for returning per-object status
> >> would start as driver custom.  (And even 'SLAVE_CRTC'..)  Userspace
> >> could look for certain property names in the same way that it looks
> >> for certain gl extension strings.  But should be semi-standardized, so
> >> other drivers which need the same thing should use same property
> >> names/values/behaviors as much as possible.. which was the point for
> >> starting the thread ;-)
> >
> > What's the problem with just using two crtcs? With the atomic API you
> > just shovel the state for both down into the driver in one ioctl. This
> > is pretty much what we'll need to do to drive those 4k MST DP displays
> > as well. The driver will then have to do its best to genlock the crtcs
> > if the hardware doesn't do it fully. IIRC that's how we're going to have
> > to do the MST stuff, ie. use the same clock source for both obviously,
> > and try to start all the pipes as fast as possible so that the vblanks
> > line up. And that's going to require more changes to our modesetting
> > codepaths.
> 
> well, two problems:
> 1) it won't actually work (at least not without some overhaul of kms
> core and helpers)..  encoder only has a single crtc ptr.  And anyway,
> it is useful for the driver to differentiate between which pipe/mixer
> is primary and which is slave.

What does primary/slave mean here? That seems like a rather hardware
specific notion.

> The SLAVE_CRTC property essentially gives you that 2nd pointer you need.

Would seem easier to add the pointer. Or even better: just expose the
display as two connectors and then you don't have to change anything.
It's just like having multiple displays positioned next to each other
today.

> 2) still would be nice to be able to drive 4k displays from x11.. and
> for the most part there isn't much compelling reason for most ddx's to
> migrate to atomic ioctl.

Someone might argue that 4k support is a compelling reason ;)

-- 
Ville Syrj?l?
Intel OTC


[Bug 73291] Kernel 3.13.7 boots with hybrid Intel/ATI but to blank graphical screen

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=73291

--- Comment #14 from Mike Cloaked  ---
Yes prior to blacklisting the radeon module I tried booting with radeon.runpm=0
and I still got the blank screen for graphical boot.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCHv4 04/13] drm/shmobile: Restrict plane loops to only operate on legacy planes

2014-04-01 Thread Laurent Pinchart
Hi Daniel,

On Friday 28 March 2014 18:53:40 Daniel Vetter wrote:
> On Fri, Mar 28, 2014 at 06:52:50PM +0100, Daniel Vetter wrote:
> > On Fri, Mar 28, 2014 at 04:50:13PM +0100, Laurent Pinchart wrote:
> > > On Thursday 27 March 2014 17:44:29 Matt Roper wrote:
> > > > Ensure that existing driver loops over all planes do not change
> > > > behavior when we begin adding new types of planes (primary and cursor)
> > > > to the DRM plane list in future patches.
> > > > 
> > > > Cc: Laurent Pinchart 
> > > > Signed-off-by: Matt Roper 
> > > 
> > > Acked-by: Laurent Pinchart 
> > > 
> > > I have a question though. The patch set introduces three plane types,
> > > OVERLAY, PRIMARY and CURSOR. What should a driver that has no concept
> > > of primary plane do ? Expose all planes as OVERLAY planes only ?
> > 
> > It's a matter of backwards compat with old userspace. primary/cursor are
> > simply ways to tell the drm core which planes to use to forward the legacy
> > cursor crtc and which plane will be used for the framebuffer in setCrtc.
> > 
> > So until we have the new atomic interface ready your driver kinda needs to
> > expose at least a primary plane, otherwise there's no way to even switch
> > on the crtc.
> > 
> > But besides this backwards compat issue there's no difference and you can
> > specify whatever plane you want as primary/cursor (or none if you don't
> > care about old userspace).
> 
> Well the NULL primary plane probably needs a bit of work on top of Matt's
> patch series here ...

It's the NULL primary plane I'm interested about, to allow a "root" plane not 
to span the whole display. I have no urgent need for this though, I was just 
curious to see if that feature was planned.

-- 
Regards,

Laurent Pinchart



[PATCHv4 06/13] drm: Add primary plane helpers (v2)

2014-04-01 Thread Laurent Pinchart
Hi Daniel,

On Friday 28 March 2014 18:54:49 Daniel Vetter wrote:
> On Fri, Mar 28, 2014 at 04:48:42PM +0100, Laurent Pinchart wrote:
> > On Friday 28 March 2014 09:32:06 Daniel Vetter wrote:
> > > On Thu, Mar 27, 2014 at 05:44:31PM -0700, Matt Roper wrote:
> > > > When we expose non-overlay planes to userspace, they will become
> > > > accessible via standard userspace plane API's.  We should be able to
> > > > handle the standard plane operations against primary planes in a
> > > > generic way via the modeset handler.
> > > > 
> > > > Drivers that can program primary planes more efficiently, that want to
> > > > use their own primary plane structure to track additional information,
> > > > or that don't have the limitations assumed by the helpers are free to
> > > > provide their own implementation of some or all of these handlers.
> > > > 
> > > > v2:
> > > >  - Move plane helpers to a new file (drm_plane_helper.c)
> > > >  - Tighten checks on update handler (check for scaling, CRTC coverage,
> > > >subpixel positioning)
> > > >  - Pass proper panning parameters to modeset interface
> > > >  - Disallow disabling primary plane (and thus CRTC) if other planes
> > > >are still active on the CRTC.
> > > >  - Use a minimal format list that should work on all hardware/drivers.
> > > >Drivers may call this function with a more accurate plane list to
> > > >enable additional formats they can support.
> > > > 
> > > > Signed-off-by: Matt Roper 
> > > > ---
> > > > 
> > > >  drivers/gpu/drm/Makefile   |   3 +-
> > > >  drivers/gpu/drm/drm_plane_helper.c | 312 
> > > >  include/drm/drm_plane_helper.h |  49 ++
> > > 
> > > DocBook integration is missing for all the great kerneldoc you've
> > > written.
> > 
> > I'd go a bit further than that, there's a chapter on planes in the DocBook
> > documentation that should also be updated, otherwise it would get
> > outdated.
> 
> Probably better done as part of the patch which actually adds primary
> planes, since this here is just the convenience helpers for easier
> transition ...

Sure, that's perfectly fine with me.

> > > That boils down to adding a new section next to the other helper
> > > libraries in the drm docbook to pull the kerneldoc in and running make
> > > htmldocs to make sure the kerneldoc checks out.
> > > 
> > > If you want you can add a DOC: overview section and pull that into the
> > > docbook too, see e.g. how the drm prime helpers are integrated.
> > > 
> > > >  3 files changed, 363 insertions(+), 1 deletion(-)
> > > >  create mode 100644 drivers/gpu/drm/drm_plane_helper.c
> > > >  create mode 100644 include/drm/drm_plane_helper.h

-- 
Regards,

Laurent Pinchart



[Bug 73291] Kernel 3.13.7 boots with hybrid Intel/ATI but to blank graphical screen

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=73291

--- Comment #13 from Alex Deucher  ---
(In reply to Mike Cloaked from comment #12)
> Is this bug related to https://bugzilla.kernel.org/show_bug.cgi?id=65761

I don't think so.  In your case you seem to lose the display before the radeon
card is even used.  Are you sure radeon.runpm=0 doesn't help?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[Bug 73291] Kernel 3.13.7 boots with hybrid Intel/ATI but to blank graphical screen

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=73291

--- Comment #12 from Mike Cloaked  ---
Is this bug related to https://bugzilla.kernel.org/show_bug.cgi?id=65761

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Ville Syrjälä
On Tue, Apr 01, 2014 at 09:54:40AM -0400, Rob Clark wrote:
> On Tue, Apr 1, 2014 at 9:40 AM, Daniel Vetter  wrote:
> > On Tue, Apr 01, 2014 at 08:40:54AM -0400, Rob Clark wrote:
> >> No, not really.  I was just trying to get away with pushing some
> >> complexity (for case #1) up to userspace instead of doing it in the
> >> kernel.
> >
> > To clarify: I don't think it makes sense to fully abstract this away in
> > the kernel, especially if userspace needs to be aware of the boundary
> > between the crtcs so that it can correctly tile up the logical frambuffer.
> > But I'm not sure whether trying to make that possible with a generic
> > userspace driver is sensible, or whether having a bit of magic glue code
> > in the ddx/wayland/hwc part for e.g. msm is the better option, at least in
> > the short term.
> >
> > Since if the set of useable planes actually changes we need to push that
> > decision up the stack even further like wayland/hwc currently allow, and
> > maybe there's some things we need to fix at that layer first. Once we've
> > learned that lesson we can push things down again and add a neat little
> > generic kernel interface. At least thus far we've always done a bit of
> > prototyping with driver-specific code to learn a few lessons, e.g. the
> > various pieces of non-standard plane/overlay in i915.
> 
> right, things like 'STATUS' property for returning per-object status
> would start as driver custom.  (And even 'SLAVE_CRTC'..)  Userspace
> could look for certain property names in the same way that it looks
> for certain gl extension strings.  But should be semi-standardized, so
> other drivers which need the same thing should use same property
> names/values/behaviors as much as possible.. which was the point for
> starting the thread ;-)

What's the problem with just using two crtcs? With the atomic API you
just shovel the state for both down into the driver in one ioctl. This
is pretty much what we'll need to do to drive those 4k MST DP displays
as well. The driver will then have to do its best to genlock the crtcs
if the hardware doesn't do it fully. IIRC that's how we're going to have
to do the MST stuff, ie. use the same clock source for both obviously,
and try to start all the pipes as fast as possible so that the vblanks
line up. And that's going to require more changes to our modesetting
codepaths.

So, I don't see a need for any SLAVE_CRTC properties or dynamic remapping
of resources. The latter would get nasty when the resources (eg. planes)
aren't uniform anyway. Just let userspace figure it out.

-- 
Ville Syrj?l?
Intel OTC


[PATCH v2] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Ville Syrjälä
On Tue, Apr 01, 2014 at 06:43:42PM +0530, Vandana Kannan wrote:
> On Apr-01-2014 5:04 PM, Ville Syrj?l? wrote:
> > On Tue, Apr 01, 2014 at 04:26:59PM +0530, Vandana Kannan wrote:
> >> Populate PAR in infoframe structure. If there is a user setting for PAR, 
> >> then
> >> that value is set. Else, value is taken from CEA mode list if VIC is found.
> >> Else, PAR is calculated from resolution. If none of these conditions are
> >> satisfied, PAR is NONE as per initialization.
> >>
> >> v2: Removed the part which sets PAR according to user input, based on
> >> Daniel's review comments.
> >>
> >> A separate patch will be submitted to create a property that would enable a
> >> user space app to set aspect ratio for AVI infoframe.
> >>
> >> Signed-off-by: Vandana Kannan 
> >> Cc: Jesse Barnes 
> >> Cc: Vijay Purushothaman 
> >> Cc: Ville Syrj?l? 
> >> Cc: intel-gfx at lists.freedesktop.org
> >> Reviewed-by: Jesse Barnes 
> >> ---
> >>  drivers/gpu/drm/drm_edid.c | 29 +
> >>  include/drm/drm_crtc.h |  1 +
> >>  2 files changed, 30 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> >> index d4e3f9d..fee24d3 100644
> >> --- a/drivers/gpu/drm/drm_edid.c
> >> +++ b/drivers/gpu/drm/drm_edid.c
> >> @@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
> >> *to_match)
> >>  }
> >>  EXPORT_SYMBOL(drm_match_cea_mode);
> >>  
> >> +/**
> >> + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding 
> >> to
> >> + * the input VIC from the CEA mode list
> >> + *
> >> + * Returns picture aspect ratio
> >> + */
> >> +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
> >> +{
> >> +  /* return picture aspect ratio for video_code - 1 to access the
> >> +   * right array element
> >> +  */
> >> +  return edid_cea_modes[video_code-1].picture_aspect_ratio;
> >> +}
> >> +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
> >> +
> >>  /*
> >>   * Calculate the alternate clock for HDMI modes (those from the HDMI 
> >> vendor
> >>   * specific block).
> >> @@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
> >> hdmi_avi_infoframe *frame,
> >>frame->video_code = drm_match_cea_mode(mode);
> >>  
> >>frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
> >> +
> >> +  /* Populate picture aspect ratio from CEA mode list */
> >> +  if (frame->video_code > 0)
> >> +  frame->picture_aspect = drm_get_cea_aspect_ratio(
> >> +  frame->video_code);
> >> +  else {
> >> +  if (!(mode->vdisplay % 3) &&
> >> +  (((mode->vdisplay * 4) / 3) == mode->hdisplay))
> >> +  frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
> >> +  else if (!(mode->vdisplay % 9) &&
> >> +  (((mode->vdisplay * 16) / 9) == mode->hdisplay))
> >> +  frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
> >> +  }
> > 
> > I'm not sure if providing the PAR for non-CEA modes like this makes
> > any real difference. But I guess it can't hurt since you only provide
> > it for exact matches.
> > 
> > But the matches are maybe even a bit too exact. For instance 1366x768
> > will not match the 16:9 case. So maybe it should be calculated in a bit
> > more relaxed way.
> > 
> > Or just dropped totally. I'm not sure.
> > 
> Maybe we can drop it for now (for this patch) and come up with another
> patch containing calculations which are more relaxed than the above.
> What do you think?

That's fine by me.

> >> +
> >>frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
> >>frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
> >>  
> >> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> >> index 27f828c..50dc55a 100644
> >> --- a/include/drm/drm_crtc.h
> >> +++ b/include/drm/drm_crtc.h
> >> @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device 
> >> *dev,
> >>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
> >>void *data, struct drm_file *file_priv);
> >>  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
> >> +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 
> >> video_code);
> >>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
> >>  extern bool drm_detect_monitor_audio(struct edid *edid);
> >>  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
> >> -- 
> >> 1.9.1
> > 

-- 
Ville Syrj?l?
Intel OTC


[PATCH v2] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Vandana Kannan
Populate PAR in infoframe structure. If there is a user setting for PAR, then
that value is set. Else, value is taken from CEA mode list if VIC is found.
Else, PAR is calculated from resolution. If none of these conditions are
satisfied, PAR is NONE as per initialization.

v2: Removed the part which sets PAR according to user input, based on
Daniel's review comments.

A separate patch will be submitted to create a property that would enable a
user space app to set aspect ratio for AVI infoframe.

Signed-off-by: Vandana Kannan 
Cc: Jesse Barnes 
Cc: Vijay Purushothaman 
Cc: Ville Syrj?l? 
Cc: intel-gfx at lists.freedesktop.org
Reviewed-by: Jesse Barnes 
---
 drivers/gpu/drm/drm_edid.c | 29 +
 include/drm/drm_crtc.h |  1 +
 2 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index d4e3f9d..fee24d3 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
*to_match)
 }
 EXPORT_SYMBOL(drm_match_cea_mode);

+/**
+ * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
+ * the input VIC from the CEA mode list
+ *
+ * Returns picture aspect ratio
+ */
+enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
+{
+   /* return picture aspect ratio for video_code - 1 to access the
+* right array element
+   */
+   return edid_cea_modes[video_code-1].picture_aspect_ratio;
+}
+EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
+
 /*
  * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
  * specific block).
@@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
hdmi_avi_infoframe *frame,
frame->video_code = drm_match_cea_mode(mode);

frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
+
+   /* Populate picture aspect ratio from CEA mode list */
+   if (frame->video_code > 0)
+   frame->picture_aspect = drm_get_cea_aspect_ratio(
+   frame->video_code);
+   else {
+   if (!(mode->vdisplay % 3) &&
+   (((mode->vdisplay * 4) / 3) == mode->hdisplay))
+   frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
+   else if (!(mode->vdisplay % 9) &&
+   (((mode->vdisplay * 16) / 9) == mode->hdisplay))
+   frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
+   }
+
frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 27f828c..50dc55a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
 extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
+extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
 extern bool drm_detect_hdmi_monitor(struct edid *edid);
 extern bool drm_detect_monitor_audio(struct edid *edid);
 extern bool drm_rgb_quant_range_selectable(struct edid *edid);
-- 
1.9.1



[Bug 41086] Screen update problems when scrolling to the right in many (any?) java apps

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=41086

bugs.freedesktop.org.674292 at mstier.de changed:

   What|Removed |Added

Summary|[r600] Screen update|Screen update problems when
   |problems when scrolling to  |scrolling to the right in
   |the right in tvbrowser  |many (any?) java apps
   |(java app)  |

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/b895ec29/attachment.html>


[Bug 41086] [r600] Screen update problems when scrolling to the right in tvbrowser (java app)

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=41086

bugs.freedesktop.org.674292 at mstier.de changed:

   What|Removed |Added

  Component|DRM/Radeon  |libdrm

--- Comment #16 from bugs.freedesktop.org.674292 at mstier.de ---
It is still there in Ubuntu 12.04 LTS (up-to-date). Here, too, is a pretty
recent nvidia (GTX 660) at work with proprietary drivers (v304.116). All
standard setup coming with the distro, but using the gome classic 2d desktop.

See also https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/1032936 and
https://netbeans.org/bugzilla/show_bug.cgi?id=243407.

A workaround is -Dsun.java2d.opengl=true.

The problem is pretty easily reproducible by installing Netbeans und opening
the file dialog (native or metal theme), going into a large folder like
/usr/share and scrolling right. You see it immediately. You can barely browse
ANYTHING AT ALL.

One hint: it is *NOT* appearing via "ssh otherUserNotRunningX at localhost -Y
.../bin/netbeans", even when explcitily setting sun.java2d.opengl to false.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/e6da4372/attachment-0001.html>


crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Daniel Vetter
On Tue, Apr 01, 2014 at 08:40:54AM -0400, Rob Clark wrote:
> No, not really.  I was just trying to get away with pushing some
> complexity (for case #1) up to userspace instead of doing it in the
> kernel.

To clarify: I don't think it makes sense to fully abstract this away in
the kernel, especially if userspace needs to be aware of the boundary
between the crtcs so that it can correctly tile up the logical frambuffer.
But I'm not sure whether trying to make that possible with a generic
userspace driver is sensible, or whether having a bit of magic glue code
in the ddx/wayland/hwc part for e.g. msm is the better option, at least in
the short term.

Since if the set of useable planes actually changes we need to push that
decision up the stack even further like wayland/hwc currently allow, and
maybe there's some things we need to fix at that layer first. Once we've
learned that lesson we can push things down again and add a neat little
generic kernel interface. At least thus far we've always done a bit of
prototyping with driver-specific code to learn a few lessons, e.g. the
various pieces of non-standard plane/overlay in i915.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


Framebuffer corruption in QEMU or Linux's cirrus driver

2014-04-01 Thread Andy Lutomirski
On Tue, Apr 1, 2014 at 3:09 PM, Andy Lutomirski  wrote:
> Running:
>
> ./virtme-run --installed-kernel
>
> from this virtme commit:
>
> https://git.kernel.org/cgit/utils/kernel/virtme/virtme.git/commit/?id=2b409a086d15b7a878c7d5204b1f44a6564a341f
>
> results in a bunch of missing lines of text once bootup finishes.
> Pressing enter a few times gradually fixes it.
>
> I don't know whether this is a qemu bug or a Linux bug.
>
> I'm seeing this on Fedora's 3.13.7 kernel and on a fairly recent
> 3.14-rc kernel.  For the latter, cirrus is built-in (not a module),
> I'm running:
>
> virtme-run --kimg arch/x86/boot/bzImage
>
> and I see more profound corruption.

I'm guessing this is a cirrus drm bug.  bochs-drm (using virtme-run
--installed-kernel --qemu-opts -vga std) does not appear to have the
same issue.  Neither does qxl.

(qxl is painfully slow, though, and it doesn't seem to be using UC memory.)

--Andy


[PATCHv5 14/14] drm/doc: Update plane documentation and add plane helper library

2014-04-01 Thread Matt Roper
Signed-off-by: Matt Roper 
---
 Documentation/DocBook/drm.tmpl | 50 --
 1 file changed, 43 insertions(+), 7 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index 9f5457a..702c4474 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -1194,7 +1194,7 @@ int max_width, max_height;
   pointer to CRTC functions.
 
   
-  
+  
 CRTC Operations
 
   Set Configuration
@@ -1335,15 +1335,47 @@ int max_width, max_height;
optionally scale it to a destination size. The result is then blended
with or overlayed on top of a CRTC.
   
+  
+  The DRM core recognizes three types of planes:
+  
+
+DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC.  Primary
+planes are the planes operated upon by by CRTC modesetting and flipping
+operations described in .
+
+
+DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC.  Cursor
+planes are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and
+DRM_IOCTL_MODE_CURSOR2 ioctls.
+
+
+DRM_PLANE_TYPE_OVERLAY represents all non-primary, non-cursor planes.
+Some drivers refer to these types of planes as "sprites" internally.
+
+  
+  For compatibility with legacy userspace, only overlay planes are made
+  available to userspace by default.  Userspace clients may set the
+  DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that
+  they wish to receive a universal plane list containing all plane types.
+  
   
 Plane Initialization
 
-  Planes are optional. To create a plane, a KMS drivers allocates and
+  To create a plane, a KMS drivers allocates and
   zeroes an instances of struct drm_plane
   (possibly as part of a larger structure) and registers it with a call
-  to drm_plane_init. The function takes a bitmask
+  to drm_universal_plane_init. The function takes 
a bitmask
   of the CRTCs that can be associated with the plane, a pointer to the
-  plane functions and a list of format supported formats.
+  plane functions, a list of format supported formats, and the type of
+  plane (primary, cursor, or overlay) being initialized.
+
+
+  Cursor and overlay planes are optional.  All drivers should provide
+  one primary plane per CRTC (although this requirement may change in
+  the future); drivers that do not wish to provide special handling for
+  primary planes may make use of the helper functions described in
+   to create and register a
+  primary plane with standard capabilities.
 
   
   
@@ -1774,7 +1806,7 @@ void intel_crt_init(struct drm_device *dev)
   
 Mode Setting Helper Functions
 
-  The CRTC, encoder and connector functions provided by the drivers
+  The plane, CRTC, encoder and connector functions provided by the drivers
   implement the DRM API. They're called by the DRM core and ioctl handlers
   to handle device state changes and configuration request. As implementing
   those functions often requires logic not specific to drivers, mid-layer
@@ -1782,8 +1814,8 @@ void intel_crt_init(struct drm_device *dev)
 
 
   The DRM core contains one mid-layer implementation. The mid-layer 
provides
-  implementations of several CRTC, encoder and connector functions (called
-  from the top of the mid-layer) that pre-process requests and call
+  implementations of several plane, CRTC, encoder and connector functions
+  (called from the top of the mid-layer) that pre-process requests and call
   lower-level functions provided by the driver (at the bottom of the
   mid-layer). For instance, the
   drm_crtc_helper_set_config function can be used to
@@ -2293,6 +2325,10 @@ void intel_crt_init(struct drm_device *dev)
 !Iinclude/linux/hdmi.h
 !Edrivers/video/hdmi.c
 
+
+  Plane Helper Reference
+!Edrivers/gpu/drm/drm_plane_helper.c Plane Helpers
+
   

   
-- 
1.8.5.1



[PATCHv5 13/14] drm: Allow userspace to ask for universal plane list (v2)

2014-04-01 Thread Matt Roper
Userspace clients which wish to receive all DRM planes (primary and
cursor planes in addition to the traditional overlay planes) may set the
DRM_CLIENT_CAP_UNIVERSAL_PLANES capability.

v2: Hide behind drm.universal_planes module option [suggested by
Daniel Vetter]

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/drm_crtc.c  | 20 +++-
 drivers/gpu/drm/drm_ioctl.c |  7 +++
 drivers/gpu/drm/drm_stub.c  |  5 +
 include/drm/drmP.h  |  6 ++
 include/uapi/drm/drm.h  |  8 
 5 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 18321fb..d8b7099 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1959,6 +1959,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
struct drm_plane *plane;
uint32_t __user *plane_ptr;
int copied = 0, ret = 0;
+   unsigned num_planes;

if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
@@ -1966,17 +1967,26 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
drm_modeset_lock_all(dev);
config = >mode_config;

+   if (file_priv->universal_planes)
+   num_planes = config->num_total_plane;
+   else
+   num_planes = config->num_overlay_plane;
+
/*
 * This ioctl is called twice, once to determine how much space is
 * needed, and the 2nd time to fill it.
 */
-   if (config->num_overlay_plane &&
-   (plane_resp->count_planes >= config->num_overlay_plane)) {
+   if (num_planes &&
+   (plane_resp->count_planes >= num_planes)) {
plane_ptr = (uint32_t __user *)(unsigned 
long)plane_resp->plane_id_ptr;

list_for_each_entry(plane, >plane_list, head) {
-   /* Only advertise overlays to userspace for now. */
-   if (plane->type != DRM_PLANE_TYPE_OVERLAY)
+   /*
+* Unless userspace set the 'universal planes'
+* capability bit, only advertise overlays.
+*/
+   if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
+   !file_priv->universal_planes)
continue;

if (put_user(plane->base.id, plane_ptr + copied)) {
@@ -1986,7 +1996,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
copied++;
}
}
-   plane_resp->count_planes = config->num_overlay_plane;
+   plane_resp->count_planes = num_planes;

 out:
drm_modeset_unlock_all(dev);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index f4dc9b7..93a4204 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -328,6 +328,13 @@ drm_setclientcap(struct drm_device *dev, void *data, 
struct drm_file *file_priv)
return -EINVAL;
file_priv->stereo_allowed = req->value;
break;
+   case DRM_CLIENT_CAP_UNIVERSAL_PLANES:
+   if (!drm_universal_planes)
+   return -EINVAL;
+   if (req->value > 1)
+   return -EINVAL;
+   file_priv->universal_planes = req->value;
+   break;
default:
return -EINVAL;
}
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index fac6f98..4c24c3a 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -45,6 +45,10 @@ EXPORT_SYMBOL(drm_debug);
 unsigned int drm_rnodes = 0;   /* 1 to enable experimental render nodes API */
 EXPORT_SYMBOL(drm_rnodes);

+/* 1 to allow user space to request universal planes (experimental) */
+unsigned int drm_universal_planes = 0;
+EXPORT_SYMBOL(drm_universal_planes);
+
 unsigned int drm_vblank_offdelay = 5000;/* Default to 5000 msecs. */
 EXPORT_SYMBOL(drm_vblank_offdelay);

@@ -68,6 +72,7 @@ MODULE_PARM_DESC(timestamp_monotonic, "Use monotonic 
timestamps");

 module_param_named(debug, drm_debug, int, 0600);
 module_param_named(rnodes, drm_rnodes, int, 0600);
+module_param_named(universal_planes, drm_universal_planes, int, 0600);
 module_param_named(vblankoffdelay, drm_vblank_offdelay, int, 0600);
 module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 
0600);
 module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 9e347fa..52d100c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -409,6 +409,11 @@ struct drm_file {
unsigned is_master :1;
/* true when the client has asked us to expose stereo 3D mode flags */
unsigned stereo_allowed :1;
+   /*
+* true if client understands CRTC primary planes and cursor planes
+* in the plane list
+

[PATCHv5 12/14] drm: Remove unused drm_crtc->fb

2014-04-01 Thread Matt Roper
Signed-off-by: Matt Roper 
---
 include/drm/drm_crtc.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index f147a84..c061bb3 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -311,9 +311,6 @@ struct drm_crtc {
struct drm_plane *primary;
struct drm_plane *cursor;

-   /* framebuffer the connector is currently bound to */
-   struct drm_framebuffer *fb;
-
/* Temporary tracking of the old fb while a modeset is ongoing. Used
 * by drm_mode_set_config_internal to implement correct refcounting. */
struct drm_framebuffer *old_fb;
-- 
1.8.5.1



[PATCHv5 11/14] drm: Replace crtc fb with primary plane fb (v3)

2014-04-01 Thread Matt Roper
Now that CRTC's have a primary plane, there's no need to track the
framebuffer in the CRTC.  Replace all references to the CRTC fb with the
primary plane's fb.

This patch was generated by the Coccinelle semantic patching tool using
the following rules:

@@ struct drm_crtc C; @@
-   (C).fb
+   C.primary->fb

@@ struct drm_crtc *C; @@
-   (C)->fb
+   C->primary->fb

v3: Generate patch via coccinelle.  Actual removal of crtc->fb has been
moved to a subsequent patch.

v2: Fixup several lingering crtc->fb instances that were missed in the
first patch iteration.  [Rob Clark]

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/armada/armada_crtc.c |  23 ++---
 drivers/gpu/drm/ast/ast_mode.c   |  12 +--
 drivers/gpu/drm/bochs/bochs_kms.c|   4 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c |  10 +-
 drivers/gpu/drm/drm_crtc.c   |  26 ++---
 drivers/gpu/drm/drm_crtc_helper.c|  20 ++--
 drivers/gpu/drm/drm_fb_helper.c  |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c |  20 ++--
 drivers/gpu/drm/gma500/cdv_intel_display.c   |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_dp.c|   2 +-
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c  |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_lvds.c  |   2 +-
 drivers/gpu/drm/gma500/gma_display.c |  16 ++--
 drivers/gpu/drm/gma500/mdfld_dsi_output.c|   2 +-
 drivers/gpu/drm/gma500/mdfld_intel_display.c |  16 ++--
 drivers/gpu/drm/gma500/oaktrail_crtc.c   |  12 +--
 drivers/gpu/drm/gma500/psb_intel_display.c   |   2 +-
 drivers/gpu/drm/gma500/psb_intel_lvds.c  |   2 +-
 drivers/gpu/drm/gma500/psb_intel_sdvo.c  |   2 +-
 drivers/gpu/drm/i915/i915_debugfs.c  |   4 +-
 drivers/gpu/drm/i915/i915_irq.c  |   4 +-
 drivers/gpu/drm/i915/intel_display.c | 138 +--
 drivers/gpu/drm/i915/intel_dp.c  |   4 +-
 drivers/gpu/drm/i915/intel_fbdev.c   |   6 +-
 drivers/gpu/drm/i915/intel_overlay.c |   4 +-
 drivers/gpu/drm/i915/intel_pm.c  |  36 +++
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  26 ++---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c |  28 +++---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c |  22 ++---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c  |  20 ++--
 drivers/gpu/drm/nouveau/dispnv04/dfp.c   |   2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c|   8 +-
 drivers/gpu/drm/nouveau/nv50_display.c   |  17 ++--
 drivers/gpu/drm/omapdrm/omap_crtc.c  |  10 +-
 drivers/gpu/drm/omapdrm/omap_fb.c|   2 +-
 drivers/gpu/drm/qxl/qxl_display.c|  10 +-
 drivers/gpu/drm/radeon/atombios_crtc.c   |  20 ++--
 drivers/gpu/drm/radeon/r100.c|   4 +-
 drivers/gpu/drm/radeon/radeon_connectors.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_display.c  |   4 +-
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c  |  16 ++--
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c   |  10 +-
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c|  14 +--
 drivers/gpu/drm/tegra/dc.c   |  16 ++--
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c |   8 +-
 drivers/gpu/drm/udl/udl_modeset.c|   2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c  |  14 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c  |   8 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |   8 +-
 drivers/staging/imx-drm/ipuv3-crtc.c |   6 +-
 51 files changed, 329 insertions(+), 327 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c 
b/drivers/gpu/drm/armada/armada_crtc.c
index d8e3982..5831e41 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -478,11 +478,12 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
unsigned i;
bool interlaced;

-   drm_framebuffer_reference(crtc->fb);
+   drm_framebuffer_reference(crtc->primary->fb);

interlaced = !!(adj->flags & DRM_MODE_FLAG_INTERLACE);

-   i = armada_drm_crtc_calc_fb(dcrtc->crtc.fb, x, y, regs, interlaced);
+   i = armada_drm_crtc_calc_fb(dcrtc->crtc.primary->fb,
+   x, y, regs, interlaced);

rm = adj->crtc_hsync_start - adj->crtc_hdisplay;
lm = adj->crtc_htotal - adj->crtc_hsync_end;
@@ -567,10 +568,10 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc,
}

val = CFG_GRA_ENA | CFG_GRA_HSMOOTH;
-   val |= CFG_GRA_FMT(drm_fb_to_armada_fb(dcrtc->crtc.fb)->fmt);
-   val |= CFG_GRA_MOD(drm_fb_to_armada_fb(dcrtc->crtc.fb)->mod);
+   val |= CFG_GRA_FMT(drm_fb_to_armada_fb(dcrtc->crtc.primary->fb)->fmt);
+   val |= CFG_GRA_MOD(drm_fb_to_armada_fb(dcrtc->crtc.primary->fb)->mod);

-   if (drm_fb_to_armada_fb(dcrtc->crtc.fb)->fmt > CFG_420)
+   if (drm_fb_to_armada_fb(dcrtc->crtc.primary->fb)->fmt > CFG_420)
val |= 

[PATCHv5 10/14] drm/msm: Switch to universal plane API's

2014-04-01 Thread Matt Roper
Use drm_universal_plane_init() and drm_crtc_init_with_planes() rather
than the legacy drm_plane_init() / drm_crtc_init().  This will ensure
that the proper primary plane is registered with the DRM (and eventually
exposed to userspace in future patches).

Cc: Rob Clark 
Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c  | 5 -
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 8 +---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c  | 5 -
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 8 +---
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
index 84c5b13..fc1cdfa 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
@@ -740,6 +740,9 @@ void mdp4_crtc_attach(struct drm_crtc *crtc, struct 
drm_plane *plane)

 void mdp4_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane)
 {
+   /* don't actually detatch our primary plane: */
+   if (to_mdp4_crtc(crtc)->plane == plane)
+   return;
set_attach(crtc, mdp4_plane_pipe(plane), NULL);
 }

@@ -791,7 +794,7 @@ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev,

INIT_FENCE_CB(_crtc->pageflip_cb, pageflip_cb);

-   drm_crtc_init(dev, crtc, _crtc_funcs);
+   drm_crtc_init_with_planes(dev, crtc, plane, NULL, _crtc_funcs);
drm_crtc_helper_add(crtc, _crtc_helper_funcs);

mdp4_plane_install_properties(mdp4_crtc->plane, >base);
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
index 1e893dd..66f33db 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
@@ -222,6 +222,7 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
struct drm_plane *plane = NULL;
struct mdp4_plane *mdp4_plane;
int ret;
+   enum drm_plane_type type;

mdp4_plane = kzalloc(sizeof(*mdp4_plane), GFP_KERNEL);
if (!mdp4_plane) {
@@ -237,9 +238,10 @@ struct drm_plane *mdp4_plane_init(struct drm_device *dev,
mdp4_plane->nformats = mdp4_get_formats(pipe_id, mdp4_plane->formats,
ARRAY_SIZE(mdp4_plane->formats));

-   drm_plane_init(dev, plane, 0xff, _plane_funcs,
-   mdp4_plane->formats, mdp4_plane->nformats,
-   private_plane);
+   type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
+   drm_universal_plane_init(dev, plane, 0xff, _plane_funcs,
+mdp4_plane->formats, mdp4_plane->nformats,
+type);

mdp4_plane_install_properties(plane, >base);

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
index f279402..54afdb2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
@@ -524,6 +524,9 @@ void mdp5_crtc_attach(struct drm_crtc *crtc, struct 
drm_plane *plane)

 void mdp5_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane)
 {
+   /* don't actually detatch our primary plane: */
+   if (to_mdp5_crtc(crtc)->plane == plane)
+   return;
set_attach(crtc, mdp5_plane_pipe(plane), NULL);
 }

@@ -559,7 +562,7 @@ struct drm_crtc *mdp5_crtc_init(struct drm_device *dev,

INIT_FENCE_CB(_crtc->pageflip_cb, pageflip_cb);

-   drm_crtc_init(dev, crtc, _crtc_funcs);
+   drm_crtc_init_with_planes(dev, crtc, plane, NULL, _crtc_funcs);
drm_crtc_helper_add(crtc, _crtc_helper_funcs);

mdp5_plane_install_properties(mdp5_crtc->plane, >base);
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 0ac8bb5..47f7bbb 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -358,6 +358,7 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
struct drm_plane *plane = NULL;
struct mdp5_plane *mdp5_plane;
int ret;
+   enum drm_plane_type type;

mdp5_plane = kzalloc(sizeof(*mdp5_plane), GFP_KERNEL);
if (!mdp5_plane) {
@@ -373,9 +374,10 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
mdp5_plane->nformats = mdp5_get_formats(pipe, mdp5_plane->formats,
ARRAY_SIZE(mdp5_plane->formats));

-   drm_plane_init(dev, plane, 0xff, _plane_funcs,
-   mdp5_plane->formats, mdp5_plane->nformats,
-   private_plane);
+   type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
+   drm_universal_plane_init(dev, plane, 0xff, _plane_funcs,
+mdp5_plane->formats, mdp5_plane->nformats,
+type);

mdp5_plane_install_properties(plane, >base);

-- 
1.8.5.1



[PATCHv5 09/14] drm: Add drm_crtc_init_with_planes() (v2)

2014-04-01 Thread Matt Roper
Add a new drm_crtc_init_with_planes() to allow drivers to provide
specific primary and cursor planes at CRTC initialization.  The existing
drm_crtc_init() interface remains to avoid driver churn in existing
drivers; it will initialize the CRTC with a plane helper-created primary
plane and no cursor plane.

v2:
  - Move drm_crtc_init() to plane helper file so that nothing in the DRM
core depends on helpers.  [suggested by Daniel Vetter]
  - Keep cursor parameter to drm_crtc_init_with_planes() a void* until
we actually add cursor support.  [suggested by Daniel Vetter]

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/drm_crtc.c | 19 +++
 drivers/gpu/drm/drm_plane_helper.c | 21 +
 include/drm/drm_crtc.h | 11 +++
 3 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index eb21659..110e5ce 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -692,9 +692,12 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
 EXPORT_SYMBOL(drm_framebuffer_remove);

 /**
- * drm_crtc_init - Initialise a new CRTC object
+ * drm_crtc_init_with_planes - Initialise a new CRTC object with
+ *specified primary and cursor planes.
  * @dev: DRM device
  * @crtc: CRTC object to init
+ * @primary: Primary plane for CRTC
+ * @cursor: Cursor plane for CRTC
  * @funcs: callbacks for the new CRTC
  *
  * Inits a new object created as base part of a driver crtc object.
@@ -702,8 +705,10 @@ EXPORT_SYMBOL(drm_framebuffer_remove);
  * Returns:
  * Zero on success, error code on failure.
  */
-int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
-  const struct drm_crtc_funcs *funcs)
+int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
+ struct drm_plane *primary,
+ void *cursor,
+ const struct drm_crtc_funcs *funcs)
 {
int ret;

@@ -724,12 +729,16 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc 
*crtc,
list_add_tail(>head, >mode_config.crtc_list);
dev->mode_config.num_crtc++;

+   crtc->primary = primary;
+   if (primary)
+   primary->possible_crtcs = 1 << drm_crtc_index(crtc);
+
  out:
drm_modeset_unlock_all(dev);

return ret;
 }
-EXPORT_SYMBOL(drm_crtc_init);
+EXPORT_SYMBOL(drm_crtc_init_with_planes);

 /**
  * drm_crtc_cleanup - Clean up the core crtc usage
@@ -2219,6 +2228,8 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)

ret = crtc->funcs->set_config(set);
if (ret == 0) {
+   crtc->primary->crtc = crtc;
+
/* crtc->fb must be updated by ->set_config, enforces this. */
WARN_ON(fb != crtc->fb);
}
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 2f2374a..e768d35 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -310,3 +310,24 @@ struct drm_plane *drm_primary_helper_create_plane(struct 
drm_device *dev,
 }
 EXPORT_SYMBOL(drm_primary_helper_create_plane);

+/**
+ * drm_crtc_init - Legacy CRTC initialization function
+ * @dev: DRM device
+ * @crtc: CRTC object to init
+ * @funcs: callbacks for the new CRTC
+ *
+ * Initialize a CRTC object with a default helper-provided primary plane and no
+ * cursor plane.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
+ const struct drm_crtc_funcs *funcs)
+{
+   struct drm_plane *primary;
+
+   primary = drm_primary_helper_create_plane(dev, NULL, 0);
+   return drm_crtc_init_with_planes(dev, crtc, primary, NULL, funcs);
+}
+EXPORT_SYMBOL(drm_crtc_init);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 45bcfc2..f147a84 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -270,6 +270,8 @@ struct drm_crtc_funcs {
  * @dev: parent DRM device
  * @head: list management
  * @base: base KMS object for ID tracking etc.
+ * @primary: primary plane for this CRTC
+ * @cursor: cursor plane for this CRTC
  * @enabled: is this CRTC enabled?
  * @mode: current mode timings
  * @hwmode: mode timings as programmed to hw regs
@@ -305,6 +307,10 @@ struct drm_crtc {

struct drm_mode_object base;

+   /* primary and cursor planes for CRTC */
+   struct drm_plane *primary;
+   struct drm_plane *cursor;
+
/* framebuffer the connector is currently bound to */
struct drm_framebuffer *fb;

@@ -824,6 +830,11 @@ extern void drm_modeset_lock_all(struct drm_device *dev);
 extern void drm_modeset_unlock_all(struct drm_device *dev);
 extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);

+extern int drm_crtc_init_with_planes(struct drm_device *dev,
+struct drm_crtc *crtc,
+ 

[PATCHv5 08/14] drm: Add plane type property (v2)

2014-04-01 Thread Matt Roper
Add a plane type property to allow userspace to distinguish plane types.

v2: Driver-specific churn eliminated now that drm_plane_init() and
drm_universal_plane_init() were separated out in a previous patch.

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/drm_crtc.c | 23 +++
 include/drm/drm_crtc.h |  1 +
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index a7384d7..eb21659 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -121,6 +121,13 @@ static const struct drm_prop_enum_list 
drm_dpms_enum_list[] =

 DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)

+static const struct drm_prop_enum_list drm_plane_type_enum_list[] =
+{
+   { DRM_PLANE_TYPE_OVERLAY, "Overlay" },
+   { DRM_PLANE_TYPE_PRIMARY, "Primary" },
+   { DRM_PLANE_TYPE_CURSOR, "Cursor" },
+};
+
 /*
  * Optional properties
  */
@@ -1165,6 +1172,21 @@ static int 
drm_mode_create_standard_connector_properties(struct drm_device *dev)
return 0;
 }

+static int drm_mode_create_standard_plane_properties(struct drm_device *dev)
+{
+   struct drm_property *type;
+
+   /*
+* Standard properties (apply to all planes)
+*/
+   type = drm_property_create_enum(dev, DRM_MODE_PROP_IMMUTABLE,
+   "type", drm_plane_type_enum_list,
+   ARRAY_SIZE(drm_plane_type_enum_list));
+   dev->mode_config.plane_type_property = type;
+
+   return 0;
+}
+
 /**
  * drm_mode_create_dvi_i_properties - create DVI-I specific connector 
properties
  * @dev: DRM device
@@ -4568,6 +4590,7 @@ void drm_mode_config_init(struct drm_device *dev)

drm_modeset_lock_all(dev);
drm_mode_create_standard_connector_properties(dev);
+   drm_mode_create_standard_plane_properties(dev);
drm_modeset_unlock_all(dev);

/* Just to be sure */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index fee37b0..45bcfc2 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -771,6 +771,7 @@ struct drm_mode_config {
struct list_head property_blob_list;
struct drm_property *edid_property;
struct drm_property *dpms_property;
+   struct drm_property *plane_type_property;

/* DVI-I properties */
struct drm_property *dvi_i_subconnector_property;
-- 
1.8.5.1



[PATCHv5 07/14] drm: Add drm_universal_plane_init()

2014-04-01 Thread Matt Roper
Add a new plane initialization interface for universal plane support
that allows a specific plane type (primary, cursor, or overlay) to
be specified.

drm_plane_init() remains as a compatibility API to reduce churn in
existing drivers.  The 'bool priv' parameter has been changed to
'bool is_primary' under the assumption that all existing uses of
private planes were representing primary planes.

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/drm_crtc.c | 84 ++
 include/drm/drm_crtc.h |  9 -
 2 files changed, 63 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 99e6b22..a7384d7 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1000,26 +1000,25 @@ void drm_encoder_cleanup(struct drm_encoder *encoder)
 EXPORT_SYMBOL(drm_encoder_cleanup);

 /**
- * drm_plane_init - Initialise a new plane object
+ * drm_universal_plane_init - Initialize a new universal plane object
  * @dev: DRM device
  * @plane: plane object to init
  * @possible_crtcs: bitmask of possible CRTCs
  * @funcs: callbacks for the new plane
  * @formats: array of supported formats (%DRM_FORMAT_*)
  * @format_count: number of elements in @formats
- * @priv: plane is private (hidden from userspace)?
+ * @type: type of plane (overlay, primary, cursor)
  *
- * Inits a preallocate plane object created as base part of a driver plane
- * object.
+ * Initializes a plane object of type @type.
  *
  * Returns:
  * Zero on success, error code on failure.
  */
-int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
-  unsigned long possible_crtcs,
-  const struct drm_plane_funcs *funcs,
-  const uint32_t *formats, uint32_t format_count,
-  bool priv)
+int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
+unsigned long possible_crtcs,
+const struct drm_plane_funcs *funcs,
+const uint32_t *formats, uint32_t format_count,
+enum drm_plane_type type)
 {
int ret;

@@ -1044,26 +1043,53 @@ int drm_plane_init(struct drm_device *dev, struct 
drm_plane *plane,
memcpy(plane->format_types, formats, format_count * sizeof(uint32_t));
plane->format_count = format_count;
plane->possible_crtcs = possible_crtcs;
-   plane->type = DRM_PLANE_TYPE_OVERLAY;
+   plane->type = type;

-   /* private planes are not exposed to userspace, but depending on
-* display hardware, might be convenient to allow sharing programming
-* for the scanout engine with the crtc implementation.
-*/
-   if (!priv) {
-   list_add_tail(>head, >mode_config.plane_list);
-   dev->mode_config.num_total_plane++;
-   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-   dev->mode_config.num_overlay_plane++;
-   } else {
-   INIT_LIST_HEAD(>head);
-   }
+   list_add_tail(>head, >mode_config.plane_list);
+   dev->mode_config.num_total_plane++;
+   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+   dev->mode_config.num_overlay_plane++;
+
+   drm_object_attach_property(>base,
+  dev->mode_config.plane_type_property,
+  plane->type);

  out:
drm_modeset_unlock_all(dev);

return ret;
 }
+EXPORT_SYMBOL(drm_universal_plane_init);
+
+/**
+ * drm_plane_init - Initialize a legacy plane
+ * @dev: DRM device
+ * @plane: plane object to init
+ * @possible_crtcs: bitmask of possible CRTCs
+ * @funcs: callbacks for the new plane
+ * @formats: array of supported formats (%DRM_FORMAT_*)
+ * @format_count: number of elements in @formats
+ * @is_primary: plane type (primary vs overlay)
+ *
+ * Legacy API to initialize a DRM plane.
+ *
+ * New drivers should call drm_universal_plane_init() instead.
+ *
+ * Returns:
+ * Zero on success, error code on failure.
+ */
+int drm_plane_init(struct drm_device *dev, struct drm_plane *plane,
+  unsigned long possible_crtcs,
+  const struct drm_plane_funcs *funcs,
+  const uint32_t *formats, uint32_t format_count,
+  bool is_primary)
+{
+   enum drm_plane_type type;
+
+   type = is_primary ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
+   return drm_universal_plane_init(dev, plane, possible_crtcs, funcs,
+   formats, format_count, type);
+}
 EXPORT_SYMBOL(drm_plane_init);

 /**
@@ -1081,13 +1107,13 @@ void drm_plane_cleanup(struct drm_plane *plane)
drm_modeset_lock_all(dev);
kfree(plane->format_types);
drm_mode_object_put(dev, >base);
-   /* if not added to a list, it must be a private plane */
-   if (!list_empty(>head)) {
-   list_del(>head);
-

[PATCHv5 06/14] drm: Add primary plane helpers (v3)

2014-04-01 Thread Matt Roper
When we expose non-overlay planes to userspace, they will become
accessible via standard userspace plane API's.  We should be able to
handle the standard plane operations against primary planes in a generic
way via the modeset handler.

Drivers that can program primary planes more efficiently, that want to
use their own primary plane structure to track additional information,
or that don't have the limitations assumed by the helpers are free to
provide their own implementation of some or all of these handlers.

v3: Tweak kerneldoc formatting slightly to avoid ugliness
v2:
 - Move plane helpers to a new file (drm_plane_helper.c)
 - Tighten checks on update handler (check for scaling, CRTC coverage,
   subpixel positioning)
 - Pass proper panning parameters to modeset interface
 - Disallow disabling primary plane (and thus CRTC) if other planes are
   still active on the CRTC.
 - Use a minimal format list that should work on all hardware/drivers.
   Drivers may call this function with a more accurate plane list to
   enable additional formats they can support.

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/Makefile   |   3 +-
 drivers/gpu/drm/drm_plane_helper.c | 312 +
 include/drm/drm_plane_helper.h |  49 ++
 3 files changed, 363 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_plane_helper.c
 create mode 100644 include/drm/drm_plane_helper.h

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 5e792b0..9d25dbb 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -13,7 +13,8 @@ drm-y   :=drm_auth.o drm_buffer.o drm_bufs.o 
drm_cache.o \
drm_crtc.o drm_modes.o drm_edid.o \
drm_info.o drm_debugfs.o drm_encoder_slave.o \
drm_trace_points.o drm_global.o drm_prime.o \
-   drm_rect.o drm_vma_manager.o drm_flip_work.o
+   drm_rect.o drm_vma_manager.o drm_flip_work.o \
+   drm_plane_helper.o

 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
new file mode 100644
index 000..2f2374a
--- /dev/null
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -0,0 +1,312 @@
+/*
+ * Copyright (C) 2014 Intel Corporation
+ *
+ * DRM universal plane helper functions
+ *
+ * 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 
+
+#define SUBPIXEL_MASK 0x
+
+/*
+ * This is the minimal list of formats that seem to be safe for modeset use
+ * with all current DRM drivers.  Most hardware can actually support more
+ * formats than this and drivers may specify a more accurate list when
+ * creating the primary plane.  However drivers that still call
+ * drm_plane_init() will use this minimal format list as the default.
+ */
+const static uint32_t safe_modeset_formats[] = {
+   DRM_FORMAT_XRGB,
+   DRM_FORMAT_ARGB,
+};
+
+/*
+ * Returns the connectors currently associated with a CRTC.  This function
+ * should be called twice:  once with a NULL connector list to retrieve
+ * the list size, and once with the properly allocated list to be filled in.
+ */
+static int get_connectors_for_crtc(struct drm_crtc *crtc,
+  struct drm_connector **connector_list,
+  int num_connectors)
+{
+   struct drm_device *dev = crtc->dev;
+   struct drm_connector *connector;
+   int count = 0;
+
+   list_for_each_entry(connector, >mode_config.connector_list, head)
+   if (connector->encoder && connector->encoder->crtc == crtc) {
+   if (connector_list != NULL && count < num_connectors)
+   *(connector_list++) = connector;
+
+   count++;
+   }
+
+   

[PATCHv5 05/14] drm: Make drm_crtc_check_viewport non-static

2014-04-01 Thread Matt Roper
This function will be used by the universal plane helpers and may also
be useful for individual drivers.

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/drm_crtc.c | 20 +---
 include/drm/drm_crtc.h |  4 
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 7def92b..99e6b22 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2186,14 +2186,19 @@ int drm_mode_set_config_internal(struct drm_mode_set 
*set)
 }
 EXPORT_SYMBOL(drm_mode_set_config_internal);

-/*
- * Checks that the framebuffer is big enough for the CRTC viewport
- * (x, y, hdisplay, vdisplay)
+/**
+ * drm_crtc_check_viewport - Checks that a framebuffer is big enough for the
+ * CRTC viewport
+ * @crtc: CRTC that framebuffer will be displayed on
+ * @x: x panning
+ * @y: y panning
+ * @mode: mode that framebuffer will be displayed under
+ * @fb: framebuffer to check size of
  */
-static int drm_crtc_check_viewport(const struct drm_crtc *crtc,
-  int x, int y,
-  const struct drm_display_mode *mode,
-  const struct drm_framebuffer *fb)
+int drm_crtc_check_viewport(const struct drm_crtc *crtc,
+   int x, int y,
+   const struct drm_display_mode *mode,
+   const struct drm_framebuffer *fb)

 {
int hdisplay, vdisplay;
@@ -2224,6 +2229,7 @@ static int drm_crtc_check_viewport(const struct drm_crtc 
*crtc,

return 0;
 }
+EXPORT_SYMBOL(drm_crtc_check_viewport);

 /**
  * drm_mode_setcrtc - set CRTC configuration
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 5b8847a..79a5a83 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -882,6 +882,10 @@ extern int drm_plane_init(struct drm_device *dev,
  bool priv);
 extern void drm_plane_cleanup(struct drm_plane *plane);
 extern void drm_plane_force_disable(struct drm_plane *plane);
+extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
+  int x, int y,
+  const struct drm_display_mode *mode,
+  const struct drm_framebuffer *fb);

 extern void drm_encoder_cleanup(struct drm_encoder *encoder);

-- 
1.8.5.1



[PATCHv5 04/14] drm/shmobile: Restrict plane loops to only operate on legacy planes

2014-04-01 Thread Matt Roper
Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

Acked-by: Laurent Pinchart 
Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c 
b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
index 0428076..ea543b4 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
@@ -247,7 +247,7 @@ static void shmob_drm_crtc_start(struct shmob_drm_crtc 
*scrtc)
lcdc_write(sdev, LDDDSR, value);

/* Setup planes. */
-   list_for_each_entry(plane, >mode_config.plane_list, head) {
+   drm_for_each_legacy_plane(plane, >mode_config.plane_list) {
if (plane->crtc == crtc)
shmob_drm_plane_setup(plane);
}
-- 
1.8.5.1



[PATCHv5 03/14] drm/i915: Restrict plane loops to only operate on overlay planes (v2)

2014-04-01 Thread Matt Roper
Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

v2: Switch to using drm_for_each_legacy_plane()

Cc: Intel Graphics Development 
Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/i915/intel_display.c | 10 --
 drivers/gpu/drm/i915/intel_pm.c  |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 907b7ef..fc1d9cf 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3517,22 +3517,28 @@ static void intel_enable_planes(struct drm_crtc *crtc)
 {
struct drm_device *dev = crtc->dev;
enum pipe pipe = to_intel_crtc(crtc)->pipe;
+   struct drm_plane *plane;
struct intel_plane *intel_plane;

-   list_for_each_entry(intel_plane, >mode_config.plane_list, 
base.head)
+   drm_for_each_legacy_plane(plane, >mode_config.plane_list) {
+   intel_plane = to_intel_plane(plane);
if (intel_plane->pipe == pipe)
intel_plane_restore(_plane->base);
+   }
 }

 static void intel_disable_planes(struct drm_crtc *crtc)
 {
struct drm_device *dev = crtc->dev;
enum pipe pipe = to_intel_crtc(crtc)->pipe;
+   struct drm_plane *plane;
struct intel_plane *intel_plane;

-   list_for_each_entry(intel_plane, >mode_config.plane_list, 
base.head)
+   drm_for_each_legacy_plane(plane, >mode_config.plane_list) {
+   intel_plane = to_intel_plane(plane);
if (intel_plane->pipe == pipe)
intel_plane_disable(_plane->base);
+   }
 }

 void hsw_enable_ips(struct intel_crtc *crtc)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9728c2c..ec36080 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2129,7 +2129,7 @@ static void ilk_compute_wm_parameters(struct drm_crtc 
*crtc,
list_for_each_entry(crtc, >mode_config.crtc_list, head)
config->num_pipes_active += intel_crtc_active(crtc);

-   list_for_each_entry(plane, >mode_config.plane_list, head) {
+   drm_for_each_legacy_plane(plane, >mode_config.plane_list) {
struct intel_plane *intel_plane = to_intel_plane(plane);

if (intel_plane->pipe == pipe)
-- 
1.8.5.1



[PATCHv5 02/14] drm/exynos: Restrict plane loops to only operate on overlay planes (v2)

2014-04-01 Thread Matt Roper
Ensure that existing driver loops over all planes do not change behavior
when we begin adding new types of planes (primary and cursor) to the DRM
plane list in future patches.

v2: Switch to using drm_for_each_legacy_plane()

Cc: Inki Dae 
Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 9cc92ae..c70b380 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -190,7 +190,7 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)

exynos_drm_crtc_dpms(crtc, DRM_MODE_DPMS_OFF);

-   list_for_each_entry(plane, >dev->mode_config.plane_list, head) {
+   drm_for_each_legacy_plane(plane, >dev->mode_config.plane_list, 
head) {
if (plane->crtc != crtc)
continue;

diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 835c0f1..7e282e3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -101,7 +101,7 @@ static void exynos_drm_encoder_disable(struct drm_encoder 
*encoder)
exynos_drm_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);

/* all planes connected to this encoder should be also disabled. */
-   list_for_each_entry(plane, >mode_config.plane_list, head) {
+   drm_for_each_legacy_plane(plane, >mode_config.plane_list) {
if (plane->crtc == encoder->crtc)
plane->funcs->disable_plane(plane);
}
-- 
1.8.5.1



[PATCHv5 01/14] drm: Add support for multiple plane types (v2)

2014-04-01 Thread Matt Roper
The DRM core currently only tracks "overlay"-style planes.  Start
refactoring the plane handling to allow other plane types (primary and
cursor) to also be placed on the DRM plane list.

v2: Add drm_for_each_legacy_plane() iterator to smooth transition
of drivers with plane loops.

Signed-off-by: Matt Roper 
---
 drivers/gpu/drm/drm_crtc.c  | 21 -
 drivers/gpu/drm/drm_fb_helper.c |  3 ++-
 include/drm/drm_crtc.h  | 24 +++-
 3 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 960ca98..7def92b 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1044,6 +1044,7 @@ int drm_plane_init(struct drm_device *dev, struct 
drm_plane *plane,
memcpy(plane->format_types, formats, format_count * sizeof(uint32_t));
plane->format_count = format_count;
plane->possible_crtcs = possible_crtcs;
+   plane->type = DRM_PLANE_TYPE_OVERLAY;

/* private planes are not exposed to userspace, but depending on
 * display hardware, might be convenient to allow sharing programming
@@ -1051,7 +1052,9 @@ int drm_plane_init(struct drm_device *dev, struct 
drm_plane *plane,
 */
if (!priv) {
list_add_tail(>head, >mode_config.plane_list);
-   dev->mode_config.num_plane++;
+   dev->mode_config.num_total_plane++;
+   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+   dev->mode_config.num_overlay_plane++;
} else {
INIT_LIST_HEAD(>head);
}
@@ -1081,7 +1084,9 @@ void drm_plane_cleanup(struct drm_plane *plane)
/* if not added to a list, it must be a private plane */
if (!list_empty(>head)) {
list_del(>head);
-   dev->mode_config.num_plane--;
+   dev->mode_config.num_total_plane--;
+   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+   dev->mode_config.num_overlay_plane--;
}
drm_modeset_unlock_all(dev);
 }
@@ -1908,11 +1913,15 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
 * This ioctl is called twice, once to determine how much space is
 * needed, and the 2nd time to fill it.
 */
-   if (config->num_plane &&
-   (plane_resp->count_planes >= config->num_plane)) {
+   if (config->num_overlay_plane &&
+   (plane_resp->count_planes >= config->num_overlay_plane)) {
plane_ptr = (uint32_t __user *)(unsigned 
long)plane_resp->plane_id_ptr;

list_for_each_entry(plane, >plane_list, head) {
+   /* Only advertise overlays to userspace for now. */
+   if (plane->type != DRM_PLANE_TYPE_OVERLAY)
+   continue;
+
if (put_user(plane->base.id, plane_ptr + copied)) {
ret = -EFAULT;
goto out;
@@ -1920,7 +1929,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
copied++;
}
}
-   plane_resp->count_planes = config->num_plane;
+   plane_resp->count_planes = config->num_overlay_plane;

 out:
drm_modeset_unlock_all(dev);
@@ -4534,6 +4543,8 @@ void drm_mode_config_init(struct drm_device *dev)
dev->mode_config.num_connector = 0;
dev->mode_config.num_crtc = 0;
dev->mode_config.num_encoder = 0;
+   dev->mode_config.num_overlay_plane = 0;
+   dev->mode_config.num_total_plane = 0;
 }
 EXPORT_SYMBOL(drm_mode_config_init);

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 16f271e..f30bf7b 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -291,7 +291,8 @@ bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper 
*fb_helper)
drm_warn_on_modeset_not_all_locked(dev);

list_for_each_entry(plane, >mode_config.plane_list, head)
-   drm_plane_force_disable(plane);
+   if (plane->type != DRM_PLANE_TYPE_PRIMARY)
+   drm_plane_force_disable(plane);

for (i = 0; i < fb_helper->crtc_count; i++) {
struct drm_mode_set *mode_set = 
_helper->crtc_info[i].mode_set;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 50dc55a..5b8847a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -541,6 +541,12 @@ struct drm_plane_funcs {
struct drm_property *property, uint64_t val);
 };

+enum drm_plane_type {
+   DRM_PLANE_TYPE_OVERLAY,
+   DRM_PLANE_TYPE_PRIMARY,
+   DRM_PLANE_TYPE_CURSOR,
+};
+
 /**
  * drm_plane - central DRM plane control structure
  * @dev: DRM device this plane belongs to
@@ -553,6 +559,7 @@ struct drm_plane_funcs {
  * @fb: currently bound fb
  * @funcs: helper functions
  * @properties: property 

[PATCHv5 00/14] Universal plane preparation patches

2014-04-01 Thread Matt Roper
Previous series revisions & explanation at [1], [2], [3], and [4]

Just a few minor changes in this revision based on Daniel's feedback; I think
this should be pretty close to being ready for merging:
 * Docbook integration for primary plane helpers and new functions (and a few
   minor updates to existing plane documentation).
 * Dropped the max width/height property patch for now; actual hardware
   limitations can be more complex than a constant min/max and how to address
   this is still being discussed on the mailing list.
 * drm_crtc_init() moves to the helper library to ensure nothing in the core
   depends on helpers.
 * The cursor parameter to drm_crtc_init_with_planes() has been made a void*
   for now until we actually start adding cursor support.
 * The client capability bit to enable userspace visibility of universal planes
   is back, but hidden behind a drm.universal_planes module parameter.


[1] http://lists.freedesktop.org/archives/dri-devel/2014-March/056424.html
[2] http://lists.freedesktop.org/archives/dri-devel/2014-March/055855.html
[3] http://lists.freedesktop.org/archives/dri-devel/2014-March/055222.html
[4] http://lists.freedesktop.org/archives/dri-devel/2014-February/054719.html

Matt Roper (14):
  drm: Add support for multiple plane types (v2)
  drm/exynos: Restrict plane loops to only operate on overlay planes
(v2)
  drm/i915: Restrict plane loops to only operate on overlay planes (v2)
  drm/shmobile: Restrict plane loops to only operate on legacy planes
  drm: Make drm_crtc_check_viewport non-static
  drm: Add primary plane helpers (v3)
  drm: Add drm_universal_plane_init()
  drm: Add plane type property (v2)
  drm: Add drm_crtc_init_with_planes() (v2)
  drm/msm: Switch to universal plane API's
  drm: Replace crtc fb with primary plane fb (v3)
  drm: Remove unused drm_crtc->fb
  drm: Allow userspace to ask for universal plane list (v2)
  drm/doc: Update plane documentation and add plane helper library

 Documentation/DocBook/drm.tmpl   |  50 +++-
 drivers/gpu/drm/Makefile |   3 +-
 drivers/gpu/drm/armada/armada_crtc.c |  23 +-
 drivers/gpu/drm/ast/ast_mode.c   |  12 +-
 drivers/gpu/drm/bochs/bochs_kms.c|   4 +-
 drivers/gpu/drm/cirrus/cirrus_mode.c |  10 +-
 drivers/gpu/drm/drm_crtc.c   | 189 +++
 drivers/gpu/drm/drm_crtc_helper.c|  20 +-
 drivers/gpu/drm/drm_fb_helper.c  |   9 +-
 drivers/gpu/drm/drm_ioctl.c  |   7 +
 drivers/gpu/drm/drm_plane_helper.c   | 333 +++
 drivers/gpu/drm/drm_stub.c   |   5 +
 drivers/gpu/drm/exynos/exynos_drm_crtc.c |  22 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c  |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_display.c   |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_dp.c|   2 +-
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c  |   2 +-
 drivers/gpu/drm/gma500/cdv_intel_lvds.c  |   2 +-
 drivers/gpu/drm/gma500/gma_display.c |  16 +-
 drivers/gpu/drm/gma500/mdfld_dsi_output.c|   2 +-
 drivers/gpu/drm/gma500/mdfld_intel_display.c |  16 +-
 drivers/gpu/drm/gma500/oaktrail_crtc.c   |  12 +-
 drivers/gpu/drm/gma500/psb_intel_display.c   |   2 +-
 drivers/gpu/drm/gma500/psb_intel_lvds.c  |   2 +-
 drivers/gpu/drm/gma500/psb_intel_sdvo.c  |   2 +-
 drivers/gpu/drm/i915/i915_debugfs.c  |   4 +-
 drivers/gpu/drm/i915/i915_irq.c  |   4 +-
 drivers/gpu/drm/i915/intel_display.c | 148 ++--
 drivers/gpu/drm/i915/intel_dp.c  |   4 +-
 drivers/gpu/drm/i915/intel_fbdev.c   |   6 +-
 drivers/gpu/drm/i915/intel_overlay.c |   4 +-
 drivers/gpu/drm/i915/intel_pm.c  |  38 +--
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  26 +--
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c |  33 +--
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c|   8 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c |  27 ++-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c|   8 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c  |  20 +-
 drivers/gpu/drm/nouveau/dispnv04/dfp.c   |   2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c|   8 +-
 drivers/gpu/drm/nouveau/nv50_display.c   |  17 +-
 drivers/gpu/drm/omapdrm/omap_crtc.c  |  10 +-
 drivers/gpu/drm/omapdrm/omap_fb.c|   2 +-
 drivers/gpu/drm/qxl/qxl_display.c|  10 +-
 drivers/gpu/drm/radeon/atombios_crtc.c   |  20 +-
 drivers/gpu/drm/radeon/r100.c|   4 +-
 drivers/gpu/drm/radeon/radeon_connectors.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_device.c   |   2 +-
 drivers/gpu/drm/radeon/radeon_display.c  |   4 +-
 drivers/gpu/drm/radeon/radeon_legacy_crtc.c  |  16 +-
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c   |  10 +-
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c|  16 +-
 drivers/gpu/drm/tegra/dc.c   |  16 +-
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c |   8 +-
 

[PATCH] drm/qxl: unset a pointer in sync_obj_unref

2014-04-01 Thread Maarten Lankhorst
This fixes a BUG_ON(bo->sync_obj != NULL); in ttm_bo_release_list.

Cc: stable at vger.kernel.org #v3.10+

Signed-off-by: Maarten Lankhorst 
---
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index c7e7e6590c2b..c82c1d6a965a 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -433,6 +433,7 @@ static int qxl_sync_obj_flush(void *sync_obj)

  static void qxl_sync_obj_unref(void **sync_obj)
  {
+   *sync_obj = NULL;
  }

  static void *qxl_sync_obj_ref(void *sync_obj)



[PATCH] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Vandana Kannan
On Apr-01-2014 12:57 PM, Daniel Vetter wrote:
> On Tue, Apr 01, 2014 at 08:06:04AM +0530, Vandana Kannan wrote:
>> On Apr-01-2014 12:35 AM, Daniel Vetter wrote:
>>> On Fri, Mar 21, 2014 at 08:31:29AM +0530, Vandana Kannan wrote:
 Populate PAR in infoframe structure. If there is a user setting for PAR, 
 then
 that value is set. Else, value is taken from CEA mode list if VIC is found.
 Else, PAR is calculated from resolution. If none of these conditions are
 satisfied, PAR is NONE as per initialization.

 As a next step, create a property that would enable a user space app to set
 aspect ratio. (will be pushed as a separate patch)

 Signed-off-by: Vandana Kannan 
 Cc: Jesse Barnes 
 Cc: Vijay Purushothaman 
 Cc: Ville Syrj?l? 
 Cc: intel-gfx at lists.freedesktop.org
 ---
  drivers/gpu/drm/drm_edid.c |   34 ++
  include/drm/drm_crtc.h |1 +
  2 files changed, 35 insertions(+)

 diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
 index d4e3f9d..3db693f 100644
 --- a/drivers/gpu/drm/drm_edid.c
 +++ b/drivers/gpu/drm/drm_edid.c
 @@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
 *to_match)
  }
  EXPORT_SYMBOL(drm_match_cea_mode);
  
 +/**
 + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding 
 to
 + * the input VIC from the CEA mode list
 + *
 + * Returns picture aspect ratio
 + */
 +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
 +{
 +  /* return picture aspect ratio for video_code - 1 to access the
 +   * right array element
 +  */
 +  return edid_cea_modes[video_code-1].picture_aspect_ratio;
 +}
 +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
 +
  /*
   * Calculate the alternate clock for HDMI modes (those from the HDMI 
 vendor
   * specific block).
 @@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
 hdmi_avi_infoframe *frame,
frame->video_code = drm_match_cea_mode(mode);
  
frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
 +
 +  /* Populate picture aspect ratio from either CEA mode list or
 +   *  user input
 +  */
 +  if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
 +  mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
 +  frame->picture_aspect = mode->picture_aspect_ratio;
>>>
>>> Please pardon my ignorance, but how can userspace actually set this part
>>> of the mode? I couldn't find any code which sets this anywhere ...
>>> -Daniel
>>>
>> I have submitted a patch to enable user space to set picture aspect
>> ratio through a property..
>> drm/i915: Add property to set HDMI aspect ratio
>> http://lists.freedesktop.org/archives/intel-gfx/2014-March/042403.html
> 
> Ah, that makes more sense. I think we should move the property also into
> the drm core so that all drivers that want to expose this can use the same
> property. Also if you have patches which depend upon each another in a
> funtional way it's better to post them together in one series.
> -Daniel
> 
Ok, I will modify the patch (which adds aspect ratio property) to move
the property to drm and resend separately.
This patch as it is unblocks AVI infoframe compliance test, so can this
patch be considered for acceptance now?
>> -Vandana
 +  else if (frame->video_code > 0)
 +  frame->picture_aspect = drm_get_cea_aspect_ratio(
 +  frame->video_code);
 +  else {
 +  if (!(mode->vdisplay % 3) &&
 +  (((mode->vdisplay * 4) / 3) == mode->hdisplay))
 +  frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
 +  else if (!(mode->vdisplay % 9) &&
 +  (((mode->vdisplay * 16) / 9) == mode->hdisplay))
 +  frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
 +  }
 +
frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
  
 diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
 index 27f828c..50dc55a 100644
 --- a/include/drm/drm_crtc.h
 +++ b/include/drm/drm_crtc.h
 @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device 
 *dev,
  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv);
  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
 +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 
 video_code);
  extern bool drm_detect_hdmi_monitor(struct edid *edid);
  extern bool drm_detect_monitor_audio(struct edid *edid);
  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
 -- 
 1.7.9.5

 

[PATCH v2] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Ville Syrjälä
On Tue, Apr 01, 2014 at 04:26:59PM +0530, Vandana Kannan wrote:
> Populate PAR in infoframe structure. If there is a user setting for PAR, then
> that value is set. Else, value is taken from CEA mode list if VIC is found.
> Else, PAR is calculated from resolution. If none of these conditions are
> satisfied, PAR is NONE as per initialization.
> 
> v2: Removed the part which sets PAR according to user input, based on
> Daniel's review comments.
> 
> A separate patch will be submitted to create a property that would enable a
> user space app to set aspect ratio for AVI infoframe.
> 
> Signed-off-by: Vandana Kannan 
> Cc: Jesse Barnes 
> Cc: Vijay Purushothaman 
> Cc: Ville Syrj?l? 
> Cc: intel-gfx at lists.freedesktop.org
> Reviewed-by: Jesse Barnes 
> ---
>  drivers/gpu/drm/drm_edid.c | 29 +
>  include/drm/drm_crtc.h |  1 +
>  2 files changed, 30 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index d4e3f9d..fee24d3 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
> *to_match)
>  }
>  EXPORT_SYMBOL(drm_match_cea_mode);
>  
> +/**
> + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
> + * the input VIC from the CEA mode list
> + *
> + * Returns picture aspect ratio
> + */
> +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
> +{
> + /* return picture aspect ratio for video_code - 1 to access the
> +  * right array element
> + */
> + return edid_cea_modes[video_code-1].picture_aspect_ratio;
> +}
> +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
> +
>  /*
>   * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
>   * specific block).
> @@ -3613,6 +3628,20 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
> hdmi_avi_infoframe *frame,
>   frame->video_code = drm_match_cea_mode(mode);
>  
>   frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
> +
> + /* Populate picture aspect ratio from CEA mode list */
> + if (frame->video_code > 0)
> + frame->picture_aspect = drm_get_cea_aspect_ratio(
> + frame->video_code);
> + else {
> + if (!(mode->vdisplay % 3) &&
> + (((mode->vdisplay * 4) / 3) == mode->hdisplay))
> + frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
> + else if (!(mode->vdisplay % 9) &&
> + (((mode->vdisplay * 16) / 9) == mode->hdisplay))
> + frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
> + }

I'm not sure if providing the PAR for non-CEA modes like this makes
any real difference. But I guess it can't hurt since you only provide
it for exact matches.

But the matches are maybe even a bit too exact. For instance 1366x768
will not match the 16:9 case. So maybe it should be calculated in a bit
more relaxed way.

Or just dropped totally. I'm not sure.

> +
>   frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
>   frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
>  
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 27f828c..50dc55a 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device 
> *dev,
>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
>   void *data, struct drm_file *file_priv);
>  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
> +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 
> video_code);
>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
>  extern bool drm_detect_monitor_audio(struct edid *edid);
>  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
> -- 
> 1.9.1

-- 
Ville Syrj?l?
Intel OTC


[PATCHv4 06/13] drm: Add primary plane helpers (v2)

2014-04-01 Thread Daniel Vetter
On Tue, Apr 1, 2014 at 1:45 PM, Rob Clark  wrote:
> On Tue, Apr 1, 2014 at 3:45 AM, Daniel Vetter  wrote:
>> On Mon, Mar 31, 2014 at 06:03:24PM -0700, Matt Roper wrote:
>>> On Fri, Mar 28, 2014 at 09:32:06AM +0100, Daniel Vetter wrote:
>>> > On Thu, Mar 27, 2014 at 05:44:31PM -0700, Matt Roper wrote:
>>> ...
>>> > > +  * N.B., we call set_config() directly here rather than using
>>> > > +  * drm_mode_set_config_internal.  We're reprogramming the same
>>> > > +  * connectors that were already in use, so we shouldn't need the extra
>>> > > +  * cross-CRTC fb refcounting to accomodate stealing connectors.
>>> > > +  * drm_mode_setplane() already handles the basic refcounting for the
>>> > > +  * framebuffers involved in this operation.
>>> >
>>> > Wrong. The current crtc helper logic disables all disconnected connectors
>>> > forcefully on each set_config. Nope, I didn't make those semantics ... So
>>> > I think we need to think a bit harder here again.
>>> >
>>> > See drm_helper_disable_unused_functions.
>>>
>>> I think I'm still missing something here; can you clarify what the
>>> problematic case would be?
>>>
>>> I only see a call to __drm_helper_disable_unused_functions() in the CRTC
>>> helper in cases where mode_changed = 1, which I don't believe it ever
>>> should be through the setplane() calls.  We should just be updating the
>>> framebuffer (and possibly panning) without touching any of the
>>> connectors, so I don't see how unrelated CRTC's would get disabled.  Am
>>> I overlooking another case here that the basic refcounting in setplane
>>> doesn't already handle?
>>
>> Looking at drm_helper_disable_unused_functions we'll spot
>>
>> list_for_each_entry(connector, >mode_config.connector_list, 
>> head) {
>> if (!connector->encoder)
>> continue;
>> if (connector->status == connector_status_disconnected)
>> connector->encoder = NULL;
>> }
>>
>>
>> So as soon as a connector is disconnected and you do _any_ kind of
>> ->set_config call with modesetting helpers that crtc gets killed. Even if
>> it's completely unrelated. Dave originally changed this with an imo rather
>> thin justification:
>
> sure, so this could change the timing of things a bit..  but it would
> be a bug if a HPD event or poll didn't eventually detect that and shut
> things off..

Well on the semantics imo this is userspace's decision, or should be
at least. And there's no driver which kills the output in the hdp
handler at all. So I'm all in favour of just removing this and letting
DEs handle hpd events (like they currently all do). But until we have
that completely unrelated crtcs _can_ get disabled when you call
->set_config, and that means we do have to handle the refcounting
correctly by doing what set_config_internal does essentially.
-Daniel
--
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH] gpu: host1x: handle the correct # of syncpt regs

2014-04-01 Thread Stephen Warren
From: Stephen Warren 

BIT_WORD() truncates rather than rounds, so the loops in
syncpt_thresh_isr() and _host1x_intr_disable_all_syncpt_intrs() use <=
rather than < in an attempt to process the correct number of registers
when rounding of the conversion of count of bits to count of words is
necessary. However, when rounding isn't necessary (as is the case for
all values of nb_pts the code actually sees), this causes one too many
registers to be processed.

Solve this by using BITS_TO_LONGS() (which rounds internally), rather
than BIT_WORD(), and comparing with < rather than <=.

Signed-off-by: Stephen Warren 
---
 drivers/gpu/host1x/hw/intr_hw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/host1x/hw/intr_hw.c b/drivers/gpu/host1x/hw/intr_hw.c
index db9017adfe2b..17407b2de2bf 100644
--- a/drivers/gpu/host1x/hw/intr_hw.c
+++ b/drivers/gpu/host1x/hw/intr_hw.c
@@ -47,7 +47,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id)
unsigned long reg;
int i, id;

-   for (i = 0; i <= BIT_WORD(host->info->nb_pts); i++) {
+   for (i = 0; i < BITS_TO_LONGS(host->info->nb_pts); i++) {
reg = host1x_sync_readl(host,
HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(i));
for_each_set_bit(id, , BITS_PER_LONG) {
@@ -64,7 +64,7 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct 
host1x *host)
 {
u32 i;

-   for (i = 0; i <= BIT_WORD(host->info->nb_pts); ++i) {
+   for (i = 0; i < BITS_TO_LONGS(host->info->nb_pts); ++i) {
host1x_sync_writel(host, 0xu,
HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(i));
host1x_sync_writel(host, 0xu,
-- 
1.8.1.5



[PATCH] drm/rcar-du: Handle encoder initialization failures

2014-04-01 Thread Laurent Pinchart
The rcar_du_encoder_init() function can fail and return an error code.
Don't ignore it.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index fbeabd9..a87edfa 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -248,7 +248,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
continue;
}

-   rcar_du_encoder_init(rcdu, pdata->type, pdata->output, pdata);
+   ret = rcar_du_encoder_init(rcdu, pdata->type, pdata->output,
+  pdata);
+   if (ret < 0)
+   return ret;
}

/* Set the possible CRTCs and possible clones. There's always at least
-- 
Regards,

Laurent Pinchart



[PATCH v2] drm: Make drm_clflush_virt_range() void*

2014-04-01 Thread ville.syrj...@linux.intel.com
From: Ville Syrj?l? 

Currently drm_cflush_virt_rage() takes a char* so the caller probably
has to do pointless casting to avoid compiler warnings. Make the
argument void* instead to avoid such issues.

v2: Use void* arithmetic (Chris)

Signed-off-by: Ville Syrj?l? 
---
 drivers/gpu/drm/drm_cache.c | 4 ++--
 include/drm/drmP.h  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c
index bb8f580..4bfad5f 100644
--- a/drivers/gpu/drm/drm_cache.c
+++ b/drivers/gpu/drm/drm_cache.c
@@ -125,11 +125,11 @@ drm_clflush_sg(struct sg_table *st)
 EXPORT_SYMBOL(drm_clflush_sg);

 void
-drm_clflush_virt_range(char *addr, unsigned long length)
+drm_clflush_virt_range(void *addr, unsigned long length)
 {
 #if defined(CONFIG_X86)
if (cpu_has_clflush) {
-   char *end = addr + length;
+   void *end = addr + length;
mb();
for (; addr < end; addr += boot_cpu_data.x86_clflush_size)
clflush(addr);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 2f49510..9c10952 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1294,7 +1294,7 @@ extern int drm_remove_magic(struct drm_master *master, 
drm_magic_t magic);
 /* Cache management (drm_cache.c) */
 void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
 void drm_clflush_sg(struct sg_table *st);
-void drm_clflush_virt_range(char *addr, unsigned long length);
+void drm_clflush_virt_range(void *addr, unsigned long length);

/* Locking IOCTL support (drm_lock.h) */
 extern int drm_lock(struct drm_device *dev, void *data,
-- 
1.8.3.2



[PATCH v2] drm: Make drm_clflush_virt_range() void*

2014-04-01 Thread Daniel Vetter
On Tue, Apr 01, 2014 at 11:08:59AM +0100, Chris Wilson wrote:
> On Tue, Apr 01, 2014 at 12:59:08PM +0300, ville.syrjala at linux.intel.com 
> wrote:
> > From: Ville Syrj?l? 
> > 
> > Currently drm_cflush_virt_rage() takes a char* so the caller probably
> > has to do pointless casting to avoid compiler warnings. Make the
> > argument void* instead to avoid such issues.
> > 
> > v2: Use void* arithmetic (Chris)
> > 
> > Signed-off-by: Ville Syrj?l? 
> Reviewed-by: Chris Wilson 

Queued for -next with Dave's irc ack, thanks for the patch.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


linux-next: Tree for Apr 1 (drivers/gpu/drm/i915)

2014-04-01 Thread Randy Dunlap
On 04/01/2014 12:39 AM, Stephen Rothwell wrote:
> Hi all,
> 
> Please do not add material intended for v3.16 to your linux-next included
> branches until after v3.15-rc1 is released.
> 
> This tree still fails (more than usual) the powerpc allyesconfig build.
> 
> Changes since 20140331:
> 

for linux-next 0401 and 0331:

drivers/gpu/drm/i915/i915_cmd_parser.c:405:4: warning: format '%td' expects 
argument of type 'ptrdiff_t', but argument 5 has type 'long unsigned int' 
[-Wformat]


Just use %td without the (unsigned long) cast.


-- 
~Randy


[PATCH 1/1] drm/vmwgfx: correct fb_fix_screeninfo.line_length

2014-04-01 Thread Thomas Hellstrom
On 03/28/2014 02:45 AM, Dave Airlie wrote:
> On Fri, Mar 28, 2014 at 10:45 AM, Christopher Friedt
>  wrote:
>> Previously, the vmwgfx_fb driver would allow users to call FBIOSET_VINFO, 
>> but it would not adjust
>> the FINFO properly, resulting in distorted screen rendering. The patch 
>> corrects that behaviour.
>>
>> See https://bugs.gentoo.org/show_bug.cgi?id=494794 for examples.
>>
> Just adding cc's of maintainer list.
Looks correct to me.
Reviewed-by: Thomas Hellstrom 

Will add it to vmgfx-next and cc stable.

Thanks,
Thomas



>> Signed-off-by: Christopher Friedt 
>> ---
>>  drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c 
>> b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
>> index ed5ce2a..021b522 100644
>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
>> @@ -147,7 +147,7 @@ static int vmw_fb_check_var(struct fb_var_screeninfo 
>> *var,
>> }
>>
>> if (!vmw_kms_validate_mode_vram(vmw_priv,
>> -   info->fix.line_length,
>> +   var->xres * var->bits_per_pixel/8,
>> var->yoffset + var->yres)) {
>> DRM_ERROR("Requested geom can not fit in framebuffer\n");
>> return -EINVAL;
>> @@ -162,6 +162,8 @@ static int vmw_fb_set_par(struct fb_info *info)
>> struct vmw_private *vmw_priv = par->vmw_priv;
>> int ret;
>>
>> +   info->fix.line_length = info->var.xres * info->var.bits_per_pixel/8;
>> +
>> ret = vmw_kms_write_svga(vmw_priv, info->var.xres, info->var.yres,
>>  info->fix.line_length,
>>  par->bpp, par->depth);
>> @@ -177,6 +179,7 @@ static int vmw_fb_set_par(struct fb_info *info)
>> vmw_write(vmw_priv, SVGA_REG_DISPLAY_POSITION_Y, 
>> info->var.yoffset);
>> vmw_write(vmw_priv, SVGA_REG_DISPLAY_WIDTH, info->var.xres);
>> vmw_write(vmw_priv, SVGA_REG_DISPLAY_HEIGHT, info->var.yres);
>> +   vmw_write(vmw_priv, SVGA_REG_BYTES_PER_LINE, 
>> info->fix.line_length);
>> vmw_write(vmw_priv, SVGA_REG_DISPLAY_ID, SVGA_ID_INVALID);
>> }
>>
>> --
>> 1.8.3.2
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Daniel Vetter
On Tue, Apr 1, 2014 at 11:26 AM, Vandana Kannan
 wrote:
> Ok, I will modify the patch (which adds aspect ratio property) to move
> the property to drm and resend separately.
> This patch as it is unblocks AVI infoframe compliance test, so can this
> patch be considered for acceptance now?

Without the 2 lines to look at mode->picture_aspect_ratio I think yes.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[RFC 0/4] drm: exynos: Add drivers for MDNIE and IELCD

2014-04-01 Thread Andrzej Hajda
Hi Ajay,

Thanks for the patchset.

On 03/19/2014 03:22 PM, Ajay Kumar wrote:
> This series is based on exynos-drm-next-todo branch of Inki Dae's tree at:
> git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
> 
> On Exynos SOC, FIMD supports various post processors
> like MIE, MDNIE and IELCD for image enhancement purposes.
> This patchset adds an infrastructure in exynos FIMD to support such
> post procerssors and also adds support routines for MDNIE, and IELCD.


I

> 
> (1) For basic display output,
>   -- MDNIE and IELCD should have same video timings as FIMD (mode_set)
>   -- strict power_up/down sequence need to be followed between FIMD,
>  MDNIE, and IELCD (power_on, power_off)
> 
> (2) For enhanced display output,
>   -- MDNIE needs image enhancement data from userspace
>  (set_property and set_gamma)
> 
> Rahul Sharma's patchset at:
> http://comments.gmane.org/gmane.linux.kernel.samsung-soc/27642
> The above patchset is needed to support the enhanced display output.

There should be also patches adding enhanced output support for
exynos_drm framework, I have not found any on dri-devel list.

> 
> MDNIE and IELCD DT nodes are given as phandles to FIMD DT node.

I wonder if it wouldn't be better to use video interface links here,
instead of creating new properties and describing dependency between
them we would just use standard(almost :) ) video links to connect nodes:

FIMD ---> mDNIe ---> IELCD ---> ...
FIMD ---> MIE ---> ...
...

> SOC specific information like base address, clocks and other
> configuration information are extracted via FIMD DT node.

All bindings should be documented in separate patches with device-tree
maintainers added to CC.

It would be nice to have information on which boards it has been tested.
Patches to DTS files of existing boards will be also helpful.

Regards
Andrzej


> 
> Ajay Kumar, Shirish, Rahul Sharma (4):
>   drm: exynos: Add infrastructure to support FIMD post processors
>   drm: exynos: add MDNIE post processor
>   drm: exynos: add IELCD post processor
>   drm: exynos: add MDNIE and IELCD to FIMD pp list
> 
>  drivers/gpu/drm/exynos/Makefile|   3 +-
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 179 
>  drivers/gpu/drm/exynos/exynos_fimd_pp.h|  54 +++
>  drivers/gpu/drm/exynos/exynos_ielcd.c  | 295 
>  drivers/gpu/drm/exynos/exynos_mdnie.c  | 707 
> +
>  drivers/gpu/drm/exynos/exynos_mdnie_regs.h | 154 +++
>  include/video/samsung_fimd.h   |  49 +-
>  7 files changed, 1439 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/exynos/exynos_fimd_pp.h
>  create mode 100644 drivers/gpu/drm/exynos/exynos_ielcd.c
>  create mode 100644 drivers/gpu/drm/exynos/exynos_mdnie.c
>  create mode 100644 drivers/gpu/drm/exynos/exynos_mdnie_regs.h
> 



[PATCH v2] drm: Make drm_clflush_virt_range() void*

2014-04-01 Thread Chris Wilson
On Tue, Apr 01, 2014 at 12:59:08PM +0300, ville.syrjala at linux.intel.com 
wrote:
> From: Ville Syrj?l? 
> 
> Currently drm_cflush_virt_rage() takes a char* so the caller probably
> has to do pointless casting to avoid compiler warnings. Make the
> argument void* instead to avoid such issues.
> 
> v2: Use void* arithmetic (Chris)
> 
> Signed-off-by: Ville Syrj?l? 
Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[RFC 4/4] drm: exynos: add MDNIE and IELCD to FIMD pp list

2014-04-01 Thread Andrzej Hajda
Hi Ajay,

Thanks for the patch.

On 03/19/2014 03:22 PM, Ajay Kumar wrote:
> This patch adds code to add MDNIE and IELCD onto the
> list of FIMD PP.
> 
> Signed-off-by: Ajay Kumar 
> Signed-off-by: Shirish S 
> Signed-off-by: Rahul Sharma 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 +
>  drivers/gpu/drm/exynos/exynos_fimd_pp.h  |  2 ++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index a584d8e..d5a32fb 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -160,8 +160,25 @@ static int fimd_mgr_initialize(struct exynos_drm_manager 
> *mgr,
>  {
>   struct fimd_context *ctx = mgr->ctx;
>   struct exynos_drm_private *priv;
> + struct exynos_fimd_pp *mdnie_pp = NULL, *ielcd_pp = NULL;
> + int ret;
> +
>   priv = drm_dev->dev_private;
>  
> + ret = exynos_mdnie_init(ctx->dev, _pp);
> + if (!ret && mdnie_pp) {

Why do not check ret only?

> + ret = exynos_ielcd_init(ctx->dev, _pp);
> + if (!ret && ielcd_pp) {
> + fimd_add_pp_to_list(ctx, mdnie_pp);
> + fimd_add_pp_to_list(ctx, ielcd_pp);
> + ctx->enable_pp = true;
> + ctx->pp_running = false;
> + } else {
> + DRM_INFO("No ielcd node present, "
> + "MDNIE feature will be disabled\n");
> + }
> + }
> +

You can put it all into separate routine and you will have much cleaner
code:
{
...
ret = exynos_mdnie_init(ctx->dev, _pp);
if (!ret)
return ret;

ret = exynos_ielcd_init(ctx->dev, _pp);
if (!ret)
return ret;

fimd_add_pp_to_list(ctx, mdnie_pp);
fimd_add_pp_to_list(ctx, ielcd_pp);
ctx->enable_pp = true;
ctx->pp_running = false;
}

Anyway, there is no removal code.

Regards
Andrzej

>   mgr->drm_dev = ctx->drm_dev = drm_dev;
>   mgr->pipe = ctx->pipe = priv->pipe++;
>  
> diff --git a/drivers/gpu/drm/exynos/exynos_fimd_pp.h 
> b/drivers/gpu/drm/exynos/exynos_fimd_pp.h
> index 528d3cb..b980742 100644
> --- a/drivers/gpu/drm/exynos/exynos_fimd_pp.h
> +++ b/drivers/gpu/drm/exynos/exynos_fimd_pp.h
> @@ -49,4 +49,6 @@ struct exynos_fimd_pp {
>   void *ctx;
>  };
>  
> +extern int exynos_mdnie_init(struct device *dev, struct exynos_fimd_pp **pp);
> +extern int exynos_ielcd_init(struct device *dev, struct exynos_fimd_pp **pp);
>  #endif
> 



crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Rob Clark
On Tue, Apr 1, 2014 at 10:42 AM, Ville Syrj?l?
 wrote:
> On Tue, Apr 01, 2014 at 10:22:07AM -0400, Rob Clark wrote:
>> On Tue, Apr 1, 2014 at 10:12 AM, Ville Syrj?l?
>>  wrote:
>> > On Tue, Apr 01, 2014 at 09:54:40AM -0400, Rob Clark wrote:
>> >> On Tue, Apr 1, 2014 at 9:40 AM, Daniel Vetter  wrote:
>> >> > On Tue, Apr 01, 2014 at 08:40:54AM -0400, Rob Clark wrote:
>> >> >> No, not really.  I was just trying to get away with pushing some
>> >> >> complexity (for case #1) up to userspace instead of doing it in the
>> >> >> kernel.
>> >> >
>> >> > To clarify: I don't think it makes sense to fully abstract this away in
>> >> > the kernel, especially if userspace needs to be aware of the boundary
>> >> > between the crtcs so that it can correctly tile up the logical 
>> >> > frambuffer.
>> >> > But I'm not sure whether trying to make that possible with a generic
>> >> > userspace driver is sensible, or whether having a bit of magic glue code
>> >> > in the ddx/wayland/hwc part for e.g. msm is the better option, at least 
>> >> > in
>> >> > the short term.
>> >> >
>> >> > Since if the set of useable planes actually changes we need to push that
>> >> > decision up the stack even further like wayland/hwc currently allow, and
>> >> > maybe there's some things we need to fix at that layer first. Once we've
>> >> > learned that lesson we can push things down again and add a neat little
>> >> > generic kernel interface. At least thus far we've always done a bit of
>> >> > prototyping with driver-specific code to learn a few lessons, e.g. the
>> >> > various pieces of non-standard plane/overlay in i915.
>> >>
>> >> right, things like 'STATUS' property for returning per-object status
>> >> would start as driver custom.  (And even 'SLAVE_CRTC'..)  Userspace
>> >> could look for certain property names in the same way that it looks
>> >> for certain gl extension strings.  But should be semi-standardized, so
>> >> other drivers which need the same thing should use same property
>> >> names/values/behaviors as much as possible.. which was the point for
>> >> starting the thread ;-)
>> >
>> > What's the problem with just using two crtcs? With the atomic API you
>> > just shovel the state for both down into the driver in one ioctl. This
>> > is pretty much what we'll need to do to drive those 4k MST DP displays
>> > as well. The driver will then have to do its best to genlock the crtcs
>> > if the hardware doesn't do it fully. IIRC that's how we're going to have
>> > to do the MST stuff, ie. use the same clock source for both obviously,
>> > and try to start all the pipes as fast as possible so that the vblanks
>> > line up. And that's going to require more changes to our modesetting
>> > codepaths.
>>
>> well, two problems:
>> 1) it won't actually work (at least not without some overhaul of kms
>> core and helpers)..  encoder only has a single crtc ptr.  And anyway,
>> it is useful for the driver to differentiate between which pipe/mixer
>> is primary and which is slave.
>
> What does primary/slave mean here? That seems like a rather hardware
> specific notion.

it could be.. you might need to configure the mixers differently (like
setting a MERGE bit/bitfield in one of them).

But it seems easier for a driver to ignore that differentiation if it
doesn't have to care about it, than the other way around

>> The SLAVE_CRTC property essentially gives you that 2nd pointer you need.
>
> Would seem easier to add the pointer. Or even better: just expose the
> display as two connectors and then you don't have to change anything.
> It's just like having multiple displays positioned next to each other
> today.

this is specifically for the case where you have two crtcs, one
encoder.  I don't want to make the driver jump through hoops with a
dummy encoder/connector for this..

>> 2) still would be nice to be able to drive 4k displays from x11.. and
>> for the most part there isn't much compelling reason for most ddx's to
>> migrate to atomic ioctl.
>
> Someone might argue that 4k support is a compelling reason ;)

well, yeah, we could put an semi-artificial restriction like that to
force people to move to the new ioctl.  But I'd rather not.

BR,
-R

> --
> Ville Syrj?l?
> Intel OTC


[RFC 3/4] drm: exynos: add IELCD post processor

2014-04-01 Thread Andrzej Hajda
Hi,

Thanks for the patch.

On 03/19/2014 03:22 PM, Ajay Kumar wrote:
> Add post processor ops for IELCD and their support functions.
> Expose an interface for the FIMD to register IELCD PP.
> 
> Signed-off-by: Ajay Kumar 
> Signed-off-by: Shirish S 
> Signed-off-by: Rahul Sharma 
> ---
>  drivers/gpu/drm/exynos/Makefile   |   3 +-
>  drivers/gpu/drm/exynos/exynos_ielcd.c | 295 
> ++
>  include/video/samsung_fimd.h  |  43 +
>  3 files changed, 340 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/exynos/exynos_ielcd.c
> 
> diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile
> index 653eab5..f3d7314 100644
> --- a/drivers/gpu/drm/exynos/Makefile
> +++ b/drivers/gpu/drm/exynos/Makefile
> @@ -10,7 +10,8 @@ exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
>  
>  exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
>  exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o
> -exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)  += exynos_drm_fimd.o exynos_mdnie.o
> +exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)  += exynos_drm_fimd.o exynos_mdnie.o \
> + exynos_ielcd.o

Kconfig option would be nice.

>  exynosdrm-$(CONFIG_DRM_EXYNOS_DSI)   += exynos_drm_dsi.o
>  exynosdrm-$(CONFIG_DRM_EXYNOS_DP)+= exynos_dp_core.o exynos_dp_reg.o
>  exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)  += exynos_hdmi.o exynos_mixer.o
> diff --git a/drivers/gpu/drm/exynos/exynos_ielcd.c 
> b/drivers/gpu/drm/exynos/exynos_ielcd.c
> new file mode 100644
> index 000..33d0d34
> --- /dev/null
> +++ b/drivers/gpu/drm/exynos/exynos_ielcd.c
> @@ -0,0 +1,295 @@
> +/* drivers/gpu/drm/exynos/exynos_ielcd.c
> + *
> + * Samsung IELCD driver
> + *
> + * Copyright (C) 2014 Samsung Electronics Co., Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> +*/
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 
> +
> +#include "exynos_drm_drv.h"
> +#include "exynos_fimd_pp.h"
> +
> +#define exynos_ielcd_readl(addr) readl(ielcd->exynos_ielcd_base + addr)
> +#define exynos_ielcd_writel(addr, val) \
> + writel(val, ielcd->exynos_ielcd_base + addr)
> +#define IELCD_TIMEOUT_CNT1000
> +
> +struct ielcd_context {
> + void __iomem*exynos_ielcd_base;
> + unsignedvdisplay;
> + unsignedvsync_len;
> + unsignedvbpd;
> + unsignedvfpd;
> + unsignedhdisplay;
> + unsignedhsync_len;
> + unsignedhbpd;
> + unsignedhfpd;
> + unsignedvidcon0;
> + unsignedvidcon1;
> +};
> +
> +static int ielcd_logic_start(struct ielcd_context *ielcd)
> +{
> + exynos_ielcd_writel(IELCD_AUXCON, IELCD_MAGIC_KEY);
> +
> + return 0;
> +}
> +
> +static void ielcd_set_polarity(struct ielcd_context *ielcd)
> +{
> + unsigned int cfg;
> +
> + cfg = exynos_ielcd_readl(IELCD_VIDCON1);
> +
> + cfg &= ~(VIDCON1_INV_VCLK | VIDCON1_INV_HSYNC
> + | VIDCON1_INV_VSYNC | VIDCON1_INV_VDEN);
> + cfg |= ielcd->vidcon1;
> + exynos_ielcd_writel(IELCD_VIDCON1, cfg);

Isn't it suppose to be configurable, read from drm_mode + DT properties.
BTW how it works with the same settings in FIMD? FIMD settings are
ignored or xor-ed ?

> +}
> +
> +static void ielcd_set_timing(struct ielcd_context *ielcd)
> +{
> + unsigned int cfg;
> +
> + /*LCD verical porch setting*/
> + cfg = VIDTCON0_VBPD(ielcd->vbpd - 1) |
> + VIDTCON0_VFPD(ielcd->vfpd - 1) |
> + VIDTCON0_VSPW(ielcd->vsync_len - 1);
> +
> + exynos_ielcd_writel(IELCD_VIDTCON0, cfg);
> + /*LCD horizontal porch setting*/
> + cfg = VIDTCON1_HBPD(ielcd->hbpd - 1) |
> + VIDTCON1_HFPD(ielcd->hfpd - 1) |
> + VIDTCON1_HSPW(ielcd->hsync_len - 1);
> +
> + exynos_ielcd_writel(IELCD_VIDTCON1, cfg);
> +}
> +
> +static void ielcd_set_lcd_size(struct ielcd_context *ielcd)
> +{
> + unsigned int cfg;
> +
> + cfg = (IELCD_VIDTCON2_LINEVAL(ielcd->vdisplay - 1) |
> + IELCD_VIDTCON2_HOZVAL(ielcd->hdisplay - 1));
> + exynos_ielcd_writel(IELCD_VIDTCON2, cfg);
> +
> + /* window0 position setting */
> + exynos_ielcd_writel(IELCD_VIDOSD0A, 0);
> + cfg = (IELCD_VIDOSDB_XPOS_END(ielcd->hdisplay - 1)) |
> + (IELCD_VIDOSDB_YPOS_END(ielcd->vdisplay - 1));
> + exynos_ielcd_writel(IELCD_VIDOSD0B, cfg);
> +
> + /* window0 osd size setting */
> + exynos_ielcd_writel(IELCD_VIDOSD0C, ielcd->hdisplay *
> + ielcd->vdisplay);
> +
> +  

crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Rob Clark
On Tue, Apr 1, 2014 at 10:12 AM, Ville Syrj?l?
 wrote:
> On Tue, Apr 01, 2014 at 09:54:40AM -0400, Rob Clark wrote:
>> On Tue, Apr 1, 2014 at 9:40 AM, Daniel Vetter  wrote:
>> > On Tue, Apr 01, 2014 at 08:40:54AM -0400, Rob Clark wrote:
>> >> No, not really.  I was just trying to get away with pushing some
>> >> complexity (for case #1) up to userspace instead of doing it in the
>> >> kernel.
>> >
>> > To clarify: I don't think it makes sense to fully abstract this away in
>> > the kernel, especially if userspace needs to be aware of the boundary
>> > between the crtcs so that it can correctly tile up the logical frambuffer.
>> > But I'm not sure whether trying to make that possible with a generic
>> > userspace driver is sensible, or whether having a bit of magic glue code
>> > in the ddx/wayland/hwc part for e.g. msm is the better option, at least in
>> > the short term.
>> >
>> > Since if the set of useable planes actually changes we need to push that
>> > decision up the stack even further like wayland/hwc currently allow, and
>> > maybe there's some things we need to fix at that layer first. Once we've
>> > learned that lesson we can push things down again and add a neat little
>> > generic kernel interface. At least thus far we've always done a bit of
>> > prototyping with driver-specific code to learn a few lessons, e.g. the
>> > various pieces of non-standard plane/overlay in i915.
>>
>> right, things like 'STATUS' property for returning per-object status
>> would start as driver custom.  (And even 'SLAVE_CRTC'..)  Userspace
>> could look for certain property names in the same way that it looks
>> for certain gl extension strings.  But should be semi-standardized, so
>> other drivers which need the same thing should use same property
>> names/values/behaviors as much as possible.. which was the point for
>> starting the thread ;-)
>
> What's the problem with just using two crtcs? With the atomic API you
> just shovel the state for both down into the driver in one ioctl. This
> is pretty much what we'll need to do to drive those 4k MST DP displays
> as well. The driver will then have to do its best to genlock the crtcs
> if the hardware doesn't do it fully. IIRC that's how we're going to have
> to do the MST stuff, ie. use the same clock source for both obviously,
> and try to start all the pipes as fast as possible so that the vblanks
> line up. And that's going to require more changes to our modesetting
> codepaths.

well, two problems:
1) it won't actually work (at least not without some overhaul of kms
core and helpers)..  encoder only has a single crtc ptr.  And anyway,
it is useful for the driver to differentiate between which pipe/mixer
is primary and which is slave.  The SLAVE_CRTC property essentially
gives you that 2nd pointer you need.
2) still would be nice to be able to drive 4k displays from x11.. and
for the most part there isn't much compelling reason for most ddx's to
migrate to atomic ioctl.

BR,
-R

> So, I don't see a need for any SLAVE_CRTC properties or dynamic remapping
> of resources. The latter would get nasty when the resources (eg. planes)
> aren't uniform anyway. Just let userspace figure it out.
>
> --
> Ville Syrj?l?
> Intel OTC


crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Daniel Vetter
On Mon, Mar 31, 2014 at 02:04:00PM -0400, Rob Clark wrote:
> I thought I'd kick off a thread to better discuss how to deal with
> "large" displays which need multiple crtcs/planes merged to deal
> without output larger than a certain width.
> 
> What I have in mind basically amounts to driver-custom-properties and
> shouldn't really need much/anything in the way of drm core or helper
> support[1].  There may of course be some room to make helpers/core
> more aware of crtc ganging if it turns out to be something that many
> drivers are doing in the same way.  But to start with my bigger
> concern is getting the userspace interface right.
> 
> This is semi-related to a thread started earlier by Aaron Plattner on
> xorg-devel:
> 
> http://lists.freedesktop.org/archives/xorg-devel/2014-January/039984.html
> 
> As I see it, there are really two different scenarios:
> 
> 1) single encoder/connector:  double up on planes (pipes) and crtcs
> (mixers), but still a single connector.
> 
> 2) double up entire pipe.. this scenario is more like what Aaron
> mentioned.  This could mean using multiple DVI or HDMI connectors, or
> multiple DSI channels.  In the DSI case, I'm not entirely sure yet the
> implications for a dsi panel driver, but I think it needs to be a bit
> aware.

I think this here is (mostly) a userspace problem of figuring out how the
different outputs are laid out in reality. Only difference is that the hw
might (not sure how far those standars really are) provide some definit
hints. So imo not a kernel problem really.

> ---
> 
> For the first scenario, the approach I am leaning towards is a
> 'SLAVE_CRTC'[2] property on the crtc.  The idea being that userspace
> could pick an otherwise unused CRTC, and assign it as a slave in order
> to enable higher resolutions.  The primary crtc could use the slave's
> mixer and primary plane.  The existing encoder->possible_crtcs would
> be used by userspace to figure out which crtc(s) it could pick to use
> as a slave.
> 
> The property approach seems like it should fit in nicely with the
> plans for atomic.  The driver can decide whether a given mode is
> possible during the atomic 'test' step based on the proposed
> SLAVE_CRTC value.  We do possibly get funny edge cases where a CRTC
> isn't yet available but will be after next vblank, but this is
> basically the same scenario with have already with moving planes
> between crtcs (and where an EBUSY or similar return value from atomic
> would make sense).
> 
> For non-primary planes, it may be sufficient to expose max
> width/height dimensions and let userspace figure out when it needs to
> use multiple planes for a single layer.

I second the idea of exposing plane limits. I've cc'ed a thread on
dri-devel where Damien discussed this a bit. We probably need a pile of
per plane/per pixel format properties like max/min size, stride and a
pile of flags for special cases.

For the crtc ganging I wonder whether we even should expose this. For
generic userspace it's just yet another random hardware restriction. E.g.
in i915 we don't expose the various (and constantly changing between
platforms) restrictions on plls. All we do is tell userspace that it
didn't work out.

Imo the point of atomic modesets with the test mode is that we can expose
this information at least indirectly to userspace. But trying to come up
with some explicit scheme for every insane corner case is imo pointless -
generic userspace won't ever bothering with them, and if you need special
code you might as well bake in the assumptions in userspace. Kinda like
current userspace has baked-in assumptions about how a fb backing storage
object should look like.

So overall I think we need to have the following pieces:
- Plane limits so that fbcon and userspace which can't do tiling can
  restrict itself appropriately.
- When userspace asks for a big mode which needs ganging of some stuff the
  kernel driver handles all the resource allocation. If your hw allows it
  it's obviously best if you can freely reassign resources between crtcs,
  otherwise it'll be really hard for userspace to get anything done
  without atomic modesets.
- Generic userspace slices the logical framebuffer into tiles which
  fit into the planes.

Or do I miss something big here?

> For the second scenario, I am less sure.  We could of course also have
> some sort of 'SLAVE_CONNECTOR' property (since encoders themselves
> don't currently have/need properties).  But this probably depends on
> the outcome of the xorg/xrandr userspace discussion.
> 
> Anyways, I'd of course be interested to hear from others who will have
> to tackle the same problem in their own drivers, whether the
> 'SLAVE_CRTC' approach works for them or not, etc.  It looks like the
> first scenario is something I'll get to deal with pretty soon now (ie.
> approximately as soon as I buy myself a 4k DP monitor ;-))

Like I've said I think the 2nd scenario isn't a kernel issue (maybe we
need to expose 

[RFC 2/4] drm: exynos: add MDNIE post processor

2014-04-01 Thread Andrzej Hajda
Hi Ajay,

Thanks for the patch.

On 03/19/2014 03:22 PM, Ajay Kumar wrote:
> Add post processor ops for MDNIE and their support functions.
> Expose an interface for the FIMD to register MDNIE PP.
> 
> Signed-off-by: Ajay Kumar 
> Signed-off-by: Shirish S 
> Signed-off-by: Rahul Sharma 
> ---
>  drivers/gpu/drm/exynos/Makefile|   2 +-
>  drivers/gpu/drm/exynos/exynos_mdnie.c  | 707 
> +
>  drivers/gpu/drm/exynos/exynos_mdnie_regs.h | 154 +++
>  3 files changed, 862 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/exynos/exynos_mdnie.c
>  create mode 100644 drivers/gpu/drm/exynos/exynos_mdnie_regs.h
> 
> diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile
> index 02dde22..653eab5 100644
> --- a/drivers/gpu/drm/exynos/Makefile
> +++ b/drivers/gpu/drm/exynos/Makefile
> @@ -10,7 +10,7 @@ exynosdrm-y := exynos_drm_drv.o exynos_drm_encoder.o \
>  
>  exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o
>  exynosdrm-$(CONFIG_DRM_EXYNOS_DMABUF) += exynos_drm_dmabuf.o
> -exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)  += exynos_drm_fimd.o
> +exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)  += exynos_drm_fimd.o exynos_mdnie.o

Is there is a reason to not to create Kconfig entry?

>  exynosdrm-$(CONFIG_DRM_EXYNOS_DSI)   += exynos_drm_dsi.o
>  exynosdrm-$(CONFIG_DRM_EXYNOS_DP)+= exynos_dp_core.o exynos_dp_reg.o
>  exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI)  += exynos_hdmi.o exynos_mixer.o
> diff --git a/drivers/gpu/drm/exynos/exynos_mdnie.c 
> b/drivers/gpu/drm/exynos/exynos_mdnie.c
> new file mode 100644
> index 000..a043853
> --- /dev/null
> +++ b/drivers/gpu/drm/exynos/exynos_mdnie.c
> @@ -0,0 +1,707 @@
> +/* drivers/gpu/drm/exynos/exynos_mdnie.c
> + *
> + * Samsung mDNIe driver
> + *
> + * Copyright (C) 2014 Samsung Electronics Co., Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> +*/
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 
> +
> +#include "exynos_drm_drv.h"
> +#include "exynos_fimd_pp.h"
> +#include "exynos_mdnie_regs.h"
> +
> +#define GAMMA_RAMP_LENGTH17
> +#define COLOR_COMPONENTS 3

It is not used.

> +
> +#define MDNIE_ON 1
> +#define MDNIE_OFF0

You can drop these and use bool instead.

> +
> +#define PARAM_IN_RANGE(r, p, l, u)   \
> + do {\
> + r = ((p >= l) && (p <= u)) ? 0 : 1; \
> + if (r) \
> + DRM_ERROR("Wrong param: %s:%llu\n", #p, (u64)p); \
> + } while (0)

I am not sure if it is applicable but you can try to replace it with clamp.

> +
> +struct exynos_mdnie_drm_gamma {
> + u8 gamma_r[GAMMA_RAMP_LENGTH];
> + u8 gamma_g[GAMMA_RAMP_LENGTH];
> + u8 gamma_b[GAMMA_RAMP_LENGTH];
> +};
> +
> +struct mdnie_conf_params {
> + u32 modules_enabled;
> + struct exynos_mdnie_drm_gamma   gamma_params;
> + struct drm_exynos_mdnie_window  win;
> + struct drm_mode_color_reproduction  cr_params;
> + struct drm_mode_color_saturationcs_params;
> + struct drm_mode_edge_enhancementde_params;
> +};
> +
> +struct mdnie_context {
> + struct mdnie_conf_paramsparams;
> + struct clk  *mdnie_mux_clk;
> + struct clk  *mdnie_bus_clk;
> + struct clk  *mdnie_src_clk;
> + struct clk  *sclk_mout_fimd;
> + void __iomem*exynos_mdnie_base;
> + void __iomem*sysreg_disp1blk;
> + struct drm_display_mode mode;
> +};
> +
> +static void exynos_mdnie_unmask(struct mdnie_context *mdnie)
> +{
> + writel(!MDNIE_RELEASE_RFF_MASK_REGISTERS,
> + mdnie->exynos_mdnie_base +
> + MDNIE_RELEASE_RFF * sizeof(u32));
> +}


I see this function is called after many writes, why?

> +
> +static u32 mdnie_read(struct mdnie_context *mdnie, u32 reg)
> +{
> + return readl(mdnie->exynos_mdnie_base + reg * sizeof(u32)) &
> + MDNIE_REG_WIDTH;
> +}

By convention registers are addressed using byte offset.

> +
> +static void mdnie_write(struct mdnie_context *mdnie, u32 reg, u32 val)
> +{
> + writel(val & MDNIE_REG_WIDTH, mdnie->exynos_mdnie_base +
> + (reg & MDNIE_REG_OFFSET_LIMIT) * sizeof(u32));
> +
> + exynos_mdnie_unmask(mdnie);
> +}
> +
> +static void exynos_mdnie_bank_sel(struct mdnie_context *mdnie, int bank)
> +{
> + if (bank)
> + writel(MDNIE_TOP_R0_BANK1_SEL |
> + MDNIE_TOP_R0_SHADOW_SEL ,
> +

crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Rob Clark
On Tue, Apr 1, 2014 at 9:40 AM, Daniel Vetter  wrote:
> On Tue, Apr 01, 2014 at 08:40:54AM -0400, Rob Clark wrote:
>> No, not really.  I was just trying to get away with pushing some
>> complexity (for case #1) up to userspace instead of doing it in the
>> kernel.
>
> To clarify: I don't think it makes sense to fully abstract this away in
> the kernel, especially if userspace needs to be aware of the boundary
> between the crtcs so that it can correctly tile up the logical frambuffer.
> But I'm not sure whether trying to make that possible with a generic
> userspace driver is sensible, or whether having a bit of magic glue code
> in the ddx/wayland/hwc part for e.g. msm is the better option, at least in
> the short term.
>
> Since if the set of useable planes actually changes we need to push that
> decision up the stack even further like wayland/hwc currently allow, and
> maybe there's some things we need to fix at that layer first. Once we've
> learned that lesson we can push things down again and add a neat little
> generic kernel interface. At least thus far we've always done a bit of
> prototyping with driver-specific code to learn a few lessons, e.g. the
> various pieces of non-standard plane/overlay in i915.

right, things like 'STATUS' property for returning per-object status
would start as driver custom.  (And even 'SLAVE_CRTC'..)  Userspace
could look for certain property names in the same way that it looks
for certain gl extension strings.  But should be semi-standardized, so
other drivers which need the same thing should use same property
names/values/behaviors as much as possible.. which was the point for
starting the thread ;-)

BR,
-R


> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCHv4 06/13] drm: Add primary plane helpers (v2)

2014-04-01 Thread Daniel Vetter
On Mon, Mar 31, 2014 at 06:03:24PM -0700, Matt Roper wrote:
> On Fri, Mar 28, 2014 at 09:32:06AM +0100, Daniel Vetter wrote:
> > On Thu, Mar 27, 2014 at 05:44:31PM -0700, Matt Roper wrote:
> ...
> > > +  * N.B., we call set_config() directly here rather than using
> > > +  * drm_mode_set_config_internal.  We're reprogramming the same
> > > +  * connectors that were already in use, so we shouldn't need the extra
> > > +  * cross-CRTC fb refcounting to accomodate stealing connectors.
> > > +  * drm_mode_setplane() already handles the basic refcounting for the
> > > +  * framebuffers involved in this operation.
> > 
> > Wrong. The current crtc helper logic disables all disconnected connectors
> > forcefully on each set_config. Nope, I didn't make those semantics ... So
> > I think we need to think a bit harder here again.
> > 
> > See drm_helper_disable_unused_functions.
> 
> I think I'm still missing something here; can you clarify what the
> problematic case would be?
> 
> I only see a call to __drm_helper_disable_unused_functions() in the CRTC
> helper in cases where mode_changed = 1, which I don't believe it ever
> should be through the setplane() calls.  We should just be updating the
> framebuffer (and possibly panning) without touching any of the
> connectors, so I don't see how unrelated CRTC's would get disabled.  Am
> I overlooking another case here that the basic refcounting in setplane
> doesn't already handle?

Looking at drm_helper_disable_unused_functions we'll spot

list_for_each_entry(connector, >mode_config.connector_list, head) {
if (!connector->encoder)
continue;
if (connector->status == connector_status_disconnected)
connector->encoder = NULL;
}


So as soon as a connector is disconnected and you do _any_ kind of
->set_config call with modesetting helpers that crtc gets killed. Even if
it's completely unrelated. Dave originally changed this with an imo rather
thin justification:

commit a3a0544b2c84e1d7a2022b558ecf66d8c6a8dd93
Author: Dave Airlie 
Date:   Mon Aug 31 15:16:30 2009 +1000

drm/kms: add explicit encoder disable function and detach harder.

For shared tv-out and VGA encoders, we really need to know if
the encoder is just being switched off temporarily in blanking
or if we are really disabling it hard.

Also we need to try harder to disconnect encoders from unused
connectors so we can share more efficently.

(shared encoders stuff is coming in radeon tv-out support)

Signed-off-by: Dave Airlie 

To me this always smelled like papering over broken userspace. I've killed
this in the i915 modeset rewrite and we didn't really have angry users
scaling our walls. But I'm not sure what'll happen if we do this for all
other drivers.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Daniel Vetter
On Tue, Apr 01, 2014 at 08:06:04AM +0530, Vandana Kannan wrote:
> On Apr-01-2014 12:35 AM, Daniel Vetter wrote:
> > On Fri, Mar 21, 2014 at 08:31:29AM +0530, Vandana Kannan wrote:
> >> Populate PAR in infoframe structure. If there is a user setting for PAR, 
> >> then
> >> that value is set. Else, value is taken from CEA mode list if VIC is found.
> >> Else, PAR is calculated from resolution. If none of these conditions are
> >> satisfied, PAR is NONE as per initialization.
> >>
> >> As a next step, create a property that would enable a user space app to set
> >> aspect ratio. (will be pushed as a separate patch)
> >>
> >> Signed-off-by: Vandana Kannan 
> >> Cc: Jesse Barnes 
> >> Cc: Vijay Purushothaman 
> >> Cc: Ville Syrj?l? 
> >> Cc: intel-gfx at lists.freedesktop.org
> >> ---
> >>  drivers/gpu/drm/drm_edid.c |   34 ++
> >>  include/drm/drm_crtc.h |1 +
> >>  2 files changed, 35 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> >> index d4e3f9d..3db693f 100644
> >> --- a/drivers/gpu/drm/drm_edid.c
> >> +++ b/drivers/gpu/drm/drm_edid.c
> >> @@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
> >> *to_match)
> >>  }
> >>  EXPORT_SYMBOL(drm_match_cea_mode);
> >>  
> >> +/**
> >> + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding 
> >> to
> >> + * the input VIC from the CEA mode list
> >> + *
> >> + * Returns picture aspect ratio
> >> + */
> >> +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
> >> +{
> >> +  /* return picture aspect ratio for video_code - 1 to access the
> >> +   * right array element
> >> +  */
> >> +  return edid_cea_modes[video_code-1].picture_aspect_ratio;
> >> +}
> >> +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
> >> +
> >>  /*
> >>   * Calculate the alternate clock for HDMI modes (those from the HDMI 
> >> vendor
> >>   * specific block).
> >> @@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
> >> hdmi_avi_infoframe *frame,
> >>frame->video_code = drm_match_cea_mode(mode);
> >>  
> >>frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
> >> +
> >> +  /* Populate picture aspect ratio from either CEA mode list or
> >> +   *  user input
> >> +  */
> >> +  if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
> >> +  mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
> >> +  frame->picture_aspect = mode->picture_aspect_ratio;
> > 
> > Please pardon my ignorance, but how can userspace actually set this part
> > of the mode? I couldn't find any code which sets this anywhere ...
> > -Daniel
> > 
> I have submitted a patch to enable user space to set picture aspect
> ratio through a property..
> drm/i915: Add property to set HDMI aspect ratio
> http://lists.freedesktop.org/archives/intel-gfx/2014-March/042403.html

Ah, that makes more sense. I think we should move the property also into
the drm core so that all drivers that want to expose this can use the same
property. Also if you have patches which depend upon each another in a
funtional way it's better to post them together in one series.
-Daniel

> -Vandana
> >> +  else if (frame->video_code > 0)
> >> +  frame->picture_aspect = drm_get_cea_aspect_ratio(
> >> +  frame->video_code);
> >> +  else {
> >> +  if (!(mode->vdisplay % 3) &&
> >> +  (((mode->vdisplay * 4) / 3) == mode->hdisplay))
> >> +  frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
> >> +  else if (!(mode->vdisplay % 9) &&
> >> +  (((mode->vdisplay * 16) / 9) == mode->hdisplay))
> >> +  frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
> >> +  }
> >> +
> >>frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
> >>frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
> >>  
> >> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> >> index 27f828c..50dc55a 100644
> >> --- a/include/drm/drm_crtc.h
> >> +++ b/include/drm/drm_crtc.h
> >> @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device 
> >> *dev,
> >>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
> >>void *data, struct drm_file *file_priv);
> >>  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
> >> +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 
> >> video_code);
> >>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
> >>  extern bool drm_detect_monitor_audio(struct edid *edid);
> >>  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
> >> -- 
> >> 1.7.9.5
> >>
> >> ___
> >> dri-devel mailing list
> >> dri-devel at lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> > 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH] drm: Prefer noninterlace cmdline mode unless explicitly specified

2014-04-01 Thread Takashi Iwai
At Wed, 19 Mar 2014 15:17:50 +0100,
Daniel Vetter wrote:
> 
> On Wed, Mar 19, 2014 at 02:53:13PM +0100, Takashi Iwai wrote:
> > Currently drm_pick_cmdline_mode() doesn't care about the interlace
> > when the given mode line has no "i" suffix.  That is, when there are
> > multiple entries for the same resolution, an interlace mode might be
> > picked up just depending on the assigned order, and there is no way to
> > exclude it.
> > 
> > This patch changes the logic for the mode selection, to prefer the
> > noninterlace mode unless the interlace mode is explicitly given.
> > When no matching mode is found, it still tries the interlace mode as
> > fallback.
> > 
> > Signed-off-by: Takashi Iwai 
> 
> Yeah, makes sense. Do you have some bz or something for reference?
> 
> Reviewed-by: Daniel Vetter 
> 
> Cheers, Daniel

Dave, could you check this patch for 3.15?  I can resend if needed.


thanks,

Takashi


> > ---
> >  drivers/gpu/drm/drm_fb_helper.c | 11 +++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c 
> > b/drivers/gpu/drm/drm_fb_helper.c
> > index 98a03639b413..0a4b0a24359f 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -1162,6 +1162,7 @@ static struct drm_display_mode 
> > *drm_pick_cmdline_mode(struct drm_fb_helper_conne
> >  {
> > struct drm_cmdline_mode *cmdline_mode;
> > struct drm_display_mode *mode = NULL;
> > +   bool prefer_non_interlace;
> >  
> > cmdline_mode = _helper_conn->cmdline_mode;
> > if (cmdline_mode->specified == false)
> > @@ -1173,6 +1174,8 @@ static struct drm_display_mode 
> > *drm_pick_cmdline_mode(struct drm_fb_helper_conne
> > if (cmdline_mode->rb || cmdline_mode->margins)
> > goto create_mode;
> >  
> > +   prefer_non_interlace = !cmdline_mode->interlace;
> > + again:
> > list_for_each_entry(mode, _helper_conn->connector->modes, head) {
> > /* check width/height */
> > if (mode->hdisplay != cmdline_mode->xres ||
> > @@ -1187,10 +1190,18 @@ static struct drm_display_mode 
> > *drm_pick_cmdline_mode(struct drm_fb_helper_conne
> > if (cmdline_mode->interlace) {
> > if (!(mode->flags & DRM_MODE_FLAG_INTERLACE))
> > continue;
> > +   } else if (prefer_non_interlace) {
> > +   if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> > +   continue;
> > }
> > return mode;
> > }
> >  
> > +   if (prefer_non_interlace) {
> > +   prefer_non_interlace = false;
> > +   goto again;
> > +   }
> > +
> >  create_mode:
> > mode = drm_mode_create_from_cmdline_mode(fb_helper_conn->connector->dev,
> >  cmdline_mode);
> > -- 
> > 1.9.0
> > 
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> 


crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Rob Clark
On Tue, Apr 1, 2014 at 8:40 AM, Rob Clark  wrote:
> On Tue, Apr 1, 2014 at 4:04 AM, Daniel Vetter  wrote:
>> On Mon, Mar 31, 2014 at 02:04:00PM -0400, Rob Clark wrote:
>>> I thought I'd kick off a thread to better discuss how to deal with
>>> "large" displays which need multiple crtcs/planes merged to deal
>>> without output larger than a certain width.
>>>
>>> What I have in mind basically amounts to driver-custom-properties and
>>> shouldn't really need much/anything in the way of drm core or helper
>>> support[1].  There may of course be some room to make helpers/core
>>> more aware of crtc ganging if it turns out to be something that many
>>> drivers are doing in the same way.  But to start with my bigger
>>> concern is getting the userspace interface right.
>>>
>>> This is semi-related to a thread started earlier by Aaron Plattner on
>>> xorg-devel:
>>>
>>> http://lists.freedesktop.org/archives/xorg-devel/2014-January/039984.html
>>>
>>> As I see it, there are really two different scenarios:
>>>
>>> 1) single encoder/connector:  double up on planes (pipes) and crtcs
>>> (mixers), but still a single connector.
>>>
>>> 2) double up entire pipe.. this scenario is more like what Aaron
>>> mentioned.  This could mean using multiple DVI or HDMI connectors, or
>>> multiple DSI channels.  In the DSI case, I'm not entirely sure yet the
>>> implications for a dsi panel driver, but I think it needs to be a bit
>>> aware.
>>
>> I think this here is (mostly) a userspace problem of figuring out how the
>> different outputs are laid out in reality. Only difference is that the hw
>> might (not sure how far those standars really are) provide some definit
>> hints. So imo not a kernel problem really.
>
> right, that is why I included the link back to the xorg-devel
> discussion.  The second scenario seems pretty similar to that.
>
> (although re-reading what I wrote, I realized I didn't connect those
> two dots at all)
>
>>> ---
>>>
>>> For the first scenario, the approach I am leaning towards is a
>>> 'SLAVE_CRTC'[2] property on the crtc.  The idea being that userspace
>>> could pick an otherwise unused CRTC, and assign it as a slave in order
>>> to enable higher resolutions.  The primary crtc could use the slave's
>>> mixer and primary plane.  The existing encoder->possible_crtcs would
>>> be used by userspace to figure out which crtc(s) it could pick to use
>>> as a slave.
>>>
>>> The property approach seems like it should fit in nicely with the
>>> plans for atomic.  The driver can decide whether a given mode is
>>> possible during the atomic 'test' step based on the proposed
>>> SLAVE_CRTC value.  We do possibly get funny edge cases where a CRTC
>>> isn't yet available but will be after next vblank, but this is
>>> basically the same scenario with have already with moving planes
>>> between crtcs (and where an EBUSY or similar return value from atomic
>>> would make sense).
>>>
>>> For non-primary planes, it may be sufficient to expose max
>>> width/height dimensions and let userspace figure out when it needs to
>>> use multiple planes for a single layer.
>>
>> I second the idea of exposing plane limits. I've cc'ed a thread on
>> dri-devel where Damien discussed this a bit. We probably need a pile of
>> per plane/per pixel format properties like max/min size, stride and a
>> pile of flags for special cases.
>
> right, this is pretty much what I had in mind, a bunch of read-only properties
>
>> For the crtc ganging I wonder whether we even should expose this. For
>> generic userspace it's just yet another random hardware restriction. E.g.
>> in i915 we don't expose the various (and constantly changing between
>> platforms) restrictions on plls. All we do is tell userspace that it
>> didn't work out.
>
> True..  I guess if it was only one driver that would have to deal with
> this, that would make sense.  Otherwise, I'd be pretty happy to make
> the kernel a bit simpler and let userspace choose.
>
> I guess you already do some under-the-hood remapping of pipes/crtcs in
> i915, so maybe this sort of thing is a bit easier for you.  I was
> really hoping not to have to go there.

one extra thing to note:  SLAVE_CRTC makes things someone usable for
userspace that still uses the legacy setcrtc API..  trying to do it
all under the hood seems only reasonable for atomic.

What I'm leaning towards is introducing SLAVE_CRTC property, but in
the atomic case, let the driver attempt to set that property itself if
needed during the atomic->test() step.

BR,
-R

>> Imo the point of atomic modesets with the test mode is that we can expose
>> this information at least indirectly to userspace. But trying to come up
>> with some explicit scheme for every insane corner case is imo pointless -
>> generic userspace won't ever bothering with them, and if you need special
>> code you might as well bake in the assumptions in userspace. Kinda like
>> current userspace has baked-in assumptions about how a fb backing storage

[Bug 65761] HD 7970M Hybrid - hangs and errors and rmmod causes crash

2014-04-01 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=65761

Mike Cloaked  changed:

   What|Removed |Added

 CC||mike.cloaked at gmail.com

--- Comment #56 from Mike Cloaked  ---
It is possible that this report is directly related:

https://bugzilla.kernel.org/show_bug.cgi?id=73291

So I guess at this time the bug is still awaiting the mesa fix to test further
in arch linux at least?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


crtc ganging in KMS, "large" displays, etc

2014-04-01 Thread Rob Clark
On Tue, Apr 1, 2014 at 4:04 AM, Daniel Vetter  wrote:
> On Mon, Mar 31, 2014 at 02:04:00PM -0400, Rob Clark wrote:
>> I thought I'd kick off a thread to better discuss how to deal with
>> "large" displays which need multiple crtcs/planes merged to deal
>> without output larger than a certain width.
>>
>> What I have in mind basically amounts to driver-custom-properties and
>> shouldn't really need much/anything in the way of drm core or helper
>> support[1].  There may of course be some room to make helpers/core
>> more aware of crtc ganging if it turns out to be something that many
>> drivers are doing in the same way.  But to start with my bigger
>> concern is getting the userspace interface right.
>>
>> This is semi-related to a thread started earlier by Aaron Plattner on
>> xorg-devel:
>>
>> http://lists.freedesktop.org/archives/xorg-devel/2014-January/039984.html
>>
>> As I see it, there are really two different scenarios:
>>
>> 1) single encoder/connector:  double up on planes (pipes) and crtcs
>> (mixers), but still a single connector.
>>
>> 2) double up entire pipe.. this scenario is more like what Aaron
>> mentioned.  This could mean using multiple DVI or HDMI connectors, or
>> multiple DSI channels.  In the DSI case, I'm not entirely sure yet the
>> implications for a dsi panel driver, but I think it needs to be a bit
>> aware.
>
> I think this here is (mostly) a userspace problem of figuring out how the
> different outputs are laid out in reality. Only difference is that the hw
> might (not sure how far those standars really are) provide some definit
> hints. So imo not a kernel problem really.

right, that is why I included the link back to the xorg-devel
discussion.  The second scenario seems pretty similar to that.

(although re-reading what I wrote, I realized I didn't connect those
two dots at all)

>> ---
>>
>> For the first scenario, the approach I am leaning towards is a
>> 'SLAVE_CRTC'[2] property on the crtc.  The idea being that userspace
>> could pick an otherwise unused CRTC, and assign it as a slave in order
>> to enable higher resolutions.  The primary crtc could use the slave's
>> mixer and primary plane.  The existing encoder->possible_crtcs would
>> be used by userspace to figure out which crtc(s) it could pick to use
>> as a slave.
>>
>> The property approach seems like it should fit in nicely with the
>> plans for atomic.  The driver can decide whether a given mode is
>> possible during the atomic 'test' step based on the proposed
>> SLAVE_CRTC value.  We do possibly get funny edge cases where a CRTC
>> isn't yet available but will be after next vblank, but this is
>> basically the same scenario with have already with moving planes
>> between crtcs (and where an EBUSY or similar return value from atomic
>> would make sense).
>>
>> For non-primary planes, it may be sufficient to expose max
>> width/height dimensions and let userspace figure out when it needs to
>> use multiple planes for a single layer.
>
> I second the idea of exposing plane limits. I've cc'ed a thread on
> dri-devel where Damien discussed this a bit. We probably need a pile of
> per plane/per pixel format properties like max/min size, stride and a
> pile of flags for special cases.

right, this is pretty much what I had in mind, a bunch of read-only properties

> For the crtc ganging I wonder whether we even should expose this. For
> generic userspace it's just yet another random hardware restriction. E.g.
> in i915 we don't expose the various (and constantly changing between
> platforms) restrictions on plls. All we do is tell userspace that it
> didn't work out.

True..  I guess if it was only one driver that would have to deal with
this, that would make sense.  Otherwise, I'd be pretty happy to make
the kernel a bit simpler and let userspace choose.

I guess you already do some under-the-hood remapping of pipes/crtcs in
i915, so maybe this sort of thing is a bit easier for you.  I was
really hoping not to have to go there.

> Imo the point of atomic modesets with the test mode is that we can expose
> this information at least indirectly to userspace. But trying to come up
> with some explicit scheme for every insane corner case is imo pointless -
> generic userspace won't ever bothering with them, and if you need special
> code you might as well bake in the assumptions in userspace. Kinda like
> current userspace has baked-in assumptions about how a fb backing storage
> object should look like.

True, although I expect width limits to not be entirely uncommon.  I
think I know of at least two or three hw platforms with some sort of
"merge" feature for wide displays.



but, now that we are on the topic of atomic..  seems like there are
two cases for what happens with planes vs ganged crtcs.  Either the
plane can be shared across the two half-crtcs or not.  So maybe I end
up having to remap planes under the hood already (in which case, I
suppose doing the same for crtcs isn't such a big 

[PATCH] drm/edid: Fill PAR in AVI infoframe based on CEA mode list

2014-04-01 Thread Vandana Kannan
On Apr-01-2014 12:35 AM, Daniel Vetter wrote:
> On Fri, Mar 21, 2014 at 08:31:29AM +0530, Vandana Kannan wrote:
>> Populate PAR in infoframe structure. If there is a user setting for PAR, then
>> that value is set. Else, value is taken from CEA mode list if VIC is found.
>> Else, PAR is calculated from resolution. If none of these conditions are
>> satisfied, PAR is NONE as per initialization.
>>
>> As a next step, create a property that would enable a user space app to set
>> aspect ratio. (will be pushed as a separate patch)
>>
>> Signed-off-by: Vandana Kannan 
>> Cc: Jesse Barnes 
>> Cc: Vijay Purushothaman 
>> Cc: Ville Syrj?l? 
>> Cc: intel-gfx at lists.freedesktop.org
>> ---
>>  drivers/gpu/drm/drm_edid.c |   34 ++
>>  include/drm/drm_crtc.h |1 +
>>  2 files changed, 35 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> index d4e3f9d..3db693f 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -2452,6 +2452,21 @@ u8 drm_match_cea_mode(const struct drm_display_mode 
>> *to_match)
>>  }
>>  EXPORT_SYMBOL(drm_match_cea_mode);
>>  
>> +/**
>> + * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
>> + * the input VIC from the CEA mode list
>> + *
>> + * Returns picture aspect ratio
>> + */
>> +enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code)
>> +{
>> +/* return picture aspect ratio for video_code - 1 to access the
>> + * right array element
>> +*/
>> +return edid_cea_modes[video_code-1].picture_aspect_ratio;
>> +}
>> +EXPORT_SYMBOL(drm_get_cea_aspect_ratio);
>> +
>>  /*
>>   * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
>>   * specific block).
>> @@ -3613,6 +3628,25 @@ drm_hdmi_avi_infoframe_from_display_mode(struct 
>> hdmi_avi_infoframe *frame,
>>  frame->video_code = drm_match_cea_mode(mode);
>>  
>>  frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
>> +
>> +/* Populate picture aspect ratio from either CEA mode list or
>> + *  user input
>> +*/
>> +if (mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_4_3 ||
>> +mode->picture_aspect_ratio == HDMI_PICTURE_ASPECT_16_9)
>> +frame->picture_aspect = mode->picture_aspect_ratio;
> 
> Please pardon my ignorance, but how can userspace actually set this part
> of the mode? I couldn't find any code which sets this anywhere ...
> -Daniel
> 
I have submitted a patch to enable user space to set picture aspect
ratio through a property..
drm/i915: Add property to set HDMI aspect ratio
http://lists.freedesktop.org/archives/intel-gfx/2014-March/042403.html
-Vandana
>> +else if (frame->video_code > 0)
>> +frame->picture_aspect = drm_get_cea_aspect_ratio(
>> +frame->video_code);
>> +else {
>> +if (!(mode->vdisplay % 3) &&
>> +(((mode->vdisplay * 4) / 3) == mode->hdisplay))
>> +frame->picture_aspect = HDMI_PICTURE_ASPECT_4_3;
>> +else if (!(mode->vdisplay % 9) &&
>> +(((mode->vdisplay * 16) / 9) == mode->hdisplay))
>> +frame->picture_aspect = HDMI_PICTURE_ASPECT_16_9;
>> +}
>> +
>>  frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
>>  frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN;
>>  
>> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
>> index 27f828c..50dc55a 100644
>> --- a/include/drm/drm_crtc.h
>> +++ b/include/drm/drm_crtc.h
>> @@ -983,6 +983,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device 
>> *dev,
>>  extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
>>  void *data, struct drm_file *file_priv);
>>  extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
>> +extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 
>> video_code);
>>  extern bool drm_detect_hdmi_monitor(struct edid *edid);
>>  extern bool drm_detect_monitor_audio(struct edid *edid);
>>  extern bool drm_rgb_quant_range_selectable(struct edid *edid);
>> -- 
>> 1.7.9.5
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 



[PATCHv4 06/13] drm: Add primary plane helpers (v2)

2014-04-01 Thread Rob Clark
On Tue, Apr 1, 2014 at 3:45 AM, Daniel Vetter  wrote:
> On Mon, Mar 31, 2014 at 06:03:24PM -0700, Matt Roper wrote:
>> On Fri, Mar 28, 2014 at 09:32:06AM +0100, Daniel Vetter wrote:
>> > On Thu, Mar 27, 2014 at 05:44:31PM -0700, Matt Roper wrote:
>> ...
>> > > +  * N.B., we call set_config() directly here rather than using
>> > > +  * drm_mode_set_config_internal.  We're reprogramming the same
>> > > +  * connectors that were already in use, so we shouldn't need the extra
>> > > +  * cross-CRTC fb refcounting to accomodate stealing connectors.
>> > > +  * drm_mode_setplane() already handles the basic refcounting for the
>> > > +  * framebuffers involved in this operation.
>> >
>> > Wrong. The current crtc helper logic disables all disconnected connectors
>> > forcefully on each set_config. Nope, I didn't make those semantics ... So
>> > I think we need to think a bit harder here again.
>> >
>> > See drm_helper_disable_unused_functions.
>>
>> I think I'm still missing something here; can you clarify what the
>> problematic case would be?
>>
>> I only see a call to __drm_helper_disable_unused_functions() in the CRTC
>> helper in cases where mode_changed = 1, which I don't believe it ever
>> should be through the setplane() calls.  We should just be updating the
>> framebuffer (and possibly panning) without touching any of the
>> connectors, so I don't see how unrelated CRTC's would get disabled.  Am
>> I overlooking another case here that the basic refcounting in setplane
>> doesn't already handle?
>
> Looking at drm_helper_disable_unused_functions we'll spot
>
> list_for_each_entry(connector, >mode_config.connector_list, 
> head) {
> if (!connector->encoder)
> continue;
> if (connector->status == connector_status_disconnected)
> connector->encoder = NULL;
> }
>
>
> So as soon as a connector is disconnected and you do _any_ kind of
> ->set_config call with modesetting helpers that crtc gets killed. Even if
> it's completely unrelated. Dave originally changed this with an imo rather
> thin justification:

sure, so this could change the timing of things a bit..  but it would
be a bug if a HPD event or poll didn't eventually detect that and shut
things off..

BR,
-R

> commit a3a0544b2c84e1d7a2022b558ecf66d8c6a8dd93
> Author: Dave Airlie 
> Date:   Mon Aug 31 15:16:30 2009 +1000
>
> drm/kms: add explicit encoder disable function and detach harder.
>
> For shared tv-out and VGA encoders, we really need to know if
> the encoder is just being switched off temporarily in blanking
> or if we are really disabling it hard.
>
> Also we need to try harder to disconnect encoders from unused
> connectors so we can share more efficently.
>
> (shared encoders stuff is coming in radeon tv-out support)
>
> Signed-off-by: Dave Airlie 
>
> To me this always smelled like papering over broken userspace. I've killed
> this in the i915 modeset rewrite and we didn't really have angry users
> scaling our walls. But I'm not sure what'll happen if we do this for all
> other drivers.
> -Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 76884] New: Dithering not enabled on 6-bit per channel display

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=76884

  Priority: medium
Bug ID: 76884
  Assignee: dri-devel at lists.freedesktop.org
   Summary: Dithering not enabled on 6-bit per channel display
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: paula at parashep.com
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: unspecified
 Component: DRM/Radeon
   Product: DRI

from what I've read, dithering configuration should be automatically configured
based on the OEM configuration of the display. however, on this laptop (HP Envy
17-1195ca), it clearly is not. built-in eDP display, 1920x1080 at 60Hz. it is
also a 3D display, and it also supports 120Hz. I don't use 3D or 120Hz mode so
I haven't tested those.

version 7.3+git1403171930

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/c85844f5/attachment.html>


[Bug 66963] Rv6xx dpm problems

2014-04-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=66963

--- Comment #205 from Bryan Quigley <gquigs+bugs at gmail.com> ---
1. (In reply to comment #199)

I've reproduced the hang without X, instead using kmscon.
This causes the graphics hang (can still switch back to the original VT and
kill it though):  /usr/local/bin/kmscon --vt 5 --hwaccel
Booting with dpm off or without --hwaccel doesn't trigger the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20140401/a4c6a45b/attachment.html>