[GIT PULL] exynos-drm-fixes

2017-01-16 Thread Inki Dae
Hi Dave,

   Just regression fixups to resolve page fault issue of DECON device.

   Please kindly let me know if there is any problem.

Thanks,
Inki Dae

The following changes since commit 9afe69d5a9495f8b023017e4c328fa717e00f092:

  Merge tag 'drm-misc-fixes-2017-01-09' of 
git://anongit.freedesktop.org/git/drm-misc into drm-fixes (2017-01-10 08:18:53 
+1000)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos 
exynos-drm-fixes

for you to fetch changes up to 821b40b79db7dedbfe15ab330dfd181e661a533f:

  drm/exynos/decon5433: set STANDALONE_UPDATE_F also if planes are disabled 
(2017-01-13 18:22:51 +0900)


Andrzej Hajda (2):
  drm/exynos/decon5433: update shadow registers iff there are active windows
  drm/exynos/decon5433: set STANDALONE_UPDATE_F also if planes are disabled

 drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/exynos: use atomic helper commit

2017-01-16 Thread Inki Dae
This patch relpaces specific atomic commit function
with atomic helper commit one, which also includes
atomic_commit_tail callback for Exynos SoC becasue
crtc devices on Exynos SoC uses power domain device
so drm_atomic_helper_commit_planes should be called
after drm_atomic_helper_commit_modeset_enables.

Signed-off-by: Inki Dae 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c |   9 ++-
 drivers/gpu/drm/exynos/exynos_drm_drv.c  | 110 +--
 drivers/gpu/drm/exynos/exynos_drm_fb.c   |  25 ++-
 3 files changed, 33 insertions(+), 111 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 2530bf5..47da612 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -39,6 +39,14 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 
if (exynos_crtc->ops->disable)
exynos_crtc->ops->disable(exynos_crtc);
+
+   if (crtc->state->event && !crtc->state->active) {
+   spin_lock_irq(&crtc->dev->event_lock);
+   drm_crtc_send_vblank_event(crtc, crtc->state->event);
+   spin_unlock_irq(&crtc->dev->event_lock);
+
+   crtc->state->event = NULL;
+   }
 }
 
 static void
@@ -94,7 +102,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
drm_crtc_send_vblank_event(crtc, event);
spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
}
-
 }
 
 static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 3ec0535..9d0df00 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -38,56 +38,6 @@
 #define DRIVER_MAJOR   1
 #define DRIVER_MINOR   0
 
-struct exynos_atomic_commit {
-   struct work_struct  work;
-   struct drm_device   *dev;
-   struct drm_atomic_state *state;
-   u32 crtcs;
-};
-
-static void exynos_atomic_commit_complete(struct exynos_atomic_commit *commit)
-{
-   struct drm_device *dev = commit->dev;
-   struct exynos_drm_private *priv = dev->dev_private;
-   struct drm_atomic_state *state = commit->state;
-
-   drm_atomic_helper_commit_modeset_disables(dev, state);
-
-   drm_atomic_helper_commit_modeset_enables(dev, state);
-
-   /*
-* Exynos can't update planes with CRTCs and encoders disabled,
-* its updates routines, specially for FIMD, requires the clocks
-* to be enabled. So it is necessary to handle the modeset operations
-* *before* the commit_planes() step, this way it will always
-* have the relevant clocks enabled to perform the update.
-*/
-
-   drm_atomic_helper_commit_planes(dev, state, 0);
-
-   drm_atomic_helper_wait_for_vblanks(dev, state);
-
-   drm_atomic_helper_cleanup_planes(dev, state);
-
-   drm_atomic_state_put(state);
-
-   spin_lock(&priv->lock);
-   priv->pending &= ~commit->crtcs;
-   spin_unlock(&priv->lock);
-
-   wake_up_all(&priv->wait);
-
-   kfree(commit);
-}
-
-static void exynos_drm_atomic_work(struct work_struct *work)
-{
-   struct exynos_atomic_commit *commit = container_of(work,
-   struct exynos_atomic_commit, work);
-
-   exynos_atomic_commit_complete(commit);
-}
-
 static struct device *exynos_drm_get_dma_device(void);
 
 static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
@@ -202,65 +152,6 @@ static void exynos_drm_unload(struct drm_device *dev)
dev->dev_private = NULL;
 }
 
