[Bug 101026] RX 550 HDMI 4k 60fps not working, DisplayPort is.

2017-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101026

Liam Murphy  changed:

   What|Removed |Added

   Priority|medium  |high

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 101026] RX 550 HDMI 4k 60fps not working, DisplayPort is.

2017-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101026

Bug ID: 101026
   Summary: RX 550 HDMI 4k 60fps not working, DisplayPort is.
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: liammur...@fastmail.com
QA Contact: dri-devel@lists.freedesktop.org

Hello everyone,

Please let me know what logs/command outputs I can give, not sure what would
help you all out.

I recently bought an AMD RX 550, first GPU with the Polaris architecture (so I
assume growing pains here), and am experiencing a bug where HDMI at 4k 60 fps
is not working, but DisplayPort does. 

HDMI 4k60fps is working for me under Windows, so to me it's safe to say this is
a Mesa problem. 

This was happening on Mesa 17.0.5 and 17.2 git on OpenSUSE Tumbleweed, in
addition to Mesa 17 on Ubuntu 17.04.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/8] remove unsafe drm_for_each_connector()

2017-05-12 Thread Sean Paul
On Thu, May 11, 2017 at 04:10:41PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Hi all,
> 
> Something ligth in the middle of all my other tasks. I removed
> drm_for_each_connector() in favor of drm_for_each_connector_iter().
> 
> The i915 patch was tested, but I only *built-tested* the others!
> 
> Gustavo
> 
> ---

Hi Gustavo,
Aside from the rockchip splat, consider the rest of the series:

Reviewed-by: Sean Paul 

Once you have a v2 rockchip, I'll test and ack.

Sean

> Gustavo Padovan (8):
>   drm/exynos: use drm_for_each_connector_iter()
>   drm/rockchip: use drm_for_each_connector_iter()
>   drm/i915: use drm_for_each_connector_iter()
>   drm/mediatek: use drm_for_each_connector_iter()
>   drm/nouveau: use drm_for_each_connector_iter()
>   drm/vc4: use drm_for_each_connector_iter()
>   drm: remove unsafe drm_for_each_connector()
>   drm: todo: remove task about switch to drm_connector_list_iter
> 
>  Documentation/gpu/todo.rst  | 13 -
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 --
>  drivers/gpu/drm/i915/intel_display.c|  5 -
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c |  5 -
>  drivers/gpu/drm/nouveau/nv50_display.c  |  5 -
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 10 +-
>  drivers/gpu/drm/vc4/vc4_crtc.c  |  5 -
>  include/drm/drm_connector.h | 15 ---
>  8 files changed, 29 insertions(+), 43 deletions(-)
> 
> -- 
> 2.9.3
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/8] drm/rockchip: use drm_for_each_connector_iter()

2017-05-12 Thread Sean Paul
On Thu, May 11, 2017 at 04:10:43PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Drop legacy drm_for_each_connector() in favor of the race-free
> drm_for_each_connector_iter()
> 
> Cc: Mark Yao 
> Signed-off-by: Gustavo Padovan 
> 
> ---
> only built-tested!
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 40a5e6e..4f042ab 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1118,16 +1118,16 @@ static void vop_crtc_destroy_state(struct drm_crtc 
> *crtc,
>  #ifdef CONFIG_DRM_ANALOGIX_DP
>  static struct drm_connector *vop_get_edp_connector(struct vop *vop)
>  {
> - struct drm_crtc *crtc = >crtc;
>   struct drm_connector *connector;
> + struct drm_connector_list_iter conn_iter;
>  
> - mutex_lock(>dev->mode_config.mutex);
> - drm_for_each_connector(connector, crtc->dev)
> + drm_connector_list_iter_begin(vop->drm_dev, _iter);
> + drm_for_each_connector_iter(connector, _iter) {

Unmatched brace here. This code is protected by CONFIG_DRM_ANALOGIX_DP, so I'm
guessing that's why your build test didn't pick it up.

Sean

>   if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
> - mutex_unlock(>dev->mode_config.mutex);
> + drm_connector_list_iter_end(_iter);
>   return connector;
>   }
> - mutex_unlock(>dev->mode_config.mutex);
> + drm_connector_list_iter_end(_iter);
>  
>   return NULL;
>  }
> -- 
> 2.9.3
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/vc4: use drm_for_each_connector_iter()

2017-05-12 Thread Eric Anholt
Gustavo Padovan  writes:

> From: Gustavo Padovan 
>
> Drop legacy drm_for_each_connector() in favor of the race-free
> drm_for_each_connector_iter().
>
> v2: add missing drm_connector_list_iter_end(Daniel Vetter)
>
> Cc: Eric Anholt 
> Signed-off-by: Gustavo Padovan 
> Reviewed-by: Daniel Vetter 

Acked-by: Eric Anholt 


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [git pull] drm fixes for v4.12-rc1

2017-05-12 Thread Linus Torvalds
On May 12, 2017 12:30 PM, "Dave Airlie"  wrote:

>
> Dave, time to update your scripts and address book..

wierd gmail failed me.


I think gmail is sometimes too smart for its own good. It takes the other
recipients into account when auto-completing the recipients list, so even
if you *normally* send to the new dri list, it might be looking at your
historical patterns when sending to me, and then picking the old list by
default.

  Linus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/tegra: Check size of a submitted command buffer

2017-05-12 Thread Erik Faye-Lund
On Fri, May 12, 2017 at 9:29 PM, Dmitry Osipenko  wrote:
> If command buffer claims a number of words that is higher than its BO can
> fit and a relocation lays past the BO, a kernel OOPS will be fired on that
> relocation address patching. This was triggered by an opentegra Xorg driver
> that erroneously pushed too many commands to the pushbuf.
>
> [   46.829393] Unable to handle kernel paging request at virtual address 
> f09b2000
> ...
> [] (host1x_job_pin) from [] (tegra_drm_submit+0x474/0x510)
> [] (tegra_drm_submit) from [] (tegra_submit+0x50/0x6c)
> [] (tegra_submit) from [] (drm_ioctl+0x1e4/0x3ec)
> [] (drm_ioctl) from [] (do_vfs_ioctl+0x9c/0x8e4)
> [] (do_vfs_ioctl) from [] (SyS_ioctl+0x34/0x5c)
> [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x3c)
>
> Signed-off-by: Dmitry Osipenko 

Looks good, good catch!

Reviewed-by: Erik Faye-Lund 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 1/3] drm/stm: ltdc: Add bridge support

2017-05-12 Thread Philippe CORNU
Add the bridge support, used by DSI host and HDMI/LVDS bridges.

Signed-off-by: Philippe CORNU 
---
 drivers/gpu/drm/stm/ltdc.c | 82 +++---
 drivers/gpu/drm/stm/ltdc.h |  1 +
 2 files changed, 72 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 7b2d63b..b0d1fba 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -858,6 +858,43 @@ static struct drm_encoder *ltdc_rgb_encoder_create(struct 
drm_device *ddev)
return encoder;
 }
 
+static const struct drm_encoder_funcs bridge_encoder_funcs = {
+   .destroy = drm_encoder_cleanup,
+};
+
+struct drm_encoder *bridge_encoder_create(struct drm_device *ddev,
+ struct drm_bridge *bridge)
+{
+   struct drm_encoder *encoder;
+   int ret;
+
+   encoder = devm_kzalloc(ddev->dev, sizeof(*encoder), GFP_KERNEL);
+   if (!encoder)
+   return NULL;
+
+   encoder->possible_crtcs = CRTC_MASK;
+   encoder->possible_clones = 0; /* No cloning support */
+
+   drm_encoder_init(ddev, encoder, _encoder_funcs,
+DRM_MODE_ENCODER_TMDS, NULL);
+
+   drm_encoder_helper_add(encoder, NULL);
+
+   /* Link drm_bridge to encoder */
+   bridge->encoder = encoder;
+   encoder->bridge = bridge;
+
+   ret = drm_bridge_attach(encoder, bridge, NULL);
+   if (ret) {
+   drm_encoder_cleanup(encoder);
+   return NULL;
+   }
+
+   DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id);
+
+   return encoder;
+}
+
 /*
  * DRM_CONNECTOR
  */
@@ -967,12 +1004,12 @@ static int ltdc_get_caps(struct drm_device *ddev)
return 0;
 }
 
-static struct drm_panel *ltdc_get_panel(struct drm_device *ddev)
+static int ltdc_parse_dt(struct drm_device *ddev)
 {
+   struct ltdc_device *ldev = ddev->dev_private;
struct device *dev = ddev->dev;
struct device_node *np = dev->of_node;
struct device_node *entity, *port = NULL;
-   struct drm_panel *panel = NULL;
 
DRM_DEBUG_DRIVER("\n");
 
@@ -987,19 +1024,36 @@ static struct drm_panel *ltdc_get_panel(struct 
drm_device *ddev)
 
port = of_graph_get_remote_port_parent(entity);
if (port) {
+   struct drm_bridge *bridge;
+   struct drm_panel *panel;
+
+   bridge = of_drm_find_bridge(port);
panel = of_drm_find_panel(port);
-   of_node_put(port);
+   if (!bridge && !panel) {
+   of_node_put(entity);
+   return -EPROBE_DEFER;
+   }
+
+   if (bridge) {
+   if (!ldev->bridge) {
+   ldev->bridge = bridge;
+   DRM_INFO("remote bridge %s\n",
+port->full_name);
+   }
+   }
+
if (panel) {
-   DRM_DEBUG_DRIVER("remote panel %s\n",
+   if (!ldev->panel) {
+   ldev->panel = panel;
+   DRM_INFO("remote panel %s\n",
 port->full_name);
-   } else {
-   DRM_DEBUG_DRIVER("panel missing\n");
-   of_node_put(entity);
+   }
}
+   of_node_put(port);
}
}
 
-   return panel;
+   return 0;
 }
 
 int ltdc_load(struct drm_device *ddev)
@@ -1017,9 +1071,9 @@ int ltdc_load(struct drm_device *ddev)
 
DRM_DEBUG_DRIVER("\n");
 
-   ldev->panel = ltdc_get_panel(ddev);
-   if (!ldev->panel)
-   return -EPROBE_DEFER;
+   ret = ltdc_parse_dt(ddev);
+   if (ret)
+   return ret;
 
rstc = of_reset_control_get(np, NULL);
 
@@ -1077,6 +1131,12 @@ int ltdc_load(struct drm_device *ddev)
 
DRM_INFO("ltdc hw version 0x%08x - ready\n", ldev->caps.hw_version);
 
+   if (ldev->bridge) {
+   encoder = bridge_encoder_create(ddev, ldev->bridge);
+   if (!encoder)
+   return -EINVAL;
+   }
+
if (ldev->panel) {
encoder = ltdc_rgb_encoder_create(ddev);
if (!encoder) {
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index 5427ef4..0083cad 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -25,6 +25,7 @@ struct ltdc_device {
void __iomem *regs;
struct clk *pixel_clk;  /* lcd pixel clock */
struct drm_panel *panel;
+   struct 

Re: [PATCH v2 00/29] Remove the omapdrm and omapdss devices from platform code

2017-05-12 Thread Tony Lindgren
* Tomi Valkeinen  [170512 00:32]:
> On 11/05/17 17:16, Tony Lindgren wrote:
> 
> >> pinctrl-single doesn't allow to freely set the bits, but requires the
> >> pins to have similar bit structure (function-mask). In CONTROL_DSIPHY,
> >> DSI1 and DSI2 have different bit structures.
> > 
> > OK if the register mixes different types of controllers that
> > can't be partitioned into separate 8 or 16 bit instances then
> > you're out of luck with pinctrl-single. If it does not fit, no
> > point trying to force it, then you need a custom pinctrl driver.
> 
> Writing a driver for a single register on a legacy SoC feels like an
> overkill... But I guess a generic pinctrl driver which allows free
> writes to registers would do the trick, but, then again, if so far we
> have a single register in a single SoC that needs this, maybe it's not
> worth the effort.

Yeah..

> >> I don't understand why pinctrl-single tries so hard to fit things into
> >> one mold...
> > 
> > Basically on many SoCs pinctrl is just the same exact control
> > register repeated for each pin on the SoC:
> 
> Right, I was just wondering why it forces one to have a function mask,
> versus allowing it to be left out and thus making it possible to handle
> also cases where the pins require different kinds of bit masks.

Some of the bits are not usable typically. I think what you're
describing could probably be done with a custom compatible plus
struct pcs_soc_data.

Regards,

Tony
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v7 6/9] drm/i915: Add option to support dynamic backlight via DPCD

2017-05-12 Thread Pandiyan, Dhinakaran
On Thu, 2017-05-11 at 16:02 -0700, Puthikorn Voravootivat wrote:
> This patch adds option to enable dynamic backlight for eDP
> panel that supports this feature via DPCD register and
> set minimum / maximum brightness to 0% and 100% of the
> normal brightness.
> 
> Signed-off-by: Puthikorn Voravootivat 
> ---
>  drivers/gpu/drm/i915/i915_params.c|  5 
>  drivers/gpu/drm/i915/i915_params.h|  3 +-
>  drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 40 
> +++
>  3 files changed, 41 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_params.c 
> b/drivers/gpu/drm/i915/i915_params.c
> index 13cf3f1572ab..6eaf660e74da 100644
> --- a/drivers/gpu/drm/i915/i915_params.c
> +++ b/drivers/gpu/drm/i915/i915_params.c
> @@ -65,6 +65,7 @@ struct i915_params i915 __read_mostly = {
>   .inject_load_failure = 0,
>   .enable_dpcd_backlight = -1,
>   .enable_gvt = false,
> + .enable_dbc = false,

Thanks for adding this switch, however I am not sure about doing this
via a kernel parameter. Controlling this via a drm_property is another
way. But, that would require user space changes. 

Jani, 
What are your thoughts on adding another kernel parameter. iirc there
were some concerns in the mailing list about adding new params a while
back. 


-DK


>  };
>  
>  module_param_named(modeset, i915.modeset, int, 0400);
> @@ -255,3 +256,7 @@ MODULE_PARM_DESC(enable_dpcd_backlight,
>  module_param_named(enable_gvt, i915.enable_gvt, bool, 0400);
>  MODULE_PARM_DESC(enable_gvt,
>   "Enable support for Intel GVT-g graphics virtualization host 
> support(default:false)");
> +
> +module_param_named(enable_dbc, i915.enable_dbc, bool, 0600);
> +MODULE_PARM_DESC(enable_dbc,
> + "Enable support for dynamic backlight control (default:false)");
> diff --git a/drivers/gpu/drm/i915/i915_params.h 
> b/drivers/gpu/drm/i915/i915_params.h
> index ac02efce6e22..2de3e2850b54 100644
> --- a/drivers/gpu/drm/i915/i915_params.h
> +++ b/drivers/gpu/drm/i915/i915_params.h
> @@ -67,7 +67,8 @@
>   func(bool, nuclear_pageflip); \
>   func(bool, enable_dp_mst); \
>   func(int, enable_dpcd_backlight); \
> - func(bool, enable_gvt)
> + func(bool, enable_gvt); \
> + func(bool, enable_dbc)
>  
>  #define MEMBER(T, member) T member
>  struct i915_params {
> diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c 
> b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> index a72893da78d0..1c5459bc20ae 100644
> --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> @@ -97,10 +97,27 @@ intel_dp_aux_set_backlight(struct intel_connector 
> *connector, u32 level)
>   }
>  }
>  
> +/*
> + * Set minimum / maximum dynamic brightness percentage. This value is 
> expressed
> + * as the percentage of normal brightness in 5% increments.
> + */
> +static void
> +intel_dp_aux_set_dynamic_backlight_percent(struct intel_dp *intel_dp,
> +u32 min, u32 max)
> +{
> + u8 dbc[] = { DIV_ROUND_CLOSEST(min, 5), DIV_ROUND_CLOSEST(max, 5) };
> +
> + if (drm_dp_dpcd_write(_dp->aux, DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET,
> +   dbc, sizeof(dbc) < 0)) {
> + DRM_DEBUG_KMS("Failed to write aux DBC brightness level\n");
> + }
> +}
> +
>  static void intel_dp_aux_enable_backlight(struct intel_connector *connector)
>  {
>   struct intel_dp *intel_dp = enc_to_intel_dp(>encoder->base);
>   uint8_t dpcd_buf = 0;
> + uint8_t new_dpcd_buf = 0;
>   uint8_t edp_backlight_mode = 0;
>  
>   if (drm_dp_dpcd_readb(_dp->aux,
> @@ -110,18 +127,15 @@ static void intel_dp_aux_enable_backlight(struct 
> intel_connector *connector)
>   return;
>   }
>  
> + new_dpcd_buf = dpcd_buf;
>   edp_backlight_mode = dpcd_buf & DP_EDP_BACKLIGHT_CONTROL_MODE_MASK;
>  
>   switch (edp_backlight_mode) {
>   case DP_EDP_BACKLIGHT_CONTROL_MODE_PWM:
>   case DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET:
>   case DP_EDP_BACKLIGHT_CONTROL_MODE_PRODUCT:
> - dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK;
> - dpcd_buf |= DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD;
> - if (drm_dp_dpcd_writeb(_dp->aux,
> - DP_EDP_BACKLIGHT_MODE_SET_REGISTER, dpcd_buf) < 0) {
> - DRM_DEBUG_KMS("Failed to write aux backlight mode\n");
> - }
> + new_dpcd_buf &= ~DP_EDP_BACKLIGHT_CONTROL_MODE_MASK;
> + new_dpcd_buf |= DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD;
>   break;
>  
>   /* Do nothing when it is already DPCD mode */
> @@ -130,6 +144,20 @@ static void intel_dp_aux_enable_backlight(struct 
> intel_connector *connector)
>   break;
>   }
>  
> + if (i915.enable_dbc &&
> + (intel_dp->edp_dpcd[2] & DP_EDP_DYNAMIC_BACKLIGHT_CAP)) {
> + new_dpcd_buf |= DP_EDP_DYNAMIC_BACKLIGHT_ENABLE;
> + 

Re: [PATCH v2 5/8] drm: Use new mode_valid() helpers in connector probe helper

2017-05-12 Thread Jose Abreu
Hi Laurent,


On 12-05-2017 10:35, Laurent Pinchart wrote:
> Hi Jose,
>
> Thank you for the patch.
>
> On Tuesday 09 May 2017 18:00:12 Jose Abreu wrote:
>> This changes the connector probe helper function to use the new
>> encoder->mode_valid() and crtc->mode_valid() helper callbacks to
>> validate the modes.
>>
>> The new callbacks are optional so the behaviour remains the same
>> if they are not implemented. If they are, then the code loops
>> through all the connector's encodersXcrtcs and calls the
>> callback.
>>
>> If at least a valid encoderXcrtc combination is found which
>> accepts the mode then the function returns MODE_OK.
>>
>> Signed-off-by: Jose Abreu 
>> Cc: Carlos Palminha 
>> Cc: Alexey Brodkin 
>> Cc: Ville Syrjälä 
>> Cc: Daniel Vetter 
>> Cc: Dave Airlie 
>> Cc: Andrzej Hajda 
>> Cc: Archit Taneja 
>> ---
>>
>> Changes v1->v2:
>>  - Use new helpers suggested by Ville
>>  - Change documentation (Daniel)
>>
>>  drivers/gpu/drm/drm_probe_helper.c | 60 +--
>>  1 file changed, 57 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_probe_helper.c
>> b/drivers/gpu/drm/drm_probe_helper.c index 1b0c14a..de47413 100644
>> --- a/drivers/gpu/drm/drm_probe_helper.c
>> +++ b/drivers/gpu/drm/drm_probe_helper.c
>> @@ -39,6 +39,8 @@
>>  #include 
>>  #include 
>>
>> +#include "drm_crtc_internal.h"
>> +
>>  /**
>>   * DOC: output probing helper overview
>>   *
>> @@ -80,6 +82,54 @@
>>  return MODE_OK;
>>  }
>>
>> +static enum drm_mode_status
>> +drm_mode_validate_connector(struct drm_connector *connector,
>> +struct drm_display_mode *mode)
> This does more than validating the mode against the connector, it validates 
> it 
> against the whole pipeline. I would call the function 
> drm_mode_validate_pipeline() (or any other similar name).

Yeah, in previous version I had something similar but I changed
in order to address review comments. I can change again though...

>
>> +{
>> +struct drm_device *dev = connector->dev;
>> +uint32_t *ids = connector->encoder_ids;
>> +enum drm_mode_status ret = MODE_OK;
>> +unsigned int i;
>> +
>> +/* Step 1: Validate against connector */
>> +ret = drm_connector_mode_valid(connector, mode);
>> +if (ret != MODE_OK)
>> +return ret;
>> +
>> +/* Step 2: Validate against encoders and crtcs */
>> +for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
>> +struct drm_encoder *encoder = drm_encoder_find(dev, ids[i]);
>> +struct drm_crtc *crtc;
>> +
>> +if (!encoder)
>> +continue;
>> +
>> +ret = drm_encoder_mode_valid(encoder, mode);
>> +if (ret != MODE_OK) {
>> +/* No point in continuing for crtc check as this 
> encoder
>> + * will not accept the mode anyway. If all encoders
>> + * reject the mode then, at exit, ret will not be
>> + * MODE_OK. */
>> +continue;
>> +}
>> +
>> +drm_for_each_crtc(crtc, dev) {
>> +if (!drm_encoder_crtc_ok(encoder, crtc))
>> +continue;
>> +
>> +ret = drm_crtc_mode_valid(crtc, mode);
>> +if (ret == MODE_OK) {
>> +/* If we get to this point there is at least
>> + * one combination of encoder+crtc that works
>> + * for this mode. Lets return now. */
>> +return ret;
>> +}
>> +}
>> +}
>> +
>> +return ret;
>> +}
>> +
>>  static int drm_helper_probe_add_cmdline_mode(struct drm_connector
>> *connector)
>>  {
>>  struct drm_cmdline_mode *cmdline_mode;
>> @@ -284,7 +334,11 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
>>   *- drm_mode_validate_flag() checks the modes against basic connector
>>   *  capabilities (interlace_allowed,doublescan_allowed,stereo_allowed)
>>   *- the optional _connector_helper_funcs.mode_valid helper can
>> perform
>> - *  driver and/or hardware specific checks
>> + *  driver and/or sink specific checks
>> + *- the optional _crtc_helper_funcs.mode_valid and
>> + *  _encoder_helper_funcs.mode_valid helpers can perform driver
>> and/or
>> + *  source specific checks which are also enforced by the
>> modeset/atomic
>> + *  helpers
>>   *
>>   * 5. Any mode whose status is not OK is pruned from the connector's modes
>> list,
>>   *accompanied by a debug message indicating the reason for the mode's
>> @@ -428,8 +482,8 @@ int
>> drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>>  if (mode->status == 

[PATCH v2] drm/vc4: Fix resource leak in 'vc4_get_hang_state_ioctl()' in error handling path

2017-05-12 Thread Christophe JAILLET
If one 'drm_gem_handle_create()' fails, we leak somes handles and some
memory.

In order to fix it:
  - move the 'free(bo_state)' at the end of the function so that it is also
called in the eror handling path. This has the side effect to also try 
to free it if the first 'kcalloc' fails. This is harmless.
  - add a new label, err_delete_handle, in order to delete already
allocated handles in error handling path
  - remove the now useless 'err' label

The way the code is now written will also delete the handles if the
'copy_to_user()' call fails.

Signed-off-by: Christophe JAILLET 
---
v2: reorder code and add a 'err_delete_handle' label in order to free
resources in the correct order and avoid NULL pointer dereference
---
 drivers/gpu/drm/vc4/vc4_gem.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index e9c381c42139..891c7a22cf81 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -111,8 +111,8 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
);
 
if (ret) {
-   state->bo_count = i - 1;
-   goto err;
+   state->bo_count = i;
+   goto err_delete_handle;
}
bo_state[i].handle = handle;
bo_state[i].paddr = vc4_bo->base.paddr;
@@ -124,13 +124,16 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void 
*data,
 state->bo_count * sizeof(*bo_state)))
ret = -EFAULT;
 
-   kfree(bo_state);
+err_delete_handle:
+   if (ret) {
+   for (i = 0; i < state->bo_count; i++)
+   drm_gem_handle_delete(file_priv, bo_state[i].handle);
+   }
 
 err_free:
-
vc4_free_hang_state(dev, kernel_state);
+   kfree(bo_state);
 
-err:
return ret;
 }
 
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/3] drm/tegra: Check size of a submitted command buffer

2017-05-12 Thread Dmitry Osipenko
If command buffer claims a number of words that is higher than its BO can
fit and a relocation lays past the BO, a kernel OOPS will be fired on that
relocation address patching. This was triggered by an opentegra Xorg driver
that erroneously pushed too many commands to the pushbuf.

[   46.829393] Unable to handle kernel paging request at virtual address 
f09b2000
...
[] (host1x_job_pin) from [] (tegra_drm_submit+0x474/0x510)
[] (tegra_drm_submit) from [] (tegra_submit+0x50/0x6c)
[] (tegra_submit) from [] (drm_ioctl+0x1e4/0x3ec)
[] (drm_ioctl) from [] (do_vfs_ioctl+0x9c/0x8e4)
[] (do_vfs_ioctl) from [] (SyS_ioctl+0x34/0x5c)
[] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x3c)

Signed-off-by: Dmitry Osipenko 
---
 drivers/gpu/drm/tegra/drm.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 732c8d98044f..e9c74a7780e7 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -361,20 +361,30 @@ int tegra_drm_submit(struct tegra_drm_context *context,
 
while (num_cmdbufs) {
struct drm_tegra_cmdbuf cmdbuf;
-   struct host1x_bo *bo;
+   struct drm_gem_object *gem;
+   struct tegra_bo *bo;
 
if (copy_from_user(, cmdbufs, sizeof(cmdbuf))) {
err = -EFAULT;
goto fail;
}
 
-   bo = host1x_bo_lookup(file, cmdbuf.handle);
-   if (!bo) {
+   gem = drm_gem_object_lookup(file, cmdbuf.handle);
+   if (!gem) {
err = -ENOENT;
goto fail;
}
 
-   host1x_job_add_gather(job, bo, cmdbuf.words, cmdbuf.offset);
+   drm_gem_object_unreference_unlocked(gem);
+
+   if (cmdbuf.words * 4 > gem->size) {
+   err = -EINVAL;
+   goto fail;
+   }
+
+   bo = to_tegra_bo(gem);
+   host1x_job_add_gather(job, >base,
+ cmdbuf.words, cmdbuf.offset);
num_cmdbufs--;
cmdbufs++;
}
-- 
2.12.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 2/3] dt-bindings: display: Add STM32 DSI host driver

2017-05-12 Thread Philippe CORNU
This patch adds documentation of device tree bindings for the STM32
DSI host driver based on the Synopsys DW MIPI DSI driver from Rockchip.

Signed-off-by: Philippe CORNU 
---
 .../devicetree/bindings/display/st,stm32-ltdc.txt  | 92 +-
 1 file changed, 90 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt 
b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt
index 8e14769..a61381b 100644
--- a/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt
+++ b/Documentation/devicetree/bindings/display/st,stm32-ltdc.txt
@@ -1,7 +1,6 @@
 * STMicroelectronics STM32 lcd-tft display controller
 
 - ltdc: lcd-tft display controller host
-  must be a sub-node of st-display-subsystem
   Required properties:
   - compatible: "st,stm32-ltdc"
   - reg: Physical base address of the IP registers and length of memory mapped 
region.
@@ -13,8 +12,25 @@
   Required nodes:
 - Video port for RGB output.
 
-Example:
+* STMicroelectronics STM32 specific extensions to Synopsys Designware MIPI DSI
+(similar to "rockchip/dw_mipi_dsi_rockchip.txt")
 
+Required properties:
+- #address-cells: Should be <1>.
+- #size-cells: Should be <0>.
+- compatible: "st,stm32-dsi_host".
+- reg: Represent the physical address range of the controller.
+- clocks, clock-names: Phandles to the controller's pll reference
+  clock(ref) and APB clock(pclk). As described in [1].
+- ports: contain a port node with endpoint definitions as defined in [2].
+- resets: list of phandle + reset specifier pairs, as described in [3].
+- reset-names: string reset name, must be "apb".
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+[2] Documentation/devicetree/bindings/media/video-interfaces.txt
+[3] Documentation/devicetree/bindings/reset/reset.txt
+
+Example 1: RGB panel
 / {
...
soc {
@@ -34,3 +50,75 @@ Example:
};
};
 };
+
+Example 2: DSI panel
+
+/ {
+   ...
+   soc {
+   ...
+   ltdc: display-controller@40016800 {
+   compatible = "st,stm32-ltdc";
+   reg = <0x40016800 0x200>;
+   interrupts = <88>, <89>;
+   resets = < STM32F4_APB2_RESET(LTDC)>;
+   clocks = < 1 CLK_LCD>;
+   clock-names = "lcd";
+
+   port {
+   ltdc_out_dsi_host: endpoint {
+   remote-endpoint = <_host_in>;
+   };
+   };
+   };
+
+
+   dsi_host: dsi_host@40016C00 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "st,stm32-dsi_host";
+   reg = <0x40016C00 0x800>;
+   clocks = < 1 CLK_F469_DSI>, <_hse>;
+   clock-names = "ref", "pclk";
+   resets = < STM32F4_APB2_RESET(DSI)>;
+   reset-names = "apb";
+   status = "okay";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   dsi_host_in: endpoint {
+   remote-endpoint = 
<_out_dsi_host>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   dsi_host_out_panel: endpoint {
+   remote-endpoint = 
<_host_in_panel>;
+   };
+   };
+
+   };
+
+   panel-dsi@0 {
+   reg = <0>; /* dsi virtual channel (0..3) */
+   compatible = ...;
+   enable-gpios = ...;
+   status = "okay";
+
+   port {
+   dsi_host_in_panel: endpoint {
+   remote-endpoint = 
<_host_out_panel>;
+   };
+   };
+
+   };
+
+   };
+
+   };
+};
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/3] drm/tegra: Correct idr_alloc() minimum id

2017-05-12 Thread Dmitry Osipenko
The start = 0 is invalid and causes weird CDMA channel timeouts, presumably
some memory misuse/corruption is going on.

Fixes: bdd2f9cd10eb ("drm/tegra: Don't leak kernel pointer to userspace")
Signed-off-by: Dmitry Osipenko 
---
 drivers/gpu/drm/tegra/drm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 768750226452..732c8d98044f 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -518,7 +518,7 @@ static int tegra_client_open(struct tegra_drm_file *fpriv,
if (err < 0)
return err;
 
-   err = idr_alloc(>contexts, context, 0, 0, GFP_KERNEL);
+   err = idr_alloc(>contexts, context, 1, 0, GFP_KERNEL);
if (err < 0) {
client->ops->close_channel(context);
return err;
-- 
2.12.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/3] drm/tegra: Fix lockup on a use of staging API

2017-05-12 Thread Dmitry Osipenko
Commit bdd2f9cd ("Don't leak kernel pointer to userspace") added a mutex
around staging IOCTL's, some of those mutexes are taken twice.

Fixes: bdd2f9cd10eb ("drm/tegra: Don't leak kernel pointer to userspace")
Signed-off-by: Dmitry Osipenko 
---
 drivers/gpu/drm/tegra/drm.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index ab2dfd4e4bd9..768750226452 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -430,18 +430,6 @@ int tegra_drm_submit(struct tegra_drm_context *context,
 
 
 #ifdef CONFIG_DRM_TEGRA_STAGING
-static struct tegra_drm_context *
-tegra_drm_file_get_context(struct tegra_drm_file *file, u32 id)
-{
-   struct tegra_drm_context *context;
-
-   mutex_lock(>lock);
-   context = idr_find(>contexts, id);
-   mutex_unlock(>lock);
-
-   return context;
-}
-
 static int tegra_gem_create(struct drm_device *drm, void *data,
struct drm_file *file)
 {
@@ -585,7 +573,7 @@ static int tegra_close_channel(struct drm_device *drm, void 
*data,
 
mutex_lock(>lock);
 
-   context = tegra_drm_file_get_context(fpriv, args->context);
+   context = idr_find(>contexts, args->context);
if (!context) {
err = -EINVAL;
goto unlock;
@@ -610,7 +598,7 @@ static int tegra_get_syncpt(struct drm_device *drm, void 
*data,
 
mutex_lock(>lock);
 
-   context = tegra_drm_file_get_context(fpriv, args->context);
+   context = idr_find(>contexts, args->context);
if (!context) {
err = -ENODEV;
goto unlock;
@@ -639,7 +627,7 @@ static int tegra_submit(struct drm_device *drm, void *data,
 
mutex_lock(>lock);
 
-   context = tegra_drm_file_get_context(fpriv, args->context);
+   context = idr_find(>contexts, args->context);
if (!context) {
err = -ENODEV;
goto unlock;
@@ -664,7 +652,7 @@ static int tegra_get_syncpt_base(struct drm_device *drm, 
void *data,
 
mutex_lock(>lock);
 
-   context = tegra_drm_file_get_context(fpriv, args->context);
+   context = idr_find(>contexts, args->context);
if (!context) {
err = -ENODEV;
goto unlock;
-- 
2.12.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/3] drm/tegra: Check size of a submitted command buffer

2017-05-12 Thread Dmitry Osipenko
On 12.05.2017 22:06, Erik Faye-Lund wrote:
> On Fri, May 12, 2017 at 9:02 PM, Dmitry Osipenko  wrote:
>> +   if (cmdbuf.words * 4 > gem->size) {
> 
> Shouldn't this be "cmdbuf.offset + cmdbuf.words * 4 > gem->size"?
> 

Seems yes, good catch. Thank you :)

-- 
Dmitry
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm/tegra: Check size of a submitted command buffer

2017-05-12 Thread Dmitry Osipenko
If command buffer claims a number of words that is higher than its BO can
fit and a relocation lays past the BO, a kernel OOPS will be fired on that
relocation address patching. This was triggered by an opentegra Xorg driver
that erroneously pushed too many commands to the pushbuf.

[   46.829393] Unable to handle kernel paging request at virtual address 
f09b2000
...
[] (host1x_job_pin) from [] (tegra_drm_submit+0x474/0x510)
[] (tegra_drm_submit) from [] (tegra_submit+0x50/0x6c)
[] (tegra_submit) from [] (drm_ioctl+0x1e4/0x3ec)
[] (drm_ioctl) from [] (do_vfs_ioctl+0x9c/0x8e4)
[] (do_vfs_ioctl) from [] (SyS_ioctl+0x34/0x5c)
[] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x3c)

Signed-off-by: Dmitry Osipenko 
---

v2: Take into account the cmdbuf.offset

 drivers/gpu/drm/tegra/drm.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 732c8d98044f..9ad4ac7c08d1 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -361,20 +361,30 @@ int tegra_drm_submit(struct tegra_drm_context *context,
 
while (num_cmdbufs) {
struct drm_tegra_cmdbuf cmdbuf;
-   struct host1x_bo *bo;
+   struct drm_gem_object *gem;
+   struct tegra_bo *bo;
 
if (copy_from_user(, cmdbufs, sizeof(cmdbuf))) {
err = -EFAULT;
goto fail;
}
 
-   bo = host1x_bo_lookup(file, cmdbuf.handle);
-   if (!bo) {
+   gem = drm_gem_object_lookup(file, cmdbuf.handle);
+   if (!gem) {
err = -ENOENT;
goto fail;
}
 
-   host1x_job_add_gather(job, bo, cmdbuf.words, cmdbuf.offset);
+   drm_gem_object_unreference_unlocked(gem);
+
+   if (cmdbuf.offset + cmdbuf.words * 4 > gem->size) {
+   err = -EINVAL;
+   goto fail;
+   }
+
+   bo = to_tegra_bo(gem);
+   host1x_job_add_gather(job, >base,
+ cmdbuf.words, cmdbuf.offset);
num_cmdbufs--;
cmdbufs++;
}
-- 
2.12.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] GPU hang with kernel 4.10rc3

2017-05-12 Thread Juergen Gross
On 11/05/17 23:08, Pavel Machek wrote:
> On Mon 2017-01-23 10:39:27, Juergen Gross wrote:
>> On 13/01/17 15:41, Juergen Gross wrote:
>>> On 12/01/17 10:21, Chris Wilson wrote:
 On Thu, Jan 12, 2017 at 07:03:25AM +0100, Juergen Gross wrote:
> On 11/01/17 18:08, Chris Wilson wrote:
>> On Wed, Jan 11, 2017 at 05:33:34PM +0100, Juergen Gross wrote:
>>> With kernel 4.10rc3 running as Xen dm0 I get at each boot:
>>>
>>> [   49.213697] [drm] GPU HANG: ecode 7:0:0x3d1d3d3d, in gnome-shell
>>> [1431], reason: Hang on render ring, action: reset
>>> [   49.213699] [drm] GPU hangs can indicate a bug anywhere in the entire
>>> gfx stack, including userspace.
>>> [   49.213700] [drm] Please file a _new_ bug report on
>>> bugs.freedesktop.org against DRI -> DRM/Intel
>>> [   49.213700] [drm] drm/i915 developers can then reassign to the right
>>> component if it's not a kernel issue.
>>> [   49.213700] [drm] The gpu crash dump is required to analyze gpu
>>> hangs, so please always attach it.
>>> [   49.213701] [drm] GPU crash dump saved to /sys/class/drm/card0/error
>>> [   49.213755] drm/i915: Resetting chip after gpu hang
>>> [   60.213769] drm/i915: Resetting chip after gpu hang
>>> [   71.189737] drm/i915: Resetting chip after gpu hang
>>> [   82.165747] drm/i915: Resetting chip after gpu hang
>>> [   93.205727] drm/i915: Resetting chip after gpu hang
>>>
>>> The dump is attached.
>>
>> That's a nasty one. The first couple of pages of the batchbuffer appear
>> to be overwritten. (Full of 0xc2c2c2c2, i.e. probably pixel data.) That
>> may be a concurrent write by either the GPU or CPU, or we may have
>> incorrected mapped a set of pages. That it doesn't recovered suggests
>> that the corruption occurs frequently, probably on every request/batch.
>
> I hoped someone would have an idea already.

 Sorry, first report of something like this in a long time (that I can
 remember at least). And the problem is that it can be anything from a
 coherency to a concurrency issue, so no one patch springs to mind.
 Thankfully it appears to be kernel related.
 -Chris

>>>
>>> Bisecting took longer than I thought, but I had to cherry pick some
>>> patches and rebase one of them multiple times...
>>>
>>> Finally I found the commit to blame: 920cf4194954ec ("drm/i915:
>>> Introduce an internal allocator for disposable private objects")
>>>
>>> In case you need me to produce some more data or test a patch
>>> feel free to reach out.
>>
>> Anything new for this severe regression?
>>
>> Without a fix 4.10 will be unusable with Xen on a machine with i915
>> graphics!
> 
> Did this get solved?

Yes. Commit 7152187159193056f30ad5726741bb25028672bf.


Juergen

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 3/3] drm/stm: Add STM32 DSI host driver

2017-05-12 Thread Philippe CORNU
This mipi dsi host driver is based on the Rockchip version of the
Synopsys Designware mipi dsi driver (rockchip/dw-mipi-dsi.c)
modified for the stm32 family:
- replace Rockchip digital & phy specific extensions with stm32's ones.
- add a bridge

Signed-off-by: Philippe CORNU 
---
 drivers/gpu/drm/stm/Kconfig   |7 +
 drivers/gpu/drm/stm/Makefile  |2 +
 drivers/gpu/drm/stm/dw-mipi-dsi.c | 1197 +
 3 files changed, 1206 insertions(+)
 create mode 100644 drivers/gpu/drm/stm/dw-mipi-dsi.c

diff --git a/drivers/gpu/drm/stm/Kconfig b/drivers/gpu/drm/stm/Kconfig
index 2c4817f..0007789 100644
--- a/drivers/gpu/drm/stm/Kconfig
+++ b/drivers/gpu/drm/stm/Kconfig
@@ -14,3 +14,10 @@ config DRM_STM
  STMicroelectronics STM32 MCUs.
  To compile this driver as a module, choose M here: the module
  will be called stm-drm.
+
+config DRM_STM_DSI
+   tristate "MIPI DSI support for STMicroelectronics SoC"
+   depends on DRM_STM
+   select DRM_MIPI_DSI
+   help
+ Choose this option for MIPI DSI support on STMicroelectronics SoC.
diff --git a/drivers/gpu/drm/stm/Makefile b/drivers/gpu/drm/stm/Makefile
index e114d45..e448a93 100644
--- a/drivers/gpu/drm/stm/Makefile
+++ b/drivers/gpu/drm/stm/Makefile
@@ -4,4 +4,6 @@ stm-drm-y := \
drv.o \
ltdc.o
 
+obj-$(CONFIG_DRM_STM_DSI) += dw-mipi-dsi.o
+
 obj-$(CONFIG_DRM_STM) += stm-drm.o
diff --git a/drivers/gpu/drm/stm/dw-mipi-dsi.c 
b/drivers/gpu/drm/stm/dw-mipi-dsi.c
new file mode 100644
index 000..4b7f7b9
--- /dev/null
+++ b/drivers/gpu/drm/stm/dw-mipi-dsi.c
@@ -0,0 +1,1197 @@
+/*
+ * Copyright (c) 2016, Fuzhou Rockchip 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.
+ *
+ * Modified by Philippe Cornu  for the stm32 family.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME"dw-mipi-dsi"
+
+#define DSI_VERSION0x00
+#define DSI_PWR_UP 0x04
+#define RESET  0
+#define POWERUPBIT(0)
+
+#define DSI_CLKMGR_CFG 0x08
+#define TO_CLK_DIVIDSION(div)  (((div) & 0xff) << 8)
+#define TX_ESC_CLK_DIVIDSION(div)  (((div) & 0xff) << 0)
+
+#define DSI_DPI_VCID   0x0c
+#define DPI_VID(vid)   (((vid) & 0x3) << 0)
+
+#define DSI_DPI_COLOR_CODING   0x10
+#define EN18_LOOSELY   BIT(8)
+#define DPI_COLOR_CODING_16BIT_1   0x0
+#define DPI_COLOR_CODING_16BIT_2   0x1
+#define DPI_COLOR_CODING_16BIT_3   0x2
+#define DPI_COLOR_CODING_18BIT_1   0x3
+#define DPI_COLOR_CODING_18BIT_2   0x4
+#define DPI_COLOR_CODING_24BIT 0x5
+
+#define DSI_DPI_CFG_POL0x14
+#define COLORM_ACTIVE_LOW  BIT(4)
+#define SHUTD_ACTIVE_LOW   BIT(3)
+#define HSYNC_ACTIVE_LOW   BIT(2)
+#define VSYNC_ACTIVE_LOW   BIT(1)
+#define DATAEN_ACTIVE_LOW  BIT(0)
+
+#define DSI_DPI_LP_CMD_TIM 0x18
+#define OUTVACT_LPCMD_TIME(p)  (((p) & 0xff) << 16)
+#define INVACT_LPCMD_TIME(p)   ((p) & 0xff)
+
+#define DSI_DBI_CFG0x20
+#define DSI_DBI_CMDSIZE0x28
+
+#define DSI_PCKHDL_CFG 0x2c
+#define EN_CRC_RX  BIT(4)
+#define EN_ECC_RX  BIT(3)
+#define EN_BTA BIT(2)
+#define EN_EOTP_RX BIT(1)
+#define EN_EOTP_TX BIT(0)
+
+#define DSI_MODE_CFG   0x34
+#define ENABLE_VIDEO_MODE  0
+#define ENABLE_CMD_MODEBIT(0)
+
+#define DSI_VID_MODE_CFG   0x38
+#define FRAME_BTA_ACK  BIT(14)
+#define ENABLE_LOW_POWER   (0x3f << 8)
+#define ENABLE_LOW_POWER_MASK  (0x3f << 8)
+#define VID_MODE_TYPE_NON_BURST_SYNC_PULSES0x0
+#define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS0x1
+#define VID_MODE_TYPE_BURST0x2
+#define VID_MODE_TYPE_MASK 0x3
+
+#define DSI_VID_PKT_SIZE   0x3c
+#define VID_PKT_SIZE(p)(((p) & 0x3fff) << 0)
+#define VID_PKT_MAX_SIZE   0x3fff
+
+#define DSI_VID_HSA_TIME   0x48
+#define DSI_VID_HBP_TIME   0x4c
+#define DSI_VID_HLINE_TIME 0x50
+#define DSI_VID_VSA_LINES  0x54
+#define DSI_VID_VBP_LINES  0x58
+#define DSI_VID_VFP_LINES  0x5c
+#define DSI_VID_VACTIVE_LINES  

[PATCH v1 0/3] STM32 DSI HOST

2017-05-12 Thread Philippe CORNU
The purpose of this set of patches is to add the mipi dsi host driver
to the stm32 family.

This mipi dsi host driver is based on the Rockchip version of the
Synopsys Designware mipi dsi driver (rockchip/dw-mipi-dsi.c)
modified for the stm32 family:
- replace Rockchip digital & phy specific extensions with stm32's ones.
- add a bridge

Philippe CORNU (3):
  drm/stm: ltdc: Add bridge support
  dt-bindings: display: Add STM32 DSI host driver
  drm/stm: Add STM32 DSI host driver

 .../devicetree/bindings/display/st,stm32-ltdc.txt  |   92 +-
 drivers/gpu/drm/stm/Kconfig|7 +
 drivers/gpu/drm/stm/Makefile   |2 +
 drivers/gpu/drm/stm/dw-mipi-dsi.c  | 1197 
 drivers/gpu/drm/stm/ltdc.c |   82 +-
 drivers/gpu/drm/stm/ltdc.h |1 +
 6 files changed, 1368 insertions(+), 13 deletions(-)
 create mode 100644 drivers/gpu/drm/stm/dw-mipi-dsi.c

-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v7 3/9] drm/i915: Drop AUX backlight enable check for backlight control

2017-05-12 Thread Pandiyan, Dhinakaran
On Thu, 2017-05-11 at 16:02 -0700, Puthikorn Voravootivat wrote:
> There are some panel that
> (1) does not support display backlight enable via AUX
> (2) support display backlight adjustment via AUX
> (3) support display backlight enable via eDP BL_ENABLE pin
> 
> The current driver required that (1) must be support to enable (2).
> This patch drops that requirement.
> 

You sent this version before I finished my follow-up questions, copying
the conversation here for context. 


DK: Won't DP_EDP_BACKLIGHT_AUX_ENABLE_CAP be 1 always? The code below,
in
intel_dp_aux_display_control_capable(), makes sure
DP_EDP_BACKLIGHT_PIN_ENABLE_CAP=0. The spec says at least one of these
has to be 1.

Puthikorn: We will drop the  DP_EDP_BACKLIGHT_PIN_ENABLE_CAP != 0 check
in next patch set.
This patch adds check here to prepare for that.


1) So, this patch does not really fix what the commit message claims
because it is dependent on the following patch. Does it make sense to
remove this check in this patch? That way, this patch by itself is the
fix that the commit message says.

-   !((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP) 


2) If a panel supports backlight enable via AUX and BL_ENABLE pin, this
patch (along with the next) enables backlight twice, doesn't it?
_intel_edp_backlight_on(intel_dp) in intel_dp.c is called
unconditionally after intel_dp_aux_enable_backlight(). I don't know how
likely this configuration is or if it's alright to enable via both AUX
and BL_ENABLE pin.




> Signed-off-by: Puthikorn Voravootivat 
> ---
>  drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c 
> b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> index 870c03fc0f3a..c22712762957 100644
> --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> @@ -28,6 +28,10 @@ static void set_aux_backlight_enable(struct intel_dp 
> *intel_dp, bool enable)
>  {
>   uint8_t reg_val = 0;
>  
> +   /* Early return when display use other mechanism to enable backlight. 
> */
> + if (!(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP))
> + return;
> +
>   if (drm_dp_dpcd_readb(_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER,
> _val) < 0) {
>   DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n",
> @@ -164,7 +168,6 @@ intel_dp_aux_display_control_capable(struct 
> intel_connector *connector)
>* the panel can support backlight control over the aux channel
>*/
>   if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP &&
> - (intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) &&
>   (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP) &&
>   !((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP) ||
> (intel_dp->edp_dpcd[2] & 
> DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP))) {

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v7 3/9] drm/i915: Drop AUX backlight enable check for backlight control

2017-05-12 Thread Puthikorn Voravootivat
On Fri, May 12, 2017 at 6:14 AM, Jani Nikula 
wrote:

> On Fri, 12 May 2017, "Pandiyan, Dhinakaran" 
> wrote:
> > On Thu, 2017-05-11 at 16:02 -0700, Puthikorn Voravootivat wrote:
> >> There are some panel that
> >> (1) does not support display backlight enable via AUX
> >> (2) support display backlight adjustment via AUX
> >> (3) support display backlight enable via eDP BL_ENABLE pin
> >>
> >> The current driver required that (1) must be support to enable (2).
> >> This patch drops that requirement.
> >>
> >
> > You sent this version before I finished my follow-up questions, copying
> > the conversation here for context.
>
> Puthikorn, please don't send new versions before the review is
> addressed.
>
Sorry I thought I was explained it clear enough.

>
> Pushed patches 1, 2, 5, and 7. Thanks for the patches and review.
>
> BR,
> Jani.
>
> > DK: Won't DP_EDP_BACKLIGHT_AUX_ENABLE_CAP be 1 always? The code below,
> > in
> > intel_dp_aux_display_control_capable(), makes sure
> > DP_EDP_BACKLIGHT_PIN_ENABLE_CAP=0. The spec says at least one of these
> > has to be 1.
> >
> > Puthikorn: We will drop the  DP_EDP_BACKLIGHT_PIN_ENABLE_CAP != 0 check
> > in next patch set.
> > This patch adds check here to prepare for that.
> >
> >
> > 1) So, this patch does not really fix what the commit message claims
> > because it is dependent on the following patch. Does it make sense to
> > remove this check in this patch? That way, this patch by itself is the
> > fix that the commit message says.
> >
> > -   !((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP)
> >
>
Sure. I can remove this here and adds it in next patch instead.

>
> > 2) If a panel supports backlight enable via AUX and BL_ENABLE pin, this
> > patch (along with the next) enables backlight twice, doesn't it?
> > _intel_edp_backlight_on(intel_dp) in intel_dp.c is called
> > unconditionally after intel_dp_aux_enable_backlight(). I don't know how
> > likely this configuration is or if it's alright to enable via both AUX
> > and BL_ENABLE pin.
> >
>
The eDP spec did not mention this case explicitly.
But it should not hurt to enable backlight twice as we want the backlight
to be enabled anyway.


> >
> >
> >
> >> Signed-off-by: Puthikorn Voravootivat 
> >> ---
> >>  drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 5 -
> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> >> index 870c03fc0f3a..c22712762957 100644
> >> --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> >> +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
> >> @@ -28,6 +28,10 @@ static void set_aux_backlight_enable(struct
> intel_dp *intel_dp, bool enable)
> >>  {
> >>  uint8_t reg_val = 0;
> >>
> >> +   /* Early return when display use other mechanism to enable
> backlight. */
> >> +if (!(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP))
> >> +return;
> >> +
> >>  if (drm_dp_dpcd_readb(_dp->aux, DP_EDP_DISPLAY_CONTROL_
> REGISTER,
> >>_val) < 0) {
> >>  DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n",
> >> @@ -164,7 +168,6 @@ intel_dp_aux_display_control_capable(struct
> intel_connector *connector)
> >>   * the panel can support backlight control over the aux channel
> >>   */
> >>  if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP
> &&
> >> -(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) &&
> >>  (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP)
> &&
> >>  !((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP) ||
> >>(intel_dp->edp_dpcd[2] & 
> >> DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP)))
> {
> >
>
> --
> Jani Nikula, Intel Open Source Technology Center
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [linux-sunxi] [PATCH v2 18/20] drm/sun4i: Add HDMI support

2017-05-12 Thread Chen-Yu Tsai
On Thu, May 4, 2017 at 3:55 PM, Chen-Yu Tsai  wrote:
> On Wed, May 3, 2017 at 7:59 PM, Maxime Ripard
>  wrote:
>> The earlier Allwinner SoCs (A10, A10s, A20, A31) have an embedded HDMI
>> controller.
>>
>> That HDMI controller is able to do audio and CEC, but those have been left
>> out for now.
>>
>> Signed-off-by: Maxime Ripard 
>> ---
>>  drivers/gpu/drm/sun4i/Kconfig   |   9 +-
>>  drivers/gpu/drm/sun4i/Makefile  |   6 +-
>>  drivers/gpu/drm/sun4i/sun4i_hdmi.h  | 157 +++-
>>  drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c  | 127 +-
>>  drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c  | 493 +-
>>  drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 225 ++-
>>  6 files changed, 1017 insertions(+), 0 deletions(-)
>>  create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi.h
>>  create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c
>>  create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
>>  create mode 100644 drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c
>>
>> diff --git a/drivers/gpu/drm/sun4i/Kconfig b/drivers/gpu/drm/sun4i/Kconfig
>> index a4b357db8856..35299c4e2594 100644
>> --- a/drivers/gpu/drm/sun4i/Kconfig
>> +++ b/drivers/gpu/drm/sun4i/Kconfig
>> @@ -12,3 +12,12 @@ config DRM_SUN4I
>>   Choose this option if you have an Allwinner SoC with a
>>   Display Engine. If M is selected the module will be called
>>   sun4i-drm.
>> +
>> +if DRM_SUN4I
>> +config DRM_SUN4I_HDMI
>> +   tristate "Allwinner A10 HDMI Controller Support"
>> +   help
>> + Choose this option if you have an Allwinner SoC with an HDMI
>> + controller.
>> +
>> +endif
>> diff --git a/drivers/gpu/drm/sun4i/Makefile b/drivers/gpu/drm/sun4i/Makefile
>> index 59b757350a1f..c09bf8093710 100644
>> --- a/drivers/gpu/drm/sun4i/Makefile
>> +++ b/drivers/gpu/drm/sun4i/Makefile
>> @@ -11,3 +11,9 @@ obj-$(CONFIG_DRM_SUN4I)   += sun4i-drm.o 
>> sun4i-tcon.o
>>  obj-$(CONFIG_DRM_SUN4I)+= sun4i_backend.o
>>  obj-$(CONFIG_DRM_SUN4I)+= sun6i_drc.o
>>  obj-$(CONFIG_DRM_SUN4I)+= sun4i_tv.o
>> +
>> +sun4i-drm-hdmi-y += sun4i_hdmi_enc.o
>> +sun4i-drm-hdmi-y += sun4i_hdmi_ddc_clk.o
>> +sun4i-drm-hdmi-y += sun4i_hdmi_tmds_clk.o
>> +
>> +obj-$(CONFIG_DRM_SUN4I_HDMI)   += sun4i-drm-hdmi.o
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h 
>> b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
>> new file mode 100644
>> index ..40d57b195b48
>> --- /dev/null
>> +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h
>> @@ -0,0 +1,157 @@
>> +/*
>> + * Copyright (C) 2016 Maxime Ripard
>> + *
>> + * Maxime Ripard 
>> + *
>> + * 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.
>> + */
>> +
>> +#ifndef _SUN4I_HDMI_H_
>> +#define _SUN4I_HDMI_H_
>> +
>> +#include 
>> +#include 
>> +
>> +#define SUN4I_HDMI_CTRL_REG0x004
>> +#define SUN4I_HDMI_CTRL_ENABLE BIT(31)
>> +
>> +#define SUN4I_HDMI_IRQ_REG 0x008
>> +#define SUN4I_HDMI_IRQ_STA_MASK0x73
>> +#define SUN4I_HDMI_IRQ_STA_FIFO_OF BIT(1)
>> +#define SUN4I_HDMI_IRQ_STA_FIFO_UF BIT(0)
>> +
>> +#define SUN4I_HDMI_HPD_REG 0x00c
>> +#define SUN4I_HDMI_HPD_HIGHBIT(0)
>> +
>> +#define SUN4I_HDMI_VID_CTRL_REG0x010
>> +#define SUN4I_HDMI_VID_CTRL_ENABLE BIT(31)
>> +#define SUN4I_HDMI_VID_CTRL_HDMI_MODE  BIT(30)
>> +
>> +#define SUN4I_HDMI_VID_TIMING_ACT_REG  0x014
>> +#define SUN4I_HDMI_VID_TIMING_BP_REG   0x018
>> +#define SUN4I_HDMI_VID_TIMING_FP_REG   0x01c
>> +#define SUN4I_HDMI_VID_TIMING_SPW_REG  0x020
>> +
>> +#define SUN4I_HDMI_VID_TIMING_X(x) x) - 1) & GENMASK(11, 
>> 0)))
>> +#define SUN4I_HDMI_VID_TIMING_Y(y) y) - 1) & GENMASK(11, 
>> 0)) << 16)
>> +
>> +#define SUN4I_HDMI_VID_TIMING_POL_REG  0x024
>> +#define SUN4I_HDMI_VID_TIMING_POL_TX_CLK(0x3e0 << 16)
>> +#define SUN4I_HDMI_VID_TIMING_POL_VSYNCBIT(1)
>> +#define SUN4I_HDMI_VID_TIMING_POL_HSYNCBIT(0)
>> +
>> +#define SUN4I_HDMI_AVI_INFOFRAME_REG(n)(0x080 + (n))
>> +
>> +#define SUN4I_HDMI_PAD_CTRL0_REG   0x200
>> +#define SUN4I_HDMI_PAD_CTRL0_BIASENBIT(31)
>> +#define SUN4I_HDMI_PAD_CTRL0_LDOCENBIT(30)
>> +#define SUN4I_HDMI_PAD_CTRL0_LDODENBIT(29)
>> +#define SUN4I_HDMI_PAD_CTRL0_PWENC BIT(28)
>> +#define SUN4I_HDMI_PAD_CTRL0_PWEND BIT(27)
>> +#define SUN4I_HDMI_PAD_CTRL0_PWENG BIT(26)
>> +#define SUN4I_HDMI_PAD_CTRL0_CKEN  BIT(25)
>> +#define SUN4I_HDMI_PAD_CTRL0_TXEN   

Re: [PATCH] drm: Add crtc/encoder/bridge->mode_valid() callbacks

2017-05-12 Thread Jose Abreu
Hi Daniel,


On 12-05-2017 08:31, Daniel Vetter wrote:
> From: Jose Abreu 
>
> This adds a new callback to crtc, encoder and bridge helper functions
> called mode_valid(). This callback shall be implemented if the
> corresponding component has some sort of restriction in the modes
> that can be displayed. A NULL callback implicates that the component
> can display all the modes.
>
> We also change the documentation so that the new and old callbacks
> are correctly documented.
>
> Only the callbacks were implemented to simplify review process,
> following patches will make use of them.
>
> Changes in v2 from Daniel:
> - Update the warning about how modes aren't filtered in atomic_check -
>   the heleprs help out a lot more now.
> - Consistenly roll out that warning, crtc/encoder's atomic_check
>   missed it.
> - Sprinkle more links all over the place, so it's easier to see where
>   this stuff is used and how the differen hooks are related.
> - Note that ->mode_valid is optional everywhere.
> - Explain why the connector's mode_valid is special and does _not_ get
>   called in atomic_check.
>
> Signed-off-by: Jose Abreu 
> Cc: Jose Abreu 
> Cc: Carlos Palminha 
> Cc: Alexey Brodkin 
> Cc: Ville Syrjälä 
> Cc: Daniel Vetter 
> Cc: Dave Airlie 
> Cc: Andrzej Hajda 
> Cc: Archit Taneja 
> Signed-off-by: Daniel Vetter  (v2)

Thanks! Looks fine by me.

Reviewed-by: Jose Abreu 

Best regards,
Jose Miguel Abreu

> ---
>  include/drm/drm_bridge.h |  31 +
>  include/drm/drm_modeset_helper_vtables.h | 116 
> ++-
>  2 files changed, 114 insertions(+), 33 deletions(-)
>
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index fdd82fcbf168..f694de756ecf 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -59,6 +59,31 @@ struct drm_bridge_funcs {
>   void (*detach)(struct drm_bridge *bridge);
>  
>   /**
> +  * @mode_valid:
> +  *
> +  * This callback is used to check if a specific mode is valid in this
> +  * bridge. This should be implemented if the bridge has some sort of
> +  * restriction in the modes it can display. For example, a given bridge
> +  * may be responsible to set a clock value. If the clock can not
> +  * produce all the values for the available modes then this callback
> +  * can be used to restrict the number of modes to only the ones that
> +  * can be displayed.
> +  *
> +  * This hook is used by the probe helpers to filter the mode list in
> +  * drm_helper_probe_single_connector_modes(), and it is used by the
> +  * atomic helpers to validate modes supplied by userspace in
> +  * drm_atomic_helper_check_modeset().
> +  *
> +  * This function is optional.
> +  *
> +  * RETURNS:
> +  *
> +  * drm_mode_status Enum
> +  */
> + enum drm_mode_status (*mode_valid)(struct drm_bridge *crtc,
> +const struct drm_display_mode *mode);
> +
> + /**
>* @mode_fixup:
>*
>* This callback is used to validate and adjust a mode. The paramater
> @@ -82,6 +107,12 @@ struct drm_bridge_funcs {
>* NOT touch any persistent state (hardware or software) or data
>* structures except the passed in @state parameter.
>*
> +  * Also beware that userspace can request its own custom modes, neither
> +  * core nor helpers filter modes to the list of probe modes reported by
> +  * the GETCONNECTOR IOCTL and stored in _connector.modes. To ensure
> +  * that modes are filtered consistently put any bridge constraints and
> +  * limits checks into @mode_valid.
> +  *
>* RETURNS:
>*
>* True if an acceptable configuration is possible, false if the modeset
> diff --git a/include/drm/drm_modeset_helper_vtables.h 
> b/include/drm/drm_modeset_helper_vtables.h
> index c01c328f6cc8..91d071ff1232 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -106,6 +106,31 @@ struct drm_crtc_helper_funcs {
>   void (*commit)(struct drm_crtc *crtc);
>  
>   /**
> +  * @mode_valid:
> +  *
> +  * This callback is used to check if a specific mode is valid in this
> +  * crtc. This should be implemented if the crtc has some sort of
> +  * restriction in the modes it can display. For example, a given crtc
> +  * may be responsible to set a clock value. If the clock can not
> +  * produce all the values for the available modes then this callback
> +  * can be used to restrict the number of modes to only the ones that
> +  * can be displayed.
> +  *
> +  * 

Re: [git pull] drm fixes for v4.12-rc1

2017-05-12 Thread Dave Airlie
On 13 May 2017 at 04:56, Linus Torvalds  wrote:
> .. and here's the email repeated for the new dri-devel list, since
> apparently Dave sent the pull request to the old no-longer-working one
> that just sends annoying bounces.
>
> Dave, time to update your scripts and address book..

wierd gmail failed me.
>
>   Linus
>
> On Fri, May 12, 2017 at 11:54 AM, Linus Torvalds
>  wrote:
>> On Thu, May 11, 2017 at 11:00 PM, Dave Airlie  wrote:
>>>
>>> It also has an amdgpu fixes pull, with lots of ongoing work on Vega10
>>> which is new in this kernel and is preliminary support so may have a
>>> fair bit of movement.
>>
>> Note: I will *not* be taking these kinds of pull requests after rc1.
>>
>> If Vega10 is in such bad shape that it will need this kind of stuff
>> and isn't worth shipping without them in 4.12, I will take a *oneline*
>> that just disables it.
>>
>> So no "thousands of lines of fixes for a new driver".
>>
>> Being new to 4.12 isn't an excuse for crazy stuff after the merge
>> window. If it will need more of this kind of attention, all it means
>> is that it shouldn't have been sent to me at all in the first place.
>>
>> The drm subsystem is still on my "no more of this shit" list, so I'm
>> going to be very unforgiving of big pull requests when they aren't
>> appropriate.

It's already disabled. It probably won't be enabled in your kernel for 1-2
more releases. You can't even get Vega hardware, I can't even get Vega
hardware at the moment.

For background we've done a lot of work in the graphics community to
get vendors to release code for new hardware early so we can get it all
lined up in the kernel before the hw ships. Some support would be nice.

Vega10 is in bad shape, that's the whole point of merging it early and
turned off, so we don't just dump rebased 100 times code into your tree
on release day and find it doesn't work, instead AMD can develop other
features in their driver for Vega10 and older chips at the same time,
without constant rebasing, and fixup their internal and external driver
ABIs in an upstream kernel tree, instead of dropping a driver based on
Linux 3.10 or something.

In saying that, I did think this pull was probably a bit much, so
Alex, can you please minimise the Vega churn to -next trees unless
changes are needed to fix problems on older GPUs, also I did miss
one pull request from Alex in there somewhere, so that might have
contributed to the overly large pull.

Dave.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 195737] AMDGPU: incorrect monitor position on Xorg

2017-05-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=195737

--- Comment #1 from beta990 (francois5...@gmail.com) ---
A workaround is blacklisting the amdgpu module and use radeon instead, but this
should not be needed on 270X.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 195737] New: AMDGPU: incorrect monitor position on Xorg

2017-05-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=195737

Bug ID: 195737
   Summary: AMDGPU: incorrect monitor position on Xorg
   Product: Drivers
   Version: 2.5
Kernel Version: 4.10.13
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: high
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: francois5...@gmail.com
Regression: No

Starting KDE in Xorg on Linux 4.10.13 results in a wrong position being used by
the monitor (LG 29UM58). When using Wayland instead the position is correctly
calculated.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v3 7/8] drm/vc4: update cursors asynchronously through atomic

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

Add support to async updates of cursors by using the new atomic
interface for that. Basically what this commit does is do what
vc4_update_plane() did but through atomic.

v3: move size checks back to drivers (Ville Syrjälä)

v2: move fb setting to core and use new state (Eric Anholt)

Cc: Eric Anholt 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/vc4/vc4_plane.c | 99 +++--
 1 file changed, 35 insertions(+), 64 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index d34cd53..05e9f5f 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -735,70 +735,38 @@ void vc4_plane_async_set_fb(struct drm_plane *plane, 
struct drm_framebuffer *fb)
vc4_state->dlist[vc4_state->ptr0_offset] = addr;
 }
 
-static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = {
-   .atomic_check = vc4_plane_atomic_check,
-   .atomic_update = vc4_plane_atomic_update,
-};
-
-static void vc4_plane_destroy(struct drm_plane *plane)
-{
-   drm_plane_helper_disable(plane);
-   drm_plane_cleanup(plane);
-}
-
-/* Implements immediate (non-vblank-synced) updates of the cursor
- * position, or falls back to the atomic helper otherwise.
- */
-static int
-vc4_update_plane(struct drm_plane *plane,
-struct drm_crtc *crtc,
-struct drm_framebuffer *fb,
-int crtc_x, int crtc_y,
-unsigned int crtc_w, unsigned int crtc_h,
-uint32_t src_x, uint32_t src_y,
-uint32_t src_w, uint32_t src_h,
-struct drm_modeset_acquire_ctx *ctx)
+static int vc4_plane_atomic_async_check(struct drm_plane *plane,
+   struct drm_plane_state *state)
 {
-   struct drm_plane_state *plane_state;
-   struct vc4_plane_state *vc4_state;
-
-   if (plane != crtc->cursor)
-   goto out;
-
-   plane_state = plane->state;
-   vc4_state = to_vc4_plane_state(plane_state);
+   if (plane != state->crtc->cursor)
+   return -EINVAL;
 
-   if (!plane_state)
-   goto out;
+   if (!plane->state)
+   return -EINVAL;
 
/* No configuring new scaling in the fast path. */
-   if (crtc_w != plane_state->crtc_w ||
-   crtc_h != plane_state->crtc_h ||
-   src_w != plane_state->src_w ||
-   src_h != plane_state->src_h) {
-   goto out;
+   if (state->crtc_w != plane->state->crtc_w ||
+   state->crtc_h != plane->state->crtc_h ||
+   state->src_w != plane->state->src_w ||
+   state->src_h != plane->state->src_h) {
+   return -EINVAL;
}
 
-   if (fb != plane_state->fb) {
-   drm_atomic_set_fb_for_plane(plane->state, fb);
-   vc4_plane_async_set_fb(plane, fb);
-   }
+   return 0;
+}
 
-   /* Set the cursor's position on the screen.  This is the
-* expected change from the drm_mode_cursor_universal()
-* helper.
-*/
-   plane_state->crtc_x = crtc_x;
-   plane_state->crtc_y = crtc_y;
+static void vc4_plane_atomic_async_update(struct drm_plane *plane,
+ struct drm_plane_state *new_state)
+{
+   struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state);
 
-   /* Allow changing the start position within the cursor BO, if
-* that matters.
-*/
-   plane_state->src_x = src_x;
-   plane_state->src_y = src_y;
+   plane->state->src_x = new_state->src_x;
+   plane->state->src_y = new_state->src_y;
+   plane->state->crtc_x = new_state->crtc_x;
+   plane->state->crtc_y = new_state->crtc_y;
 
-   /* Update the display list based on the new crtc_x/y. */
-   vc4_plane_atomic_check(plane, plane_state);
+   if (plane->state->fb != new_state->fb)
+   vc4_plane_async_set_fb(plane, new_state->fb);
 
/* Note that we can't just call vc4_plane_write_dlist()
 * because that would smash the context data that the HVS is
@@ -810,20 +778,23 @@ vc4_update_plane(struct drm_plane *plane,
   _state->hw_dlist[vc4_state->pos2_offset]);
writel(vc4_state->dlist[vc4_state->ptr0_offset],
   _state->hw_dlist[vc4_state->ptr0_offset]);
+}
 
-   return 0;
+static const struct drm_plane_helper_funcs vc4_plane_helper_funcs = {
+   .atomic_check = vc4_plane_atomic_check,
+   .atomic_update = vc4_plane_atomic_update,
+   .atomic_async_check = vc4_plane_atomic_async_check,
+   .atomic_async_update = vc4_plane_atomic_async_update,
+};
 
-out:
-   return drm_atomic_helper_update_plane(plane, crtc, fb,
- crtc_x, crtc_y,
- crtc_w, crtc_h,
-   

[RFC v3 8/8] drm/atomic: add ASYNC_UPDATE flag to the Atomic IOCTL

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

This flag tells core to jump ahead the queued update if the conditions in
drm_atomic_async_check() are met. That means we are only able to do an
async update if no modeset is pending and update for the same plane is not
queued.

It uses the already in place infrastructure for async updates.

It is useful for cursor updates and async PageFlips over the atomic
ioctl, otherwise in some cases updates may be delayed to the point the user
will notice it.

DRM_MODE_ATOMIC_ASYNC_UPDATE should be passed to the Atomic IOCTL to use
this feature.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/drm_atomic.c | 8 +++-
 include/uapi/drm/drm_mode.h  | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 259a758..304dd0a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -77,6 +77,7 @@ drm_atomic_state_init(struct drm_device *dev, struct 
drm_atomic_state *state)
 * setting this appropriately?
 */
state->allow_modeset = true;
+   state->async_update = true;
 
state->crtcs = kcalloc(dev->mode_config.num_crtc,
   sizeof(*state->crtcs), GFP_KERNEL);
@@ -1653,7 +1654,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
 
-   if (state->legacy_cursor_update)
+   if (state->async_update || state->legacy_cursor_update)
state->async_update = drm_atomic_async_check(state);
 
return ret;
@@ -2189,6 +2190,10 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
(arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
return -EINVAL;
 
+   if ((arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET) &&
+   (arg->flags & DRM_MODE_ATOMIC_ASYNC_UPDATE))
+   return -EINVAL;
+
drm_modeset_acquire_init(, 0);
 
state = drm_atomic_state_alloc(dev);
@@ -2197,6 +2202,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 
state->acquire_ctx = 
state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET);
+   state->async_update = !!(arg->flags & DRM_MODE_ATOMIC_ASYNC_UPDATE);
 
 retry:
plane_mask = 0;
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 8c67fc0..7c067ca 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -646,13 +646,15 @@ struct drm_mode_destroy_dumb {
 #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
 #define DRM_MODE_ATOMIC_NONBLOCK  0x0200
 #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
+#define DRM_MODE_ATOMIC_ASYNC_UPDATE 0x0800
 
 #define DRM_MODE_ATOMIC_FLAGS (\
DRM_MODE_PAGE_FLIP_EVENT |\
DRM_MODE_PAGE_FLIP_ASYNC |\
DRM_MODE_ATOMIC_TEST_ONLY |\
DRM_MODE_ATOMIC_NONBLOCK |\
-   DRM_MODE_ATOMIC_ALLOW_MODESET)
+   DRM_MODE_ATOMIC_ALLOW_MODESET |\
+   DRM_MODE_ATOMIC_ASYNC_UPDATE)
 
 struct drm_mode_atomic {
__u32 flags;
-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v3 5/8] drm/msm: update cursors asynchronously through atomic

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

Add support to async updates of cursors by using the new atomic
interface for that. Basically what this commit does is do what
mdp5_update_cursor_plane_legacy() did but through atomic.

v3: move size checks back to drivers (Ville Syrjälä)

v2: move fb setting to core and use new state (Eric Anholt)

Cc: Rob Clark 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 151 +-
 1 file changed, 63 insertions(+), 88 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index a38c5fe..07106c1 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -33,15 +33,6 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
struct drm_crtc *crtc, struct drm_framebuffer *fb,
struct drm_rect *src, struct drm_rect *dest);
 
-static int mdp5_update_cursor_plane_legacy(struct drm_plane *plane,
-   struct drm_crtc *crtc,
-   struct drm_framebuffer *fb,
-   int crtc_x, int crtc_y,
-   unsigned int crtc_w, unsigned int crtc_h,
-   uint32_t src_x, uint32_t src_y,
-   uint32_t src_w, uint32_t src_h,
-   struct drm_modeset_acquire_ctx *ctx);
-
 static struct mdp5_kms *get_kms(struct drm_plane *plane)
 {
struct msm_drm_private *priv = plane->dev->dev_private;
@@ -257,7 +248,7 @@ static const struct drm_plane_funcs mdp5_plane_funcs = {
 };
 
 static const struct drm_plane_funcs mdp5_cursor_plane_funcs = {
-   .update_plane = mdp5_update_cursor_plane_legacy,
+   .update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = mdp5_plane_destroy,
.set_property = drm_atomic_helper_plane_set_property,
@@ -484,11 +475,73 @@ static void mdp5_plane_atomic_update(struct drm_plane 
*plane,
}
 }
 
+static int mdp5_plane_atomic_async_check(struct drm_plane *plane,
+struct drm_plane_state *state)
+{
+   struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
+   struct drm_crtc_state *crtc_state;
+
+   crtc_state = drm_atomic_get_existing_crtc_state(state->state,
+   state->crtc);
+   if (WARN_ON(!crtc_state))
+   return -EINVAL;
+
+   if (!crtc_state->active)
+   return -EINVAL;
+
+   mdp5_state = to_mdp5_plane_state(state);
+
+   /* don't use fast path if we don't have a hwpipe allocated yet */
+   if (!mdp5_state->hwpipe)
+   return -EINVAL;
+
+   /* only allow changing of position(crtc x/y or src x/y) in fast path */
+   if (plane->state->crtc != state->crtc ||
+   plane->state->src_w != state->src_w ||
+   plane->state->src_h != state->src_h ||
+   plane->state->crtc_w != state->crtc_w ||
+   plane->state->crtc_h != state->crtc_h ||
+   !plane->state->fb ||
+   plane->state->fb != state->fb)
+   return -EINVAL;
+
+   return 0;
+}
+
+static void mdp5_plane_atomic_async_update(struct drm_plane *plane,
+  struct drm_plane_state *new_state)
+{
+   plane->state->src_x = new_state->src_x;
+   plane->state->src_y = new_state->src_y;
+   plane->state->crtc_x = new_state->crtc_x;
+   plane->state->crtc_y = new_state->crtc_y;
+
+   if (plane_enabled(new_state)) {
+   struct mdp5_ctl *ctl;
+   struct mdp5_pipeline *pipeline =
+   mdp5_crtc_get_pipeline(plane->crtc);
+   int ret;
+
+   ret = mdp5_plane_mode_set(plane, new_state->crtc, new_state->fb,
+   _state->src, _state->dst);
+   WARN_ON(ret < 0);
+
+   ctl = mdp5_crtc_get_ctl(new_state->crtc);
+
+   mdp5_ctl_commit(ctl, pipeline, mdp5_plane_get_flush(plane));
+   }
+
+   *to_mdp5_plane_state(plane->state) =
+   *to_mdp5_plane_state(new_state);
+}
+
 static const struct drm_plane_helper_funcs mdp5_plane_helper_funcs = {
.prepare_fb = mdp5_plane_prepare_fb,
.cleanup_fb = mdp5_plane_cleanup_fb,
.atomic_check = mdp5_plane_atomic_check,
.atomic_update = mdp5_plane_atomic_update,
+   .atomic_async_check = mdp5_plane_atomic_async_check,
+   .atomic_async_update = mdp5_plane_atomic_async_update,
 };
 
 static void set_scanout_locked(struct mdp5_kms *mdp5_kms,
@@ -997,84 +1050,6 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
return ret;
 }
 
-static int mdp5_update_cursor_plane_legacy(struct drm_plane *plane,
-

[RFC v3 2/8] drm/virtio: support async cursor updates

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

Short circuit the update path for cursors and use the drm async update
infrastructure.

v2: move fb setting to core and use new state (Eric Anholt)

Signed-off-by: Gustavo Padovan 

---
I wrote this mostly for testing purposes, not sure if its something that
we actually need for virtio.
---
 drivers/gpu/drm/virtio/virtgpu_plane.c | 53 ++
 1 file changed, 53 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c 
b/drivers/gpu/drm/virtio/virtgpu_plane.c
index 76d5fed..9b396c1 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -260,6 +260,57 @@ static void virtio_gpu_cursor_plane_update(struct 
drm_plane *plane,
virtio_gpu_cursor_ping(vgdev, output);
 }
 
+static int virtio_gpu_cursor_plane_async_check(struct drm_plane *plane,
+  struct drm_plane_state 
*new_state)
+{
+   struct virtio_gpu_output *output;
+
+   if (!plane->state->crtc)
+   return -EINVAL;
+
+   output = drm_crtc_to_virtio_gpu_output(plane->state->crtc);
+   if (!output)
+   return -EINVAL;
+
+   if (plane->state->crtc != new_state->crtc ||
+   plane->state->src_w != new_state->src_w ||
+   plane->state->src_h != new_state->src_h ||
+   plane->state->crtc_w != new_state->crtc_w ||
+   plane->state->crtc_h != new_state->crtc_h ||
+   !plane->state->fb ||
+   plane->state->fb != new_state->fb)
+   return -EINVAL;
+
+   return 0;
+}
+
+static void virtio_gpu_cursor_plane_async_update(struct drm_plane *plane,
+struct drm_plane_state 
*new_state)
+{
+   struct drm_device *dev = plane->dev;
+   struct virtio_gpu_device *vgdev = dev->dev_private;
+   struct virtio_gpu_output *output = NULL;
+
+   output = drm_crtc_to_virtio_gpu_output(plane->state->crtc);
+   if (WARN_ON(!output))
+   return;
+
+   if (plane->state->fb != new_state->fb)
+   return;
+
+   plane->state->src_x = new_state->src_x;
+   plane->state->src_y = new_state->src_y;
+   plane->state->crtc_x = new_state->crtc_x;
+   plane->state->crtc_y = new_state->crtc_y;
+
+   DRM_DEBUG("move +%d+%d\n", plane->state->crtc_x, plane->state->crtc_y);
+
+   output->cursor.hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_MOVE_CURSOR);
+   output->cursor.pos.x = cpu_to_le32(plane->state->crtc_x);
+   output->cursor.pos.y = cpu_to_le32(plane->state->crtc_y);
+   virtio_gpu_cursor_ping(vgdev, output);
+}
+
 static const struct drm_plane_helper_funcs virtio_gpu_primary_helper_funcs = {
.atomic_check   = virtio_gpu_plane_atomic_check,
.atomic_update  = virtio_gpu_primary_plane_update,
@@ -268,6 +319,8 @@ static const struct drm_plane_helper_funcs 
virtio_gpu_primary_helper_funcs = {
 static const struct drm_plane_helper_funcs virtio_gpu_cursor_helper_funcs = {
.atomic_check   = virtio_gpu_plane_atomic_check,
.atomic_update  = virtio_gpu_cursor_plane_update,
+   .atomic_async_check = virtio_gpu_cursor_plane_async_check,
+   .atomic_async_update= virtio_gpu_cursor_plane_async_update,
 };
 
 struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev,
-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v3 6/8] drm/msm: remove mdp5_cursor_plane_funcs

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

After converting legacy cursor updates to atomic async commits
mdp5_cursor_plane_funcs just duplicates mdp5_plane_funcs now.

Cc: Rob Clark 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 26 +++---
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 07106c1..794ca07 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -247,19 +247,6 @@ static const struct drm_plane_funcs mdp5_plane_funcs = {
.atomic_print_state = mdp5_plane_atomic_print_state,
 };
 
-static const struct drm_plane_funcs mdp5_cursor_plane_funcs = {
-   .update_plane = drm_atomic_helper_update_plane,
-   .disable_plane = drm_atomic_helper_disable_plane,
-   .destroy = mdp5_plane_destroy,
-   .set_property = drm_atomic_helper_plane_set_property,
-   .atomic_set_property = mdp5_plane_atomic_set_property,
-   .atomic_get_property = mdp5_plane_atomic_get_property,
-   .reset = mdp5_plane_reset,
-   .atomic_duplicate_state = mdp5_plane_duplicate_state,
-   .atomic_destroy_state = mdp5_plane_destroy_state,
-   .atomic_print_state = mdp5_plane_atomic_print_state,
-};
-
 static int mdp5_plane_prepare_fb(struct drm_plane *plane,
 struct drm_plane_state *new_state)
 {
@@ -,16 +1098,9 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
 
spin_lock_init(_plane->pipe_lock);
 
-   if (type == DRM_PLANE_TYPE_CURSOR)
-   ret = drm_universal_plane_init(dev, plane, 0xff,
-   _cursor_plane_funcs,
-   mdp5_plane->formats, mdp5_plane->nformats,
-   type, NULL);
-   else
-   ret = drm_universal_plane_init(dev, plane, 0xff,
-   _plane_funcs,
-   mdp5_plane->formats, mdp5_plane->nformats,
-   type, NULL);
+   ret = drm_universal_plane_init(dev, plane, 0xff, _plane_funcs,
+  mdp5_plane->formats,
+  mdp5_plane->nformats, type, NULL);
if (ret)
goto fail;
 
-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v3 0/8] drm/atomic: add async plane update

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

Hi,

One more take of Asynchronous Plane Updates over Atomic. Here I looked
to msm, vc4 and i915 to identify a common pattern to create atomic helpers
for async updates. So in patch 1 drm_atomic_async_check() and
drm_atomic_helper_async_commit() are introduced along with driver's plane hooks:
->atomic_async_check() and ->atomic_async_commit().

For now we only support async update for one plane at a time. Also the async
update can't modify the CRTC so no modesets are allowed.

Then the other patches add support for it in the drivers. I did virtio mostly
for testing. msm and vc4 are only compile-tested.

I started IGT changes to test the Atomic IOCTL with the new flag:

https://git.collabora.com/cgit/user/padovan/intel-gpu-tools.git/

Support for async page flips and drm core workers to delay plane/fb clean up
are not plane for this patchset.

TODO

* improve i-g-t tests where needed


Gustavo Padovan (8):
  drm/atomic: initial support for asynchronous plane update
  drm/virtio: support async cursor updates
  drm/i915: update cursors asynchronously through atomic
  drm/i915: remove intel_cursor_plane_funcs
  drm/msm: update cursors asynchronously through atomic
  drm/msm: remove mdp5_cursor_plane_funcs
  drm/vc4: update cursors asynchronously through atomic
  drm/atomic: add ASYNC_UPDATE flag to the Atomic IOCTL

 drivers/gpu/drm/drm_atomic.c  |  71 +
 drivers/gpu/drm/drm_atomic_helper.c   |  48 +
 drivers/gpu/drm/i915/intel_atomic_plane.c |  67 
 drivers/gpu/drm/i915/intel_display.c  | 160 +---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 170 +++---
 drivers/gpu/drm/vc4/vc4_plane.c   |  96 ++---
 drivers/gpu/drm/virtio/virtgpu_plane.c|  48 +
 include/drm/drm_atomic.h  |   2 +
 include/drm/drm_atomic_helper.h   |   2 +
 include/drm/drm_modeset_helper_vtables.h  |  48 +
 include/uapi/drm/drm_mode.h   |   4 +-
 11 files changed, 404 insertions(+), 312 deletions(-)

-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v3 4/8] drm/i915: remove intel_cursor_plane_funcs

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

After converting legacy cursor updates to atomic async commits
intel_cursor_plane_funcs just duplicates intel_plane_funcs now.

Cc: Daniel Vetter 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/i915/intel_display.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 7f4c8d3..ee75165 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13418,17 +13418,6 @@ const struct drm_plane_funcs intel_plane_funcs = {
.atomic_destroy_state = intel_plane_destroy_state,
 };
 
-static const struct drm_plane_funcs intel_cursor_plane_funcs = {
-   .update_plane = drm_atomic_helper_update_plane,
-   .disable_plane = drm_atomic_helper_disable_plane,
-   .destroy = intel_plane_destroy,
-   .set_property = drm_atomic_helper_plane_set_property,
-   .atomic_get_property = intel_plane_atomic_get_property,
-   .atomic_set_property = intel_plane_atomic_set_property,
-   .atomic_duplicate_state = intel_plane_duplicate_state,
-   .atomic_destroy_state = intel_plane_destroy_state,
-};
-
 static struct intel_plane *
 intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
@@ -13675,7 +13664,7 @@ intel_cursor_plane_create(struct drm_i915_private 
*dev_priv, enum pipe pipe)
cursor->disable_plane = intel_disable_cursor_plane;
 
ret = drm_universal_plane_init(_priv->drm, >base,
-  0, _cursor_plane_funcs,
+  0, _plane_funcs,
   intel_cursor_formats,
   ARRAY_SIZE(intel_cursor_formats),
   DRM_PLANE_TYPE_CURSOR,
-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[RFC v3 3/8] drm/i915: update cursors asynchronously through atomic

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

Add support to async updates of cursors by using the new atomic
interface for that. Basically what this commit does is do what
intel_legacy_cursor_update() did but through atomic.

v3:
- set correct vma to new state for cleanup
- move size checks back to drivers (Ville Syrjälä)

v2:
- move fb setting to core and use new state (Eric Anholt)

Cc: Daniel Vetter 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/i915/intel_atomic_plane.c |  73 +++
 drivers/gpu/drm/i915/intel_display.c  | 149 +-
 2 files changed, 97 insertions(+), 125 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c 
b/drivers/gpu/drm/i915/intel_atomic_plane.c
index cfb4729..974c91f 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -246,11 +246,84 @@ static void intel_plane_atomic_update(struct drm_plane 
*plane,
}
 }
 
+static int intel_plane_atomic_async_check(struct drm_plane *plane,
+ struct drm_plane_state *state)
+{
+   struct drm_crtc *crtc = plane->state->crtc;
+   struct drm_crtc_state *crtc_state = crtc->state;
+
+   if (plane->type != DRM_PLANE_TYPE_CURSOR)
+   return -EINVAL;
+
+   /*
+* When crtc is inactive or there is a modeset pending,
+* wait for it to complete in the slowpath
+*/
+   if (!crtc_state->active || to_intel_crtc_state(crtc_state)->update_pipe)
+   return -EINVAL;
+
+   /*
+* If any parameters change that may affect watermarks,
+* take the slowpath. Only changing fb or position should be
+* in the fastpath.
+*/
+   if (plane->state->crtc != state->crtc ||
+   plane->state->src_w != state->src_w ||
+   plane->state->src_h != state->src_h ||
+   plane->state->crtc_w != state->crtc_w ||
+   plane->state->crtc_h != state->crtc_h ||
+   !plane->state->fb != !state->fb)
+   return -EINVAL;
+
+   return 0;
+}
+
+static void intel_plane_atomic_async_update(struct drm_plane *plane,
+   struct drm_plane_state *new_state)
+{
+   struct intel_plane *intel_plane = to_intel_plane(plane);
+   struct drm_crtc *crtc = plane->state->crtc;
+   struct drm_framebuffer *old_fb;
+   struct i915_vma *old_vma;
+
+   old_vma = to_intel_plane_state(plane->state)->vma;
+   old_fb = plane->state->fb;
+
+   i915_gem_track_fb(intel_fb_obj(old_fb), intel_fb_obj(new_state->fb),
+ intel_plane->frontbuffer_bit);
+
+   plane->state->src_x = new_state->src_x;
+   plane->state->src_y = new_state->src_y;
+   plane->state->crtc_x = new_state->crtc_x;
+   plane->state->crtc_y = new_state->crtc_y;
+   plane->state->fb = new_state->fb;
+   *to_intel_plane_state(plane->state) = *to_intel_plane_state(new_state);
+
+   to_intel_plane_state(new_state)->vma = old_vma;
+   new_state->fb = old_fb;
+
+   if (plane->state->visible) {
+   trace_intel_update_plane(plane, to_intel_crtc(crtc));
+   intel_plane->update_plane(plane,
+ to_intel_crtc_state(crtc->state),
+ to_intel_plane_state(plane->state));
+   } else {
+   trace_intel_disable_plane(plane, to_intel_crtc(crtc));
+   intel_plane->disable_plane(plane, crtc);
+   }
+
+   mutex_lock(>dev->struct_mutex);
+   intel_cleanup_plane_fb(plane, new_state);
+   mutex_unlock(>dev->struct_mutex);
+}
+
 const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
.prepare_fb = intel_prepare_plane_fb,
.cleanup_fb = intel_cleanup_plane_fb,
.atomic_check = intel_plane_atomic_check,
.atomic_update = intel_plane_atomic_update,
+   .atomic_async_check = intel_plane_atomic_async_check,
+   .atomic_async_update = intel_plane_atomic_async_update,
 };
 
 /**
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 207f144..7f4c8d3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13010,6 +13010,26 @@ static int intel_atomic_commit(struct drm_device *dev,
struct drm_i915_private *dev_priv = to_i915(dev);
int ret = 0;
 
+   /*
+* The atomic async update fast path takes care
+* of avoiding the vblank waits for simple cursor
+* movement and flips. For cursor on/off and size changes,
+* we want to perform the vblank waits so that watermark
+* updates happen during the correct frames. Gen9+ have
+* double buffered watermarks and so shouldn't need this.
+*/
+   if (state->async_update) {
+  

[RFC v3 1/8] drm/atomic: initial support for asynchronous plane update

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

In some cases, like cursor updates, it is interesting to update the
plane in an asynchronous fashion to avoid big delays. The current queued
update could be still waiting for a fence to signal and thus block any
subsequent update until its scan out. In cases like this if we update the
cursor synchronously through the atomic API it will cause significant
delays that would even be noticed by the final user.

This patch creates a fast path to jump ahead the current queued state and
do single planes updates without going through all atomic steps in
drm_atomic_helper_commit(). We take this path for legacy cursor updates.

For now only single plane updates are supported, but we plan to support
multiple planes updates and async PageFlips through this interface as well
in the near future.

v3:
- fix iteration on the wrong crtc state
- put back code to forbid updates if there is a queued update for
the same plane (Ville Syrjälä)
- move size checks back to drivers (Ville Syrjälä)
- move ASYNC_UPDATE flag addition to its own patch (Ville Syrjälä)

v2:
- allow updates even if there is a queued update for the same
plane.
- fixes on the documentation (Emil Velikov)
- unconditionally call ->atomic_async_update (Emil Velikov)
- check for ->atomic_async_update earlier (Daniel Vetter)
- make ->atomic_async_check() the last step (Daniel Vetter)
- add ASYNC_UPDATE flag (Eric Anholt)
- update state in core after ->atomic_async_update (Eric Anholt)
- update docs (Eric Anholt)

Cc: Daniel Vetter 
Cc: Rob Clark 
Cc: Eric Anholt 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/drm_atomic.c | 65 
 drivers/gpu/drm/drm_atomic_helper.c  | 35 +
 include/drm/drm_atomic.h |  2 +
 include/drm/drm_atomic_helper.h  |  2 +
 include/drm/drm_modeset_helper_vtables.h | 48 +++
 5 files changed, 152 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index be62774..259a758 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -631,6 +631,68 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
return 0;
 }
 
+static bool drm_atomic_async_check(struct drm_atomic_state *state)
+{
+   struct drm_crtc *crtc;
+   struct drm_crtc_state *crtc_state;
+   struct drm_crtc_commit *commit;
+   struct drm_plane *__plane, *plane = NULL;
+   struct drm_plane_state *__plane_state, *plane_state = NULL;
+   const struct drm_plane_helper_funcs *funcs;
+   int i, j, n_planes = 0;
+
+   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+   if (drm_atomic_crtc_needs_modeset(crtc_state))
+   return false;
+   }
+
+   for_each_new_plane_in_state(state, __plane, __plane_state, i) {
+   n_planes++;
+   plane = __plane;
+   plane_state = __plane_state;
+   }
+
+   /* FIXME: we support only single plane updates for now */
+   if (!plane || n_planes != 1)
+   return false;
+
+   if (!plane->state->crtc)
+   return false;
+
+   funcs = plane->helper_private;
+   if (!funcs->atomic_async_update)
+   return false;
+
+   if (plane_state->fence)
+   return false;
+
+   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
+   if (plane->crtc != crtc)
+   continue;
+
+   spin_lock(>commit_lock);
+   commit = list_first_entry_or_null(>commit_list,
+ struct drm_crtc_commit,
+ commit_entry);
+   if (!commit) {
+   spin_unlock(>commit_lock);
+   continue;
+   }
+   spin_unlock(>commit_lock);
+
+   if (!crtc->state->state)
+   continue;
+
+   for_each_plane_in_state(crtc->state->state, __plane,
+   __plane_state, j) {
+   if (__plane == plane)
+   return false;
+   }
+   }
+
+   return !funcs->atomic_async_check(plane, plane_state);
+}
+
 static void drm_atomic_crtc_print_state(struct drm_printer *p,
const struct drm_crtc_state *state)
 {
@@ -1591,6 +1653,9 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
 
+   if (state->legacy_cursor_update)
+   state->async_update = drm_atomic_async_check(state);
+
return ret;
 }
 EXPORT_SYMBOL(drm_atomic_check_only);
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 

Re: [PATCH 3/3] drm/tegra: Check size of a submitted command buffer

2017-05-12 Thread Erik Faye-Lund
On Fri, May 12, 2017 at 9:02 PM, Dmitry Osipenko  wrote:
> If command buffer claims a number of words that is higher than its BO can
> fit and a relocation lays past the BO, a kernel OOPS will be fired on that
> relocation address patching. This was triggered by an opentegra Xorg driver
> that erroneously pushed too many commands to the pushbuf.
>
> [   46.829393] Unable to handle kernel paging request at virtual address 
> f09b2000
> ...
> [] (host1x_job_pin) from [] (tegra_drm_submit+0x474/0x510)
> [] (tegra_drm_submit) from [] (tegra_submit+0x50/0x6c)
> [] (tegra_submit) from [] (drm_ioctl+0x1e4/0x3ec)
> [] (drm_ioctl) from [] (do_vfs_ioctl+0x9c/0x8e4)
> [] (do_vfs_ioctl) from [] (SyS_ioctl+0x34/0x5c)
> [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x3c)
>
> Signed-off-by: Dmitry Osipenko 
> ---
>  drivers/gpu/drm/tegra/drm.c | 18 ++
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 732c8d98044f..e9c74a7780e7 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -361,20 +361,30 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>
> while (num_cmdbufs) {
> struct drm_tegra_cmdbuf cmdbuf;
> -   struct host1x_bo *bo;
> +   struct drm_gem_object *gem;
> +   struct tegra_bo *bo;
>
> if (copy_from_user(, cmdbufs, sizeof(cmdbuf))) {
> err = -EFAULT;
> goto fail;
> }
>
> -   bo = host1x_bo_lookup(file, cmdbuf.handle);
> -   if (!bo) {
> +   gem = drm_gem_object_lookup(file, cmdbuf.handle);
> +   if (!gem) {
> err = -ENOENT;
> goto fail;
> }
>
> -   host1x_job_add_gather(job, bo, cmdbuf.words, cmdbuf.offset);
> +   drm_gem_object_unreference_unlocked(gem);
> +
> +   if (cmdbuf.words * 4 > gem->size) {

Shouldn't this be "cmdbuf.offset + cmdbuf.words * 4 > gem->size"?
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [git pull] drm fixes for v4.12-rc1

2017-05-12 Thread Linus Torvalds
.. and here's the email repeated for the new dri-devel list, since
apparently Dave sent the pull request to the old no-longer-working one
that just sends annoying bounces.

Dave, time to update your scripts and address book..

  Linus

On Fri, May 12, 2017 at 11:54 AM, Linus Torvalds
 wrote:
> On Thu, May 11, 2017 at 11:00 PM, Dave Airlie  wrote:
>>
>> It also has an amdgpu fixes pull, with lots of ongoing work on Vega10
>> which is new in this kernel and is preliminary support so may have a
>> fair bit of movement.
>
> Note: I will *not* be taking these kinds of pull requests after rc1.
>
> If Vega10 is in such bad shape that it will need this kind of stuff
> and isn't worth shipping without them in 4.12, I will take a *oneline*
> that just disables it.
>
> So no "thousands of lines of fixes for a new driver".
>
> Being new to 4.12 isn't an excuse for crazy stuff after the merge
> window. If it will need more of this kind of attention, all it means
> is that it shouldn't have been sent to me at all in the first place.
>
> The drm subsystem is still on my "no more of this shit" list, so I'm
> going to be very unforgiving of big pull requests when they aren't
> appropriate.
>
>  Linus
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3] dma-buf/sync-file: Defer creation of sync_file->name

2017-05-12 Thread Chris Wilson
Constructing the name takes the majority of the time for allocating a
sync_file to wrap a fence, and the name is very rarely used (only via
the sync_file status user interface). To reduce the impact on the common
path (that of creating sync_file to pass around), defer the construction
of the name until it is first used.

v2: Update kerneldoc (kbuild test robot)
v3: sync_debug.c was peeking at the name

Signed-off-by: Chris Wilson 
Cc: Sumit Semwal 
Cc: Gustavo Padovan 
---
 drivers/dma-buf/sync_debug.c |  3 ++-
 drivers/dma-buf/sync_file.c  | 34 +++---
 include/linux/sync_file.h|  5 +++--
 3 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
index 4b1731ee7458..9a93f1085c63 100644
--- a/drivers/dma-buf/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -134,7 +134,8 @@ static void sync_print_sync_file(struct seq_file *s,
 {
int i;
 
-   seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name,
+   seq_printf(s, "[%p] %s: %s\n", sync_file,
+  sync_file_get_name(sync_file),
   sync_status_str(dma_fence_get_status(sync_file->fence)));
 
if (dma_fence_is_array(sync_file->fence)) {
diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index c9eb4997cfcc..d105079ec45c 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -80,11 +80,6 @@ struct sync_file *sync_file_create(struct dma_fence *fence)
 
sync_file->fence = dma_fence_get(fence);
 
-   snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d",
-fence->ops->get_driver_name(fence),
-fence->ops->get_timeline_name(fence), fence->context,
-fence->seqno);
-
return sync_file;
 }
 EXPORT_SYMBOL(sync_file_create);
@@ -129,6 +124,31 @@ struct dma_fence *sync_file_get_fence(int fd)
 }
 EXPORT_SYMBOL(sync_file_get_fence);
 
+/**
+ * sync_file_get_name - get the name of the sync_file
+ * @sync_file: sync_file to get the fence from
+ *
+ * Each sync_file may have a name assigned either by the user (when merging
+ * sync_files together) or created from the fence it contains. However,
+ * construction of the name is deferred until first use.
+ *
+ * Returns: a string representing the name
+ */
+char *sync_file_get_name(struct sync_file *sync_file)
+{
+   if (!sync_file->user_name[0]) {
+   scnprintf(sync_file->user_name,
+ sizeof(sync_file->user_name),
+ "%s-%s%llu-%d",
+ 
sync_file->fence->ops->get_driver_name(sync_file->fence),
+ 
sync_file->fence->ops->get_timeline_name(sync_file->fence),
+ sync_file->fence->context,
+ sync_file->fence->seqno);
+   }
+
+   return sync_file->user_name;
+}
+
 static int sync_file_set_fence(struct sync_file *sync_file,
   struct dma_fence **fences, int num_fences)
 {
@@ -266,7 +286,7 @@ static struct sync_file *sync_file_merge(const char *name, 
struct sync_file *a,
goto err;
}
 
-   strlcpy(sync_file->name, name, sizeof(sync_file->name));
+   strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name));
return sync_file;
 
 err:
@@ -419,7 +439,7 @@ static long sync_file_ioctl_fence_info(struct sync_file 
*sync_file,
}
 
 no_fences:
-   strlcpy(info.name, sync_file->name, sizeof(info.name));
+   strlcpy(info.name, sync_file_get_name(sync_file), sizeof(info.name));
info.status = dma_fence_is_signaled(sync_file->fence);
info.num_fences = num_fences;
 
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
index d37beefdfbd5..0f3f05325c84 100644
--- a/include/linux/sync_file.h
+++ b/include/linux/sync_file.h
@@ -23,7 +23,7 @@
 /**
  * struct sync_file - sync file to export to the userspace
  * @file:  file representing this fence
- * @name:  name of sync_file.  Useful for debugging
+ * @user_name: name of sync_file.  Useful for debugging
  * @sync_file_list:membership in global file list
  * @wq:wait queue for fence signaling
  * @fence: fence with the fences in the sync_file
@@ -31,7 +31,7 @@
  */
 struct sync_file {
struct file *file;
-   charname[32];
+   charuser_name[32];
 #ifdef CONFIG_DEBUG_FS
struct list_headsync_file_list;
 #endif
@@ -46,5 +46,6 @@ struct sync_file {
 
 struct sync_file *sync_file_create(struct dma_fence *fence);
 struct dma_fence *sync_file_get_fence(int fd);
+char *sync_file_get_name(struct sync_file *sync_file);
 
 #endif /* _LINUX_SYNC_H */
-- 
2.11.0

___
dri-devel mailing list

[Bug 101011] Shadow of Mordor crashes with mesa from 08.05.2017.

2017-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101011

--- Comment #1 from Gilles  ---
I have the exact same problem with the same driver versions.

Platform:
Linux Mint 18.1 x64
Kernel 4.11.0-041100-generic
Mesa package: 17.2~git170508140100.b84979d~
LLVM package: 5.0~svn301901-0~x~padoka0
AMD Ryzen 7 1700 @3.75Ghz
MSI RX 470 Gaming X @stock

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/8] drm/i915: use drm_for_each_connector_iter()

2017-05-12 Thread Ville Syrjälä
On Fri, May 12, 2017 at 09:42:20AM +0200, Daniel Vetter wrote:
> On Thu, May 11, 2017 at 04:10:44PM -0300, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Drop legacy drm_for_each_connector() in favor of the race-free
> > drm_for_each_connector_iter().
> > 
> > Cc: Daniel Vetter 
> > Cc: Jani Nikula 
> > Signed-off-by: Gustavo Padovan 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 5 -
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c 
> > b/drivers/gpu/drm/i915/intel_display.c
> > index 3617927..207f144 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -11216,6 +11216,7 @@ static bool check_digital_port_conflicts(struct 
> > drm_atomic_state *state)
> >  {
> > struct drm_device *dev = state->dev;
> > struct drm_connector *connector;
> > +   struct drm_connector_list_iter conn_iter;
> > unsigned int used_ports = 0;
> > unsigned int used_mst_ports = 0;
> >  
> > @@ -11224,7 +11225,8 @@ static bool check_digital_port_conflicts(struct 
> > drm_atomic_state *state)
> >  * list to detect the problem on ddi platforms
> >  * where there's just one encoder per digital port.
> >  */
> > -   drm_for_each_connector(connector, dev) {
> > +   drm_connector_list_iter_begin(dev, _iter);
> > +   drm_for_each_connector_iter(connector, _iter) {
> 
> Since this checks an atomic state it'd probably be better to use
> for_each_new_connector_in_state (to make sure we check the same connectors
> as in the atomic state,

We need to check all ports here, not just the ones part of the state.

> and not something else due to hotplug changes
> meanwhile). But this is ok as the mechanical change, so
> 
> Reviewed-by: Daniel Vetter 
> 
> > struct drm_connector_state *connector_state;
> > struct intel_encoder *encoder;
> >  
> > @@ -11263,6 +11265,7 @@ static bool check_digital_port_conflicts(struct 
> > drm_atomic_state *state)
> > break;
> > }
> > }
> > +   drm_connector_list_iter_end(_iter);
> >  
> > /* can't mix MST and SST/HDMI on the same port */
> > if (used_ports & used_mst_ports)
> > -- 
> > 2.9.3
> > 
> > ___
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 99923] HITMAN (2016) having lighting and artefacting, and overly light room.

2017-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99923

--- Comment #15 from Christoph Schwerdtfeger  ---
The issue is still present using mesa 17.1.0-1 (Debian/experimental) and llvm
4.0.1~+rc1 (also Debian/experimental).
I also have llvm 5.0 (5.0~svn301421; Debian/experimental) installed.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm/vc4: use drm_for_each_connector_iter()

2017-05-12 Thread Gustavo Padovan
From: Gustavo Padovan 

Drop legacy drm_for_each_connector() in favor of the race-free
drm_for_each_connector_iter().

v2: add missing drm_connector_list_iter_end(Daniel Vetter)

Cc: Eric Anholt 
Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 

---
only built-tested!
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index d86c8cc..d66345f 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -359,12 +359,16 @@ static u32 vc4_get_fifo_full_level(u32 format)
 static struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc)
 {
struct drm_connector *connector;
+   struct drm_connector_list_iter conn_iter;
 
-   drm_for_each_connector(connector, crtc->dev) {
+   drm_connector_list_iter_begin(crtc->dev, _iter);
+   drm_for_each_connector_iter(connector, _iter) {
if (connector->state->crtc == crtc) {
+   drm_connector_list_iter_end(_iter);
return connector->encoder;
}
}
+   drm_connector_list_iter_end(_iter);
 
return NULL;
 }
-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Requests for Proposal for hosting XDC 2018

2017-05-12 Thread Daniel Vetter
On Fri, May 12, 2017 at 12:08 AM, Daniel Vetter  wrote:
> The X.org board is soliciting proposals to host XDC in 2017

That's meant to read 2018 too of course, I missed one date ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] dma-buf/sync-file: Defer creation of sync_file->name

2017-05-12 Thread Gustavo Padovan
Hi Chris,

Thanks for the patch!

2017-05-12 Chris Wilson :

> Constructing the name takes the majority of the time for allocating a
> sync_file to wrap a fence, and the name is very rarely used (only via
> the sync_file status user interface). To reduce the impact on the common
> path (that of creating sync_file to pass around), defer the construction
> of the name until it is first used.
> 
> Signed-off-by: Chris Wilson 
> Cc: Sumit Semwal 
> Cc: Gustavo Padovan 
> ---
>  drivers/dma-buf/sync_file.c | 18 +++---
>  include/linux/sync_file.h   |  2 +-
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
> index 2321035f6204..2cccfa834778 100644
> --- a/drivers/dma-buf/sync_file.c
> +++ b/drivers/dma-buf/sync_file.c
> @@ -82,11 +82,6 @@ struct sync_file *sync_file_create(struct dma_fence *fence)
>  
>   sync_file->fence = dma_fence_get(fence);
>  
> - snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d",
> -  fence->ops->get_driver_name(fence),
> -  fence->ops->get_timeline_name(fence), fence->context,
> -  fence->seqno);
> -
>   return sync_file;
>  }
>  EXPORT_SYMBOL(sync_file_create);
> @@ -268,7 +263,7 @@ static struct sync_file *sync_file_merge(const char 
> *name, struct sync_file *a,
>   goto err;
>   }
>  
> - strlcpy(sync_file->name, name, sizeof(sync_file->name));
> + strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name));
>   return sync_file;
>  
>  err:
> @@ -422,7 +417,16 @@ static long sync_file_ioctl_fence_info(struct sync_file 
> *sync_file,
>   }
>  
>  no_fences:
> - strlcpy(info.name, sync_file->name, sizeof(info.name));
> + if (!sync_file->user_name[0]) {
> + scnprintf(sync_file->user_name,
> +   sizeof(sync_file->user_name),
> +   "%s-%s%llu-%d",
> +   
> sync_file->fence->ops->get_driver_name(sync_file->fence),
> +   
> sync_file->fence->ops->get_timeline_name(sync_file->fence),
> +   sync_file->fence->context,
> +   sync_file->fence->seqno);
> + }
> + strlcpy(info.name, sync_file->user_name, sizeof(info.name));
>   info.status = dma_fence_is_signaled(sync_file->fence);
>   info.num_fences = num_fences;
>  
> diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
> index 3e3ab84fc4cd..0cbeff29f510 100644
> --- a/include/linux/sync_file.h
> +++ b/include/linux/sync_file.h
> @@ -34,7 +34,7 @@
>  struct sync_file {
>   struct file *file;
>   struct kref kref;
> - charname[32];
> + charuser_name[32];

Looks good to me, but please re-spin it fixing the issue reported by the
test bot then I can apply it.

Gustavo

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 3/5] drm/syncobj: add sync_file interaction.

2017-05-12 Thread Sean Paul
On Fri, May 12, 2017 at 10:34:55AM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This interface allows importing the fence from a sync_file into
> an existing drm sync object, or exporting the fence attached to
> an existing drm sync object into a new sync file object.
> 
> This should only be used to interact with sync files where necessary.
> 
> Signed-off-by: Dave Airlie 

With Daniel's comments taken into account,

Reviewed-by: Sean Paul 

> ---
>  drivers/gpu/drm/drm_syncobj.c | 56 
> +++
>  include/uapi/drm/drm.h|  6 +++--
>  2 files changed, 60 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 9a8c690..69ef20a 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -52,6 +52,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "drm_internal.h"
>  #include 
> @@ -290,6 +291,48 @@ static int drm_syncobj_fd_to_handle(struct drm_file 
> *file_private,
>   return 0;
>  }
>  
> +int drm_syncobj_import_sync_file_fence(struct drm_file *file_private,
> +int fd, int handle)
> +{
> + struct dma_fence *fence = sync_file_get_fence(fd);
> + if (!fence)
> + return -EINVAL;
> +
> + return drm_syncobj_replace_fence(file_private, handle, fence);
> +}
> +
> +int drm_syncobj_export_sync_file(struct drm_file *file_private,
> +  int handle, int *p_fd)
> +{
> + int ret;
> + struct dma_fence *fence;
> + struct sync_file *sync_file;
> + int fd = get_unused_fd_flags(O_CLOEXEC);
> +
> + if (fd < 0)
> + return fd;
> +
> + ret = drm_syncobj_fence_get(file_private, handle, );
> + if (ret)
> + goto err_put_fd;
> +
> + sync_file = sync_file_create(fence);
> + if (!sync_file) {
> + ret = -EINVAL;
> + goto err_fence_put;
> + }
> +
> + fd_install(fd, sync_file->file);
> +
> + dma_fence_put(fence);
> + *p_fd = fd;
> + return 0;
> +err_fence_put:
> + dma_fence_put(fence);
> +err_put_fd:
> + put_unused_fd(fd);
> + return ret;
> +}
>  /**
>   * drm_syncobj_open - initalizes syncobj file-private structures at devnode 
> open time
>   * @dev: drm_device which is being opened by userspace
> @@ -372,6 +415,12 @@ drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, 
> void *data,
>   if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
>   return -ENODEV;
>  
> + if (args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_FENCE_SYNC_FILE)
> + return drm_syncobj_export_sync_file(file_private, args->handle,
> + >fd);
> + else if (args->flags)
> + return -EINVAL;
> +
>   return drm_syncobj_handle_to_fd(file_private, args->handle,
>   >fd);
>  }
> @@ -385,6 +434,13 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, 
> void *data,
>   if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
>   return -ENODEV;
>  
> + if (args->flags & DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE_FENCE)
> + return drm_syncobj_import_sync_file_fence(file_private,
> +   args->fd,
> +   args->handle);
> + else if (args->flags)
> + return -EINVAL;
> +
>   return drm_syncobj_fd_to_handle(file_private, args->fd,
>   >handle);
>  }
> diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
> index db9e35e..d0e05f4 100644
> --- a/include/uapi/drm/drm.h
> +++ b/include/uapi/drm/drm.h
> @@ -707,13 +707,15 @@ struct drm_syncobj_destroy {
>   __u32 pad;
>  };
>  
> +#define DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE_FENCE (1 << 0)
> +#define DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_FENCE_SYNC_FILE (1 << 0)
>  struct drm_syncobj_handle {
>   __u32 handle;
>   /** Flags.. only applicable for handle->fd */
> - __u32 flags;
> + __u32 fd_flags;
>  
>   __s32 fd;
> - __u32 pad;
> + __u32 flags;
>  };
>  
>  /* timeout_ns is relative timeout in nanoseconds */
> -- 
> 2.9.3
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 0/6] Introduce new mode validation callbacks