-static int commit_is_pending(struct exynos_drm_private *priv, u32 crtcs)
-{
-   bool pending;
-
-   spin_lock(&priv->lock);
-   pending = priv->pending & crtcs;
-   spin_unlock(&priv->lock);
-
-   return pending;
-}
-
-int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state 
*state,
-bool nonblock)
-{
-   struct exynos_drm_private *priv = dev->dev_private;
-   struct exynos_atomic_commit *commit;
-   struct drm_crtc *crtc;
-   struct drm_crtc_state *crtc_state;
-   int i, ret;
-
-   commit = kzalloc(sizeof(*commit), GFP_KERNEL);
-   if (!commit)
-   return -ENOMEM;
-
-   ret = drm_atomic_helper_prepare_planes(dev, state);
-   if (ret) {
-   kfree(commit);
-   return ret;
-   }
-
-   /* This is the point of no return */
-
-   INIT_WORK(&commit->work, exynos_drm_atomic_work);
-   commit->dev = dev;
-   commit->state = state;
-
-   /* Wait until all affected CRTCs have completed previous commits and
-* mark them as pending.
-*/
-   for_each_crtc_in_state(state, crtc, crtc_state, i)
-   commit->crtcs |= drm_crtc_mask(crtc);
-
-   wait_event(priv->wait, !commit_is_pending(pri

[PATCH] drm/exynos: remove unnecessary codes

2017-01-16 Thread Inki Dae
This patch removes exynos_drm_crtc_cancel_page_flip call
when drm is closed because at that time, events will be released
by drm_events_release function.

Change-Id: I156ea27a4c90aa87a27a50415515fa334148c912
Signed-off-by: Inki Dae 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 9d0df00..035d02e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -198,13 +198,7 @@ static int exynos_drm_open(struct drm_device *dev, struct 
drm_file *file)
 static void exynos_drm_preclose(struct drm_device *dev,
struct drm_file *file)
 {
-   struct drm_crtc *crtc;
-
exynos_drm_subdrv_close(dev, file);
-
-   list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
-   exynos_drm_crtc_cancel_page_flip(crtc, file);
-
 }
 
 static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
-- 
1.9.1

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


Re: [Intel-gfx] [RESEND PATCH v14 2/2] drm/i915: Put "cooked" vlank counters in frame CRC lines

2017-01-16 Thread Tomeu Vizoso
On 10 January 2017 at 17:31, Daniel Vetter  wrote:
> On Tue, Jan 10, 2017 at 05:54:57PM +0200, Ville Syrjälä wrote:
>> On Tue, Jan 10, 2017 at 02:43:05PM +0100, Tomeu Vizoso wrote:
>> > Use drm_accurate_vblank_count so we have the full 32 bit to represent
>> > the frame counter and userspace has a simpler way of knowing when the
>> > counter wraps around.
>> >
>> > Signed-off-by: Tomeu Vizoso 
>> > Reviewed-by: Emil Velikov 
>> > Reviewed-by: Robert Foss 
>> > ---
>> >
>> >  drivers/gpu/drm/i915/i915_irq.c | 6 +++---
>> >  1 file changed, 3 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/i915_irq.c 
>> > b/drivers/gpu/drm/i915/i915_irq.c
>> > index b9beb5955dae..75fb1f66cc0c 100644
>> > --- a/drivers/gpu/drm/i915/i915_irq.c
>> > +++ b/drivers/gpu/drm/i915/i915_irq.c
>> > @@ -1557,7 +1557,6 @@ static void display_pipe_crc_irq_handler(struct 
>> > drm_i915_private *dev_priv,
>> > struct drm_driver *driver = dev_priv->drm.driver;
>> > uint32_t crcs[5];
>> > int head, tail;
>> > -   u32 frame;
>> >
>> > spin_lock(&pipe_crc->lock);
>> > if (pipe_crc->source) {
>> > @@ -1612,8 +1611,9 @@ static void display_pipe_crc_irq_handler(struct 
>> > drm_i915_private *dev_priv,
>> > crcs[2] = crc2;
>> > crcs[3] = crc3;
>> > crcs[4] = crc4;
>> > -   frame = driver->get_vblank_counter(&dev_priv->drm, pipe);
>> > -   drm_crtc_add_crc_entry(&crtc->base, true, frame, crcs);
>> > +   drm_crtc_add_crc_entry(&crtc->base, true,
>> > +  drm_accurate_vblank_count(&crtc->base),
>>
>> My assumption would be that this gets called after the vblank irq
>> handler, so using the _accurate version seems a bit overkill.
>
> Since we're at like v15 of this I figured I'll pull this in, and we can
> polish this a bit more later. Tomeu, can you pls do that follow-up patch
> and get Ville to review+merge it.

At least on the SKL and SNB I have here, the -sequence subtests in
kms_pipe_crc_basic fail if I replace the call to
drm_accurate_vblank_count with drm_crtc_vblank_count.

Any ideas on why this could be?

Thanks,

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


Re: [PATCH v2] drm/exynos: mic: Add runtime PM support

2017-01-16 Thread Inki Dae
Applied.

Thanks.

2017년 01월 13일 17:30에 Marek Szyprowski 이(가) 쓴 글:
> This patch adds runtime support calls to notify device core when MIC
> device is really in use. Runtime PM is implemented by enabling and
> disabling clocks like in other Exynos DRM subdrivers. Adding runtime
> PM support is needed to let power domain with this device to be turned
> off when display is not used.
> 
> Signed-off-by: Marek Szyprowski 
> ---
> Changelog:
> v2:
> - moved clock control to runtime PM callbacks as requested by Inki Dae
> 
> v1: http://www.spinics.net/lists/dri-devel/msg129095.html
> - initial version
> ---
>  drivers/gpu/drm/exynos/exynos_drm_mic.c | 82 
> -
>  1 file changed, 59 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c 
> b/drivers/gpu/drm/exynos/exynos_drm_mic.c
> index a0def0be6d65..430f67c63707 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
> @@ -19,6 +19,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -312,7 +313,6 @@ static void mic_disable(struct drm_bridge *bridge) { }
>  static void mic_post_disable(struct drm_bridge *bridge)
>  {
>   struct exynos_mic *mic = bridge->driver_private;
> - int i;
>  
>   mutex_lock(&mic_mutex);
>   if (!mic->enabled)
> @@ -320,9 +320,7 @@ static void mic_post_disable(struct drm_bridge *bridge)
>  
>   mic_set_path(mic, 0);
>  
> - for (i = NUM_CLKS - 1; i > -1; i--)
> - clk_disable_unprepare(mic->clks[i]);
> -
> + pm_runtime_put(mic->dev);
>   mic->enabled = 0;
>  
>  already_disabled:
> @@ -332,27 +330,22 @@ static void mic_post_disable(struct drm_bridge *bridge)
>  static void mic_pre_enable(struct drm_bridge *bridge)
>  {
>   struct exynos_mic *mic = bridge->driver_private;
> - int ret, i;
> + int ret;
>  
>   mutex_lock(&mic_mutex);
>   if (mic->enabled)
> - goto already_enabled;
> + goto unlock;
>  
> - for (i = 0; i < NUM_CLKS; i++) {
> - ret = clk_prepare_enable(mic->clks[i]);
> - if (ret < 0) {
> - DRM_ERROR("Failed to enable clock (%s)\n",
> - clk_names[i]);
> - goto turn_off_clks;
> - }
> - }
> + ret = pm_runtime_get_sync(mic->dev);
> + if (ret < 0)
> + goto unlock;
>  
>   mic_set_path(mic, 1);
>  
>   ret = mic_sw_reset(mic);
>   if (ret) {
>   DRM_ERROR("Failed to reset\n");
> - goto turn_off_clks;
> + goto turn_off;
>   }
>  
>   if (!mic->i80_mode)
> @@ -365,10 +358,9 @@ static void mic_pre_enable(struct drm_bridge *bridge)
>  
>   return;
>  
> -turn_off_clks:
> - while (--i > -1)
> - clk_disable_unprepare(mic->clks[i]);
> -already_enabled:
> +turn_off:
> + pm_runtime_put(mic->dev);
> +unlock:
>   mutex_unlock(&mic_mutex);
>  }
>  
> @@ -401,14 +393,12 @@ static void exynos_mic_unbind(struct device *dev, 
> struct device *master,
> void *data)
>  {
>   struct exynos_mic *mic = dev_get_drvdata(dev);
> - int i;
>  
>   mutex_lock(&mic_mutex);
>   if (!mic->enabled)
>   goto already_disabled;
>  
> - for (i = NUM_CLKS - 1; i > -1; i--)
> - clk_disable_unprepare(mic->clks[i]);
> + pm_runtime_put(mic->dev);
>  
>  already_disabled:
>   mutex_unlock(&mic_mutex);
> @@ -421,6 +411,41 @@ static void exynos_mic_unbind(struct device *dev, struct 
> device *master,
>   .unbind = exynos_mic_unbind,
>  };
>  
> +#ifdef CONFIG_PM
> +static int exynos_mic_suspend(struct device *dev)
> +{
> + struct exynos_mic *mic = dev_get_drvdata(dev);
> + int i;
> +
> + for (i = NUM_CLKS - 1; i > -1; i--)
> + clk_disable_unprepare(mic->clks[i]);
> +
> + return 0;
> +}
> +
> +static int exynos_mic_resume(struct device *dev)
> +{
> + struct exynos_mic *mic = dev_get_drvdata(dev);
> + int ret, i;
> +
> + for (i = 0; i < NUM_CLKS; i++) {
> + ret = clk_prepare_enable(mic->clks[i]);
> + if (ret < 0) {
> + DRM_ERROR("Failed to enable clock (%s)\n",
> + clk_names[i]);
> + while (--i > -1)
> + clk_disable_unprepare(mic->clks[i]);
> + return ret;
> + }
> + }
> + return 0;
> +}
> +#endif
> +
> +static const struct dev_pm_ops exynos_mic_pm_ops = {
> + SET_RUNTIME_PM_OPS(exynos_mic_suspend, exynos_mic_resume, NULL)
> +};
> +
>  static int exynos_mic_probe(struct platform_device *pdev)
>  {
>   struct device *dev = &pdev->dev;
> @@ -473,9 +498,18 @@ static int exynos_mic_probe(struct platform_device *pdev)
>  
>   platform_set_drvdata(pdev, mic);
>  
> + pm_runtime_enable(dev

Re: [PATCH] drm/exynos: remove unnecessary codes

2017-01-16 Thread Inki Dae


2017년 01월 16일 18:13에 Inki Dae 이(가) 쓴 글:
> This patch removes exynos_drm_crtc_cancel_page_flip call
> when drm is closed because at that time, events will be released
> by drm_events_release function.
> 
> Change-Id: I156ea27a4c90aa87a27a50415515fa334148c912

Oops, I forgot to remove above Changed-Id. Please ignore this line. I will 
merge it without the line.

Thanks.

> Signed-off-by: Inki Dae 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 6 --
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 9d0df00..035d02e 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -198,13 +198,7 @@ static int exynos_drm_open(struct drm_device *dev, 
> struct drm_file *file)
>  static void exynos_drm_preclose(struct drm_device *dev,
>   struct drm_file *file)
>  {
> - struct drm_crtc *crtc;
> -
>   exynos_drm_subdrv_close(dev, file);
> -
> - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
> - exynos_drm_crtc_cancel_page_flip(crtc, file);
> -
>  }
>  
>  static void exynos_drm_postclose(struct drm_device *dev, struct drm_file 
> *file)
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2.1 1/7] drm/atomic: Add new iterators over all state, v3.

2017-01-16 Thread Maarten Lankhorst
Op 15-01-17 om 20:56 schreef Laurent Pinchart:
> Hi Maarten,
>
> Thank you for the patch.
>
> On Tuesday 10 Jan 2017 14:46:58 Maarten Lankhorst wrote:
>> Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to
>> replace the old for_each_xxx_in_state ones. This is useful for >1 flip
>> depth and getting rid of all xxx->state dereferences.
>>
>> This requires extra fixups done when committing a state after
>> duplicating, which in general isn't valid but is used by suspend/resume.
>> To handle these, introduce drm_atomic_helper_commit_duplicated_state
>> which performs those fixups before checking & committing the state.
>>
>> Changes since v1:
>> - Remove nonblock parameter for commit_duplicated_state.
>> Changes since v2:
>> - Use commit_duplicated_state for i915 load detection.
>> - Add WARN_ON(old_state != obj->state) before swapping.
>>
>> Signed-off-by: Maarten Lankhorst 
>> ---
>> Forgot that there was a v2. It still broke on igt load detect tests, this
>> should be the fix.
>>
>> I also added a big WARN_ON before swapping to ensure old state is correct.
>> At this point we can no longer fix it because atomic_check is called with
>> the wrong items, but it will help limit the damage.
> This patch now conflicts with "[PATCH v2 4/7] drm/atomic: Fix atomic helpers 
> to use the new iterator macros.". Could you fix that and repost the whole 
> series ?
Yeah I noticed. I wanted to resend because patch 7 had a small bug too, but 
trybot was failing on some tests.
After doing some bisection by sending patches it turns out the error went away 
by itself. The failing test also didn't seem related to the series.
With that issue gone, I'll resend.

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


Re: [PATCH] drm: etnaviv: constify etnaviv_iommu_ops structures

2017-01-16 Thread Lucas Stach
Am Montag, den 16.01.2017, 00:20 +0530 schrieb Bhumika Goyal:
> Declare etnaviv_iommu_ops structure as const as it is only used when
> the reference of one of its field is stored in the ops field of a
> iommu_domain structure. This ops field is of type const, so 
> etnaviv_iommu_ops structures having similar properties can be declared 
> const too.
> Done using Coccinelle:
> 
> @r1 disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct etnaviv_iommu_ops i@p={...};
> 
> @ok1@
> identifier r1.i;
> position p;
> struct etnaviv_iommu_domain x;
> @@
> x.domain.ops=&i...@p.ops;
> 
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct etnaviv_iommu_ops i;
> 
> Before and after size details of .o file remains the same after 
> cross compiling for arm architecture.
> 
> Signed-off-by: Bhumika Goyal 

Thanks, I've applied this patch to my tree.

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_iommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> index 81f1583..7a7c97f 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
> @@ -184,7 +184,7 @@ static void etnaviv_iommuv1_dump(struct iommu_domain 
> *domain, void *buf)
>   memcpy(buf, etnaviv_domain->pgtable.pgtable, PT_SIZE);
>  }
>  
> -static struct etnaviv_iommu_ops etnaviv_iommu_ops = {
> +static const struct etnaviv_iommu_ops etnaviv_iommu_ops = {
>   .ops = {
>   .domain_free = etnaviv_domain_free,
>   .map = etnaviv_iommuv1_map,


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


Re: [PATCH] drm/exynos: remove unnecessary codes

2017-01-16 Thread Andrzej Hajda
On 16.01.2017 10:13, Inki Dae wrote:
> This patch removes exynos_drm_crtc_cancel_page_flip call
> when drm is closed because at that time, events will be released
> by drm_events_release function.
>
> Change-Id: I156ea27a4c90aa87a27a50415515fa334148c912
> Signed-off-by: Inki Dae 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 6 --
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 9d0df00..035d02e 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -198,13 +198,7 @@ static int exynos_drm_open(struct drm_device *dev, 
> struct drm_file *file)
>  static void exynos_drm_preclose(struct drm_device *dev,
>   struct drm_file *file)
>  {
> - struct drm_crtc *crtc;
> -
>   exynos_drm_subdrv_close(dev, file);
> -
> - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
> - exynos_drm_crtc_cancel_page_flip(crtc, file);

Since this is single user of exynos_drm_crtc_cancel_page_flip, this
function can be removed as well.
Beside this:
Reviewed-by: Andrzej Hajda 


Regards
Andrzej

> -
>  }
>  
>  static void exynos_drm_postclose(struct drm_device *dev, struct drm_file 
> *file)


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


[PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state.

2017-01-16 Thread Maarten Lankhorst
Fourth iteration. Instead of trying to convert all drivers straight away,
implement all macros that are required to get state working.

Old situation:
Use obj->state, which can refer to old or new state.
Use drm_atomic_get_(existing_)obj_state, which can refer to new or old state.
Use for_each_obj_in_state, which refers to new or old state.

New situation:

During atomic check:
- Use drm_atomic_get_obj_state to add a object to the atomic state,
  or get the new state.
- Use drm_atomic_get_(old/new)_obj_state to peek at the new/old state,
  without adding the object. This will return NULL if the object is
  not part of the state. For planes and connectors the relevant crtc_state
  is added, so this will work to get the crtc_state from obj_state->crtc
  too, this means not having to write some error handling. 

During atomic commit:
- Do not use drm_atomic_get_obj_state, obj->state or 
drm_atomic_get_(existing_)obj_state
  any more, replace with drm_atomic_get_old/new_obj_state calls as required.

During both:
- Use for_each_(new,old,oldnew)_obj_in_state to get the old or new state as 
needed.
  oldnew will be renamed to for_each_obj_in_state after all callers are 
converted
  to the new api.

When not doing atomic updates:
Look at obj->state for now. I have some patches to fix this but I was asked to
make it return a const state. This breaks a lot of users though so I skipped 
that
patch in this iteration.

This series will return the correct state regardless of swapping.

Maarten Lankhorst (7):
  drm/atomic: Add new iterators over all state, v3.
  drm/atomic: Make add_affected_connectors look at crtc_state.
  drm/atomic: Use new atomic iterator macros.
  drm/atomic: Fix atomic helpers to use the new iterator macros.
  drm/atomic: Add macros to access existing old/new state
  drm/atomic: Convert get_existing_state callers to get_old/new_state, v2.
  drm/blend: Use new atomic iterator macros.

 drivers/gpu/drm/drm_atomic.c |  39 ++--
 drivers/gpu/drm/drm_atomic_helper.c  | 377 ---
 drivers/gpu/drm/drm_blend.c  |  23 +--
 drivers/gpu/drm/i915/intel_display.c |  13 +-
 include/drm/drm_atomic.h | 180 -
 include/drm/drm_atomic_helper.h  |   2 +
 6 files changed, 438 insertions(+), 196 deletions(-)

-- 
2.7.4

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


[PATCH v3 3/7] drm/atomic: Use new atomic iterator macros.

2017-01-16 Thread Maarten Lankhorst
Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_atomic.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 18cdf2c956c6..7b61e0da9ace 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1562,7 +1562,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 
DRM_DEBUG_ATOMIC("checking %p\n", state);
 
-   for_each_plane_in_state(state, plane, plane_state, i) {
+   for_each_new_plane_in_state(state, plane, plane_state, i) {
ret = drm_atomic_plane_check(plane, plane_state);
if (ret) {
DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic core check 
failed\n",
@@ -1571,7 +1571,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
}
}
 
-   for_each_crtc_in_state(state, crtc, crtc_state, i) {
+   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
ret = drm_atomic_crtc_check(crtc, crtc_state);
if (ret) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check 
failed\n",
@@ -1584,7 +1584,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
ret = config->funcs->atomic_check(state->dev, state);
 
if (!state->allow_modeset) {
-   for_each_crtc_in_state(state, crtc, crtc_state, i) {
+   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
if (drm_atomic_crtc_needs_modeset(crtc_state)) {
DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requires full 
modeset\n",
 crtc->base.id, crtc->name);
@@ -1668,13 +1668,13 @@ static void drm_atomic_print_state(const struct 
drm_atomic_state *state)
 
DRM_DEBUG_ATOMIC("checking %p\n", state);
 
-   for_each_plane_in_state(state, plane, plane_state, i)
+   for_each_new_plane_in_state(state, plane, plane_state, i)
drm_atomic_plane_print_state(&p, plane_state);
 
-   for_each_crtc_in_state(state, crtc, crtc_state, i)
+   for_each_new_crtc_in_state(state, crtc, crtc_state, i)
drm_atomic_crtc_print_state(&p, crtc_state);
 
-   for_each_connector_in_state(state, connector, connector_state, i)
+   for_each_new_connector_in_state(state, connector, connector_state, i)
drm_atomic_connector_print_state(&p, connector_state);
 }
 
@@ -1961,7 +1961,7 @@ static int prepare_crtc_signaling(struct drm_device *dev,
if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)
return 0;
 
-   for_each_crtc_in_state(state, crtc, crtc_state, i) {
+   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
u64 __user *fence_ptr;
 
fence_ptr = get_out_fence_for_crtc(crtc_state->state, crtc);
@@ -2041,7 +2041,7 @@ static void complete_crtc_signaling(struct drm_device 
*dev,
return;
}
 
-   for_each_crtc_in_state(state, crtc, crtc_state, i) {
+   for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
/*
 * TEST_ONLY and PAGE_FLIP_EVENT are mutually
 * exclusive, if they weren't, this code should be
-- 
2.7.4

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


[PATCH v3 2/7] drm/atomic: Make add_affected_connectors look at crtc_state.

2017-01-16 Thread Maarten Lankhorst
This kills another dereference of connector->state. connector_mask
holds all unchanged connectors at least and any changed connectors
are already in state anyway.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_atomic.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 1c1cbf436717..18cdf2c956c6 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1419,8 +1419,13 @@ drm_atomic_add_affected_connectors(struct 
drm_atomic_state *state,
struct drm_connector *connector;
struct drm_connector_state *conn_state;
struct drm_connector_list_iter conn_iter;
+   struct drm_crtc_state *crtc_state;
int ret;
 
+   crtc_state = drm_atomic_get_crtc_state(state, crtc);
+   if (IS_ERR(crtc_state))
+   return PTR_ERR(crtc_state);
+
ret = drm_modeset_lock(&config->connection_mutex, state->acquire_ctx);
if (ret)
return ret;
@@ -1429,12 +1434,12 @@ drm_atomic_add_affected_connectors(struct 
drm_atomic_state *state,
 crtc->base.id, crtc->name, state);
 
/*
-* Changed connectors are already in @state, so only need to look at the
-* current configuration.
+* Changed connectors are already in @state, so only need to look
+* at the connector_mask in crtc_state.
 */
drm_connector_list_iter_get(state->dev, &conn_iter);
drm_for_each_connector_iter(connector, &conn_iter) {
-   if (connector->state->crtc != crtc)
+   if (!(crtc_state->connector_mask & (1 << 
drm_connector_index(connector
continue;
 
conn_state = drm_atomic_get_connector_state(state, connector);
-- 
2.7.4

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


[PATCH v3 4/7] drm/atomic: Fix atomic helpers to use the new iterator macros.

2017-01-16 Thread Maarten Lankhorst
Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_atomic_helper.c | 293 +++-
 1 file changed, 152 insertions(+), 141 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index d153e8a72921..b26cf786ce12 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -63,14 +63,15 @@
  */
 static void
 drm_atomic_helper_plane_changed(struct drm_atomic_state *state,
+   struct drm_plane_state *old_plane_state,
struct drm_plane_state *plane_state,
struct drm_plane *plane)
 {
struct drm_crtc_state *crtc_state;
 
-   if (plane->state->crtc) {
+   if (old_plane_state->crtc) {
crtc_state = drm_atomic_get_existing_crtc_state(state,
-   
plane->state->crtc);
+   
old_plane_state->crtc);
 
if (WARN_ON(!crtc_state))
return;
@@ -104,7 +105,7 @@ static int handle_conflicting_encoders(struct 
drm_atomic_state *state,
 * part of the state. If the same encoder is assigned to multiple
 * connectors bail out.
 */
-   for_each_connector_in_state(state, connector, conn_state, i) {
+   for_each_new_connector_in_state(state, connector, conn_state, i) {
const struct drm_connector_helper_funcs *funcs = 
connector->helper_private;
struct drm_encoder *new_encoder;
 
@@ -245,22 +246,22 @@ steal_encoder(struct drm_atomic_state *state,
 {
struct drm_crtc_state *crtc_state;
struct drm_connector *connector;
-   struct drm_connector_state *connector_state;
+   struct drm_connector_state *old_connector_state, *new_connector_state;
int i;
 
-   for_each_connector_in_state(state, connector, connector_state, i) {
+   for_each_oldnew_connector_in_state(state, connector, 
old_connector_state, new_connector_state, i) {
struct drm_crtc *encoder_crtc;
 
-   if (connector_state->best_encoder != encoder)
+   if (new_connector_state->best_encoder != encoder)
continue;
 
-   encoder_crtc = connector->state->crtc;
+   encoder_crtc = old_connector_state->crtc;
 
DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s], 
stealing it\n",
 encoder->base.id, encoder->name,
 encoder_crtc->base.id, encoder_crtc->name);
 
-   set_best_encoder(state, connector_state, NULL);
+   set_best_encoder(state, new_connector_state, NULL);
 
crtc_state = drm_atomic_get_existing_crtc_state(state, 
encoder_crtc);
crtc_state->connectors_changed = true;
@@ -272,7 +273,8 @@ steal_encoder(struct drm_atomic_state *state,
 static int
 update_connector_routing(struct drm_atomic_state *state,
 struct drm_connector *connector,
-struct drm_connector_state *connector_state)
+struct drm_connector_state *old_connector_state,
+struct drm_connector_state *new_connector_state)
 {
const struct drm_connector_helper_funcs *funcs;
struct drm_encoder *new_encoder;
@@ -282,24 +284,24 @@ update_connector_routing(struct drm_atomic_state *state,
 connector->base.id,
 connector->name);
 
-   if (connector->state->crtc != connector_state->crtc) {
-   if (connector->state->crtc) {
-   crtc_state = drm_atomic_get_existing_crtc_state(state, 
connector->state->crtc);
+   if (old_connector_state->crtc != new_connector_state->crtc) {
+   if (old_connector_state->crtc) {
+   crtc_state = drm_atomic_get_existing_crtc_state(state, 
old_connector_state->crtc);
crtc_state->connectors_changed = true;
}
 
-   if (connector_state->crtc) {
-   crtc_state = drm_atomic_get_existing_crtc_state(state, 
connector_state->crtc);
+   if (new_connector_state->crtc) {
+   crtc_state = drm_atomic_get_existing_crtc_state(state, 
new_connector_state->crtc);
crtc_state->connectors_changed = true;
}
}
 
-   if (!connector_state->crtc) {
+   if (!new_connector_state->crtc) {
DRM_DEBUG_ATOMIC("Disabling [CONNECTOR:%d:%s]\n",
connector->base.id,
connector->name);
 
-   set_best_encoder(state, connector_state, NULL);
+   set_best_encoder(state, new_connector_state, NULL);
 
return 0;
}
@@ -308,7 +310,7 @@

[PATCH v3 6/7] drm/atomic: Convert get_existing_state callers to get_old/new_state, v2.

2017-01-16 Thread Maarten Lankhorst
This is a straightforward conversion that converts all the users of
get_existing_state in atomic core to use get_old_state or get_new_state

Changes since v1:
- Fix using the wrong state in drm_atomic_helper_update_legacy_modeset_state.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_atomic.c|  6 +++---
 drivers/gpu/drm/drm_atomic_helper.c | 39 +
 drivers/gpu/drm/drm_blend.c |  3 +--
 3 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 7b61e0da9ace..6428e9469607 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1362,8 +1362,8 @@ drm_atomic_set_crtc_for_connector(struct 
drm_connector_state *conn_state,
return 0;
 
if (conn_state->crtc) {
-   crtc_state = 
drm_atomic_get_existing_crtc_state(conn_state->state,
-   
conn_state->crtc);
+   crtc_state = drm_atomic_get_new_crtc_state(conn_state->state,
+  conn_state->crtc);
 
crtc_state->connector_mask &=
~(1 << drm_connector_index(conn_state->connector));
@@ -1480,7 +1480,7 @@ drm_atomic_add_affected_planes(struct drm_atomic_state 
*state,
 {
struct drm_plane *plane;
 
-   WARN_ON(!drm_atomic_get_existing_crtc_state(state, crtc));
+   WARN_ON(!drm_atomic_get_new_crtc_state(state, crtc));
 
drm_for_each_plane_mask(plane, state->dev, crtc->state->plane_mask) {
struct drm_plane_state *plane_state =
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index b26cf786ce12..1de8d5fbc8d3 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -70,8 +70,7 @@ drm_atomic_helper_plane_changed(struct drm_atomic_state 
*state,
struct drm_crtc_state *crtc_state;
 
if (old_plane_state->crtc) {
-   crtc_state = drm_atomic_get_existing_crtc_state(state,
-   
old_plane_state->crtc);
+   crtc_state = drm_atomic_get_new_crtc_state(state, 
old_plane_state->crtc);
 
if (WARN_ON(!crtc_state))
return;
@@ -80,8 +79,7 @@ drm_atomic_helper_plane_changed(struct drm_atomic_state 
*state,
}
 
if (plane_state->crtc) {
-   crtc_state = drm_atomic_get_existing_crtc_state(state,
-   
plane_state->crtc);
+   crtc_state = drm_atomic_get_new_crtc_state(state, 
plane_state->crtc);
 
if (WARN_ON(!crtc_state))
return;
@@ -150,7 +148,7 @@ static int handle_conflicting_encoders(struct 
drm_atomic_state *state,
drm_for_each_connector_iter(connector, &conn_iter) {
struct drm_crtc_state *crtc_state;
 
-   if (drm_atomic_get_existing_connector_state(state, connector))
+   if (drm_atomic_get_new_connector_state(state, connector))
continue;
 
encoder = connector->state->best_encoder;
@@ -178,7 +176,7 @@ static int handle_conflicting_encoders(struct 
drm_atomic_state *state,
 conn_state->crtc->base.id, 
conn_state->crtc->name,
 connector->base.id, connector->name);
 
-   crtc_state = drm_atomic_get_existing_crtc_state(state, 
conn_state->crtc);
+   crtc_state = drm_atomic_get_new_crtc_state(state, 
conn_state->crtc);
 
ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
if (ret)
@@ -219,7 +217,7 @@ set_best_encoder(struct drm_atomic_state *state,
 */
WARN_ON(!crtc && encoder != conn_state->best_encoder);
if (crtc) {
-   crtc_state = drm_atomic_get_existing_crtc_state(state, 
crtc);
+   crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 
crtc_state->encoder_mask &=
~(1 << 
drm_encoder_index(conn_state->best_encoder));
@@ -230,7 +228,7 @@ set_best_encoder(struct drm_atomic_state *state,
crtc = conn_state->crtc;
WARN_ON(!crtc);
if (crtc) {
-   crtc_state = drm_atomic_get_existing_crtc_state(state, 
crtc);
+   crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
 
crtc_state->encoder_mask |=
1 << drm_encoder_index(encoder);
@@ -263,7 +261,7 @@ steal_encoder(struct drm_atomic_state *state,
 
set_best_encoder(state, new_connector_state, NULL);
 
-   crtc_state = drm_atomic_get_existing_crtc_state(state, 
encoder_crtc);
+

[PATCH v3 7/7] drm/blend: Use new atomic iterator macros.

2017-01-16 Thread Maarten Lankhorst
Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_blend.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 5c45d0852608..78cf9f6cae08 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -378,26 +378,26 @@ int drm_atomic_normalize_zpos(struct drm_device *dev,
  struct drm_atomic_state *state)
 {
struct drm_crtc *crtc;
-   struct drm_crtc_state *crtc_state;
+   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
struct drm_plane *plane;
-   struct drm_plane_state *plane_state;
+   struct drm_plane_state *old_plane_state, *new_plane_state;
int i, ret = 0;
 
-   for_each_plane_in_state(state, plane, plane_state, i) {
-   crtc = plane_state->crtc;
+   for_each_oldnew_plane_in_state(state, plane, old_plane_state, 
new_plane_state, i) {
+   crtc = new_plane_state->crtc;
if (!crtc)
continue;
-   if (plane->state->zpos != plane_state->zpos) {
-   crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
-   crtc_state->zpos_changed = true;
+   if (old_plane_state->zpos != new_plane_state->zpos) {
+   new_crtc_state = drm_atomic_get_new_crtc_state(state, 
crtc);
+   new_crtc_state->zpos_changed = true;
}
}
 
-   for_each_crtc_in_state(state, crtc, crtc_state, i) {
-   if (crtc_state->plane_mask != crtc->state->plane_mask ||
-   crtc_state->zpos_changed) {
+   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 
new_crtc_state, i) {
+   if (old_crtc_state->plane_mask != new_crtc_state->plane_mask ||
+   new_crtc_state->zpos_changed) {
ret = drm_atomic_helper_crtc_normalize_zpos(crtc,
-   crtc_state);
+   
new_crtc_state);
if (ret)
return ret;
}
-- 
2.7.4

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


[PATCH v3 5/7] drm/atomic: Add macros to access existing old/new state

2017-01-16 Thread Maarten Lankhorst
After atomic commit, these macros should be used in place of
get_existing_state. Also after commit get_xx_state should no longer
be used because it may not have the required locks.

Signed-off-by: Maarten Lankhorst 
---
 include/drm/drm_atomic.h | 99 
 1 file changed, 99 insertions(+)

diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 6062e7f27325..2e6bb7acc837 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -285,6 +285,35 @@ drm_atomic_get_existing_crtc_state(struct drm_atomic_state 
*state,
 }
 
 /**
+ * drm_atomic_get_old_crtc_state - get old crtc state, if it exists
+ * @state: global atomic state object
+ * @crtc: crtc to grab
+ *
+ * This function returns the old crtc state for the given crtc, or
+ * NULL if the crtc is not part of the global atomic state.
+ */
+static inline struct drm_crtc_state *
+drm_atomic_get_old_crtc_state(struct drm_atomic_state *state,
+ struct drm_crtc *crtc)
+{
+   return state->crtcs[drm_crtc_index(crtc)].old_state;
+}
+/**
+ * drm_atomic_get_new_crtc_state - get new crtc state, if it exists
+ * @state: global atomic state object
+ * @crtc: crtc to grab
+ *
+ * This function returns the new crtc state for the given crtc, or
+ * NULL if the crtc is not part of the global atomic state.
+ */
+static inline struct drm_crtc_state *
+drm_atomic_get_new_crtc_state(struct drm_atomic_state *state,
+ struct drm_crtc *crtc)
+{
+   return state->crtcs[drm_crtc_index(crtc)].new_state;
+}
+
+/**
  * drm_atomic_get_existing_plane_state - get plane state, if it exists
  * @state: global atomic state object
  * @plane: plane to grab
@@ -300,6 +329,36 @@ drm_atomic_get_existing_plane_state(struct 
drm_atomic_state *state,
 }
 
 /**
+ * drm_atomic_get_old_plane_state - get plane state, if it exists
+ * @state: global atomic state object
+ * @plane: plane to grab
+ *
+ * This function returns the old plane state for the given plane, or
+ * NULL if the plane is not part of the global atomic state.
+ */
+static inline struct drm_plane_state *
+drm_atomic_get_old_plane_state(struct drm_atomic_state *state,
+  struct drm_plane *plane)
+{
+   return state->planes[drm_plane_index(plane)].old_state;
+}
+
+/**
+ * drm_atomic_get_new_plane_state - get plane state, if it exists
+ * @state: global atomic state object
+ * @plane: plane to grab
+ *
+ * This function returns the new plane state for the given plane, or
+ * NULL if the plane is not part of the global atomic state.
+ */
+static inline struct drm_plane_state *
+drm_atomic_get_new_plane_state(struct drm_atomic_state *state,
+  struct drm_plane *plane)
+{
+   return state->planes[drm_plane_index(plane)].new_state;
+}
+
+/**
  * drm_atomic_get_existing_connector_state - get connector state, if it exists
  * @state: global atomic state object
  * @connector: connector to grab
@@ -320,6 +379,46 @@ drm_atomic_get_existing_connector_state(struct 
drm_atomic_state *state,
 }
 
 /**
+ * drm_atomic_get_old_connector_state - get connector state, if it exists
+ * @state: global atomic state object
+ * @connector: connector to grab
+ *
+ * This function returns the old connector state for the given connector,
+ * or NULL if the connector is not part of the global atomic state.
+ */
+static inline struct drm_connector_state *
+drm_atomic_get_old_connector_state(struct drm_atomic_state *state,
+  struct drm_connector *connector)
+{
+   int index = drm_connector_index(connector);
+
+   if (index >= state->num_connector)
+   return NULL;
+
+   return state->connectors[index].old_state;
+}
+
+/**
+ * drm_atomic_get_new_connector_state - get connector state, if it exists
+ * @state: global atomic state object
+ * @connector: connector to grab
+ *
+ * This function returns the new connector state for the given connector,
+ * or NULL if the connector is not part of the global atomic state.
+ */
+static inline struct drm_connector_state *
+drm_atomic_get_new_connector_state(struct drm_atomic_state *state,
+  struct drm_connector *connector)
+{
+   int index = drm_connector_index(connector);
+
+   if (index >= state->num_connector)
+   return NULL;
+
+   return state->connectors[index].new_state;
+}
+
+/**
  * __drm_atomic_get_current_plane_state - get current plane state
  * @state: global atomic state object
  * @plane: plane to grab
-- 
2.7.4

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


[PATCH v3 1/7] drm/atomic: Add new iterators over all state, v3.

2017-01-16 Thread Maarten Lankhorst
Add for_each_(old)(new)_(plane,connector,crtc)_in_state iterators to
replace the old for_each_xxx_in_state ones. This is useful for >1 flip
depth and getting rid of all xxx->state dereferences.

This requires extra fixups done when committing a state after
duplicating, which in general isn't valid but is used by suspend/resume.
To handle these, introduce drm_atomic_helper_commit_duplicated_state
which performs those fixups before checking & committing the state.

Changes since v1:
- Remove nonblock parameter for commit_duplicated_state.
Changes since v2:
- Use commit_duplicated_state for i915 load detection.
- Add WARN_ON(old_state != obj->state) before swapping.

Signed-off-by: Maarten Lankhorst 
---
 drivers/gpu/drm/drm_atomic.c |  6 +++
 drivers/gpu/drm/drm_atomic_helper.c  | 65 +
 drivers/gpu/drm/i915/intel_display.c | 13 +++---
 include/drm/drm_atomic.h | 81 ++--
 include/drm/drm_atomic_helper.h  |  2 +
 5 files changed, 149 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 6414bcf7f41b..1c1cbf436717 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -275,6 +275,8 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
return ERR_PTR(-ENOMEM);
 
state->crtcs[index].state = crtc_state;
+   state->crtcs[index].old_state = crtc->state;
+   state->crtcs[index].new_state = crtc_state;
state->crtcs[index].ptr = crtc;
crtc_state->state = state;
 
@@ -691,6 +693,8 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state,
 
state->planes[index].state = plane_state;
state->planes[index].ptr = plane;
+   state->planes[index].old_state = plane->state;
+   state->planes[index].new_state = plane_state;
plane_state->state = state;
 
DRM_DEBUG_ATOMIC("Added [PLANE:%d:%s] %p state to %p\n",
@@ -1031,6 +1035,8 @@ drm_atomic_get_connector_state(struct drm_atomic_state 
*state,
 
drm_connector_reference(connector);
state->connectors[index].state = connector_state;
+   state->connectors[index].old_state = connector->state;
+   state->connectors[index].new_state = connector_state;
state->connectors[index].ptr = connector;
connector_state->state = state;
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index b26e3419027e..d153e8a72921 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1971,11 +1971,11 @@ void drm_atomic_helper_swap_state(struct 
drm_atomic_state *state,
int i;
long ret;
struct drm_connector *connector;
-   struct drm_connector_state *conn_state;
+   struct drm_connector_state *conn_state, *old_conn_state;
struct drm_crtc *crtc;
-   struct drm_crtc_state *crtc_state;
+   struct drm_crtc_state *crtc_state, *old_crtc_state;
struct drm_plane *plane;
-   struct drm_plane_state *plane_state;
+   struct drm_plane_state *plane_state, *old_plane_state;
struct drm_crtc_commit *commit;
 
if (stall) {
@@ -1999,13 +1999,17 @@ void drm_atomic_helper_swap_state(struct 
drm_atomic_state *state,
}
}
 
-   for_each_connector_in_state(state, connector, conn_state, i) {
+   for_each_oldnew_connector_in_state(state, connector, old_conn_state, 
conn_state, i) {
+   WARN_ON(connector->state != old_conn_state);
+
connector->state->state = state;
swap(state->connectors[i].state, connector->state);
connector->state->state = NULL;
}
 
-   for_each_crtc_in_state(state, crtc, crtc_state, i) {
+   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, crtc_state, 
i) {
+   WARN_ON(crtc->state != old_crtc_state);
+
crtc->state->state = state;
swap(state->crtcs[i].state, crtc->state);
crtc->state->state = NULL;
@@ -2020,7 +2024,9 @@ void drm_atomic_helper_swap_state(struct drm_atomic_state 
*state,
}
}
 
-   for_each_plane_in_state(state, plane, plane_state, i) {
+   for_each_oldnew_plane_in_state(state, plane, old_plane_state, 
plane_state, i) {
+   WARN_ON(plane->state != old_plane_state);
+
plane->state->state = state;
swap(state->planes[i].state, plane->state);
plane->state->state = NULL;
@@ -2471,7 +2477,7 @@ EXPORT_SYMBOL(drm_atomic_helper_disable_all);
  *
  * See also:
  * drm_atomic_helper_duplicate_state(), drm_atomic_helper_disable_all(),
- * drm_atomic_helper_resume()
+ * drm_atomic_helper_resume(), drm_atomic_helper_commit_duplicated_state()
  */
 struct drm_atomic_state *drm_atomic_helper_suspend(struct drm_device *dev)
 {
@@ -2512,6 +2518,47 @@ struct drm_atomic_state 
*drm_atomic_helper_suspend(st

Re: [Intel-gfx] [PATCH 06/10] drm/i915/psr: set CHICKEN_TRANS for psr2

2017-01-16 Thread Jani Nikula
On Fri, 13 Jan 2017, Rodrigo Vivi  wrote:
> This and all the remaining patches on this series (6,7,8 and 9) got
> merged to dinq.

Given that this patch series was not properly sent as a thread, I don't
think our CI ran it as a whole, and it should not have been pushed
before that.

BR,
Jani.

>
> Thanks for the patches.
>
> On Thu, Jan 12, 2017 at 12:12 PM, Vivi, Rodrigo  
> wrote:
>> Reviewed-by: Rodrigo Vivi 
>>
>> On Fri, 2017-01-13 at 00:31 +0530, vathsala nagaraju wrote:
>>> As per bpsec, CHICKEN_TRANS_EDP bit 12 ,15 must be programmed in
>>> psr2 enable sequence.
>>> bit 12 : Program Transcoder EDP VSC DIP header with a valid setting for
>>> PSR2 and Set CHICKEN_TRANS_EDP(0x420cc) bit 12 for programmable
>>> header packet.
>>> bit 15 : Set CHICKEN_TRANS_EDP(0x420cc) bit 15 if Y coordinate is supported
>>>
>>> v2: (Rodrigo)
>>> - move CHICKEN_TRANS_EDP bit set logic right after setup_vsc
>>>
>>> v3:(Rodrigo)
>>> - initialize chicken_trans to CHICKEN_TRANS_BIT12 instead of 0
>>>
>>> v4:(chris wilson)
>>> - use BIT(12), remove CHICKEN_TRANS_BIT12
>>> - remove unnecessary comments
>>> - update commit message
>>>
>>> v5:
>>> - rename bit 12 PSR2_VSC_ENABLE_PROG_HEADER
>>> - rename bit 15 PSR2_ADD_VERTICAL_LINE_COUNT
>>>
>>> v6:(Rodrigo)
>>> - remove TRANS_EDP=3, use cpu_transcoder
>>>
>>> Cc: Rodrigo Vivi 
>>> Cc: Jim Bride 
>>> Signed-off-by: vathsala nagaraju 
>>> Signed-off-by: Patil Deepti 
>>> ---
>>>  drivers/gpu/drm/i915/i915_reg.h  | 6 ++
>>>  drivers/gpu/drm/i915/intel_psr.c | 7 +++
>>>  2 files changed, 13 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_reg.h 
>>> b/drivers/gpu/drm/i915/i915_reg.h
>>> index 7830e6e..c9c1ccd 100644
>>> --- a/drivers/gpu/drm/i915/i915_reg.h
>>> +++ b/drivers/gpu/drm/i915/i915_reg.h
>>> @@ -6449,6 +6449,12 @@ enum {
>>>  #define  BDW_DPRS_MASK_VBLANK_SRD(1 << 0)
>>>  #define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, 
>>> _CHICKEN_PIPESL_1_B)
>>>
>>> +#define CHICKEN_TRANS_A 0x420c0
>>> +#define CHICKEN_TRANS_B 0x420c4
>>> +#define CHICKEN_TRANS(trans) _MMIO_TRANS(trans, CHICKEN_TRANS_A, 
>>> CHICKEN_TRANS_B)
>>> +#define PSR2_VSC_ENABLE_PROG_HEADER(1<<12)
>>> +#define PSR2_ADD_VERTICAL_LINE_COUNT   (1<<15)
>>> +
>>>  #define DISP_ARB_CTL _MMIO(0x45000)
>>>  #define  DISP_FBC_MEMORY_WAKE(1<<31)
>>>  #define  DISP_TILE_SURFACE_SWIZZLING (1<<13)
>>> diff --git a/drivers/gpu/drm/i915/intel_psr.c 
>>> b/drivers/gpu/drm/i915/intel_psr.c
>>> index 36c4045..935402e 100644
>>> --- a/drivers/gpu/drm/i915/intel_psr.c
>>> +++ b/drivers/gpu/drm/i915/intel_psr.c
>>> @@ -480,6 +480,9 @@ void intel_psr_enable(struct intel_dp *intel_dp)
>>>   struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
>>>   struct drm_device *dev = intel_dig_port->base.base.dev;
>>>   struct drm_i915_private *dev_priv = to_i915(dev);
>>> + struct intel_crtc *crtc = 
>>> to_intel_crtc(intel_dig_port->base.base.crtc);
>>> + enum transcoder cpu_transcoder = crtc->config->cpu_transcoder;
>>> + u32 chicken;
>>>
>>>   if (!HAS_PSR(dev_priv)) {
>>>   DRM_DEBUG_KMS("PSR not supported on this platform\n");
>>> @@ -505,6 +508,10 @@ void intel_psr_enable(struct intel_dp *intel_dp)
>>>   if (HAS_DDI(dev_priv)) {
>>>   if (dev_priv->psr.psr2_support) {
>>>   skl_psr_setup_su_vsc(intel_dp);
>>> + chicken = PSR2_VSC_ENABLE_PROG_HEADER;
>>> + if (dev_priv->psr.y_cord_support)
>>> + chicken |= PSR2_ADD_VERTICAL_LINE_COUNT;
>>> + I915_WRITE(CHICKEN_TRANS(cpu_transcoder), chicken);
>>>   } else {
>>>   /* set up vsc header for psr1 */
>>>   hsw_psr_setup_vsc(intel_dp);
>>
>> ___
>> Intel-gfx mailing list
>> intel-...@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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


[PATCH v2 01/11] dt-bindings: add rk3399 support for dw-mipi-rockchip

2017-01-16 Thread Chris Zhong
The dw-mipi-dsi of rk3399 is almost the same as rk3288, the rk3399 has
additional phy config clock.

Signed-off-by: Chris Zhong 
---

 .../devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
index 1753f0c..0f82568 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
@@ -5,10 +5,12 @@ Required properties:
 - #address-cells: Should be <1>.
 - #size-cells: Should be <0>.
 - compatible: "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi".
+ "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi".
 - reg: Represent the physical address range of the controller.
 - interrupts: Represent the controller's interrupt to the CPU(s).
 - clocks, clock-names: Phandles to the controller's pll reference
-  clock(ref) and APB clock(pclk), as described in [1].
+  clock(ref) and APB clock(pclk). For RK3399, a phy config clock
+  (phy_cfg) is additional required. As described in [1].
 - rockchip,grf: this soc should set GRF regs to mux vopl/vopb.
 - ports: contain a port node with endpoint definitions as defined in [2].
   For vopb,set the reg = <0> and set the reg = <1> for vopl.
-- 
2.6.3

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


[PATCH v2 02/11] drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi

2017-01-16 Thread Chris Zhong
The vopb/vopl switch register of RK3399 mipi is different from RK3288,
the default setting for mipi dsi mode is different too, so add a
of_device_id structure to distinguish them, and make sure set the
correct mode before mipi phy init.

Signed-off-by: Chris Zhong 
Signed-off-by: Mark Yao 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 101 -
 1 file changed, 74 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index d9aa382..04fd595 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -28,9 +28,17 @@
 
 #define DRIVER_NAME"dw-mipi-dsi"
 
-#define GRF_SOC_CON60x025c
-#define DSI0_SEL_VOP_LIT(1 << 6)
-#define DSI1_SEL_VOP_LIT(1 << 9)
+#define RK3288_GRF_SOC_CON60x025c
+#define RK3288_DSI0_SEL_VOP_LITBIT(6)
+#define RK3288_DSI1_SEL_VOP_LITBIT(9)
+
+#define RK3399_GRF_SOC_CON19   0x6250
+#define RK3399_DSI0_SEL_VOP_LITBIT(0)
+#define RK3399_DSI1_SEL_VOP_LITBIT(4)
+
+/* disable turnrequest, turndisable, forcetxstopmode, forcerxmode */
+#define RK3399_GRF_SOC_CON22   0x6258
+#define RK3399_GRF_DSI_MODE0x
 
 #define DSI_VERSION0x00
 #define DSI_PWR_UP 0x04
@@ -147,7 +155,6 @@
 #define LPRX_TO_CNT(p) ((p) & 0x)
 
 #define DSI_BTA_TO_CNT 0x8c
-
 #define DSI_LPCLK_CTRL 0x94
 #define AUTO_CLKLANE_CTRL  BIT(1)
 #define PHY_TXREQUESTCLKHS BIT(0)
@@ -213,11 +220,11 @@
 
 #define HSFREQRANGE_SEL(val)   (((val) & 0x3f) << 1)
 
-#define INPUT_DIVIDER(val) ((val - 1) & 0x7f)
+#define INPUT_DIVIDER(val) (((val) - 1) & 0x7f)
 #define LOW_PROGRAM_EN 0
 #define HIGH_PROGRAM_ENBIT(7)
-#define LOOP_DIV_LOW_SEL(val)  ((val - 1) & 0x1f)
-#define LOOP_DIV_HIGH_SEL(val) (((val - 1) >> 5) & 0x1f)
+#define LOOP_DIV_LOW_SEL(val)  (((val) - 1) & 0x1f)
+#define LOOP_DIV_HIGH_SEL(val) val) - 1) >> 5) & 0x1f)
 #define PLL_LOOP_DIV_ENBIT(5)
 #define PLL_INPUT_DIV_EN   BIT(4)
 
@@ -263,6 +270,11 @@ enum {
 };
 
 struct dw_mipi_dsi_plat_data {
+   u32 dsi0_en_bit;
+   u32 dsi1_en_bit;
+   u32 grf_switch_reg;
+   u32 grf_dsi0_mode;
+   u32 grf_dsi0_mode_reg;
unsigned int max_data_lanes;
enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
   struct drm_display_mode *mode);
@@ -279,6 +291,7 @@ struct dw_mipi_dsi {
 
struct clk *pllref_clk;
struct clk *pclk;
+   struct clk *phy_cfg_clk;
 
unsigned int lane_mbps; /* per lane */
u32 channel;
@@ -353,6 +366,7 @@ static inline struct dw_mipi_dsi *encoder_to_dsi(struct 
drm_encoder *encoder)
 {
return container_of(encoder, struct dw_mipi_dsi, encoder);
 }
+
 static inline void dsi_write(struct dw_mipi_dsi *dsi, u32 reg, u32 val)
 {
writel(val, dsi->base + reg);
@@ -364,7 +378,7 @@ static inline u32 dsi_read(struct dw_mipi_dsi *dsi, u32 reg)
 }
 
 static void dw_mipi_dsi_phy_write(struct dw_mipi_dsi *dsi, u8 test_code,
-u8 test_data)
+ u8 test_data)
 {
/*
 * With the falling edge on TESTCLK, the TESTDIN[7:0] signal content
@@ -400,6 +414,14 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
 
dsi_write(dsi, DSI_PWR_UP, POWERUP);
 
+   if (!IS_ERR(dsi->phy_cfg_clk)) {
+   ret = clk_prepare_enable(dsi->phy_cfg_clk);
+   if (ret) {
+   dev_err(dsi->dev, "Failed to enable phy_cfg_clk\n");
+   return ret;
+   }
+   }
+
dw_mipi_dsi_phy_write(dsi, 0x10, BYPASS_VCO_RANGE |
 VCO_RANGE_CON_SEL(vco) |
 VCO_IN_CAP_CON_LOW |
@@ -439,22 +461,23 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
dsi_write(dsi, DSI_PHY_RSTZ, PHY_ENFORCEPLL | PHY_ENABLECLK |
 PHY_UNRSTZ | PHY_UNSHUTDOWNZ);
 
-
ret = readx_poll_timeout(readl, dsi->base + DSI_PHY_STATUS,
 val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US);
if (ret < 0) {
dev_err(dsi->dev, "failed to wait for phy lock state\n");
-   return ret;
+   goto phy_init_end;
}
 
ret = readx_poll_timeout(readl, dsi->base + DSI_PHY_STATUS,
 val, val & STOP_STATE_CLK_LANE, 1000,
 PHY_STATUS_TIMEOUT_US);
-   if (ret < 0) {
+   if (ret < 0)
dev_err(dsi->dev,
"failed to wait for phy clk lane stop state\n");
-   return ret;
- 

[PATCH v2 0/11] Rockchip dw-mipi-dsi driver

2017-01-16 Thread Chris Zhong
Hi all

This patch serial is for RK3399 MIPI DSI. The MIPI DSI controller of
RK3399 is almost the same as RK3288, except a little bit of difference
in phy clock controlling and port id selection register.

And these patches also fixes some driver bugs; add the power domain
support.

they have been tested on rk3399 and rk3288 evb board.


Chris Zhong (7):
  dt-bindings: add rk3399 support for dw-mipi-rockchip
  drm/rockchip/dsi: dw-mipi: support RK3399 mipi dsi
  drm/rockchip/dsi: remove mode_valid function
  dt-bindings: add power domain node for dw-mipi-rockchip
  drm/rockchip/dsi: add dw-mipi power domain support
  drm/rockchip/dsi: fix phy clk lane stop state timeout
  drm/rockchip/dsi: fix insufficient bandwidth of some panel

Mark Yao (2):
  drm/rockchip/dsi: return probe defer if attach panel failed
  drm/rockchip/dsi: fix mipi display can't found at init time

xubilv (2):
  drm/rockchip/dsi: fix the issue can not send commands
  drm/rockchip/dsi: decrease the value of Ths-prepare

 .../display/rockchip/dw_mipi_dsi_rockchip.txt  |   7 +-
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 254 +
 2 files changed, 163 insertions(+), 98 deletions(-)

-- 
2.6.3

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


[PATCH v2 03/11] drm/rockchip/dsi: remove mode_valid function

2017-01-16 Thread Chris Zhong
The MIPI DSI do not need check the validity of resolution, the max
resolution should depend VOP. Hence, remove rk3288_mipi_dsi_mode_valid
here.

Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 39 --
 1 file changed, 39 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 04fd595..8f8d48a 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -276,8 +276,6 @@ struct dw_mipi_dsi_plat_data {
u32 grf_dsi0_mode;
u32 grf_dsi0_mode_reg;
unsigned int max_data_lanes;
-   enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
-  struct drm_display_mode *mode);
 };
 
 struct dw_mipi_dsi {
@@ -978,23 +976,8 @@ static int dw_mipi_dsi_connector_get_modes(struct 
drm_connector *connector)
return drm_panel_get_modes(dsi->panel);
 }
 
-static enum drm_mode_status dw_mipi_dsi_mode_valid(
-   struct drm_connector *connector,
-   struct drm_display_mode *mode)
-{
-   struct dw_mipi_dsi *dsi = con_to_dsi(connector);
-
-   enum drm_mode_status mode_status = MODE_OK;
-
-   if (dsi->pdata->mode_valid)
-   mode_status = dsi->pdata->mode_valid(connector, mode);
-
-   return mode_status;
-}
-
 static struct drm_connector_helper_funcs dw_mipi_dsi_connector_helper_funcs = {
.get_modes = dw_mipi_dsi_connector_get_modes,
-   .mode_valid = dw_mipi_dsi_mode_valid,
 };
 
 static void dw_mipi_dsi_drm_connector_destroy(struct drm_connector *connector)
@@ -1065,33 +1048,11 @@ static int rockchip_mipi_parse_dt(struct dw_mipi_dsi 
*dsi)
return 0;
 }
 
-static enum drm_mode_status rk3288_mipi_dsi_mode_valid(
-   struct drm_connector *connector,
-   struct drm_display_mode *mode)
-{
-   /*
-* The VID_PKT_SIZE field in the DSI_VID_PKT_CFG
-* register is 11-bit.
-*/
-   if (mode->hdisplay > 0x7ff)
-   return MODE_BAD_HVALUE;
-
-   /*
-* The V_ACTIVE_LINES field in the DSI_VTIMING_CFG
-* register is 11-bit.
-*/
-   if (mode->vdisplay > 0x7ff)
-   return MODE_BAD_VVALUE;
-
-   return MODE_OK;
-}
-
 static struct dw_mipi_dsi_plat_data rk3288_mipi_dsi_drv_data = {
.dsi0_en_bit = RK3288_DSI0_SEL_VOP_LIT,
.dsi1_en_bit = RK3288_DSI1_SEL_VOP_LIT,
.grf_switch_reg = RK3288_GRF_SOC_CON6,
.max_data_lanes = 4,
-   .mode_valid = rk3288_mipi_dsi_mode_valid,
 };
 
 static struct dw_mipi_dsi_plat_data rk3399_mipi_dsi_drv_data = {
-- 
2.6.3

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


[PATCH v2 06/11] drm/rockchip/dsi: return probe defer if attach panel failed

2017-01-16 Thread Chris Zhong
From: Mark Yao 

Return -EINVAL would cause mipi dsi bad behavior, probe defer
to ensure mipi find the correct mode,

Signed-off-by: Mark Yao 
Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index d2a3efb..5e3f031 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -549,10 +549,14 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host 
*host,
dsi->channel = device->channel;
dsi->format = device->format;
dsi->panel = of_drm_find_panel(device->dev.of_node);
-   if (dsi->panel)
-   return drm_panel_attach(dsi->panel, &dsi->connector);
+   if (!dsi->panel) {
+   DRM_ERROR("failed to find panel\n");
+   return -EPROBE_DEFER;
+   }
 
-   return -EINVAL;
+   drm_panel_attach(dsi->panel, &dsi->connector);
+
+   return 0;
 }
 
 static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
@@ -560,7 +564,8 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host 
*host,
 {
struct dw_mipi_dsi *dsi = host_to_dsi(host);
 
-   drm_panel_detach(dsi->panel);
+   if (dsi->panel)
+   drm_panel_detach(dsi->panel);
 
return 0;
 }
-- 
2.6.3

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


[PATCH v2 04/11] dt-bindings: add power domain node for dw-mipi-rockchip

2017-01-16 Thread Chris Zhong
Signed-off-by: Chris Zhong 
Acked-by: Rob Herring 
---

 .../devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt  | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
index 0f82568..188f6f7 100644
--- 
a/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
+++ 
b/Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
@@ -15,6 +15,9 @@ Required properties:
 - ports: contain a port node with endpoint definitions as defined in [2].
   For vopb,set the reg = <0> and set the reg = <1> for vopl.
 
+Optional properties:
+- power-domains: a phandle to mipi dsi power domain node.
+
 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
 [2] Documentation/devicetree/bindings/media/video-interfaces.txt
 
-- 
2.6.3

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


[PATCH v2 05/11] drm/rockchip/dsi: add dw-mipi power domain support

2017-01-16 Thread Chris Zhong
Reference the power domain incase dw-mipi power down when
in use.

Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 8f8d48a..d2a3efb 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -291,6 +292,7 @@ struct dw_mipi_dsi {
struct clk *pclk;
struct clk *phy_cfg_clk;
 
+   int dpms_mode;
unsigned int lane_mbps; /* per lane */
u32 channel;
u32 lanes;
@@ -842,6 +844,9 @@ static void dw_mipi_dsi_encoder_mode_set(struct drm_encoder 
*encoder,
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
int ret;
 
+   if (dsi->dpms_mode == DRM_MODE_DPMS_ON)
+   return;
+
dsi->mode = adjusted_mode;
 
ret = dw_mipi_dsi_get_lane_bps(dsi);
@@ -853,6 +858,8 @@ static void dw_mipi_dsi_encoder_mode_set(struct drm_encoder 
*encoder,
return;
}
 
+   pm_runtime_get_sync(dsi->dev);
+
dw_mipi_dsi_init(dsi);
dw_mipi_dsi_dpi_config(dsi, mode);
dw_mipi_dsi_packet_handler_config(dsi);
@@ -874,6 +881,9 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
 {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
 
+   if (dsi->dpms_mode != DRM_MODE_DPMS_ON)
+   return;
+
drm_panel_disable(dsi->panel);
 
if (clk_prepare_enable(dsi->pclk)) {
@@ -893,7 +903,9 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
 
dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE);
dw_mipi_dsi_disable(dsi);
+   pm_runtime_put(dsi->dev);
clk_disable_unprepare(dsi->pclk);
+   dsi->dpms_mode = DRM_MODE_DPMS_OFF;
 }
 
 static void dw_mipi_dsi_encoder_commit(struct drm_encoder *encoder)
@@ -927,6 +939,7 @@ static void dw_mipi_dsi_encoder_commit(struct drm_encoder 
*encoder)
 
regmap_write(dsi->grf_regmap, pdata->grf_switch_reg, val);
dev_dbg(dsi->dev, "vop %s output to dsi0\n", (mux) ? "LIT" : "BIG");
+   dsi->dpms_mode = DRM_MODE_DPMS_ON;
 }
 
 static int
@@ -1094,6 +1107,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 
dsi->dev = dev;
dsi->pdata = pdata;
+   dsi->dpms_mode = DRM_MODE_DPMS_OFF;
 
ret = rockchip_mipi_parse_dt(dsi);
if (ret)
@@ -1139,6 +1153,8 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 
dev_set_drvdata(dev, dsi);
 
+   pm_runtime_enable(dev);
+
dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
dsi->dsi_host.dev = dev;
return mipi_dsi_host_register(&dsi->dsi_host);
@@ -1154,6 +1170,7 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct 
device *master,
struct dw_mipi_dsi *dsi = dev_get_drvdata(dev);
 
mipi_dsi_host_unregister(&dsi->dsi_host);
+   pm_runtime_disable(dev);
clk_disable_unprepare(dsi->pllref_clk);
 }
 
-- 
2.6.3

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


[PATCH v2 07/11] drm/rockchip/dsi: fix mipi display can't found at init time

2017-01-16 Thread Chris Zhong
From: Mark Yao 

The problem is that:
  mipi panel probe request mipi_dsi_host_register.
  mipi host attach is call from panel device, so the defer function
always can't works.

So at the first bind time, always can't found mipi panel.

Signed-off-by: Mark Yao 
Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 57 +++---
 1 file changed, 39 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 5e3f031..4ec82f6 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -551,11 +551,9 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host 
*host,
dsi->panel = of_drm_find_panel(device->dev.of_node);
if (!dsi->panel) {
DRM_ERROR("failed to find panel\n");
-   return -EPROBE_DEFER;
+   return -ENODEV;
}
 
-   drm_panel_attach(dsi->panel, &dsi->connector);
-
return 0;
 }
 
@@ -567,6 +565,7 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host 
*host,
if (dsi->panel)
drm_panel_detach(dsi->panel);
 
+   dsi->panel = NULL;
return 0;
 }
 
@@ -1048,6 +1047,8 @@ static int dw_mipi_dsi_register(struct drm_device *drm,
   &dw_mipi_dsi_atomic_connector_funcs,
   DRM_MODE_CONNECTOR_DSI);
 
+   drm_panel_attach(dsi->panel, &dsi->connector);
+
drm_mode_connector_attach_encoder(connector, encoder);
 
return 0;
@@ -1097,23 +1098,17 @@ MODULE_DEVICE_TABLE(of, dw_mipi_dsi_dt_ids);
 static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
void *data)
 {
-   const struct of_device_id *of_id =
-   of_match_device(dw_mipi_dsi_dt_ids, dev);
-   const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = data;
-   struct dw_mipi_dsi *dsi;
+   struct dw_mipi_dsi *dsi = dev_get_drvdata(dev);
struct resource *res;
int ret;
 
-   dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
-   if (!dsi)
-   return -ENOMEM;
-
-   dsi->dev = dev;
-   dsi->pdata = pdata;
dsi->dpms_mode = DRM_MODE_DPMS_OFF;
 
+   if (!dsi->panel)
+   return -EPROBE_DEFER;
+
ret = rockchip_mipi_parse_dt(dsi);
if (ret)
return ret;
@@ -1160,9 +1155,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 
pm_runtime_enable(dev);
 
-   dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
-   dsi->dsi_host.dev = dev;
-   return mipi_dsi_host_register(&dsi->dsi_host);
+   return 0;
 
 err_pllref:
clk_disable_unprepare(dsi->pllref_clk);
@@ -1174,7 +1167,6 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct 
device *master,
 {
struct dw_mipi_dsi *dsi = dev_get_drvdata(dev);
 
-   mipi_dsi_host_unregister(&dsi->dsi_host);
pm_runtime_disable(dev);
clk_disable_unprepare(dsi->pllref_clk);
 }
@@ -1186,11 +1178,40 @@ static const struct component_ops dw_mipi_dsi_ops = {
 
 static int dw_mipi_dsi_probe(struct platform_device *pdev)
 {
-   return component_add(&pdev->dev, &dw_mipi_dsi_ops);
+   struct device *dev = &pdev->dev;
+   const struct of_device_id *of_id =
+   of_match_device(dw_mipi_dsi_dt_ids, dev);
+   const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
+   struct dw_mipi_dsi *dsi;
+   int ret;
+
+   dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL);
+   if (!dsi)
+   return -ENOMEM;
+
+   dsi->dev = dev;
+   dsi->pdata = pdata;
+   dsi->dsi_host.ops = &dw_mipi_dsi_host_ops;
+   dsi->dsi_host.dev = &pdev->dev;
+
+   ret = mipi_dsi_host_register(&dsi->dsi_host);
+   if (ret)
+   return ret;
+
+   platform_set_drvdata(pdev, dsi);
+   ret = component_add(&pdev->dev, &dw_mipi_dsi_ops);
+   if (ret)
+   mipi_dsi_host_unregister(&dsi->dsi_host);
+
+   return ret;
 }
 
 static int dw_mipi_dsi_remove(struct platform_device *pdev)
 {
+   struct dw_mipi_dsi *dsi = dev_get_drvdata(&pdev->dev);
+
+   if (dsi)
+   mipi_dsi_host_unregister(&dsi->dsi_host);
component_del(&pdev->dev, &dw_mipi_dsi_ops);
return 0;
 }
-- 
2.6.3

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


[PATCH v2 10/11] drm/rockchip/dsi: fix phy clk lane stop state timeout

2017-01-16 Thread Chris Zhong
Before phy init, the detection of phy state should be controlled
manually. After that, we can switch the detection to hardward,
it is automatic. Hence move PHY_TXREQUESTCLKHS setting to the end
of phy init.

Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index f50909e..9dfa73d 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -475,6 +475,8 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
dev_err(dsi->dev,
"failed to wait for phy clk lane stop state\n");
 
+   dsi_write(dsi, DSI_LPCLK_CTRL, PHY_TXREQUESTCLKHS);
+
 phy_init_end:
if (!IS_ERR(dsi->phy_cfg_clk))
clk_disable_unprepare(dsi->phy_cfg_clk);
@@ -721,7 +723,6 @@ static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)
  | PHY_RSTZ | PHY_SHUTDOWNZ);
dsi_write(dsi, DSI_CLKMGR_CFG, TO_CLK_DIVIDSION(10) |
  TX_ESC_CLK_DIVIDSION(7));
-   dsi_write(dsi, DSI_LPCLK_CTRL, PHY_TXREQUESTCLKHS);
 }
 
 static void dw_mipi_dsi_dpi_config(struct dw_mipi_dsi *dsi,
-- 
2.6.3

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


[PATCH v2 11/11] drm/rockchip/dsi: fix insufficient bandwidth of some panel

2017-01-16 Thread Chris Zhong
Set the lanes bps to 1 / 0.9 times of pclk, the margin is not enough
for some panel, it will cause the screen display is not normal, so
increases the badnwidth to 1 / 0.8.

Signed-off-by: Chris Zhong 

---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 9dfa73d..5a973fe 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -501,8 +501,8 @@ static int dw_mipi_dsi_get_lane_bps(struct dw_mipi_dsi *dsi)
 
mpclk = DIV_ROUND_UP(dsi->mode->clock, MSEC_PER_SEC);
if (mpclk) {
-   /* take 1 / 0.9, since mbps must big than bandwidth of RGB */
-   tmp = mpclk * (bpp / dsi->lanes) * 10 / 9;
+   /* take 1 / 0.8, since mbps must big than bandwidth of RGB */
+   tmp = mpclk * (bpp / dsi->lanes) * 10 / 8;
if (tmp < max_mbps)
target_mbps = tmp;
else
-- 
2.6.3

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


[PATCH v2 09/11] drm/rockchip/dsi: decrease the value of Ths-prepare

2017-01-16 Thread Chris Zhong
From: xubilv 

Signed-off-by: xubilv 
Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 4a2691c..f50909e 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -455,7 +455,7 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
 BANDGAP_SEL(BANDGAP_96_10));
 
dw_mipi_dsi_phy_write(dsi, 0x70, TLP_PROGRAM_EN | 0xf);
-   dw_mipi_dsi_phy_write(dsi, 0x71, THS_PRE_PROGRAM_EN | 0x55);
+   dw_mipi_dsi_phy_write(dsi, 0x71, THS_PRE_PROGRAM_EN | 0x2d);
dw_mipi_dsi_phy_write(dsi, 0x72, THS_ZERO_PROGRAM_EN | 0xa);
 
dsi_write(dsi, DSI_PHY_RSTZ, PHY_ENFORCEPLL | PHY_ENABLECLK |
-- 
2.6.3

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


[PATCH v2 08/11] drm/rockchip/dsi: fix the issue can not send commands

2017-01-16 Thread Chris Zhong
From: xubilv 

There is a bug in hdr_write function, the value from the caller will be
overwritten, it cause the mipi can not send the correct command. And the
MIPI_DSI_GENERIC_SHORT_WRITE_n_PARAM message type should be supported.

Signed-off-by: xubilv 
Signed-off-by: Chris Zhong 
---

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 26 +-
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 4ec82f6..4a2691c 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -572,10 +572,12 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host 
*host,
 static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 val)
 {
int ret;
+   u32 sts;
 
ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
-val, !(val & GEN_CMD_FULL), 1000,
+sts, !(sts & GEN_CMD_FULL), 1000,
 CMD_PKT_STATUS_TIMEOUT_US);
+
if (ret < 0) {
dev_err(dsi->dev, "failed to get available command FIFO\n");
return ret;
@@ -584,8 +586,9 @@ static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi 
*dsi, u32 val)
dsi_write(dsi, DSI_GEN_HDR, val);
 
ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
-val, val & (GEN_CMD_EMPTY | GEN_PLD_W_EMPTY),
+sts, sts & (GEN_CMD_EMPTY | GEN_PLD_W_EMPTY),
 1000, CMD_PKT_STATUS_TIMEOUT_US);
+
if (ret < 0) {
dev_err(dsi->dev, "failed to write command FIFO\n");
return ret;
@@ -594,8 +597,8 @@ static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi 
*dsi, u32 val)
return 0;
 }
 
-static int dw_mipi_dsi_dcs_short_write(struct dw_mipi_dsi *dsi,
-  const struct mipi_dsi_msg *msg)
+static int dw_mipi_dsi_short_write(struct dw_mipi_dsi *dsi,
+  const struct mipi_dsi_msg *msg)
 {
const u16 *tx_buf = msg->tx_buf;
u32 val = GEN_HDATA(*tx_buf) | GEN_HTYPE(msg->type);
@@ -609,13 +612,14 @@ static int dw_mipi_dsi_dcs_short_write(struct dw_mipi_dsi 
*dsi,
return dw_mipi_dsi_gen_pkt_hdr_write(dsi, val);
 }
 
-static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
- const struct mipi_dsi_msg *msg)
+static int dw_mipi_dsi_long_write(struct dw_mipi_dsi *dsi,
+ const struct mipi_dsi_msg *msg)
 {
const u32 *tx_buf = msg->tx_buf;
int len = msg->tx_len, pld_data_bytes = sizeof(*tx_buf), ret;
u32 val = GEN_HDATA(msg->tx_len) | GEN_HTYPE(msg->type);
u32 remainder = 0;
+   u32 sts = 0;
 
if (msg->tx_len < 3) {
dev_err(dsi->dev, "wrong tx buf length %zu for long write\n",
@@ -635,7 +639,7 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi 
*dsi,
}
 
ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
-val, !(val & GEN_PLD_W_FULL), 1000,
+sts, !(sts & GEN_PLD_W_FULL), 1000,
 CMD_PKT_STATUS_TIMEOUT_US);
if (ret < 0) {
dev_err(dsi->dev,
@@ -656,11 +660,15 @@ static ssize_t dw_mipi_dsi_host_transfer(struct 
mipi_dsi_host *host,
switch (msg->type) {
case MIPI_DSI_DCS_SHORT_WRITE:
case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
+   case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
+   case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
+   case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
-   ret = dw_mipi_dsi_dcs_short_write(dsi, msg);
+   ret = dw_mipi_dsi_short_write(dsi, msg);
break;
case MIPI_DSI_DCS_LONG_WRITE:
-   ret = dw_mipi_dsi_dcs_long_write(dsi, msg);
+   case MIPI_DSI_GENERIC_LONG_WRITE:
+   ret = dw_mipi_dsi_long_write(dsi, msg);
break;
default:
dev_err(dsi->dev, "unsupported message type\n");
-- 
2.6.3

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


Re: [PATCH 2/4] clk: samsung: Remove Exynos4415 driver (SoC not supported anymore)

2017-01-16 Thread Sylwester Nawrocki
On 01/14/2017 01:36 PM, Krzysztof Kozlowski wrote:
> Support for Exynos4415 is going away because there are no internal nor
> external users.
> 
> Since commit 46dcf0ff0de3 ("ARM: dts: exynos: Remove exynos4415.dtsi"),
> the platform cannot be instantiated so remove also the drivers.
> 
> Signed-off-by: Krzysztof Kozlowski 

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


[Bug 98743] Incorrect colormapping in Verdun game

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98743

Samuel Pitoiset  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Samuel Pitoiset  ---
Probably related to https://bugs.freedesktop.org/show_bug.cgi?id=98984 as well.

This can't be reproduced in current LLVM. Please upgrade.
Thanks!

-- 
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 98984] Hexagonal shapes around lights in Cities: Skylines

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=98984

Samuel Pitoiset  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #11 from Samuel Pitoiset  ---
Fixed in current LLVM. Please upgrade.

Thanks!

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


Re: [Intel-gfx] [PATCH 2/4] drm/i915: Fix POWER_DOMAIN_AUDIO refcounting.

2017-01-16 Thread Maarten Lankhorst
Op 11-01-17 om 17:13 schreef Daniel Vetter:
> On Thu, Dec 15, 2016 at 03:29:43PM +0100, Maarten Lankhorst wrote:
>> If the crtc was brought up with audio before the driver loads,
>> then crtc_disable will remove a refcount to audio that doesn't exist
>> before.
>>
>> Fortunately we already set power domains on readout, so we can just add
>> the power domain handling to get_crtc_power_domains, which will update
>> the power domains correctly in all cases.
>>
>> This was found when testing module reload on CI with the crtc enabled,
>> which resulted in the following warn after module reload + modeset:
>>
>> [   24.197041] [ cut here ]
>> [   24.197075] WARNING: CPU: 0 PID: 99 at 
>> drivers/gpu/drm/i915/intel_runtime_pm.c:1790 
>> intel_display_power_put+0x134/0x140 [i915]
>> [   24.197076] Use count on domain AUDIO is already zero
>> [   24.197098] CPU: 0 PID: 99 Comm: kworker/u8:2 Not tainted 
>> 4.9.0-CI-Trybot_393+ #1
>> [   24.197099] Hardware name:  /NUC6i5SYB, BIOS 
>> SYSKLi35.86A.0042.2016.0409.1246 04/09/2016
>> [   24.197102] Workqueue: events_unbound async_run_entry_fn
>> [   24.197105]  c93c7688 81435b35 c93c76d8 
>> 
>> [   24.197107]  c93c76c8 8107e4d6 06fe5dc36f28 
>> 88025dc30054
>> [   24.197109]  88025dc36f28 88025dc3 88025dc3 
>> 0015
>> [   24.197110] Call Trace:
>> [   24.197113]  [] dump_stack+0x67/0x92
>> [   24.197116]  [] __warn+0xc6/0xe0
>> [   24.197118]  [] warn_slowpath_fmt+0x4a/0x50
>> [   24.197149]  [] intel_display_power_put+0x134/0x140 
>> [i915]
>> [   24.197187]  [] intel_disable_ddi+0x4d/0x80 [i915]
>> [   24.197223]  [] 
>> intel_encoders_disable.isra.74+0x7f/0x90 [i915]
>> [   24.197257]  [] haswell_crtc_disable+0x55/0x170 [i915]
>> [   24.197292]  [] intel_atomic_commit_tail+0x108/0xfd0 
>> [i915]
>> [   24.197295]  [] ? __lock_is_held+0x66/0x90
>> [   24.197330]  [] intel_atomic_commit+0x429/0x560 [i915]
>> [   24.197332]  [] 
>> ?drm_atomic_add_affected_connectors+0x56/0xf0
>> [   24.197334]  [] drm_atomic_commit+0x46/0x50
>> [   24.197336]  [] restore_fbdev_mode+0x147/0x270
>> [   24.197337]  [] 
>> drm_fb_helper_restore_fbdev_mode_unlocked+0x2e/0x70
>> [   24.197339]  [] drm_fb_helper_set_par+0x28/0x50
>> [   24.197374]  [] intel_fbdev_set_par+0x13/0x70 [i915]
>> [   24.197376]  [] fbcon_init+0x57a/0x600
>> [   24.197379]  [] visual_init+0xd1/0x130
>> [   24.197381]  [] do_bind_con_driver+0x1bc/0x3a0
>> [   24.197384]  [] do_take_over_console+0x111/0x180
>> [   24.197386]  [] do_fbcon_takeover+0x52/0xb0
>> [   24.197387]  [] fbcon_event_notify+0x723/0x850
>> [   24.197390]  [] 
>> ?__blocking_notifier_call_chain+0x30/0x70
>> [   24.197392]  [] notifier_call_chain+0x34/0xa0
>> [   24.197394]  [] __blocking_notifier_call_chain+0x48/0x70
>> [   24.197397]  [] blocking_notifier_call_chain+0x11/0x20
>> [   24.197398]  [] fb_notifier_call_chain+0x16/0x20
>> [   24.197400]  [] register_framebuffer+0x24c/0x330
>> [   24.197402]  [] drm_fb_helper_initial_config+0x219/0x3c0
>> [   24.197436]  [] intel_fbdev_initial_config+0x13/0x30 
>> [i915]
>> [   24.197438]  [] async_run_entry_fn+0x34/0x140
>> [   24.197440]  [] process_one_work+0x1ec/0x6b0
>> [   24.197442]  [] ? process_one_work+0x166/0x6b0
>> [   24.197445]  [] worker_thread+0x49/0x490
>> [   24.197447]  [] ? process_one_work+0x6b0/0x6b0
>> [   24.197448]  [] kthread+0xeb/0x110
>> [   24.197451]  [] ? kthread_park+0x60/0x60
>> [   24.197453]  [] ret_from_fork+0x27/0x40
>> [   24.197476] ---[ end trace bda64b683b8e8162 ]---
>>
>> Signed-off-by: Maarten Lankhorst 
> Do we still need this with patch 3? I know it'd be nice if we could
> faithfully restore any state we can also program, but then that's also a
> lot of complexity ...
>
> Otoh patch 3 means we'll stop testing a lot of the fastboot code while
> reloading the driver. But then that's been the thing in the past, and as
> long as we still boot up we have at least some test coverage fo the
> fastboot code (I'm mostly concerned about the plane/buffer readout code,
> since that's not covered by the state checker).
>
> But for now I'd say let's just go with patch 3 only.
We don't need this patch, but it makes the audio power domain tracked like all 
other power domains. It's a nice cleanup in general and I would like it even 
without the rest of the series. Could otherwise be merged through the intel 
tree through.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/exynos: use atomic helper commit

2017-01-16 Thread Tobias Jakobi
Inki Dae wrote:
> This patch relpaces specific atomic commit function
> with atomic helper commit one, which also includes
> atomic_commit_tail callback for Exynos SoC becasue
> crtc devices on Exynos SoC uses power domain device
> so drm_atomic_helper_commit_planes should be called
> after drm_atomic_helper_commit_modeset_enables.
The commit message needs fixing. I think I know my way around Exynos DRM
a bit, but reading this just confuses me.

In particular the first part can probably be dropped, since it only
describes what the patch does (and I can already see this from the diff
itself).
Also some spelling issues:
relpaces -> replaces
becasue - because

With best wishes,
Tobias


> 
> Signed-off-by: Inki Dae 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c |   9 ++-
>  drivers/gpu/drm/exynos/exynos_drm_drv.c  | 110 
> +--
>  drivers/gpu/drm/exynos/exynos_drm_fb.c   |  25 ++-
>  3 files changed, 33 insertions(+), 111 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 2530bf5..47da612 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -39,6 +39,14 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>  
>   if (exynos_crtc->ops->disable)
>   exynos_crtc->ops->disable(exynos_crtc);
> +
> + if (crtc->state->event && !crtc->state->active) {
> + spin_lock_irq(&crtc->dev->event_lock);
> + drm_crtc_send_vblank_event(crtc, crtc->state->event);
> + spin_unlock_irq(&crtc->dev->event_lock);
> +
> + crtc->state->event = NULL;
> + }
>  }
>  
>  static void
> @@ -94,7 +102,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
>   drm_crtc_send_vblank_event(crtc, event);
>   spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>   }
> -
>  }
>  
>  static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 3ec0535..9d0df00 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -38,56 +38,6 @@
>  #define DRIVER_MAJOR 1
>  #define DRIVER_MINOR 0
>  
> -struct exynos_atomic_commit {
> - struct work_struct  work;
> - struct drm_device   *dev;
> - struct drm_atomic_state *state;
> - u32 crtcs;
> -};
> -
> -static void exynos_atomic_commit_complete(struct exynos_atomic_commit 
> *commit)
> -{
> - struct drm_device *dev = commit->dev;
> - struct exynos_drm_private *priv = dev->dev_private;
> - struct drm_atomic_state *state = commit->state;
> -
> - drm_atomic_helper_commit_modeset_disables(dev, state);
> -
> - drm_atomic_helper_commit_modeset_enables(dev, state);
> -
> - /*
> -  * Exynos can't update planes with CRTCs and encoders disabled,
> -  * its updates routines, specially for FIMD, requires the clocks
> -  * to be enabled. So it is necessary to handle the modeset operations
> -  * *before* the commit_planes() step, this way it will always
> -  * have the relevant clocks enabled to perform the update.
> -  */
> -
> - drm_atomic_helper_commit_planes(dev, state, 0);
> -
> - drm_atomic_helper_wait_for_vblanks(dev, state);
> -
> - drm_atomic_helper_cleanup_planes(dev, state);
> -
> - drm_atomic_state_put(state);
> -
> - spin_lock(&priv->lock);
> - priv->pending &= ~commit->crtcs;
> - spin_unlock(&priv->lock);
> -
> - wake_up_all(&priv->wait);
> -
> - kfree(commit);
> -}
> -
> -static void exynos_drm_atomic_work(struct work_struct *work)
> -{
> - struct exynos_atomic_commit *commit = container_of(work,
> - struct exynos_atomic_commit, work);
> -
> - exynos_atomic_commit_complete(commit);
> -}
> -
>  static struct device *exynos_drm_get_dma_device(void);
>  
>  static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> @@ -202,65 +152,6 @@ static void exynos_drm_unload(struct drm_device *dev)
>   dev->dev_private = NULL;
>  }
>  
> -static int commit_is_pending(struct exynos_drm_private *priv, u32 crtcs)
> -{
> - bool pending;
> -
> - spin_lock(&priv->lock);
> - pending = priv->pending & crtcs;
> - spin_unlock(&priv->lock);
> -
> - return pending;
> -}
> -
> -int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state 
> *state,
> -  bool nonblock)
> -{
> - struct exynos_drm_private *priv = dev->dev_private;
> - struct exynos_atomic_commit *commit;
> - struct drm_crtc *crtc;
> - struct drm_crtc_state *crtc_state;
> - int i, ret;
> -
> - commit = kzalloc(sizeof(*commit), GFP_KERNEL);
> - if (!commit)
> - return -ENOMEM;
> -
> - ret = drm_atomic_helper_prepare_planes(dev, state);
> - if

Re: [PATCH] drm/exynos: remove unnecessary codes

2017-01-16 Thread Tobias Jakobi
Seen this quite often lately. It should be be 'code' and not 'codes'.

Code in the programming context is always a collection of instructions.

With best wishes,
Tobias


Inki Dae wrote:
> This patch removes exynos_drm_crtc_cancel_page_flip call
> when drm is closed because at that time, events will be released
> by drm_events_release function.
> 
> Change-Id: I156ea27a4c90aa87a27a50415515fa334148c912
> Signed-off-by: Inki Dae 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 6 --
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 9d0df00..035d02e 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -198,13 +198,7 @@ static int exynos_drm_open(struct drm_device *dev, 
> struct drm_file *file)
>  static void exynos_drm_preclose(struct drm_device *dev,
>   struct drm_file *file)
>  {
> - struct drm_crtc *crtc;
> -
>   exynos_drm_subdrv_close(dev, file);
> -
> - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
> - exynos_drm_crtc_cancel_page_flip(crtc, file);
> -
>  }
>  
>  static void exynos_drm_postclose(struct drm_device *dev, struct drm_file 
> *file)
> 

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


[patch] drm/msm: return -EFAULT if copy_from_user() fails

2017-01-16 Thread Dan Carpenter
copy_from_user_inatomic() is actually a local function that returns
-EFAULT or positive values on error.  Otherwise copy_from_user() returns
the number of bytes remaining to be copied.  We want to return -EFAULT
here.

I removed an unlikely() because we just did a copy_from_user()
so I don't think it can possibly make a difference.

Signed-off-by: Dan Carpenter 
---
Not compiled.

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c 
b/drivers/gpu/drm/msm/msm_gem_submit.c
index 4896765..1172fe7 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -95,13 +95,13 @@ static int submit_lookup_objects(struct msm_gem_submit 
*submit,
 */
submit->bos[i].flags = 0;
 
-   ret = copy_from_user_inatomic(&submit_bo, userptr, 
sizeof(submit_bo));
-   if (unlikely(ret)) {
+   if (copy_from_user_inatomic(&submit_bo, userptr, 
sizeof(submit_bo))) {
pagefault_enable();
spin_unlock(&file->table_lock);
-   ret = copy_from_user(&submit_bo, userptr, 
sizeof(submit_bo));
-   if (ret)
+   if (copy_from_user(&submit_bo, userptr, 
sizeof(submit_bo))) {
+   ret = -EFAULT;
goto out;
+   }
spin_lock(&file->table_lock);
pagefault_disable();
}
@@ -317,9 +317,10 @@ static int submit_reloc(struct msm_gem_submit *submit, 
struct msm_gem_object *ob
uint64_t iova;
bool valid;
 
-   ret = copy_from_user(&submit_reloc, userptr, 
sizeof(submit_reloc));
-   if (ret)
+   if (copy_from_user(&submit_reloc, userptr, 
sizeof(submit_reloc))) {
+   ret = -EFAULT;
goto out;
+   }
 
if (submit_reloc.submit_offset % 4) {
DRM_ERROR("non-aligned reloc offset: %u\n",
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 11/11] drm/rockchip/dsi: fix insufficient bandwidth of some panel

2017-01-16 Thread John Keeping
On Mon, 16 Jan 2017 18:08:31 +0800, Chris Zhong wrote:

> Set the lanes bps to 1 / 0.9 times of pclk, the margin is not enough
> for some panel, it will cause the screen display is not normal, so
> increases the badnwidth to 1 / 0.8.
> 
> Signed-off-by: Chris Zhong 
> 
> ---
> 
>  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
> b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index 9dfa73d..5a973fe 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -501,8 +501,8 @@ static int dw_mipi_dsi_get_lane_bps(struct dw_mipi_dsi 
> *dsi)
>  
>   mpclk = DIV_ROUND_UP(dsi->mode->clock, MSEC_PER_SEC);
>   if (mpclk) {
> - /* take 1 / 0.9, since mbps must big than bandwidth of RGB */
> - tmp = mpclk * (bpp / dsi->lanes) * 10 / 9;
> + /* take 1 / 0.8, since mbps must big than bandwidth of RGB */
> + tmp = mpclk * (bpp / dsi->lanes) * 10 / 8;

This and patch 9 are just hacking around the underlying problem in order
to make particular panels work.  I'm pretty sure the actual issue is the
use of hardcoded values when configuring the PHY, since the PHY
parameters are specified in clock cycles but the MIPI spec requires
absolute time durations.

I posted a series addressing this a while ago, although I screwed up
sending it so some patches were included twice and since no one
expressed any interest I didn't post a cleaned up version.

The relevant patch is here:

https://patchwork.kernel.org/patch/9340193/

>   if (tmp < max_mbps)
>   target_mbps = tmp;
>   else
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v1 0/7] DRM: add LTDC support for STM32F4

2017-01-16 Thread Yannick Fertre
The purpose of this set of patches is to add a new driver for stm32f429.
This driver was developed and tested on evaluation board stm32429i.

Stm32f4 is a MCU platform which don't have MMU so the last patches developed
by Benjamin Gaignard regarding "DRM: allow to use mmuless devices"
are necessary.

The board stm429i embeds a Ampire AM-480272H3TMQW-T01H screen.
A new simple panel am-480272h3tmqw-t01h have been added to support it.

Yannick Fertre (7):
  dt-bindings: display: add STM32 LTDC driver
  drm/st: Add STM32 LTDC driver
  dt-bindings: Add Ampire AM-480272H3TMQW-T01H panel
  drm/panel: simple: Add support for Ampire AM-480272H3TMQW-T01H
  ARM: dts: stm32f429: Add ltdc support
  ARM: dts: stm32429i-eval: Enable ltdc & simple panel on Eval board
  ARM: configs: Add STM32 LTDC support in STM32 defconfig

 .../display/panel/ampire,am-480272h3tmqw-t01h.txt  |7 +
 .../devicetree/bindings/display/st,ltdc.txt|   57 +
 arch/arm/boot/dts/stm32429i-eval.dts   |   58 +
 arch/arm/boot/dts/stm32f429.dtsi   |   25 +-
 arch/arm/configs/stm32_defconfig   |5 +
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/panel/panel-simple.c   |   29 +
 drivers/gpu/drm/st/Kconfig |   14 +
 drivers/gpu/drm/st/Makefile|7 +
 drivers/gpu/drm/st/drv.c   |  279 
 drivers/gpu/drm/st/drv.h   |   25 +
 drivers/gpu/drm/st/ltdc.c  | 1438 
 drivers/gpu/drm/st/ltdc.h  |   20 +
 14 files changed, 1966 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt
 create mode 100644 Documentation/devicetree/bindings/display/st,ltdc.txt
 create mode 100644 drivers/gpu/drm/st/Kconfig
 create mode 100644 drivers/gpu/drm/st/Makefile
 create mode 100644 drivers/gpu/drm/st/drv.c
 create mode 100644 drivers/gpu/drm/st/drv.h
 create mode 100644 drivers/gpu/drm/st/ltdc.c
 create mode 100644 drivers/gpu/drm/st/ltdc.h

-- 
1.9.1

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


[PATCH v1 5/7] ARM: dts: stm32f429: Add ltdc support

2017-01-16 Thread Yannick Fertre
Add LTDC (Lcd-tft Display Controller) support.

Signed-off-by: Yannick Fertre 
---
 arch/arm/boot/dts/stm32f429.dtsi | 25 -
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/stm32f429.dtsi b/arch/arm/boot/dts/stm32f429.dtsi
index 336ee4f..fc43415 100644
--- a/arch/arm/boot/dts/stm32f429.dtsi
+++ b/arch/arm/boot/dts/stm32f429.dtsi
@@ -185,7 +185,7 @@
interrupts = <1>, <2>, <3>, <6>, <7>, <8>, <9>, <10>, 
<23>, <40>, <41>, <42>, <62>, <76>;
};
 
-   pin-controller {
+   pinctrl: pin-controller {
#address-cells = <1>;
#size-cells = <1>;
compatible = "st,stm32f429-pinctrl";
@@ -404,6 +404,29 @@
interrupts = <80>;
clocks = <&rcc 0 38>;
};
+
+   st-display-subsystem {
+   compatible = "st,display-subsystem";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   dma-ranges;
+
+   ltdc_host: stm32-ltdc@40016800 {
+   compatible = "st,ltdc";
+   reg = <0x40016800 0x200>;
+   interrupts = <88>, <89>;
+   resets = <&rcc 314>;
+   clocks = <&rcc 1 8>;
+   clock-names = "clk-lcd";
+   status = "disabled";
+
+   port {
+   ltdc_out_rgb: endpoint {
+   };
+   };
+   };
+   };
};
 };
 
-- 
1.9.1

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


[PATCH v1 1/7] dt-bindings: display: add STM32 LTDC driver

2017-01-16 Thread Yannick Fertre
Signed-off-by: Yannick Fertre 
---
 .../devicetree/bindings/display/st,ltdc.txt| 57 ++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/st,ltdc.txt

diff --git a/Documentation/devicetree/bindings/display/st,ltdc.txt 
b/Documentation/devicetree/bindings/display/st,ltdc.txt
new file mode 100644
index 000..20e89da
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/st,ltdc.txt
@@ -0,0 +1,57 @@
+* STMicroelectronics STM32 lcd-tft display controller
+
+- st-display-subsystem: Master device for DRM sub-components
+  This device must be the parent of all the sub-components and is responsible
+  of bind them.
+  Required properties:
+  - compatible: "st,display-subsystem"
+  - ranges: to allow probing of subdevices
+
+- ltdc_host: lcd-tft display controller host
+  must be a sub-node of st-display-subsystem
+  Required properties:
+  - compatible: "st,ltdc"
+  - reg: Physical base address of the IP registers and length of memory mapped 
region.
+  - clocks: from common clock binding: handle hardware IP needed clocks, the
+number of clocks may depend of the SoC type.
+See ../clocks/clock-bindings.txt for details.
+  - clock-names: names of the clocks listed in clocks property in the same
+order.
+  - resets: resets to be used by the device
+See ../reset/reset.txt for details.
+  - reset-names: names of the resets listed in resets property in the same
+order.
+  Required nodes:
+- Video port for RGB output.
+
+Example:
+
+/ {
+   ...
+   soc {
+   ...
+   st-display-subsystem {
+   compatible = "st,display-subsystem";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   ranges;
+   dma-ranges;
+
+   ltdc_host: stm32-ltdc@40016800 {
+   compatible = "st,ltdc";
+   reg = <0x40016800 0x200>;
+   interrupts = <88>, <89>;
+   resets = <&rcc 314>;
+   clocks = <&rcc 1 8>;
+   clock-names = "clk-lcd";
+   status = "disabled";
+
+   port {
+   ltdc_out_rgb: endpoint {
+   };
+   };
+   };
+   };
+   ...
+   };
+};
-- 
1.9.1

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


[PATCH v1 0/7] DRM: add LTDC support for STM32F4

2017-01-16 Thread Yannick Fertre
The purpose of this set of patches is to add a new driver for stm32f429.
This driver was developed and tested on evaluation board stm32429i.

Stm32f4 is a MCU platform which don't have MMU so the last patches developed
by Benjamin Gaignard regarding "DRM: allow to use mmuless devices"
are necessary.

The board stm429i embeds a Ampire AM-480272H3TMQW-T01H screen.
A new simple panel am-480272h3tmqw-t01h have been added to support it.

Yannick Fertre (7):
  dt-bindings: display: add STM32 LTDC driver
  drm/st: Add STM32 LTDC driver
  dt-bindings: Add Ampire AM-480272H3TMQW-T01H panel
  drm/panel: simple: Add support for Ampire AM-480272H3TMQW-T01H
  ARM: dts: stm32f429: Add ltdc support
  ARM: dts: stm32429i-eval: Enable ltdc & simple panel on Eval board
  ARM: configs: Add STM32 LTDC support in STM32 defconfig

 .../display/panel/ampire,am-480272h3tmqw-t01h.txt  |7 +
 .../devicetree/bindings/display/st,ltdc.txt|   57 +
 arch/arm/boot/dts/stm32429i-eval.dts   |   58 +
 arch/arm/boot/dts/stm32f429.dtsi   |   25 +-
 arch/arm/configs/stm32_defconfig   |5 +
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/panel/panel-simple.c   |   29 +
 drivers/gpu/drm/st/Kconfig |   14 +
 drivers/gpu/drm/st/Makefile|7 +
 drivers/gpu/drm/st/drv.c   |  279 
 drivers/gpu/drm/st/drv.h   |   25 +
 drivers/gpu/drm/st/ltdc.c  | 1438 
 drivers/gpu/drm/st/ltdc.h  |   20 +
 14 files changed, 1966 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt
 create mode 100644 Documentation/devicetree/bindings/display/st,ltdc.txt
 create mode 100644 drivers/gpu/drm/st/Kconfig
 create mode 100644 drivers/gpu/drm/st/Makefile
 create mode 100644 drivers/gpu/drm/st/drv.c
 create mode 100644 drivers/gpu/drm/st/drv.h
 create mode 100644 drivers/gpu/drm/st/ltdc.c
 create mode 100644 drivers/gpu/drm/st/ltdc.h

-- 
1.9.1

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


[PATCH v1 3/7] dt-bindings: Add Ampire AM-480272H3TMQW-T01H panel

2017-01-16 Thread Yannick Fertre
Signed-off-by: Yannick Fertre 
---
 .../bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt | 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt
 
b/Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt
new file mode 100644
index 000..f59e3c4
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt
@@ -0,0 +1,7 @@
+Ampire AM-480272H3TMQW-T01H 4.3" WQVGA TFT LCD panel
+
+Required properties:
+- compatible: should be "ampire,am-480272h3tmqw-t01h"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
1.9.1

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


[PATCH v1 6/7] ARM: dts: stm32429i-eval: Enable ltdc & simple panel on Eval board

2017-01-16 Thread Yannick Fertre
Enable ltdc & enable am-480272h3tmqw-t01h panel.

Signed-off-by: Yannick Fertre 
---
 arch/arm/boot/dts/stm32429i-eval.dts | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm/boot/dts/stm32429i-eval.dts 
b/arch/arm/boot/dts/stm32429i-eval.dts
index 2de6487..f987ca5 100644
--- a/arch/arm/boot/dts/stm32429i-eval.dts
+++ b/arch/arm/boot/dts/stm32429i-eval.dts
@@ -88,6 +88,52 @@
clocks = <&rcc 0 30>;
clock-names = "main_clk";
};
+
+   panel_rgb: panel-rgb {
+   compatible = "ampire,am-480272h3tmqw-t01h";
+   status = "okay";
+   port {
+   panel_in_rgb: endpoint {
+   remote-endpoint = <;
+   };
+   };
+   };
+};
+
+&pinctrl {
+   pinctrl_ltdc: ltdc@0 {
+   pins {
+   pinmux = ,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+,
+;
+   slew-rate = <2>;
+   };
+   };
 };
 
 &clk_hse {
@@ -123,3 +169,15 @@
pinctrl-names = "default";
status = "okay";
 };
+
+;
+   pinctrl-names = "default";
+
+   port {
+   ltdc_out_rgb: endpoint {
+   remote-endpoint = <&panel_in_rgb>;
+   };
+   };
+};
-- 
1.9.1

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


[PATCH v1 2/7] drm/st: Add STM32 LTDC driver

2017-01-16 Thread Yannick Fertre
This patch adds support for the STM32 LCD-TFT display controller.

Signed-off-by: Yannick Fertre 
---
 drivers/gpu/drm/Kconfig |2 +
 drivers/gpu/drm/Makefile|1 +
 drivers/gpu/drm/st/Kconfig  |   14 +
 drivers/gpu/drm/st/Makefile |7 +
 drivers/gpu/drm/st/drv.c|  279 +
 drivers/gpu/drm/st/drv.h|   25 +
 drivers/gpu/drm/st/ltdc.c   | 1438 +++
 drivers/gpu/drm/st/ltdc.h   |   20 +
 8 files changed, 1786 insertions(+)
 create mode 100644 drivers/gpu/drm/st/Kconfig
 create mode 100644 drivers/gpu/drm/st/Makefile
 create mode 100644 drivers/gpu/drm/st/drv.c
 create mode 100644 drivers/gpu/drm/st/drv.h
 create mode 100644 drivers/gpu/drm/st/ltdc.c
 create mode 100644 drivers/gpu/drm/st/ltdc.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 6f3f9e6..d8e6f92 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -237,6 +237,8 @@ source "drivers/gpu/drm/fsl-dcu/Kconfig"
 
 source "drivers/gpu/drm/tegra/Kconfig"
 
+source "drivers/gpu/drm/st/Kconfig"
+
 source "drivers/gpu/drm/panel/Kconfig"
 
 source "drivers/gpu/drm/bridge/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 92de399..7434c09 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_DRM_BOCHS) += bochs/
 obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/
 obj-$(CONFIG_DRM_MSM) += msm/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
+obj-$(CONFIG_DRM_ST) += st/
 obj-$(CONFIG_DRM_STI) += sti/
 obj-$(CONFIG_DRM_IMX) += imx/
 obj-$(CONFIG_DRM_MEDIATEK) += mediatek/
diff --git a/drivers/gpu/drm/st/Kconfig b/drivers/gpu/drm/st/Kconfig
new file mode 100644
index 000..fa0ac0c
--- /dev/null
+++ b/drivers/gpu/drm/st/Kconfig
@@ -0,0 +1,14 @@
+config DRM_ST
+   tristate "DRM Support for STMicroelectronics SoC Series"
+   depends on DRM && (ARCH_STM32 || ARCH_MULTIPLATFORM)
+   select DRM_KMS_HELPER
+   select DRM_GEM_CMA_HELPER
+   select DRM_KMS_CMA_HELPER
+   select DRM_PANEL
+   select VIDEOMODE_HELPERS
+   select FB_PROVIDE_GET_FB_UNMAPPED_AREA
+   help
+ Choose this option if you have an ST STMicroelectronics SoC.
+
+ To compile this driver as a module, choose M here: the module
+ will be called st-drm.
diff --git a/drivers/gpu/drm/st/Makefile b/drivers/gpu/drm/st/Makefile
new file mode 100644
index 000..b2a9025
--- /dev/null
+++ b/drivers/gpu/drm/st/Makefile
@@ -0,0 +1,7 @@
+ccflags-y := -Iinclude/drm
+
+st-drm-y := \
+   drv.o \
+   ltdc.o
+
+obj-$(CONFIG_DRM_ST) += st-drm.o
diff --git a/drivers/gpu/drm/st/drv.c b/drivers/gpu/drm/st/drv.c
new file mode 100644
index 000..a275019
--- /dev/null
+++ b/drivers/gpu/drm/st/drv.c
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) STMicroelectronics SA 2017
+ *
+ * Authors: Philippe Cornu 
+ *  Yannick Fertre 
+ *  Fabien Dessenne 
+ *  Mickael Reulier 
+ *
+ * License terms:  GNU General Public License (GPL), version 2
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "drv.h"
+#include "ltdc.h"
+
+#define DRIVER_NAME"st"
+#define DRIVER_DESC"STMicroelectronics SoC DRM"
+#define DRIVER_DATE"20170110"
+#define DRIVER_MAJOR   1
+#define DRIVER_MINOR   0
+
+#define ST_MAX_FB_WIDTH2048
+#define ST_MAX_FB_HEIGHT   2048 /* same as width to handle orientation */
+
+static void st_output_poll_changed(struct drm_device *ddev)
+{
+   struct st_private *priv = ddev->dev_private;
+
+   drm_fbdev_cma_hotplug_event(priv->fbdev);
+}
+
+static const struct drm_mode_config_funcs st_mode_config_funcs = {
+   .fb_create = drm_fb_cma_create,
+   .output_poll_changed = st_output_poll_changed,
+   .atomic_check = drm_atomic_helper_check,
+   .atomic_commit = drm_atomic_helper_commit,
+};
+
+static void st_mode_config_init(struct drm_device *ddev)
+{
+   ddev->mode_config.min_width = 0;
+   ddev->mode_config.min_height = 0;
+
+   /*
+* set max width and height as default value.
+* this value would be used to check framebuffer size limitation
+* at drm_mode_addfb().
+*/
+   ddev->mode_config.max_width = ST_MAX_FB_WIDTH;
+   ddev->mode_config.max_height = ST_MAX_FB_HEIGHT;
+   ddev->mode_config.funcs = &st_mode_config_funcs;
+}
+
+static const struct file_operations st_driver_fops = {
+   .owner = THIS_MODULE,
+   .open = drm_open,
+   .get_unmapped_area = drm_gem_cma_get_unmapped_area,
+   .mmap = drm_gem_cma_mmap,
+   .poll = drm_poll,
+   .read = drm_read,
+   .unlocked_ioctl = drm_ioctl,
+#ifdef CONFIG_COMPAT
+   .compat_ioctl = drm_compat_ioctl,
+#endif
+   .release = drm_release,
+};
+
+static struct drm_driver st_driver = {
+   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
+  DRIVER_ATOMIC,
+   .gem_free_object_unlocked = drm_gem_cma_free_objec

[PATCH v1 7/7] ARM: configs: Add STM32 LTDC support in STM32 defconfig

2017-01-16 Thread Yannick Fertre
Signed-off-by: Yannick Fertre 
---
 arch/arm/configs/stm32_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/configs/stm32_defconfig b/arch/arm/configs/stm32_defconfig
index 29068f5..e3974d9 100644
--- a/arch/arm/configs/stm32_defconfig
+++ b/arch/arm/configs/stm32_defconfig
@@ -71,3 +71,8 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_FTRACE is not set
 CONFIG_CRC_ITU_T=y
 CONFIG_CRC7=y
+CONFIG_DRM=y
+CONFIG_DRM_ST=y
+CONFIG_DRM_PANEL=y
+CONFIG_DRM_PANEL_SIMPLE=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
-- 
1.9.1

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


[PATCH v1 4/7] drm/panel: simple: Add support for Ampire AM-480272H3TMQW-T01H

2017-01-16 Thread Yannick Fertre
Add simple-panel support for the Ampire AM-480272H3TMQW-T01H,
which is a 4.3" WQVGA panel.

Signed-off-by: Yannick Fertre 
---
 drivers/gpu/drm/panel/panel-simple.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 06aaf79..ee5d2ff 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -386,6 +386,32 @@ static void panel_simple_shutdown(struct device *dev)
panel_simple_disable(&panel->base);
 }
 
+static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = {
+   .clock = 9000,
+   .hdisplay = 480,
+   .hsync_start = 480 + 2,
+   .hsync_end = 480 + 2 + 41,
+   .htotal = 480 + 2 + 41 + 2,
+   .vdisplay = 272,
+   .vsync_start = 272 + 2,
+   .vsync_end = 272 + 2 + 10,
+   .vtotal = 272 + 2 + 10 + 2,
+   .vrefresh = 60,
+   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
+};
+
+static const struct panel_desc ampire_am_480272h3tmqw_t01h = {
+   .modes = &ire_am_480272h3tmqw_t01h_mode,
+   .num_modes = 1,
+   .bpc = 8,
+
+   .size = {
+   .width = 105,
+   .height = 67,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+};
+
 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
.clock = 3,
.hdisplay = 800,
@@ -1715,6 +1741,9 @@ static void panel_simple_shutdown(struct device *dev)
 
 static const struct of_device_id platform_of_match[] = {
{
+   .compatible = "ampire,am-480272h3tmqw-t01h",
+   .data = &ire_am_480272h3tmqw_t01h,
+   }, {
.compatible = "ampire,am800480r3tmqwa1h",
.data = &ire_am800480r3tmqwa1h,
}, {
-- 
1.9.1

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


Re: [RFC] drm: Parse HDMI 2.0 YCbCr 4:2:0 VDB and VCB

2017-01-16 Thread Ville Syrjälä
On Mon, Jan 16, 2017 at 01:24:01PM +, Jose Abreu wrote:
> Hi Ville,
> 
> 
> Sorry for the late reply.
> 
> 
> On 11-01-2017 11:36, Ville Syrjälä wrote:
> > On Wed, Jan 11, 2017 at 10:27:03AM +, Jose Abreu wrote:
> >> Hi Ville,
> >>
> >>
> >> On 10-01-2017 17:21, Ville Syrjälä wrote:
> >>
> >> [snip]
> >>
>  But we already have color_formats field in drm_display_info
>  struct, right? Shouldn't we instead create for example a helper
>  which returns the best output colorspace? According to what you
>  said it would be something like:
> 
>  if (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR444)
>  return YCBCR444;
>  else if (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR422)
>  return YCBCR422;
>  else if (display_info->color_formats & DRM_COLOR_FORMAT_YCBCR420
>  && vic_is_420)
>  return YCBCR420;
>  else
>  return RGB444; /* Mandatory by spec */
> >>> Perhaps. But it would have to be more involved than that since there
> >>> might limitations on eg. the max TMDS clock imposed by the source or
> >>> cable/dongle which presumably might require that we pick 4:2:0 over
> >>> 4:4:4.
> >>>
> >>> It would also need to account which formats are actually supported by
> >>> the source.
> >>>
> >>> I guess for bpc it would be enough to just consider 8bpc in such a
> >>> function, and then the driver can bump it up afterwards if possible.
> >> But the max tmds clock will probably be involved in deep color
> >> modes, as 24bpp has always a 1x factor in every YCbCr, except
> >> 4:2:0. So, the sink has a max tmds but this gets into account
> >> when the vic list present in the EDID is built, but not
> >> considered in deep color modes, unless the EDID is broken.
> >>
> >>> As for the RGB vs. YCbCr question, I guess we should just prefer RGB444
> >>> for now. And fall back to YCbCr 4:2:2 or 4:2:0 if necessary. And that 
> >>> leaves YCbCr 4:4:4 unsed since it has the same requirements as RGB
> >>> 4:4:4 and thus doesn't provide any benefit as such. We could later add
> >>> a property to let the user choose between RGB vs. YCbCr more explicitly.
> >>>
> >> Hmm, I am trying to implement this but I am facing a difficulty:
> >> how will I fallback to YCbCr? RGB is always supported and the max
> >> tmds only enters in deep color modes. For reference here is a
> >> simple struct i created with the different tmds character rate
> >> factors for the different encodings (I think they are correct,
> >> but cross check please):
> >>
> >> #define DRM_CS_DESC(cs, f, b) \
> >> .colorspace = (cs), .factor_to_khz = (f), .bpc = (b)
> >>
> >> static const struct drm_mode_colorspace_desc {
> >> u32 colorspace;
> >> u32 factor_to_khz;
> >> u32 bpc;
> >> } drm_mode_colorspace_factors = { /* Ordered by descending
> >> preference */
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_RGB444, 2000, 48) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB444, 2000, 48) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_RGB444, 1500, 36) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB444, 1500, 36) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_RGB444, 1250, 30) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB444, 1250, 30) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_RGB444, 1000, 24) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB444, 1000, 24) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB422, 1000, 24) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB422, 1000, 30) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB422, 1000, 36) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB420, 1000, 48) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB420, 750, 36) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB420, 625, 30) },
> >> { DRM_CS_DESC(DRM_COLOR_FORMAT_YCRCB420, 500, 24) },
> >>
> >> Notice how YCbCr 4:4:4 will never get picked: it has the same
> >> factor of RGB 4:4:4 for every bpc. So, the sink must support RGB
> >> 4:4:4 and may support YCbCr. What I didn't check was that if it
> >> is possible to have support for deep color YCbCr without having
> >> support for deep color RGB 4:4:4. Do you know if this can happen?
> > I don't think that's possible. So the 4:4:4 RGB vs. YCbCr choice is
> > probably something we have to leave up to the user. Although I have
> > a vague recollection that CEA-861 says that you should prefer YCbCr
> > for CE modes and RGB for IT modes. 
> 
> RGB Full Range is the default for IT modes. As for CE modes it
> says it depends on vactive, which I am not quite understanding
> why (pg. 34, CEA-861-F).

I think that vactive note is just referring to the SD->BT.601 and
HD->BT.709 rule.

> 
> > If we want to follow that I think we
> > want a property similar to the "Broadcast RGB" thing that allows you to
> > select between "Automatic", "RGB", and "YCbCr". Not sure if we should
> > also allow the user to explicitly select the subsampling mode for YCbCr.
> 
> I think we can start by only RGB vs. YCbCr vs. automatic.
> 
> > I also think we sho

[Bug 99426] gem_mmap_gtt swap tests are too long - perf: interrupt took too long

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99426

Bug ID: 99426
   Summary: gem_mmap_gtt swap tests are too long - perf: interrupt
took too long
   Product: DRI
   Version: unspecified
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: IGT
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: christophe.prig...@intel.com

Tested on BDW, SNB, SKL, IVB, HSW, BYT with SW config:

Kernel: 4.10.0-rc3 ea7e3e5 branch drm-tip from
https://cgit.freedesktop.org/drm-tip
  commit ea7e3e5c99e316fb6876399f9b32b2372e45c4af
  Author: Joonas Lahtinen 
  Date:   Mon Jan 9 16:46:47 2017 +0200
  drm-tip: 2017y-01m-09d-14h-45m-54s UTC integration manifest

libdrm-2.4.74-21 geebefaf from git://anongit.freedesktop.org/mesa/drm
mesa: mesa-13.0.2 c9e993b from git://anongit.freedesktop.org/mesa/mesa
cairo 1.15.4 9fe6683 from git://anongit.freedesktop.org/cairo
xorg-server-1.19.0-38 9d32b71 from git://git.freedesktop.org/git/xorg/xserver
xf86-video-intel 2.99.917-747 028c946 from
git://git.freedesktop.org/git/xorg/driver/xf86-video-intel
libva-1.7.2-45 acbc209 from git://git.freedesktop.org/git/vaapi/libva 
vaapi-intel-driver: 1.7.2-216 70770f9 from
git://git.freedesktop.org/git/vaapi/intel-driver
intel-gpu-tools-1.17 e2eefcc from
http://anongit.freedesktop.org/git/xorg/app/intel-gpu-tools.git

Steps:
---
1. Execute IGT test manually (no timeout is used):
./gem_mmap_gtt --r swap-copy
2. Wait 100 hours

Actual results:

2. Test is still not finished after 100 hours (IGT is still running - DUT is
not freezed)
dmesg shows the same logs on all platforms, example on SKL:
[  151.322722] [IGT] gem_mmap_gtt: executing
[  151.353973] [IGT] gem_mmap_gtt: starting subtest swap-copy
[  151.354090] gem_mmap_gtt (31952): drop_caches: 4
[ 4843.205005] perf: interrupt took too long (2540 > 2500), lowering
kernel.perf_event_max_sample_rate to 78500
[ 6383.794279] perf: interrupt took too long (3202 > 3175), lowering
kernel.perf_event_max_sample_rate to 62250
[ 9271.093175] perf: interrupt took too long (4037 > 4002), lowering
kernel.perf_event_max_sample_rate to 49500
[14046.280647] perf: interrupt took too long (5090 > 5046), lowering
kernel.perf_event_max_sample_rate to 39250
[22889.758381] perf: interrupt took too long (6365 > 6362), lowering
kernel.perf_event_max_sample_rate to 31250
[50315.915256] perf: interrupt took too long (7982 > 7956), lowering
kernel.perf_event_max_sample_rate to 25000

Expected results:
-
2. Test is not so long

Info:
-
I can't attach dmesg due to its size
There is no log from IGT

-- 
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 libdrm v2 2/4] xf86drm: Add USB support

2017-01-16 Thread Emil Velikov
On 13 January 2017 at 12:11, Mark Kettenis  wrote:
>> From: Thierry Reding 
>> Date: Thu, 12 Jan 2017 23:04:27 +0100
>>
>> Allow DRM/KMS devices hosted on USB to be detected by the drmDevice
>> infrastructure.
>>
>> v2:
>> - make sysfs_uevent_get() more flexible using a format string
>>
>> Signed-off-by: Thierry Reding 
>
> All this sysfs parsing stuff is highly Linux-specific and should
> probably be #ifdef __linux__.  Returning -EINVAL on non-Linux
> platforms for usb and host1x should be fine.
>
Nicely spotted. Thierry with the above the series is
Reviewed-by: Emil Velikov 

Can you land these in the next few days - I would love to have a
libdrm release and use drmGetDevice[s]2 in mesa.

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


Re: [PATCH libdrm 1/2] xf86drmMode.h: Use consistent padding

2017-01-16 Thread Emil Velikov
On 12 January 2017 at 21:35, Thierry Reding  wrote:
> From: Thierry Reding 
>
> Signed-off-by: Thierry Reding 
This and 2/2 are
Reviewed-by: Emil Velikov 

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


Re: [PATCH libdrm] xf86drm: Fix type-punned pointer build warning

2017-01-16 Thread Emil Velikov
On 12 January 2017 at 21:48, Thierry Reding  wrote:
> From: Thierry Reding 
>
>   CC   libdrm_la-xf86drmMode.lo
> ../xf86drmMode.c: In function 'drmHandleEvent':
> ../xf86drmMode.c:854:15: warning: dereferencing type-punned pointer will 
> break strict-aliasing rules [-Wstrict-aliasing]
>e = (struct drm_event *)(&buffer[i]);
>^
>
> Signed-off-by: Thierry Reding 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99350
Reviewed-by: Emil Velikov 

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


[Bug 99045] The string passed to sscanf() contains an uninitialized value.

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99045

Emil Velikov  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Emil Velikov  ---
Just pushed the patch to master. Thanks !

-- 
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 93760] radeonsi vaapi mpeg2 decode slightly corrupt or asserts.

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93760

--- Comment #6 from Nayan Deshmukh  ---
(In reply to Christian König from comment #3)
> Sorry totally missed that bug.
> 
> The problem is most likely that GStreamer sends multiple slices in one
> request to VA-API and we can't handle that in the state tracker.
> 
> Should be easy to fix actually, but we need somebody to look into it and
> reproduce this.
>
What changes do we need to make to handle multiple slices?
The video plays fine with vdpau. Can you point me to the code where vdpau
handles multiple slices as both of them share similar code path.

> Another task for Nayan maybe?

-- 
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 libdrm] xf86drm: fix valgrind warning in drmParsePciBusInfo

2017-01-16 Thread Emil Velikov
On 13 January 2017 at 21:11, Nicholas Miell  wrote:
> On 01/13/2017 09:57 AM, Emil Velikov wrote:
>>
>> On 13 January 2017 at 11:34, Jan Vesely  wrote:
>>>
>>> On Thu, 2017-01-12 at 18:16 -0800, Nicholas Miell wrote:

 From 714d07f600db39498c87d7816f4dd3a7e6d9bbca Mon Sep 17 00:00:00 2001
 From: Nicholas Miell 
 Date: Thu, 12 Jan 2017 15:43:07 -0800
 Subject: [PATCH libdrm] xf86drm: fix valgrind warning in
 drmParsePciBusInfo

 The current implementation reads (up to) 513 bytes, overwrites the 513th
 byte with '\0' and then passes the buffer off to strstr() and sscanf()
 without ever initializing the middle bytes. This causes valgrind
 warnings and potentially fails to parse PCI_SLOT_NAME if the uevent is
 unexpectedly large.
>>>
>>>
>>> a simpler fix should also get rid of the valgrind warning:
>>>
>>> -  ret = read(fd, data, sizeof(data));
>>> -  data[sizeof(data)-1] = '\0';
>>> +  ret = read(fd, data, sizeof(data) - 1);
>>>close(fd);
>>>if (ret < 0)
>>>return -errno
>>> +  data[ret] = '\0';
>>>
>> We had this (better imho) patch a week or so ago. In either case the
>> issue is virtually since (iirc) if the string is malformed we'll bail
>> out either way.
>
>
> Simpler, but potentially stops working in the future. It already stopped
> working once.
>
Stopped working = it never worked since it was introduced (initially
in mesa) circa 2014 ;-)

That aside, Thierry has some helper(s) which we can reuse here.

>>> I think that dynamic memory allocation is still a more robust approach.
>>>
>> Yes that might be the better solution, or one could even use
>> getline(). The latter might be pushing it's only POSIX 2008.
>
>
> POSIX isn't relevant, this is a Linux-specific function.
>
I'm well aware of that, it was me who added the guard or reviewed &
pushed the commit ;-)

As you may be aware other platforms also have sysfs - FreeBSD (and
derivatives?), GNU Hurd and perhaps others. Things are kept Linux only
since almost (nobody) running !Linux platform has bothered looking in
libdrm for a long time. And it's not like I haven't poked people on a
number of occasions :-P

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


[PATCH] drm: Clean up the 1366x768 fixup codes

2017-01-16 Thread Takashi Iwai
This is just a cleanup, no functional change.

The fixup code for 1366x768 in drm_mode_create_from_cmdline_mode() is
basically a copy of the existing code in drm_edid.c.  Make the latter
code public so that it can be called from the former function.

Signed-off-by: Takashi Iwai 
---
 drivers/gpu/drm/drm_crtc_internal.h | 3 +++
 drivers/gpu/drm/drm_edid.c  | 6 +++---
 drivers/gpu/drm/drm_modes.c | 9 ++---
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
b/drivers/gpu/drm/drm_crtc_internal.h
index cdf6860c9d22..01bde7103ad6 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -199,3 +199,6 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
   void *data, struct drm_file *file_priv);
 int drm_mode_page_flip_ioctl(struct drm_device *dev,
 void *data, struct drm_file *file_priv);
+
+/* drm_edid.c */
+void drm_mode_fixup_1366x768(struct drm_display_mode *mode);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 336be31ff3de..739a19cb27d9 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2152,7 +2152,7 @@ drm_dmt_modes_for_range(struct drm_connector *connector, 
struct edid *edid,
 /* fix up 1366x768 mode from 1368x768;
  * GFT/CVT can't express 1366 width which isn't dividable by 8
  */
-static void fixup_mode_1366x768(struct drm_display_mode *mode)
+void drm_mode_fixup_1366x768(struct drm_display_mode *mode)
 {
if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
mode->hdisplay = 1366;
@@ -2176,7 +2176,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, 
struct edid *edid,
if (!newmode)
return modes;
 
-   fixup_mode_1366x768(newmode);
+   drm_mode_fixup_1366x768(newmode);
if (!mode_in_range(newmode, edid, timing) ||
!valid_inferred_mode(connector, newmode)) {
drm_mode_destroy(dev, newmode);
@@ -2205,7 +2205,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, 
struct edid *edid,
if (!newmode)
return modes;
 
-   fixup_mode_1366x768(newmode);
+   drm_mode_fixup_1366x768(newmode);
if (!mode_in_range(newmode, edid, timing) ||
!valid_inferred_mode(connector, newmode)) {
drm_mode_destroy(dev, newmode);
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index e6b19bc9021a..860f4d1ffbde 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1461,13 +1461,8 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
 
mode->type |= DRM_MODE_TYPE_USERDEF;
/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
-   if (cmd->xres == 1366 && mode->hdisplay == 1368) {
-   mode->hdisplay = 1366;
-   mode->hsync_start--;
-   mode->hsync_end--;
-   drm_mode_set_name(mode);
-   }
-   drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+   if (cmd->xres == 1366)
+   drm_mode_fixup_1366x768(mode);
return mode;
 }
 EXPORT_SYMBOL(drm_mode_create_from_cmdline_mode);
-- 
2.11.0

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


Re: [PATCH] README: Fix grammar

2017-01-16 Thread Emil Velikov
On 16 January 2017 at 01:09, Fabio Estevam  wrote:
> Fix two grammar issues:
>
> - "standard  autotools  packages ---> "standard  autotools  package"
> - "If you are install" ---> "If you are installing"
>
> Signed-off-by: Fabio Estevam 
R-b and pushed to master.

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


[Bug 93760] radeonsi vaapi mpeg2 decode slightly corrupt or asserts.

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=93760

--- Comment #7 from Christian König  ---
Take a look at vlVaHandleSliceParameterBufferMPEG12 and the assert.

We probably just need to handle the case of multiple buffers here and in
handleVASliceDataBufferType.

The later is a bit tricky, since you need to search all slice buffers for the
start code and call begin_frame() only once even when you get multiple buffers
and/or calls to that function.

-- 
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: [Freedreno] [PATCH 10/12] firmware: qcom_scm: Add qcom_scm_gpu_zap_resume()

2017-01-16 Thread Stanimir Varbanov
Hi Andy,

On 01/15/2017 07:20 AM, Andy Gross wrote:
> + Stanimir
> 
> On Sat, Jan 14, 2017 at 09:49:01PM -0600, Andy Gross wrote:
>> On Fri, Jan 13, 2017 at 04:24:38PM -0700, Jordan Crouse wrote:
>>> On Fri, Jan 13, 2017 at 11:12:41AM -0600, Andy Gross wrote:
 On Mon, Nov 28, 2016 at 12:28:35PM -0700, Jordan Crouse wrote:
> Add an interface to trigger the remote processor to reinitialize the GPU
> zap shader on power-up.
>
> Signed-off-by: Jordan Crouse 
> ---

 

> +int __qcom_scm_gpu_zap_resume(struct device *dev)
> +{
> + struct qcom_scm_desc desc = {0};
> + struct arm_smccc_res res;
> + int ret;
> +
> + desc.args[0] = 0;
>>>
>>> This is an opcode to force the state to resume.
>>>
>>> QCOM_SCM_BOOT_SET_STATE_RESUME perhaps?  Or something similar but shorter.
>>>
> + desc.args[1] = 13;
>>>
>>> This is the same as the SCM id of the GPU but I think that is a coincidence.
>>> We've always used it to identify the GPU in this call.
>>>
>>> QCOM_SCM_BOOT_SET_STATE_GPU would be fine here - or something similar.
>>>
 Can I get a define here for these two?  Or maybe a comment on what these 
 values
 are?

> + desc.arginfo = QCOM_SCM_ARGS(2);
> +
> + ret = qcom_scm_call(dev, QCOM_SCM_SVC_BOOT, 0x0A, &desc, &res);

 Same with the 0xA.  We usually throw a #define in for the command 
 definitions.
>>>
>>> 0x0A sets the state of the device - for us it is always 0 (resume) and 
>>> always
>>> the GPU.
>>>
>>> #define  QCOM_SCM_BOOT_SET_STATE 0x0A
>>>
 Otherwise this all looks fine.  If you can get back to me with either the 
 values
 or a new patch I can include this in the next pull.
>>>
>>> I'll make the changes and start the song and dance, but you'll no doubt be
>>> faster than I.
>>
>> I can just fix up the patch with the above.  Thanks for the additional 
>> details.
> 
> The plot thickens.  So I have a patch from Stanimir concerning another SCM 
> call
> that is using the same command and number of arguments.  And it also concerns
> setting state.  I think that we need to roll a common API for setting the 
> state
> and then both of you can call it.  That way we can kill two birds with one
> stone.
> 
> Something along the lines of a function prototype:
> int qcom_scm_set_remote_state(u32 state, u32 id)
> {
>   return __qcom_scm_set_remote_state(__scm->dev, state, id);
> }
> EXPORT_SYMBOL(qcom_scm_set_remote_state);
> 
> where state is the state you want set, and id is the identifier of the remote
> proc.
> 
> Does this make sense for both of your use cases?

I'm fine with that.

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


[PULL] drm-amdkfd-next

2017-01-16 Thread Oded Gabbay
Hi Dave,

Pull request for amdkfd.
Just two patches for 4.11 merge window:
- A small fix to return value of function in case of error
- A spelling mistake

Thanks,

   Oded

The following changes since commit 282d0a35c8c42c3ac4dd86a7e408ed1b30db4897:

  Merge tag 'drm-misc-next-2017-01-09' of 
git://anongit.freedesktop.org/git/drm-misc into drm-next (2017-01-10 08:06:56 
+1000)

are available in the git repository at:

  git://people.freedesktop.org/~gabbayo/linux tags/drm-amdkfd-next-2017-01-16

for you to fetch changes up to 8bf793883da213864efc50c274d2b38ec0ca58b2:

  drm/amdkfd: fix improper return value on error (2017-01-16 17:34:47 +0200)


Colin Ian King (1):
  amdkfd: fix spelling mistake in kfd_ioctl_dbg_unrgesiter

Pan Bian (1):
  drm/amdkfd: fix improper return value on error

 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 6 +++---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c  | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 188621] Function kfd_wait_on_events() does not set error code when the call to copy_from_user() fails

2017-01-16 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=188621

--- Comment #4 from Oded Gabbay  ---
Hi,
Sent the patch to upstream for kernel 4.11 merge window.

Oded

-- 
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


[PATCH 0/4] Allow ASYNC flip with atomic helpers.

2017-01-16 Thread Andrey Grodzovsky
This series is a folow-up on 
https://patchwork.kernel.org/patch/9501787/

The first patch makes changes to atomic helpers
to allow for drives with ASYNC flip support to use them.
Patches 2 and 3 are to use this in AMDGPU/DC and
patch 4 is possible cleanup in nouveau/kms who seems
to have the duplicate the helper as we did to support
ASYNC flips. 

Andrey Grodzovsky (4):
  drm/atomic: Save flip flags in drm_plane_state
  drm/amdgpu: Remove flip_flag from amdgpu_crtc
  drm/amd/display: Switch to using atomic_helper for flip.
  drm/nouveau/kms/nv50: Switch to using atomic helper for flip.

 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h   |  1 -
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++
 drivers/gpu/drm/drm_atomic_helper.c| 10 +--
 drivers/gpu/drm/nouveau/nv50_display.c | 77 ++
 include/drm/drm_plane.h|  8 ++
 5 files changed, 22 insertions(+), 166 deletions(-)

-- 
1.9.1

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


[PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state

2017-01-16 Thread Andrey Grodzovsky
Allows using atomic flip helpers for drivers
using ASYNC flip.
Remove ASYNC_FLIP restriction in helpers and
caches the page flip flags in drm_plane_state
to be used in the low level drivers.

Signed-off-by: Andrey Grodzovsky 
---
 drivers/gpu/drm/drm_atomic_helper.c | 10 +++---
 include/drm/drm_plane.h |  8 
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index a4e5477..f83dc43 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2737,7 +2737,8 @@ static int page_flip_common(
struct drm_atomic_state *state,
struct drm_crtc *crtc,
struct drm_framebuffer *fb,
-   struct drm_pending_vblank_event *event)
+   struct drm_pending_vblank_event *event,
+   uint32_t flags)
 {
struct drm_plane *plane = crtc->primary;
struct drm_plane_state *plane_state;
@@ -2754,6 +2755,7 @@ static int page_flip_common(
if (IS_ERR(plane_state))
return PTR_ERR(plane_state);
 
+   plane_state->pflip_flags = flags;
 
ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
if (ret != 0)
@@ -2800,9 +2802,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
struct drm_atomic_state *state;
int ret = 0;
 
-   if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
-   return -EINVAL;
-
state = drm_atomic_state_alloc(plane->dev);
if (!state)
return -ENOMEM;
@@ -2865,9 +2864,6 @@ int drm_atomic_helper_page_flip_target(
struct drm_crtc_state *crtc_state;
int ret = 0;
 
-   if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
-   return -EINVAL;
-
state = drm_atomic_state_alloc(plane->dev);
if (!state)
return -ENOMEM;
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index db3bbde..86d8ffc 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -122,6 +122,14 @@ struct drm_plane_state {
 */
bool visible;
 
+
+   /**
+* @pflip_flags:
+*
+* Flip related config options
+*/
+   u32 pflip_flags;
+
struct drm_atomic_state *state;
 };
 
-- 
1.9.1

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


Re: [PATCH 2/5 v3] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event()

2017-01-16 Thread Laurent Pinchart
Hi John,

Thank you for the patch.

On Tuesday 03 Jan 2017 11:41:39 John Stultz wrote:
> In chasing down a previous issue with EDID probing from calling
> drm_helper_hpd_irq_event() from irq context, Laurent noticed
> that the DRM documentation suggests that
> drm_kms_helper_hotplug_event() should be used instead.
> 
> Thus this patch replaces drm_helper_hpd_irq_event() with
> drm_kms_helper_hotplug_event(), which requires we update the
> connector.status entry and only call _hotplug_event() when the
> status changes.
> 
> Cc: David Airlie 
> Cc: Archit Taneja 
> Cc: Wolfram Sang 
> Cc: Lars-Peter Clausen 
> Cc: Laurent Pinchart 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: John Stultz 
> ---
> v3: Update connector.status value and only call __hotplug_event()
> when that status changes, as suggested by Laurent.
> 
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 16 +++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 4fcea44..d93d66f
> 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -405,8 +405,22 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
>  static void adv7511_hpd_work(struct work_struct *work)
>  {
>   struct adv7511 *adv7511 = container_of(work, struct adv7511, 
hpd_work);
> + enum drm_connector_status status;
> + unsigned int val;
> + int ret;
> +
> + ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
> + if (ret < 0)
> + status = connector_status_disconnected;
> + else if (val & ADV7511_STATUS_HPD)
> + status = connector_status_connected;
> + else
> + status = connector_status_disconnected;
> +
> + if (adv7511->connector.status != status)
> + drm_kms_helper_hotplug_event(adv7511->connector.dev);
> 
> - drm_helper_hpd_irq_event(adv7511->connector.dev);
> + adv7511->connector.status = status;

Shouldn't you update the status before calling drm_kms_helper_hotplug_event() 
? Doing it after not only creates a small race condition as 
drm_kms_helper_hotplug_event() sends an event to userspace that could result 
in an ioctl call to retrieve the status, but the status is also checked by 
drm_setup_crtcs() called by drm_fb_helper_hotplug_event().

>  }
> 
>  static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 4/5 v3] drm/bridge: adv7511: Rework adv7511_power_on/off() so they can be reused internally

2017-01-16 Thread Laurent Pinchart
Hi John,

Thank you for the patch.

On Tuesday 03 Jan 2017 11:41:41 John Stultz wrote:
> In chasing down issues with EDID probing, I found some
> duplicated but incomplete logic used to power the chip on and
> off.
> 
> This patch refactors the adv7511_power_on/off functions, so
> they can be used for internal needs.
> 
> Cc: David Airlie 
> Cc: Archit Taneja 
> Cc: Wolfram Sang 
> Cc: Lars-Peter Clausen 
> Cc: Laurent Pinchart 

Reviewed-by: Laurent Pinchart 

> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: John Stultz 
> ---
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 4b90975..dbdb71c
> 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -325,7 +325,7 @@ static void adv7511_set_link_config(struct adv7511
> *adv7511, adv7511->rgb = config->input_colorspace == HDMI_COLORSPACE_RGB;
>  }
> 
> -static void adv7511_power_on(struct adv7511 *adv7511)
> +static void __adv7511_power_on(struct adv7511 *adv7511)
>  {
>   adv7511->current_edid_segment = -1;
> 
> @@ -359,24 +359,30 @@ static void adv7511_power_on(struct adv7511 *adv7511)
>* Most of the registers are reset during power down or when HPD is 
low.
>*/
>   regcache_sync(adv7511->regmap);
> +}
> 
> +static void adv7511_power_on(struct adv7511 *adv7511)
> +{
> + __adv7511_power_on(adv7511);
>   if (adv7511->type == ADV7533)
>   adv7533_dsi_power_on(adv7511);
> -
>   adv7511->powered = true;
>  }
> 
> -static void adv7511_power_off(struct adv7511 *adv7511)
> +static void __adv7511_power_off(struct adv7511 *adv7511)
>  {
>   /* TODO: setup additional power down modes */
>   regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
>  ADV7511_POWER_POWER_DOWN,
>  ADV7511_POWER_POWER_DOWN);
>   regcache_mark_dirty(adv7511->regmap);
> +}
> 
> +static void adv7511_power_off(struct adv7511 *adv7511)
> +{
> + __adv7511_power_off(adv7511);
>   if (adv7511->type == ADV7533)
>   adv7533_dsi_power_off(adv7511);
> -
>   adv7511->powered = false;
>  }

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 2/5 v3] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event()

2017-01-16 Thread Laurent Pinchart
On Monday 16 Jan 2017 17:47:46 Laurent Pinchart wrote:
> Hi John,
> 
> Thank you for the patch.
> 
> On Tuesday 03 Jan 2017 11:41:39 John Stultz wrote:
> > In chasing down a previous issue with EDID probing from calling
> > drm_helper_hpd_irq_event() from irq context, Laurent noticed
> > that the DRM documentation suggests that
> > drm_kms_helper_hotplug_event() should be used instead.
> > 
> > Thus this patch replaces drm_helper_hpd_irq_event() with
> > drm_kms_helper_hotplug_event(), which requires we update the
> > connector.status entry and only call _hotplug_event() when the
> > status changes.
> > 
> > Cc: David Airlie 
> > Cc: Archit Taneja 
> > Cc: Wolfram Sang 
> > Cc: Lars-Peter Clausen 
> > Cc: Laurent Pinchart 
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: John Stultz 
> > ---
> > v3: Update connector.status value and only call __hotplug_event()
> > 
> > when that status changes, as suggested by Laurent.
> >  
> >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 16 +++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 4fcea44..d93d66f
> > 100644
> > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> > @@ -405,8 +405,22 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
> > 
> >  static void adv7511_hpd_work(struct work_struct *work)
> >  {
> >  
> > struct adv7511 *adv7511 = container_of(work, struct adv7511,
> 
> hpd_work);
> 
> > +   enum drm_connector_status status;
> > +   unsigned int val;
> > +   int ret;
> > +
> > +   ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
> > +   if (ret < 0)
> > +   status = connector_status_disconnected;
> > +   else if (val & ADV7511_STATUS_HPD)
> > +   status = connector_status_connected;
> > +   else
> > +   status = connector_status_disconnected;
> > +
> > +   if (adv7511->connector.status != status)
> > +   drm_kms_helper_hotplug_event(adv7511->connector.dev);
> > 
> > -   drm_helper_hpd_irq_event(adv7511->connector.dev);
> > +   adv7511->connector.status = status;
> 
> Shouldn't you update the status before calling
> drm_kms_helper_hotplug_event() ? Doing it after not only creates a small
> race condition as
> drm_kms_helper_hotplug_event() sends an event to userspace that could result
> in an ioctl call to retrieve the status, but the status is also checked by
> drm_setup_crtcs() called by drm_fb_helper_hotplug_event().

With

if (adv7511->connector.status != status) {
adv7511->connector.status = status;
drm_kms_helper_hotplug_event(adv7511->connector.dev);
}

Reviewed-by: Laurent Pinchart 
Tested-by: Laurent Pinchart 

> >  }
> >  
> >  static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 0/5 v3] adv7511 EDID probing improvements

2017-01-16 Thread Laurent Pinchart
Hi John,

Thank you for the patches.

On Tuesday 03 Jan 2017 11:41:37 John Stultz wrote:
> Hope everyone had a good newyears!
> 
> Wanted to re-send out v3 of this patch set improving the EDID
> probing on the adv7511 used on HiKey, for consideration for
> merging for 4.11
> 
> The first three patches are fixups that are hopefully straight
> forward, integrating feedback I got from Laurant.
> 
> The last two patches try to clean up and resue code, which as
> a side effect avoids an issue I'm seeing where something is
> going wrong with the regmap cache state for the
> ADV7511_REG_EDID_I2C_ADDR(0x43) register which results in
> i2c_transfer errors if we don't do the
> regcache_sync/_mark_dirty() calls. I suspect there might be a
> better solution there, but have not gotten any other suggestions
> so I wanted to go ahead and submit these.
> 
> Thoughts and feedback would be appreciated!

For the whole series,

Tested-by: Laurent Pinchart 

> New in v3:
> * Addressed naming improvements and drm_kms_helper_hotplug_event
>   usage corrections as suggested by Laurent.
> 
> Cc: David Airlie 
> Cc: Archit Taneja 
> Cc: Wolfram Sang 
> Cc: Lars-Peter Clausen 
> Cc: Laurent Pinchart 
> Cc: dri-devel@lists.freedesktop.org
> 
> Archit Taneja (1):
>   drm/bridge: adv7511: Enable HPD interrupts to support hotplug and
> improve monitor detection
> 
> John Stultz (4):
>   drm/bridge: adv7511: Use work_struct to defer hotplug handing to out
> of irq context
>   drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event()
>   drm/bridge: adv7511: Rework adv7511_power_on/off() so they can be
> reused internally
>   drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID
> 
>  drivers/gpu/drm/bridge/adv7511/adv7511.h |  2 +
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 62
> +++- 2 files changed, 44 insertions(+), 20
> deletions(-)

-- 
Regards,

Laurent Pinchart

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


[PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip.

2017-01-16 Thread Andrey Grodzovsky
Change-Id: Iad3e0b9b3546e4e4dc79be9233daf4fe4dba83e0
Signed-off-by: Andrey Grodzovsky 
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++
 1 file changed, 6 insertions(+), 86 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index a443b70..d4664bf 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -1060,83 +1060,6 @@ static int dm_crtc_funcs_atomic_set_property(
return 0;
 }
 
-
-static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc,
-   struct drm_framebuffer *fb,
-   struct drm_pending_vblank_event *event,
-   uint32_t flags)
-{
-   struct drm_plane *plane = crtc->primary;
-   struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
-   struct drm_atomic_state *state;
-   struct drm_plane_state *plane_state;
-   struct drm_crtc_state *crtc_state;
-   int ret = 0;
-
-   state = drm_atomic_state_alloc(plane->dev);
-   if (!state)
-   return -ENOMEM;
-
-   ret = drm_crtc_vblank_get(crtc);
-   if (ret)
-   return ret;
-
-   state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
-retry:
-   crtc_state = drm_atomic_get_crtc_state(state, crtc);
-   if (IS_ERR(crtc_state)) {
-   ret = PTR_ERR(crtc_state);
-   goto fail;
-   }
-   crtc_state->event = event;
-
-   plane_state = drm_atomic_get_plane_state(state, plane);
-   if (IS_ERR(plane_state)) {
-   ret = PTR_ERR(plane_state);
-   goto fail;
-   }
-
-   ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
-   if (ret != 0)
-   goto fail;
-   drm_atomic_set_fb_for_plane(plane_state, fb);
-
-   /* Make sure we don't accidentally do a full modeset. */
-   state->allow_modeset = false;
-   if (!crtc_state->active) {
-   DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n",
-crtc->base.id);
-   ret = -EINVAL;
-   goto fail;
-   }
-   acrtc->flip_flags = flags;
-
-   ret = drm_atomic_nonblocking_commit(state);
-
-fail:
-   if (ret == -EDEADLK)
-   goto backoff;
-
-   if (ret)
-   drm_crtc_vblank_put(crtc);
-
-   drm_atomic_state_put(state);
-
-   return ret;
-backoff:
-   drm_atomic_state_clear(state);
-   drm_atomic_legacy_backoff(state);
-
-   /*
-* Someone might have exchanged the framebuffer while we dropped locks
-* in the backoff code. We need to fix up the fb refcount tracking the
-* core does for us.
-*/
-   plane->old_fb = plane->fb;
-
-   goto retry;
-}
-
 /* Implemented only the options currently availible for the driver */
 static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
.reset = drm_atomic_helper_crtc_reset,
@@ -1145,7 +1068,7 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc 
*crtc,
.destroy = amdgpu_dm_crtc_destroy,
.gamma_set = amdgpu_dm_atomic_crtc_gamma_set,
.set_config = drm_atomic_helper_set_config,
-   .page_flip = amdgpu_atomic_helper_page_flip,
+   .page_flip_target = drm_atomic_helper_page_flip_target,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
.atomic_set_property = dm_crtc_funcs_atomic_set_property
@@ -1679,7 +1602,7 @@ static bool page_flip_needed(
sizeof(old_state_tmp)) == 0 ? true:false;
if (new_state->crtc && page_flip_required == false) {
acrtc_new = to_amdgpu_crtc(new_state->crtc);
-   if (acrtc_new->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC)
+   if (new_state->pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC)
page_flip_required = true;
}
return page_flip_required;
@@ -2760,7 +2683,6 @@ int amdgpu_dm_atomic_commit(
for_each_plane_in_state(state, plane, old_plane_state, i) {
struct drm_plane_state *plane_state = plane->state;
struct drm_crtc *crtc = plane_state->crtc;
-   struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
struct drm_framebuffer *fb = plane_state->fb;
 
if (!fb || !crtc || !crtc->state->planes_changed ||
@@ -2771,10 +2693,9 @@ int amdgpu_dm_atomic_commit(
ret = amdgpu_crtc_page_flip_target(crtc,
   fb,
   crtc->state->event,
-  acrtc->flip_flags,
-  
drm_crtc_

[PATCH 4/4] drm/nouveau/kms/nv50: Switch to using atomic helper for flip.

2017-01-16 Thread Andrey Grodzovsky
Signed-off-by: Andrey Grodzovsky 
---
 drivers/gpu/drm/nouveau/nv50_display.c | 77 +++---
 1 file changed, 5 insertions(+), 72 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c 
b/drivers/gpu/drm/nouveau/nv50_display.c
index 2c2c645..419e00c 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -846,6 +846,10 @@ struct nv50_wndw_func {
asyw->image.w = fb->base.width;
asyw->image.h = fb->base.height;
asyw->image.kind = (fb->nvbo->tile_flags & 0xff00) >> 8;
+
+   asyw->interval =
+   asyw->state.pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? 0 
: 1;
+
if (asyw->image.kind) {
asyw->image.layout = 0;
if (drm->device.info.chipset >= 0xc0)
@@ -2221,77 +2225,6 @@ struct nv50_base {
.atomic_check = nv50_head_atomic_check,
 };
 
-/* This is identical to the version in the atomic helpers, except that
- * it supports non-vblanked ("async") page flips.
- */
-static int
-nv50_head_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
-   struct drm_pending_vblank_event *event, u32 flags)
-{
-   struct drm_plane *plane = crtc->primary;
-   struct drm_atomic_state *state;
-   struct drm_plane_state *plane_state;
-   struct drm_crtc_state *crtc_state;
-   int ret = 0;
-
-   state = drm_atomic_state_alloc(plane->dev);
-   if (!state)
-   return -ENOMEM;
-
-   state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
-retry:
-   crtc_state = drm_atomic_get_crtc_state(state, crtc);
-   if (IS_ERR(crtc_state)) {
-   ret = PTR_ERR(crtc_state);
-   goto fail;
-   }
-   crtc_state->event = event;
-
-   plane_state = drm_atomic_get_plane_state(state, plane);
-   if (IS_ERR(plane_state)) {
-   ret = PTR_ERR(plane_state);
-   goto fail;
-   }
-
-   ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
-   if (ret != 0)
-   goto fail;
-   drm_atomic_set_fb_for_plane(plane_state, fb);
-
-   /* Make sure we don't accidentally do a full modeset. */
-   state->allow_modeset = false;
-   if (!crtc_state->active) {
-   DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n",
-crtc->base.id);
-   ret = -EINVAL;
-   goto fail;
-   }
-
-   if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
-   nv50_wndw_atom(plane_state)->interval = 0;
-
-   ret = drm_atomic_nonblocking_commit(state);
-fail:
-   if (ret == -EDEADLK)
-   goto backoff;
-
-   drm_atomic_state_put(state);
-   return ret;
-
-backoff:
-   drm_atomic_state_clear(state);
-   drm_atomic_legacy_backoff(state);
-
-   /*
-* Someone might have exchanged the framebuffer while we dropped locks
-* in the backoff code. We need to fix up the fb refcount tracking the
-* core does for us.
-*/
-   plane->old_fb = plane->fb;
-
-   goto retry;
-}
-
 static int
 nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
uint32_t size)
@@ -2386,7 +2319,7 @@ struct nv50_base {
.gamma_set = nv50_head_gamma_set,
.destroy = nv50_head_destroy,
.set_config = drm_atomic_helper_set_config,
-   .page_flip = nv50_head_page_flip,
+   .page_flip = drm_atomic_helper_page_flip,
.set_property = drm_atomic_helper_crtc_set_property,
.atomic_duplicate_state = nv50_head_atomic_duplicate_state,
.atomic_destroy_state = nv50_head_atomic_destroy_state,
-- 
1.9.1

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


[PATCH 2/4] drm/amdgpu: Remove flip_flag from amdgpu_crtc

2017-01-16 Thread Andrey Grodzovsky
Follwing introduction of pflip_flags in drm_plane_state
this is not needed anymore.

Signed-off-by: Andrey Grodzovsky 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
index 4c0a86e..3ff3c14 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
@@ -443,7 +443,6 @@ struct amdgpu_crtc {
enum amdgpu_interrupt_state vsync_timer_enabled;
 
int otg_inst;
-   uint32_t flip_flags;
/* After Set Mode target will be non-NULL */
struct dc_target *target;
 };
-- 
1.9.1

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


Re: [PATCH 5/5 v3] drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID

2017-01-16 Thread Laurent Pinchart
Hi John,

Thank you for the patch.

On Tuesday 03 Jan 2017 11:41:42 John Stultz wrote:
> I've found that by just turning the chip on and off via the
> POWER_DOWN register, I end up getting i2c_transfer errors
> on HiKey.
> 
> Investigating further, it seems some of the register state
> in the regmap cache is somehow getting lost. Using the logic
> in __adv7511_power_on/off() which syncs and dirtys the cache
> avoids this issue.
> 
> Thus this patch changes the EDID probing logic so that we
> re-use the __adv7511_power_on/off() calls.

regcache_sync() is quite costly as it will write a bunch of registers. 
Wouldn't it be more efficient to only write the registers that are needed for 
EDID access ?

> Cc: David Airlie 
> Cc: Archit Taneja 
> Cc: Wolfram Sang 
> Cc: Lars-Peter Clausen 
> Cc: Laurent Pinchart 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: John Stultz 
> ---
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 +++--
>  1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index dbdb71c..24573e0
> 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -572,24 +572,13 @@ static int adv7511_get_modes(struct adv7511 *adv7511,
>   unsigned int count;
> 
>   /* Reading the EDID only works if the device is powered */
> - if (!adv7511->powered) {
> - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
> -ADV7511_POWER_POWER_DOWN, 0);
> - if (adv7511->i2c_main->irq) {
> - regmap_write(adv7511->regmap, 
ADV7511_REG_INT_ENABLE(0),
> -  ADV7511_INT0_EDID_READY);
> - regmap_write(adv7511->regmap, 
ADV7511_REG_INT_ENABLE(1),
> -  ADV7511_INT1_DDC_ERROR);
> - }
> - adv7511->current_edid_segment = -1;
> - }
> + if (!adv7511->powered)
> + __adv7511_power_on(adv7511);
> 
>   edid = drm_do_get_edid(connector, adv7511_get_edid_block, adv7511);
> 
>   if (!adv7511->powered)
> - regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER,
> -ADV7511_POWER_POWER_DOWN,
> -ADV7511_POWER_POWER_DOWN);
> + __adv7511_power_off(adv7511);
> 
>   kfree(adv7511->edid);
>   adv7511->edid = edid;

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v1 0/7] DRM: add LTDC support for STM32F4

2017-01-16 Thread Neil Armstrong
On 01/16/2017 02:28 PM, Yannick Fertre wrote:
> The purpose of this set of patches is to add a new driver for stm32f429.
> This driver was developed and tested on evaluation board stm32429i.
> 
> Stm32f4 is a MCU platform which don't have MMU so the last patches developed
> by Benjamin Gaignard regarding "DRM: allow to use mmuless devices"
> are necessary.
> 
> The board stm429i embeds a Ampire AM-480272H3TMQW-T01H screen.
> A new simple panel am-480272h3tmqw-t01h have been added to support it.
> 
> Yannick Fertre (7):
>   dt-bindings: display: add STM32 LTDC driver
>   drm/st: Add STM32 LTDC driver
>   dt-bindings: Add Ampire AM-480272H3TMQW-T01H panel
>   drm/panel: simple: Add support for Ampire AM-480272H3TMQW-T01H
>   ARM: dts: stm32f429: Add ltdc support
>   ARM: dts: stm32429i-eval: Enable ltdc & simple panel on Eval board
>   ARM: configs: Add STM32 LTDC support in STM32 defconfig
> 
>  .../display/panel/ampire,am-480272h3tmqw-t01h.txt  |7 +
>  .../devicetree/bindings/display/st,ltdc.txt|   57 +
>  arch/arm/boot/dts/stm32429i-eval.dts   |   58 +
>  arch/arm/boot/dts/stm32f429.dtsi   |   25 +-
>  arch/arm/configs/stm32_defconfig   |5 +
>  drivers/gpu/drm/Kconfig|2 +
>  drivers/gpu/drm/Makefile   |1 +
>  drivers/gpu/drm/panel/panel-simple.c   |   29 +
>  drivers/gpu/drm/st/Kconfig |   14 +
>  drivers/gpu/drm/st/Makefile|7 +
>  drivers/gpu/drm/st/drv.c   |  279 
>  drivers/gpu/drm/st/drv.h   |   25 +
>  drivers/gpu/drm/st/ltdc.c  | 1438 
> 
>  drivers/gpu/drm/st/ltdc.h  |   20 +
>  14 files changed, 1966 insertions(+), 1 deletion(-)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.txt
>  create mode 100644 Documentation/devicetree/bindings/display/st,ltdc.txt
>  create mode 100644 drivers/gpu/drm/st/Kconfig
>  create mode 100644 drivers/gpu/drm/st/Makefile
>  create mode 100644 drivers/gpu/drm/st/drv.c
>  create mode 100644 drivers/gpu/drm/st/drv.h
>  create mode 100644 drivers/gpu/drm/st/ltdc.c
>  create mode 100644 drivers/gpu/drm/st/ltdc.h
> 

Hi Yannick,

Shouldn't be more logical to use stm32 for the driver instead of st ?
It would eventually collude with the other STMicroelectronics SoCs and
will be aligned with other drivers like stm32-rtc, stm32-i2c, ...

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


[Bug 99330] Severe flickering with Fiji on Wayland

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99330

Vedran Miletić  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |NOTOURBUG

--- Comment #8 from Vedran Miletić  ---
Somehow can't reproduce it right now. The only related package I see in my
today's updates is GTK3 3.22.6-2.fc25 [1] which fixes [2]. Could be that. Will
report if it happens again.

[1] https://koji.fedoraproject.org/koji/buildinfo?buildID=832589
[2] https://bugzilla.gnome.org/show_bug.cgi?id=769835

-- 
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 99310] Ubuntu 16.04/16.10 AMD Radeonsi - wrong colors (oibaf ppa) in XFCE and eog.

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99310

--- Comment #2 from baptiste.fa...@orange.fr  ---
Same problem with me : reddish icons and blue tint for jpegs.

Using ubuntu 16.10 with mesa 13.0 (paolo dias package) and a amd r390.

-- 
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/exynos: use atomic helper commit

2017-01-16 Thread Gustavo Padovan
Hi Inki,

2017-01-16 Inki Dae :

> This patch relpaces specific atomic commit function
> with atomic helper commit one, which also includes
> atomic_commit_tail callback for Exynos SoC becasue
> crtc devices on Exynos SoC uses power domain device
> so drm_atomic_helper_commit_planes should be called
> after drm_atomic_helper_commit_modeset_enables.

Indeed, the commit message needs fixing.

> 
> Signed-off-by: Inki Dae 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c |   9 ++-
>  drivers/gpu/drm/exynos/exynos_drm_drv.c  | 110 
> +--
>  drivers/gpu/drm/exynos/exynos_drm_fb.c   |  25 ++-
>  3 files changed, 33 insertions(+), 111 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 2530bf5..47da612 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -39,6 +39,14 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
>  
>   if (exynos_crtc->ops->disable)
>   exynos_crtc->ops->disable(exynos_crtc);
> +
> + if (crtc->state->event && !crtc->state->active) {
> + spin_lock_irq(&crtc->dev->event_lock);
> + drm_crtc_send_vblank_event(crtc, crtc->state->event);
> + spin_unlock_irq(&crtc->dev->event_lock);
> +
> + crtc->state->event = NULL;
> + }
>  }
>  
>  static void
> @@ -94,7 +102,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc,
>   drm_crtc_send_vblank_event(crtc, event);
>   spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>   }
> -

Nitpick: I wouldn't include changes like this in the patch.

>  }
>  
>  static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 3ec0535..9d0df00 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -38,56 +38,6 @@
>  #define DRIVER_MAJOR 1
>  #define DRIVER_MINOR 0
>  
> -struct exynos_atomic_commit {
> - struct work_struct  work;
> - struct drm_device   *dev;
> - struct drm_atomic_state *state;
> - u32 crtcs;
> -};
> -
> -static void exynos_atomic_commit_complete(struct exynos_atomic_commit 
> *commit)
> -{
> - struct drm_device *dev = commit->dev;
> - struct exynos_drm_private *priv = dev->dev_private;
> - struct drm_atomic_state *state = commit->state;
> -
> - drm_atomic_helper_commit_modeset_disables(dev, state);
> -
> - drm_atomic_helper_commit_modeset_enables(dev, state);
> -
> - /*
> -  * Exynos can't update planes with CRTCs and encoders disabled,
> -  * its updates routines, specially for FIMD, requires the clocks
> -  * to be enabled. So it is necessary to handle the modeset operations
> -  * *before* the commit_planes() step, this way it will always
> -  * have the relevant clocks enabled to perform the update.
> -  */

Please move this comment to the commit_tail function instead of deleting
it.

> -
> - drm_atomic_helper_commit_planes(dev, state, 0);
> -
> - drm_atomic_helper_wait_for_vblanks(dev, state);
> -
> - drm_atomic_helper_cleanup_planes(dev, state);
> -
> - drm_atomic_state_put(state);
> -
> - spin_lock(&priv->lock);
> - priv->pending &= ~commit->crtcs;
> - spin_unlock(&priv->lock);
> -
> - wake_up_all(&priv->wait);
> -
> - kfree(commit);
> -}
> -
> -static void exynos_drm_atomic_work(struct work_struct *work)
> -{
> - struct exynos_atomic_commit *commit = container_of(work,
> - struct exynos_atomic_commit, work);
> -
> - exynos_atomic_commit_complete(commit);
> -}
> -
>  static struct device *exynos_drm_get_dma_device(void);
>  
>  static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> @@ -202,65 +152,6 @@ static void exynos_drm_unload(struct drm_device *dev)
>   dev->dev_private = NULL;
>  }
>  
> -static int commit_is_pending(struct exynos_drm_private *priv, u32 crtcs)
> -{
> - bool pending;
> -
> - spin_lock(&priv->lock);
> - pending = priv->pending & crtcs;
> - spin_unlock(&priv->lock);
> -
> - return pending;
> -}
> -
> -int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state 
> *state,
> -  bool nonblock)
> -{
> - struct exynos_drm_private *priv = dev->dev_private;
> - struct exynos_atomic_commit *commit;
> - struct drm_crtc *crtc;
> - struct drm_crtc_state *crtc_state;
> - int i, ret;
> -
> - commit = kzalloc(sizeof(*commit), GFP_KERNEL);
> - if (!commit)
> - return -ENOMEM;
> -
> - ret = drm_atomic_helper_prepare_planes(dev, state);
> - if (ret) {
> - kfree(commit);
> - return ret;
> - }
> -
> - /* This is the point of no return */
> -
> - INIT_WORK(&commit->

Re: [PATCH] drm: Clean up the 1366x768 fixup codes

2017-01-16 Thread Gustavo Padovan
Hi Takashi,

2017-01-16 Takashi Iwai :

> This is just a cleanup, no functional change.
> 
> The fixup code for 1366x768 in drm_mode_create_from_cmdline_mode() is
> basically a copy of the existing code in drm_edid.c.  Make the latter
> code public so that it can be called from the former function.
> 
> Signed-off-by: Takashi Iwai 
> ---
>  drivers/gpu/drm/drm_crtc_internal.h | 3 +++
>  drivers/gpu/drm/drm_edid.c  | 6 +++---
>  drivers/gpu/drm/drm_modes.c | 9 ++---
>  3 files changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
> b/drivers/gpu/drm/drm_crtc_internal.h
> index cdf6860c9d22..01bde7103ad6 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -199,3 +199,6 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
>  void *data, struct drm_file *file_priv);
>  int drm_mode_page_flip_ioctl(struct drm_device *dev,
>void *data, struct drm_file *file_priv);
> +
> +/* drm_edid.c */
> +void drm_mode_fixup_1366x768(struct drm_display_mode *mode);
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 336be31ff3de..739a19cb27d9 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2152,7 +2152,7 @@ drm_dmt_modes_for_range(struct drm_connector 
> *connector, struct edid *edid,
>  /* fix up 1366x768 mode from 1368x768;
>   * GFT/CVT can't express 1366 width which isn't dividable by 8
>   */
> -static void fixup_mode_1366x768(struct drm_display_mode *mode)
> +void drm_mode_fixup_1366x768(struct drm_display_mode *mode)
>  {
>   if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
>   mode->hdisplay = 1366;
> @@ -2176,7 +2176,7 @@ drm_gtf_modes_for_range(struct drm_connector 
> *connector, struct edid *edid,
>   if (!newmode)
>   return modes;
>  
> - fixup_mode_1366x768(newmode);
> + drm_mode_fixup_1366x768(newmode);
>   if (!mode_in_range(newmode, edid, timing) ||
>   !valid_inferred_mode(connector, newmode)) {
>   drm_mode_destroy(dev, newmode);
> @@ -2205,7 +2205,7 @@ drm_cvt_modes_for_range(struct drm_connector 
> *connector, struct edid *edid,
>   if (!newmode)
>   return modes;
>  
> - fixup_mode_1366x768(newmode);
> + drm_mode_fixup_1366x768(newmode);
>   if (!mode_in_range(newmode, edid, timing) ||
>   !valid_inferred_mode(connector, newmode)) {
>   drm_mode_destroy(dev, newmode);
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index e6b19bc9021a..860f4d1ffbde 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1461,13 +1461,8 @@ drm_mode_create_from_cmdline_mode(struct drm_device 
> *dev,
>  
>   mode->type |= DRM_MODE_TYPE_USERDEF;
>   /* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> - if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> - mode->hdisplay = 1366;
> - mode->hsync_start--;
> - mode->hsync_end--;
> - drm_mode_set_name(mode);
> - }
> - drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);

At a glance removing the call to drm_mode_set_crtcinfo() seems a
functional change to me. I'm not sure why you removed it.

Gustavo

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


Re: [PATCH 2/5 v3] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event()

2017-01-16 Thread John Stultz
On Mon, Jan 16, 2017 at 7:56 AM, Laurent Pinchart
 wrote:
> On Monday 16 Jan 2017 17:47:46 Laurent Pinchart wrote:
>> Hi John,
>>
>> Thank you for the patch.
>>
>> On Tuesday 03 Jan 2017 11:41:39 John Stultz wrote:
>> > In chasing down a previous issue with EDID probing from calling
>> > drm_helper_hpd_irq_event() from irq context, Laurent noticed
>> > that the DRM documentation suggests that
>> > drm_kms_helper_hotplug_event() should be used instead.
>> >
>> > Thus this patch replaces drm_helper_hpd_irq_event() with
>> > drm_kms_helper_hotplug_event(), which requires we update the
>> > connector.status entry and only call _hotplug_event() when the
>> > status changes.
>> >
>> > Cc: David Airlie 
>> > Cc: Archit Taneja 
>> > Cc: Wolfram Sang 
>> > Cc: Lars-Peter Clausen 
>> > Cc: Laurent Pinchart 
>> > Cc: dri-devel@lists.freedesktop.org
>> > Signed-off-by: John Stultz 
>> > ---
>> > v3: Update connector.status value and only call __hotplug_event()
>> >
>> > when that status changes, as suggested by Laurent.
>> >
>> >  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 16 +++-
>> >  1 file changed, 15 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
>> > b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 4fcea44..d93d66f
>> > 100644
>> > --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
>> > +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
>> > @@ -405,8 +405,22 @@ static bool adv7511_hpd(struct adv7511 *adv7511)
>> >
>> >  static void adv7511_hpd_work(struct work_struct *work)
>> >  {
>> >
>> > struct adv7511 *adv7511 = container_of(work, struct adv7511,
>>
>> hpd_work);
>>
>> > +   enum drm_connector_status status;
>> > +   unsigned int val;
>> > +   int ret;
>> > +
>> > +   ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
>> > +   if (ret < 0)
>> > +   status = connector_status_disconnected;
>> > +   else if (val & ADV7511_STATUS_HPD)
>> > +   status = connector_status_connected;
>> > +   else
>> > +   status = connector_status_disconnected;
>> > +
>> > +   if (adv7511->connector.status != status)
>> > +   drm_kms_helper_hotplug_event(adv7511->connector.dev);
>> >
>> > -   drm_helper_hpd_irq_event(adv7511->connector.dev);
>> > +   adv7511->connector.status = status;
>>
>> Shouldn't you update the status before calling
>> drm_kms_helper_hotplug_event() ? Doing it after not only creates a small
>> race condition as
>> drm_kms_helper_hotplug_event() sends an event to userspace that could result
>> in an ioctl call to retrieve the status, but the status is also checked by
>> drm_setup_crtcs() called by drm_fb_helper_hotplug_event().
>
> With
>
> if (adv7511->connector.status != status) {
> adv7511->connector.status = status;
> drm_kms_helper_hotplug_event(adv7511->connector.dev);
> }
>
> Reviewed-by: Laurent Pinchart 
> Tested-by: Laurent Pinchart 

Thanks so much for catching this! I'll respin the patches with this
fix and resend a v4.

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


Re: [PATCH] drm: Clean up the 1366x768 fixup codes

2017-01-16 Thread Takashi Iwai
On Mon, 16 Jan 2017 20:16:04 +0100,
Gustavo Padovan wrote:
> 
> Hi Takashi,
> 
> 2017-01-16 Takashi Iwai :
> 
> > This is just a cleanup, no functional change.
> > 
> > The fixup code for 1366x768 in drm_mode_create_from_cmdline_mode() is
> > basically a copy of the existing code in drm_edid.c.  Make the latter
> > code public so that it can be called from the former function.
> > 
> > Signed-off-by: Takashi Iwai 
> > ---
> >  drivers/gpu/drm/drm_crtc_internal.h | 3 +++
> >  drivers/gpu/drm/drm_edid.c  | 6 +++---
> >  drivers/gpu/drm/drm_modes.c | 9 ++---
> >  3 files changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
> > b/drivers/gpu/drm/drm_crtc_internal.h
> > index cdf6860c9d22..01bde7103ad6 100644
> > --- a/drivers/gpu/drm/drm_crtc_internal.h
> > +++ b/drivers/gpu/drm/drm_crtc_internal.h
> > @@ -199,3 +199,6 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
> >void *data, struct drm_file *file_priv);
> >  int drm_mode_page_flip_ioctl(struct drm_device *dev,
> >  void *data, struct drm_file *file_priv);
> > +
> > +/* drm_edid.c */
> > +void drm_mode_fixup_1366x768(struct drm_display_mode *mode);
> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> > index 336be31ff3de..739a19cb27d9 100644
> > --- a/drivers/gpu/drm/drm_edid.c
> > +++ b/drivers/gpu/drm/drm_edid.c
> > @@ -2152,7 +2152,7 @@ drm_dmt_modes_for_range(struct drm_connector 
> > *connector, struct edid *edid,
> >  /* fix up 1366x768 mode from 1368x768;
> >   * GFT/CVT can't express 1366 width which isn't dividable by 8
> >   */
> > -static void fixup_mode_1366x768(struct drm_display_mode *mode)
> > +void drm_mode_fixup_1366x768(struct drm_display_mode *mode)
> >  {
> > if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
> > mode->hdisplay = 1366;
> > @@ -2176,7 +2176,7 @@ drm_gtf_modes_for_range(struct drm_connector 
> > *connector, struct edid *edid,
> > if (!newmode)
> > return modes;
> >  
> > -   fixup_mode_1366x768(newmode);
> > +   drm_mode_fixup_1366x768(newmode);
> > if (!mode_in_range(newmode, edid, timing) ||
> > !valid_inferred_mode(connector, newmode)) {
> > drm_mode_destroy(dev, newmode);
> > @@ -2205,7 +2205,7 @@ drm_cvt_modes_for_range(struct drm_connector 
> > *connector, struct edid *edid,
> > if (!newmode)
> > return modes;
> >  
> > -   fixup_mode_1366x768(newmode);
> > +   drm_mode_fixup_1366x768(newmode);
> > if (!mode_in_range(newmode, edid, timing) ||
> > !valid_inferred_mode(connector, newmode)) {
> > drm_mode_destroy(dev, newmode);
> > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > index e6b19bc9021a..860f4d1ffbde 100644
> > --- a/drivers/gpu/drm/drm_modes.c
> > +++ b/drivers/gpu/drm/drm_modes.c
> > @@ -1461,13 +1461,8 @@ drm_mode_create_from_cmdline_mode(struct drm_device 
> > *dev,
> >  
> > mode->type |= DRM_MODE_TYPE_USERDEF;
> > /* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
> > -   if (cmd->xres == 1366 && mode->hdisplay == 1368) {
> > -   mode->hdisplay = 1366;
> > -   mode->hsync_start--;
> > -   mode->hsync_end--;
> > -   drm_mode_set_name(mode);
> > -   }
> > -   drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
> 
> At a glance removing the call to drm_mode_set_crtcinfo() seems a
> functional change to me. I'm not sure why you removed it.

Oops, of course it's wrong.  It shouldn't have been deleted.
Will resubmit the proper patch.

Thanks for catching!


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


[PATCH] drm/armada: Include current dir on CFLAGS for armada trace

2017-01-16 Thread Gustavo Padovan
From: Gustavo Padovan 

Otherwise compilation fails like this:

In file included from drivers/gpu/drm/armada/armada_trace.h:66:0,
 from drivers/gpu/drm/armada/armada_trace.c:3:
./include/trace/define_trace.h:88:43: fatal error: ./armada_trace.h: No such 
file or directory
compilation terminated.

Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/armada/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/armada/Makefile b/drivers/gpu/drm/armada/Makefile
index a18f156..64c0b45 100644
--- a/drivers/gpu/drm/armada/Makefile
+++ b/drivers/gpu/drm/armada/Makefile
@@ -4,3 +4,5 @@ armada-y+= armada_510.o
 armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
 
 obj-$(CONFIG_DRM_ARMADA) := armada.o
+
+CFLAGS_armada_trace.o := -I$(src)
-- 
2.5.5

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


Re: [PATCH 5/5 v3] drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID

2017-01-16 Thread John Stultz
On Mon, Jan 16, 2017 at 8:03 AM, Laurent Pinchart
 wrote:
> Hi John,
>
> Thank you for the patch.
>
> On Tuesday 03 Jan 2017 11:41:42 John Stultz wrote:
>> I've found that by just turning the chip on and off via the
>> POWER_DOWN register, I end up getting i2c_transfer errors
>> on HiKey.
>>
>> Investigating further, it seems some of the register state
>> in the regmap cache is somehow getting lost. Using the logic
>> in __adv7511_power_on/off() which syncs and dirtys the cache
>> avoids this issue.
>>
>> Thus this patch changes the EDID probing logic so that we
>> re-use the __adv7511_power_on/off() calls.
>
> regcache_sync() is quite costly as it will write a bunch of registers.
> Wouldn't it be more efficient to only write the registers that are needed for
> EDID access ?

So yes, you've mentioned this concern before, and I did spend some
time to narrow which lost-register state (0x43
 - ADV7511_REG_EDID_I2C_ADDR) was causing the trouble with i2c
trasnfer errors I was seeing:
  https://lkml.org/lkml/2016/11/22/677

However, I didn't get much feedback on that, and it seems (to me at
least) concerning that we are losing the underlying state of a
register in the cache, so just syncing that one register back to the
hardware might solve the issue I was seeing, but I worry what other
registers might also be out of sync.

The comment above the regmap_sync in adv7511_power_on after all states:
   "Most of the registers are reset during power down or when HPD is low."

So it seems like if we're setting the power down (and setting HPD in
cases where Archit had a patch to add HPD pulsing to the
adv7511_get_modes path), it seems reasonable to do the same
regmap_sync()?

But, I'm not really picky here, and I'm very open to other approaches
(including something like the patch in the link above) if you have
suggestions/preferences. I just want it to work reliably on my
hardware. :)

And just so I can better understand it, can you explain some about the
impact of your efficiency concerns?

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


Re: [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state

2017-01-16 Thread Gustavo Padovan
Hi Andrey,

2017-01-16 Andrey Grodzovsky :

> Allows using atomic flip helpers for drivers
> using ASYNC flip.
> Remove ASYNC_FLIP restriction in helpers and
> caches the page flip flags in drm_plane_state
> to be used in the low level drivers.
> 
> Signed-off-by: Andrey Grodzovsky 
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 10 +++---
>  include/drm/drm_plane.h |  8 
>  2 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index a4e5477..f83dc43 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2737,7 +2737,8 @@ static int page_flip_common(
>   struct drm_atomic_state *state,
>   struct drm_crtc *crtc,
>   struct drm_framebuffer *fb,
> - struct drm_pending_vblank_event *event)
> + struct drm_pending_vblank_event *event,
> + uint32_t flags)

Did you build this patch? It is changing the signature of
page_flip_common() but no changes to the callers.

Gustavo

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


Re: [PATCH v1 1/7] dt-bindings: display: add STM32 LTDC driver

2017-01-16 Thread Laurent Pinchart
Hi Yannick,

Thank you for the patch.

On Monday 16 Jan 2017 14:28:58 Yannick Fertre wrote:
> Signed-off-by: Yannick Fertre 
> ---
>  .../devicetree/bindings/display/st,ltdc.txt| 57 ++
>  1 file changed, 57 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/display/st,ltdc.txt
> 
> diff --git a/Documentation/devicetree/bindings/display/st,ltdc.txt
> b/Documentation/devicetree/bindings/display/st,ltdc.txt new file mode
> 100644
> index 000..20e89da
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/st,ltdc.txt
> @@ -0,0 +1,57 @@
> +* STMicroelectronics STM32 lcd-tft display controller
> +
> +- st-display-subsystem: Master device for DRM sub-components
> +  This device must be the parent of all the sub-components and is
> responsible
> +  of bind them.

Why do you need this ? At a quick glance the ltdc node should be enough.

> +  Required properties:
> +  - compatible: "st,display-subsystem"
> +  - ranges: to allow probing of subdevices
> +
> +- ltdc_host: lcd-tft display controller host
> +  must be a sub-node of st-display-subsystem
> +  Required properties:
> +  - compatible: "st,ltdc"
> +  - reg: Physical base address of the IP registers and length of memory
> mapped region.
> +  - clocks: from common clock binding: handle hardware IP needed clocks,
> the
> +number of clocks may depend of the SoC type.
> +See ../clocks/clock-bindings.txt for details.
> +  - clock-names: names of the clocks listed in clocks property in the same
> +order.

You need to define the required/optional clocks with their names here. If they 
vary depending on the SoC, the DT bindings document need to list them for each 
SoC.

> +  - resets: resets to be used by the device
> +See ../reset/reset.txt for details.
> +  - reset-names: names of the resets listed in resets property in the same
> +order.
> +  Required nodes:
> +- Video port for RGB output.
> +
> +Example:
> +
> +/ {
> + ...
> + soc {
> + ...
> + st-display-subsystem {
> + compatible = "st,display-subsystem";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> + dma-ranges;
> +
> + ltdc_host: stm32-ltdc@40016800 {
> + compatible = "st,ltdc";
> + reg = <0x40016800 0x200>;
> + interrupts = <88>, <89>;
> + resets = <&rcc 314>;
> + clocks = <&rcc 1 8>;
> + clock-names = "clk-lcd";
> + status = "disabled";
> +
> + port {
> + ltdc_out_rgb: endpoint {
> + };
> + };
> + };
> + };
> + ...
> + };
> +};

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] drm/exynos: use atomic helper commit

2017-01-16 Thread Laurent Pinchart
Hi Inki,

Thank you for the patch.

On Monday 16 Jan 2017 18:13:22 Inki Dae wrote:
> This patch relpaces specific atomic commit function
> with atomic helper commit one, which also includes
> atomic_commit_tail callback for Exynos SoC becasue
> crtc devices on Exynos SoC uses power domain device
> so drm_atomic_helper_commit_planes should be called
> after drm_atomic_helper_commit_modeset_enables.

Please note that drm_atomic_helper_commit() is currently broken, its async 
commit support is subject to a race condition. Maarten's "[PATCH v3 0/7] 
drm/atomic: Add accessor macros for all atomic state" patch series is an 
attempt to fix that, I'll try to review it ASAP.

> Signed-off-by: Inki Dae 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c |   9 ++-
>  drivers/gpu/drm/exynos/exynos_drm_drv.c  | 110 +---
>  drivers/gpu/drm/exynos/exynos_drm_fb.c   |  25 ++-
>  3 files changed, 33 insertions(+), 111 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 2530bf5..47da612 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -39,6 +39,14 @@ static void exynos_drm_crtc_disable(struct drm_crtc
> *crtc)
> 
>   if (exynos_crtc->ops->disable)
>   exynos_crtc->ops->disable(exynos_crtc);
> +
> + if (crtc->state->event && !crtc->state->active) {
> + spin_lock_irq(&crtc->dev->event_lock);
> + drm_crtc_send_vblank_event(crtc, crtc->state->event);
> + spin_unlock_irq(&crtc->dev->event_lock);
> +
> + crtc->state->event = NULL;
> + }
>  }
> 
>  static void
> @@ -94,7 +102,6 @@ static void exynos_crtc_atomic_flush(struct drm_crtc
> *crtc, drm_crtc_send_vblank_event(crtc, event);
>   spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
>   }
> -
>  }
> 
>  static const struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = {
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 3ec0535..9d0df00 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -38,56 +38,6 @@
>  #define DRIVER_MAJOR 1
>  #define DRIVER_MINOR 0
> 
> -struct exynos_atomic_commit {
> - struct work_struct  work;
> - struct drm_device   *dev;
> - struct drm_atomic_state *state;
> - u32 crtcs;
> -};
> -
> -static void exynos_atomic_commit_complete(struct exynos_atomic_commit
> *commit) -{
> - struct drm_device *dev = commit->dev;
> - struct exynos_drm_private *priv = dev->dev_private;
> - struct drm_atomic_state *state = commit->state;
> -
> - drm_atomic_helper_commit_modeset_disables(dev, state);
> -
> - drm_atomic_helper_commit_modeset_enables(dev, state);
> -
> - /*
> -  * Exynos can't update planes with CRTCs and encoders disabled,
> -  * its updates routines, specially for FIMD, requires the clocks
> -  * to be enabled. So it is necessary to handle the modeset operations
> -  * *before* the commit_planes() step, this way it will always
> -  * have the relevant clocks enabled to perform the update.
> -  */
> -
> - drm_atomic_helper_commit_planes(dev, state, 0);
> -
> - drm_atomic_helper_wait_for_vblanks(dev, state);
> -
> - drm_atomic_helper_cleanup_planes(dev, state);
> -
> - drm_atomic_state_put(state);
> -
> - spin_lock(&priv->lock);
> - priv->pending &= ~commit->crtcs;
> - spin_unlock(&priv->lock);
> -
> - wake_up_all(&priv->wait);
> -
> - kfree(commit);
> -}
> -
> -static void exynos_drm_atomic_work(struct work_struct *work)
> -{
> - struct exynos_atomic_commit *commit = container_of(work,
> - struct exynos_atomic_commit, work);
> -
> - exynos_atomic_commit_complete(commit);
> -}
> -
>  static struct device *exynos_drm_get_dma_device(void);
> 
>  static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
> @@ -202,65 +152,6 @@ static void exynos_drm_unload(struct drm_device *dev)
>   dev->dev_private = NULL;
>  }
> 
> -static int commit_is_pending(struct exynos_drm_private *priv, u32 crtcs)
> -{
> - bool pending;
> -
> - spin_lock(&priv->lock);
> - pending = priv->pending & crtcs;
> - spin_unlock(&priv->lock);
> -
> - return pending;
> -}
> -
> -int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state
> *state, -  bool nonblock)
> -{
> - struct exynos_drm_private *priv = dev->dev_private;
> - struct exynos_atomic_commit *commit;
> - struct drm_crtc *crtc;
> - struct drm_crtc_state *crtc_state;
> - int i, ret;
> -
> - commit = kzalloc(sizeof(*commit), GFP_KERNEL);
> - if (!commit)
> - return -ENOMEM;
> -
> - ret = drm_atomic_helper_prepare_planes(dev, state);
> - if (ret) {
> - kfree(commit);
> - return r

Re: [PATCH] drm/armada: Include current dir on CFLAGS for armada trace

2017-01-16 Thread Laurent Pinchart
Hi Gustavo,

Thank you for the patch.

On Monday 16 Jan 2017 18:13:30 Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Otherwise compilation fails like this:
> 
> In file included from drivers/gpu/drm/armada/armada_trace.h:66:0,
>  from drivers/gpu/drm/armada/armada_trace.c:3:
> ./include/trace/define_trace.h:88:43: fatal error: ./armada_trace.h: No such
> file or directory compilation terminated.
> 
> Signed-off-by: Gustavo Padovan 

How about a Fixes: line ?

> ---
>  drivers/gpu/drm/armada/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/armada/Makefile
> b/drivers/gpu/drm/armada/Makefile index a18f156..64c0b45 100644
> --- a/drivers/gpu/drm/armada/Makefile
> +++ b/drivers/gpu/drm/armada/Makefile
> @@ -4,3 +4,5 @@ armada-y  += armada_510.o
>  armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
> 
>  obj-$(CONFIG_DRM_ARMADA) := armada.o
> +
> +CFLAGS_armada_trace.o := -I$(src)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 0/4] Allow ASYNC flip with atomic helpers.

2017-01-16 Thread Laurent Pinchart
Hi Andrey,

Thank you for the patches.

On Monday 16 Jan 2017 10:44:54 Andrey Grodzovsky wrote:
> This series is a folow-up on
> https://patchwork.kernel.org/patch/9501787/
> 
> The first patch makes changes to atomic helpers
> to allow for drives with ASYNC flip support to use them.
> Patches 2 and 3 are to use this in AMDGPU/DC and
> patch 4 is possible cleanup in nouveau/kms who seems
> to have the duplicate the helper as we did to support
> ASYNC flips.

I have my doubts regarding this. I'd much rather see userspace moving to the 
atomic API instead of extending support for legacy APIs.

> Andrey Grodzovsky (4):
>   drm/atomic: Save flip flags in drm_plane_state
>   drm/amdgpu: Remove flip_flag from amdgpu_crtc
>   drm/amd/display: Switch to using atomic_helper for flip.
>   drm/nouveau/kms/nv50: Switch to using atomic helper for flip.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h   |  1 -
>  .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ---
>  drivers/gpu/drm/drm_atomic_helper.c| 10 +--
>  drivers/gpu/drm/nouveau/nv50_display.c | 77 ++
>  include/drm/drm_plane.h|  8 ++
>  5 files changed, 22 insertions(+), 166 deletions(-)

-- 
Regards,

Laurent Pinchart

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


RE: [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state

2017-01-16 Thread Grodzovsky, Andrey


> -Original Message-
> From: Gustavo Padovan [mailto:gust...@padovan.org]
> Sent: Monday, January 16, 2017 3:22 PM
> To: Grodzovsky, Andrey
> Cc: dri-devel@lists.freedesktop.org; nouv...@lists.freedesktop.org; amd-
> g...@lists.freedesktop.org; Deucher, Alexander; daniel.vet...@intel.com
> Subject: Re: [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
> 
> Hi Andrey,
> 
> 2017-01-16 Andrey Grodzovsky :
> 
> > Allows using atomic flip helpers for drivers using ASYNC flip.
> > Remove ASYNC_FLIP restriction in helpers and caches the page flip
> > flags in drm_plane_state to be used in the low level drivers.
> >
> > Signed-off-by: Andrey Grodzovsky 
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 10 +++---
> >  include/drm/drm_plane.h |  8 
> >  2 files changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > b/drivers/gpu/drm/drm_atomic_helper.c
> > index a4e5477..f83dc43 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2737,7 +2737,8 @@ static int page_flip_common(
> > struct drm_atomic_state *state,
> > struct drm_crtc *crtc,
> > struct drm_framebuffer *fb,
> > -   struct drm_pending_vblank_event *event)
> > +   struct drm_pending_vblank_event *event,
> > +   uint32_t flags)
> 
> Did you build this patch? It is changing the signature of
> page_flip_common() but no changes to the callers.
> 
> Gustavo

Thanks for spotting this, I am afraid I've sent not the final version of the 
patch. 
I will resend the latest version later today.

Thanks
Andrey

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


[Bug 99275] Kernel 4.9: amdgpu regression; gui flickers; amd radeon rx 460

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99275

--- Comment #10 from Reimar Imhof  ---
I've just tried kernel 4.9.4
from download.opensuse.org/repositories/Kernel:/stable/standard/
Same bug.

Do you have any news?

-- 
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/armada: Include current dir on CFLAGS for armada trace

2017-01-16 Thread Gustavo Padovan
2017-01-16 Laurent Pinchart :

> Hi Gustavo,
> 
> Thank you for the patch.
> 
> On Monday 16 Jan 2017 18:13:30 Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Otherwise compilation fails like this:
> > 
> > In file included from drivers/gpu/drm/armada/armada_trace.h:66:0,
> >  from drivers/gpu/drm/armada/armada_trace.c:3:
> > ./include/trace/define_trace.h:88:43: fatal error: ./armada_trace.h: No such
> > file or directory compilation terminated.
> > 
> > Signed-off-by: Gustavo Padovan 
> 
> How about a Fixes: line ?

Fixes: c8a220c686a5 ("drm/armada: add tracing support")

Gustavo

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


Re: [PATCH 2/3] drm: qxl: Open code probing sequence for qxl

2017-01-16 Thread Gustavo Padovan
Hi Gabriel,

2017-01-12 Gabriel Krisman Bertazi :

> This avoids using the deprecated drm_get_pci_dev() and load() hook
> interfaces in the qxl driver.
> 
> The only tricky part is to ensure TTM debugfs initialization
> happens after the debugfs root node is created, which is done by moving
> that code into the debufs_init() hook.  Since the hook is called 3 times
> for each minor function, we make sure it is only executed for the
> primary minor.
> 
> Tested on qemu with igt and running a WM on top of X.
> 
> Signed-off-by: Gabriel Krisman Bertazi 
> CC: Dave Airlie 
> CC: Daniel Vetter 
> CC: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/qxl/qxl_debugfs.c | 12 
>  drivers/gpu/drm/qxl/qxl_drv.c | 58 
> +--
>  drivers/gpu/drm/qxl/qxl_drv.h |  7 -
>  drivers/gpu/drm/qxl/qxl_kms.c | 40 ++-
>  drivers/gpu/drm/qxl/qxl_ttm.c |  8 +-
>  5 files changed, 77 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c 
> b/drivers/gpu/drm/qxl/qxl_debugfs.c
> index 241af9131dc8..417b538b3ed8 100644
> --- a/drivers/gpu/drm/qxl/qxl_debugfs.c
> +++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
> @@ -84,8 +84,20 @@ int
>  qxl_debugfs_init(struct drm_minor *minor)
>  {
>  #if defined(CONFIG_DEBUG_FS)
> + int r;
> + struct qxl_device *dev =
> + (struct qxl_device *) minor->dev->dev_private;
> +
>   drm_debugfs_create_files(qxl_debugfs_list, QXL_DEBUGFS_ENTRIES,
>minor->debugfs_root, minor);
> +
> + if (minor->type == DRM_MINOR_PRIMARY) {

I'm not confortable with exposing minor->type here and making qxl
the first driver to use it outside of drm core. Don't we have any other
way. 

I see that inside qxl_debugfs_add_files() we have a check for already
registered files. Wouldn't that or some modification around work for
this?

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


Re: [PATCH 0/4] Allow ASYNC flip with atomic helpers.

2017-01-16 Thread Harry Wentland

On 2017-01-16 03:39 PM, Laurent Pinchart wrote:

Hi Andrey,

Thank you for the patches.

On Monday 16 Jan 2017 10:44:54 Andrey Grodzovsky wrote:

This series is a folow-up on
https://patchwork.kernel.org/patch/9501787/

The first patch makes changes to atomic helpers
to allow for drives with ASYNC flip support to use them.
Patches 2 and 3 are to use this in AMDGPU/DC and
patch 4 is possible cleanup in nouveau/kms who seems
to have the duplicate the helper as we did to support
ASYNC flips.


I have my doubts regarding this. I'd much rather see userspace moving to the
atomic API instead of extending support for legacy APIs.



This change is not about introducing the async flag but cleaning up the 
legacy helpers to make sure drivers that currently use it through the 
legacy IOCTLs can benefit from the helpers and not have to roll their own.


If the problem is with the pflip_flags, wouldn't drivers still need that 
after moving userspace to the atomic IOCTL?


I don't disagree with you on having userspace move to atomic but I don't 
expect to see all userspace drivers move to atomic in the next couple 
months. Why not clean this up in the meantime?


Harry


Andrey Grodzovsky (4):
  drm/atomic: Save flip flags in drm_plane_state
  drm/amdgpu: Remove flip_flag from amdgpu_crtc
  drm/amd/display: Switch to using atomic_helper for flip.
  drm/nouveau/kms/nv50: Switch to using atomic helper for flip.

 drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h   |  1 -
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ---
 drivers/gpu/drm/drm_atomic_helper.c| 10 +--
 drivers/gpu/drm/nouveau/nv50_display.c | 77 ++
 include/drm/drm_plane.h|  8 ++
 5 files changed, 22 insertions(+), 166 deletions(-)



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


Re: [PATCH -next] drm/hisilicon/hibmc: Fix wrong pointer passed to PTR_ERR()

2017-01-16 Thread Gustavo Padovan
Hi Wei,

2017-01-12 Wei Yongjun :

> From: Wei Yongjun 
> 
> PTR_ERR should access the value just tested by IS_ERR, otherwise
> the wrong error code will be returned.
> 
> Fixes: d1667b86795a ("drm/hisilicon/hibmc: Add support for frame buffer")
> Signed-off-by: Wei Yongjun 

Reviewed-by: Gustavo Padovan 

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


[Bug 96488] [r600g]OpenCL driver causes segfault in ImageMagick's Histogram kernel

2017-01-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=96488

--- Comment #10 from Jan Vesely  ---
(In reply to nixscripter from comment #9)
> I have downloaded LLVM r290690 which contains your first diff, manually
> applied your 2nd diff, and compiled it. The resulting library seems to
> resolve the issue.
> 
> Once that patch is reviewed and applied to the mainline, I will do one final
> verification and (hopefully) close this bug.
> 
> Thanks for all your efforts on this!

I have just landed the patch. Note that if the kernel uses sub-int(short,char)
vectors. it will generate incorrect code until D27964 (or alternative) is
merged.

Jan

-- 
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 -next] drm/atomic: make release_crtc_commit() static

2017-01-16 Thread Gustavo Padovan
Hi Wei,

2017-01-12 Wei Yongjun :

> From: Wei Yongjun 
> 
> Fixes the following sparse warning:
> 
> drivers/gpu/drm/drm_atomic_helper.c:1360:6: warning:
>  symbol 'release_crtc_commit' was not declared. Should it be static?
> 
> Signed-off-by: Wei Yongjun 
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Gustavo Padovan 

Gustavo

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


Re: [PATCH] drm/armada: Include current dir on CFLAGS for armada trace

2017-01-16 Thread Laurent Pinchart
Hi Gustavo,

(CC'ing Steven)

On Monday 16 Jan 2017 19:12:58 Gustavo Padovan wrote:
> 2017-01-16 Laurent Pinchart :
> > On Monday 16 Jan 2017 18:13:30 Gustavo Padovan wrote:
> >> From: Gustavo Padovan 
> >> 
> >> Otherwise compilation fails like this:
> >> 
> >> In file included from drivers/gpu/drm/armada/armada_trace.h:66:0,
> >> 
> >>  from drivers/gpu/drm/armada/armada_trace.c:3:
> >> ./include/trace/define_trace.h:88:43: fatal error: ./armada_trace.h: No
> >> such file or directory compilation terminated.
> >> 
> >> Signed-off-by: Gustavo Padovan 
> > 
> > How about a Fixes: line ?
> 
> Fixes: c8a220c686a5 ("drm/armada: add tracing support")

Thank you.

The approach taken here seems to be shared by a fair number of drivers, so

Acked-by: Laurent Pinchart 

However, you could also set TRACE_INCLUDE_PATH to ../../drivers/gpu/drm/armada 
as done by drivers/dma-buf, drivers/ras and drivers/net/fjes. I'm not sure 
what's best, but if setting CFLAGS is preferred, I think we should get rid of 
TRACE_INCLUDE_PATH.

Steven, any opinion ? To avoid forcing you to dig the original e-mail up, the 
proposed fix is

> diff --git a/drivers/gpu/drm/armada/Makefile
> b/drivers/gpu/drm/armada/Makefile
> index a18f156..64c0b45 100644
> --- a/drivers/gpu/drm/armada/Makefile
> +++ b/drivers/gpu/drm/armada/Makefile
> @@ -4,3 +4,5 @@ armada-y+= armada_510.o
>  armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
>  
>  obj-$(CONFIG_DRM_ARMADA) := armada.o
> +
> +CFLAGS_armada_trace.o := -I$(src)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 0/4] Allow ASYNC flip with atomic helpers.

2017-01-16 Thread Laurent Pinchart
Hi Harry,

On Monday 16 Jan 2017 16:13:39 Harry Wentland wrote:
> On 2017-01-16 03:39 PM, Laurent Pinchart wrote:
> > On Monday 16 Jan 2017 10:44:54 Andrey Grodzovsky wrote:
> >> This series is a folow-up on
> >> https://patchwork.kernel.org/patch/9501787/
> >> 
> >> The first patch makes changes to atomic helpers
> >> to allow for drives with ASYNC flip support to use them.
> >> Patches 2 and 3 are to use this in AMDGPU/DC and
> >> patch 4 is possible cleanup in nouveau/kms who seems
> >> to have the duplicate the helper as we did to support
> >> ASYNC flips.
> > 
> > I have my doubts regarding this. I'd much rather see userspace moving to
> > the atomic API instead of extending support for legacy APIs.
> 
> This change is not about introducing the async flag but cleaning up the
> legacy helpers to make sure drivers that currently use it through the
> legacy IOCTLs can benefit from the helpers and not have to roll their own.
> 
> If the problem is with the pflip_flags, wouldn't drivers still need that
> after moving userspace to the atomic IOCTL?
> 
> I don't disagree with you on having userspace move to atomic but I don't
> expect to see all userspace drivers move to atomic in the next couple
> months. Why not clean this up in the meantime?

If this patch series was just about moving common driver code into the core, 
sure, but it goes beyond that. Or, actually, it needs to go beyond that, but 
doesn't yet. Removing the DRM_MODE_PAGE_FLIP_ASYNC test in patch 1/4 means 
that the DRM core will not reject async page flips anymore, for any driver 
that uses the helper. You thus need to either patch all drivers that use the 
helper to reject the flag, or implement the feature in the drivers (and 
preferably in the helpers then). The current version of this patch series will 
make all existing users of the helpers accept async page flips without 
actually implementing them.

> >> Andrey Grodzovsky (4):
> >>   drm/atomic: Save flip flags in drm_plane_state
> >>   drm/amdgpu: Remove flip_flag from amdgpu_crtc
> >>   drm/amd/display: Switch to using atomic_helper for flip.
> >>   drm/nouveau/kms/nv50: Switch to using atomic helper for flip.
> >>  
> >>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h   |  1 -
> >>  .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ---
> >>  drivers/gpu/drm/drm_atomic_helper.c| 10 +--
> >>  drivers/gpu/drm/nouveau/nv50_display.c | 77 ++-
> >>  include/drm/drm_plane.h|  8 ++
> >>  5 files changed, 22 insertions(+), 166 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 2/4] drm/amdgpu: Remove flip_flag from amdgpu_crtc

2017-01-16 Thread Laurent Pinchart
Hi Andrey,

Thank you for the patch.

On Monday 16 Jan 2017 10:44:56 Andrey Grodzovsky wrote:
> Follwing introduction of pflip_flags in drm_plane_state
> this is not needed anymore.
> 
> Signed-off-by: Andrey Grodzovsky 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 4c0a86e..3ff3c14 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -443,7 +443,6 @@ struct amdgpu_crtc {
>   enum amdgpu_interrupt_state vsync_timer_enabled;
> 
>   int otg_inst;
> - uint32_t flip_flags;

This breaks compilation of the amdgpu driver. You should squash this patch 
with 3/4.

>   /* After Set Mode target will be non-NULL */
>   struct dc_target *target;
>  };

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip.

2017-01-16 Thread Laurent Pinchart
Hi Andrey,

Thank you for the patch.

On Monday 16 Jan 2017 10:44:57 Andrey Grodzovsky wrote:
> Change-Id: Iad3e0b9b3546e4e4dc79be9233daf4fe4dba83e0
> Signed-off-by: Andrey Grodzovsky 
> ---
>  .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++
>  1 file changed, 6 insertions(+), 86 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c index
> a443b70..d4664bf 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
> @@ -1060,83 +1060,6 @@ static int dm_crtc_funcs_atomic_set_property(
>   return 0;
>  }
> 
> -
> -static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc,
> - struct drm_framebuffer *fb,
> - struct drm_pending_vblank_event *event,
> - uint32_t flags)
> -{
> - struct drm_plane *plane = crtc->primary;
> - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
> - struct drm_atomic_state *state;
> - struct drm_plane_state *plane_state;
> - struct drm_crtc_state *crtc_state;
> - int ret = 0;
> -
> - state = drm_atomic_state_alloc(plane->dev);
> - if (!state)
> - return -ENOMEM;
> -
> - ret = drm_crtc_vblank_get(crtc);

The DRM core's atomic page flip helper doesn't get/put vblank. Have you 
double-checked that removing them isn't a problem ?

> - if (ret)
> - return ret;
> -
> - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> -retry:
> - crtc_state = drm_atomic_get_crtc_state(state, crtc);
> - if (IS_ERR(crtc_state)) {
> - ret = PTR_ERR(crtc_state);
> - goto fail;
> - }
> - crtc_state->event = event;
> -
> - plane_state = drm_atomic_get_plane_state(state, plane);
> - if (IS_ERR(plane_state)) {
> - ret = PTR_ERR(plane_state);
> - goto fail;
> - }
> -
> - ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
> - if (ret != 0)
> - goto fail;
> - drm_atomic_set_fb_for_plane(plane_state, fb);
> -
> - /* Make sure we don't accidentally do a full modeset. */
> - state->allow_modeset = false;
> - if (!crtc_state->active) {
> - DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy 
flip\n",
> -  crtc->base.id);
> - ret = -EINVAL;
> - goto fail;
> - }
> - acrtc->flip_flags = flags;
> -
> - ret = drm_atomic_nonblocking_commit(state);
> -
> -fail:
> - if (ret == -EDEADLK)
> - goto backoff;
> -
> - if (ret)
> - drm_crtc_vblank_put(crtc);
> -
> - drm_atomic_state_put(state);
> -
> - return ret;
> -backoff:
> - drm_atomic_state_clear(state);
> - drm_atomic_legacy_backoff(state);
> -
> - /*
> -  * Someone might have exchanged the framebuffer while we dropped locks
> -  * in the backoff code. We need to fix up the fb refcount tracking the
> -  * core does for us.
> -  */
> - plane->old_fb = plane->fb;
> -
> - goto retry;
> -}
> -
>  /* Implemented only the options currently availible for the driver */
>  static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = {
>   .reset = drm_atomic_helper_crtc_reset,
> @@ -1145,7 +1068,7 @@ static int amdgpu_atomic_helper_page_flip(struct
> drm_crtc *crtc, .destroy = amdgpu_dm_crtc_destroy,
>   .gamma_set = amdgpu_dm_atomic_crtc_gamma_set,
>   .set_config = drm_atomic_helper_set_config,
> - .page_flip = amdgpu_atomic_helper_page_flip,
> + .page_flip_target = drm_atomic_helper_page_flip_target,
>   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>   .atomic_set_property = dm_crtc_funcs_atomic_set_property
> @@ -1679,7 +1602,7 @@ static bool page_flip_needed(
>   sizeof(old_state_tmp)) == 0 ? true:false;
>   if (new_state->crtc && page_flip_required == false) {
>   acrtc_new = to_amdgpu_crtc(new_state->crtc);
> - if (acrtc_new->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC)
> + if (new_state->pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC)
>   page_flip_required = true;
>   }
>   return page_flip_required;
> @@ -2760,7 +2683,6 @@ int amdgpu_dm_atomic_commit(
>   for_each_plane_in_state(state, plane, old_plane_state, i) {
>   struct drm_plane_state *plane_state = plane->state;
>   struct drm_crtc *crtc = plane_state->crtc;
> - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
>   struct drm_framebuffer *fb = plane_state->fb;
> 
>   if (!fb || !crtc || !crtc->state->planes_changed ||
> @@ -2771,10 +2693,9 @@ int amdgpu_dm_atomic_commit(
>   ret = amdgpu_crtc_page_flip_target(crt

Re: [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state

2017-01-16 Thread Laurent Pinchart
Hi Andrey,

Thank you for the patch.

On Monday 16 Jan 2017 10:44:55 Andrey Grodzovsky wrote:
> Allows using atomic flip helpers for drivers
> using ASYNC flip.
> Remove ASYNC_FLIP restriction in helpers and
> caches the page flip flags in drm_plane_state
> to be used in the low level drivers.
> 
> Signed-off-by: Andrey Grodzovsky 
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 10 +++---
>  include/drm/drm_plane.h |  8 
>  2 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c index a4e5477..f83dc43 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2737,7 +2737,8 @@ static int page_flip_common(
>   struct drm_atomic_state *state,
>   struct drm_crtc *crtc,
>   struct drm_framebuffer *fb,
> - struct drm_pending_vblank_event *event)
> + struct drm_pending_vblank_event *event,
> + uint32_t flags)
>  {
>   struct drm_plane *plane = crtc->primary;
>   struct drm_plane_state *plane_state;
> @@ -2754,6 +2755,7 @@ static int page_flip_common(
>   if (IS_ERR(plane_state))
>   return PTR_ERR(plane_state);
> 
> + plane_state->pflip_flags = flags;
> 
>   ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);
>   if (ret != 0)
> @@ -2800,9 +2802,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
> struct drm_atomic_state *state;
>   int ret = 0;
> 
> - if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
> - return -EINVAL;
> -

With this change all drivers using the helper will not reject that async flag, 
even if they don't implement support for async page flip. You need to either 
patch them all to reject the flag, or implement async page flip support for 
all of them (preferable in the helpers, and then remove the

 * Note that for now so called async page flips (i.e. updates which are not
 * synchronized to vblank) are not supported, since the atomic interfaces have
 * no provisions for this yet.

comment).

>   state = drm_atomic_state_alloc(plane->dev);
>   if (!state)
>   return -ENOMEM;
> @@ -2865,9 +2864,6 @@ int drm_atomic_helper_page_flip_target(
>   struct drm_crtc_state *crtc_state;
>   int ret = 0;
> 
> - if (flags & DRM_MODE_PAGE_FLIP_ASYNC)
> - return -EINVAL;
> -
>   state = drm_atomic_state_alloc(plane->dev);
>   if (!state)
>   return -ENOMEM;
> diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> index db3bbde..86d8ffc 100644
> --- a/include/drm/drm_plane.h
> +++ b/include/drm/drm_plane.h
> @@ -122,6 +122,14 @@ struct drm_plane_state {
>*/
>   bool visible;
> 
> +
> + /**
> +  * @pflip_flags:
> +  *
> +  * Flip related config options
> +  */
> + u32 pflip_flags;
> +
>   struct drm_atomic_state *state;
>  };

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] drm/fence: fix memory overwrite when setting out_fence fd

2017-01-16 Thread Gustavo Padovan
2017-01-13 Chad Versace :

> On Fri 13 Jan 2017, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Currently if the userspace declares a int variable to store the out_fence
> > fd and pass it to OUT_FENCE_PTR the kernel will overwrite the 32 bits
> > above the int variable on 64 bits systems.
> > 
> > Fix this by making the internal storage of out_fence in the kernel a s32
> > pointer.
> > 
> > Reported-by: Chad Versace 
> > Signed-off-by: Gustavo Padovan 
> > Cc: Daniel Vetter 
> > Cc: Rafael Antognolli 
> > Cc: Laurent Pinchart 
> > Cc: sta...@vger.kernel.org
> 
> Reviewed-and-Tested-by: Chad Versace 
> 
> I applied this to my kernel branch, updated kmscube, and the spinning cube 
> still looks good.
> For reference, here are the tags I tested with:
> 
> mesa: 
> http://git.kiwitree.net/cgit/~chadv/mesa/tag/?h=chadv/review/i965-exec-fence-v03
> libdrm: 
> http://git.kiwitree.net/cgit/~chadv/libdrm/tag/?h=chadv/review/intel-exec-fence-v01
> linux: 
> http://git.kiwitree.net/cgit/~chadv/linux/tag/?h=chadv/test/i915-exec-fence-v04
> kmscube: 
> http://git.kiwitree.net/cgit/~chadv/kmscube/tag/?h=chadv/test/fences-v03

I pushed this patch to drm-misc-fixes. Thank you all.

Gustavo

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


Re: [PATCH 5/5 v3] drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID

2017-01-16 Thread Laurent Pinchart
Hi John,

On Monday 16 Jan 2017 12:14:48 John Stultz wrote:
> On Mon, Jan 16, 2017 at 8:03 AM, Laurent Pinchart wrote:
> > On Tuesday 03 Jan 2017 11:41:42 John Stultz wrote:
> >> I've found that by just turning the chip on and off via the
> >> POWER_DOWN register, I end up getting i2c_transfer errors
> >> on HiKey.
> >> 
> >> Investigating further, it seems some of the register state
> >> in the regmap cache is somehow getting lost. Using the logic
> >> in __adv7511_power_on/off() which syncs and dirtys the cache
> >> avoids this issue.
> >> 
> >> Thus this patch changes the EDID probing logic so that we
> >> re-use the __adv7511_power_on/off() calls.
> > 
> > regcache_sync() is quite costly as it will write a bunch of registers.
> > Wouldn't it be more efficient to only write the registers that are needed
> > for EDID access ?
> 
> So yes, you've mentioned this concern before, and I did spend some
> time to narrow which lost-register state (0x43
>  - ADV7511_REG_EDID_I2C_ADDR) was causing the trouble with i2c
> trasnfer errors I was seeing:
>   https://lkml.org/lkml/2016/11/22/677
> 
> However, I didn't get much feedback on that, and it seems (to me at
> least) concerning that we are losing the underlying state of a
> register in the cache, so just syncing that one register back to the
> hardware might solve the issue I was seeing, but I worry what other
> registers might also be out of sync.
>
> The comment above the regmap_sync in adv7511_power_on after all states:
>"Most of the registers are reset during power down or when HPD is low."

You're right that most registers will be out of sync.

> So it seems like if we're setting the power down (and setting HPD in
> cases where Archit had a patch to add HPD pulsing to the
> adv7511_get_modes path), it seems reasonable to do the same
> regmap_sync()?

It would be if we had to keep the device powered up, but we're powering it 
down right after reading the EDID. I don't think there's a need to reconfigure 
it completely, only setting the registers needed to read the EDID should be 
enough.

> But, I'm not really picky here, and I'm very open to other approaches
> (including something like the patch in the link above) if you have
> suggestions/preferences. I just want it to work reliably on my
> hardware. :)
>
> And just so I can better understand it, can you explain some about the
> impact of your efficiency concerns?

I'm not too picky either :-) If we can't find a reliable way to read the EDID 
by just configuring the registers we need, we could go for a full 
reconfiguration. However, restoring the value of all cached registers will 
result in lots of I2C writes, which are time-consuming operations. EDID read 
would be sped up if we could avoid that.

-- 
Regards,

Laurent Pinchart

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


  1   2   >