2017-05-12 Thread Andrzej Hajda
On 12.05.2017 09:32, Daniel Vetter wrote:
> On Thu, May 11, 2017 at 10:05:56AM +0100, Jose Abreu wrote:
>> This series is a follow up from the discussion at [1]. We start by
>> introducing crtc->mode_valid(), encoder->mode_valid() and
>> bridge->mode_valid() callbacks which will be used in followup
>> patches and also by cleaning the documentation a little bit.
>>
>> We proceed by introducing new helpers to call this new callbacks
>> at 2/6.
>>
>> At 3/6 a helper function is introduced that calls all mode_valid()
>> from a set of bridges.
>>
>> Next, at 4/6 we modify the connector probe helper so that only modes
>> which are supported by a given bridge+encoder+crtc combination are
>> probbed.
>>
>> At 5/6 we call all the mode_valid() callbacks for a given pipeline,
>> except the connector->mode_valid one, so that the mode is validated.
>> This is done before calling mode_fixup().
>>
>> Finally, at 6/6 we use the new crtc->mode_valid() callback in arcpgu
>> and remove the atomic_check() callback.
>>
>> [1] https://patchwork.kernel.org/patch/9702233/
>>
>> Jose Abreu (6):
>>   drm: Add crtc/encoder/bridge->mode_valid() callbacks
>>   drm: Add drm_{crtc/encoder/connector}_mode_valid()
>>   drm: Introduce drm_bridge_mode_valid()
>>   drm: Use new mode_valid() helpers in connector probe helper
>>   drm: Use mode_valid() in atomic modeset
>>   drm: arc: Use crtc->mode_valid() callback
>>
>> Cc: Carlos Palminha 
>> Cc: Alexey Brodkin 
>> Cc: Ville Syrjälä 
>> Cc: Daniel Vetter 
>> Cc: Dave Airlie 
>> Cc: Andrzej Hajda 
>> Cc: Archit Taneja 
> Commented with an entire patch on patch 1, patches 2-5 are all
>
> Reviewed-by: Daniel Vetter 
>
> But I think some more acks/r-bs would be really good, since this is quite
> a bit change in the helper infrastructure. But otherwise ready for merging
> imo. Can you pls also review my proposal for patch 1?
>
> Thanks, Daniel

As the patchset improves many things, I would like to point here that
there are still issues with mode probing at least in case of panels.
Panels in general does not provide discrete list of supported modes, but
they provide list of supported mode ranges (named display_timings), at
the moment this is only addressed in drm_panel_funcs::get_timings, but
drm core does not use it at all.
Currently most of the panel drivers advertises only fixed list of
arbitrary chosen modes, and if bridge/connector/encoder/crtc does not
support it pipeline does not work, even if slightly different
configuration could work. Of course there are workarounds but maybe it
would be good to replace drm_connector::modes with drm_connector::timings.
This way set of valid timings of the whole pipeline will be intersection
of sets of valid timings of every component of the pipeline - quite
straightforward and simple construct.

As this is just an idea which came to me during patchset review, it is
not backed by any code, but maybe it can be interesting for quick
brainstorm.

Regards
Andrzej


>
>>  drivers/gpu/drm/arc/arcpgu_crtc.c  |  39 ++
>>  drivers/gpu/drm/drm_atomic_helper.c|  76 +++-
>>  drivers/gpu/drm/drm_bridge.c   |  33 +
>>  drivers/gpu/drm/drm_crtc_helper_internal.h |  13 
>>  drivers/gpu/drm/drm_probe_helper.c | 103 ++-
>>  include/drm/drm_bridge.h   |  22 ++
>>  include/drm/drm_modeset_helper_vtables.h   | 110 
>> ++---
>>  7 files changed, 348 insertions(+), 48 deletions(-)
>>
>> -- 
>> 1.9.1
>>
>>

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/5] drm/syncobj: add sync obj wait interface. (v2)

2017-05-12 Thread Sean Paul
On Fri, May 12, 2017 at 10:34:54AM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This interface will allow sync object to be used to back
> Vulkan fences. This API is pretty much the vulkan fence waiting
> API, and I've ported the code from amdgpu.
> 
> v2: accept relative timeout, pass remaining time back
> to userspace.
> 
> Signed-off-by: Dave Airlie 

Reviewed-by: Sean Paul 

> ---
>  drivers/gpu/drm/drm_internal.h |   2 +
>  drivers/gpu/drm/drm_ioctl.c|   2 +
>  drivers/gpu/drm/drm_syncobj.c  | 139 
> -
>  include/uapi/drm/drm.h |  12 
>  4 files changed, 154 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index 44ef903..a508ad9 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -156,3 +156,5 @@ int drm_syncobj_handle_to_fd_ioctl(struct drm_device 
> *dev, void *data,
>  struct drm_file *file_private);
>  int drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
>  struct drm_file *file_private);
> +int drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
> +struct drm_file *file_private);
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 6da7adc..b142466 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -653,6 +653,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
> DRM_UNLOCKED|DRM_RENDER_ALLOW),
>   DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_FD_TO_HANDLE, 
> drm_syncobj_fd_to_handle_ioctl,
> DRM_UNLOCKED|DRM_RENDER_ALLOW),
> + DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_WAIT, drm_syncobj_wait_ioctl,
> +   DRM_UNLOCKED|DRM_RENDER_ALLOW),
>  };
>  
>  #define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 835e987..9a8c690 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -1,5 +1,7 @@
>  /*
>   * Copyright 2017 Red Hat
> + * Parts ported from amdgpu (fence wait code).
> + * Copyright 2016 Advanced Micro Devices, Inc.
>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the "Software"),
> @@ -31,10 +33,13 @@
>   * that contain an optional fence. The fence can be updated with a new
>   * fence, or be NULL.
>   *
> + * syncobj's can be waited upon, where it will wait for the underlying
> + * fence.
> + *
>   * syncobj's can be export to fd's and back, these fd's are opaque and
>   * have no other use case, except passing the syncobj between processes.
>   *
> - * TODO: sync_file interactions, waiting
> + * TODO: sync_file interactions.
>   *
>   * Their primary use-case is to implement Vulkan fences and semaphores.
>   *
> @@ -383,3 +388,135 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, 
> void *data,
>   return drm_syncobj_fd_to_handle(file_private, args->fd,
>   >handle);
>  }
> +
> +static int drm_syncobj_wait_all_fences(struct drm_device *dev,
> +struct drm_file *file_private,
> +struct drm_syncobj_wait *wait,
> +uint32_t *handles)
> +{
> + uint32_t i;
> + int ret = 0;
> + unsigned long timeout = nsecs_to_jiffies(wait->timeout_ns);
> +
> + for (i = 0; i < wait->count_handles; i++) {
> + struct dma_fence *fence;
> +
> + ret = drm_syncobj_fence_get(file_private, handles[i],
> + );
> + if (ret)
> + return ret;
> +
> + if (!fence)
> + continue;
> +
> + ret = dma_fence_wait_timeout(fence, true, timeout);
> +
> + dma_fence_put(fence);
> + if (ret < 0)
> + return ret;
> + if (ret == 0)
> + break;
> + timeout = ret;
> + }
> +
> + if (ret > 0)
> + wait->timeout_ns = jiffies_to_nsecs(ret);
> + wait->out_status = (ret > 0);
> + wait->first_signaled = 0;
> + return 0;
> +}
> +
> +static int drm_syncobj_wait_any_fence(struct drm_device *dev,
> +   struct drm_file *file_private,
> +   struct drm_syncobj_wait *wait,
> +   uint32_t *handles)
> +{
> + unsigned long timeout = nsecs_to_jiffies(wait->timeout_ns);
> + struct dma_fence **array;
> + uint32_t i;
> + int ret;
> + uint32_t first = ~0;
> +
> + /* Prepare the fence array */
> + array = kcalloc(wait->count_handles,
> + sizeof(struct 

Re: [PATCH 1/5] drm: introduce sync objects (v2)

2017-05-12 Thread Sean Paul
On Fri, May 12, 2017 at 10:34:53AM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> Sync objects are new toplevel drm object, that contain a
> pointer to a fence. This fence can be updated via command
> submission ioctls via drivers.
> 
> There is also a generic wait obj API modelled on the vulkan
> wait API (with code modelled on some amdgpu code).
> 
> These objects can be converted to an opaque fd that can be
> passes between processes.
> 
> v2: rename reference/unreference to put/get (Chris)
> fix leaked reference (David Zhou)
> drop mutex in favour of cmpxchg (Chris)
> document drm_syncobj_fence_get
> use ENOENT for syncobj lookup.
> 
> Signed-off-by: Dave Airlie 

With Daniel's comments addressed,

Reviewed-by: Sean Paul 

> 
> fixup
> ---
>  Documentation/gpu/drm-internals.rst |   3 +
>  Documentation/gpu/drm-mm.rst|   6 +
>  drivers/gpu/drm/Makefile|   2 +-
>  drivers/gpu/drm/drm_fops.c  |   8 +
>  drivers/gpu/drm/drm_internal.h  |  13 ++
>  drivers/gpu/drm/drm_ioctl.c |  12 ++
>  drivers/gpu/drm/drm_syncobj.c   | 385 
> 
>  include/drm/drmP.h  |   5 +
>  include/drm/drm_drv.h   |   1 +
>  include/drm/drm_syncobj.h   |  87 
>  include/uapi/drm/drm.h  |  25 +++
>  11 files changed, 546 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/drm_syncobj.c
>  create mode 100644 include/drm/drm_syncobj.h
> 
> diff --git a/Documentation/gpu/drm-internals.rst 
> b/Documentation/gpu/drm-internals.rst
> index e35920d..2ea3bce 100644
> --- a/Documentation/gpu/drm-internals.rst
> +++ b/Documentation/gpu/drm-internals.rst
> @@ -98,6 +98,9 @@ DRIVER_ATOMIC
>  implement appropriate obj->atomic_get_property() vfuncs for any
>  modeset objects with driver specific properties.
>  
> +DRIVER_SYNCOBJ
> +Driver support drm sync objects.
> +
>  Major, Minor and Patchlevel
>  ~~~
>  
> diff --git a/Documentation/gpu/drm-mm.rst b/Documentation/gpu/drm-mm.rst
> index f5760b1..28aebe8 100644
> --- a/Documentation/gpu/drm-mm.rst
> +++ b/Documentation/gpu/drm-mm.rst
> @@ -483,3 +483,9 @@ DRM Cache Handling
>  
>  .. kernel-doc:: drivers/gpu/drm/drm_cache.c
> :export:
> +
> +DRM Sync Objects
> +===
> +
> +.. kernel-doc:: drivers/gpu/drm/drm_syncobj.c
> +   :export:
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 3ee9579..b5e565c 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -16,7 +16,7 @@ drm-y   :=  drm_auth.o drm_bufs.o drm_cache.o \
>   drm_framebuffer.o drm_connector.o drm_blend.o \
>   drm_encoder.o drm_mode_object.o drm_property.o \
>   drm_plane.o drm_color_mgmt.o drm_print.o \
> - drm_dumb_buffers.o drm_mode_config.o
> + drm_dumb_buffers.o drm_mode_config.o drm_syncobj.o
>  
>  drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
>  drm-$(CONFIG_DRM_VM) += drm_vm.o
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index afdf5b1..9a61df2 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -219,6 +219,9 @@ static int drm_open_helper(struct file *filp, struct 
> drm_minor *minor)
>   if (drm_core_check_feature(dev, DRIVER_GEM))
>   drm_gem_open(dev, priv);
>  
> + if (drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> + drm_syncobj_open(priv);
> +
>   if (drm_core_check_feature(dev, DRIVER_PRIME))
>   drm_prime_init_file_private(>prime);
>  
> @@ -266,6 +269,8 @@ static int drm_open_helper(struct file *filp, struct 
> drm_minor *minor)
>  out_prime_destroy:
>   if (drm_core_check_feature(dev, DRIVER_PRIME))
>   drm_prime_destroy_file_private(>prime);
> + if (drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> + drm_syncobj_release(priv);
>   if (drm_core_check_feature(dev, DRIVER_GEM))
>   drm_gem_release(dev, priv);
>   put_pid(priv->pid);
> @@ -400,6 +405,9 @@ int drm_release(struct inode *inode, struct file *filp)
>   drm_property_destroy_user_blobs(dev, file_priv);
>   }
>  
> + if (drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> + drm_syncobj_release(file_priv);
> +
>   if (drm_core_check_feature(dev, DRIVER_GEM))
>   drm_gem_release(dev, file_priv);
>  
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index f37388c..44ef903 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -142,4 +142,17 @@ static inline int drm_debugfs_crtc_crc_add(struct 
> drm_crtc *crtc)
>  {
>   return 0;
>  }
> +
>  #endif
> +
> +/* drm_syncobj.c */
> +void drm_syncobj_open(struct drm_file *file_private);
> +void drm_syncobj_release(struct drm_file *file_private);
> +int 

Re: [PATCH v7 3/9] drm/i915: Drop AUX backlight enable check for backlight control

2017-05-12 Thread Jani Nikula
On Fri, 12 May 2017, "Pandiyan, Dhinakaran"  
wrote:
> On Thu, 2017-05-11 at 16:02 -0700, Puthikorn Voravootivat wrote:
>> There are some panel that
>> (1) does not support display backlight enable via AUX
>> (2) support display backlight adjustment via AUX
>> (3) support display backlight enable via eDP BL_ENABLE pin
>> 
>> The current driver required that (1) must be support to enable (2).
>> This patch drops that requirement.
>> 
>
> You sent this version before I finished my follow-up questions, copying
> the conversation here for context. 

Puthikorn, please don't send new versions before the review is
addressed.

Pushed patches 1, 2, 5, and 7. Thanks for the patches and review.

BR,
Jani.

> DK: Won't DP_EDP_BACKLIGHT_AUX_ENABLE_CAP be 1 always? The code below,
> in
> intel_dp_aux_display_control_capable(), makes sure
> DP_EDP_BACKLIGHT_PIN_ENABLE_CAP=0. The spec says at least one of these
> has to be 1.
>
> Puthikorn: We will drop the  DP_EDP_BACKLIGHT_PIN_ENABLE_CAP != 0 check
> in next patch set.
> This patch adds check here to prepare for that.
>
>
> 1) So, this patch does not really fix what the commit message claims
> because it is dependent on the following patch. Does it make sense to
> remove this check in this patch? That way, this patch by itself is the
> fix that the commit message says.
>
> -   !((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP) 
>
>
> 2) If a panel supports backlight enable via AUX and BL_ENABLE pin, this
> patch (along with the next) enables backlight twice, doesn't it?
> _intel_edp_backlight_on(intel_dp) in intel_dp.c is called
> unconditionally after intel_dp_aux_enable_backlight(). I don't know how
> likely this configuration is or if it's alright to enable via both AUX
> and BL_ENABLE pin.
>
>
>
>
>> Signed-off-by: Puthikorn Voravootivat 
>> ---
>>  drivers/gpu/drm/i915/intel_dp_aux_backlight.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c 
>> b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
>> index 870c03fc0f3a..c22712762957 100644
>> --- a/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
>> +++ b/drivers/gpu/drm/i915/intel_dp_aux_backlight.c
>> @@ -28,6 +28,10 @@ static void set_aux_backlight_enable(struct intel_dp 
>> *intel_dp, bool enable)
>>  {
>>  uint8_t reg_val = 0;
>>  
>> +   /* Early return when display use other mechanism to enable 
>> backlight. */
>> +if (!(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP))
>> +return;
>> +
>>  if (drm_dp_dpcd_readb(_dp->aux, DP_EDP_DISPLAY_CONTROL_REGISTER,
>>_val) < 0) {
>>  DRM_DEBUG_KMS("Failed to read DPCD register 0x%x\n",
>> @@ -164,7 +168,6 @@ intel_dp_aux_display_control_capable(struct 
>> intel_connector *connector)
>>   * the panel can support backlight control over the aux channel
>>   */
>>  if (intel_dp->edp_dpcd[1] & DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP &&
>> -(intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_AUX_ENABLE_CAP) &&
>>  (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP) &&
>>  !((intel_dp->edp_dpcd[1] & DP_EDP_BACKLIGHT_PIN_ENABLE_CAP) ||
>>(intel_dp->edp_dpcd[2] & 
>> DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP))) {
>

-- 
Jani Nikula, Intel Open Source Technology Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] dma-buf/sync-file: Defer creation of sync_file->name

2017-05-12 Thread kbuild test robot
Hi Chris,

[auto build test WARNING on linus/master]
[also build test WARNING on v4.11 next-20170512]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Chris-Wilson/dma-buf-sync-file-Defer-creation-of-sync_file-name/20170512-193751
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick 
(https://www.imagemagick.org)
   arch/x86/include/asm/uaccess_32.h:1: warning: no structured comments found
   include/linux/init.h:1: warning: no structured comments found
   include/linux/mod_devicetable.h:686: warning: Excess 
struct/union/enum/typedef member 'ver_major' description in 'fsl_mc_device_id'
   include/linux/mod_devicetable.h:686: warning: Excess 
struct/union/enum/typedef member 'ver_minor' description in 'fsl_mc_device_id'
   kernel/sched/core.c:2088: warning: No description found for parameter 'rf'
   kernel/sched/core.c:2088: warning: Excess function parameter 'cookie' 
description in 'try_to_wake_up_local'
   include/linux/kthread.h:26: warning: Excess function parameter '...' 
description in 'kthread_create'
   kernel/sys.c:1: warning: no structured comments found
   include/linux/device.h:969: warning: No description found for parameter 
'dma_ops'
   drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found
>> include/linux/sync_file.h:47: warning: No description found for parameter 
>> 'user_name'
>> include/linux/sync_file.h:47: warning: Excess struct/union/enum/typedef 
>> member 'name' description in 'sync_file'
   include/linux/iio/iio.h:597: warning: No description found for parameter 
'trig_readonly'
   include/linux/iio/trigger.h:151: warning: No description found for parameter 
'indio_dev'
   include/linux/iio/trigger.h:151: warning: No description found for parameter 
'trig'
   include/linux/device.h:970: warning: No description found for parameter 
'dma_ops'
   include/linux/usb/gadget.h:230: warning: No description found for parameter 
'claimed'
   include/linux/usb/gadget.h:230: warning: No description found for parameter 
'enabled'
   include/linux/usb/gadget.h:408: warning: No description found for parameter 
'quirk_altset_not_supp'
   include/linux/usb/gadget.h:408: warning: No description found for parameter 
'quirk_stall_not_supp'
   include/linux/usb/gadget.h:408: warning: No description found for parameter 
'quirk_zlp_not_supp'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'set_busid'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'irq_handler'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'irq_preinstall'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'irq_postinstall'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'irq_uninstall'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'debugfs_init'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_open_object'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_close_object'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'prime_handle_to_fd'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'prime_fd_to_handle'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_export'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_import'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_pin'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_unpin'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_res_obj'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_get_sg_table'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_import_sg_table'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_vmap'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_vunmap'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_prime_mmap'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'gem_vm_ops'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'major'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'minor'
   include/drm/drm_drv.h:524: warning: No description found for parameter 
'patchlevel'
   include/drm/drm_drv.h:524: warning: No description found for parameter 'name'
   include/drm/drm_drv.h:524: warning: No description found for parameter 'desc'
   include/drm/drm_drv.h:524: warning: No description found for parameter 'date'
   incl

Re: [PATCH 14/13] drm: omapdrm: Remove unused omap_dss_find_output() function

2017-05-12 Thread Tomi Valkeinen
On 12/05/17 15:33, Laurent Pinchart wrote:
> The omap_dss_find_output() function is unused, remove it.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  1 -
>  drivers/gpu/drm/omapdrm/dss/output.c  | 13 -
>  2 files changed, 14 deletions(-)

Thanks, I have picked this up.

 Tomi



signature.asc
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: Add crtc/encoder/bridge->mode_valid() callbacks

2017-05-12 Thread Andrzej Hajda
On 12.05.2017 09:31, Daniel Vetter wrote:
> From: Jose Abreu 
>
> This adds a new callback to crtc, encoder and bridge helper functions
> called mode_valid(). This callback shall be implemented if the
> corresponding component has some sort of restriction in the modes
> that can be displayed. A NULL callback implicates that the component
> can display all the modes.
>
> We also change the documentation so that the new and old callbacks
> are correctly documented.
>
> Only the callbacks were implemented to simplify review process,
> following patches will make use of them.
>
> Changes in v2 from Daniel:
> - Update the warning about how modes aren't filtered in atomic_check -
>   the heleprs help out a lot more now.
> - Consistenly roll out that warning, crtc/encoder's atomic_check
>   missed it.
> - Sprinkle more links all over the place, so it's easier to see where
>   this stuff is used and how the differen hooks are related.
> - Note that ->mode_valid is optional everywhere.
> - Explain why the connector's mode_valid is special and does _not_ get
>   called in atomic_check.
>
> Signed-off-by: Jose Abreu 
> Cc: Jose Abreu 
> Cc: Carlos Palminha 
> Cc: Alexey Brodkin 
> Cc: Ville Syrjälä 
> Cc: Daniel Vetter 
> Cc: Dave Airlie 
> Cc: Andrzej Hajda 
> Cc: Archit Taneja 
> Signed-off-by: Daniel Vetter  (v2)
> ---
>  include/drm/drm_bridge.h |  31 +
>  include/drm/drm_modeset_helper_vtables.h | 116 
> ++-
>  2 files changed, 114 insertions(+), 33 deletions(-)
>
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index fdd82fcbf168..f694de756ecf 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -59,6 +59,31 @@ struct drm_bridge_funcs {
>   void (*detach)(struct drm_bridge *bridge);
>  
>   /**
> +  * @mode_valid:
> +  *
> +  * This callback is used to check if a specific mode is valid in this
> +  * bridge. This should be implemented if the bridge has some sort of
> +  * restriction in the modes it can display. For example, a given bridge
> +  * may be responsible to set a clock value. If the clock can not
> +  * produce all the values for the available modes then this callback
> +  * can be used to restrict the number of modes to only the ones that
> +  * can be displayed.
> +  *
> +  * This hook is used by the probe helpers to filter the mode list in
> +  * drm_helper_probe_single_connector_modes(), and it is used by the
> +  * atomic helpers to validate modes supplied by userspace in
> +  * drm_atomic_helper_check_modeset().
> +  *
> +  * This function is optional.
> +  *
> +  * RETURNS:
> +  *
> +  * drm_mode_status Enum
> +  */
> + enum drm_mode_status (*mode_valid)(struct drm_bridge *crtc,
> +const struct drm_display_mode *mode);

I have put my concerns here but it touches all mode_valid callbacks.
As the callback can be called in mode probe and atomic check it could
only inspect common set of properties for both contexts, for example
crtc cannot check to which encoder it is connected, am I right?
Maybe it would be good to emphasize it here, as it is emphasized in case
of mode_fixup callbacks.

> +
> + /**
>* @mode_fixup:
>*
>* This callback is used to validate and adjust a mode. The paramater
> @@ -82,6 +107,12 @@ struct drm_bridge_funcs {
>* NOT touch any persistent state (hardware or software) or data
>* structures except the passed in @state parameter.
>*
> +  * Also beware that userspace can request its own custom modes, neither
> +  * core nor helpers filter modes to the list of probe modes reported by
> +  * the GETCONNECTOR IOCTL and stored in _connector.modes. To ensure
> +  * that modes are filtered consistently put any bridge constraints and
> +  * limits checks into @mode_valid.
> +  *
>* RETURNS:
>*
>* True if an acceptable configuration is possible, false if the modeset
> diff --git a/include/drm/drm_modeset_helper_vtables.h 
> b/include/drm/drm_modeset_helper_vtables.h
> index c01c328f6cc8..91d071ff1232 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -106,6 +106,31 @@ struct drm_crtc_helper_funcs {
>   void (*commit)(struct drm_crtc *crtc);
>  
>   /**
> +  * @mode_valid:
> +  *
> +  * This callback is used to check if a specific mode is valid in this
> +  * crtc. This should be implemented if the crtc has some sort of
> +  * restriction in the modes it can display. For example, a given crtc
> +  * may be responsible 

[PATCH 14/13] drm: omapdrm: Remove unused omap_dss_find_output() function

2017-05-12 Thread Laurent Pinchart
The omap_dss_find_output() function is unused, remove it.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  1 -
 drivers/gpu/drm/omapdrm/dss/output.c  | 13 -
 2 files changed, 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 41a58c7e38cd..90ce754fba4e 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -634,7 +634,6 @@ int omap_dss_get_num_overlays(void);
 int omapdss_register_output(struct omap_dss_device *output);
 void omapdss_unregister_output(struct omap_dss_device *output);
 struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
-struct omap_dss_device *omap_dss_find_output(const char *name);
 struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node 
*port);
 int omapdss_output_set_device(struct omap_dss_device *out,
struct omap_dss_device *dssdev);
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
b/drivers/gpu/drm/omapdrm/dss/output.c
index 655c5d73eac9..3c572b699ed3 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -133,19 +133,6 @@ struct omap_dss_device *omap_dss_get_output(enum 
omap_dss_output_id id)
 }
 EXPORT_SYMBOL(omap_dss_get_output);
 
-struct omap_dss_device *omap_dss_find_output(const char *name)
-{
-   struct omap_dss_device *out;
-
-   list_for_each_entry(out, _list, list) {
-   if (strcmp(out->name, name) == 0)
-   return omap_dss_get_device(out);
-   }
-
-   return NULL;
-}
-EXPORT_SYMBOL(omap_dss_find_output);
-
 struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node 
*port)
 {
struct device_node *src_node;
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 01/13] drm/omap: panel-dpi: remove non-DT support

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

On Friday 12 May 2017 15:29:38 Tomi Valkeinen wrote:
> On 12/05/17 15:08, Laurent Pinchart wrote:
> > On Friday 12 May 2017 13:41:30 Tomi Valkeinen wrote:
> >> Non-DT booting is no longer supported, so remove legacy code.
> >> 
> >> Signed-off-by: Tomi Valkeinen 
> >> ---
> >> 
> >>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++---
> >>  1 file changed, 6 insertions(+), 72 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
> >> 04ce8c5f2954..75b98bb81de2 100644
> >> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> >> @@ -18,7 +18,6 @@
> > 
> > I think you can drop linux/of_gpio.h.
> 
> Yep.
> 
> >> +  if (!pdev->dev.of_node)
> >> +  return -ENODEV;
> >> +
> > 
> > This can't happen.
> 
> True. I have removed that from the first three patches.
> 
> Do you want me to resend, or can I get your reviewed-by?

Reviewed-by: Laurent Pinchart 

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 01/13] drm/omap: panel-dpi: remove non-DT support

2017-05-12 Thread Tomi Valkeinen
Hi,

On 12/05/17 15:08, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Friday 12 May 2017 13:41:30 Tomi Valkeinen wrote:
>> Non-DT booting is no longer supported, so remove legacy code.
>>
>> Signed-off-by: Tomi Valkeinen 
>> ---
>>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++--
>>  1 file changed, 6 insertions(+), 72 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
>> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
>> 04ce8c5f2954..75b98bb81de2 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
>> @@ -18,7 +18,6 @@
> 
> I think you can drop linux/of_gpio.h.

Yep.

>> +if (!pdev->dev.of_node)
>> +return -ENODEV;
>> +
> 
> This can't happen.

True. I have removed that from the first three patches.

Do you want me to resend, or can I get your reviewed-by?

 Tomi



signature.asc
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 13/13] drm/omap: remove omap_overlay & omap_overlay_manager

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:42 Tomi Valkeinen wrote:
> Structs omap_overlay and omap_overlay_manager are not used, remove them.
> 
> Signed-off-by: Tomi Valkeinen 

You can also remove enum omap_overlay_manager_caps in the same patch. With 
that fixed,

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 87 
>  1 file changed, 87 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 3cf42e5ddf3e..41a58c7e38cd
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -59,7 +59,6 @@
>  #define DISPC_IRQ_FRAMEDONE3 (1 << 30)
> 
>  struct omap_dss_device;
> -struct omap_overlay_manager;
>  struct dss_lcd_mgr_config;
>  struct snd_aes_iec958;
>  struct snd_cea_861_aud_if;
> @@ -306,48 +305,6 @@ struct omap_overlay_info {
>   u8 zorder;
>  };
> 
> -struct omap_overlay {
> - struct kobject kobj;
> - struct list_head list;
> -
> - /* static fields */
> - const char *name;
> - enum omap_plane_id id;
> - enum omap_color_mode supported_modes;
> - enum omap_overlay_caps caps;
> -
> - /* dynamic fields */
> - struct omap_overlay_manager *manager;
> -
> - /*
> -  * The following functions do not block:
> -  *
> -  * is_enabled
> -  * set_overlay_info
> -  * get_overlay_info
> -  *
> -  * The rest of the functions may block and cannot be called from
> -  * interrupt context
> -  */
> -
> - int (*enable)(struct omap_overlay *ovl);
> - int (*disable)(struct omap_overlay *ovl);
> - bool (*is_enabled)(struct omap_overlay *ovl);
> -
> - int (*set_manager)(struct omap_overlay *ovl,
> - struct omap_overlay_manager *mgr);
> - int (*unset_manager)(struct omap_overlay *ovl);
> -
> - int (*set_overlay_info)(struct omap_overlay *ovl,
> - struct omap_overlay_info *info);
> - void (*get_overlay_info)(struct omap_overlay *ovl,
> - struct omap_overlay_info *info);
> -
> - int (*wait_for_go)(struct omap_overlay *ovl);
> -
> - struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
> -};
> -
>  struct omap_overlay_manager_info {
>   u32 default_color;
> 
> @@ -361,47 +318,6 @@ struct omap_overlay_manager_info {
>   struct omap_dss_cpr_coefs cpr_coefs;
>  };
> 
> -struct omap_overlay_manager {
> - struct kobject kobj;
> -
> - /* static fields */
> - const char *name;
> - enum omap_channel id;
> - enum omap_overlay_manager_caps caps;
> - struct list_head overlays;
> - enum omap_display_type supported_displays;
> - enum omap_dss_output_id supported_outputs;
> -
> - /* dynamic fields */
> - struct omap_dss_device *output;
> -
> - /*
> -  * The following functions do not block:
> -  *
> -  * set_manager_info
> -  * get_manager_info
> -  * apply
> -  *
> -  * The rest of the functions may block and cannot be called from
> -  * interrupt context
> -  */
> -
> - int (*set_output)(struct omap_overlay_manager *mgr,
> - struct omap_dss_device *output);
> - int (*unset_output)(struct omap_overlay_manager *mgr);
> -
> - int (*set_manager_info)(struct omap_overlay_manager *mgr,
> - struct omap_overlay_manager_info *info);
> - void (*get_manager_info)(struct omap_overlay_manager *mgr,
> - struct omap_overlay_manager_info *info);
> -
> - int (*apply)(struct omap_overlay_manager *mgr);
> - int (*wait_for_go)(struct omap_overlay_manager *mgr);
> - int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
> -
> - struct omap_dss_device *(*get_device)(struct omap_overlay_manager 
*mgr);
> -};
> -
>  /* 22 pins means 1 clk lane and 10 data lanes */
>  #define OMAP_DSS_MAX_DSI_PINS 22
> 
> @@ -712,10 +628,8 @@ enum omap_color_mode
> dss_feat_get_supported_color_modes(enum omap_plane_id plane
> 
> 
>  int omap_dss_get_num_overlay_managers(void);
> -struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
> 
>  int omap_dss_get_num_overlays(void);
> -struct omap_overlay *omap_dss_get_overlay(int num);
> 
>  int omapdss_register_output(struct omap_dss_device *output);
>  void omapdss_unregister_output(struct omap_dss_device *output);
> @@ -727,7 +641,6 @@ int omapdss_output_set_device(struct omap_dss_device
> *out, int omapdss_output_unset_device(struct omap_dss_device *out);
> 
>  struct omap_dss_device *omapdss_find_output_from_display(struct
> omap_dss_device *dssdev); -struct omap_overlay_manager
> *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);
> 
>  void omapdss_default_get_timings(struct omap_dss_device *dssdev,
>struct videomode *vm);

-- 
Regards,

Laurent Pinchart


Re: [PATCH 12/13] drm/omap: remove unused fields

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:41 Tomi Valkeinen wrote:
> Remove unused fields in struct omap_dss_device.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 17 -
>  1 file changed, 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 74408b0ece26..3cf42e5ddf3e
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -596,12 +596,6 @@ struct omap_dss_device {
>   enum omap_display_type type;
>   enum omap_display_type output_type;
> 
> - union {
> - struct {
> - int module;
> - } dsi;
> - } phy;
> -
>   struct {
>   struct videomode vm;
> 
> @@ -609,17 +603,8 @@ struct omap_dss_device {
>   enum omap_dss_dsi_mode dsi_mode;
>   } panel;
> 
> - struct {
> - u8 pixel_size;
> - } ctrl;
> -
>   const char *name;
> 
> - /* used to match device to driver */
> - const char *driver_name;
> -
> - void *data;
> -
>   struct omap_dss_driver *driver;
> 
>   union {
> @@ -655,8 +640,6 @@ struct omap_dss_device {
>   int port_num;
> 
>   /* dynamic fields */
> - struct omap_overlay_manager *manager;
> -
>   struct omap_dss_device *dst;
>  };

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 11/13] drm/omap: remove legacy get_resolution

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:40 Tomi Valkeinen wrote:
> get_resolution is not used, remove it.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c  |  2 --
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c|  2 --
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c   |  2 --
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c|  2 --
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  9 -
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c |  2 --
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c |  2 --
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  |  2 --
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c |  2 --
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c |  2 --
>  drivers/gpu/drm/omapdrm/dss/display.c   | 10 --
> drivers/gpu/drm/omapdrm/dss/omapdss.h   |  5 - 12
> files changed, 42 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c index
> 8453b1103abd..542a76503fbd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -171,8 +171,6 @@ static struct omap_dss_driver tvc_driver = {
>   .get_timings= tvc_get_timings,
>   .check_timings  = tvc_check_timings,
> 
> - .get_resolution = omapdss_default_get_resolution,
> -
>   .get_wss= tvc_get_wss,
>   .set_wss= tvc_set_wss,
>  };
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index
> 8720b2dcb316..05fa24a518c8 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -227,8 +227,6 @@ static struct omap_dss_driver dvic_driver = {
>   .get_timings= dvic_get_timings,
>   .check_timings  = dvic_check_timings,
> 
> - .get_resolution = omapdss_default_get_resolution,
> -
>   .read_edid  = dvic_read_edid,
>   .detect = dvic_detect,
>  };
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c index
> 555e193c9732..79cb69f1acf5 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -195,8 +195,6 @@ static struct omap_dss_driver hdmic_driver = {
>   .get_timings= hdmic_get_timings,
>   .check_timings  = hdmic_check_timings,
> 
> - .get_resolution = omapdss_default_get_resolution,
> -
>   .read_edid  = hdmic_read_edid,
>   .detect = hdmic_detect,
>   .set_hdmi_mode  = hdmic_set_hdmi_mode,
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
> cc5920b476d6..49ceed7f1d11 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -159,8 +159,6 @@ static struct omap_dss_driver panel_dpi_ops = {
>   .set_timings= panel_dpi_set_timings,
>   .get_timings= panel_dpi_get_timings,
>   .check_timings  = panel_dpi_check_timings,
> -
> - .get_resolution = omapdss_default_get_resolution,
>  };
> 
>  static int panel_dpi_probe_of(struct platform_device *pdev)
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index
> 1fbbe4c4bce6..76787a75a4dc 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -379,13 +379,6 @@ static const struct backlight_ops dsicm_bl_ops = {
>   .update_status  = dsicm_bl_update_status,
>  };
> 
> -static void dsicm_get_resolution(struct omap_dss_device *dssdev,
> - u16 *xres, u16 *yres)
> -{
> - *xres = dssdev->panel.vm.hactive;
> - *yres = dssdev->panel.vm.vactive;
> -}
> -
>  static ssize_t dsicm_num_errors_show(struct device *dev,
>   struct device_attribute *attr, char *buf)
>  {
> @@ -1116,8 +1109,6 @@ static struct omap_dss_driver dsicm_ops = {
>   .update = dsicm_update,
>   .sync   = dsicm_sync,
> 
> - .get_resolution = dsicm_get_resolution,
> -
>   .enable_te  = dsicm_enable_te,
>   .get_te = dsicm_get_te,
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c index
> 451e1608a1db..c90474afaebd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> +++ 

Re: [PATCH 10/13] drm/omap: remove unused get_dimensions()

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:39 Tomi Valkeinen wrote:
> get_dimensions function pointer is not used, remove it.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 8eb8315a6c95..4909ea11cb71
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -690,8 +690,6 @@ struct omap_dss_driver {
> 
>   void (*get_resolution)(struct omap_dss_device *dssdev,
>   u16 *xres, u16 *yres);
> - void (*get_dimensions)(struct omap_dss_device *dssdev,
> - u32 *width, u32 *height);
> 
>   int (*check_timings)(struct omap_dss_device *dssdev,
>struct videomode *vm);

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 09/13] drm/omap: remove rfbi

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:38 Tomi Valkeinen wrote:
> The RFBI driver has not worked nor compiled for many years. There are
> very few boards out there that use RFBI, and no one has stepped up to
> fix it.
> 
> So let's remove the RFBI code that doesn't even compile.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig   |   13 -
>  drivers/gpu/drm/omapdrm/dss/Makefile  |1 -
>  drivers/gpu/drm/omapdrm/dss/core.c|6 -
>  drivers/gpu/drm/omapdrm/dss/dss.h |4 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |   32 -
>  drivers/gpu/drm/omapdrm/dss/rfbi.c| 1075 --
>  6 files changed, 1131 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/rfbi.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig
> b/drivers/gpu/drm/omapdrm/dss/Kconfig index f53adb944a0d..8b87d5cf45fc
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -49,19 +49,6 @@ config OMAP2_DSS_DPI
>   help
> DPI Interface. This is the Parallel Display Interface.
> 
> -config OMAP2_DSS_RFBI
> - bool "RFBI support"
> - depends on BROKEN
> -default n
> - help
> -   MIPI DBI support (RFBI, Remote Framebuffer Interface, in Texas
> -   Instrument's terminology).
> -
> -   DBI is a bus between the host processor and a peripheral,
> -   such as a display or a framebuffer chip.
> -
> -   See http://www.mipi.org/ for DBI specifications.
> -
>  config OMAP2_DSS_VENC
>   bool "VENC support"
>  default y
> diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile
> b/drivers/gpu/drm/omapdrm/dss/Makefile index 75ec30f231c7..688195e448c5
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Makefile
> +++ b/drivers/gpu/drm/omapdrm/dss/Makefile
> @@ -8,7 +8,6 @@ obj-$(CONFIG_OMAP2_DSS) += omapdss.o
>  omapdss-y := core.o dss.o dss_features.o dispc.o dispc_coefs.o \
>   pll.o video-pll.o
>  omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
> -omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o
>  omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
>  omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
>  omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c
> b/drivers/gpu/drm/omapdrm/dss/core.c index f056bffcab73..bdce4bfdf6e0
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> @@ -208,9 +208,6 @@ static int (*dss_output_drv_reg_funcs[])(void)
> __initdata = { #ifdef CONFIG_OMAP2_DSS_DSI
>   dsi_init_platform_driver,
>  #endif
> -#ifdef CONFIG_OMAP2_DSS_RFBI
> - rfbi_init_platform_driver,
> -#endif
>  #ifdef CONFIG_OMAP2_DSS_VENC
>   venc_init_platform_driver,
>  #endif
> @@ -232,9 +229,6 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
>  #ifdef CONFIG_OMAP2_DSS_VENC
>   venc_uninit_platform_driver,
>  #endif
> -#ifdef CONFIG_OMAP2_DSS_RFBI
> - rfbi_uninit_platform_driver,
> -#endif
>  #ifdef CONFIG_OMAP2_DSS_DSI
>   dsi_uninit_platform_driver,
>  #endif
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h
> b/drivers/gpu/drm/omapdrm/dss/dss.h index d8bf99a97571..8dbf35f3ab23 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -382,10 +382,6 @@ void hdmi4_uninit_platform_driver(void);
>  int hdmi5_init_platform_driver(void) __init;
>  void hdmi5_uninit_platform_driver(void);
> 
> -/* RFBI */
> -int rfbi_init_platform_driver(void) __init;
> -void rfbi_uninit_platform_driver(void);
> -
> 
>  #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
>  static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 3cbc9e49aa5a..8eb8315a6c95
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -126,11 +126,6 @@ enum omap_dss_trans_key_type {
>   OMAP_DSS_COLOR_KEY_VID_SRC = 1,
>  };
> 
> -enum omap_rfbi_te_mode {
> - OMAP_DSS_RFBI_TE_MODE_1 = 1,
> - OMAP_DSS_RFBI_TE_MODE_2 = 2,
> -};
> -
>  enum omap_dss_signal_level {
>   OMAPDSS_SIG_ACTIVE_LOW,
>   OMAPDSS_SIG_ACTIVE_HIGH,
> @@ -220,27 +215,6 @@ enum omap_dss_output_id {
>   OMAP_DSS_OUTPUT_HDMI= 1 << 6,
>  };
> 
> -/* RFBI */
> -
> -struct rfbi_timings {
> - int cs_on_time;
> - int cs_off_time;
> - int we_on_time;
> - int we_off_time;
> - int re_on_time;
> - int re_off_time;
> - int we_cycle_time;
> - int re_cycle_time;
> - int cs_pulse_width;
> - int access_time;
> -
> - int clk_div;
> -
> - u32 tim[5]; /* set by rfbi_convert_timings() */
> -
> - int converted;
> -};
> -
>  /* DSI */
> 
>  enum omap_dss_dsi_trans_mode {
> @@ -624,11 +598,6 @@ struct omap_dss_device {
> 
>   union {
>   struct {
> - u8 channel;
> -

Re: [PATCH 08/13] drm/omap: dpi: remove legacy data_lines

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:37 Tomi Valkeinen wrote:
> Remove DPI's legacy data_lines code.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c   |  4 
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c|  5 -
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c |  5 -
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c |  4 
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  |  5 -
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c |  5 -
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c |  4 
>  drivers/gpu/drm/omapdrm/dss/dpi.c   | 13 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  6 --
>  9 files changed, 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c index
> 13e32d02c884..947295f9e30f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -22,7 +22,6 @@ struct panel_drv_data {
>   struct omap_dss_device *in;
> 
>   int pd_gpio;
> - int data_lines;
> 
>   struct videomode vm;
>  };
> @@ -82,8 +81,6 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
>   return 0;
> 
>   in->ops.dpi->set_timings(in, >vm);
> - if (ddata->data_lines)
> - in->ops.dpi->set_data_lines(in, ddata->data_lines);
> 
>   r = in->ops.dpi->enable(in);
>   if (r)
> @@ -226,7 +223,6 @@ static int tfp410_probe(struct platform_device *pdev)
>   dssdev->type = OMAP_DISPLAY_TYPE_DPI;
>   dssdev->output_type = OMAP_DISPLAY_TYPE_DVI;
>   dssdev->owner = THIS_MODULE;
> - dssdev->phy.dpi.data_lines = ddata->data_lines;
>   dssdev->port_num = 1;
> 
>   r = omapdss_register_output(dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
> 75b98bb81de2..cc5920b476d6 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -26,8 +26,6 @@ struct panel_drv_data {
>   struct omap_dss_device dssdev;
>   struct omap_dss_device *in;
> 
> - int data_lines;
> -
>   struct videomode vm;
> 
>   struct backlight_device *backlight;
> @@ -77,8 +75,6 @@ static int panel_dpi_enable(struct omap_dss_device
> *dssdev) if (omapdss_device_is_enabled(dssdev))
>   return 0;
> 
> - if (ddata->data_lines)
> - in->ops.dpi->set_data_lines(in, ddata->data_lines);
>   in->ops.dpi->set_timings(in, >vm);
> 
>   r = in->ops.dpi->enable(in);
> @@ -257,7 +253,6 @@ static int panel_dpi_probe(struct platform_device *pdev)
> dssdev->type = OMAP_DISPLAY_TYPE_DPI;
>   dssdev->owner = THIS_MODULE;
>   dssdev->panel.vm = ddata->vm;
> - dssdev->phy.dpi.data_lines = ddata->data_lines;
> 
>   r = omapdss_register_display(dssdev);
>   if (r) {
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c index
> 43d21edb51f5..451e1608a1db 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> @@ -49,8 +49,6 @@ struct panel_drv_data {
> 
>   struct spi_device *spi;
> 
> - int data_lines;
> -
>   struct videomode vm;
> 
>   struct gpio_desc *enable_gpio;
> @@ -159,8 +157,6 @@ static int lb035q02_enable(struct omap_dss_device
> *dssdev) if (omapdss_device_is_enabled(dssdev))
>   return 0;
> 
> - if (ddata->data_lines)
> - in->ops.dpi->set_data_lines(in, ddata->data_lines);
>   in->ops.dpi->set_timings(in, >vm);
> 
>   r = in->ops.dpi->enable(in);
> @@ -289,7 +285,6 @@ static int lb035q02_panel_spi_probe(struct spi_device
> *spi) dssdev->type = OMAP_DISPLAY_TYPE_DPI;
>   dssdev->owner = THIS_MODULE;
>   dssdev->panel.vm = ddata->vm;
> - dssdev->phy.dpi.data_lines = ddata->data_lines;
> 
>   r = omapdss_register_display(dssdev);
>   if (r) {
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c index
> 2de27ba01552..95f6702a7b4f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> @@ -25,8 +25,6 @@ struct panel_drv_data {
> 
>   struct videomode vm;
> 
> - int data_lines;
> -
>   int res_gpio;
>   int qvga_gpio;
> 
> @@ -153,8 +151,6 @@ static int nec_8048_enable(struct omap_dss_device
> *dssdev) if (omapdss_device_is_enabled(dssdev))
>   return 0;
> 
> - if (ddata->data_lines)
> - 

Re: [PATCH 07/13] drm/omap: remove recommended_bpp

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:36 Tomi Valkeinen wrote:
> recommended_bpp hasn't been used for ages, remove the code.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  1 -
>  drivers/gpu/drm/omapdrm/dss/display.c   | 33 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  2 --
>  3 files changed, 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index
> ac5800c72cb4..1fbbe4c4bce6 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -1117,7 +1117,6 @@ static struct omap_dss_driver dsicm_ops = {
>   .sync   = dsicm_sync,
> 
>   .get_resolution = dsicm_get_resolution,
> - .get_recommended_bpp = omapdss_default_get_recommended_bpp,
> 
>   .enable_te  = dsicm_enable_te,
>   .get_te = dsicm_get_te,
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c
> b/drivers/gpu/drm/omapdrm/dss/display.c index ac2e297e7e1b..10c36539d8ee
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -38,37 +38,6 @@ void omapdss_default_get_resolution(struct
> omap_dss_device *dssdev, }
>  EXPORT_SYMBOL(omapdss_default_get_resolution);
> 
> -int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev)
> -{
> - switch (dssdev->type) {
> - case OMAP_DISPLAY_TYPE_DPI:
> - if (dssdev->phy.dpi.data_lines == 24)
> - return 24;
> - else
> - return 16;
> -
> - case OMAP_DISPLAY_TYPE_DBI:
> - if (dssdev->ctrl.pixel_size == 24)
> - return 24;
> - else
> - return 16;
> - case OMAP_DISPLAY_TYPE_DSI:
> - if (dssdev->panel.dsi_pix_fmt == OMAP_DSS_DSI_FMT_RGB565)
> - return 16;
> - else
> - return 24;
> - case OMAP_DISPLAY_TYPE_VENC:
> - case OMAP_DISPLAY_TYPE_SDI:
> - case OMAP_DISPLAY_TYPE_HDMI:
> - case OMAP_DISPLAY_TYPE_DVI:
> - return 24;
> - default:
> - BUG();
> - return 0;
> - }
> -}
> -EXPORT_SYMBOL(omapdss_default_get_recommended_bpp);
> -
>  void omapdss_default_get_timings(struct omap_dss_device *dssdev,
>struct videomode *vm)
>  {
> @@ -104,8 +73,6 @@ int omapdss_register_display(struct omap_dss_device
> *dssdev)
> 
>   if (drv && drv->get_resolution == NULL)
>   drv->get_resolution = omapdss_default_get_resolution;
> - if (drv && drv->get_recommended_bpp == NULL)
> - drv->get_recommended_bpp = 
omapdss_default_get_recommended_bpp;
>   if (drv && drv->get_timings == NULL)
>   drv->get_timings = omapdss_default_get_timings;
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index abdb332019e9..47f0205809a1
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -730,7 +730,6 @@ struct omap_dss_driver {
>   u16 *xres, u16 *yres);
>   void (*get_dimensions)(struct omap_dss_device *dssdev,
>   u32 *width, u32 *height);
> - int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
> 
>   int (*check_timings)(struct omap_dss_device *dssdev,
>struct videomode *vm);
> @@ -792,7 +791,6 @@ struct omap_overlay_manager
> *omapdss_find_mgr_from_display(struct omap_dss_devic
> 
>  void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
>   u16 *xres, u16 *yres);
> -int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
>  void omapdss_default_get_timings(struct omap_dss_device *dssdev,
>struct videomode *vm);

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 06/13] drm/omap: venc: remove set_type & invert_vid_out_polarity

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:35 Tomi Valkeinen wrote:
> Non-DT booting is no longer supported, so remove legacy code.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c | 10 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 --
>  drivers/gpu/drm/omapdrm/dss/venc.c| 23 ---
>  3 files changed, 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c index
> f7a5731492d0..b1f6aa09f699 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -157,14 +157,6 @@ static int opa362_check_timings(struct omap_dss_device
> *dssdev, return in->ops.atv->check_timings(in, vm);
>  }
> 
> -static void opa362_set_type(struct omap_dss_device *dssdev,
> - enum omap_dss_venc_type type)
> -{
> - /* we can only drive a COMPOSITE output */
> - WARN_ON(type != OMAP_DSS_VENC_TYPE_COMPOSITE);
> -
> -}
> -
>  static const struct omapdss_atv_ops opa362_atv_ops = {
>   .connect= opa362_connect,
>   .disconnect = opa362_disconnect,
> @@ -175,8 +167,6 @@ static const struct omapdss_atv_ops opa362_atv_ops = {
>   .check_timings  = opa362_check_timings,
>   .set_timings= opa362_set_timings,
>   .get_timings= opa362_get_timings,
> -
> - .set_type   = opa362_set_type,
>  };
> 
>  static int opa362_probe(struct platform_device *pdev)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 1ce53b072b16..abdb332019e9
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -525,11 +525,6 @@ struct omapdss_atv_ops {
>   void (*get_timings)(struct omap_dss_device *dssdev,
>   struct videomode *vm);
> 
> - void (*set_type)(struct omap_dss_device *dssdev,
> - enum omap_dss_venc_type type);
> - void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
> - bool invert_polarity);
> -
>   int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
>   u32 (*get_wss)(struct omap_dss_device *dssdev);
>  };
> @@ -642,11 +637,6 @@ struct omap_dss_device {
>   struct {
>   int module;
>   } dsi;
> -
> - struct {
> - enum omap_dss_venc_type type;
> - bool invert_polarity;
> - } venc;
>   } phy;
> 
>   struct {
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c
> b/drivers/gpu/drm/omapdrm/dss/venc.c index 8e836fddc390..a6bfb3918b8d
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -616,26 +616,6 @@ static int venc_set_wss(struct omap_dss_device *dssdev,
> u32 wss) return r;
>  }
> 
> -static void venc_set_type(struct omap_dss_device *dssdev,
> - enum omap_dss_venc_type type)
> -{
> - mutex_lock(_lock);
> -
> - venc.type = type;
> -
> - mutex_unlock(_lock);
> -}
> -
> -static void venc_invert_vid_out_polarity(struct omap_dss_device *dssdev,
> - bool invert_polarity)
> -{
> - mutex_lock(_lock);
> -
> - venc.invert_polarity = invert_polarity;
> -
> - mutex_unlock(_lock);
> -}
> -
>  static int venc_init_regulator(void)
>  {
>   struct regulator *vdda_dac;
> @@ -779,9 +759,6 @@ static const struct omapdss_atv_ops venc_ops = {
>   .set_timings = venc_set_timings,
>   .get_timings = venc_get_timings,
> 
> - .set_type = venc_set_type,
> - .invert_vid_out_polarity = venc_invert_vid_out_polarity,
> -
>   .set_wss = venc_set_wss,
>   .get_wss = venc_get_wss,
>  };

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 05/13] drm/omap: sdi: remove legacy set_datapairs

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:34 Tomi Valkeinen wrote:
> Non-DT booting is no longer supported, so remove legacy code.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 --
>  drivers/gpu/drm/omapdrm/dss/sdi.c | 7 ---
>  2 files changed, 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 8396036e210c..1ce53b072b16
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -490,8 +490,6 @@ struct omapdss_sdi_ops {
>   struct videomode *vm);
>   void (*get_timings)(struct omap_dss_device *dssdev,
>   struct videomode *vm);
> -
> - void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
>  };
> 
>  struct omapdss_dvi_ops {
> @@ -642,10 +640,6 @@ struct omap_dss_device {
>   } rfbi;
> 
>   struct {
> - u8 datapairs;
> - } sdi;
> -
> - struct {
>   int module;
>   } dsi;
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c
> b/drivers/gpu/drm/omapdrm/dss/sdi.c index f2f8aed53a7b..d18ad58c5a19 100644
> --- a/drivers/gpu/drm/omapdrm/dss/sdi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
> @@ -252,11 +252,6 @@ static int sdi_check_timings(struct omap_dss_device
> *dssdev, return 0;
>  }
> 
> -static void sdi_set_datapairs(struct omap_dss_device *dssdev, int
> datapairs) -{
> - sdi.datapairs = datapairs;
> -}
> -
>  static int sdi_init_regulator(void)
>  {
>   struct regulator *vdds_sdi;
> @@ -326,8 +321,6 @@ static const struct omapdss_sdi_ops sdi_ops = {
>   .check_timings = sdi_check_timings,
>   .set_timings = sdi_set_timings,
>   .get_timings = sdi_get_timings,
> -
> - .set_datapairs = sdi_set_datapairs,
>  };
> 
>  static void sdi_init_output(struct platform_device *pdev)

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 04/13] drm/omap: connector-dvi/hdmi: remove extra include

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:33 Tomi Valkeinen wrote:
> Remove extra includes related to non-DT boot.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c  | 1 -
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index
> d6875d9fcefa..8720b2dcb316 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -15,7 +15,6 @@
>  #include 
> 
>  #include 
> -#include 
> 
>  #include "../dss/omapdss.h"
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c index
> 1ef130641bae..555e193c9732 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -17,7 +17,6 @@
>  #include 
> 
>  #include 
> -#include 
> 
>  #include "../dss/omapdss.h"

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 02/13] drm/omap: acx565akm: remove non-DT support

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:31 Tomi Valkeinen wrote:
> Non-DT booting is no longer supported, so remove legacy code.
> 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../drm/omapdrm/displays/panel-sony-acx565akm.c| 50 +++
>  1 file changed, 6 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c index
> 5ab39e0060f2..be368868f77f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
> @@ -32,8 +32,6 @@
>  #include 
>  #include 

Slightly out of scope for this patch, it would be nice to convert the driver 
to gpiod.

> 
> -#include 
> -
>  #include "../dss/omapdss.h"
> 
>  #define MIPID_CMD_READ_DISP_ID   0x04
> @@ -69,7 +67,6 @@ struct panel_drv_data {
>   struct omap_dss_device *in;
> 
>   int reset_gpio;
> - int datapairs;
> 
>   struct videomode vm;
> 
> @@ -547,9 +544,6 @@ static int acx565akm_panel_power_on(struct
> omap_dss_device *dssdev)
> 
>   in->ops.sdi->set_timings(in, >vm);
> 
> - if (ddata->datapairs > 0)
> - in->ops.sdi->set_datapairs(in, ddata->datapairs);
> -
>   r = in->ops.sdi->enable(in);
>   if (r) {
>   pr_err("%s sdi enable failed\n", __func__);
> @@ -701,32 +695,6 @@ static struct omap_dss_driver acx565akm_ops = {
>   .get_resolution = omapdss_default_get_resolution,
>  };
> 
> -static int acx565akm_probe_pdata(struct spi_device *spi)
> -{
> - const struct panel_acx565akm_platform_data *pdata;
> - struct panel_drv_data *ddata = dev_get_drvdata(>dev);
> - struct omap_dss_device *dssdev, *in;
> -
> - pdata = dev_get_platdata(>dev);
> -
> - ddata->reset_gpio = pdata->reset_gpio;
> -
> - in = omap_dss_find_output(pdata->source);
> - if (in == NULL) {
> - dev_err(>dev, "failed to find video source '%s'\n",
> - pdata->source);
> - return -EPROBE_DEFER;
> - }
> - ddata->in = in;
> -
> - ddata->datapairs = pdata->datapairs;
> -
> - dssdev = >dssdev;
> - dssdev->name = pdata->name;
> -
> - return 0;
> -}
> -
>  static int acx565akm_probe_of(struct spi_device *spi)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(>dev);
> @@ -754,6 +722,9 @@ static int acx565akm_probe(struct spi_device *spi)
> 
>   dev_dbg(>dev, "%s\n", __func__);
> 
> + if (!spi->dev.of_node)
> + return -ENODEV;
> +

This can't happen (I won't repeat the comment for the other patches in the 
series, please take it into account where applicable).

>   spi->mode = SPI_MODE_3;
> 
>   ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
> @@ -766,18 +737,9 @@ static int acx565akm_probe(struct spi_device *spi)
> 
>   mutex_init(>mutex);
> 
> - if (dev_get_platdata(>dev)) {
> - r = acx565akm_probe_pdata(spi);
> - if (r)
> - return r;
> - } else if (spi->dev.of_node) {
> - r = acx565akm_probe_of(spi);
> - if (r)
> - return r;
> - } else {
> - dev_err(>dev, "platform data missing!\n");
> - return -ENODEV;
> - }
> + r = acx565akm_probe_of(spi);
> + if (r)
> + return r;
> 
>   if (gpio_is_valid(ddata->reset_gpio)) {
>   r = devm_gpio_request_one(>dev, ddata->reset_gpio,

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 01/13] drm/omap: panel-dpi: remove non-DT support

2017-05-12 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Friday 12 May 2017 13:41:30 Tomi Valkeinen wrote:
> Non-DT booting is no longer supported, so remove legacy code.
> 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++--
>  1 file changed, 6 insertions(+), 72 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index
> 04ce8c5f2954..75b98bb81de2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -18,7 +18,6 @@

I think you can drop linux/of_gpio.h.

>  #include 
>  #include 
> 
> -#include 
>  #include 
> 
>  #include "../dss/omapdss.h"
> @@ -33,9 +32,6 @@ struct panel_drv_data {
> 
>   struct backlight_device *backlight;
> 
> - /* used for non-DT boot, to be removed */
> - int backlight_gpio;
> -
>   struct gpio_desc *enable_gpio;
>   struct regulator *vcc_supply;
>  };
> @@ -97,9 +93,6 @@ static int panel_dpi_enable(struct omap_dss_device
> *dssdev)
> 
>   gpiod_set_value_cansleep(ddata->enable_gpio, 1);
> 
> - if (gpio_is_valid(ddata->backlight_gpio))
> - gpio_set_value_cansleep(ddata->backlight_gpio, 1);
> -
>   if (ddata->backlight) {
>   ddata->backlight->props.power = FB_BLANK_UNBLANK;
>   backlight_update_status(ddata->backlight);
> @@ -118,9 +111,6 @@ static void panel_dpi_disable(struct omap_dss_device
> *dssdev) if (!omapdss_device_is_enabled(dssdev))
>   return;
> 
> - if (gpio_is_valid(ddata->backlight_gpio))
> - gpio_set_value_cansleep(ddata->backlight_gpio, 0);
> -
>   if (ddata->backlight) {
>   ddata->backlight->props.power = FB_BLANK_POWERDOWN;
>   backlight_update_status(ddata->backlight);
> @@ -177,47 +167,6 @@ static struct omap_dss_driver panel_dpi_ops = {
>   .get_resolution = omapdss_default_get_resolution,
>  };
> 
> -static int panel_dpi_probe_pdata(struct platform_device *pdev)
> -{
> - const struct panel_dpi_platform_data *pdata;
> - struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> - struct omap_dss_device *dssdev, *in;
> - int r;
> -
> - pdata = dev_get_platdata(>dev);
> -
> - in = omap_dss_find_output(pdata->source);
> - if (in == NULL) {
> - dev_err(>dev, "failed to find video source '%s'\n",
> - pdata->source);
> - return -EPROBE_DEFER;
> - }
> -
> - ddata->in = in;
> -
> - ddata->data_lines = pdata->data_lines;
> -
> - videomode_from_timing(pdata->display_timing, >vm);
> -
> - dssdev = >dssdev;
> - dssdev->name = pdata->name;
> -
> - r = devm_gpio_request_one(>dev, pdata->enable_gpio,
> - GPIOF_OUT_INIT_LOW, "panel enable");
> - if (r)
> - goto err_gpio;
> -
> - ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio);
> -
> - ddata->backlight_gpio = pdata->backlight_gpio;
> -
> - return 0;
> -
> -err_gpio:
> - omap_dss_put_device(ddata->in);
> - return r;
> -}
> -
>  static int panel_dpi_probe_of(struct platform_device *pdev)
>  {
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
> @@ -248,8 +197,6 @@ static int panel_dpi_probe_of(struct platform_device
> *pdev) if (IS_ERR(ddata->vcc_supply))
>   return PTR_ERR(ddata->vcc_supply);
> 
> - ddata->backlight_gpio = -ENOENT;
> -
>   bl_node = of_parse_phandle(node, "backlight", 0);
>   if (bl_node) {
>   ddata->backlight = of_find_backlight_by_node(bl_node);
> @@ -291,30 +238,18 @@ static int panel_dpi_probe(struct platform_device
> *pdev) struct omap_dss_device *dssdev;
>   int r;
> 
> + if (!pdev->dev.of_node)
> + return -ENODEV;
> +

This can't happen.

>   ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
>   if (ddata == NULL)
>   return -ENOMEM;
> 
>   platform_set_drvdata(pdev, ddata);
> 
> - if (dev_get_platdata(>dev)) {
> - r = panel_dpi_probe_pdata(pdev);
> - if (r)
> - return r;
> - } else if (pdev->dev.of_node) {
> - r = panel_dpi_probe_of(pdev);
> - if (r)
> - return r;
> - } else {
> - return -ENODEV;
> - }
> -
> - if (gpio_is_valid(ddata->backlight_gpio)) {
> - r = devm_gpio_request_one(>dev, ddata->backlight_gpio,
> - GPIOF_OUT_INIT_LOW, "panel backlight");
> - if (r)
> - goto err_gpio;
> - }
> + r = panel_dpi_probe_of(pdev);
> + if (r)
> + return r;
> 
>   dssdev = >dssdev;
>   dssdev->dev = >dev;
> @@ -333,7 +268,6 @@ static int panel_dpi_probe(struct platform_device *pdev)
> return 0;
> 
>  err_reg:
> -err_gpio:
>   omap_dss_put_device(ddata->in);
>   return 

[Bug 101003] segfault with ideas test of glmark2

2017-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101003

--- Comment #4 from José Jorge  ---
Created attachment 131335
  --> https://bugs.freedesktop.org/attachment.cgi?id=131335=edit
Backtrace with mesa 17.1.0

I could update to mesa 17.1.0, so I did this backtrace with it.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/3] GPU-DRM-Radeon: Fine-tuning for three function implementations

2017-05-12 Thread Laurent Pinchart
Hi Christian,

On Wednesday 10 May 2017 13:30:37 Christian König wrote:
> Am 10.05.2017 um 02:23 schrieb Michel Dänzer:
> > On 03/05/17 09:46 PM, Christian König wrote:
> >> Am 02.05.2017 um 22:04 schrieb SF Markus Elfring:
> >>> From: Markus Elfring 
> >>> Date: Tue, 2 May 2017 22:00:02 +0200
> >>> 
> >>> Three update suggestions were taken into account
> >>> from static source code analysis.
> >>> 
> >>> Markus Elfring (3):
> >>> Use seq_putc() in radeon_sa_bo_dump_debug_info()
> >>> Use seq_puts() in radeon_debugfs_pm_info()
> >>> Use seq_puts() in r100_debugfs_cp_csq_fifo()
> >> 
> >> Reviewed-by: Christian König 
> > 
> > Based on
> > https://lists.freedesktop.org/archives/dri-devel/2017-May/140837.html
> > and followups, I'm afraid we'll have to make sure Markus' patches have
> > been tested adequately before applying them.
> 
> I can't judge the background of that decision, but at least those tree
> patches for radeon looked trivial to me.
> 
> I don't see much what could go wrong when merging them.

For what it's worth, I've once applied a patch from Markus for the uvcvideo 
driver that seemed trivial but ended up introducing a breakage that I hadn't 
caught during review. I recommend rejecting Markus' patches that are not clear 
improvements, and carefully testing the others.

> On the other hand you are right that trying to find hardware to test that
> stuff could be challenging.

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] dma-buf/sync-file: Defer creation of sync_file->name

2017-05-12 Thread Chris Wilson
Constructing the name takes the majority of the time for allocating a
sync_file to wrap a fence, and the name is very rarely used (only via
the sync_file status user interface). To reduce the impact on the common
path (that of creating sync_file to pass around), defer the construction
of the name until it is first used.

Signed-off-by: Chris Wilson 
Cc: Sumit Semwal 
Cc: Gustavo Padovan 
---
 drivers/dma-buf/sync_file.c | 18 +++---
 include/linux/sync_file.h   |  2 +-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 2321035f6204..2cccfa834778 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -82,11 +82,6 @@ struct sync_file *sync_file_create(struct dma_fence *fence)
 
sync_file->fence = dma_fence_get(fence);
 
-   snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d",
-fence->ops->get_driver_name(fence),
-fence->ops->get_timeline_name(fence), fence->context,
-fence->seqno);
-
return sync_file;
 }
 EXPORT_SYMBOL(sync_file_create);
@@ -268,7 +263,7 @@ static struct sync_file *sync_file_merge(const char *name, 
struct sync_file *a,
goto err;
}
 
-   strlcpy(sync_file->name, name, sizeof(sync_file->name));
+   strlcpy(sync_file->user_name, name, sizeof(sync_file->user_name));
return sync_file;
 
 err:
@@ -422,7 +417,16 @@ static long sync_file_ioctl_fence_info(struct sync_file 
*sync_file,
}
 
 no_fences:
-   strlcpy(info.name, sync_file->name, sizeof(info.name));
+   if (!sync_file->user_name[0]) {
+   scnprintf(sync_file->user_name,
+ sizeof(sync_file->user_name),
+ "%s-%s%llu-%d",
+ 
sync_file->fence->ops->get_driver_name(sync_file->fence),
+ 
sync_file->fence->ops->get_timeline_name(sync_file->fence),
+ sync_file->fence->context,
+ sync_file->fence->seqno);
+   }
+   strlcpy(info.name, sync_file->user_name, sizeof(info.name));
info.status = dma_fence_is_signaled(sync_file->fence);
info.num_fences = num_fences;
 
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
index 3e3ab84fc4cd..0cbeff29f510 100644
--- a/include/linux/sync_file.h
+++ b/include/linux/sync_file.h
@@ -34,7 +34,7 @@
 struct sync_file {
struct file *file;
struct kref kref;
-   charname[32];
+   charuser_name[32];
 #ifdef CONFIG_DEBUG_FS
struct list_headsync_file_list;
 #endif
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: Add crtc/encoder/bridge->mode_valid() callbacks

2017-05-12 Thread Laurent Pinchart
Hi Daniel,

On Friday 12 May 2017 09:31:00 Daniel Vetter wrote:
> From: Jose Abreu 
> 
> This adds a new callback to crtc, encoder and bridge helper functions
> called mode_valid(). This callback shall be implemented if the
> corresponding component has some sort of restriction in the modes
> that can be displayed. A NULL callback implicates that the component
> can display all the modes.
> 
> We also change the documentation so that the new and old callbacks
> are correctly documented.
> 
> Only the callbacks were implemented to simplify review process,
> following patches will make use of them.
> 
> Changes in v2 from Daniel:
> - Update the warning about how modes aren't filtered in atomic_check -
>   the heleprs help out a lot more now.
> - Consistenly roll out that warning, crtc/encoder's atomic_check
>   missed it.
> - Sprinkle more links all over the place, so it's easier to see where
>   this stuff is used and how the differen hooks are related.
> - Note that ->mode_valid is optional everywhere.
> - Explain why the connector's mode_valid is special and does _not_ get
>   called in atomic_check.

As commented on v2 (but after you sent this patch), I think we need to 
document clearly how mode_valid and mode_fixup should interact. It's very 
confusing for driver authors at the moment.

> Signed-off-by: Jose Abreu 
> Cc: Jose Abreu 
> Cc: Carlos Palminha 
> Cc: Alexey Brodkin 
> Cc: Ville Syrjälä 
> Cc: Daniel Vetter 
> Cc: Dave Airlie 
> Cc: Andrzej Hajda 
> Cc: Archit Taneja 
> Signed-off-by: Daniel Vetter  (v2)
> ---
>  include/drm/drm_bridge.h |  31 +
>  include/drm/drm_modeset_helper_vtables.h | 116
> ++- 2 files changed, 114 insertions(+), 33
> deletions(-)
> 
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index fdd82fcbf168..f694de756ecf 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -59,6 +59,31 @@ struct drm_bridge_funcs {
>   void (*detach)(struct drm_bridge *bridge);
> 
>   /**
> +  * @mode_valid:
> +  *
> +  * This callback is used to check if a specific mode is valid in this
> +  * bridge. This should be implemented if the bridge has some sort of
> +  * restriction in the modes it can display. For example, a given 
bridge
> +  * may be responsible to set a clock value. If the clock can not
> +  * produce all the values for the available modes then this callback
> +  * can be used to restrict the number of modes to only the ones that
> +  * can be displayed.
> +  *
> +  * This hook is used by the probe helpers to filter the mode list in
> +  * drm_helper_probe_single_connector_modes(), and it is used by the
> +  * atomic helpers to validate modes supplied by userspace in
> +  * drm_atomic_helper_check_modeset().
> +  *
> +  * This function is optional.
> +  *
> +  * RETURNS:
> +  *
> +  * drm_mode_status Enum
> +  */
> + enum drm_mode_status (*mode_valid)(struct drm_bridge *crtc,
> +const struct drm_display_mode 
*mode);
> +
> + /**
>* @mode_fixup:
>*
>* This callback is used to validate and adjust a mode. The paramater
> @@ -82,6 +107,12 @@ struct drm_bridge_funcs {
>* NOT touch any persistent state (hardware or software) or data
>* structures except the passed in @state parameter.
>*
> +  * Also beware that userspace can request its own custom modes, 
neither
> +  * core nor helpers filter modes to the list of probe modes reported 
by
> +  * the GETCONNECTOR IOCTL and stored in _connector.modes. To 
ensure
> +  * that modes are filtered consistently put any bridge constraints and
> +  * limits checks into @mode_valid.
> +  *
>* RETURNS:
>*
>* True if an acceptable configuration is possible, false if the 
modeset
> diff --git a/include/drm/drm_modeset_helper_vtables.h
> b/include/drm/drm_modeset_helper_vtables.h index c01c328f6cc8..91d071ff1232
> 100644
> --- a/include/drm/drm_modeset_helper_vtables.h
> +++ b/include/drm/drm_modeset_helper_vtables.h
> @@ -106,6 +106,31 @@ struct drm_crtc_helper_funcs {
>   void (*commit)(struct drm_crtc *crtc);
> 
>   /**
> +  * @mode_valid:
> +  *
> +  * This callback is used to check if a specific mode is valid in this
> +  * crtc. This should be implemented if the crtc has some sort of
> +  * restriction in the modes it can display. For example, a given crtc
> +  * may be responsible to set a clock value. If the clock can not
> +  * produce all the values for the available modes then this callback
> +  * can be used to 

Re: [PATCH 1/4] drm/vc4: Adjust modes in DSI to work around the integer PLL divider.

2017-05-12 Thread Noralf Trønnes


Den 12.05.2017 01.56, skrev Eric Anholt:

BCM2835's PLLD_DSI1 divider doesn't give us many choices for our pixel
clocks, so to support panels on the Raspberry Pi we need to set a
higher pixel clock rate than requested and adjust the mode we program
to extend out the HFP so that the refresh rate matches.

Signed-off-by: Eric Anholt 
---
  drivers/gpu/drm/vc4/vc4_dsi.c | 112 --
  1 file changed, 86 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index fb54a9d10360..62cb3b0d0345 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -519,7 +519,8 @@ struct vc4_dsi {
/* DSI channel for the panel we're connected to. */
u32 channel;
u32 lanes;
-   enum mipi_dsi_pixel_format format;
+   u32 format;
+   u32 divider;
u32 mode_flags;
  
  	/* Input clock from CPRMAN to the digital PHY, for the DSI

@@ -817,13 +818,67 @@ static void vc4_dsi_encoder_disable(struct drm_encoder 
*encoder)
pm_runtime_put(dev);
  }
  
+/* Extends the mode's blank intervals to handle BCM2835's integer-only

+ * DSI PLL divider.
+ *
+ * On 2835, PLLD is set to 2Ghz, and may not be changed by the display
+ * driver since most peripherals are hanging off of the PLLD_PER
+ * divider.  PLLD_DSI1, which drives our DSI bit clock (and therefore
+ * the pixel clock), only has an integer divider off of DSI.
+ *
+ * To get our panel mode to refresh at the expected 60Hz, we need to
+ * extend the horizontal blank time.  This means we drive a
+ * higher-than-expected clock rate to the panel, but that's what the
+ * firmware (which ) does too.


Something missing in the comment here.

Noralf.


+ */
+static bool vc4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
+  const struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted_mode)
+{
+   struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
+   struct vc4_dsi *dsi = vc4_encoder->dsi;
+   struct clk *phy_parent = clk_get_parent(dsi->pll_phy_clock);
+   unsigned long parent_rate = clk_get_rate(phy_parent);
+   unsigned long pixel_clock_hz = mode->clock * 1000;
+   unsigned long pll_clock = pixel_clock_hz * dsi->divider;
+   int divider;
+
+   /* Find what divider gets us a faster clock than the requested
+* pixel clock.
+*/
+   for (divider = 1; divider < 8; divider++) {
+   if (parent_rate / divider < pll_clock) {
+   divider--;
+   break;
+   }
+   }
+
+   /* Now that we've picked a PLL divider, calculate back to its
+* pixel clock.
+*/
+   pll_clock = parent_rate / divider;
+   pixel_clock_hz = pll_clock / dsi->divider;
+
+   /* Round up the clk_set_rate() request slightly, since
+* PLLD_DSI1 is an integer divider and its rate selection will
+* never round up.
+*/
+   adjusted_mode->clock = pixel_clock_hz / 1000 + 1;
+
+   /* Given the new pixel clock, adjust HFP to keep vrefresh the same. */
+   adjusted_mode->htotal = pixel_clock_hz / (mode->vrefresh * 
mode->vtotal);
+   adjusted_mode->hsync_end += adjusted_mode->htotal - mode->htotal;
+   adjusted_mode->hsync_start += adjusted_mode->htotal - mode->htotal;
+
+   return true;
+}
+
  static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
  {
-   struct drm_display_mode *mode = >crtc->mode;
+   struct drm_display_mode *mode = >crtc->state->adjusted_mode;
struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
struct vc4_dsi *dsi = vc4_encoder->dsi;
struct device *dev = >pdev->dev;
-   u32 format = 0, divider = 0;
bool debug_dump_regs = false;
unsigned long hs_clock;
u32 ui_ns;
@@ -845,26 +900,7 @@ static void vc4_dsi_encoder_enable(struct drm_encoder 
*encoder)
vc4_dsi_dump_regs(dsi);
}
  
-	switch (dsi->format) {

-   case MIPI_DSI_FMT_RGB888:
-   format = DSI_PFORMAT_RGB888;
-   divider = 24 / dsi->lanes;
-   break;
-   case MIPI_DSI_FMT_RGB666:
-   format = DSI_PFORMAT_RGB666;
-   divider = 24 / dsi->lanes;
-   break;
-   case MIPI_DSI_FMT_RGB666_PACKED:
-   format = DSI_PFORMAT_RGB666_PACKED;
-   divider = 18 / dsi->lanes;
-   break;
-   case MIPI_DSI_FMT_RGB565:
-   format = DSI_PFORMAT_RGB565;
-   divider = 16 / dsi->lanes;
-   break;
-   }
-
-   phy_clock = pixel_clock_hz * divider;
+   phy_clock = pixel_clock_hz * dsi->divider;
ret = clk_set_rate(dsi->pll_phy_clock, phy_clock);
if (ret) {
dev_err(>pdev->dev,
@@ -1049,8 +1085,9 @@ static void 

Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid()

2017-05-12 Thread Laurent Pinchart
Hi Archit,

On Friday 12 May 2017 16:20:07 Archit Taneja wrote:
> On 05/12/2017 03:08 PM, Laurent Pinchart wrote:
> > On Wednesday 10 May 2017 17:14:33 Daniel Vetter wrote:
> >> On Wed, May 10, 2017 at 04:41:09PM +0300, Ville Syrjälä wrote:
> >>> On Tue, May 09, 2017 at 06:00:13PM +0100, Jose Abreu wrote:
>  Introduce a new helper function which calls mode_valid() callback
>  for all bridges in an encoder chain.
>  
>  Signed-off-by: Jose Abreu 
>  Cc: Carlos Palminha 
>  Cc: Alexey Brodkin 
>  Cc: Ville Syrjälä 
>  Cc: Daniel Vetter 
>  Cc: Dave Airlie 
>  Cc: Andrzej Hajda 
>  Cc: Archit Taneja 
>  ---
>  
>   drivers/gpu/drm/drm_bridge.c | 33 +
>   include/drm/drm_bridge.h |  2 ++
>   2 files changed, 35 insertions(+)
>  
>  diff --git a/drivers/gpu/drm/drm_bridge.c
>  b/drivers/gpu/drm/drm_bridge.c
>  index 86a7637..dc8cdfe 100644
>  --- a/drivers/gpu/drm/drm_bridge.c
>  +++ b/drivers/gpu/drm/drm_bridge.c
>  @@ -206,6 +206,39 @@ bool drm_bridge_mode_fixup(struct drm_bridge
>  *bridge,
>  
>   EXPORT_SYMBOL(drm_bridge_mode_fixup);
>   
>   /**
>  
>  + * drm_bridge_mode_valid - validate the mode against all bridges in
>  the
>  + * encoder chain.
>  + * @bridge: bridge control structure
>  + * @mode: desired mode to be validated
>  + *
>  + * Calls _bridge_funcs.mode_valid for all the bridges in the
>  encoder
>  + * chain, starting from the first bridge to the last. If at least one
>  bridge + * does not accept the mode the function returns the error
>  code.
>  + *
>  + * Note: the bridge passed should be the one closest to the encoder.
>  + *
>  + * RETURNS:
>  + * MODE_OK on success, drm_mode_status Enum error code on failure
>  + */
>  +enum drm_mode_status drm_bridge_mode_valid(struct drm_bridge *bridge,
>  +   const struct 
drm_display_mode
> > 
> > *mode)
> > 
>  +{
>  +enum drm_mode_status ret = MODE_OK;
>  +
>  +if (!bridge)
>  +return ret;
>  +
>  +if (bridge->funcs->mode_valid)
>  +ret = bridge->funcs->mode_valid(bridge, mode);
>  +
>  +if (ret != MODE_OK)
>  +return ret;
>  +
>  +return drm_bridge_mode_valid(bridge->next, mode);
> >>> 
> >>> Looks like it should be pretty trivial to avoid the recursion.
> >>> 
> >>> Am I correct in interpreting this that bridges have some kind of
> >>> a hand rolled linked list implementation? Reusing the standard
> >>> linked lists would allow you to use list_for_each() etc.
> >> 
> >> Yeah it's a hand-rolled list, but current hw also has a bridge nesting
> >> depth of 2, so it really doesn't matter. I guess once we have real long
> >> chains of bridges we can fix this (and just using list_head sounds like a
> >> great idea).
> > 
> > Even if not really needed right now, it's a pretty easy cleanup, if Jose
> > has time to handle it in v3 of this series let's not postpone it ;-)
> 
> jfyi, some of the bridge functions call the ops from the last bridge in the
> chain to first, so we'd need to use list_for_each_entry_prev() (or something
> like that) for them.

And now that I think about it, for some of the operations (especially 
enable/disable) I believe that the bridge should be able to decide whether to 
call the next/previous bridge first or to configure its hardware first. I can 
image bridges that need the previous bridge in the chain to provide a valid 
clock before they get started, as well as bridges that need to be started with 
the incoming video signal stopped.

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid()

2017-05-12 Thread Archit Taneja



On 05/12/2017 03:08 PM, Laurent Pinchart wrote:

Hi Daniel,

On Wednesday 10 May 2017 17:14:33 Daniel Vetter wrote:

On Wed, May 10, 2017 at 04:41:09PM +0300, Ville Syrjälä wrote:

On Tue, May 09, 2017 at 06:00:13PM +0100, Jose Abreu wrote:

Introduce a new helper function which calls mode_valid() callback
for all bridges in an encoder chain.

Signed-off-by: Jose Abreu 
Cc: Carlos Palminha 
Cc: Alexey Brodkin 
Cc: Ville Syrjälä 
Cc: Daniel Vetter 
Cc: Dave Airlie 
Cc: Andrzej Hajda 
Cc: Archit Taneja 
---

 drivers/gpu/drm/drm_bridge.c | 33 +
 include/drm/drm_bridge.h |  2 ++
 2 files changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 86a7637..dc8cdfe 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -206,6 +206,39 @@ bool drm_bridge_mode_fixup(struct drm_bridge
*bridge,

 EXPORT_SYMBOL(drm_bridge_mode_fixup);

 /**

+ * drm_bridge_mode_valid - validate the mode against all bridges in the
+ *encoder chain.
+ * @bridge: bridge control structure
+ * @mode: desired mode to be validated
+ *
+ * Calls _bridge_funcs.mode_valid for all the bridges in the
encoder
+ * chain, starting from the first bridge to the last. If at least one
bridge + * does not accept the mode the function returns the error
code.
+ *
+ * Note: the bridge passed should be the one closest to the encoder.
+ *
+ * RETURNS:
+ * MODE_OK on success, drm_mode_status Enum error code on failure
+ */
+enum drm_mode_status drm_bridge_mode_valid(struct drm_bridge *bridge,
+  const struct drm_display_mode

*mode)

+{
+   enum drm_mode_status ret = MODE_OK;
+
+   if (!bridge)
+   return ret;
+
+   if (bridge->funcs->mode_valid)
+   ret = bridge->funcs->mode_valid(bridge, mode);
+
+   if (ret != MODE_OK)
+   return ret;
+
+   return drm_bridge_mode_valid(bridge->next, mode);


Looks like it should be pretty trivial to avoid the recursion.

Am I correct in interpreting this that bridges have some kind of
a hand rolled linked list implementation? Reusing the standard
linked lists would allow you to use list_for_each() etc.


Yeah it's a hand-rolled list, but current hw also has a bridge nesting
depth of 2, so it really doesn't matter. I guess once we have real long
chains of bridges we can fix this (and just using list_head sounds like a
great idea).


Even if not really needed right now, it's a pretty easy cleanup, if Jose has
time to handle it in v3 of this series let's not postpone it ;-)


jfyi, some of the bridge functions call the ops from the last bridge in the
chain to first, so we'd need to use list_for_each_entry_prev() (or something
like that) for them.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 11/13] drm/omap: remove legacy get_resolution

2017-05-12 Thread Tomi Valkeinen
get_resolution is not used, remove it.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c  |  2 --
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c|  2 --
 drivers/gpu/drm/omapdrm/displays/connector-hdmi.c   |  2 --
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c|  2 --
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  9 -
 drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c |  2 --
 drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c |  2 --
 drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  |  2 --
 drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c |  2 --
 drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c |  2 --
 drivers/gpu/drm/omapdrm/dss/display.c   | 10 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  5 -
 12 files changed, 42 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index 8453b1103abd..542a76503fbd 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -171,8 +171,6 @@ static struct omap_dss_driver tvc_driver = {
.get_timings= tvc_get_timings,
.check_timings  = tvc_check_timings,
 
-   .get_resolution = omapdss_default_get_resolution,
-
.get_wss= tvc_get_wss,
.set_wss= tvc_set_wss,
 };
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index 8720b2dcb316..05fa24a518c8 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -227,8 +227,6 @@ static struct omap_dss_driver dvic_driver = {
.get_timings= dvic_get_timings,
.check_timings  = dvic_check_timings,
 
-   .get_resolution = omapdss_default_get_resolution,
-
.read_edid  = dvic_read_edid,
.detect = dvic_detect,
 };
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index 555e193c9732..79cb69f1acf5 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -195,8 +195,6 @@ static struct omap_dss_driver hdmic_driver = {
.get_timings= hdmic_get_timings,
.check_timings  = hdmic_check_timings,
 
-   .get_resolution = omapdss_default_get_resolution,
-
.read_edid  = hdmic_read_edid,
.detect = hdmic_detect,
.set_hdmi_mode  = hdmic_set_hdmi_mode,
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index cc5920b476d6..49ceed7f1d11 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -159,8 +159,6 @@ static struct omap_dss_driver panel_dpi_ops = {
.set_timings= panel_dpi_set_timings,
.get_timings= panel_dpi_get_timings,
.check_timings  = panel_dpi_check_timings,
-
-   .get_resolution = omapdss_default_get_resolution,
 };
 
 static int panel_dpi_probe_of(struct platform_device *pdev)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 1fbbe4c4bce6..76787a75a4dc 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -379,13 +379,6 @@ static const struct backlight_ops dsicm_bl_ops = {
.update_status  = dsicm_bl_update_status,
 };
 
-static void dsicm_get_resolution(struct omap_dss_device *dssdev,
-   u16 *xres, u16 *yres)
-{
-   *xres = dssdev->panel.vm.hactive;
-   *yres = dssdev->panel.vm.vactive;
-}
-
 static ssize_t dsicm_num_errors_show(struct device *dev,
struct device_attribute *attr, char *buf)
 {
@@ -1116,8 +1109,6 @@ static struct omap_dss_driver dsicm_ops = {
.update = dsicm_update,
.sync   = dsicm_sync,
 
-   .get_resolution = dsicm_get_resolution,
-
.enable_te  = dsicm_enable_te,
.get_te = dsicm_get_te,
 
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c 
b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index 451e1608a1db..c90474afaebd 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -226,8 +226,6 @@ static struct omap_dss_driver lb035q02_ops = {
.set_timings= lb035q02_set_timings,
.get_timings= lb035q02_get_timings,
.check_timings  = lb035q02_check_timings,
-
-   .get_resolution = omapdss_default_get_resolution,
 

[PATCH 07/13] drm/omap: remove recommended_bpp

2017-05-12 Thread Tomi Valkeinen
recommended_bpp hasn't been used for ages, remove the code.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  1 -
 drivers/gpu/drm/omapdrm/dss/display.c   | 33 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  2 --
 3 files changed, 36 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ac5800c72cb4..1fbbe4c4bce6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -1117,7 +1117,6 @@ static struct omap_dss_driver dsicm_ops = {
.sync   = dsicm_sync,
 
.get_resolution = dsicm_get_resolution,
-   .get_recommended_bpp = omapdss_default_get_recommended_bpp,
 
.enable_te  = dsicm_enable_te,
.get_te = dsicm_get_te,
diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
b/drivers/gpu/drm/omapdrm/dss/display.c
index ac2e297e7e1b..10c36539d8ee 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -38,37 +38,6 @@ void omapdss_default_get_resolution(struct omap_dss_device 
*dssdev,
 }
 EXPORT_SYMBOL(omapdss_default_get_resolution);
 
-int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev)
-{
-   switch (dssdev->type) {
-   case OMAP_DISPLAY_TYPE_DPI:
-   if (dssdev->phy.dpi.data_lines == 24)
-   return 24;
-   else
-   return 16;
-
-   case OMAP_DISPLAY_TYPE_DBI:
-   if (dssdev->ctrl.pixel_size == 24)
-   return 24;
-   else
-   return 16;
-   case OMAP_DISPLAY_TYPE_DSI:
-   if (dssdev->panel.dsi_pix_fmt == OMAP_DSS_DSI_FMT_RGB565)
-   return 16;
-   else
-   return 24;
-   case OMAP_DISPLAY_TYPE_VENC:
-   case OMAP_DISPLAY_TYPE_SDI:
-   case OMAP_DISPLAY_TYPE_HDMI:
-   case OMAP_DISPLAY_TYPE_DVI:
-   return 24;
-   default:
-   BUG();
-   return 0;
-   }
-}
-EXPORT_SYMBOL(omapdss_default_get_recommended_bpp);
-
 void omapdss_default_get_timings(struct omap_dss_device *dssdev,
 struct videomode *vm)
 {
@@ -104,8 +73,6 @@ int omapdss_register_display(struct omap_dss_device *dssdev)
 
if (drv && drv->get_resolution == NULL)
drv->get_resolution = omapdss_default_get_resolution;
-   if (drv && drv->get_recommended_bpp == NULL)
-   drv->get_recommended_bpp = omapdss_default_get_recommended_bpp;
if (drv && drv->get_timings == NULL)
drv->get_timings = omapdss_default_get_timings;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index abdb332019e9..47f0205809a1 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -730,7 +730,6 @@ struct omap_dss_driver {
u16 *xres, u16 *yres);
void (*get_dimensions)(struct omap_dss_device *dssdev,
u32 *width, u32 *height);
-   int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
 
int (*check_timings)(struct omap_dss_device *dssdev,
 struct videomode *vm);
@@ -792,7 +791,6 @@ struct omap_overlay_manager 
*omapdss_find_mgr_from_display(struct omap_dss_devic
 
 void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
u16 *xres, u16 *yres);
-int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
 void omapdss_default_get_timings(struct omap_dss_device *dssdev,
 struct videomode *vm);
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 08/13] drm/omap: dpi: remove legacy data_lines

2017-05-12 Thread Tomi Valkeinen
Remove DPI's legacy data_lines code.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c   |  4 
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c|  5 -
 drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c |  5 -
 drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c |  4 
 drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  |  5 -
 drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c |  5 -
 drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c |  4 
 drivers/gpu/drm/omapdrm/dss/dpi.c   | 13 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  6 --
 9 files changed, 51 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
index 13e32d02c884..947295f9e30f 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
@@ -22,7 +22,6 @@ struct panel_drv_data {
struct omap_dss_device *in;
 
int pd_gpio;
-   int data_lines;
 
struct videomode vm;
 };
@@ -82,8 +81,6 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
return 0;
 
in->ops.dpi->set_timings(in, >vm);
-   if (ddata->data_lines)
-   in->ops.dpi->set_data_lines(in, ddata->data_lines);
 
r = in->ops.dpi->enable(in);
if (r)
@@ -226,7 +223,6 @@ static int tfp410_probe(struct platform_device *pdev)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DVI;
dssdev->owner = THIS_MODULE;
-   dssdev->phy.dpi.data_lines = ddata->data_lines;
dssdev->port_num = 1;
 
r = omapdss_register_output(dssdev);
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index 75b98bb81de2..cc5920b476d6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -26,8 +26,6 @@ struct panel_drv_data {
struct omap_dss_device dssdev;
struct omap_dss_device *in;
 
-   int data_lines;
-
struct videomode vm;
 
struct backlight_device *backlight;
@@ -77,8 +75,6 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
 
-   if (ddata->data_lines)
-   in->ops.dpi->set_data_lines(in, ddata->data_lines);
in->ops.dpi->set_timings(in, >vm);
 
r = in->ops.dpi->enable(in);
@@ -257,7 +253,6 @@ static int panel_dpi_probe(struct platform_device *pdev)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->panel.vm = ddata->vm;
-   dssdev->phy.dpi.data_lines = ddata->data_lines;
 
r = omapdss_register_display(dssdev);
if (r) {
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c 
b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index 43d21edb51f5..451e1608a1db 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -49,8 +49,6 @@ struct panel_drv_data {
 
struct spi_device *spi;
 
-   int data_lines;
-
struct videomode vm;
 
struct gpio_desc *enable_gpio;
@@ -159,8 +157,6 @@ static int lb035q02_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
 
-   if (ddata->data_lines)
-   in->ops.dpi->set_data_lines(in, ddata->data_lines);
in->ops.dpi->set_timings(in, >vm);
 
r = in->ops.dpi->enable(in);
@@ -289,7 +285,6 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->panel.vm = ddata->vm;
-   dssdev->phy.dpi.data_lines = ddata->data_lines;
 
r = omapdss_register_display(dssdev);
if (r) {
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c 
b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
index 2de27ba01552..95f6702a7b4f 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
@@ -25,8 +25,6 @@ struct panel_drv_data {
 
struct videomode vm;
 
-   int data_lines;
-
int res_gpio;
int qvga_gpio;
 
@@ -153,8 +151,6 @@ static int nec_8048_enable(struct omap_dss_device *dssdev)
if (omapdss_device_is_enabled(dssdev))
return 0;
 
-   if (ddata->data_lines)
-   in->ops.dpi->set_data_lines(in, ddata->data_lines);
in->ops.dpi->set_timings(in, >vm);
 
r = in->ops.dpi->enable(in);
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c 

[PATCH 13/13] drm/omap: remove omap_overlay & omap_overlay_manager

2017-05-12 Thread Tomi Valkeinen
Structs omap_overlay and omap_overlay_manager are not used, remove them.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 87 ---
 1 file changed, 87 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 3cf42e5ddf3e..41a58c7e38cd 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -59,7 +59,6 @@
 #define DISPC_IRQ_FRAMEDONE3   (1 << 30)
 
 struct omap_dss_device;
-struct omap_overlay_manager;
 struct dss_lcd_mgr_config;
 struct snd_aes_iec958;
 struct snd_cea_861_aud_if;
@@ -306,48 +305,6 @@ struct omap_overlay_info {
u8 zorder;
 };
 
-struct omap_overlay {
-   struct kobject kobj;
-   struct list_head list;
-
-   /* static fields */
-   const char *name;
-   enum omap_plane_id id;
-   enum omap_color_mode supported_modes;
-   enum omap_overlay_caps caps;
-
-   /* dynamic fields */
-   struct omap_overlay_manager *manager;
-
-   /*
-* The following functions do not block:
-*
-* is_enabled
-* set_overlay_info
-* get_overlay_info
-*
-* The rest of the functions may block and cannot be called from
-* interrupt context
-*/
-
-   int (*enable)(struct omap_overlay *ovl);
-   int (*disable)(struct omap_overlay *ovl);
-   bool (*is_enabled)(struct omap_overlay *ovl);
-
-   int (*set_manager)(struct omap_overlay *ovl,
-   struct omap_overlay_manager *mgr);
-   int (*unset_manager)(struct omap_overlay *ovl);
-
-   int (*set_overlay_info)(struct omap_overlay *ovl,
-   struct omap_overlay_info *info);
-   void (*get_overlay_info)(struct omap_overlay *ovl,
-   struct omap_overlay_info *info);
-
-   int (*wait_for_go)(struct omap_overlay *ovl);
-
-   struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
-};
-
 struct omap_overlay_manager_info {
u32 default_color;
 
@@ -361,47 +318,6 @@ struct omap_overlay_manager_info {
struct omap_dss_cpr_coefs cpr_coefs;
 };
 
-struct omap_overlay_manager {
-   struct kobject kobj;
-
-   /* static fields */
-   const char *name;
-   enum omap_channel id;
-   enum omap_overlay_manager_caps caps;
-   struct list_head overlays;
-   enum omap_display_type supported_displays;
-   enum omap_dss_output_id supported_outputs;
-
-   /* dynamic fields */
-   struct omap_dss_device *output;
-
-   /*
-* The following functions do not block:
-*
-* set_manager_info
-* get_manager_info
-* apply
-*
-* The rest of the functions may block and cannot be called from
-* interrupt context
-*/
-
-   int (*set_output)(struct omap_overlay_manager *mgr,
-   struct omap_dss_device *output);
-   int (*unset_output)(struct omap_overlay_manager *mgr);
-
-   int (*set_manager_info)(struct omap_overlay_manager *mgr,
-   struct omap_overlay_manager_info *info);
-   void (*get_manager_info)(struct omap_overlay_manager *mgr,
-   struct omap_overlay_manager_info *info);
-
-   int (*apply)(struct omap_overlay_manager *mgr);
-   int (*wait_for_go)(struct omap_overlay_manager *mgr);
-   int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
-
-   struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
-};
-
 /* 22 pins means 1 clk lane and 10 data lanes */
 #define OMAP_DSS_MAX_DSI_PINS 22
 
@@ -712,10 +628,8 @@ enum omap_color_mode 
dss_feat_get_supported_color_modes(enum omap_plane_id plane
 
 
 int omap_dss_get_num_overlay_managers(void);
-struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
 
 int omap_dss_get_num_overlays(void);
-struct omap_overlay *omap_dss_get_overlay(int num);
 
 int omapdss_register_output(struct omap_dss_device *output);
 void omapdss_unregister_output(struct omap_dss_device *output);
@@ -727,7 +641,6 @@ int omapdss_output_set_device(struct omap_dss_device *out,
 int omapdss_output_unset_device(struct omap_dss_device *out);
 
 struct omap_dss_device *omapdss_find_output_from_display(struct 
omap_dss_device *dssdev);
-struct omap_overlay_manager *omapdss_find_mgr_from_display(struct 
omap_dss_device *dssdev);
 
 void omapdss_default_get_timings(struct omap_dss_device *dssdev,
 struct videomode *vm);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 02/13] drm/omap: acx565akm: remove non-DT support

2017-05-12 Thread Tomi Valkeinen
Non-DT booting is no longer supported, so remove legacy code.

Signed-off-by: Tomi Valkeinen 
---
 .../drm/omapdrm/displays/panel-sony-acx565akm.c| 50 +++---
 1 file changed, 6 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
index 5ab39e0060f2..be368868f77f 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
@@ -32,8 +32,6 @@
 #include 
 #include 
 
-#include 
-
 #include "../dss/omapdss.h"
 
 #define MIPID_CMD_READ_DISP_ID 0x04
@@ -69,7 +67,6 @@ struct panel_drv_data {
struct omap_dss_device *in;
 
int reset_gpio;
-   int datapairs;
 
struct videomode vm;
 
@@ -547,9 +544,6 @@ static int acx565akm_panel_power_on(struct omap_dss_device 
*dssdev)
 
in->ops.sdi->set_timings(in, >vm);
 
-   if (ddata->datapairs > 0)
-   in->ops.sdi->set_datapairs(in, ddata->datapairs);
-
r = in->ops.sdi->enable(in);
if (r) {
pr_err("%s sdi enable failed\n", __func__);
@@ -701,32 +695,6 @@ static struct omap_dss_driver acx565akm_ops = {
.get_resolution = omapdss_default_get_resolution,
 };
 
-static int acx565akm_probe_pdata(struct spi_device *spi)
-{
-   const struct panel_acx565akm_platform_data *pdata;
-   struct panel_drv_data *ddata = dev_get_drvdata(>dev);
-   struct omap_dss_device *dssdev, *in;
-
-   pdata = dev_get_platdata(>dev);
-
-   ddata->reset_gpio = pdata->reset_gpio;
-
-   in = omap_dss_find_output(pdata->source);
-   if (in == NULL) {
-   dev_err(>dev, "failed to find video source '%s'\n",
-   pdata->source);
-   return -EPROBE_DEFER;
-   }
-   ddata->in = in;
-
-   ddata->datapairs = pdata->datapairs;
-
-   dssdev = >dssdev;
-   dssdev->name = pdata->name;
-
-   return 0;
-}
-
 static int acx565akm_probe_of(struct spi_device *spi)
 {
struct panel_drv_data *ddata = dev_get_drvdata(>dev);
@@ -754,6 +722,9 @@ static int acx565akm_probe(struct spi_device *spi)
 
dev_dbg(>dev, "%s\n", __func__);
 
+   if (!spi->dev.of_node)
+   return -ENODEV;
+
spi->mode = SPI_MODE_3;
 
ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
@@ -766,18 +737,9 @@ static int acx565akm_probe(struct spi_device *spi)
 
mutex_init(>mutex);
 
-   if (dev_get_platdata(>dev)) {
-   r = acx565akm_probe_pdata(spi);
-   if (r)
-   return r;
-   } else if (spi->dev.of_node) {
-   r = acx565akm_probe_of(spi);
-   if (r)
-   return r;
-   } else {
-   dev_err(>dev, "platform data missing!\n");
-   return -ENODEV;
-   }
+   r = acx565akm_probe_of(spi);
+   if (r)
+   return r;
 
if (gpio_is_valid(ddata->reset_gpio)) {
r = devm_gpio_request_one(>dev, ddata->reset_gpio,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 09/13] drm/omap: remove rfbi

2017-05-12 Thread Tomi Valkeinen
The RFBI driver has not worked nor compiled for many years. There are
very few boards out there that use RFBI, and no one has stepped up to
fix it.

So let's remove the RFBI code that doesn't even compile.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/Kconfig   |   13 -
 drivers/gpu/drm/omapdrm/dss/Makefile  |1 -
 drivers/gpu/drm/omapdrm/dss/core.c|6 -
 drivers/gpu/drm/omapdrm/dss/dss.h |4 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h |   32 -
 drivers/gpu/drm/omapdrm/dss/rfbi.c| 1075 -
 6 files changed, 1131 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/rfbi.c

diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig 
b/drivers/gpu/drm/omapdrm/dss/Kconfig
index f53adb944a0d..8b87d5cf45fc 100644
--- a/drivers/gpu/drm/omapdrm/dss/Kconfig
+++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
@@ -49,19 +49,6 @@ config OMAP2_DSS_DPI
help
  DPI Interface. This is the Parallel Display Interface.
 
-config OMAP2_DSS_RFBI
-   bool "RFBI support"
-   depends on BROKEN
-default n
-   help
- MIPI DBI support (RFBI, Remote Framebuffer Interface, in Texas
- Instrument's terminology).
-
- DBI is a bus between the host processor and a peripheral,
- such as a display or a framebuffer chip.
-
- See http://www.mipi.org/ for DBI specifications.
-
 config OMAP2_DSS_VENC
bool "VENC support"
 default y
diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile 
b/drivers/gpu/drm/omapdrm/dss/Makefile
index 75ec30f231c7..688195e448c5 100644
--- a/drivers/gpu/drm/omapdrm/dss/Makefile
+++ b/drivers/gpu/drm/omapdrm/dss/Makefile
@@ -8,7 +8,6 @@ obj-$(CONFIG_OMAP2_DSS) += omapdss.o
 omapdss-y := core.o dss.o dss_features.o dispc.o dispc_coefs.o \
pll.o video-pll.o
 omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
-omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o
 omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
 omapdss-$(CONFIG_OMAP2_DSS_SDI) += sdi.o
 omapdss-$(CONFIG_OMAP2_DSS_DSI) += dsi.o
diff --git a/drivers/gpu/drm/omapdrm/dss/core.c 
b/drivers/gpu/drm/omapdrm/dss/core.c
index f056bffcab73..bdce4bfdf6e0 100644
--- a/drivers/gpu/drm/omapdrm/dss/core.c
+++ b/drivers/gpu/drm/omapdrm/dss/core.c
@@ -208,9 +208,6 @@ static int (*dss_output_drv_reg_funcs[])(void) __initdata = 
{
 #ifdef CONFIG_OMAP2_DSS_DSI
dsi_init_platform_driver,
 #endif
-#ifdef CONFIG_OMAP2_DSS_RFBI
-   rfbi_init_platform_driver,
-#endif
 #ifdef CONFIG_OMAP2_DSS_VENC
venc_init_platform_driver,
 #endif
@@ -232,9 +229,6 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
 #ifdef CONFIG_OMAP2_DSS_VENC
venc_uninit_platform_driver,
 #endif
-#ifdef CONFIG_OMAP2_DSS_RFBI
-   rfbi_uninit_platform_driver,
-#endif
 #ifdef CONFIG_OMAP2_DSS_DSI
dsi_uninit_platform_driver,
 #endif
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h 
b/drivers/gpu/drm/omapdrm/dss/dss.h
index d8bf99a97571..8dbf35f3ab23 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -382,10 +382,6 @@ void hdmi4_uninit_platform_driver(void);
 int hdmi5_init_platform_driver(void) __init;
 void hdmi5_uninit_platform_driver(void);
 
-/* RFBI */
-int rfbi_init_platform_driver(void) __init;
-void rfbi_uninit_platform_driver(void);
-
 
 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
 static inline void dss_collect_irq_stats(u32 irqstatus, unsigned *irq_arr)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 3cbc9e49aa5a..8eb8315a6c95 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -126,11 +126,6 @@ enum omap_dss_trans_key_type {
OMAP_DSS_COLOR_KEY_VID_SRC = 1,
 };
 
-enum omap_rfbi_te_mode {
-   OMAP_DSS_RFBI_TE_MODE_1 = 1,
-   OMAP_DSS_RFBI_TE_MODE_2 = 2,
-};
-
 enum omap_dss_signal_level {
OMAPDSS_SIG_ACTIVE_LOW,
OMAPDSS_SIG_ACTIVE_HIGH,
@@ -220,27 +215,6 @@ enum omap_dss_output_id {
OMAP_DSS_OUTPUT_HDMI= 1 << 6,
 };
 
-/* RFBI */
-
-struct rfbi_timings {
-   int cs_on_time;
-   int cs_off_time;
-   int we_on_time;
-   int we_off_time;
-   int re_on_time;
-   int re_off_time;
-   int we_cycle_time;
-   int re_cycle_time;
-   int cs_pulse_width;
-   int access_time;
-
-   int clk_div;
-
-   u32 tim[5]; /* set by rfbi_convert_timings() */
-
-   int converted;
-};
-
 /* DSI */
 
 enum omap_dss_dsi_trans_mode {
@@ -624,11 +598,6 @@ struct omap_dss_device {
 
union {
struct {
-   u8 channel;
-   u8 data_lines;
-   } rfbi;
-
-   struct {
int module;
} dsi;
} phy;
@@ -642,7 +611,6 @@ struct omap_dss_device {
 
struct {
u8 pixel_size;
-   struct rfbi_timings rfbi_timings;
} ctrl;
 
const char *name;
diff 

[PATCH 06/13] drm/omap: venc: remove set_type & invert_vid_out_polarity

2017-05-12 Thread Tomi Valkeinen
Non-DT booting is no longer supported, so remove legacy code.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/displays/encoder-opa362.c | 10 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 10 --
 drivers/gpu/drm/omapdrm/dss/venc.c| 23 ---
 3 files changed, 43 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index f7a5731492d0..b1f6aa09f699 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -157,14 +157,6 @@ static int opa362_check_timings(struct omap_dss_device 
*dssdev,
return in->ops.atv->check_timings(in, vm);
 }
 
-static void opa362_set_type(struct omap_dss_device *dssdev,
-   enum omap_dss_venc_type type)
-{
-   /* we can only drive a COMPOSITE output */
-   WARN_ON(type != OMAP_DSS_VENC_TYPE_COMPOSITE);
-
-}
-
 static const struct omapdss_atv_ops opa362_atv_ops = {
.connect= opa362_connect,
.disconnect = opa362_disconnect,
@@ -175,8 +167,6 @@ static const struct omapdss_atv_ops opa362_atv_ops = {
.check_timings  = opa362_check_timings,
.set_timings= opa362_set_timings,
.get_timings= opa362_get_timings,
-
-   .set_type   = opa362_set_type,
 };
 
 static int opa362_probe(struct platform_device *pdev)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 1ce53b072b16..abdb332019e9 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -525,11 +525,6 @@ struct omapdss_atv_ops {
void (*get_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
 
-   void (*set_type)(struct omap_dss_device *dssdev,
-   enum omap_dss_venc_type type);
-   void (*invert_vid_out_polarity)(struct omap_dss_device *dssdev,
-   bool invert_polarity);
-
int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
u32 (*get_wss)(struct omap_dss_device *dssdev);
 };
@@ -642,11 +637,6 @@ struct omap_dss_device {
struct {
int module;
} dsi;
-
-   struct {
-   enum omap_dss_venc_type type;
-   bool invert_polarity;
-   } venc;
} phy;
 
struct {
diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
b/drivers/gpu/drm/omapdrm/dss/venc.c
index 8e836fddc390..a6bfb3918b8d 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -616,26 +616,6 @@ static int venc_set_wss(struct omap_dss_device *dssdev, 
u32 wss)
return r;
 }
 
-static void venc_set_type(struct omap_dss_device *dssdev,
-   enum omap_dss_venc_type type)
-{
-   mutex_lock(_lock);
-
-   venc.type = type;
-
-   mutex_unlock(_lock);
-}
-
-static void venc_invert_vid_out_polarity(struct omap_dss_device *dssdev,
-   bool invert_polarity)
-{
-   mutex_lock(_lock);
-
-   venc.invert_polarity = invert_polarity;
-
-   mutex_unlock(_lock);
-}
-
 static int venc_init_regulator(void)
 {
struct regulator *vdda_dac;
@@ -779,9 +759,6 @@ static const struct omapdss_atv_ops venc_ops = {
.set_timings = venc_set_timings,
.get_timings = venc_get_timings,
 
-   .set_type = venc_set_type,
-   .invert_vid_out_polarity = venc_invert_vid_out_polarity,
-
.set_wss = venc_set_wss,
.get_wss = venc_get_wss,
 };
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 03/13] drm/omap: connector-analog-tv: remove non-DT support

2017-05-12 Thread Tomi Valkeinen
Non-DT booting is no longer supported, so remove legacy code.

Signed-off-by: Tomi Valkeinen 
---
 .../gpu/drm/omapdrm/displays/connector-analog-tv.c | 52 +++---
 1 file changed, 6 insertions(+), 46 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index aaa8a58390f1..8453b1103abd 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -14,8 +14,6 @@
 #include 
 #include 
 
-#include 
-
 #include "../dss/omapdss.h"
 
 struct panel_drv_data {
@@ -25,8 +23,6 @@ struct panel_drv_data {
struct device *dev;
 
struct videomode vm;
-
-   bool invert_polarity;
 };
 
 static const struct videomode tvc_pal_vm = {
@@ -95,13 +91,6 @@ static int tvc_enable(struct omap_dss_device *dssdev)
 
in->ops.atv->set_timings(in, >vm);
 
-   if (!ddata->dev->of_node) {
-   in->ops.atv->set_type(in, OMAP_DSS_VENC_TYPE_COMPOSITE);
-
-   in->ops.atv->invert_vid_out_polarity(in,
-   ddata->invert_polarity);
-   }
-
r = in->ops.atv->enable(in);
if (r)
return r;
@@ -188,30 +177,6 @@ static struct omap_dss_driver tvc_driver = {
.set_wss= tvc_set_wss,
 };
 
-static int tvc_probe_pdata(struct platform_device *pdev)
-{
-   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct connector_atv_platform_data *pdata;
-   struct omap_dss_device *in, *dssdev;
-
-   pdata = dev_get_platdata(>dev);
-
-   in = omap_dss_find_output(pdata->source);
-   if (in == NULL) {
-   dev_err(>dev, "Failed to find video source\n");
-   return -EPROBE_DEFER;
-   }
-
-   ddata->in = in;
-
-   ddata->invert_polarity = pdata->invert_polarity;
-
-   dssdev = >dssdev;
-   dssdev->name = pdata->name;
-
-   return 0;
-}
-
 static int tvc_probe_of(struct platform_device *pdev)
 {
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
@@ -235,6 +200,9 @@ static int tvc_probe(struct platform_device *pdev)
struct omap_dss_device *dssdev;
int r;
 
+   if (!pdev->dev.of_node)
+   return -ENODEV;
+
ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
if (!ddata)
return -ENOMEM;
@@ -242,17 +210,9 @@ static int tvc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata);
ddata->dev = >dev;
 
-   if (dev_get_platdata(>dev)) {
-   r = tvc_probe_pdata(pdev);
-   if (r)
-   return r;
-   } else if (pdev->dev.of_node) {
-   r = tvc_probe_of(pdev);
-   if (r)
-   return r;
-   } else {
-   return -ENODEV;
-   }
+   r = tvc_probe_of(pdev);
+   if (r)
+   return r;
 
ddata->vm = tvc_pal_vm;
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 12/13] drm/omap: remove unused fields

2017-05-12 Thread Tomi Valkeinen
Remove unused fields in struct omap_dss_device.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 74408b0ece26..3cf42e5ddf3e 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -596,12 +596,6 @@ struct omap_dss_device {
enum omap_display_type type;
enum omap_display_type output_type;
 
-   union {
-   struct {
-   int module;
-   } dsi;
-   } phy;
-
struct {
struct videomode vm;
 
@@ -609,17 +603,8 @@ struct omap_dss_device {
enum omap_dss_dsi_mode dsi_mode;
} panel;
 
-   struct {
-   u8 pixel_size;
-   } ctrl;
-
const char *name;
 
-   /* used to match device to driver */
-   const char *driver_name;
-
-   void *data;
-
struct omap_dss_driver *driver;
 
union {
@@ -655,8 +640,6 @@ struct omap_dss_device {
int port_num;
 
/* dynamic fields */
-   struct omap_overlay_manager *manager;
-
struct omap_dss_device *dst;
 };
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 10/13] drm/omap: remove unused get_dimensions()

2017-05-12 Thread Tomi Valkeinen
get_dimensions function pointer is not used, remove it.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 8eb8315a6c95..4909ea11cb71 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -690,8 +690,6 @@ struct omap_dss_driver {
 
void (*get_resolution)(struct omap_dss_device *dssdev,
u16 *xres, u16 *yres);
-   void (*get_dimensions)(struct omap_dss_device *dssdev,
-   u32 *width, u32 *height);
 
int (*check_timings)(struct omap_dss_device *dssdev,
 struct videomode *vm);
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 05/13] drm/omap: sdi: remove legacy set_datapairs

2017-05-12 Thread Tomi Valkeinen
Non-DT booting is no longer supported, so remove legacy code.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 --
 drivers/gpu/drm/omapdrm/dss/sdi.c | 7 ---
 2 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 8396036e210c..1ce53b072b16 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -490,8 +490,6 @@ struct omapdss_sdi_ops {
struct videomode *vm);
void (*get_timings)(struct omap_dss_device *dssdev,
struct videomode *vm);
-
-   void (*set_datapairs)(struct omap_dss_device *dssdev, int datapairs);
 };
 
 struct omapdss_dvi_ops {
@@ -642,10 +640,6 @@ struct omap_dss_device {
} rfbi;
 
struct {
-   u8 datapairs;
-   } sdi;
-
-   struct {
int module;
} dsi;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c 
b/drivers/gpu/drm/omapdrm/dss/sdi.c
index f2f8aed53a7b..d18ad58c5a19 100644
--- a/drivers/gpu/drm/omapdrm/dss/sdi.c
+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
@@ -252,11 +252,6 @@ static int sdi_check_timings(struct omap_dss_device 
*dssdev,
return 0;
 }
 
-static void sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs)
-{
-   sdi.datapairs = datapairs;
-}
-
 static int sdi_init_regulator(void)
 {
struct regulator *vdds_sdi;
@@ -326,8 +321,6 @@ static const struct omapdss_sdi_ops sdi_ops = {
.check_timings = sdi_check_timings,
.set_timings = sdi_set_timings,
.get_timings = sdi_get_timings,
-
-   .set_datapairs = sdi_set_datapairs,
 };
 
 static void sdi_init_output(struct platform_device *pdev)
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 01/13] drm/omap: panel-dpi: remove non-DT support

2017-05-12 Thread Tomi Valkeinen
Non-DT booting is no longer supported, so remove legacy code.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 78 +++-
 1 file changed, 6 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index 04ce8c5f2954..75b98bb81de2 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 
-#include 
 #include 
 
 #include "../dss/omapdss.h"
@@ -33,9 +32,6 @@ struct panel_drv_data {
 
struct backlight_device *backlight;
 
-   /* used for non-DT boot, to be removed */
-   int backlight_gpio;
-
struct gpio_desc *enable_gpio;
struct regulator *vcc_supply;
 };
@@ -97,9 +93,6 @@ static int panel_dpi_enable(struct omap_dss_device *dssdev)
 
gpiod_set_value_cansleep(ddata->enable_gpio, 1);
 
-   if (gpio_is_valid(ddata->backlight_gpio))
-   gpio_set_value_cansleep(ddata->backlight_gpio, 1);
-
if (ddata->backlight) {
ddata->backlight->props.power = FB_BLANK_UNBLANK;
backlight_update_status(ddata->backlight);
@@ -118,9 +111,6 @@ static void panel_dpi_disable(struct omap_dss_device 
*dssdev)
if (!omapdss_device_is_enabled(dssdev))
return;
 
-   if (gpio_is_valid(ddata->backlight_gpio))
-   gpio_set_value_cansleep(ddata->backlight_gpio, 0);
-
if (ddata->backlight) {
ddata->backlight->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(ddata->backlight);
@@ -177,47 +167,6 @@ static struct omap_dss_driver panel_dpi_ops = {
.get_resolution = omapdss_default_get_resolution,
 };
 
-static int panel_dpi_probe_pdata(struct platform_device *pdev)
-{
-   const struct panel_dpi_platform_data *pdata;
-   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct omap_dss_device *dssdev, *in;
-   int r;
-
-   pdata = dev_get_platdata(>dev);
-
-   in = omap_dss_find_output(pdata->source);
-   if (in == NULL) {
-   dev_err(>dev, "failed to find video source '%s'\n",
-   pdata->source);
-   return -EPROBE_DEFER;
-   }
-
-   ddata->in = in;
-
-   ddata->data_lines = pdata->data_lines;
-
-   videomode_from_timing(pdata->display_timing, >vm);
-
-   dssdev = >dssdev;
-   dssdev->name = pdata->name;
-
-   r = devm_gpio_request_one(>dev, pdata->enable_gpio,
-   GPIOF_OUT_INIT_LOW, "panel enable");
-   if (r)
-   goto err_gpio;
-
-   ddata->enable_gpio = gpio_to_desc(pdata->enable_gpio);
-
-   ddata->backlight_gpio = pdata->backlight_gpio;
-
-   return 0;
-
-err_gpio:
-   omap_dss_put_device(ddata->in);
-   return r;
-}
-
 static int panel_dpi_probe_of(struct platform_device *pdev)
 {
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
@@ -248,8 +197,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
if (IS_ERR(ddata->vcc_supply))
return PTR_ERR(ddata->vcc_supply);
 
-   ddata->backlight_gpio = -ENOENT;
-
bl_node = of_parse_phandle(node, "backlight", 0);
if (bl_node) {
ddata->backlight = of_find_backlight_by_node(bl_node);
@@ -291,30 +238,18 @@ static int panel_dpi_probe(struct platform_device *pdev)
struct omap_dss_device *dssdev;
int r;
 
+   if (!pdev->dev.of_node)
+   return -ENODEV;
+
ddata = devm_kzalloc(>dev, sizeof(*ddata), GFP_KERNEL);
if (ddata == NULL)
return -ENOMEM;
 
platform_set_drvdata(pdev, ddata);
 
-   if (dev_get_platdata(>dev)) {
-   r = panel_dpi_probe_pdata(pdev);
-   if (r)
-   return r;
-   } else if (pdev->dev.of_node) {
-   r = panel_dpi_probe_of(pdev);
-   if (r)
-   return r;
-   } else {
-   return -ENODEV;
-   }
-
-   if (gpio_is_valid(ddata->backlight_gpio)) {
-   r = devm_gpio_request_one(>dev, ddata->backlight_gpio,
-   GPIOF_OUT_INIT_LOW, "panel backlight");
-   if (r)
-   goto err_gpio;
-   }
+   r = panel_dpi_probe_of(pdev);
+   if (r)
+   return r;
 
dssdev = >dssdev;
dssdev->dev = >dev;
@@ -333,7 +268,6 @@ static int panel_dpi_probe(struct platform_device *pdev)
return 0;
 
 err_reg:
-err_gpio:
omap_dss_put_device(ddata->in);
return r;
 }
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 00/13] drm/omap: legacy cleanup

2017-05-12 Thread Tomi Valkeinen
This series removes a bunch of code that is not used anymore. Some of it was
for non-DT booting, some for omapfb.

I picked the RFBI removal to this series from the other series I have sent, as
it allowed me to remove a bit more here.

 Tomi

Tomi Valkeinen (13):
  drm/omap: panel-dpi: remove non-DT support
  drm/omap: acx565akm: remove non-DT support
  drm/omap: connector-analog-tv: remove non-DT support
  drm/omap: connector-dvi/hdmi: remove extra include
  drm/omap: sdi: remove legacy set_datapairs
  drm/omap: venc: remove set_type & invert_vid_out_polarity
  drm/omap: remove recommended_bpp
  drm/omap: dpi: remove legacy data_lines
  drm/omap: remove rfbi
  drm/omap: remove unused get_dimensions()
  drm/omap: remove legacy get_resolution
  drm/omap: remove unused fields
  drm/omap: remove omap_overlay & omap_overlay_manager

 .../gpu/drm/omapdrm/displays/connector-analog-tv.c |   54 +-
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c   |3 -
 drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  |3 -
 drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  |   10 -
 drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  |4 -
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c   |   85 +-
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c|   10 -
 .../omapdrm/displays/panel-lgphilips-lb035q02.c|7 -
 .../drm/omapdrm/displays/panel-nec-nl8048hl11.c|6 -
 .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c |7 -
 .../drm/omapdrm/displays/panel-sony-acx565akm.c|   52 +-
 .../drm/omapdrm/displays/panel-tpo-td028ttec1.c|5 -
 .../drm/omapdrm/displays/panel-tpo-td043mtea1.c|6 -
 drivers/gpu/drm/omapdrm/dss/Kconfig|   13 -
 drivers/gpu/drm/omapdrm/dss/Makefile   |1 -
 drivers/gpu/drm/omapdrm/dss/core.c |6 -
 drivers/gpu/drm/omapdrm/dss/display.c  |   43 -
 drivers/gpu/drm/omapdrm/dss/dpi.c  |   13 -
 drivers/gpu/drm/omapdrm/dss/dss.h  |4 -
 drivers/gpu/drm/omapdrm/dss/omapdss.h  |  167 ---
 drivers/gpu/drm/omapdrm/dss/rfbi.c | 1075 
 drivers/gpu/drm/omapdrm/dss/sdi.c  |7 -
 drivers/gpu/drm/omapdrm/dss/venc.c |   23 -
 23 files changed, 18 insertions(+), 1586 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/dss/rfbi.c

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 04/13] drm/omap: connector-dvi/hdmi: remove extra include

2017-05-12 Thread Tomi Valkeinen
Remove extra includes related to non-DT boot.

Signed-off-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c  | 1 -
 drivers/gpu/drm/omapdrm/displays/connector-hdmi.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index d6875d9fcefa..8720b2dcb316 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -15,7 +15,6 @@
 #include 
 
 #include 
-#include 
 
 #include "../dss/omapdss.h"
 
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index 1ef130641bae..555e193c9732 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -17,7 +17,6 @@
 #include 
 
 #include 
-#include 
 
 #include "../dss/omapdss.h"
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/7] drm/bridge: Refactor out the panel wrapper from the lvds-encoder bridge.

2017-05-12 Thread Archit Taneja

Hi,

On 05/12/2017 12:01 AM, Eric Anholt wrote:

Many DRM drivers have common code to make a stub connector
implementation that wraps a drm_panel.  By wrapping the panel in a DRM
bridge, all of the connector code (including calls during encoder
enable/disable) goes away.

v2: Fix build with CONFIG_DRM=m, drop "dev" argument that should just
be the panel's dev, move kerneldoc up a level and document
_remove().

Signed-off-by: Eric Anholt 
Acked-by: Daniel Vetter 
---
 Documentation/gpu/drm-kms-helpers.rst |   6 ++
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/bridge/Kconfig|  11 +-
 drivers/gpu/drm/bridge/lvds-encoder.c | 157 ---
 drivers/gpu/drm/bridge/panel.c| 197 ++
 include/drm/drm_bridge.h  |   7 ++
 6 files changed, 238 insertions(+), 141 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/panel.c

diff --git a/Documentation/gpu/drm-kms-helpers.rst 
b/Documentation/gpu/drm-kms-helpers.rst
index c075aadd7078..7c5e2549a58a 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -143,6 +143,12 @@ Bridge Helper Reference
 .. kernel-doc:: drivers/gpu/drm/drm_bridge.c
:export:

+Panel-Bridge Helper Reference
+-
+
+.. kernel-doc:: drivers/gpu/drm/bridge/panel.c
+   :export:
+
 .. _drm_panel_helper:

 Panel Helper Reference
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index c156fecfb362..4cc9c02cc3f2 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -24,6 +24,7 @@ drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
 drm-$(CONFIG_PCI) += ati_pcigart.o
 drm-$(CONFIG_DRM_PANEL) += drm_panel.o
+drm-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
 drm-$(CONFIG_OF) += drm_of.o
 drm-$(CONFIG_AGP) += drm_agpsupport.o
 drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index f6968d3b4b41..c4daca38743c 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -4,6 +4,14 @@ config DRM_BRIDGE
help
  Bridge registration and lookup framework.

+config DRM_PANEL_BRIDGE
+   def_bool y
+   depends on DRM_BRIDGE
+   select DRM_KMS_HELPER
+   select DRM_PANEL
+   help
+ DRM bridge wrapper of DRM panels
+
 menu "Display Interface Bridges"
depends on DRM && DRM_BRIDGE

@@ -27,8 +35,7 @@ config DRM_DUMB_VGA_DAC
 config DRM_LVDS_ENCODER
tristate "Transparent parallel to LVDS encoder support"
depends on OF
-   select DRM_KMS_HELPER
-   select DRM_PANEL
+   select DRM_PANEL_BRIDGE
help
  Support for transparent parallel to LVDS encoders that don't require
  any configuration.
diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c 
b/drivers/gpu/drm/bridge/lvds-encoder.c
index f1f67a279426..0903ba574f61 100644
--- a/drivers/gpu/drm/bridge/lvds-encoder.c
+++ b/drivers/gpu/drm/bridge/lvds-encoder.c
@@ -8,144 +8,18 @@
  */

 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 

 #include 

-struct lvds_encoder {
-   struct device *dev;
-
-   struct drm_bridge bridge;
-   struct drm_connector connector;
-   struct drm_panel *panel;
-};
-
-static inline struct lvds_encoder *
-drm_bridge_to_lvds_encoder(struct drm_bridge *bridge)
-{
-   return container_of(bridge, struct lvds_encoder, bridge);
-}
-
-static inline struct lvds_encoder *
-drm_connector_to_lvds_encoder(struct drm_connector *connector)
-{
-   return container_of(connector, struct lvds_encoder, connector);
-}
-
-static int lvds_connector_get_modes(struct drm_connector *connector)
-{
-   struct lvds_encoder *lvds = drm_connector_to_lvds_encoder(connector);
-
-   return drm_panel_get_modes(lvds->panel);
-}
-
-static const struct drm_connector_helper_funcs lvds_connector_helper_funcs = {
-   .get_modes = lvds_connector_get_modes,
-};
-
-static const struct drm_connector_funcs lvds_connector_funcs = {
-   .dpms = drm_atomic_helper_connector_dpms,
-   .reset = drm_atomic_helper_connector_reset,
-   .fill_modes = drm_helper_probe_single_connector_modes,
-   .destroy = drm_connector_cleanup,
-   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-};
-
-static int lvds_encoder_attach(struct drm_bridge *bridge)
-{
-   struct lvds_encoder *lvds = drm_bridge_to_lvds_encoder(bridge);
-   struct drm_connector *connector = >connector;
-   int ret;
-
-   if (!bridge->encoder) {
-   DRM_ERROR("Missing encoder\n");
-   return -ENODEV;
-   }
-
-   drm_connector_helper_add(connector, _connector_helper_funcs);
-
-   ret = drm_connector_init(bridge->dev, 

Re: [PATCH v2 8/8] drm: arc: Use crtc->mode_valid() callback

2017-05-12 Thread Laurent Pinchart
Hi Jose,

Thank you for the patch.

On Tuesday 09 May 2017 18:00:15 Jose Abreu wrote:
> Now that we have a callback to check if crtc supports a given mode
> we can use it in arcpgu so that we restrict the number of probbed
> modes to the ones we can actually display.
> 
> This is specially useful because arcpgu crtc is responsible to set
> a clock value in the commit() stage but unfortunatelly this clock
> does not support all the needed ranges.
> 
> Also, remove the atomic_check() callback as mode_valid() callback
> will be called before.
> 
> Signed-off-by: Jose Abreu 
> Cc: Carlos Palminha 
> Cc: Alexey Brodkin 
> Cc: Ville Syrjälä 
> Cc: Daniel Vetter 
> Cc: Dave Airlie 
> Cc: Andrzej Hajda 
> Cc: Archit Taneja 
> ---
>  drivers/gpu/drm/arc/arcpgu_crtc.c | 39 ---
>  1 file changed, 24 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c
> b/drivers/gpu/drm/arc/arcpgu_crtc.c index ad9a959..01cae0a 100644
> --- a/drivers/gpu/drm/arc/arcpgu_crtc.c
> +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c
> @@ -32,6 +32,18 @@
>   { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 },
>  };
> 
> +static bool arc_pgu_is_mode_valid(struct arcpgu_drm_private *arcpgu,
> +   const struct drm_display_mode *mode)
> +{
> + long rate, clk_rate = mode->clock * 1000;
> +
> + rate = clk_round_rate(arcpgu->clk, clk_rate);
> + if (rate != clk_rate)
> + return false;

This isn't anything new introduced by this patch, but shouldn't drivers allow 
for some margin in clock frequencies ? Surely if the mode requires a 
60.000.000 Hz frequency and the hardware can only generate 59.999.999 Hz or 
60.000.001 Hz we shouldn't fail. As far as I understand, this is something the 
mode_fixup() operation is supposed to handle, but the arc driver doesn't 
implement it.

> + return true;
> +}

Can't you inline this in arc_pgu_crtc_mode_valid() as there's a single caller 
?

>  static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
>  {
>   struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
> @@ -64,6 +76,17 @@ static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc)
>   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>  };
> 
> +enum drm_mode_status arc_pgu_crtc_mode_valid(struct drm_crtc *crtc,
> +  const struct drm_display_mode 
*mode)
> +{
> + struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
> +
> + if (!arc_pgu_is_mode_valid(arcpgu, mode))
> + return MODE_NOCLOCK;
> +
> + return MODE_OK;
> +}
> +
>  static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  {
>   struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
> @@ -129,20 +152,6 @@ static void arc_pgu_crtc_disable(struct drm_crtc *crtc)
> ~ARCPGU_CTRL_ENABLE_MASK);
>  }
> 
> -static int arc_pgu_crtc_atomic_check(struct drm_crtc *crtc,
> -  struct drm_crtc_state *state)
> -{
> - struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc);
> - struct drm_display_mode *mode = >adjusted_mode;
> - long rate, clk_rate = mode->clock * 1000;
> -
> - rate = clk_round_rate(arcpgu->clk, clk_rate);
> - if (rate != clk_rate)
> - return -EINVAL;
> -
> - return 0;
> -}
> -
>  static void arc_pgu_crtc_atomic_begin(struct drm_crtc *crtc,
> struct drm_crtc_state *state)
>  {
> @@ -158,6 +167,7 @@ static void arc_pgu_crtc_atomic_begin(struct drm_crtc
> *crtc, }
> 
>  static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = {
> + .mode_valid = arc_pgu_crtc_mode_valid,
>   .mode_set   = drm_helper_crtc_mode_set,
>   .mode_set_base  = drm_helper_crtc_mode_set_base,
>   .mode_set_nofb  = arc_pgu_crtc_mode_set_nofb,
> @@ -165,7 +175,6 @@ static void arc_pgu_crtc_atomic_begin(struct drm_crtc
> *crtc, .disable   = arc_pgu_crtc_disable,
>   .prepare= arc_pgu_crtc_disable,
>   .commit = arc_pgu_crtc_enable,
> - .atomic_check   = arc_pgu_crtc_atomic_check,
>   .atomic_begin   = arc_pgu_crtc_atomic_begin,
>  };

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 7/8] drm: Use mode_valid() in atomic modeset

2017-05-12 Thread Laurent Pinchart
Hi Daniel,

On Wednesday 10 May 2017 19:55:56 Daniel Vetter wrote:
> On Wed, May 10, 2017 at 09:38:00PM +0530, Archit Taneja wrote:
> > On 5/9/2017 10:30 PM, Jose Abreu wrote:
> > > This patches makes use of the new mode_valid() callbacks introduced
> > > previously to validate the full video pipeline when modesetting.
> > > 
> > > This calls the connector->mode_valid(), encoder->mode_valid(),
> > > bridge->mode_valid() and crtc->mode_valid() so that we can
> > > make sure that the mode will be accepted in every components.
> > > 
> > > Signed-off-by: Jose Abreu 
> > > Cc: Carlos Palminha 
> > > Cc: Alexey Brodkin 
> > > Cc: Ville Syrjälä 
> > > Cc: Daniel Vetter 
> > > Cc: Dave Airlie 
> > > Cc: Andrzej Hajda 
> > > Cc: Archit Taneja 
> > > ---
> > > 
> > > Changes v1->v2:
> > >   - Removed call to connector->mode_valid (Ville, Daniel)
> > >   - Change function name (Ville)
> > >   - Use for_each_new_connector_in_state (Ville)
> > >   - Do not validate if connector and mode didn't change (Ville)
> > >   - Use new helpers to call mode_valid
> > >   
> > >   drivers/gpu/drm/drm_atomic_helper.c | 75 +++--
> > >   1 file changed, 72 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > > b/drivers/gpu/drm/drm_atomic_helper.c index 8be9719..19d0ea1 100644
> > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > @@ -452,6 +452,69 @@ static int handle_conflicting_encoders(struct
> > > drm_atomic_state *state,
> > >   return 0;
> > >   }
> > > 
> > > +static enum drm_mode_status mode_valid_path(struct drm_connector
> > > *connector,
> > > + struct drm_encoder *encoder,
> > > + struct drm_crtc *crtc,
> > > + struct drm_display_mode *mode)
> > > +{
> > > + enum drm_mode_status ret;
> > > +
> > > + ret = drm_encoder_mode_valid(encoder, mode);
> > > + if (ret != MODE_OK) {
> > > + DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] mode_valid() failed\n",
> > > + encoder->base.id, encoder->name);
> > > + return ret;
> > > + }
> > > +
> > > + ret = drm_bridge_mode_valid(encoder->bridge, mode);
> > > + if (ret != MODE_OK) {
> > > + DRM_DEBUG_ATOMIC("[BRIDGE] mode_valid() failed\n");
> > > + return ret;
> > > + }
> > > +
> > > + ret = drm_crtc_mode_valid(crtc, mode);
> > > + if (ret != MODE_OK) {
> > > + DRM_DEBUG_ATOMIC("[CRTC:%d:%s] mode_valid() failed\n",
> > > + crtc->base.id, crtc->name);
> > > + return ret;
> > > + }
> > > +
> > > + return ret;
> > > +}
> > > +
> > > +static int
> > > +mode_valid(struct drm_atomic_state *state)
> > > +{
> > > + struct drm_connector_state *conn_state;
> > > + struct drm_connector *connector;
> > > + int i;
> > > +
> > > + for_each_new_connector_in_state(state, connector, conn_state, i) {
> > > + struct drm_encoder *encoder = conn_state->best_encoder;
> > > + struct drm_crtc *crtc = conn_state->crtc;
> > > + struct drm_crtc_state *crtc_state;
> > > + enum drm_mode_status mode_status;
> > > + struct drm_display_mode *mode;
> > > +
> > > + if (!crtc || !encoder)
> > > + continue;
> > > +
> > > + crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
> > > + if (!crtc_state)
> > > + continue;
> > > + if (!crtc_state->mode_changed && !crtc_state
> > > ->connectors_changed)
> > > + continue;
> > > +
> > > + mode = _state->mode;
> > > +
> > > + mode_status = mode_valid_path(connector, encoder, crtc, mode);
> > > + if (mode_status != MODE_OK)
> > > + return -EINVAL;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > >   /**
> > >* drm_atomic_helper_check_modeset - validate state object for modeset
> > >changes * @dev: DRM device
> > > @@ -466,13 +529,15 @@ static int handle_conflicting_encoders(struct
> > > drm_atomic_state *state,
> > >   * 2. _connector_helper_funcs.atomic_check to validate the
> > >   connector state.
> > >   * 3. If it's determined a modeset is needed then all connectors on the
> > >   affected crtc
> > >   *crtc are added and _connector_helper_funcs.atomic_check is
> > >   run on them.
> > > - * 4. _bridge_funcs.mode_fixup is called on all encoder bridges.
> > > - * 5. _encoder_helper_funcs.atomic_check is called to validate any
> > > encoder state.
> > > + * 4. _encoder_helper_funcs.mode_valid,
> > > _bridge_funcs.mode_valid and
> > > + *_crtc_helper_funcs.mode_valid are called on the affected
> > > components.
> > > + * 5. _bridge_funcs.mode_fixup is called on all encoder bridges.
> > > + * 6. 

Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid()

2017-05-12 Thread Laurent Pinchart
Hi Daniel,

On Wednesday 10 May 2017 17:14:33 Daniel Vetter wrote:
> On Wed, May 10, 2017 at 04:41:09PM +0300, Ville Syrjälä wrote:
> > On Tue, May 09, 2017 at 06:00:13PM +0100, Jose Abreu wrote:
> > > Introduce a new helper function which calls mode_valid() callback
> > > for all bridges in an encoder chain.
> > > 
> > > Signed-off-by: Jose Abreu 
> > > Cc: Carlos Palminha 
> > > Cc: Alexey Brodkin 
> > > Cc: Ville Syrjälä 
> > > Cc: Daniel Vetter 
> > > Cc: Dave Airlie 
> > > Cc: Andrzej Hajda 
> > > Cc: Archit Taneja 
> > > ---
> > > 
> > >  drivers/gpu/drm/drm_bridge.c | 33 +
> > >  include/drm/drm_bridge.h |  2 ++
> > >  2 files changed, 35 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> > > index 86a7637..dc8cdfe 100644
> > > --- a/drivers/gpu/drm/drm_bridge.c
> > > +++ b/drivers/gpu/drm/drm_bridge.c
> > > @@ -206,6 +206,39 @@ bool drm_bridge_mode_fixup(struct drm_bridge
> > > *bridge,
> > > 
> > >  EXPORT_SYMBOL(drm_bridge_mode_fixup);
> > >  
> > >  /**
> > > 
> > > + * drm_bridge_mode_valid - validate the mode against all bridges in the
> > > + *  encoder chain.
> > > + * @bridge: bridge control structure
> > > + * @mode: desired mode to be validated
> > > + *
> > > + * Calls _bridge_funcs.mode_valid for all the bridges in the
> > > encoder
> > > + * chain, starting from the first bridge to the last. If at least one
> > > bridge + * does not accept the mode the function returns the error
> > > code.
> > > + *
> > > + * Note: the bridge passed should be the one closest to the encoder.
> > > + *
> > > + * RETURNS:
> > > + * MODE_OK on success, drm_mode_status Enum error code on failure
> > > + */
> > > +enum drm_mode_status drm_bridge_mode_valid(struct drm_bridge *bridge,
> > > +const struct drm_display_mode 
*mode)
> > > +{
> > > + enum drm_mode_status ret = MODE_OK;
> > > +
> > > + if (!bridge)
> > > + return ret;
> > > +
> > > + if (bridge->funcs->mode_valid)
> > > + ret = bridge->funcs->mode_valid(bridge, mode);
> > > +
> > > + if (ret != MODE_OK)
> > > + return ret;
> > > +
> > > + return drm_bridge_mode_valid(bridge->next, mode);
> > 
> > Looks like it should be pretty trivial to avoid the recursion.
> > 
> > Am I correct in interpreting this that bridges have some kind of
> > a hand rolled linked list implementation? Reusing the standard
> > linked lists would allow you to use list_for_each() etc.
> 
> Yeah it's a hand-rolled list, but current hw also has a bridge nesting
> depth of 2, so it really doesn't matter. I guess once we have real long
> chains of bridges we can fix this (and just using list_head sounds like a
> great idea).

Even if not really needed right now, it's a pretty easy cleanup, if Jose has 
time to handle it in v3 of this series let's not postpone it ;-)

-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 5/8] drm: Use new mode_valid() helpers in connector probe helper

2017-05-12 Thread Laurent Pinchart
Hi Jose,

Thank you for the patch.

On Tuesday 09 May 2017 18:00:12 Jose Abreu wrote:
> This changes the connector probe helper function to use the new
> encoder->mode_valid() and crtc->mode_valid() helper callbacks to
> validate the modes.
> 
> The new callbacks are optional so the behaviour remains the same
> if they are not implemented. If they are, then the code loops
> through all the connector's encodersXcrtcs and calls the
> callback.
> 
> If at least a valid encoderXcrtc combination is found which
> accepts the mode then the function returns MODE_OK.
> 
> Signed-off-by: Jose Abreu 
> Cc: Carlos Palminha 
> Cc: Alexey Brodkin 
> Cc: Ville Syrjälä 
> Cc: Daniel Vetter 
> Cc: Dave Airlie 
> Cc: Andrzej Hajda 
> Cc: Archit Taneja 
> ---
> 
> Changes v1->v2:
>   - Use new helpers suggested by Ville
>   - Change documentation (Daniel)
> 
>  drivers/gpu/drm/drm_probe_helper.c | 60 +--
>  1 file changed, 57 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_probe_helper.c
> b/drivers/gpu/drm/drm_probe_helper.c index 1b0c14a..de47413 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -39,6 +39,8 @@
>  #include 
>  #include 
> 
> +#include "drm_crtc_internal.h"
> +
>  /**
>   * DOC: output probing helper overview
>   *
> @@ -80,6 +82,54 @@
>   return MODE_OK;
>  }
> 
> +static enum drm_mode_status
> +drm_mode_validate_connector(struct drm_connector *connector,
> + struct drm_display_mode *mode)

This does more than validating the mode against the connector, it validates it 
against the whole pipeline. I would call the function 
drm_mode_validate_pipeline() (or any other similar name).

> +{
> + struct drm_device *dev = connector->dev;
> + uint32_t *ids = connector->encoder_ids;
> + enum drm_mode_status ret = MODE_OK;
> + unsigned int i;
> +
> + /* Step 1: Validate against connector */
> + ret = drm_connector_mode_valid(connector, mode);
> + if (ret != MODE_OK)
> + return ret;
> +
> + /* Step 2: Validate against encoders and crtcs */
> + for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
> + struct drm_encoder *encoder = drm_encoder_find(dev, ids[i]);
> + struct drm_crtc *crtc;
> +
> + if (!encoder)
> + continue;
> +
> + ret = drm_encoder_mode_valid(encoder, mode);
> + if (ret != MODE_OK) {
> + /* No point in continuing for crtc check as this 
encoder
> +  * will not accept the mode anyway. If all encoders
> +  * reject the mode then, at exit, ret will not be
> +  * MODE_OK. */
> + continue;
> + }
> +
> + drm_for_each_crtc(crtc, dev) {
> + if (!drm_encoder_crtc_ok(encoder, crtc))
> + continue;
> +
> + ret = drm_crtc_mode_valid(crtc, mode);
> + if (ret == MODE_OK) {
> + /* If we get to this point there is at least
> +  * one combination of encoder+crtc that works
> +  * for this mode. Lets return now. */
> + return ret;
> + }
> + }
> + }
> +
> + return ret;
> +}
> +
>  static int drm_helper_probe_add_cmdline_mode(struct drm_connector
> *connector)
>  {
>   struct drm_cmdline_mode *cmdline_mode;
> @@ -284,7 +334,11 @@ void drm_kms_helper_poll_enable(struct drm_device *dev)
>   *- drm_mode_validate_flag() checks the modes against basic connector
>   *  capabilities (interlace_allowed,doublescan_allowed,stereo_allowed)
>   *- the optional _connector_helper_funcs.mode_valid helper can
> perform
> - *  driver and/or hardware specific checks
> + *  driver and/or sink specific checks
> + *- the optional _crtc_helper_funcs.mode_valid and
> + *  _encoder_helper_funcs.mode_valid helpers can perform driver
> and/or
> + *  source specific checks which are also enforced by the
> modeset/atomic
> + *  helpers
>   *
>   * 5. Any mode whose status is not OK is pruned from the connector's modes
> list,
>   *accompanied by a debug message indicating the reason for the mode's
> @@ -428,8 +482,8 @@ int
> drm_helper_probe_single_connector_modes(struct drm_connector *connector,
>   if (mode->status == MODE_OK)
>   mode->status = drm_mode_validate_flag(mode,
> mode_flags);
> 
> - if (mode->status == MODE_OK && connector_funcs->mode_valid)
> - mode->status = connector_funcs->mode_valid(connector,
> + if (mode->status == 

[Bug 96868] AMDGPU Tonga only does 2560x1440 at 120hz, switching to 144hz causes display errors, same thing used to happen with fglrx.

2017-05-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=96868

--- Comment #22 from Jonas  ---
I use amdgpu driver, so I guessed I only need patch 1, 3 & 4. This is my first
time patching a kernel, I hope I did it right.

I tried patching 4.10.15 and 4.11, but the result is the same: with 120Hz the
screen starts flickering if I have more than 3-4 windows open; with 144Hz even
with a single terminal the flickering is constant (when moving it around).

Thanks for your time and work.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: fourcc byteorder: brings header file comments in line with reality.

2017-05-12 Thread Ville Syrjälä
On Thu, May 11, 2017 at 11:23:11PM +0200, Pavel Machek wrote:
> On Fri 2017-04-21 14:08:04, Ville Syrjälä wrote:
> > On Fri, Apr 21, 2017 at 11:50:18AM +0200, Gerd Hoffmann wrote:
> > > On Fr, 2017-04-21 at 12:25 +0300, Ville Syrjälä wrote:
> > > > On Fri, Apr 21, 2017 at 09:58:24AM +0200, Gerd Hoffmann wrote:
> > > > > While working on graphics support for virtual machines on ppc64 (which
> > > > > exists in both little and big endian variants) I've figured the 
> > > > > comments
> > > > > for various drm fourcc formats in the header file don't match reality.
> > > > > 
> > > > > Comments says the RGB formats are little endian, but in practice they
> > > > > are native endian.  Look at the drm_mode_legacy_fb_format() helper.  
> > > > > It
> > > > > maps -- for example -- bpp/depth 32/24 to DRM_FORMAT_XRGB, no 
> > > > > matter
> > > > > whenever the machine is little endian or big endian.  The users of 
> > > > > this
> > > > > function (fbdev emulation, DRM_IOCTL_MODE_ADDFB) expect the 
> > > > > framebuffer
> > > > > is native endian, not little endian.  Most userspace also operates on
> > > > > native endian only.
> > > > 
> > > > I'm not a fan of "native". Native to what? "CPU" or "host" is what I'd
> > > > call it.
> > > 
> > > native == whatever the cpu is using.
> > > 
> > > I personally find "native" more intuitive, but at the end of the day I
> > > don't mind much.  If people prefer "host" over "native" I'll change it.
> > 
> > "native" to me feels more like "native to the GPU" since these things
> > really are tied to the GPU not the CPU. That's also why I went with the
> > explicit endianness originally so that the driver could properly declare
> > what the GPU supports.
> 
> You can easily have more than one GPU in the system. Plus these are
> used by cameras / frame grabbers, too. So anything else than CPU
> endianness is badly defined.

The framebuffer has very little to do with the CPU. The display
controller is the only consumer, and the producer could be
whatever.

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC v2 0/7] drm: asynchronous atomic plane update

2017-05-12 Thread Ville Syrjälä
On Thu, May 11, 2017 at 04:29:56PM -0300, Gustavo Padovan wrote:
> 2017-05-09 Ville Syrjälä :
> 
> > On Thu, Apr 27, 2017 at 12:15:12PM -0300, Gustavo Padovan wrote:
> > > From: Gustavo Padovan 
> > > 
> > > Hi,
> > > 
> > > Second take of Asynchronous Plane Updates over Atomic. Here I looked
> > > to msm, vc4 and i915 to identify a common pattern to create atomic helpers
> > > for async updates. So in patch 1 drm_atomic_async_check() and
> > > drm_atomic_helper_async_commit() are introduced along with driver's plane 
> > > hooks:
> > > ->atomic_async_check() and ->atomic_async_commit().
> > > 
> > > For now we only support async update for one plane at a time. Also the 
> > > async
> > > update can't modify the CRTC so no modesets are allowed.
> > > 
> > > Then the other patches add support for it in the drivers. I did virtio 
> > > mostly
> > > for testing. i915 have been converted and I've been using it without any
> > > problem. IGT tests seems to be fine, but there are somewhat random 
> > > failures
> > > with or without the async update changes. msm and vc4 are only 
> > > compile-tested.
> > > So I think this needs more testing
> > > 
> > > I started IGT changes to test the Atomic IOCTL with the new flag:
> > > 
> > > https://git.collabora.com/cgit/user/padovan/intel-gpu-tools.git/
> > 
> > BTW I also realized recently that this is probably not going to work
> > w.r.t. per-crtc out fences. I know we agrees earlier that the
> > "return -1" trick would work, but now that I think about it again,
> > I don't think it actually will work when combined with non-blocking
> > commits since we can't decide whether to return -1 or a fence
> > until the commit has actually been performed.
> 
> What we agreed wasn't that the 1st request was going to return the

I presume you meant "was"

> out-fence and the subsequent requests modifying that request would
> return -1. How does that change with non-blocking?

With non-blocking the commit happens after the ioctl has returned to
userspace, so it's too late to return the -1.

I suppose one option would be to avoid in fences altogether. So we'd
do the synchronization in userspace, and then do a blocking commit
without in fences to get the out fence. But that would open the
thing up to more scheduling latencies and whatnot since userspace
would have to be involved more.

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/5] drm/syncobj: add sync obj wait interface. (v2)

2017-05-12 Thread Christian König

Am 12.05.2017 um 10:49 schrieb Chris Wilson:

On Fri, May 12, 2017 at 10:34:54AM +1000, Dave Airlie wrote:

+static int drm_syncobj_wait_all_fences(struct drm_device *dev,
+  struct drm_file *file_private,
+  struct drm_syncobj_wait *wait,
+  uint32_t *handles)
+{
+   uint32_t i;
+   int ret = 0;
+   unsigned long timeout = nsecs_to_jiffies(wait->timeout_ns);
+
+   for (i = 0; i < wait->count_handles; i++) {
+   struct dma_fence *fence;
+
+   ret = drm_syncobj_fence_get(file_private, handles[i],
+   );
+   if (ret)
+   return ret;
+
+   if (!fence)
+   continue;
+
+   ret = dma_fence_wait_timeout(fence, true, timeout);

Doesn't handle -EINTR yet with timeout. If having a drmIoctl() that
can't be tricked into turning a short waiting into an indefinite one is a
goal.


Yeah, Daniel summarized that once nicely by noting that timeouts should 
be absolute not relative.


Christian.


-Chris



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/5] drm/syncobj: add sync obj wait interface. (v2)

2017-05-12 Thread Chris Wilson
On Fri, May 12, 2017 at 10:34:54AM +1000, Dave Airlie wrote:
> +static int drm_syncobj_wait_all_fences(struct drm_device *dev,
> +struct drm_file *file_private,
> +struct drm_syncobj_wait *wait,
> +uint32_t *handles)
> +{
> + uint32_t i;
> + int ret = 0;
> + unsigned long timeout = nsecs_to_jiffies(wait->timeout_ns);
> +
> + for (i = 0; i < wait->count_handles; i++) {
> + struct dma_fence *fence;
> +
> + ret = drm_syncobj_fence_get(file_private, handles[i],
> + );
> + if (ret)
> + return ret;
> +
> + if (!fence)
> + continue;
> +
> + ret = dma_fence_wait_timeout(fence, true, timeout);

Doesn't handle -EINTR yet with timeout. If having a drmIoctl() that
can't be tricked into turning a short waiting into an indefinite one is a
goal.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >