[Bug 90439] [LLVM] Xonotic render green (bisected)

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90439

--- Comment #13 from smoki  ---
(In reply to Tom Stellard from comment #12)
> Can you try this branch:
> http://cgit.freedesktop.org/~tstellar/llvm/log/?h=vinterp-fix

 Works fine, apps render fine and no piglit regression.

 With that mainlined, this one and bug 89034 can be marked as fixed.

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


[Bug 90481] Radeon R9 270X gpu lockup in game spec ops: the line.

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90481

--- Comment #3 from Ivan Viktorov  ---
Issue presented with
mesa 10.6.0-0.devel.6.5a55f68.fc23
llvm 3.6.0-1.fc23

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


[PATCH v6 11/12] drm/exynos: atomic dpms support

2015-05-22 Thread Inki Dae
Hi,

On 2015년 05월 22일 05:02, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Run dpms operations through the atomic intefaces. This basically removes
> the .dpms() callback from econders and crtcs and use .disable() and
> .enable() to turn the crtc on and off.
> 
> v2: Address comments by Joonyoung:
>   - make hdmi code call ->disable() instead of ->dpms()
>   - do not use WARN_ON on crtc enable/disable
> 
> v3: - Fix build failure after the hdmi change in v2
> - Change dpms helper of ptn3460 bridge
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/bridge/ps8622.c |  2 +-
>  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
>  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 99 
> -
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
>  10 files changed, 71 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
> index b604326..d686235 100644
> --- a/drivers/gpu/drm/bridge/ps8622.c
> +++ b/drivers/gpu/drm/bridge/ps8622.c
> @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector 
> *connector)
>  }
>  
>  static const struct drm_connector_funcs ps8622_connector_funcs = {
> - .dpms = drm_helper_connector_dpms,
> + .dpms = drm_atomic_helper_connector_dpms,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = ps8622_detect,
>   .destroy = ps8622_connector_destroy,
> diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
> b/drivers/gpu/drm/bridge/ptn3460.c
> index 8ed3617..260bc9f 100644
> --- a/drivers/gpu/drm/bridge/ptn3460.c
> +++ b/drivers/gpu/drm/bridge/ptn3460.c
> @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
> drm_connector *connector)
>  }
>  
>  static struct drm_connector_funcs ptn3460_connector_funcs = {
> - .dpms = drm_helper_connector_dpms,
> + .dpms = drm_atomic_helper_connector_dpms,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = ptn3460_detect,
>   .destroy = ptn3460_connector_destroy,
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
> b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 195fe60..c9995b1 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
> drm_connector *connector)
>  }
>  
>  static struct drm_connector_funcs exynos_dp_connector_funcs = {
> - .dpms = drm_helper_connector_dpms,
> + .dpms = drm_atomic_helper_connector_dpms,
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = exynos_dp_detect,
>   .destroy = exynos_dp_connector_destroy,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 3251652..92a5595 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -22,51 +22,57 @@
>  #include "exynos_drm_encoder.h"
>  #include "exynos_drm_plane.h"
>  
> -static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
> +static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
>  {
>   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> + struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
>  
> - DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
> -
> - if (exynos_crtc->dpms == mode) {
> - DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
> + if (exynos_crtc->enabled)
>   return;
> - }
> -
> - if (mode > DRM_MODE_DPMS_ON) {
> - /* wait for the completion of page flip. */
> - if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
> - (exynos_crtc->event == NULL), HZ/20))
> - exynos_crtc->event = NULL;
> - drm_crtc_vblank_off(crtc);
> - }
>  
>   if (exynos_crtc->ops->dpms)
> - exynos_crtc->ops->dpms(exynos_crtc, mode);
> + exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
>  
> - exynos_crtc->dpms = mode;
> + exynos_crtc->enabled = true;
>  
> - if (mode == DRM_MODE_DPMS_ON)
> - drm_crtc_vblank_on(crtc);
> -}
> + drm_crtc_vblank_on(crtc);
>  
> -static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
> -{
> - /* drm framework doesn't check NULL. */
> + if (exynos_crtc->ops->win_commit)
> + exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
> +
> + if (exynos_crtc->ops->commit)
> + exynos_crtc->ops->commit(exynos_crtc);

crtc 

[Bug 90523] Easily reproducible GPU lockup (verde) with any mesa 10.5.x

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90523

Tom Stellard  changed:

   What|Removed |Added

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

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


[Bug 90217] Counter Strike Global Offensive: GPU fault after a while

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90217

--- Comment #4 from Christoph Haag  ---
Created attachment 115981
  --> https://bugs.freedesktop.org/attachment.cgi?id=115981=edit
Mass Effect 3 with nine

Hm, I tried Mass Effect 3 with nine and got a GPU hang too. Not sure if it's
the same. No further log right now, I'll first check whether it's always at the
same point (it happened in the intro at the exact moment the reaper shoots, so
I think there is something that actually triggers it)

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


[Bug 90523] Easily reproducible GPU lockup (verde) with any mesa 10.5.x

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90523

--- Comment #8 from acab at digitalfuture.it ---
Bisecting across llvm major releases was a total pain in the arse, but then
I've realized that the bug was fixed recently in the 3.6 branch so I've given
up.

If it helps, i can tell you that the bug was fixed here (mind you good and bad
are reversed):
$ git bisect good
b5344bfff41583c00026e321d6831d4e8790b309 is the first bad commit
commit b5344bfff41583c00026e321d6831d4e8790b309
Author: Tom Stellard 
Date:   Mon May 4 19:50:17 2015 +

Merging r236307:


r236307 | thomas.stellard | 2015-04-30 23:44:09 -0400 (Thu, 30 Apr 2015) |
4 lines

R600/SI: Add VCC as an implict def of SI_KILL

When SI_KILL has a register operand, its lowered form writes to vcc.



Feel free to close the bug.
Thanks.

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


[Bug 90439] [LLVM] Xonotic render green (bisected)

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90439

--- Comment #12 from Tom Stellard  ---
Can you try this branch:
http://cgit.freedesktop.org/~tstellar/llvm/log/?h=vinterp-fix

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


[PATCH 0/5] drm/exynos: rework layer blending setup

2015-05-22 Thread Joonyoung Shim
Hi Tobias,

On 05/22/2015 05:07 PM, Tobias Jakobi wrote:
> Hello Joonyoung,
> 
> On 2015-05-22 06:04, Joonyoung Shim wrote:
>> Hi Tobias,
>>
>> On 05/22/2015 05:44 AM, Tobias Jakobi wrote:
>>> Gentle reminder that I still haven't heard anything about the series by
>>> the Samsung guys ;)
>>>
>>
>> Sorry for late, i'm busy and i think whether it's possible any way for
>> this blending from exynos drm framework after atomic feature of exynos
>> merged.
> the code is largely independent of Gustavo's patches. It doesn't really make 
> a lot of difference if it's merged before or after atomic. In fact I've 
> already tested it with and without atomic.
> 
> If possible I would like this to be merged now, so that it can go into 4.2. I 
> also have the patches fixing the zpos issue waiting, which I'm planning to 
> base on Gustavo's next cleanup series. But for this both the atomic and the 
> layer work series need to get merged first.
> 

Sorry for not detailed review, i don't know what is Inki's opinion but i
feel they need to be improved more.

Please run ./scripts/checkpatch.pl before posting and could you use word
wrap? it's too long so difficult to read.

Thanks.


[PATCH 4/5] drm/exynos: mixer: do blending setup in mixer_cfg_layer()

2015-05-22 Thread Joonyoung Shim
On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
> This updates the blending setup when the layer configuration
> changes (triggered by mixer_win_{commit,disable}).
> 
> Extra care has to be taken for the layer that is currently
> being enabled/disabled.
> 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 23 +++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 3ab7a01..430d10c 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -177,6 +177,18 @@ static inline bool is_alpha_format(const struct 
> mixer_context* ctx, unsigned int
>   }
>  }
>  
> +static inline unsigned int layer_bitmask(const struct mixer_context* ctx)
> +{
> + unsigned int i, mask = 0;
> +
> + for (i = 0; i < MIXER_WIN_NR; ++i) {
> + if (ctx->planes[i].enabled)
> + mask |= (1 << i);
> + }
> +
> + return mask;
> +}
> +
>  static inline u32 vp_reg_read(struct mixer_resources *res, u32 reg_id)
>  {
>   return readl(res->vp_regs + reg_id);
> @@ -513,6 +525,7 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, 
> unsigned int height)
>  static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, 
> bool enable)
>  {
>   struct mixer_resources *res = >mixer_res;
> + unsigned int enable_state;
>   u32 val = enable ? ~0 : 0;
>  
>   switch (win) {
> @@ -530,6 +543,16 @@ static void mixer_cfg_layer(struct mixer_context *ctx, 
> unsigned int win, bool en
>   }
>   break;
>   }
> +
> + /* Determine the current enabled/disabled state of the layers. */
> + enable_state = layer_bitmask(ctx);
> + if (enable)
> + enable_state |= (1 << win);
> + else
> + enable_state &= ~(1 << win);

I think way to remove to get enable_state of plane everytime, maybe
using atomic state information?

> +
> + /* Layer configuration has changed, update blending setup. */
> + mixer_layer_blending(ctx, enable_state);
>  }
>  
>  static void mixer_run(struct mixer_context *ctx)
> 



[PATCH 2/5] drm/exynos: mixer: introduce mixer_layer_blending()

2015-05-22 Thread Joonyoung Shim
On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
> This analyses the current layer configuration (which layers
> are enabled, which have alpha-pixelformat, etc.) and setups
> blending accordingly.
> 
> We currently disable all kinds of blending for the bottom-most
> layer, since configuration of the mixer background is not
> yet exposed.
> Also blending is only enabled when the layer has a pixelformat
> with alpha attached.
> 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 108 
> ++
>  drivers/gpu/drm/exynos/regs-mixer.h   |   1 +
>  2 files changed, 109 insertions(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index e4a5e76..5e95ef2 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -165,6 +165,18 @@ static const u8 filter_cr_horiz_tap4[] = {
>   70, 59, 48, 37, 27, 19, 11, 5,
>  };
>  
> +static inline bool is_alpha_format(const struct mixer_context* ctx, unsigned 
> int win)
> +{
> + switch (ctx->planes[win].pixel_format) {
> + case DRM_FORMAT_ARGB:
> + case DRM_FORMAT_ARGB1555:
> + case DRM_FORMAT_ARGB:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
>  static inline u32 vp_reg_read(struct mixer_resources *res, u32 reg_id)
>  {
>   return readl(res->vp_regs + reg_id);
> @@ -322,6 +334,102 @@ static void mixer_layer_priority(struct mixer_context 
> *ctx)
>   mixer_reg_write(>mixer_res, MXR_LAYER_CFG, val);
>  }
>  
> +/* Configure blending for bottom-most layer. */
> +static void mixer_bottom_layer(struct mixer_context *ctx,
> + const struct layer_config *cfg)
> +{
> + u32 val;
> + struct mixer_resources *res = >mixer_res;
> +
> + if (cfg->index == 2) {
> + val = 0; /* use defaults for video layer */
> + mixer_reg_write(res, MXR_VIDEO_CFG, val);
> + } else {
> + val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */
> +
> + /* Don't blend bottom-most layer onto the mixer background. */
> + mixer_reg_writemask(res, MXR_GRAPHIC_CFG(cfg->index),
> + val, MXR_GRP_CFG_MISC_MASK);
> + }
> +}
> +
> +static void mixer_general_layer(struct mixer_context *ctx,
> + const struct layer_config *cfg)
> +{
> + u32 val;
> + struct mixer_resources *res = >mixer_res;
> +
> + if (is_alpha_format(ctx, cfg->index)) {
> + val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */
> + val |= MXR_GRP_CFG_BLEND_PRE_MUL;
> + val |= MXR_GRP_CFG_PIXEL_BLEND_EN; /* blending based on pixel 
> alpha */
> +
> + /* The video layer never has an alpha pixelformat. */
> + mixer_reg_writemask(res, MXR_GRAPHIC_CFG(cfg->index),
> + val, MXR_GRP_CFG_MISC_MASK);
> + } else {
> + if (cfg->index == 2) {
> + /*
> +  * No blending at the moment since the NV12/NV21 
> pixelformats don't
> +  * have an alpha channel. However the mixer supports a 
> global alpha
> +  * value for a layer. Once this functionality is 
> exposed, we can
> +  * support blending of the video layer through this.
> +  */
> + val = 0;
> + mixer_reg_write(res, MXR_VIDEO_CFG, val);
> + } else {
> + val = MXR_GRP_CFG_COLOR_KEY_DISABLE;
> + mixer_reg_writemask(res, MXR_GRAPHIC_CFG(cfg->index),
> + val, MXR_GRP_CFG_MISC_MASK);
> + }
> + }
> +}
> +
> +static void mixer_layer_blending(struct mixer_context *ctx, unsigned int 
> enable_state)
> +{
> + const struct layer_config *cfg;
> + unsigned int i = 0;
> + unsigned int index;
> +
> + /* Find bottom-most enabled layer. */
> + cfg = NULL;
> + while (i < ctx->num_layer) {
> + index = ctx->layer_config[i].index;
> + ++i;

Don't use priority?

> +
> + if (enable_state & (1 << index)) {
> + cfg = >layer_config[i-1];
> + break;
> + }
> + }
> +
> + /* No enabled layers found, nothing to do. */
> + if (!cfg)
> + return;
> +
> + mixer_bottom_layer(ctx, cfg);
> +
> + while (1) {
> + /* Find the next layer. */
> + cfg = NULL;
> + while (i < ctx->num_layer) {
> + index = ctx->layer_config[i].index;
> + ++i;
> +
> + if (enable_state & (1 << index)) {
> + cfg = >layer_config[i-1];
> + break;
> + }
> + }
> +
> + /* No more enabled 

[PATCH 1/5] drm/exynos: mixer: refactor layer setup

2015-05-22 Thread Joonyoung Shim
On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
> First step in allowing a more generic way to setup complex
> blending for the different layers.
> 
> Signed-off-by: Tobias Jakobi 
> ---
>  drivers/gpu/drm/exynos/exynos_mixer.c | 90 
> ++-
>  1 file changed, 79 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
> b/drivers/gpu/drm/exynos/exynos_mixer.c
> index 4a1656b..e4a5e76 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -63,6 +63,11 @@ struct mixer_resources {
>   struct clk  *mout_mixer;
>  };
>  
> +struct layer_config {
> + unsigned int index;
> + unsigned int priority;

I think layer index and priority information can go to struct
exynos_drm_plane.

> +};
> +
>  enum mixer_version_id {
>   MXR_VER_0_0_0_16,
>   MXR_VER_16_0_33_0,
> @@ -75,6 +80,8 @@ struct mixer_context {
>   struct drm_device   *drm_dev;
>   struct exynos_drm_crtc  *crtc;
>   struct exynos_drm_plane planes[MIXER_WIN_NR];
> + const struct layer_config *layer_config;
> + unsigned int num_layer;
>   int pipe;
>   boolinterlace;
>   boolpowered;
> @@ -95,6 +102,40 @@ struct mixer_drv_data {
>   boolhas_sclk;
>  };
>  
> +/*
> + * The default layer priorities. A higher priority means that
> + * the layer is at the top of layer stack.
> + * The current configuration assumes the following usage scenario:
> + * layer1: OSD [top]
> + * layer0: main framebuffer
> + * video layer: video overlay [bottom]
> + * Note that the video layer is only usable when the
> + * video processor is available.
> + */
> +
> +static const struct layer_config default_layer_config[] = {
> + {
> + .index = 0, /* layer0 */
> + .priority = 1
> + }, {
> + .index = 1, /* layer1 */
> + .priority = 2
> + }
> +};
> +
> +static const struct layer_config vp_layer_config[] = {
> + {
> + .index = 2, /* video layer */
> + .priority = 1
> + }, {
> + .index = 0, /* layer0 */
> + .priority = 2
> + }, {
> + .index = 1, /* layer1 */
> + .priority = 3
> + }
> +};
> +

I feel there is no reason to split config, actually video layer exists
and video layer isn't enabled if no vp even if we use 3 layer.


[PATCH 1/5] drm/exynos: mixer: refactor layer setup

2015-05-22 Thread Tobias Jakobi
On 2015-05-22 11:12, Joonyoung Shim wrote:
> On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
>> First step in allowing a more generic way to setup complex
>> blending for the different layers.
>> 
>> Signed-off-by: Tobias Jakobi 
>> ---
>>  drivers/gpu/drm/exynos/exynos_mixer.c | 90 
>> ++-
>>  1 file changed, 79 insertions(+), 11 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
>> b/drivers/gpu/drm/exynos/exynos_mixer.c
>> index 4a1656b..e4a5e76 100644
>> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
>> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
>> @@ -63,6 +63,11 @@ struct mixer_resources {
>>  struct clk  *mout_mixer;
>>  };
>> 
>> +struct layer_config {
>> +unsigned int index;
>> +unsigned int priority;
> 
> I think layer index and priority information can go to struct
> exynos_drm_plane.
> 
>> +};
>> +
>>  enum mixer_version_id {
>>  MXR_VER_0_0_0_16,
>>  MXR_VER_16_0_33_0,
>> @@ -75,6 +80,8 @@ struct mixer_context {
>>  struct drm_device   *drm_dev;
>>  struct exynos_drm_crtc  *crtc;
>>  struct exynos_drm_plane planes[MIXER_WIN_NR];
>> +const struct layer_config *layer_config;
>> +unsigned int num_layer;
>>  int pipe;
>>  boolinterlace;
>>  boolpowered;
>> @@ -95,6 +102,40 @@ struct mixer_drv_data {
>>  boolhas_sclk;
>>  };
>> 
>> +/*
>> + * The default layer priorities. A higher priority means that
>> + * the layer is at the top of layer stack.
>> + * The current configuration assumes the following usage scenario:
>> + * layer1: OSD [top]
>> + * layer0: main framebuffer
>> + * video layer: video overlay [bottom]
>> + * Note that the video layer is only usable when the
>> + * video processor is available.
>> + */
>> +
>> +static const struct layer_config default_layer_config[] = {
>> +{
>> +.index = 0, /* layer0 */
>> +.priority = 1
>> +}, {
>> +.index = 1, /* layer1 */
>> +.priority = 2
>> +}
>> +};
>> +
>> +static const struct layer_config vp_layer_config[] = {
>> +{
>> +.index = 2, /* video layer */
>> +.priority = 1
>> +}, {
>> +.index = 0, /* layer0 */
>> +.priority = 2
>> +}, {
>> +.index = 1, /* layer1 */
>> +.priority = 3
>> +}
>> +};
>> +
> 
> I feel there is no reason to split config, actually video layer exists
> and video layer isn't enabled if no vp even if we use 3 layer.
Maybe I should add this here. Both default_layer_config and 
vp_layer_config function as default layer configurations. My plan is to 
expose custom configuration through a exynosdrm module parameter. The 
zpos property is immutable, so we can't modify it anymore after mixer 
probing (I understand that the immutabilility is a requirement of 
atomic). But we still can allow the user to supply his configuraton 
through the module parameter approach.


With best wishes,
Tobias



[git pull] drm fixes

2015-05-22 Thread Linus Torvalds
On Fri, May 22, 2015 at 4:20 PM, Dave Airlie  wrote:
>
> Really ^to^so

Ahh. That simple one-letter substitution makes all the difference, now
it's suddenly parseable.

Thanks,

  Linus


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Russell King - ARM Linux
On Fri, May 22, 2015 at 04:05:22PM +0200, Takashi Iwai wrote:
> At Fri, 22 May 2015 16:02:13 +0200,
> Takashi Iwai wrote:
> > OK, if so, then I rebase on top of -rc1.  The branch isn't merged yet,
> > so no big problem.
> 
> Now the rebased branch is pushed.
> 
> I also merged this branch now to for-next branch, so that it'll be
> tested through linux-next.

Thanks!

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


[PATCH 00/11] CRTC state mode property

2015-05-22 Thread Daniel Vetter
On Fri, May 22, 2015 at 01:34:43PM +0100, Daniel Stone wrote:
> Hi,
> Building on the blob-property submission series[0], this provides a
> MODE_ID property that can be used to set the current mode for a CRTC
> under atomic modesetting, plus a way for users to create blob
> properties so they can specify their own modes.
> 
> Using this[1] I've been able to validate the atomic userspace API with
> a ported version of Weston[2]. This is currently undergoing review, but
> seems pretty OK. Both modesetting for every output together, and
> per-output async pageflips with events, works as well as the driver
> does.
> 
> Also tested with fbcon and X11, on Broadwell.

A few nitpicks on some patches, all the others merged to topic/drm-misc.
-Daniel

> 
> Cheers,
> Daniel
> 
> [0]: <1429554176-9865-1-git-send-email-daniels at collabora.com>
> [1]: And a pile of other work in the i915 driver from Maarten/Ander, and
>  my own bits on top; see
>  git://git.collabora.co.uk/git/user/daniels/linux in the
>  wip/4.1.x/blob-modes-i915 branch.
> [2]: http://lists.freedesktop.org/archives/wayland-devel/2015-May/022106.html
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 11/11] drm: atomic: Add MODE_ID property

2015-05-22 Thread Daniel Vetter
On Fri, May 22, 2015 at 01:34:54PM +0100, Daniel Stone wrote:
> Atomic modesetting: now with modesetting support.
> 
> Signed-off-by: Daniel Stone 
> Tested-by: Sean Paul 
> ---
>  drivers/gpu/drm/drm_atomic.c | 12 +++-
>  drivers/gpu/drm/drm_crtc.c   |  7 +++
>  include/drm/drm_crtc.h   |  1 +
>  3 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 63fc58a..a4ab03a 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -415,10 +415,18 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>  {
>   struct drm_device *dev = crtc->dev;
>   struct drm_mode_config *config = >mode_config;
> + int ret;
>  
> - /* FIXME: Mode prop is missing, which also controls ->enable. */
>   if (property == config->prop_active)
>   state->active = val;
> + else if (property == config->prop_mode_id) {
> + struct drm_property_blob *mode =
> + drm_property_lookup_blob(dev, val);
> + ret = drm_atomic_set_mode_prop_for_crtc(state, mode);
> + if (mode)
> + drm_property_unreference_blob(mode);

Hm, maybe I need to revisit whether auto-clamping ->active is a good idea.
We need it for legacy helpers, but for atomic userspace this code means
depending upon whether active or mode_id is first in the prop list it will
get clamped or not, which isn't awesome.

Imo that's a good reason to remove the ->active clamping from
set_mode_pop_for_crtc. I guess we can keep it for set_mode_for_crtc since
that's only used internally and in legacy paths. Perhaps with a comment as
to why (and why not in set_mode_prop).

> + return ret;
> + }
>   else if (crtc->funcs->atomic_set_property)
>   return crtc->funcs->atomic_set_property(crtc, state, property, 
> val);
>   else
> @@ -443,6 +451,8 @@ int drm_atomic_crtc_get_property(struct drm_crtc *crtc,
>  
>   if (property == config->prop_active)
>   *val = state->active;
> + else if (property == config->prop_mode_id)
> + *val = (state->mode_blob) ? state->mode_blob->base.id : 0;
>   else if (crtc->funcs->atomic_get_property)
>   return crtc->funcs->atomic_get_property(crtc, state, property, 
> val);
>   else
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index ee87045..8f18412 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -688,6 +688,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, 
> struct drm_crtc *crtc,
>  
>   if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
>   drm_object_attach_property(>base, config->prop_active, 0);
> + drm_object_attach_property(>base, config->prop_mode_id, 
> 0);
>   }
>  
>   return 0;
> @@ -1454,6 +1455,12 @@ static int drm_mode_create_standard_properties(struct 
> drm_device *dev)
>   return -ENOMEM;
>   dev->mode_config.prop_active = prop;
>  
> + prop = drm_property_create_object(dev, DRM_MODE_PROP_ATOMIC,
> + "MODE_ID", DRM_MODE_OBJECT_BLOB);

Ah, here we go. Why not DRM_MODE_PROP_BLOB? Imo confusing to userspace
that some prop blobs are objects and some are old blob props.
-Daniel

> + if (!prop)
> + return -ENOMEM;
> + dev->mode_config.prop_mode_id = prop;
> +
>   return 0;
>  }
>  
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index c54fa4a..3b4d8a4 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -1146,6 +1146,7 @@ struct drm_mode_config {
>   struct drm_property *prop_fb_id;
>   struct drm_property *prop_crtc_id;
>   struct drm_property *prop_active;
> + struct drm_property *prop_mode_id;
>  
>   /* DVI-I properties */
>   struct drm_property *dvi_i_subconnector_property;
> -- 
> 2.4.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 10/11] drm/atomic: Add current-mode blob to CRTC state

2015-05-22 Thread Daniel Vetter
On Fri, May 22, 2015 at 01:34:53PM +0100, Daniel Stone wrote:
> Add a blob property tracking the current mode to the CRTC state, and
> ensure it is properly updated and referenced.
> 
> Signed-off-by: Daniel Stone 
> Tested-by: Sean Paul 
> ---
>  drivers/gpu/drm/drm_atomic.c| 62 
> +
>  drivers/gpu/drm/drm_atomic_helper.c | 11 ---
>  drivers/gpu/drm/drm_crtc.c  |  3 +-
>  include/drm/drm_crtc.h  |  3 ++
>  4 files changed, 73 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 67c251f..63fc58a 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -301,6 +301,8 @@ EXPORT_SYMBOL(drm_atomic_get_crtc_state);
>  int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
>struct drm_display_mode *mode)
>  {
> + struct drm_mode_modeinfo umode;
> +
>   /* Early return for no change. */
>   if (!mode && !state->enable)
>   return 0;
> @@ -308,9 +310,20 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state 
> *state,
>   memcmp(>mode, mode, sizeof(*mode)) == 0)
>   return 0;
>  
> + if (state->mode_blob)
> + drm_property_unreference_blob(state->mode_blob);
> + state->mode_blob = NULL;
>   state->mode_changed = true;
>  
>   if (mode) {
> + drm_mode_convert_to_umode(, mode);
> + state->mode_blob =
> + drm_property_create_blob(state->crtc->dev,
> +  sizeof(umode),
> +  );
> + if (!state->mode_blob)
> + return -ENOMEM;

IS_ERR and PTR_ERR? Dan Carpenter will catch this as soon as I'll apply
;-)

> +
>   drm_mode_copy(>mode, mode);
>   state->enable = true;
>   } else {
> @@ -330,6 +343,55 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state 
> *state,
>  }
>  EXPORT_SYMBOL(drm_atomic_set_mode_for_crtc);
>  
> +/**
> + * drm_atomic_set_mode_prop_for_crtc - set mode for CRTC
> + * @state: the CRTC whose incoming state to update
> + * @blob: pointer to blob property to use for mode
> + *
> + * Set a mode (originating from a blob property) on the desired CRTC state.
> + * This function will take a reference on the blob property for the CRTC 
> state,
> + * and release the reference held on the state's existing mode property, if 
> any
> + * was set.
> + */
> +int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
> +  struct drm_property_blob *blob)
> +{
> + if (blob == state->mode_blob)
> + return 0;
> +
> + if (state->mode_blob)
> + drm_property_unreference_blob(state->mode_blob);
> + state->mode_blob = NULL;
> +
> + if (blob) {
> + if (blob->length != sizeof(struct drm_mode_modeinfo) ||
> + drm_mode_convert_umode(>mode,
> +(const struct drm_mode_modeinfo *)
> + blob->data))
> + return -EINVAL;
> +
> + state->mode_blob = drm_property_reference_blob(blob);
> + state->mode_changed = true;
> + state->enable = true;
> + } else {
> + memset(>mode, 0, sizeof(state->mode));
> +
> + if (state->enable)
> + state->mode_changed = true;

Same comment as in the previous patch: mode_changed isnt' the core atomic
code's business.

> + state->enable = false;
> + state->active = false;
> + }
> +
> + if (state->enable)
> + DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
> +  state->mode.name, state);
> + else
> + DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
> +  state);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
>  
>  /**
>   * drm_atomic_crtc_set_property - set property on CRTC
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index 70ce243..5d596d9 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2027,6 +2027,8 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
>   */
>  void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc)
>  {
> + if (crtc->state && crtc->state->mode_blob)
> + drm_property_unreference_blob(crtc->state->mode_blob);
>   kfree(crtc->state);
>   crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL);
>  
> @@ -2048,6 +2050,8 @@ void __drm_atomic_helper_crtc_duplicate_state(struct 
> drm_crtc *crtc,
>  {
>   memcpy(state, crtc->state, sizeof(*state));
>  
> + if (state->mode_blob)
> + drm_property_reference_blob(state->mode_blob);
>   

[PATCH 09/11] drm: Add drm_atomic_set_mode_for_crtc

2015-05-22 Thread Daniel Vetter
On Fri, May 22, 2015 at 01:34:52PM +0100, Daniel Stone wrote:
> Add a new helper, to be used later for blob property management, that
> sets the mode for a CRTC state, as well as updating the CRTC enable/active
> state at the same time.
> 
> Signed-off-by: Daniel Stone 
> Tested-by: Sean Paul 

A few small nits below.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic.c | 42 
> 
>  drivers/gpu/drm/drm_atomic_helper.c  | 24 ++---
>  drivers/gpu/drm/drm_crtc_helper.c|  6 +++---
>  drivers/gpu/drm/i915/intel_display.c | 16 +-
>  include/drm/drm_atomic.h |  6 ++
>  5 files changed, 68 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 3134f50..67c251f 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -290,6 +290,48 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
>  EXPORT_SYMBOL(drm_atomic_get_crtc_state);
>  
>  /**
> + * drm_atomic_set_mode_for_crtc - set mode for CRTC
> + * @state: the CRTC whose incoming state to update
> + * @mode: kernel-internal mode to use for the CRTC, or NULL to disable
> + *
> + * Set a mode (originating from the kernel) on the desired CRTC state, and
> + * update the CRTC state's enable and mode_changed parameters as necessary.
> + * If disabling, it will also set active to false.

Kerneldoc for return values is missing. Fairly important since many atomic
functions can return -EDEADLK, but this one doesn (even not when all the
patches are applied).

> + */
> +int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
> +  struct drm_display_mode *mode)
> +{
> + /* Early return for no change. */
> + if (!mode && !state->enable)
> + return 0;
> + if (mode && state->enable &&
> + memcmp(>mode, mode, sizeof(*mode)) == 0)
> + return 0;
> +
> + state->mode_changed = true;

Layering violation: ->mode_changed is purely something for the benefit of
drivers/helpers and not something the core manadates. Hence this should
get removed imo.

> +
> + if (mode) {
> + drm_mode_copy(>mode, mode);
> + state->enable = true;
> + } else {
> + memset(>mode, 0, sizeof(state->mode));
> + state->enable = false;
> + state->active = false;
> + }
> +
> + if (state->enable)
> + DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
> +  mode->name, state);
> + else
> + DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
> +  state);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(drm_atomic_set_mode_for_crtc);
> +
> +
> +/**
>   * drm_atomic_crtc_set_property - set property on CRTC
>   * @crtc: the drm CRTC to set a property on
>   * @state: the state object to update with the new property value
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
> b/drivers/gpu/drm/drm_atomic_helper.c
> index a64bacd..70ce243 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -369,20 +369,6 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
>   struct drm_connector_state *connector_state;
>   int i, ret;
>  
> - for_each_crtc_in_state(state, crtc, crtc_state, i) {
> - if (!drm_mode_equal(>state->mode, _state->mode)) {
> - DRM_DEBUG_ATOMIC("[CRTC:%d] mode changed\n",
> -  crtc->base.id);
> - crtc_state->mode_changed = true;
> - }
> -
> - if (crtc->state->enable != crtc_state->enable) {
> - DRM_DEBUG_ATOMIC("[CRTC:%d] enable changed\n",
> -  crtc->base.id);
> - crtc_state->mode_changed = true;
> - }
> - }

Ofc then this hunk here needs to stay.

> -
>   for_each_connector_in_state(state, connector, connector_state, i) {
>   /*
>* This only sets crtc->mode_changed for routing changes,
> @@ -1607,8 +1593,9 @@ retry:
>   WARN_ON(set->fb);
>   WARN_ON(set->num_connectors);
>  
> - crtc_state->enable = false;
> - crtc_state->active = false;
> + ret = drm_atomic_set_mode_for_crtc(crtc_state, NULL);
> + if (ret != 0)
> + goto fail;
>  
>   ret = drm_atomic_set_crtc_for_plane(primary_state, NULL);
>   if (ret != 0)
> @@ -1622,9 +1609,10 @@ retry:
>   WARN_ON(!set->fb);
>   WARN_ON(!set->num_connectors);
>  
> - crtc_state->enable = true;
> + ret = drm_atomic_set_mode_for_crtc(crtc_state, set->mode);
> + if (ret != 0)
> + goto fail;
>   crtc_state->active = true;
> - drm_mode_copy(_state->mode, set->mode);
>  
>   ret = 

[PATCH 03/11] drm: Retain reference to blob properties in lookup

2015-05-22 Thread Daniel Vetter
On Fri, May 22, 2015 at 01:34:46PM +0100, Daniel Stone wrote:
> When we look up a blob property, make sure we retain a reference to the
> blob for the lifetime.
> 
> Signed-off-by: Daniel Stone 
> Tested-by: Sean Paul 
> ---
>  drivers/gpu/drm/drm_crtc.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 7e5085f..da2b117 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -4661,7 +4661,9 @@ bool drm_property_change_valid_get(struct drm_property 
> *property,
>   for (i = 0; i < property->num_values; i++)
>   valid_mask |= (1ULL << property->values[i]);
>   return !(value & ~valid_mask);
> - } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
> + } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB) ||
> +(drm_property_type_is(property, DRM_MODE_PROP_OBJECT) &&
> + property->values[0] == DRM_MODE_OBJECT_BLOB)) {
>   struct drm_property_blob *blob;
>  
>   if (value == 0)
> @@ -4709,6 +4711,8 @@ void drm_property_change_valid_put(struct drm_property 
> *property,
>   if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
>   if (property->values[0] == DRM_MODE_OBJECT_FB)
>   drm_framebuffer_unreference(obj_to_fb(ref));
> + else if (property->values[0] == DRM_MODE_OBJECT_BLOB)
> + drm_property_unreference_blob(obj_to_blob(ref));

Hm why this? I know it's a bit inconsistent that for all the other atomic
obj props we use DRM_MODE_PROP_OBJ, but for blobs we have a special one. I
guess I'll see the reason later on, but without more details I'd vote to
not subsume props under the generic PROP_OBJECT.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Takashi Iwai
At Fri, 22 May 2015 16:02:13 +0200,
Takashi Iwai wrote:
> 
> At Fri, 22 May 2015 15:00:10 +0100,
> Russell King - ARM Linux wrote:
> > 
> > On Fri, May 22, 2015 at 03:54:56PM +0200, Takashi Iwai wrote:
> > > At Fri, 22 May 2015 14:53:31 +0100,
> > > Russell King - ARM Linux wrote:
> > > > 
> > > > On Fri, May 22, 2015 at 03:30:54PM +0200, Takashi Iwai wrote:
> > > > > At Fri, 22 May 2015 14:15:35 +0100,
> > > > > Russell King - ARM Linux wrote:
> > > > > > 
> > > > > > On Fri, May 22, 2015 at 01:20:09PM +0100, Mark Brown wrote:
> > > > > > > On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> > > > > > > > Add a helper for the EDID like data structure, which is 
> > > > > > > > typically passed
> > > > > > > > from a HDMI adapter to its associated audio driver.  This 
> > > > > > > > informs the
> > > > > > > > audio driver of the capabilities of the attached HDMI sink.
> > > > > > > 
> > > > > > > As far as I can tell people are fairly happy with the 
> > > > > > > implementation
> > > > > > > here and unless I'm missing something are definitely happy with 
> > > > > > > the
> > > > > > > interface.  If that's the case can we get this into -next?  
> > > > > > > There's a
> > > > > > > lot of interest in HDMI right now (which is great) and this would 
> > > > > > > be
> > > > > > > helpful for that, it seems like even if there are issues with the
> > > > > > > implementation it would be worth merging as is so we can start 
> > > > > > > adding
> > > > > > > users and then do any improvements to the interface in parallel.
> > > > > > > 
> > > > > > > From an interface point of view:
> > > > > > > 
> > > > > > > Reviewed-by: Mark Brown 
> > > > > > 
> > > > > > I'd be more than happy if Takashi Iwai wants to take them - I'm not
> > > > > > planning on the audio driver itself being merged just yet as we 
> > > > > > still
> > > > > > need to properly hammer out the differences between the AHB audio 
> > > > > > (for
> > > > > > iMX6) and I2S audio (for Rockchip) for this device.
> > > > > 
> > > > > Sorry, I've been on vacation in the last two weeks, so slowly
> > > > > digesting all backlogs now.
> > > > > 
> > > > > > Alternatively, I could move these two patches to the beginning of my
> > > > > > series, and merge that point into my for-next and/or publish it as a
> > > > > > separate sub-branch... whatever people want, just let me know.
> > > > > 
> > > > > I'm fine to take the sound part.  It's only patches 10 and 11, right?
> > > > > Then I can provide a branch that can be merged for the rest drm
> > > > > stuff.
> > > > 
> > > > Yep, just patches 10 and 11.  If possible, please base these patches on
> > > > v4.1-rc1, thanks.
> > > 
> > > I applied them on top of -rc4, I suppose it's OK?
> > 
> > It is, but what it means is that I'll keep my copy of the patches in my
> > tree rather than pulling your tree.  Having branches spread on different
> > start points makes it difficult to generate a patch series from the git
> > tree - which is something I continue to do for the SolidRun iMX6 platforms
> > (publishing it as separate patches, tarball of those patches and a combined
> > patch.)
> > 
> > As I say, it doesn't matter that much, I can just keep my copies of the
> > patches, and when this stuff gets rebased to 4.2-rc1, git rebase should
> > eliminate them automatically.
> 
> OK, if so, then I rebase on top of -rc1.  The branch isn't merged yet,
> so no big problem.

Now the rebased branch is pushed.

I also merged this branch now to for-next branch, so that it'll be
tested through linux-next.


Takashi


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Takashi Iwai
At Fri, 22 May 2015 15:00:10 +0100,
Russell King - ARM Linux wrote:
> 
> On Fri, May 22, 2015 at 03:54:56PM +0200, Takashi Iwai wrote:
> > At Fri, 22 May 2015 14:53:31 +0100,
> > Russell King - ARM Linux wrote:
> > > 
> > > On Fri, May 22, 2015 at 03:30:54PM +0200, Takashi Iwai wrote:
> > > > At Fri, 22 May 2015 14:15:35 +0100,
> > > > Russell King - ARM Linux wrote:
> > > > > 
> > > > > On Fri, May 22, 2015 at 01:20:09PM +0100, Mark Brown wrote:
> > > > > > On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> > > > > > > Add a helper for the EDID like data structure, which is typically 
> > > > > > > passed
> > > > > > > from a HDMI adapter to its associated audio driver.  This informs 
> > > > > > > the
> > > > > > > audio driver of the capabilities of the attached HDMI sink.
> > > > > > 
> > > > > > As far as I can tell people are fairly happy with the implementation
> > > > > > here and unless I'm missing something are definitely happy with the
> > > > > > interface.  If that's the case can we get this into -next?  There's 
> > > > > > a
> > > > > > lot of interest in HDMI right now (which is great) and this would be
> > > > > > helpful for that, it seems like even if there are issues with the
> > > > > > implementation it would be worth merging as is so we can start 
> > > > > > adding
> > > > > > users and then do any improvements to the interface in parallel.
> > > > > > 
> > > > > > From an interface point of view:
> > > > > > 
> > > > > > Reviewed-by: Mark Brown 
> > > > > 
> > > > > I'd be more than happy if Takashi Iwai wants to take them - I'm not
> > > > > planning on the audio driver itself being merged just yet as we still
> > > > > need to properly hammer out the differences between the AHB audio (for
> > > > > iMX6) and I2S audio (for Rockchip) for this device.
> > > > 
> > > > Sorry, I've been on vacation in the last two weeks, so slowly
> > > > digesting all backlogs now.
> > > > 
> > > > > Alternatively, I could move these two patches to the beginning of my
> > > > > series, and merge that point into my for-next and/or publish it as a
> > > > > separate sub-branch... whatever people want, just let me know.
> > > > 
> > > > I'm fine to take the sound part.  It's only patches 10 and 11, right?
> > > > Then I can provide a branch that can be merged for the rest drm
> > > > stuff.
> > > 
> > > Yep, just patches 10 and 11.  If possible, please base these patches on
> > > v4.1-rc1, thanks.
> > 
> > I applied them on top of -rc4, I suppose it's OK?
> 
> It is, but what it means is that I'll keep my copy of the patches in my
> tree rather than pulling your tree.  Having branches spread on different
> start points makes it difficult to generate a patch series from the git
> tree - which is something I continue to do for the SolidRun iMX6 platforms
> (publishing it as separate patches, tarball of those patches and a combined
> patch.)
> 
> As I say, it doesn't matter that much, I can just keep my copies of the
> patches, and when this stuff gets rebased to 4.2-rc1, git rebase should
> eliminate them automatically.

OK, if so, then I rebase on top of -rc1.  The branch isn't merged yet,
so no big problem.


Takashi


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Takashi Iwai
At Fri, 22 May 2015 14:53:31 +0100,
Russell King - ARM Linux wrote:
> 
> On Fri, May 22, 2015 at 03:30:54PM +0200, Takashi Iwai wrote:
> > At Fri, 22 May 2015 14:15:35 +0100,
> > Russell King - ARM Linux wrote:
> > > 
> > > On Fri, May 22, 2015 at 01:20:09PM +0100, Mark Brown wrote:
> > > > On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> > > > > Add a helper for the EDID like data structure, which is typically 
> > > > > passed
> > > > > from a HDMI adapter to its associated audio driver.  This informs the
> > > > > audio driver of the capabilities of the attached HDMI sink.
> > > > 
> > > > As far as I can tell people are fairly happy with the implementation
> > > > here and unless I'm missing something are definitely happy with the
> > > > interface.  If that's the case can we get this into -next?  There's a
> > > > lot of interest in HDMI right now (which is great) and this would be
> > > > helpful for that, it seems like even if there are issues with the
> > > > implementation it would be worth merging as is so we can start adding
> > > > users and then do any improvements to the interface in parallel.
> > > > 
> > > > From an interface point of view:
> > > > 
> > > > Reviewed-by: Mark Brown 
> > > 
> > > I'd be more than happy if Takashi Iwai wants to take them - I'm not
> > > planning on the audio driver itself being merged just yet as we still
> > > need to properly hammer out the differences between the AHB audio (for
> > > iMX6) and I2S audio (for Rockchip) for this device.
> > 
> > Sorry, I've been on vacation in the last two weeks, so slowly
> > digesting all backlogs now.
> > 
> > > Alternatively, I could move these two patches to the beginning of my
> > > series, and merge that point into my for-next and/or publish it as a
> > > separate sub-branch... whatever people want, just let me know.
> > 
> > I'm fine to take the sound part.  It's only patches 10 and 11, right?
> > Then I can provide a branch that can be merged for the rest drm
> > stuff.
> 
> Yep, just patches 10 and 11.  If possible, please base these patches on
> v4.1-rc1, thanks.

I applied them on top of -rc4, I suppose it's OK?

Now pushed as topic/hdmi branch of sound git tree.
Let me know if anything else needed.


thanks,

Takashi


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Takashi Iwai
At Fri, 22 May 2015 14:15:35 +0100,
Russell King - ARM Linux wrote:
> 
> On Fri, May 22, 2015 at 01:20:09PM +0100, Mark Brown wrote:
> > On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> > > Add a helper for the EDID like data structure, which is typically passed
> > > from a HDMI adapter to its associated audio driver.  This informs the
> > > audio driver of the capabilities of the attached HDMI sink.
> > 
> > As far as I can tell people are fairly happy with the implementation
> > here and unless I'm missing something are definitely happy with the
> > interface.  If that's the case can we get this into -next?  There's a
> > lot of interest in HDMI right now (which is great) and this would be
> > helpful for that, it seems like even if there are issues with the
> > implementation it would be worth merging as is so we can start adding
> > users and then do any improvements to the interface in parallel.
> > 
> > From an interface point of view:
> > 
> > Reviewed-by: Mark Brown 
> 
> I'd be more than happy if Takashi Iwai wants to take them - I'm not
> planning on the audio driver itself being merged just yet as we still
> need to properly hammer out the differences between the AHB audio (for
> iMX6) and I2S audio (for Rockchip) for this device.

Sorry, I've been on vacation in the last two weeks, so slowly
digesting all backlogs now.

> Alternatively, I could move these two patches to the beginning of my
> series, and merge that point into my for-next and/or publish it as a
> separate sub-branch... whatever people want, just let me know.

I'm fine to take the sound part.  It's only patches 10 and 11, right?
Then I can provide a branch that can be merged for the rest drm
stuff.


thanks,

Takashi


[PATCH v3 1/4] localversion: branch virtio-gpu

2015-05-22 Thread Gerd Hoffmann
On Fr, 2015-05-22 at 15:11 +0200, Gerd Hoffmann wrote:
> ---
>  localversion-virtio-gpu | 1 +
>  1 file changed, 1 insertion(+)
>  create mode 100644 localversion-virtio-gpu
> 
> diff --git a/localversion-virtio-gpu b/localversion-virtio-gpu
> new file mode 100644
> index 000..835f52a
> --- /dev/null
> +++ b/localversion-virtio-gpu
> @@ -0,0 +1 @@
> +-virtio-gpu

Oops, scratch that one.  Local patch which of course is _not_ supposed
to be merged upstream ;)

cheers,
  Gerd




[PATCH v3 4/4] Add virtio gpu driver.

2015-05-22 Thread Gerd Hoffmann
From: Dave Airlie 

This patch adds a kms driver for the virtio gpu.  The xorg modesetting
driver can handle the device just fine, the framebuffer for fbcon is
there too.

Qemu patches for the host side are under review currently.

The pci version of the device comes in two variants: with and without
vga compatibility.  The former has a extra memory bar for the vga
framebuffer, the later is a pure virtio device.  The only concern for
this driver is that in the virtio-vga case we have to kick out the
firmware framebuffer.

Initial revision has only 2d support, 3d (virgl) support requires
some more work on the qemu side and will be added later.

Signed-off-by: Dave Airlie 
Signed-off-by: Gerd Hoffmann 
---
 drivers/gpu/drm/Kconfig  |   2 +
 drivers/gpu/drm/Makefile |   1 +
 drivers/gpu/drm/virtio/Kconfig   |  14 +
 drivers/gpu/drm/virtio/Makefile  |  11 +
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  64 
 drivers/gpu/drm/virtio/virtgpu_display.c | 485 
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c |  91 +
 drivers/gpu/drm/virtio/virtgpu_drv.c | 136 +++
 drivers/gpu/drm/virtio/virtgpu_drv.h | 350 ++
 drivers/gpu/drm/virtio/virtgpu_fb.c  | 431 ++
 drivers/gpu/drm/virtio/virtgpu_fence.c   | 119 ++
 drivers/gpu/drm/virtio/virtgpu_gem.c | 140 +++
 drivers/gpu/drm/virtio/virtgpu_kms.c | 164 +
 drivers/gpu/drm/virtio/virtgpu_object.c  | 170 +
 drivers/gpu/drm/virtio/virtgpu_plane.c   | 120 ++
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 469 +++
 drivers/gpu/drm/virtio/virtgpu_vq.c  | 614 +++
 include/drm/drmP.h   |   1 +
 include/uapi/linux/Kbuild|   1 +
 include/uapi/linux/virtio_gpu.h  | 204 ++
 include/uapi/linux/virtio_ids.h  |   1 +
 21 files changed, 3588 insertions(+)
 create mode 100644 drivers/gpu/drm/virtio/Kconfig
 create mode 100644 drivers/gpu/drm/virtio/Makefile
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_debugfs.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_display.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drm_bus.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.h
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fb.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fence.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_gem.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_kms.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_object.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_plane.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_ttm.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.c
 create mode 100644 include/uapi/linux/virtio_gpu.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 47f2ce8..d4b6545 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -206,6 +206,8 @@ source "drivers/gpu/drm/qxl/Kconfig"

 source "drivers/gpu/drm/bochs/Kconfig"

+source "drivers/gpu/drm/virtio/Kconfig"
+
 source "drivers/gpu/drm/msm/Kconfig"

 source "drivers/gpu/drm/tegra/Kconfig"
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 7d4944e..dbbc101 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -63,6 +63,7 @@ obj-$(CONFIG_DRM_OMAP)+= omapdrm/
 obj-$(CONFIG_DRM_TILCDC)   += tilcdc/
 obj-$(CONFIG_DRM_QXL) += qxl/
 obj-$(CONFIG_DRM_BOCHS) += bochs/
+obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/
 obj-$(CONFIG_DRM_MSM) += msm/
 obj-$(CONFIG_DRM_TEGRA) += tegra/
 obj-$(CONFIG_DRM_STI) += sti/
diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
new file mode 100644
index 000..9983ead
--- /dev/null
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -0,0 +1,14 @@
+config DRM_VIRTIO_GPU
+   tristate "Virtio GPU driver"
+   depends on DRM && VIRTIO
+   select FB_SYS_FILLRECT
+   select FB_SYS_COPYAREA
+   select FB_SYS_IMAGEBLIT
+select DRM_KMS_HELPER
+select DRM_KMS_FB_HELPER
+select DRM_TTM
+   help
+  This is the virtual GPU driver for virtio.  It can be used with
+   QEMU based VMMs (like KVM or Xen).
+
+  If unsure say M.
diff --git a/drivers/gpu/drm/virtio/Makefile b/drivers/gpu/drm/virtio/Makefile
new file mode 100644
index 000..2ee1602
--- /dev/null
+++ b/drivers/gpu/drm/virtio/Makefile
@@ -0,0 +1,11 @@
+#
+# Makefile for the drm device driver.  This driver provides support for the
+# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
+
+ccflags-y := -Iinclude/drm
+
+virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \
+   virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \
+   virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o
+
+obj-$(CONFIG_DRM_VIRTIO_GPU) 

[PATCH v3 3/4] drm_vblank_get: don't WARN_ON in case vblanks are not initialized

2015-05-22 Thread Gerd Hoffmann
Signed-off-by: Gerd Hoffmann 
Reviewed-by: Alex Deucher 
---
 drivers/gpu/drm/drm_irq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index af9662e..265793c 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1029,6 +1029,9 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
unsigned long irqflags;
int ret = 0;

+   if (!dev->num_crtcs)
+   return -EINVAL;
+
if (WARN_ON(crtc >= dev->num_crtcs))
return -EINVAL;

-- 
1.8.3.1



[PATCH v3 2/4] break kconfig dependency loop

2015-05-22 Thread Gerd Hoffmann
After adding virtio-gpu I get this funky kconfig dependency loop.

scripts/kconfig/conf --oldconfig Kconfig
drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
drivers/gpu/drm/Kconfig:34: symbol DRM_KMS_FB_HELPER is selected by 
DRM_VIRTIO_GPU
drivers/gpu/drm/virtio/Kconfig:1:   symbol DRM_VIRTIO_GPU depends on VIRTIO
drivers/virtio/Kconfig:1:   symbol VIRTIO is selected by REMOTEPROC
drivers/remoteproc/Kconfig:4:   symbol REMOTEPROC is selected by OMAP_REMOTEPROC
drivers/remoteproc/Kconfig:12:  symbol OMAP_REMOTEPROC depends on OMAP_IOMMU
drivers/iommu/Kconfig:141:  symbol OMAP_IOMMU is selected by VIDEO_OMAP3
drivers/media/platform/Kconfig:96:  symbol VIDEO_OMAP3 depends on VIDEO_V4L2
drivers/media/v4l2-core/Kconfig:6:  symbol VIDEO_V4L2 depends on I2C
drivers/i2c/Kconfig:7:  symbol I2C is selected by FB_DDC
drivers/video/fbdev/Kconfig:59: symbol FB_DDC is selected by FB_CYBER2000_DDC
drivers/video/fbdev/Kconfig:374:symbol FB_CYBER2000_DDC depends on 
FB_CYBER2000
drivers/video/fbdev/Kconfig:362:symbol FB_CYBER2000 depends on FB

Making VIDEO_OMAP3 depend on OMAP_IOMMU instead of selecting it breaks the
loop, which looks like the best way to handle it to me.  Updated OMAP_IOMMU
help text accordingly.

Signed-off-by: Gerd Hoffmann 
Acked-by: Mauro Carvalho Chehab 
---
 drivers/iommu/Kconfig  | 3 +++
 drivers/media/platform/Kconfig | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 1ae4e54..a5c8d5e 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -178,6 +178,9 @@ config OMAP_IOMMU
depends on ARM && MMU
depends on ARCH_OMAP2PLUS || COMPILE_TEST
select IOMMU_API
+   ---help---
+ The OMAP3 media platform drivers depend on iommu support,
+ if you need them say Y here.

 config OMAP_IOMMU_DEBUG
bool "Export OMAP IOMMU internals in DebugFS"
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 421f531..19306f72 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -87,8 +87,8 @@ config VIDEO_OMAP3
tristate "OMAP 3 Camera support"
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
depends on HAS_DMA
+   depends on OMAP_IOMMU
select ARM_DMA_USE_IOMMU
-   select OMAP_IOMMU
select VIDEOBUF2_DMA_CONTIG
select MFD_SYSCON
---help---
-- 
1.8.3.1



[PATCH v3 1/4] localversion: branch virtio-gpu

2015-05-22 Thread Gerd Hoffmann
---
 localversion-virtio-gpu | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 localversion-virtio-gpu

diff --git a/localversion-virtio-gpu b/localversion-virtio-gpu
new file mode 100644
index 000..835f52a
--- /dev/null
+++ b/localversion-virtio-gpu
@@ -0,0 +1 @@
+-virtio-gpu
-- 
1.8.3.1



[PATCH v3 0/4] Add virtio gpu driver.

2015-05-22 Thread Gerd Hoffmann
  Hi,

It's been a while, but now I finally found to time to send v3 to the
list.  No big changes in there.  Collected some review and ack lines.
Fixed some minor issues found in review.  Rebased to 4.1-rc4.  Dropped
the vga compatibility bits for now, this needs to be sorted on the qemu
side first.  But I don't want delay these patches until this is done.

cheers,
  Gerd

Dave Airlie (1):
  Add virtio gpu driver.

Gerd Hoffmann (3):
  localversion: branch virtio-gpu
  break kconfig dependency loop
  drm_vblank_get: don't WARN_ON in case vblanks are not initialized

 drivers/gpu/drm/Kconfig  |   2 +
 drivers/gpu/drm/Makefile |   1 +
 drivers/gpu/drm/drm_irq.c|   3 +
 drivers/gpu/drm/virtio/Kconfig   |  14 +
 drivers/gpu/drm/virtio/Makefile  |  11 +
 drivers/gpu/drm/virtio/virtgpu_debugfs.c |  64 
 drivers/gpu/drm/virtio/virtgpu_display.c | 485 
 drivers/gpu/drm/virtio/virtgpu_drm_bus.c |  91 +
 drivers/gpu/drm/virtio/virtgpu_drv.c | 136 +++
 drivers/gpu/drm/virtio/virtgpu_drv.h | 350 ++
 drivers/gpu/drm/virtio/virtgpu_fb.c  | 431 ++
 drivers/gpu/drm/virtio/virtgpu_fence.c   | 119 ++
 drivers/gpu/drm/virtio/virtgpu_gem.c | 140 +++
 drivers/gpu/drm/virtio/virtgpu_kms.c | 164 +
 drivers/gpu/drm/virtio/virtgpu_object.c  | 170 +
 drivers/gpu/drm/virtio/virtgpu_plane.c   | 120 ++
 drivers/gpu/drm/virtio/virtgpu_ttm.c | 469 +++
 drivers/gpu/drm/virtio/virtgpu_vq.c  | 614 +++
 drivers/iommu/Kconfig|   3 +
 drivers/media/platform/Kconfig   |   2 +-
 include/drm/drmP.h   |   1 +
 include/uapi/linux/Kbuild|   1 +
 include/uapi/linux/virtio_gpu.h  | 204 ++
 include/uapi/linux/virtio_ids.h  |   1 +
 localversion-virtio-gpu  |   1 +
 25 files changed, 3596 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/virtio/Kconfig
 create mode 100644 drivers/gpu/drm/virtio/Makefile
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_debugfs.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_display.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drm_bus.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.h
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fb.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_fence.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_gem.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_kms.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_object.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_plane.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_ttm.c
 create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.c
 create mode 100644 include/uapi/linux/virtio_gpu.h
 create mode 100644 localversion-virtio-gpu

-- 
1.8.3.1



[PATCH v4 2/2] drm/panel: Add support for LG LB070WV8 800x480 7" panel

2015-05-22 Thread Thierry Reding
On Fri, May 22, 2015 at 10:25:57AM +0200, Heiko Schocher wrote:
> This adds support for the LG LB070WV8 7" 800x480 panel to the
> DRM simple panel driver.
> 
> Signed-off-by: Heiko Schocher 
> ---
> 
> Changes in v4:
> - new in version 4, as Philipp Zabel suggested to use
>   simple panel driver
> 
> Changes in v3: None
> Changes in v2: None
> 
>  .../devicetree/bindings/panel/lg,lb070wv8.txt  |  7 ++
>  drivers/gpu/drm/panel/panel-simple.c   | 27 
> ++
>  2 files changed, 34 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/panel/lg,lb070wv8.txt

Applied, thanks. For future patches, please make sure to send them to my
GMail account (as listed in MAINTAINERS). Corporate email is known to
corrupt patches occasionally, though it seems to have worked fine this
time.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150522/b16cd7a2/attachment-0001.sig>


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Russell King - ARM Linux
On Fri, May 22, 2015 at 03:54:56PM +0200, Takashi Iwai wrote:
> At Fri, 22 May 2015 14:53:31 +0100,
> Russell King - ARM Linux wrote:
> > 
> > On Fri, May 22, 2015 at 03:30:54PM +0200, Takashi Iwai wrote:
> > > At Fri, 22 May 2015 14:15:35 +0100,
> > > Russell King - ARM Linux wrote:
> > > > 
> > > > On Fri, May 22, 2015 at 01:20:09PM +0100, Mark Brown wrote:
> > > > > On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> > > > > > Add a helper for the EDID like data structure, which is typically 
> > > > > > passed
> > > > > > from a HDMI adapter to its associated audio driver.  This informs 
> > > > > > the
> > > > > > audio driver of the capabilities of the attached HDMI sink.
> > > > > 
> > > > > As far as I can tell people are fairly happy with the implementation
> > > > > here and unless I'm missing something are definitely happy with the
> > > > > interface.  If that's the case can we get this into -next?  There's a
> > > > > lot of interest in HDMI right now (which is great) and this would be
> > > > > helpful for that, it seems like even if there are issues with the
> > > > > implementation it would be worth merging as is so we can start adding
> > > > > users and then do any improvements to the interface in parallel.
> > > > > 
> > > > > From an interface point of view:
> > > > > 
> > > > > Reviewed-by: Mark Brown 
> > > > 
> > > > I'd be more than happy if Takashi Iwai wants to take them - I'm not
> > > > planning on the audio driver itself being merged just yet as we still
> > > > need to properly hammer out the differences between the AHB audio (for
> > > > iMX6) and I2S audio (for Rockchip) for this device.
> > > 
> > > Sorry, I've been on vacation in the last two weeks, so slowly
> > > digesting all backlogs now.
> > > 
> > > > Alternatively, I could move these two patches to the beginning of my
> > > > series, and merge that point into my for-next and/or publish it as a
> > > > separate sub-branch... whatever people want, just let me know.
> > > 
> > > I'm fine to take the sound part.  It's only patches 10 and 11, right?
> > > Then I can provide a branch that can be merged for the rest drm
> > > stuff.
> > 
> > Yep, just patches 10 and 11.  If possible, please base these patches on
> > v4.1-rc1, thanks.
> 
> I applied them on top of -rc4, I suppose it's OK?

It is, but what it means is that I'll keep my copy of the patches in my
tree rather than pulling your tree.  Having branches spread on different
start points makes it difficult to generate a patch series from the git
tree - which is something I continue to do for the SolidRun iMX6 platforms
(publishing it as separate patches, tarball of those patches and a combined
patch.)

As I say, it doesn't matter that much, I can just keep my copies of the
patches, and when this stuff gets rebased to 4.2-rc1, git rebase should
eliminate them automatically.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


[Bug 90595] [drm:si_dpm_set_power_state [radeon]] *ERROR* si_set_sw_state failed

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90595

Alex Deucher  changed:

   What|Removed |Added

  Component|Driver/Radeon   |DRM/Radeon
Version|7.7 (2012.06)   |unspecified
   Assignee|xorg-driver-ati at lists.x.org |dri-devel at 
lists.freedesktop
   ||.org
Product|xorg|DRI
 QA Contact|xorg-team at lists.x.org   |

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


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Russell King - ARM Linux
On Fri, May 22, 2015 at 03:30:54PM +0200, Takashi Iwai wrote:
> At Fri, 22 May 2015 14:15:35 +0100,
> Russell King - ARM Linux wrote:
> > 
> > On Fri, May 22, 2015 at 01:20:09PM +0100, Mark Brown wrote:
> > > On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> > > > Add a helper for the EDID like data structure, which is typically passed
> > > > from a HDMI adapter to its associated audio driver.  This informs the
> > > > audio driver of the capabilities of the attached HDMI sink.
> > > 
> > > As far as I can tell people are fairly happy with the implementation
> > > here and unless I'm missing something are definitely happy with the
> > > interface.  If that's the case can we get this into -next?  There's a
> > > lot of interest in HDMI right now (which is great) and this would be
> > > helpful for that, it seems like even if there are issues with the
> > > implementation it would be worth merging as is so we can start adding
> > > users and then do any improvements to the interface in parallel.
> > > 
> > > From an interface point of view:
> > > 
> > > Reviewed-by: Mark Brown 
> > 
> > I'd be more than happy if Takashi Iwai wants to take them - I'm not
> > planning on the audio driver itself being merged just yet as we still
> > need to properly hammer out the differences between the AHB audio (for
> > iMX6) and I2S audio (for Rockchip) for this device.
> 
> Sorry, I've been on vacation in the last two weeks, so slowly
> digesting all backlogs now.
> 
> > Alternatively, I could move these two patches to the beginning of my
> > series, and merge that point into my for-next and/or publish it as a
> > separate sub-branch... whatever people want, just let me know.
> 
> I'm fine to take the sound part.  It's only patches 10 and 11, right?
> Then I can provide a branch that can be merged for the rest drm
> stuff.

Yep, just patches 10 and 11.  If possible, please base these patches on
v4.1-rc1, thanks.

Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


[git pull] drm fixes

2015-05-22 Thread Linus Torvalds
On Thu, May 21, 2015 at 8:39 PM, Dave Airlie  wrote:
>
> radeon has two displayport fixes, one for a regressions,
> i915 regression flicker fix needed to 4.0 can get fixed.

Ok, I'm used to fixing up your whitespace and lack of capitalization,
but you're getting so incoherent that I can no longer even parse it
well enough to fix it up.

English *is* your first language, right? Could you please re-phrase

  "i915 regression flicker fix needed to 4.0 can get fixed"

because it's not really making sense to me, and I want my commit
messages to make sense.

Linus


[PATCH v2] drm: Only create a cmdline mode if no probed modes match

2015-05-22 Thread Ville Syrjälä
On Fri, May 22, 2015 at 10:54:12AM +0100, Chris Wilson wrote:
> On Fri, May 22, 2015 at 12:03:27PM +0300, Ville Syrjälä wrote:
> > On Mon, Apr 20, 2015 at 02:28:56PM +0100, Chris Wilson wrote:
> > > The intention of using video=: is primarily to select
> > > the user's preferred resolution at startup. Currently we always create a
> > > new mode irrespective of whether the monitor has a native mode at the
> > > desired resolution. This has the issue that we may then select the fake
> > > mode rather the native mode during fb_helper->inital_config() and so
> > > if the fake mode is invalid we then end up with a loss of signal. Oops.
> > > This invalid fake mode would also be exported to userspace, who
> > > potentially may make the same mistake.
> > > 
> > > To avoid this issue, we filter out the added command line mode if we
> > > detect the desired resolution (and clock if specified) amongst the
> > > probed modes. This fixes the immediate problem of adding a duplicate
> > > mode, but perhaps more generically we should avoid adding a GTF mode if
> > > the monitor has an EDID that is not GTF-compatible, or similarly for
> > > CVT.
> > > 
> > > A second issue sneaked into this patch is to add the cmdline mode mode
> > > ahead of the absolute fallback 1024x768 mode. That is if the user has
> > > specified a mode that we create as a fallback, we do not need to add a
> > > second unused fallback mode.
> > > 
> > > Fixes regression from
> > > 
> > > commit eaf99c749d43ae74ac7ffece5512f3c73f01dfd2
> > > Author: Chris Wilson 
> > > Date:   Wed Aug 6 10:08:32 2014 +0200
> > > 
> > > drm: Perform cmdline mode parsing during connector initialisation
> > > 
> > > that breaks HDMI output on BeagleBone Black with LG TV (model 19LS4R-ZA).
> > > 
> > > v2: Explicitly delete our earlier cmdline mode
> > > 
> > > Reported-by: Radek Dostál 
> > > Signed-off-by: Chris Wilson 
> > > Cc: Radek Dostál 
> > > Cc: Jesse Barnes 
> > > Cc: Ville Syrjälä 
> > > Cc: Daniel Vetter 
> > > Cc: dri-devel at lists.freedesktop.org
> > > Cc: Julia Lemire 
> > > Cc: Dave Airlie 
> > > Cc: stable at vger.kernel.org
> > > ---
> > >  drivers/gpu/drm/drm_modes.c|  2 +-
> > >  drivers/gpu/drm/drm_probe_helper.c | 39 
> > > +++---
> > >  2 files changed, 37 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > > index 213b11ea69b5..13293e009990 100644
> > > --- a/drivers/gpu/drm/drm_modes.c
> > > +++ b/drivers/gpu/drm/drm_modes.c
> > > @@ -1400,7 +1400,7 @@ drm_mode_create_from_cmdline_mode(struct drm_device 
> > > *dev,
> > >   if (!mode)
> > >   return NULL;
> > >  
> > > - mode->type |= DRM_MODE_TYPE_USERDEF;
> > > + mode->type |= DRM_MODE_TYPE_USERDEF | DRM_MODE_TYPE_DRIVER;
> > 
> > Why do we need the DRIVER flag here?
> 
> So we can differentiate it from an equivalent mode added by the user
> later on.

Users can't actually add modes to the connector mode list.

> 
> > > + /* Remove the existing fake mode */
> > > + list_for_each_entry(mode, >modes, head) {
> > > + if ((mode->type & (DRM_MODE_TYPE_DRIVER | 
> > > DRM_MODE_TYPE_USERDEF)) != (DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_USERDEF))
> > > + continue;
> > 
> > Doesn't drm_mode_connector_list_update() kill it from the list
> > eventually if there's no matching mode present on the
> > probed_modes list?
> 
> Hmm, that's what I thought I tried at first. If I remember correctly we
> had to set mode->status in order to prune it since
> drm_mode_connector_list_update() itself doesn't do the deletion. Using
> the mode->status was problematic, and the simplest way to do delete the
> original cmdline mode was by explicitly removing it ourselves.

Oh right drm_mode_connector_list_update() only removes the duplicates.

And the the mode->status handling is a bit strange. Not helped by
the fact that MODE_OK is zero so all kzalloced modes start out as
MODE_OK. While I was doing the mode santiy check stuff I did
consider that I should change new modes to be MODE_UNVERIFIED by
default, but I was feeling lazy and decided against it in the end.

So yeah getting the normal prune mechanism to kill the mode would
required some rework to the mode status->handling probably, so
seems like a somewhat bigger effort.

> 
> > > @@ -179,9 +212,9 @@ static int 
> > > drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
> > >   count = (*connector_funcs->get_modes)(connector);
> > >   }
> > >  
> > > + count += drm_helper_probe_add_cmdline_mode(connector);
> > >   if (count == 0 && connector->status == connector_status_connected)
> > >   count = drm_add_modes_noedid(connector, 1024, 768);
> > > - count += drm_helper_probe_add_cmdline_mode(connector);
> > 
> > Hmm. This means drm_add_modes_noedid() will never be called if the
> > cmdline mode is present, and hence the mode list will only ever have
> > 

drivers/gpu/drm/i915/i915_gem_gtt.c

2015-05-22 Thread Andrew Morton

I'm not sure what's happened to the drm code in linux-next - it's
exploding all over the place.  Did someone turn on -Werror without
doing anywhere near enough testing?

Anyway, I don't know how to fix this i386 build error:

drivers/gpu/drm/i915/i915_gem_gtt.c: In function 'gen8_ppgtt_init':
drivers/gpu/drm/i915/i915_gem_gtt.c:954:2: error: large integer implicitly 
truncated to unsigned type [-Werror=overflow]

ppgtt->base.total = 1ULL << 32;

i915_address_space.total is a ulong: 32-bit.



[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Russell King - ARM Linux
On Fri, May 22, 2015 at 01:20:09PM +0100, Mark Brown wrote:
> On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> > Add a helper for the EDID like data structure, which is typically passed
> > from a HDMI adapter to its associated audio driver.  This informs the
> > audio driver of the capabilities of the attached HDMI sink.
> 
> As far as I can tell people are fairly happy with the implementation
> here and unless I'm missing something are definitely happy with the
> interface.  If that's the case can we get this into -next?  There's a
> lot of interest in HDMI right now (which is great) and this would be
> helpful for that, it seems like even if there are issues with the
> implementation it would be worth merging as is so we can start adding
> users and then do any improvements to the interface in parallel.
> 
> From an interface point of view:
> 
> Reviewed-by: Mark Brown 

I'd be more than happy if Takashi Iwai wants to take them - I'm not
planning on the audio driver itself being merged just yet as we still
need to properly hammer out the differences between the AHB audio (for
iMX6) and I2S audio (for Rockchip) for this device.

Alternatively, I could move these two patches to the beginning of my
series, and merge that point into my for-next and/or publish it as a
separate sub-branch... whatever people want, just let me know.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.


[Spice-devel] [PATCH] Do not loop on ERESTARTSYS using interruptible waits

2015-05-22 Thread Christophe Fergeau
Hey,

On Tue, May 19, 2015 at 05:54:54AM -0400, Frediano Ziglio wrote:
> This problem happens using KMS surfaces and QXL driver.
> To easy reproduce use KDE Plasma (which use surfaces a lot) and assure
> you are using KMS surfaces (QXL driver on Fedora/RedHat has a patch to
> stop using them). Open some complex application like LibreOffice and
> after a while your machine get stuck using 100% CPU on Xorg.
> The problem occurs as creating new surfaces not interruptible wait
> are used however instead of returning ERESTARTSYS back to userspace
> you try to loop but wait routines always keep returning ERESTARTSYS
> once the signal is marked.
> On out of memory conditions TTM module try to move objects to system
> memory and QXL assure surface is updated before the move.
> The fix handle differently this case using no interruptible wait so
> wait functions will wait instead of returning ERESTARTSYS.
> Note the when the loop occurs driver will send a lot of update requests
> causing more CPU usage on Qemu side too.
> 
> Signed-off-by: Frediano Ziglio 
> ---
>  qxl/qxl_cmd.c   | 12 +++-
>  qxl/qxl_drv.h   |  2 +-
>  qxl/qxl_ioctl.c |  2 +-
>  3 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drivers/gpu/drm/qxl/qxl_cmd.c b/qxl/qxl_cmd.c
> index 9782364..bd5404e 100644
> --- a/drivers/gpu/drm/qxl/qxl_cmd.c
> +++ b/drivers/gpu/drm/qxl/qxl_cmd.c
> @@ -317,14 +317,11 @@ static void wait_for_io_cmd(struct qxl_device *qdev, 
> uint8_t val, long port)
>  {
>   int ret;
>  
> -restart:
>   ret = wait_for_io_cmd_user(qdev, val, port, false);
> - if (ret == -ERESTARTSYS)
> - goto restart;

I think this one is not directly related to the fix, but can be removed
because wait_for_io_cmd_user(qdev, val, port, false); will call
wait_event_timeout() which cannot return ERESTARTSYS? Or was this loop
causing issues too?

>  }
>  
>  int qxl_io_update_area(struct qxl_device *qdev, struct qxl_bo *surf,
> - const struct qxl_rect *area)
> + const struct qxl_rect *area, bool intr)
>  {
>   int surface_id;
>   uint32_t surface_width, surface_height;
> @@ -350,7 +347,7 @@ int qxl_io_update_area(struct qxl_device *qdev, struct 
> qxl_bo *surf,
>   mutex_lock(>update_area_mutex);
>   qdev->ram_header->update_area = *area;
>   qdev->ram_header->update_surface = surface_id;
> - ret = wait_for_io_cmd_user(qdev, 0, QXL_IO_UPDATE_AREA_ASYNC, true);
> + ret = wait_for_io_cmd_user(qdev, 0, QXL_IO_UPDATE_AREA_ASYNC, intr);
>   mutex_unlock(>update_area_mutex);
>   return ret;
>  }
> @@ -588,10 +585,7 @@ int qxl_update_surface(struct qxl_device *qdev, struct 
> qxl_bo *surf)
>   rect.right = surf->surf.width;
>   rect.top = 0;
>   rect.bottom = surf->surf.height;
> -retry:
> - ret = qxl_io_update_area(qdev, surf, );
> - if (ret == -ERESTARTSYS)
> - goto retry;
> + ret = qxl_io_update_area(qdev, surf, , false);

My understanding is that the fix is this hunk? If so, this could be made
more obvious with an intermediate commit adding the 'bool intr' arg to
qxl_io_update_area and only calling it with 'true' in the appropriate
places.
This code path is only triggered from qxl_surface_evict() which I assume
is not necessarily easily interruptible, so this change makes sense to
me. However it would be much better to get a review from Dave Airlie ;)

Christophe
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150522/f6c44603/attachment-0001.sig>


[PATCH 3/4] drm/tegra: Add VIC support

2015-05-22 Thread Thierry Reding
quot;initialized");
> +
> + return 0;
> +}
> +
> +static int vic_remove(struct platform_device *pdev)
> +{
> + struct vic *vic = platform_get_drvdata(pdev);
> + int err;
> +
> + err = host1x_client_unregister(>client.base);
> + if (err < 0) {
> + dev_err(>dev, "failed to unregister host1x client: %d\n",
> + err);
> + return err;
> + }
> +
> + clk_disable_unprepare(vic->clk);
> + tegra_powergate_power_off(vic->config->powergate_id);

This supports the suggestion to introduce a separate function for this.

> +
> + return 0;
> +}
> +
> +struct platform_driver tegra_vic_driver = {
> + .driver = {
> + .name = "tegra-vic",
> + .of_match_table = vic_match,
> + },
> + .probe = vic_probe,
> + .remove = vic_remove,
> +};
> diff --git a/drivers/gpu/drm/tegra/vic.h b/drivers/gpu/drm/tegra/vic.h
> new file mode 100644
> index ..65ca38a8da88
> --- /dev/null
> +++ b/drivers/gpu/drm/tegra/vic.h
> @@ -0,0 +1,116 @@
> +/*
> + * Copyright (c) 2015, NVIDIA Corporation.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef TEGRA_VIC_H
> +#define TEGRA_VIC_H
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct ucode_bin_header_v1_vic {
> + u32 bin_magic;/* 0x10de */
> + u32 bin_ver;  /* cya, versioning of bin format (1) */
> + u32 bin_size; /* entire image size including this header */
> + u32 os_bin_header_offset;
> + u32 os_bin_data_offset;
> + u32 os_bin_size;
> + u32 fce_bin_header_offset;
> + u32 fce_bin_data_offset;
> + u32 fce_bin_size;
> +};
> +
> +struct ucode_os_code_header_v1_vic {
> + u32 offset;
> + u32 size;
> +};
> +
> +struct ucode_os_header_v1_vic {
> + u32 os_code_offset;
> + u32 os_code_size;
> + u32 os_data_offset;
> + u32 os_data_size;
> + u32 num_apps;
> + struct ucode_os_code_header_v1_vic *app_code;
> + struct ucode_os_code_header_v1_vic *app_data;
> + u32 *os_ovl_offset;
> + u32 *of_ovl_size;
> +};
> +
> +struct ucode_fce_header_v1_vic {
> + u32 fce_ucode_offset;
> + u32 fce_ucode_buffer_size;
> + u32 fce_ucode_size;
> +};
> +
> +struct ucode_v1_vic {
> + struct ucode_bin_header_v1_vic *bin_header;
> + struct ucode_os_header_v1_vic  *os_header;
> + struct ucode_fce_header_v1_vic *fce_header;
> +};

I'll assume that these are data structures shared by all other drivers
for Falcon driven engines, so they should probably go into the Falcon
library header as well.

> +
> +/* VIC methods */
> +#define NVA0B6_VIDEO_COMPOSITOR_SET_APPLICATION_ID   0x0200
> +#define NVA0B6_VIDEO_COMPOSITOR_SET_FCE_UCODE_SIZE   0x071C
> +#define NVA0B6_VIDEO_COMPOSITOR_SET_FCE_UCODE_OFFSET 0x072C
> +
> +/* VIC registers */
> +
> +#define NV_PVIC_FALCON_METHOD_0  0x0040
> +#define NV_PVIC_FALCON_METHOD_1  0x0044
> +
> +#define NV_PVIC_FALCON_IRQMSET   0x1010

I don't see this documented in the TRM.

> +#define IRQMSET_WDTMR_SET(1 << 1)
> +#define IRQMSET_HALT_SET (1 << 4)
> +#define IRQMSET_EXTERR_SET   (1 << 5)
> +#define IRQMSET_SWGEN0_SET   (1 << 6)
> +#define IRQMSET_SWGEN1_SET   (1 << 7)
> +#define IRQMSET_EXT(val) ((val & 0xff) << 8)

You'll need to add extra parentheses around "val" to protect against
operator precedence screwing this up.

> +
> +#define NV_PVIC_FALCON_IRQDEST   0x101c
> +#define IRQDEST_HOST_HALT_HOST   (1 << 4)
> +#define IRQDEST_HOST_EXTERR_HOST (1 << 5)
> +#define IRQDEST_HOST_SWGEN0_HOST (1 << 6)
> +#define IRQDEST_HOST_SWGEN1_HOST (1 << 7)
> +#define IRQDEST_HOST_EXT(val)((val & 0xff) << 8)

This isn't documented either.

> +
> +#define NV_PVIC_FALCON_ITFEN 0x1048
> +#define ITFEN_CTXEN_ENABLE   (1 << 0)
> +#define ITFEN_MTHDEN_ENABLE  (1 << 1)

This is...

> +#define NV_PVIC_FALCON_IDLESTATE 0x104c

... but this again isn't.

> +
> +#define NV_PVIC_FALCON_CPUCTL0x1100
> +#define CPUCTL_STARTCPU  (1 << 1)
> +
> +#define NV_PVIC_FALCON_BOOTVEC   0x1104
> +#define BOOTVEC_VEC(val) ((val & 0x) << 0)
> +
> +#define NV_PVIC_FALCON_DMACTL0x110c
> +
> +#define NV_PVIC_FALCON_DMATRFBASE0x1110
> +
> +#define NV_PVIC_FALCON_DMATRFMOFFS   0x1114
> +#define DMATRFMOFFS_OFFS(val)((val & 0x) << 0)
> +
> +#define NV_PVIC_FALCON_DMATRFCMD 0x1118
> +#define DMATRFCMD_IDLE   (1 << 1)
> +#define DMATRFCMD_IMEM   (1 << 4)
> +#define DMATRFCMD_SIZE_256B  (6 << 8)
> +
> +#define NV_PVIC_FALCON_DMATRFFBOFFS  0x111c
> +#define DMATRFFBOFFS_OFFS(val)   ((val & 0x) << 
> 0)
> +
> +#define NV_PVIC_MISC_PRI_VIC_CG  0x16d0
> +#define CG_IDLE_CG_DLY_CNT(val)  ((val & 0x3f) << 0)
> +#define CG_IDLE_CG_EN(1 << 6)
> +#define CG_WAKEUP_DLY_CNT(val)   ((val & 0xf) << 16)

These aren't in the TRM either, but I vaguely remember this being
tracked in an internal bug. Have bugs been filed to track documentation
of the other registers as well?

> +
> +

Gratuituous blank line.

> +#endif /* TEGRA_VIC_H */
> diff --git a/include/linux/host1x.h b/include/linux/host1x.h
> index fc86ced77e76..a006dad9 100644
> --- a/include/linux/host1x.h
> +++ b/include/linux/host1x.h
> @@ -26,6 +26,7 @@ enum host1x_class {
>   HOST1X_CLASS_HOST1X = 0x1,
>   HOST1X_CLASS_GR2D = 0x51,
>   HOST1X_CLASS_GR2D_SB = 0x52,
> + HOST1X_CLASS_VIC = 0x5D,
>   HOST1X_CLASS_GR3D = 0x60,
>  };

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150522/76c8da7a/attachment-0001.sig>


[PATCH 11/13] sound/core: add IEC958 channel status helper

2015-05-22 Thread Mark Brown
On Sat, May 09, 2015 at 11:26:47AM +0100, Russell King wrote:
> Add a helper to create the IEC958 channel status from an ALSA
> snd_pcm_runtime structure, taking account of the sample rate and
> sample size.

This also looks good to me from an interface point of view:

Reviwed-by: Mark Brown 
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150522/0ea0bed5/attachment.sig>


[PATCH libdrm 2/2] Add blob property create/destroy ioctl wrappers

2015-05-22 Thread Daniel Stone
Signed-off-by: Daniel Stone 
---
 include/drm/drm.h  |  2 ++
 include/drm/drm_mode.h | 21 +
 xf86drmMode.c  | 31 +++
 xf86drmMode.h  |  5 +
 4 files changed, 59 insertions(+)

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 0b1d2ef..15d4454 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -766,6 +766,8 @@ struct drm_prime_handle {
 #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct 
drm_mode_obj_set_property)
 #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)
 #define DRM_IOCTL_MODE_ATOMIC  DRM_IOWR(0xBC, struct drm_mode_atomic)
+#define DRM_IOCTL_MODE_CREATEPROPBLOB  DRM_IOWR(0xBD, struct 
drm_mode_create_blob)
+#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct 
drm_mode_destroy_blob)

 /**
  * Device specific ioctls should only be in their respective headers
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 66f856f..69c1ac3 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -523,4 +523,25 @@ struct drm_mode_atomic {
__u64 user_data;
 };

+/**
+ * Create a new 'blob' data property, copying length bytes from data pointer,
+ * and returning new blob ID.
+ */
+struct drm_mode_create_blob {
+   /** Pointer to data to copy. */
+   __u64 data;
+   /** Length of data to copy. */
+   __u32 length;
+   /** Return: new property ID. */
+   __u32 blob_id;
+};
+
+/**
+ * Destroy a user-created blob property.
+ */
+struct drm_mode_destroy_blob {
+   __u32 blob_id;
+};
+
+
 #endif
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 30b94b8..4ef2d57 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -1333,3 +1333,34 @@ out:

return ret;
 }
+
+int
+drmModeCreatePropertyBlob(int fd, const void *data, size_t length, uint32_t 
*id)
+{
+   struct drm_mode_create_blob create;
+   int ret;
+
+   if (length >= 0x)
+   return -ERANGE;
+
+   create.length = length;
+   create.data = (uintptr_t) data;
+   create.blob_id = 0;
+   *id = 0;
+
+   ret = DRM_IOCTL(fd, DRM_IOCTL_MODE_CREATEPROPBLOB, );
+   if (ret != 0)
+   return ret;
+
+   *id = create.blob_id;
+   return 0;
+}
+
+int
+drmModeDestroyPropertyBlob(int fd, uint32_t id)
+{
+   struct drm_mode_destroy_blob destroy;
+
+   destroy.blob_id = id;
+   return DRM_IOCTL(fd, DRM_IOCTL_MODE_DESTROYPROPBLOB, );
+}
diff --git a/xf86drmMode.h b/xf86drmMode.h
index 3ba2333..a6f1182 100644
--- a/xf86drmMode.h
+++ b/xf86drmMode.h
@@ -498,6 +498,11 @@ extern int drmModeAtomicCommit(int fd,
   void *user_data);
 extern void drmModeAtomicFree(drmModeAtomicReqPtr req);

+extern int drmModeCreatePropertyBlob(int fd, const void *data, size_t size,
+uint32_t *id);
+extern int drmModeDestroyPropertyBlob(int fd, uint32_t id);
+
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
-- 
2.4.1



[PATCH libdrm 1/2] Support atomic modesetting ioctl

2015-05-22 Thread Daniel Stone
From: Ville Syrjälä 

Add support for the atomic modesetting ioctl through a property-set API.

[daniels: Squashed intermediate patches from Ville, Rob and myself.
  Updated for current interface.]

Signed-off-by: Ville Syrjälä 
Signed-off-by: Rob Clark 
Signed-off-by: Daniel Stone 
---
 include/drm/drm.h  |   9 +++
 include/drm/drm_mode.h |  16 +
 xf86drmMode.c  | 186 +
 xf86drmMode.h  |  14 
 4 files changed, 225 insertions(+)

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 229a29f..0b1d2ef 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -635,6 +635,13 @@ struct drm_get_cap {
  */
 #define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2

+/**
+ * DRM_CLIENT_CAP_ATOMIC
+ *
+ * If set to 1, the DRM core will allow atomic modesetting requests.
+ */
+#define DRM_CLIENT_CAP_ATOMIC  3
+
 /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
 struct drm_set_client_cap {
__u64 capability;
@@ -758,6 +765,7 @@ struct drm_prime_handle {
 #define DRM_IOCTL_MODE_OBJ_GETPROPERTIES   DRM_IOWR(0xB9, struct 
drm_mode_obj_get_properties)
 #define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct 
drm_mode_obj_set_property)
 #define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)
+#define DRM_IOCTL_MODE_ATOMIC  DRM_IOWR(0xBC, struct drm_mode_atomic)

 /**
  * Device specific ioctls should only be in their respective headers
@@ -806,6 +814,7 @@ struct drm_event_vblank {
 #define DRM_CAP_PRIME 0x5
 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7
+#define DRM_CAP_ATOMIC 0xa

 #define DRM_PRIME_CAP_IMPORT 0x1
 #define DRM_PRIME_CAP_EXPORT 0x2
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index a2ab88a..66f856f 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -507,4 +507,20 @@ struct drm_mode_destroy_dumb {
__u32 handle;
 };

+/* page-flip flags are valid, plus: */
+#define DRM_MODE_ATOMIC_TEST_ONLY  0x0100
+#define DRM_MODE_ATOMIC_NONBLOCK   0x0200
+#define DRM_MODE_ATOMIC_ALLOW_MODESET  0x0400
+
+struct drm_mode_atomic {
+   __u32 flags;
+   __u32 count_objs;
+   __u64 objs_ptr;
+   __u64 count_props_ptr;
+   __u64 props_ptr;
+   __u64 prop_values_ptr;
+   __u64 reserved;
+   __u64 user_data;
+};
+
 #endif
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 1333da4..30b94b8 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 

 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1147,3 +1148,188 @@ int drmModeObjectSetProperty(int fd, uint32_t 
object_id, uint32_t object_type,

return DRM_IOCTL(fd, DRM_IOCTL_MODE_OBJ_SETPROPERTY, );
 }
+
+typedef struct _drmModeAtomicReqItem drmModeAtomicReqItem, 
*drmModeAtomicReqItemPtr;
+
+struct _drmModeAtomicReqItem {
+   uint32_t object_id;
+   uint32_t property_id;
+   uint64_t value;
+   drmModeAtomicReqItemPtr next;
+};
+
+struct _drmModeAtomicReq {
+   unsigned int count_objs;
+   unsigned int count_props;
+   drmModeAtomicReqItem list;
+};
+
+drmModeAtomicReqPtr drmModeAtomicAlloc(void)
+{
+   drmModeAtomicReqPtr req;
+
+   req = drmMalloc(sizeof *req);
+   if (!req)
+   return NULL;
+
+   req->list.next = NULL;
+   req->count_props = 0;
+   req->count_objs = 0;
+
+   return req;
+}
+
+int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
+uint32_t object_id,
+uint32_t property_id,
+uint64_t value)
+{
+   drmModeAtomicReqItemPtr prev = >list;
+   bool new_obj = false;
+
+   /* keep it sorted by object_id and property_id */
+   while (prev->next) {
+   if (prev->next->object_id > object_id)
+   break;
+
+   if (prev->next->object_id == object_id &&
+   prev->next->property_id >= property_id)
+   break;
+
+   prev = prev->next;
+   }
+
+   if ((prev == >list || prev->object_id != object_id) &&
+   (!prev->next || prev->next->object_id != object_id))
+   new_obj = true;
+
+   /* replace or add? */
+   if (prev->next &&
+   prev->next->object_id == object_id &&
+   prev->next->property_id == property_id) {
+   drmModeAtomicReqItemPtr item = prev->next;
+   item->value = value;
+   } else {
+   drmModeAtomicReqItemPtr item;
+
+   item = drmMalloc(sizeof *item);
+   if (!item)
+   return -1;
+
+   item->object_id = object_id;
+   item->property_id = property_id;
+   item->value = value;
+
+   item->next = prev->next;
+   prev->next = item;
+
+   req->count_props++;
+   }
+
+   if 

[PATCH libdrm 0/2] Blob and atomic wrappers

2015-05-22 Thread Daniel Stone
Hi,
Nothing big here, just the wrappers for the blob-property API, as well
as the atomic API now it's been validated by Weston.

The blob work is my own, where the atomic work is a mega-squash of
commits from Ville and Rob in particular, with my own changes to modify
the user-facing API a little, and resync with the kernel interface.

Cheers,
Daniel



[PATCH 11/11] drm: atomic: Add MODE_ID property

2015-05-22 Thread Daniel Stone
Atomic modesetting: now with modesetting support.

Signed-off-by: Daniel Stone 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_atomic.c | 12 +++-
 drivers/gpu/drm/drm_crtc.c   |  7 +++
 include/drm/drm_crtc.h   |  1 +
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 63fc58a..a4ab03a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -415,10 +415,18 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
 {
struct drm_device *dev = crtc->dev;
struct drm_mode_config *config = >mode_config;
+   int ret;

-   /* FIXME: Mode prop is missing, which also controls ->enable. */
if (property == config->prop_active)
state->active = val;
+   else if (property == config->prop_mode_id) {
+   struct drm_property_blob *mode =
+   drm_property_lookup_blob(dev, val);
+   ret = drm_atomic_set_mode_prop_for_crtc(state, mode);
+   if (mode)
+   drm_property_unreference_blob(mode);
+   return ret;
+   }
else if (crtc->funcs->atomic_set_property)
return crtc->funcs->atomic_set_property(crtc, state, property, 
val);
else
@@ -443,6 +451,8 @@ int drm_atomic_crtc_get_property(struct drm_crtc *crtc,

if (property == config->prop_active)
*val = state->active;
+   else if (property == config->prop_mode_id)
+   *val = (state->mode_blob) ? state->mode_blob->base.id : 0;
else if (crtc->funcs->atomic_get_property)
return crtc->funcs->atomic_get_property(crtc, state, property, 
val);
else
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index ee87045..8f18412 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -688,6 +688,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, 
struct drm_crtc *crtc,

if (drm_core_check_feature(dev, DRIVER_ATOMIC)) {
drm_object_attach_property(>base, config->prop_active, 0);
+   drm_object_attach_property(>base, config->prop_mode_id, 
0);
}

return 0;
@@ -1454,6 +1455,12 @@ static int drm_mode_create_standard_properties(struct 
drm_device *dev)
return -ENOMEM;
dev->mode_config.prop_active = prop;

+   prop = drm_property_create_object(dev, DRM_MODE_PROP_ATOMIC,
+   "MODE_ID", DRM_MODE_OBJECT_BLOB);
+   if (!prop)
+   return -ENOMEM;
+   dev->mode_config.prop_mode_id = prop;
+
return 0;
 }

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c54fa4a..3b4d8a4 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1146,6 +1146,7 @@ struct drm_mode_config {
struct drm_property *prop_fb_id;
struct drm_property *prop_crtc_id;
struct drm_property *prop_active;
+   struct drm_property *prop_mode_id;

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



[PATCH 10/11] drm/atomic: Add current-mode blob to CRTC state

2015-05-22 Thread Daniel Stone
Add a blob property tracking the current mode to the CRTC state, and
ensure it is properly updated and referenced.

Signed-off-by: Daniel Stone 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_atomic.c| 62 +
 drivers/gpu/drm/drm_atomic_helper.c | 11 ---
 drivers/gpu/drm/drm_crtc.c  |  3 +-
 include/drm/drm_crtc.h  |  3 ++
 4 files changed, 73 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 67c251f..63fc58a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -301,6 +301,8 @@ EXPORT_SYMBOL(drm_atomic_get_crtc_state);
 int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
 struct drm_display_mode *mode)
 {
+   struct drm_mode_modeinfo umode;
+
/* Early return for no change. */
if (!mode && !state->enable)
return 0;
@@ -308,9 +310,20 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state 
*state,
memcmp(>mode, mode, sizeof(*mode)) == 0)
return 0;

+   if (state->mode_blob)
+   drm_property_unreference_blob(state->mode_blob);
+   state->mode_blob = NULL;
state->mode_changed = true;

if (mode) {
+   drm_mode_convert_to_umode(, mode);
+   state->mode_blob =
+   drm_property_create_blob(state->crtc->dev,
+sizeof(umode),
+);
+   if (!state->mode_blob)
+   return -ENOMEM;
+
drm_mode_copy(>mode, mode);
state->enable = true;
} else {
@@ -330,6 +343,55 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state 
*state,
 }
 EXPORT_SYMBOL(drm_atomic_set_mode_for_crtc);

+/**
+ * drm_atomic_set_mode_prop_for_crtc - set mode for CRTC
+ * @state: the CRTC whose incoming state to update
+ * @blob: pointer to blob property to use for mode
+ *
+ * Set a mode (originating from a blob property) on the desired CRTC state.
+ * This function will take a reference on the blob property for the CRTC state,
+ * and release the reference held on the state's existing mode property, if any
+ * was set.
+ */
+int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
+  struct drm_property_blob *blob)
+{
+   if (blob == state->mode_blob)
+   return 0;
+
+   if (state->mode_blob)
+   drm_property_unreference_blob(state->mode_blob);
+   state->mode_blob = NULL;
+
+   if (blob) {
+   if (blob->length != sizeof(struct drm_mode_modeinfo) ||
+   drm_mode_convert_umode(>mode,
+  (const struct drm_mode_modeinfo *)
+   blob->data))
+   return -EINVAL;
+
+   state->mode_blob = drm_property_reference_blob(blob);
+   state->mode_changed = true;
+   state->enable = true;
+   } else {
+   memset(>mode, 0, sizeof(state->mode));
+
+   if (state->enable)
+   state->mode_changed = true;
+   state->enable = false;
+   state->active = false;
+   }
+
+   if (state->enable)
+   DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
+state->mode.name, state);
+   else
+   DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
+state);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);

 /**
  * drm_atomic_crtc_set_property - set property on CRTC
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 70ce243..5d596d9 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2027,6 +2027,8 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
  */
 void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc)
 {
+   if (crtc->state && crtc->state->mode_blob)
+   drm_property_unreference_blob(crtc->state->mode_blob);
kfree(crtc->state);
crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL);

@@ -2048,6 +2050,8 @@ void __drm_atomic_helper_crtc_duplicate_state(struct 
drm_crtc *crtc,
 {
memcpy(state, crtc->state, sizeof(*state));

+   if (state->mode_blob)
+   drm_property_reference_blob(state->mode_blob);
state->mode_changed = false;
state->active_changed = false;
state->planes_changed = false;
@@ -2090,11 +2094,8 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state);
 void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc,
struct drm_crtc_state *state)
 {
-   /*
-* This is currently a placeholder so that drivers 

[PATCH 09/11] drm: Add drm_atomic_set_mode_for_crtc

2015-05-22 Thread Daniel Stone
Add a new helper, to be used later for blob property management, that
sets the mode for a CRTC state, as well as updating the CRTC enable/active
state at the same time.

Signed-off-by: Daniel Stone 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_atomic.c | 42 
 drivers/gpu/drm/drm_atomic_helper.c  | 24 ++---
 drivers/gpu/drm/drm_crtc_helper.c|  6 +++---
 drivers/gpu/drm/i915/intel_display.c | 16 +-
 include/drm/drm_atomic.h |  6 ++
 5 files changed, 68 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3134f50..67c251f 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -290,6 +290,48 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
 EXPORT_SYMBOL(drm_atomic_get_crtc_state);

 /**
+ * drm_atomic_set_mode_for_crtc - set mode for CRTC
+ * @state: the CRTC whose incoming state to update
+ * @mode: kernel-internal mode to use for the CRTC, or NULL to disable
+ *
+ * Set a mode (originating from the kernel) on the desired CRTC state, and
+ * update the CRTC state's enable and mode_changed parameters as necessary.
+ * If disabling, it will also set active to false.
+ */
+int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
+struct drm_display_mode *mode)
+{
+   /* Early return for no change. */
+   if (!mode && !state->enable)
+   return 0;
+   if (mode && state->enable &&
+   memcmp(>mode, mode, sizeof(*mode)) == 0)
+   return 0;
+
+   state->mode_changed = true;
+
+   if (mode) {
+   drm_mode_copy(>mode, mode);
+   state->enable = true;
+   } else {
+   memset(>mode, 0, sizeof(state->mode));
+   state->enable = false;
+   state->active = false;
+   }
+
+   if (state->enable)
+   DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
+mode->name, state);
+   else
+   DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
+state);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_atomic_set_mode_for_crtc);
+
+
+/**
  * drm_atomic_crtc_set_property - set property on CRTC
  * @crtc: the drm CRTC to set a property on
  * @state: the state object to update with the new property value
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index a64bacd..70ce243 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -369,20 +369,6 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
struct drm_connector_state *connector_state;
int i, ret;

-   for_each_crtc_in_state(state, crtc, crtc_state, i) {
-   if (!drm_mode_equal(>state->mode, _state->mode)) {
-   DRM_DEBUG_ATOMIC("[CRTC:%d] mode changed\n",
-crtc->base.id);
-   crtc_state->mode_changed = true;
-   }
-
-   if (crtc->state->enable != crtc_state->enable) {
-   DRM_DEBUG_ATOMIC("[CRTC:%d] enable changed\n",
-crtc->base.id);
-   crtc_state->mode_changed = true;
-   }
-   }
-
for_each_connector_in_state(state, connector, connector_state, i) {
/*
 * This only sets crtc->mode_changed for routing changes,
@@ -1607,8 +1593,9 @@ retry:
WARN_ON(set->fb);
WARN_ON(set->num_connectors);

-   crtc_state->enable = false;
-   crtc_state->active = false;
+   ret = drm_atomic_set_mode_for_crtc(crtc_state, NULL);
+   if (ret != 0)
+   goto fail;

ret = drm_atomic_set_crtc_for_plane(primary_state, NULL);
if (ret != 0)
@@ -1622,9 +1609,10 @@ retry:
WARN_ON(!set->fb);
WARN_ON(!set->num_connectors);

-   crtc_state->enable = true;
+   ret = drm_atomic_set_mode_for_crtc(crtc_state, set->mode);
+   if (ret != 0)
+   goto fail;
crtc_state->active = true;
-   drm_mode_copy(_state->mode, set->mode);

ret = drm_atomic_set_crtc_for_plane(primary_state, crtc);
if (ret != 0)
diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 9297a61..cc77a4f 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -937,10 +937,10 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, 
struct drm_display_mode *mod
crtc_state->crtc = crtc;
}

-   crtc_state->enable = true;
crtc_state->planes_changed = true;
-   crtc_state->mode_changed = true;
-   drm_mode_copy(_state->mode, mode);
+   ret = 

[PATCH 08/11] drm/mode: Add user blob-creation ioctl

2015-05-22 Thread Daniel Stone
Add an ioctl which allows users to create blob properties from supplied
data. Currently this only supports modes, creating a drm_display_mode from
the userspace drm_mode_modeinfo.

v2: Removed size/type checks.
Rebased on new patches to allow error propagation from create_blob,
as well as avoiding double-allocation.

Signed-off-by: Daniel Stone 
Reviewed-by: Maarten Lankhorst 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_crtc.c  | 139 +++-
 drivers/gpu/drm/drm_fops.c  |   5 +-
 drivers/gpu/drm/drm_ioctl.c |   2 +
 include/drm/drmP.h  |   4 ++
 include/drm/drm_crtc.h  |   9 ++-
 include/uapi/drm/drm.h  |   2 +
 include/uapi/drm/drm_mode.h |  20 +++
 7 files changed, 176 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 494c4a0..9263b22 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4173,6 +4173,9 @@ drm_property_create_blob(struct drm_device *dev, size_t 
length,
if (!blob)
return ERR_PTR(-ENOMEM);

+   /* This must be explicitly initialised, so we can safely call list_del
+* on it in the removal handler, even if it isn't in a file list. */
+   INIT_LIST_HEAD(>head_file);
blob->length = length;
blob->dev = dev;

@@ -4190,7 +4193,8 @@ drm_property_create_blob(struct drm_device *dev, size_t 
length,

kref_init(>refcount);

-   list_add_tail(>head, >mode_config.property_blob_list);
+   list_add_tail(>head_global,
+ >mode_config.property_blob_list);

mutex_unlock(>mode_config.blob_lock);

@@ -4212,7 +4216,8 @@ static void drm_property_free_blob(struct kref *kref)

WARN_ON(!mutex_is_locked(>dev->mode_config.blob_lock));

-   list_del(>head);
+   list_del(>head_global);
+   list_del(>head_file);
drm_mode_object_put(blob->dev, >base);

kfree(blob);
@@ -4264,6 +4269,26 @@ static void drm_property_unreference_blob_locked(struct 
drm_property_blob *blob)
 }

 /**
+ * drm_property_destroy_user_blobs - destroy all blobs created by this client
+ * @dev:   DRM device
+ * @file_priv: destroy all blobs owned by this file handle
+ */
+void drm_property_destroy_user_blobs(struct drm_device *dev,
+struct drm_file *file_priv)
+{
+   struct drm_property_blob *blob, *bt;
+
+   mutex_lock(>mode_config.blob_lock);
+
+   list_for_each_entry_safe(blob, bt, _priv->blobs, head_file) {
+   list_del_init(>head_file);
+   drm_property_unreference_blob_locked(blob);
+   }
+
+   mutex_unlock(>mode_config.blob_lock);
+}
+
+/**
  * drm_property_reference_blob - Take a reference on an existing property
  *
  * Take a new reference on an existing blob property.
@@ -4453,6 +4478,114 @@ done:
 }

 /**
+ * drm_mode_createblob_ioctl - create a new blob property
+ * @dev: DRM device
+ * @data: ioctl data
+ * @file_priv: DRM file info
+ *
+ * This function creates a new blob property with user-defined values. In order
+ * to give us sensible validation and checking when creating, rather than at
+ * every potential use, we also require a type to be provided upfront.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_createblob_ioctl(struct drm_device *dev,
+ void *data, struct drm_file *file_priv)
+{
+   struct drm_mode_create_blob *out_resp = data;
+   struct drm_property_blob *blob;
+   void __user *blob_ptr;
+   int ret = 0;
+
+   if (!drm_core_check_feature(dev, DRIVER_MODESET))
+   return -EINVAL;
+
+   blob = drm_property_create_blob(dev, out_resp->length, NULL);
+   if (IS_ERR(blob))
+   return PTR_ERR(blob);
+
+   blob_ptr = (void __user *)(unsigned long)out_resp->data;
+   if (copy_from_user(blob->data, blob_ptr, out_resp->length)) {
+   ret = -EFAULT;
+   goto out_blob;
+   }
+
+   /* Dropping the lock between create_blob and our access here is safe
+* as only the same file_priv can remove the blob; at this point, it is
+* not associated with any file_priv. */
+   mutex_lock(>mode_config.blob_lock);
+   out_resp->blob_id = blob->base.id;
+   list_add_tail(_priv->blobs, >head_file);
+   mutex_unlock(>mode_config.blob_lock);
+
+   return 0;
+
+out_blob:
+   drm_property_unreference_blob(blob);
+   return ret;
+}
+
+/**
+ * drm_mode_destroyblob_ioctl - destroy a user blob property
+ * @dev: DRM device
+ * @data: ioctl data
+ * @file_priv: DRM file info
+ *
+ * Destroy an existing user-defined blob property.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_destroyblob_ioctl(struct drm_device *dev,
+  void *data, struct drm_file *file_priv)
+{
+  

[PATCH 07/11] drm: Return error value from blob creation

2015-05-22 Thread Daniel Stone
Change drm_property_create_blob to return an ERR_PTR-encoded error on
failure, so we can pass the failure reason down.

Signed-off-by: Daniel Stone 
Cc: Maarten Lankhorst 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_crtc.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e4a48e0..494c4a0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4154,6 +4154,10 @@ done:
  * @dev: DRM device to create property for
  * @length: Length to allocate for blob data
  * @data: If specified, copies data into blob
+ *
+ * Returns:
+ * New blob property with a single reference on success, or an ERR_PTR
+ * value on failure.
  */
 struct drm_property_blob *
 drm_property_create_blob(struct drm_device *dev, size_t length,
@@ -4163,11 +4167,11 @@ drm_property_create_blob(struct drm_device *dev, size_t 
length,
int ret;

if (!length)
-   return NULL;
+   return ERR_PTR(-EINVAL);

blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
if (!blob)
-   return NULL;
+   return ERR_PTR(-ENOMEM);

blob->length = length;
blob->dev = dev;
@@ -4181,7 +4185,7 @@ drm_property_create_blob(struct drm_device *dev, size_t 
length,
if (ret) {
kfree(blob);
mutex_unlock(>mode_config.blob_lock);
-   return NULL;
+   return ERR_PTR(-EINVAL);
}

kref_init(>refcount);
@@ -4370,8 +4374,8 @@ static int drm_property_replace_global_blob(struct 
drm_device *dev,

if (length && data) {
new_blob = drm_property_create_blob(dev, length, data);
-   if (!new_blob)
-   return -EINVAL;
+   if (IS_ERR(new_blob))
+   return PTR_ERR(new_blob);
}

/* This does not need to be synchronised with blob_lock, as the
-- 
2.4.1



[PATCH 06/11] drm: Allow creating blob properties without copy

2015-05-22 Thread Daniel Stone
Make the data parameter to drm_property_create_blob optional; if
omitted, the copy will be skipped and the data will be empty.

Signed-off-by: Daniel Stone 
Reviewed-by: Maarten Lankhorst 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_crtc.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index def7be8..e4a48e0 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4145,6 +4145,16 @@ done:
return ret;
 }

+/**
+ * drm_property_create_blob - Create new blob property
+ *
+ * Creates a new blob property for a specified DRM device, optionally
+ * copying data.
+ *
+ * @dev: DRM device to create property for
+ * @length: Length to allocate for blob data
+ * @data: If specified, copies data into blob
+ */
 struct drm_property_blob *
 drm_property_create_blob(struct drm_device *dev, size_t length,
 const void *data)
@@ -4152,7 +4162,7 @@ drm_property_create_blob(struct drm_device *dev, size_t 
length,
struct drm_property_blob *blob;
int ret;

-   if (!length || !data)
+   if (!length)
return NULL;

blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
@@ -4162,7 +4172,8 @@ drm_property_create_blob(struct drm_device *dev, size_t 
length,
blob->length = length;
blob->dev = dev;

-   memcpy(blob->data, data, length);
+   if (data)
+   memcpy(blob->data, data, length);

mutex_lock(>mode_config.blob_lock);

-- 
2.4.1



[PATCH 05/11] drm/mode: Unstatic kernel-userspace mode conversion

2015-05-22 Thread Daniel Stone
Move the drm_display_mode <-> drm_mode_modeinfo conversion functions
from drm_crtc.c to drm_modes.c, and make them non-static so that others
can use them.

Signed-off-by: Daniel Stone 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_crtc.c  | 95 ++---
 drivers/gpu/drm/drm_modes.c | 87 +
 include/drm/drm_modes.h |  4 ++
 3 files changed, 95 insertions(+), 91 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 9ab2fc6..def7be8 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1736,93 +1736,6 @@ void drm_reinit_primary_mode_group(struct drm_device 
*dev)
 EXPORT_SYMBOL(drm_reinit_primary_mode_group);

 /**
- * drm_crtc_convert_to_umode - convert a drm_display_mode into a modeinfo
- * @out: drm_mode_modeinfo struct to return to the user
- * @in: drm_display_mode to use
- *
- * Convert a drm_display_mode into a drm_mode_modeinfo structure to return to
- * the user.
- */
-static void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,
- const struct drm_display_mode *in)
-{
-   WARN(in->hdisplay > USHRT_MAX || in->hsync_start > USHRT_MAX ||
-in->hsync_end > USHRT_MAX || in->htotal > USHRT_MAX ||
-in->hskew > USHRT_MAX || in->vdisplay > USHRT_MAX ||
-in->vsync_start > USHRT_MAX || in->vsync_end > USHRT_MAX ||
-in->vtotal > USHRT_MAX || in->vscan > USHRT_MAX,
-"timing values too large for mode info\n");
-
-   out->clock = in->clock;
-   out->hdisplay = in->hdisplay;
-   out->hsync_start = in->hsync_start;
-   out->hsync_end = in->hsync_end;
-   out->htotal = in->htotal;
-   out->hskew = in->hskew;
-   out->vdisplay = in->vdisplay;
-   out->vsync_start = in->vsync_start;
-   out->vsync_end = in->vsync_end;
-   out->vtotal = in->vtotal;
-   out->vscan = in->vscan;
-   out->vrefresh = in->vrefresh;
-   out->flags = in->flags;
-   out->type = in->type;
-   strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
-   out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
-}
-
-/**
- * drm_crtc_convert_umode - convert a modeinfo into a drm_display_mode
- * @out: drm_display_mode to return to the user
- * @in: drm_mode_modeinfo to use
- *
- * Convert a drm_mode_modeinfo into a drm_display_mode structure to return to
- * the caller.
- *
- * Returns:
- * Zero on success, negative errno on failure.
- */
-static int drm_crtc_convert_umode(struct drm_display_mode *out,
- const struct drm_mode_modeinfo *in)
-{
-   int ret = -EINVAL;
-
-   if (in->clock > INT_MAX || in->vrefresh > INT_MAX) {
-   ret = -ERANGE;
-   goto out;
-   }
-
-   if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
-   goto out;
-
-   out->clock = in->clock;
-   out->hdisplay = in->hdisplay;
-   out->hsync_start = in->hsync_start;
-   out->hsync_end = in->hsync_end;
-   out->htotal = in->htotal;
-   out->hskew = in->hskew;
-   out->vdisplay = in->vdisplay;
-   out->vsync_start = in->vsync_start;
-   out->vsync_end = in->vsync_end;
-   out->vtotal = in->vtotal;
-   out->vscan = in->vscan;
-   out->vrefresh = in->vrefresh;
-   out->flags = in->flags;
-   out->type = in->type;
-   strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
-   out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
-
-   out->status = drm_mode_validate_basic(out);
-   if (out->status != MODE_OK)
-   goto out;
-
-   ret = 0;
-
-out:
-   return ret;
-}
-
-/**
  * drm_mode_getresources - get graphics configuration
  * @dev: drm device for the ioctl
  * @data: data pointer for the ioctl
@@ -2048,7 +1961,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
crtc_resp->x = crtc->primary->state->src_x >> 16;
crtc_resp->y = crtc->primary->state->src_y >> 16;
if (crtc->state->enable) {
-   drm_crtc_convert_to_umode(_resp->mode, 
>state->mode);
+   drm_mode_convert_to_umode(_resp->mode, 
>state->mode);
crtc_resp->mode_valid = 1;

} else {
@@ -2058,7 +1971,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
crtc_resp->x = crtc->x;
crtc_resp->y = crtc->y;
if (crtc->enabled) {
-   drm_crtc_convert_to_umode(_resp->mode, 
>mode);
+   drm_mode_convert_to_umode(_resp->mode, 
>mode);
crtc_resp->mode_valid = 1;

} else {
@@ -2215,7 +2128,7 @@ int drm_mode_getconnector(struct drm_device *dev, void 
*data,
if (!drm_mode_expose_to_userspace(mode, file_priv))
continue;

-   drm_crtc_convert_to_umode(_mode, mode);
+   

[PATCH 04/11] drm/mode: Validate modes inside drm_crtc_convert_umode

2015-05-22 Thread Daniel Stone
The only user of convert_umode was also performing mode validation, so
do that in the same place.

Signed-off-by: Daniel Stone 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_crtc.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index da2b117..9ab2fc6 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1785,11 +1785,15 @@ static void drm_crtc_convert_to_umode(struct 
drm_mode_modeinfo *out,
 static int drm_crtc_convert_umode(struct drm_display_mode *out,
  const struct drm_mode_modeinfo *in)
 {
-   if (in->clock > INT_MAX || in->vrefresh > INT_MAX)
-   return -ERANGE;
+   int ret = -EINVAL;
+
+   if (in->clock > INT_MAX || in->vrefresh > INT_MAX) {
+   ret = -ERANGE;
+   goto out;
+   }

if ((in->flags & DRM_MODE_FLAG_3D_MASK) > DRM_MODE_FLAG_3D_MAX)
-   return -EINVAL;
+   goto out;

out->clock = in->clock;
out->hdisplay = in->hdisplay;
@@ -1808,7 +1812,14 @@ static int drm_crtc_convert_umode(struct 
drm_display_mode *out,
strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
out->name[DRM_DISPLAY_MODE_LEN-1] = 0;

-   return 0;
+   out->status = drm_mode_validate_basic(out);
+   if (out->status != MODE_OK)
+   goto out;
+
+   ret = 0;
+
+out:
+   return ret;
 }

 /**
@@ -2821,12 +2832,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
goto out;
}

-   mode->status = drm_mode_validate_basic(mode);
-   if (mode->status != MODE_OK) {
-   ret = -EINVAL;
-   goto out;
-   }
-
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);

/*
-- 
2.4.1



[PATCH 03/11] drm: Retain reference to blob properties in lookup

2015-05-22 Thread Daniel Stone
When we look up a blob property, make sure we retain a reference to the
blob for the lifetime.

Signed-off-by: Daniel Stone 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_crtc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 7e5085f..da2b117 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4661,7 +4661,9 @@ bool drm_property_change_valid_get(struct drm_property 
*property,
for (i = 0; i < property->num_values; i++)
valid_mask |= (1ULL << property->values[i]);
return !(value & ~valid_mask);
-   } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
+   } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB) ||
+  (drm_property_type_is(property, DRM_MODE_PROP_OBJECT) &&
+   property->values[0] == DRM_MODE_OBJECT_BLOB)) {
struct drm_property_blob *blob;

if (value == 0)
@@ -4709,6 +4711,8 @@ void drm_property_change_valid_put(struct drm_property 
*property,
if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
if (property->values[0] == DRM_MODE_OBJECT_FB)
drm_framebuffer_unreference(obj_to_fb(ref));
+   else if (property->values[0] == DRM_MODE_OBJECT_BLOB)
+   drm_property_unreference_blob(obj_to_blob(ref));
}
 }

-- 
2.4.1



[PATCH 02/11] drm/crtc_helper: Replace open-coded CRTC state helpers

2015-05-22 Thread Daniel Stone
Rather than open-coding our own CRTC state helpers, use the atomic helpers
added in f5e7840b0c, and make our freeing behaviour consistent as well.

Signed-off-by: Daniel Stone 
Tested-by: Sean Paul 
---
 drivers/gpu/drm/drm_crtc_helper.c | 42 ++-
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index f2f42b1..9297a61 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -927,14 +927,15 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, 
struct drm_display_mode *mod

if (crtc->funcs->atomic_duplicate_state)
crtc_state = crtc->funcs->atomic_duplicate_state(crtc);
-   else if (crtc->state)
-   crtc_state = kmemdup(crtc->state, sizeof(*crtc_state),
-GFP_KERNEL);
-   else
+   else {
crtc_state = kzalloc(sizeof(*crtc_state), GFP_KERNEL);
-   if (!crtc_state)
-   return -ENOMEM;
-   crtc_state->crtc = crtc;
+   if (!crtc_state)
+   return -ENOMEM;
+   if (crtc->state)
+   __drm_atomic_helper_crtc_duplicate_state(crtc, 
crtc_state);
+   else
+   crtc_state->crtc = crtc;
+   }

crtc_state->enable = true;
crtc_state->planes_changed = true;
@@ -944,30 +945,25 @@ int drm_helper_crtc_mode_set(struct drm_crtc *crtc, 
struct drm_display_mode *mod

if (crtc_funcs->atomic_check) {
ret = crtc_funcs->atomic_check(crtc, crtc_state);
-   if (ret) {
-   if (crtc->funcs->atomic_destroy_state) {
-   crtc->funcs->atomic_destroy_state(crtc,
- crtc_state);
-   } else {
-   kfree(crtc_state);
-   }
-
-   return ret;
-   }
+   if (ret)
+   goto out;
}

swap(crtc->state, crtc_state);

crtc_funcs->mode_set_nofb(crtc);

-   if (crtc_state) {
-   if (crtc->funcs->atomic_destroy_state)
-   crtc->funcs->atomic_destroy_state(crtc, crtc_state);
-   else
-   kfree(crtc_state);
+   ret = drm_helper_crtc_mode_set_base(crtc, x, y, old_fb);
+
+out:
+   if (crtc->funcs->atomic_destroy_state)
+   crtc->funcs->atomic_destroy_state(crtc, crtc_state);
+   else {
+   __drm_atomic_helper_crtc_destroy_state(crtc, crtc_state);
+   kfree(crtc_state);
}

-   return drm_helper_crtc_mode_set_base(crtc, x, y, old_fb);
+   return ret;
 }
 EXPORT_SYMBOL(drm_helper_crtc_mode_set);

-- 
2.4.1



[PATCH 01/11] drm: kerneldoc fixes for blob properties

2015-05-22 Thread Daniel Stone
Change '@param foo' to '@foo:' to fit kerneldoc style.

672cb1d6ae mistakenly added an extra parameter to the kerneldoc for
drm_property_unreference_blob which wasn't actually present.

Signed-off-by: Daniel Stone 
---
 drivers/gpu/drm/drm_crtc.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 4059f06..7e5085f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4270,7 +4270,7 @@ EXPORT_SYMBOL(drm_property_create_blob);
  *
  * Internal free function for blob properties; must not be used directly.
  *
- * @param kref Reference
+ * @kref: Reference
  */
 static void drm_property_free_blob(struct kref *kref)
 {
@@ -4290,7 +4290,7 @@ static void drm_property_free_blob(struct kref *kref)
  *
  * Drop a reference on a blob property. May free the object.
  *
- * @param blob Pointer to blob property
+ * @blob: Pointer to blob property
  */
 void drm_property_unreference_blob(struct drm_property_blob *blob)
 {
@@ -4318,8 +4318,7 @@ EXPORT_SYMBOL(drm_property_unreference_blob);
  * Drop a reference on a blob property. May free the object. This must be
  * called with blob_lock held.
  *
- * @param dev  Device the blob was created on
- * @param blob Pointer to blob property
+ * @blob: Pointer to blob property
  */
 static void drm_property_unreference_blob_locked(struct drm_property_blob 
*blob)
 {
@@ -4336,7 +4335,7 @@ static void drm_property_unreference_blob_locked(struct 
drm_property_blob *blob)
  *
  * Take a new reference on an existing blob property.
  *
- * @param blob Pointer to blob property
+ * @blob: Pointer to blob property
  */
 struct drm_property_blob *drm_property_reference_blob(struct drm_property_blob 
*blob)
 {
-- 
2.4.1



[PATCH 00/11] CRTC state mode property

2015-05-22 Thread Daniel Stone
Hi,
Building on the blob-property submission series[0], this provides a
MODE_ID property that can be used to set the current mode for a CRTC
under atomic modesetting, plus a way for users to create blob
properties so they can specify their own modes.

Using this[1] I've been able to validate the atomic userspace API with
a ported version of Weston[2]. This is currently undergoing review, but
seems pretty OK. Both modesetting for every output together, and
per-output async pageflips with events, works as well as the driver
does.

Also tested with fbcon and X11, on Broadwell.

Cheers,
Daniel

[0]: <1429554176-9865-1-git-send-email-daniels at collabora.com>
[1]: And a pile of other work in the i915 driver from Maarten/Ander, and
 my own bits on top; see
 git://git.collabora.co.uk/git/user/daniels/linux in the
 wip/4.1.x/blob-modes-i915 branch.
[2]: http://lists.freedesktop.org/archives/wayland-devel/2015-May/022106.html



[Bug 90263] GPU card fans run full speed at all times

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90263

--- Comment #14 from Alex Deucher  ---
(In reply to Todd from comment #13)
> The following may or may not be relevant to this issue.
> 
> "Fixes for SI fan handling"
> 
> http://cgit.freedesktop.org/%7Eagd5f/linux/commit/?h=drm-next-3.20-
> wip=e06b000d6619ac9b60b0724c82dc58141a86a3dc
> 
> 
> "Enable smc fan control on SI"
> 
> http://cgit.freedesktop.org/%7Eagd5f/linux/commit/?h=drm-next-3.20-
> wip=bdf40b0fa6588ea64ccb069de63d16f9348aeef6

Yes, the same thing need to be done for older asics.

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


[alsa-devel] [PATCH 10/13] sound/core: add DRM ELD helper

2015-05-22 Thread Mark Brown
On Sat, May 09, 2015 at 11:26:42AM +0100, Russell King wrote:
> Add a helper for the EDID like data structure, which is typically passed
> from a HDMI adapter to its associated audio driver.  This informs the
> audio driver of the capabilities of the attached HDMI sink.

As far as I can tell people are fairly happy with the implementation
here and unless I'm missing something are definitely happy with the
interface.  If that's the case can we get this into -next?  There's a
lot of interest in HDMI right now (which is great) and this would be
helpful for that, it seems like even if there are issues with the
implementation it would be worth merging as is so we can start adding
users and then do any improvements to the interface in parallel.


[PATCH 3/4] drm/tegra: Add VIC support

2015-05-22 Thread Arto Merilainen
Hi Thierry,

On 05/22/2015 01:02 PM, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Thu, May 21, 2015 at 06:44:08PM +0300, Mikko Perttunen wrote:
>> On 05/21/2015 06:10 PM, Arto Merilainen wrote:
>>> ...
> +
> +vic->rst = devm_reset_control_get(dev, "vic03");

 I might prefer just "vic" as the clock/reset name. The name is often
 used as a sort of "role" for the clock/reset for the device, not
 necessarily the raw name of the "correct" clock/reset.

>>>
>>> I considered that - but I then noticed that
>>> drivers/clk/tegra/clk-tegra124.c was already using vic03 variant. I can
>>> write a patch for changing that too.
>>
>> Well, the two can be different; the clock-name in device tree kind of means
>> "string that i use to refer to a clock that powers the VIC unit". It's not
>> really a big deal though, both ways are used in DT bindings.
>
> I'll insist on calling this vic in the clock-names property. The 03 is
> as far as I can tell an encoding of the version number, so if you want
> to call this vic04 in some future version we'll have to needlessly
> patch the driver.

I agree, this is better without 04 postfix and I will remove it in the 
next version.

- Arto



[PATCH 3/4] drm/tegra: Add VIC support

2015-05-22 Thread Arto Merilainen
Hi Thierry,

On 05/22/2015 01:02 PM, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Thu, May 21, 2015 at 06:44:08PM +0300, Mikko Perttunen wrote:
>> On 05/21/2015 06:10 PM, Arto Merilainen wrote:
>>> ...
> +
> +vic->rst = devm_reset_control_get(dev, "vic03");

 I might prefer just "vic" as the clock/reset name. The name is often
 used as a sort of "role" for the clock/reset for the device, not
 necessarily the raw name of the "correct" clock/reset.

>>>
>>> I considered that - but I then noticed that
>>> drivers/clk/tegra/clk-tegra124.c was already using vic03 variant. I can
>>> write a patch for changing that too.
>>
>> Well, the two can be different; the clock-name in device tree kind of means
>> "string that i use to refer to a clock that powers the VIC unit". It's not
>> really a big deal though, both ways are used in DT bindings.
>
> I'll insist on calling this vic in the clock-names property. The 03 is
> as far as I can tell an encoding of the version number, so if you want
> to call this vic04 in some future version we'll have to needlessly
> patch the driver.

I agree, this is better without 03 postfix will fix this in the next 
version.

- Arto


[PATCH 0/5] drm/exynos: rework layer blending setup

2015-05-22 Thread Joonyoung Shim
Hi Tobias,

On 05/22/2015 05:44 AM, Tobias Jakobi wrote:
> Gentle reminder that I still haven't heard anything about the series by
> the Samsung guys ;)
> 

Sorry for late, i'm busy and i think whether it's possible any way for
this blending from exynos drm framework after atomic feature of exynos
merged.

Thanks.

> With best wishes,
> Tobias
> 
> 
> Tobias Jakobi wrote:
>> Hello,
>>
>> this is a rework of the layer blending setup in the Exynos DRM mixer. The 
>> current setup is static and spread out through the mixer code. This rework 
>> pushes all the configuration details into a layer_config array, which 
>> specifies the priority of each layer.
>>
>> Two arrays are currently found in the code, one for SoC versions with a 
>> video processor (VP) and one for SoC versions without VP. The VP gives us 
>> one additional layer, the video layer, which natively supports the NV12/NV21 
>> pixelformat.
>>
>> The blending setup roughly works like this:
>> 1) Find the bottom-most enabled layer. Disable all blending for this layer. 
>> This is done because we currently don't expose modification of the mixer 
>> background to userspace. Once this is done we can add more flexibility here.
>> 2) Find the next enabled layer in our layer stack. If the layer has a 
>> framebuffer with an alpha-pixelformat attached, enable blending for this 
>> layer. If not, disable blending.
>> 3) Iterate (2) until all enabled layers are processed.
>>
>> The series has been tested on a Hardkernel Odroid-X2 (Exynos4412, which has 
>> a VP).
>>
>> If you want to use libdrm's modetest to check the series, please apply 
>> patches [1] and [2]. This should make it possible to also test a plane with 
>> NV12 format (which is located 'behind' the primary plane).
>>
>> With best wishes,
>> Tobias
>>
>> [1] https://patchwork.kernel.org/patch/6349241/
>> [2] https://patchwork.kernel.org/patch/6349261/
>>
>>
>> Tobias Jakobi (5):
>>   drm/exynos: mixer: refactor layer setup
>>   drm/exynos: mixer: introduce mixer_layer_blending()
>>   drm/exynos: mixer: remove all static blending setup
>>   drm/exynos: mixer: do blending setup in mixer_cfg_layer()
>>   drm/exynos: mixer: also allow ARGB1555 and ARGB
>>
>>  drivers/gpu/drm/exynos/exynos_mixer.c | 246 
>> +-
>>  drivers/gpu/drm/exynos/regs-mixer.h   |   1 +
>>  2 files changed, 213 insertions(+), 34 deletions(-)
>>
> 
> 



[PATCH v6 00/12] drm/exynos: atomic modesetting support

2015-05-22 Thread Joonyoung Shim
Hi Gustavo,

On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Hi,
> 
> Here goes the full support for atomic modesetting on exynos. I've
> split the patches in the various phases of atomic support.
> 
> v2: fixes comments by Joonyoung
> - remove unused var in patch 09
> - use ->disable instead of outdated ->dpms in hdmi code
> - remove WARN_ON from crtc enable/disable
> 
> v3: fixes comment by Joonyoung
> - move the removal of drm_helper_disable_unused_functions() to
> separated patch
> 
> v4: add patches that remove unnecessary calls to disable_plane()
> 
> v5: fixes NULL CRTC crash on planes updates (reported by Inki and Tobias)
> 
> v6: rebase on latest exynos_drm_next
> 
> Gustavo Padovan (12):
>   drm/exynos: atomic phase 1: use drm_plane_helper_update()
>   drm/exynos: atomic phase 1: use drm_plane_helper_disable()
>   drm/exynos: atomic phase 1: add .mode_set_nofb() callback
>   drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
> destroy()
>   drm/exynos: atomic phase 2: keep track of framebuffer pointer
>   drm/exynos: atomic phase 3: atomic updates of planes
>   drm/exynos: atomic phase 3: use atomic .set_config helper
>   drm/exynos: atomic phase 3: convert page flips
>   drm/exynos: remove exported functions from exynos_drm_plane
>   drm/exynos: don't disable unused functions at init
>   drm/exynos: atomic dpms support
>   drm/exynos: remove unnecessary calls to disable_plane()
> 
>  drivers/gpu/drm/bridge/ps8622.c |   6 +-
>  drivers/gpu/drm/bridge/ptn3460.c|   6 +-
>  drivers/gpu/drm/exynos/exynos_dp_core.c |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 215 
> 
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.c |   2 +
>  drivers/gpu/drm/exynos/exynos_drm_drv.h |   4 +-
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c |   6 +-
>  drivers/gpu/drm/exynos/exynos_drm_encoder.c |  35 +
>  drivers/gpu/drm/exynos/exynos_drm_fb.c  |  12 +-
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c   |   3 -
>  drivers/gpu/drm/exynos/exynos_drm_plane.c   | 120 +---
>  drivers/gpu/drm/exynos/exynos_drm_plane.h   |  11 --
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c|   6 +-
>  drivers/gpu/drm/exynos/exynos_hdmi.c|  10 +-
>  15 files changed, 184 insertions(+), 264 deletions(-)
> 

I commented about some patches, looks good to me except them.

Reviewed-by: Joonyoung Shim 

Thanks.


[Bug 90263] GPU card fans run full speed at all times

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90263

--- Comment #13 from Todd  ---
The following may or may not be relevant to this issue.

"Fixes for SI fan handling"

http://cgit.freedesktop.org/%7Eagd5f/linux/commit/?h=drm-next-3.20-wip=e06b000d6619ac9b60b0724c82dc58141a86a3dc


"Enable smc fan control on SI"

http://cgit.freedesktop.org/%7Eagd5f/linux/commit/?h=drm-next-3.20-wip=bdf40b0fa6588ea64ccb069de63d16f9348aeef6

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


[PATCH v6 09/12] drm/exynos: remove exported functions from exynos_drm_plane

2015-05-22 Thread Joonyoung Shim
On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Now that no one is using the functions exported by exynos_drm_plane due
> to the atomic conversion we can make remove some of the them or make them
> static.
> 
> v2: remove unused exynos_drm_crtc
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 91 
> +--
>  drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 
>  2 files changed, 38 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
> b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> index e952cbd..c6e5114 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> @@ -62,35 +62,12 @@ static int exynos_plane_get_size(int start, unsigned 
> length, unsigned last)
>   return size;
>  }
>  
> -int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
> -{
> - struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
> - int nr;
> - int i;
> -
> - nr = exynos_drm_fb_get_buf_cnt(fb);
> - for (i = 0; i < nr; i++) {
> - struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
> -
> - if (!buffer) {
> - DRM_DEBUG_KMS("buffer is null\n");
> - return -EFAULT;
> - }
> -
> - exynos_plane->dma_addr[i] = buffer->dma_addr + fb->offsets[i];
> -
> - DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
> - i, (unsigned long)exynos_plane->dma_addr[i]);
> - }
> -
> - return 0;
> -}
> -
> -void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
> -   struct drm_framebuffer *fb, int crtc_x, int crtc_y,
> -   unsigned int crtc_w, unsigned int crtc_h,
> -   uint32_t src_x, uint32_t src_y,
> -   uint32_t src_w, uint32_t src_h)
> +static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc 
> *crtc,

checkpatch error:

WARNING: line over 80 characters
#56: FILE: drivers/gpu/drm/exynos/exynos_drm_plane.c:65:
+static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc 
*crtc,

total: 0 errors, 1 warnings, 136 lines checked

Thanks.


[PATCH v6 04/12] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy()

2015-05-22 Thread Joonyoung Shim
On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Set CRTC, planes and connectors to use the default implementations from
> the atomic helper library. The helpers will work to keep track of state
> for each DRM object.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/bridge/ps8622.c   | 4 
>  drivers/gpu/drm/bridge/ptn3460.c  | 4 
>  drivers/gpu/drm/exynos/exynos_dp_core.c   | 4 
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 6 ++
>  drivers/gpu/drm/exynos/exynos_drm_dpi.c   | 4 
>  drivers/gpu/drm/exynos/exynos_drm_drv.c   | 2 ++
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c   | 4 
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 
>  drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 4 
>  drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 
>  10 files changed, 40 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
> index e895aa7..b604326 100644
> --- a/drivers/gpu/drm/bridge/ps8622.c
> +++ b/drivers/gpu/drm/bridge/ps8622.c
> @@ -31,6 +31,7 @@
>  #include "drmP.h"
>  #include "drm_crtc.h"
>  #include "drm_crtc_helper.h"
> +#include "drm_atomic_helper.h"
>  
>  /* Brightness scale on the Parade chip */
>  #define PS8622_MAX_BRIGHTNESS 0xff
> @@ -502,6 +503,9 @@ static const struct drm_connector_funcs 
> ps8622_connector_funcs = {
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = ps8622_detect,
>   .destroy = ps8622_connector_destroy,
> + .reset = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  };
>  
>  static int ps8622_attach(struct drm_bridge *bridge)
> diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
> b/drivers/gpu/drm/bridge/ptn3460.c
> index 9d2f053..8ed3617 100644
> --- a/drivers/gpu/drm/bridge/ptn3460.c
> +++ b/drivers/gpu/drm/bridge/ptn3460.c
> @@ -27,6 +27,7 @@
>  
>  #include "drm_crtc.h"
>  #include "drm_crtc_helper.h"
> +#include "drm_atomic_helper.h"
>  #include "drm_edid.h"
>  #include "drmP.h"
>  
> @@ -263,6 +264,9 @@ static struct drm_connector_funcs ptn3460_connector_funcs 
> = {
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = ptn3460_detect,
>   .destroy = ptn3460_connector_destroy,
> + .reset = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  };
>  
>  static int ptn3460_bridge_attach(struct drm_bridge *bridge)
> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
> b/drivers/gpu/drm/exynos/exynos_dp_core.c
> index 30feb7d..195fe60 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -957,6 +958,9 @@ static struct drm_connector_funcs 
> exynos_dp_connector_funcs = {
>   .fill_modes = drm_helper_probe_single_connector_modes,
>   .detect = exynos_dp_detect,
>   .destroy = exynos_dp_connector_destroy,
> + .reset = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
>  };
>  
>  static int exynos_dp_get_modes(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 54b74e1..dbaf161 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -14,6 +14,8 @@
>  
>  #include 
>  #include 
> +#include 
> +#include 
>  
>  #include "exynos_drm_crtc.h"
>  #include "exynos_drm_drv.h"
> @@ -194,8 +196,12 @@ static struct drm_crtc_funcs exynos_crtc_funcs = {
>   .set_config = drm_crtc_helper_set_config,
>   .page_flip  = exynos_drm_crtc_page_flip,
>   .destroy= exynos_drm_crtc_destroy,
> + .reset = drm_atomic_helper_crtc_reset,
> + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>  };
>  
> +

Please remove a blank line.

Thanks.


[PATCH v6 03/12] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-22 Thread Joonyoung Shim
On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> The new atomic infrastructure needs the .mode_set_nofb() callback to
> update CRTC timings before setting any plane.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c | 60 
> +---
>  1 file changed, 9 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 61b8cfe..54b74e1 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -81,59 +81,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
>   return true;
>  }
>  
> -static int
> -exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode 
> *mode,
> -   struct drm_display_mode *adjusted_mode, int x, int y,
> -   struct drm_framebuffer *old_fb)
> -{
> - struct drm_framebuffer *fb = crtc->primary->fb;
> - unsigned int crtc_w;
> - unsigned int crtc_h;
> - int ret;
> -
> - /*
> -  * copy the mode data adjusted by mode_fixup() into crtc->mode
> -  * so that hardware can be seet to proper mode.
> -  */
> - memcpy(>mode, adjusted_mode, sizeof(*adjusted_mode));

This can cause any problem because exynos drm drivers use crtc->mode
directly as adjusted_mode. It's necessary to consider using
crtc_state->adjusted_mode in exynos drm drivers.

Please refer a patch of Daniel Stone using hwmode instead of mode but it
cannot use for atomic.

http://lists.freedesktop.org/archives/dri-devel/2015-March/079546.html

> -
> - ret = exynos_check_plane(crtc->primary, fb);
> - if (ret < 0)
> - return ret;
> -
> - crtc_w = fb->width - x;
> - crtc_h = fb->height - y;
> - exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
> -   crtc_w, crtc_h, x, y, crtc_w, crtc_h);
> -
> - return 0;
> -}
> -
> -static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
> -   struct drm_framebuffer *old_fb)
> +static void
> +exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
>  {
>   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> - struct drm_framebuffer *fb = crtc->primary->fb;
> - unsigned int crtc_w;
> - unsigned int crtc_h;
> - int ret;
>  
> - /* when framebuffer changing is requested, crtc's dpms should be on */
> - if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
> - DRM_ERROR("failed framebuffer changing request.\n");
> - return -EPERM;
> - }
> -
> - ret = exynos_check_plane(crtc->primary, fb);
> - if (ret)
> - return ret;
> -
> - crtc_w = fb->width - x;
> - crtc_h = fb->height - y;
> - exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> - crtc_w, crtc_h, x, y, crtc_w, crtc_h);
> + if (WARN_ON(!crtc->state))
> + return;
>  
> - return 0;
> + if (exynos_crtc->ops->commit)
> + exynos_crtc->ops->commit(exynos_crtc);

This will be called again by crtc_funcs->commit from
drm_crtc_helper_set_mode. It seems to need to remove the call from
exynos_drm_crtc_commit like below.

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 48ccab7..aa981c2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -63,9 +63,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)

if (exynos_crtc->ops->win_commit)
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-
-   if (exynos_crtc->ops->commit)
-   exynos_crtc->ops->commit(exynos_crtc);
 }

 static bool

>  }
>  
>  static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
> @@ -158,8 +115,9 @@ static struct drm_crtc_helper_funcs 
> exynos_crtc_helper_funcs = {
>   .prepare= exynos_drm_crtc_prepare,
>   .commit = exynos_drm_crtc_commit,
>   .mode_fixup = exynos_drm_crtc_mode_fixup,
> - .mode_set   = exynos_drm_crtc_mode_set,
> - .mode_set_base  = exynos_drm_crtc_mode_set_base,
> + .mode_set   = drm_helper_crtc_mode_set,
> + .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
> + .mode_set_base  = drm_helper_crtc_mode_set_base,
>   .disable= exynos_drm_crtc_disable,
>  };
>  
> 

Thanks.


[PATCH v6 02/12] drm/exynos: atomic phase 1: use drm_plane_helper_disable()

2015-05-22 Thread Joonyoung Shim
On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> The atomic helper to disable planes also uses the optional
> .atomic_disable() helper. The unique operation it does is calling
> .win_disable()
> 
> exynos_drm_fb_get_buf_cnt() needs a fb check too to avoid a null pointer.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fb.c|  2 +-
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 29 -
>  2 files changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> index 142eb4e..bf814c8 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> @@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct 
> drm_framebuffer *fb)
>  
>   exynos_fb = to_exynos_fb(fb);
>  
> - return exynos_fb->buf_cnt;
> + return exynos_fb ? exynos_fb->buf_cnt : 0;

I think this should be checked by exynos_check_plane on plane disabling
routine whether fb is NULL or not.

>  }
>  
>  struct drm_framebuffer *
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
> b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> index b218b7a..87078db 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> @@ -162,21 +162,9 @@ exynos_update_plane(struct drm_plane *plane, struct 
> drm_crtc *crtc,
>   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
>  }
>  
> -static int exynos_disable_plane(struct drm_plane *plane)
> -{
> - struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
> - struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc);
> -
> - if (exynos_crtc && exynos_crtc->ops->win_disable)
> - exynos_crtc->ops->win_disable(exynos_crtc,
> -   exynos_plane->zpos);
> -
> - return 0;
> -}
> -
>  static struct drm_plane_funcs exynos_plane_funcs = {
>   .update_plane   = drm_plane_helper_update,
> - .disable_plane  = exynos_disable_plane,
> + .disable_plane  = drm_plane_helper_disable,
>   .destroy= drm_plane_cleanup,
>  };
>  
> @@ -201,9 +189,24 @@ static void exynos_plane_atomic_update(struct drm_plane 
> *plane,
>   state->src_w >> 16, state->src_h >> 16);
>  }
>  
> +static void exynos_plane_atomic_disable(struct drm_plane *plane,
> + struct drm_plane_state *old_state)

checkpatch error:

ERROR: code indent should use tabs where possible
#64: FILE: drivers/gpu/drm/exynos/exynos_drm_plane.c:193:
+^I^I^I^Istruct drm_plane_state *old_state)$

total: 1 errors, 0 warnings, 54 lines checked

> +{
> + struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
> + struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(old_state->crtc);
> +
> + if (!old_state->crtc)
> + return;
> +
> + if (exynos_crtc->ops->win_disable)
> + exynos_crtc->ops->win_disable(exynos_crtc,
> +   exynos_plane->zpos);
> +}
> +
>  static const struct drm_plane_helper_funcs plane_helper_funcs = {
>   .atomic_check = exynos_plane_atomic_check,
>   .atomic_update = exynos_plane_atomic_update,
> + .atomic_disable = exynos_plane_atomic_disable,
>  };
>  
>  static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
> 

Thanks.


[PATCH v6 01/12] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-22 Thread Joonyoung Shim
On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Rip out the check from exynos_update_plane() and create
> exynos_check_plane() for the check phase enabling use to use
> the atomic helpers to call our check and update phases when updating
> planes.
> 
> Update all users of exynos_update_plane() accordingly to call
> exynos_check_plane() before.
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 29 +++---
>  drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 
> +++
>  drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
>  3 files changed, 46 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 9006b94..61b8cfe 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
> *crtc, int x, int y,
>   struct drm_framebuffer *fb = crtc->primary->fb;
>   unsigned int crtc_w;
>   unsigned int crtc_h;
> + int ret;
>  
>   /* when framebuffer changing is requested, crtc's dpms should be on */
>   if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
> @@ -123,11 +124,16 @@ static int exynos_drm_crtc_mode_set_base(struct 
> drm_crtc *crtc, int x, int y,
>   return -EPERM;
>   }
>  
> + ret = exynos_check_plane(crtc->primary, fb);
> + if (ret)
> + return ret;
> +
>   crtc_w = fb->width - x;
>   crtc_h = fb->height - y;
> + exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> + crtc_w, crtc_h, x, y, crtc_w, crtc_h);
>  
> - return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> -crtc_w, crtc_h, x, y, crtc_w, crtc_h);

I still think to need "[PATCH] drm/exynos: fix source data argument for
plane" before merged atomic patches for bisect.

http://lists.freedesktop.org/archives/dri-devel/2015-April/081368.html

Thanks.


[PATCH v7 13/13] drm/exynos: remove unnecessary calls to disable_plane()

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

The planes are already disabled by the drm_atomic_helper_commit() code
so we don't need to disable the in these two places.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 11 ---
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  8 
 2 files changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index ca501a9..3fbc543 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -44,8 +44,6 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_plane *plane;
-   int ret;

if (!exynos_crtc->enabled)
return;
@@ -61,15 +59,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_OFF);

exynos_crtc->enabled = false;
-
-   drm_for_each_legacy_plane(plane, >dev->mode_config.plane_list) {
-   if (plane->crtc != crtc)
-   continue;
-
-   ret = plane->funcs->disable_plane(plane);
-   if (ret)
-   DRM_ERROR("Failed to disable plane %d\n", ret);
-   }
 }

 static bool
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c 
b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
index 0648ba4..7b89fd5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c
@@ -81,17 +81,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder 
*encoder)
 {
struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
struct exynos_drm_display *display = exynos_encoder->display;
-   struct drm_plane *plane;
-   struct drm_device *dev = encoder->dev;

if (display->ops->dpms)
display->ops->dpms(display, DRM_MODE_DPMS_OFF);
-
-   /* all planes connected to this encoder should be also disabled. */
-   drm_for_each_legacy_plane(plane, >mode_config.plane_list) {
-   if (plane->crtc && (plane->crtc == encoder->crtc))
-   plane->funcs->disable_plane(plane);
-   }
 }

 static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
-- 
2.1.0



[PATCH v7 12/13] drm/exynos: atomic dpms support

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Run dpms operations through the atomic intefaces. This basically removes
the .dpms() callback from econders and crtcs and use .disable() and
.enable() to turn the crtc on and off.

v2: Address comments by Joonyoung:
- make hdmi code call ->disable() instead of ->dpms()
- do not use WARN_ON on crtc enable/disable

v3: - Fix build failure after the hdmi change in v2
- Change dpms helper of ptn3460 bridge

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/bridge/ps8622.c |  2 +-
 drivers/gpu/drm/bridge/ptn3460.c|  2 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 95 -
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
 10 files changed, 69 insertions(+), 75 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
index b604326..d686235 100644
--- a/drivers/gpu/drm/bridge/ps8622.c
+++ b/drivers/gpu/drm/bridge/ps8622.c
@@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector 
*connector)
 }

 static const struct drm_connector_funcs ps8622_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ps8622_detect,
.destroy = ps8622_connector_destroy,
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 8ed3617..260bc9f 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct drm_connector 
*connector)
 }

 static struct drm_connector_funcs ptn3460_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
.destroy = ptn3460_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 195fe60..c9995b1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
drm_connector *connector)
 }

 static struct drm_connector_funcs exynos_dp_connector_funcs = {
-   .dpms = drm_helper_connector_dpms,
+   .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
.destroy = exynos_dp_connector_destroy,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index fd5ef2c..ca501a9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -22,48 +22,54 @@
 #include "exynos_drm_encoder.h"
 #include "exynos_drm_plane.h"

-static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
+static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);

-   DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
-
-   if (exynos_crtc->dpms == mode) {
-   DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
+   if (exynos_crtc->enabled)
return;
-   }
-
-   if (mode > DRM_MODE_DPMS_ON) {
-   /* wait for the completion of page flip. */
-   if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
-   (exynos_crtc->event == NULL), HZ/20))
-   exynos_crtc->event = NULL;
-   drm_crtc_vblank_off(crtc);
-   }

if (exynos_crtc->ops->dpms)
-   exynos_crtc->ops->dpms(exynos_crtc, mode);
+   exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);

-   exynos_crtc->dpms = mode;
+   exynos_crtc->enabled = true;

-   if (mode == DRM_MODE_DPMS_ON)
-   drm_crtc_vblank_on(crtc);
-}
+   drm_crtc_vblank_on(crtc);

-static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
-{
-   /* drm framework doesn't check NULL. */
+   if (exynos_crtc->ops->win_commit)
+   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
 }

-static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
+static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct exynos_drm_plane *exynos_plane 

[PATCH v7 11/13] drm/exynos: don't disable unused functions at init

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Everything starts disabled so we don't really need to disable anything.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index e71e331..e0b085b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -275,9 +275,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev)

}

-   /* disable all the possible outputs/crtcs before entering KMS mode */
-   drm_helper_disable_unused_functions(dev);
-
ret = drm_fb_helper_initial_config(helper, PREFERRED_BPP);
if (ret < 0) {
DRM_ERROR("failed to set up hw configuration.\n");
-- 
2.1.0



[PATCH v7 10/13] drm/exynos: remove exported functions from exynos_drm_plane

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that no one is using the functions exported by exynos_drm_plane due
to the atomic conversion we can make remove some of the them or make them
static.

v2: remove unused exynos_drm_crtc

v3: fix checkpatch error (reported by Joonyoung)

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 98 +--
 drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 
 2 files changed, 42 insertions(+), 67 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index e052c72..54a83ee 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -62,38 +62,13 @@ static int exynos_plane_get_size(int start, unsigned 
length, unsigned last)
return size;
 }

-int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
-{
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   int nr;
-   int i;
-
-   if (!fb)
-   return 0;
-
-   nr = exynos_drm_fb_get_buf_cnt(fb);
-   for (i = 0; i < nr; i++) {
-   struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
-
-   if (!buffer) {
-   DRM_DEBUG_KMS("buffer is null\n");
-   return -EFAULT;
-   }
-
-   exynos_plane->dma_addr[i] = buffer->dma_addr + fb->offsets[i];
-
-   DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
-   i, (unsigned long)exynos_plane->dma_addr[i]);
-   }
-
-   return 0;
-}
-
-void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
- struct drm_framebuffer *fb, int crtc_x, int crtc_y,
- unsigned int crtc_w, unsigned int crtc_h,
- uint32_t src_x, uint32_t src_y,
- uint32_t src_w, uint32_t src_h)
+static void exynos_plane_mode_set(struct drm_plane *plane,
+ struct drm_crtc *crtc,
+ struct drm_framebuffer *fb,
+ int crtc_x, int crtc_y,
+ unsigned int crtc_w, unsigned int crtc_h,
+ uint32_t src_x, uint32_t src_y,
+ uint32_t src_w, uint32_t src_h)
 {
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
unsigned int actual_w;
@@ -148,24 +123,6 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct 
drm_crtc *crtc,
plane->crtc = crtc;
 }

-void
-exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
-struct drm_framebuffer *fb, int crtc_x, int crtc_y,
-unsigned int crtc_w, unsigned int crtc_h,
-uint32_t src_x, uint32_t src_y,
-uint32_t src_w, uint32_t src_h)
-{
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-
-   exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
- crtc_w, crtc_h, src_x >> 16, src_y >> 16,
- src_w >> 16, src_h >> 16);
-
-   if (exynos_crtc->ops->win_commit)
-   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = drm_atomic_helper_update_plane,
.disable_plane  = drm_atomic_helper_disable_plane,
@@ -178,22 +135,51 @@ static struct drm_plane_funcs exynos_plane_funcs = {
 static int exynos_plane_atomic_check(struct drm_plane *plane,
 struct drm_plane_state *state)
 {
-   return exynos_check_plane(plane, state->fb);
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+   int nr;
+   int i;
+
+   if (!state->fb)
+   return 0;
+
+   nr = exynos_drm_fb_get_buf_cnt(state->fb);
+   for (i = 0; i < nr; i++) {
+   struct exynos_drm_gem_buf *buffer =
+   exynos_drm_fb_buffer(state->fb, i);
+
+   if (!buffer) {
+   DRM_DEBUG_KMS("buffer is null\n");
+   return -EFAULT;
+   }
+
+   exynos_plane->dma_addr[i] = buffer->dma_addr +
+   state->fb->offsets[i];
+
+   DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
+   i, (unsigned long)exynos_plane->dma_addr[i]);
+   }
+
+   return 0;
 }

 static void exynos_plane_atomic_update(struct drm_plane *plane,
   struct drm_plane_state *old_state)
 {
struct drm_plane_state *state = plane->state;
+   struct 

[PATCH v7 09/13] drm/exynos: atomic phase 3: convert page flips

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

PageFlips now use the atomic helper to work through the atomic modesetting
API. Async page flips are not supported yet.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 63 +---
 drivers/gpu/drm/exynos/exynos_drm_fb.c   |  9 -
 2 files changed, 9 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 9e14ba3..fd5ef2c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -120,67 +120,6 @@ static struct drm_crtc_helper_funcs 
exynos_crtc_helper_funcs = {
.disable= exynos_drm_crtc_disable,
 };

-static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
-struct drm_framebuffer *fb,
-struct drm_pending_vblank_event *event,
-uint32_t page_flip_flags)
-{
-   struct drm_device *dev = crtc->dev;
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   unsigned int crtc_w, crtc_h;
-   int ret;
-
-   /* when the page flip is requested, crtc's dpms should be on */
-   if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
-   DRM_ERROR("failed page flip request.\n");
-   return -EINVAL;
-   }
-
-   if (!event)
-   return -EINVAL;
-
-   spin_lock_irq(>event_lock);
-   if (exynos_crtc->event) {
-   ret = -EBUSY;
-   goto out;
-   }
-
-   ret = exynos_check_plane(crtc->primary, fb);
-   if (ret)
-   goto out;
-
-   ret = drm_vblank_get(dev, exynos_crtc->pipe);
-   if (ret) {
-   DRM_DEBUG("failed to acquire vblank counter\n");
-   goto out;
-   }
-
-   exynos_crtc->event = event;
-   spin_unlock_irq(>event_lock);
-
-   /*
-* the pipe from user always is 0 so we can set pipe number
-* of current owner to event.
-*/
-   event->pipe = exynos_crtc->pipe;
-
-   crtc->primary->fb = fb;
-   crtc_w = fb->width - crtc->x;
-   crtc_h = fb->height - crtc->y;
-   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-   crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
-   crtc_w << 16, crtc_h << 16);
-
-   if (crtc->primary->state)
-   drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
-
-   return 0;
-
-out:
-   spin_unlock_irq(>event_lock);
-   return ret;
-}
-
 static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
@@ -194,7 +133,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)

 static struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_atomic_helper_set_config,
-   .page_flip  = exynos_drm_crtc_page_flip,
+   .page_flip  = drm_atomic_helper_page_flip,
.destroy= exynos_drm_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 19c0642..05d229c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -266,11 +266,18 @@ static void exynos_drm_output_poll_changed(struct 
drm_device *dev)
exynos_drm_fbdev_init(dev);
 }

+static int exynos_atomic_commit(struct drm_device *dev,
+   struct drm_atomic_state *state,
+   bool async)
+{
+   return drm_atomic_helper_commit(dev, state, false);
+}
+
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,
.output_poll_changed = exynos_drm_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
-   .atomic_commit = drm_atomic_helper_commit,
+   .atomic_commit = exynos_atomic_commit,
 };

 void exynos_drm_mode_config_init(struct drm_device *dev)
-- 
2.1.0



[PATCH v7 08/13] drm/exynos: atomic phase 3: use atomic .set_config helper

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that phase 1 and 2 are complete switch .set_config helper to
use the atomic one.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index fe77516..9e14ba3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -193,7 +193,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)
 }

 static struct drm_crtc_funcs exynos_crtc_funcs = {
-   .set_config = drm_crtc_helper_set_config,
+   .set_config = drm_atomic_helper_set_config,
.page_flip  = exynos_drm_crtc_page_flip,
.destroy= exynos_drm_crtc_destroy,
.reset = drm_atomic_helper_crtc_reset,
-- 
2.1.0



[PATCH v7 07/13] drm/exynos: atomic phase 3: atomic updates of planes

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Now that phase 1 and 2 are complete we can switch the update/disable_plane
callbacks to their atomic version.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_fb.c| 3 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 142eb4e..19c0642 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #include "exynos_drm_drv.h"
@@ -268,6 +269,8 @@ static void exynos_drm_output_poll_changed(struct 
drm_device *dev)
 static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
.fb_create = exynos_user_fb_create,
.output_poll_changed = exynos_drm_output_poll_changed,
+   .atomic_check = drm_atomic_helper_check,
+   .atomic_commit = drm_atomic_helper_commit,
 };

 void exynos_drm_mode_config_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 43ada86..e052c72 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -167,8 +167,8 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
 }

 static struct drm_plane_funcs exynos_plane_funcs = {
-   .update_plane   = drm_plane_helper_update,
-   .disable_plane  = drm_plane_helper_disable,
+   .update_plane   = drm_atomic_helper_update_plane,
+   .disable_plane  = drm_atomic_helper_disable_plane,
.destroy= drm_plane_cleanup,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
-- 
2.1.0



[PATCH v7 06/13] drm/exynos: atomic phase 2: keep track of framebuffer pointer

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Use drm_atomic_set_fb_for_plane() in the legacy page_flip path to keep
track of the framebuffer pointer and reference.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 5bfee9b..fe77516 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -171,6 +171,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
crtc_w << 16, crtc_h << 16);

+   if (crtc->primary->state)
+   drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
+
return 0;

 out:
-- 
2.1.0



[PATCH v7 05/13] drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy()

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Set CRTC, planes and connectors to use the default implementations from
the atomic helper library. The helpers will work to keep track of state
for each DRM object.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/bridge/ps8622.c   | 4 
 drivers/gpu/drm/bridge/ptn3460.c  | 4 
 drivers/gpu/drm/exynos/exynos_dp_core.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 5 +
 drivers/gpu/drm/exynos/exynos_drm_dpi.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 2 ++
 drivers/gpu/drm/exynos/exynos_drm_dsi.c   | 4 
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c  | 4 
 drivers/gpu/drm/exynos/exynos_hdmi.c  | 4 
 10 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ps8622.c b/drivers/gpu/drm/bridge/ps8622.c
index e895aa7..b604326 100644
--- a/drivers/gpu/drm/bridge/ps8622.c
+++ b/drivers/gpu/drm/bridge/ps8622.c
@@ -31,6 +31,7 @@
 #include "drmP.h"
 #include "drm_crtc.h"
 #include "drm_crtc_helper.h"
+#include "drm_atomic_helper.h"

 /* Brightness scale on the Parade chip */
 #define PS8622_MAX_BRIGHTNESS 0xff
@@ -502,6 +503,9 @@ static const struct drm_connector_funcs 
ps8622_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ps8622_detect,
.destroy = ps8622_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };

 static int ps8622_attach(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c
index 9d2f053..8ed3617 100644
--- a/drivers/gpu/drm/bridge/ptn3460.c
+++ b/drivers/gpu/drm/bridge/ptn3460.c
@@ -27,6 +27,7 @@

 #include "drm_crtc.h"
 #include "drm_crtc_helper.h"
+#include "drm_atomic_helper.h"
 #include "drm_edid.h"
 #include "drmP.h"

@@ -263,6 +264,9 @@ static struct drm_connector_funcs ptn3460_connector_funcs = 
{
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = ptn3460_detect,
.destroy = ptn3460_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };

 static int ptn3460_bridge_attach(struct drm_bridge *bridge)
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 30feb7d..195fe60 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 

@@ -957,6 +958,9 @@ static struct drm_connector_funcs exynos_dp_connector_funcs 
= {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = exynos_dp_detect,
.destroy = exynos_dp_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };

 static int exynos_dp_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index c524f0c..5bfee9b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -14,6 +14,8 @@

 #include 
 #include 
+#include 
+#include 

 #include "exynos_drm_crtc.h"
 #include "exynos_drm_drv.h"
@@ -191,6 +193,9 @@ static struct drm_crtc_funcs exynos_crtc_funcs = {
.set_config = drm_crtc_helper_set_config,
.page_flip  = exynos_drm_crtc_page_flip,
.destroy= exynos_drm_crtc_destroy,
+   .reset = drm_atomic_helper_crtc_reset,
+   .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };

 struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 37678cf..ced5c23 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 

@@ -63,6 +64,9 @@ static struct drm_connector_funcs exynos_dpi_connector_funcs 
= {
.detect = exynos_dpi_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = exynos_dpi_connector_destroy,
+   .reset = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };

 static int 

[PATCH v7 04/13] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

The new atomic infrastructure needs the .mode_set_nofb() callback to
update CRTC timings before setting any plane.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 82 +---
 1 file changed, 11 insertions(+), 71 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 27cc450..c524f0c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -62,9 +62,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)

if (exynos_crtc->ops->win_commit)
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-
-   if (exynos_crtc->ops->commit)
-   exynos_crtc->ops->commit(exynos_crtc);
 }

 static bool
@@ -81,60 +78,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
return true;
 }

-static int
-exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode, int x, int y,
- struct drm_framebuffer *old_fb)
-{
-   struct drm_framebuffer *fb = crtc->primary->fb;
-   unsigned int crtc_w;
-   unsigned int crtc_h;
-   int ret;
-
-   /*
-* copy the mode data adjusted by mode_fixup() into crtc->mode
-* so that hardware can be seet to proper mode.
-*/
-   memcpy(>mode, adjusted_mode, sizeof(*adjusted_mode));
-
-   ret = exynos_check_plane(crtc->primary, fb);
-   if (ret < 0)
-   return ret;
-
-   crtc_w = fb->width - x;
-   crtc_h = fb->height - y;
-   exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, x, y, crtc_w, crtc_h);
-
-   return 0;
-}
-
-static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
- struct drm_framebuffer *old_fb)
+static void
+exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
 {
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_framebuffer *fb = crtc->primary->fb;
-   unsigned int crtc_w;
-   unsigned int crtc_h;
-   int ret;

-   /* when framebuffer changing is requested, crtc's dpms should be on */
-   if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
-   DRM_ERROR("failed framebuffer changing request.\n");
-   return -EPERM;
-   }
-
-   ret = exynos_check_plane(crtc->primary, fb);
-   if (ret)
-   return ret;
-
-   crtc_w = fb->width - x;
-   crtc_h = fb->height - y;
-   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-   crtc_w, crtc_h, x << 16, y << 16,
-   crtc_w << 16, crtc_h << 16);
+   if (WARN_ON(!crtc->state))
+   return;

-   return 0;
+   if (exynos_crtc->ops->commit)
+   exynos_crtc->ops->commit(exynos_crtc);
 }

 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -159,8 +112,9 @@ static struct drm_crtc_helper_funcs 
exynos_crtc_helper_funcs = {
.prepare= exynos_drm_crtc_prepare,
.commit = exynos_drm_crtc_commit,
.mode_fixup = exynos_drm_crtc_mode_fixup,
-   .mode_set   = exynos_drm_crtc_mode_set,
-   .mode_set_base  = exynos_drm_crtc_mode_set_base,
+   .mode_set   = drm_helper_crtc_mode_set,
+   .mode_set_nofb  = exynos_drm_crtc_mode_set_nofb,
+   .mode_set_base  = drm_helper_crtc_mode_set_base,
.disable= exynos_drm_crtc_disable,
 };

@@ -211,23 +165,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc->primary->fb = fb;
crtc_w = fb->width - crtc->x;
crtc_h = fb->height - crtc->y;
-<<< HEAD
-   ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
- crtc_w << 16, crtc_h << 16);
-   if (ret) {
-   crtc->primary->fb = old_fb;
-   spin_lock_irq(>event_lock);
-   exynos_crtc->event = NULL;
-   drm_vblank_put(dev, exynos_crtc->pipe);
-   spin_unlock_irq(>event_lock);
-   return ret;
-   }
-===
exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-   crtc_w, crtc_h, crtc->x, crtc->y,
-   crtc_w, crtc_h);
->>> 2f6d1f4... drm/exynos: atomic phase 1: use drm_plane_helper_update()
+   crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
+   crtc_w << 16, crtc_h << 16);

return 0;

-- 
2.1.0



[PATCH v7 03/13] drm/exynos: atomic phase 1: use drm_plane_helper_disable()

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

The atomic helper to disable planes also uses the optional
.atomic_disable() helper. The unique operation it does is calling
.win_disable()

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi 
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 32 ++-
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index b218b7a..a0fdfe2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -67,6 +67,9 @@ int exynos_check_plane(struct drm_plane *plane, struct 
drm_framebuffer *fb)
int nr;
int i;

+   if (!fb)
+   return 0;
+
nr = exynos_drm_fb_get_buf_cnt(fb);
for (i = 0; i < nr; i++) {
struct exynos_drm_gem_buf *buffer = exynos_drm_fb_buffer(fb, i);
@@ -162,21 +165,9 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
 }

-static int exynos_disable_plane(struct drm_plane *plane)
-{
-   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(plane->crtc);
-
-   if (exynos_crtc && exynos_crtc->ops->win_disable)
-   exynos_crtc->ops->win_disable(exynos_crtc,
- exynos_plane->zpos);
-
-   return 0;
-}
-
 static struct drm_plane_funcs exynos_plane_funcs = {
.update_plane   = drm_plane_helper_update,
-   .disable_plane  = exynos_disable_plane,
+   .disable_plane  = drm_plane_helper_disable,
.destroy= drm_plane_cleanup,
 };

@@ -201,9 +192,24 @@ static void exynos_plane_atomic_update(struct drm_plane 
*plane,
state->src_w >> 16, state->src_h >> 16);
 }

+static void exynos_plane_atomic_disable(struct drm_plane *plane,
+   struct drm_plane_state *old_state)
+{
+   struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
+   struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(old_state->crtc);
+
+   if (!old_state->crtc)
+   return;
+
+   if (exynos_crtc->ops->win_disable)
+   exynos_crtc->ops->win_disable(exynos_crtc,
+ exynos_plane->zpos);
+}
+
 static const struct drm_plane_helper_funcs plane_helper_funcs = {
.atomic_check = exynos_plane_atomic_check,
.atomic_update = exynos_plane_atomic_update,
+   .atomic_disable = exynos_plane_atomic_disable,
 };

 static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
-- 
2.1.0



[PATCH v7 02/13] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Rip out the check from exynos_update_plane() and create
exynos_check_plane() for the check phase enabling use to use
the atomic helpers to call our check and update phases when updating
planes.

Update all users of exynos_update_plane() accordingly to call
exynos_check_plane() before.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Joonyoung Shim 
Tested-by: Tobias Jakobi y
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 23 ++
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 +++
 drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
 3 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 363b019..27cc450 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
struct drm_framebuffer *fb = crtc->primary->fb;
unsigned int crtc_w;
unsigned int crtc_h;
+   int ret;

/* when framebuffer changing is requested, crtc's dpms should be on */
if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
@@ -123,12 +124,17 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
return -EPERM;
}

+   ret = exynos_check_plane(crtc->primary, fb);
+   if (ret)
+   return ret;
+
crtc_w = fb->width - x;
crtc_h = fb->height - y;
+   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+   crtc_w, crtc_h, x << 16, y << 16,
+   crtc_w << 16, crtc_h << 16);

-   return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-  crtc_w, crtc_h, x << 16, y << 16,
-  crtc_w << 16, crtc_h << 16);
+   return 0;
 }

 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -165,7 +171,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
 {
struct drm_device *dev = crtc->dev;
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
-   struct drm_framebuffer *old_fb = crtc->primary->fb;
unsigned int crtc_w, crtc_h;
int ret;

@@ -184,6 +189,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
goto out;
}

+   ret = exynos_check_plane(crtc->primary, fb);
+   if (ret)
+   goto out;
+
ret = drm_vblank_get(dev, exynos_crtc->pipe);
if (ret) {
DRM_DEBUG("failed to acquire vblank counter\n");
@@ -202,6 +211,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc->primary->fb = fb;
crtc_w = fb->width - crtc->x;
crtc_h = fb->height - crtc->y;
+<<< HEAD
ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
  crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
  crtc_w << 16, crtc_h << 16);
@@ -213,6 +223,11 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
spin_unlock_irq(>event_lock);
return ret;
}
+===
+   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
+   crtc_w, crtc_h, crtc->x, crtc->y,
+   crtc_w, crtc_h);
+>>> 2f6d1f4... drm/exynos: atomic phase 1: use drm_plane_helper_update()

return 0;

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c 
b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index b1180fb..b218b7a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -144,21 +144,15 @@ void exynos_plane_mode_set(struct drm_plane *plane, 
struct drm_crtc *crtc,
plane->crtc = crtc;
 }

-int
+void
 exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 struct drm_framebuffer *fb, int crtc_x, int crtc_y,
 unsigned int crtc_w, unsigned int crtc_h,
 uint32_t src_x, uint32_t src_y,
 uint32_t src_w, uint32_t src_h)
 {
-
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
-   int ret;
-
-   ret = exynos_check_plane(plane, fb);
-   if (ret < 0)
-   return ret;

exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
  crtc_w, crtc_h, src_x >> 16, src_y >> 16,
@@ -166,8 +160,6 @@ exynos_update_plane(struct drm_plane *plane, struct 
drm_crtc *crtc,

if (exynos_crtc->ops->win_commit)
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
-
-   return 0;
 }

 static int exynos_disable_plane(struct drm_plane *plane)
@@ -183,11 +175,37 @@ static int exynos_disable_plane(struct drm_plane *plane)
 }

[PATCH v7 01/13] drm/exynos: fix source data argument for plane

2015-05-22 Thread Gustavo Padovan
From: Joonyoung Shim 

The exynos_update_plane function needs 16.16 fixed point source data.

Signed-off-by: Joonyoung Shim 
Reviewed-by: Gustavo Padovan 
---
 drivers/gpu/drm/exynos/exynos_drm_crtc.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index 9006b94..363b019 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -127,7 +127,8 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc 
*crtc, int x, int y,
crtc_h = fb->height - y;

return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
-  crtc_w, crtc_h, x, y, crtc_w, crtc_h);
+  crtc_w, crtc_h, x << 16, y << 16,
+  crtc_w << 16, crtc_h << 16);
 }

 static void exynos_drm_crtc_disable(struct drm_crtc *crtc)
@@ -202,8 +203,8 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
crtc_w = fb->width - crtc->x;
crtc_h = fb->height - crtc->y;
ret = exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
- crtc_w, crtc_h, crtc->x, crtc->y,
- crtc_w, crtc_h);
+ crtc_w, crtc_h, crtc->x << 16, crtc->y << 16,
+ crtc_w << 16, crtc_h << 16);
if (ret) {
crtc->primary->fb = old_fb;
spin_lock_irq(>event_lock);
-- 
2.1.0



[PATCH v7 00/13] drm/exynos: atomic modesetting support

2015-05-22 Thread Gustavo Padovan
From: Gustavo Padovan 

Hi,

Here goes the full support for atomic modesetting on exynos. I've
split the patches in the various phases of atomic support.

v2: fixes comments by Joonyoung
- remove unused var in patch 09
- use ->disable instead of outdated ->dpms in hdmi code
- remove WARN_ON from crtc enable/disable

v3: fixes comment by Joonyoung
- move the removal of drm_helper_disable_unused_functions() to
separated patch

v4: add patches that remove unnecessary calls to disable_plane()

v5: fixes NULL CRTC crash on planes updates (reported by Inki and Tobias)

v6: rebase on latest exynos_drm_next

v7: fix comments by Joonyoung
- fix two checkpatch errors
- remove extra crtc->commit() call
- check for null fb on exynos_check_plane()

Gustavo Padovan (12):
  drm/exynos: atomic phase 1: use drm_plane_helper_update()
  drm/exynos: atomic phase 1: use drm_plane_helper_disable()
  drm/exynos: atomic phase 1: add .mode_set_nofb() callback
  drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
destroy()
  drm/exynos: atomic phase 2: keep track of framebuffer pointer
  drm/exynos: atomic phase 3: atomic updates of planes
  drm/exynos: atomic phase 3: use atomic .set_config helper
  drm/exynos: atomic phase 3: convert page flips
  drm/exynos: remove exported functions from exynos_drm_plane
  drm/exynos: don't disable unused functions at init
  drm/exynos: atomic dpms support
  drm/exynos: remove unnecessary calls to disable_plane()

Joonyoung Shim (1):
  drm/exynos: fix source data argument for plane

 drivers/gpu/drm/bridge/ps8622.c |   6 +-
 drivers/gpu/drm/bridge/ptn3460.c|   6 +-
 drivers/gpu/drm/exynos/exynos_dp_core.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_crtc.c| 211 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   2 +
 drivers/gpu/drm/exynos/exynos_drm_drv.h |   4 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   6 +-
 drivers/gpu/drm/exynos/exynos_drm_encoder.c |  35 +
 drivers/gpu/drm/exynos/exynos_drm_fb.c  |  10 ++
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c   |   3 -
 drivers/gpu/drm/exynos/exynos_drm_plane.c   | 124 +---
 drivers/gpu/drm/exynos/exynos_drm_plane.h   |  11 --
 drivers/gpu/drm/exynos/exynos_drm_vidi.c|   6 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c|  10 +-
 15 files changed, 183 insertions(+), 263 deletions(-)

-- 
2.1.0



[PATCH v6 11/12] drm/exynos: atomic dpms support

2015-05-22 Thread Gustavo Padovan
Hi Inki,

2015-05-22 Inki Dae :

> Hi,
> 
> On 2015년 05월 22일 05:02, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Run dpms operations through the atomic intefaces. This basically removes
> > the .dpms() callback from econders and crtcs and use .disable() and
> > .enable() to turn the crtc on and off.
> > 
> > v2: Address comments by Joonyoung:
> > - make hdmi code call ->disable() instead of ->dpms()
> > - do not use WARN_ON on crtc enable/disable
> > 
> > v3: - Fix build failure after the hdmi change in v2
> > - Change dpms helper of ptn3460 bridge
> > 
> > Signed-off-by: Gustavo Padovan 
> > ---
> >  drivers/gpu/drm/bridge/ps8622.c |  2 +-
> >  drivers/gpu/drm/bridge/ptn3460.c|  2 +-
> >  drivers/gpu/drm/exynos/exynos_dp_core.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_crtc.c| 99 
> > -
> >  drivers/gpu/drm/exynos/exynos_drm_dpi.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_drv.h |  4 +-
> >  drivers/gpu/drm/exynos/exynos_drm_dsi.c |  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_encoder.c | 27 ++--
> >  drivers/gpu/drm/exynos/exynos_drm_vidi.c|  2 +-
> >  drivers/gpu/drm/exynos/exynos_hdmi.c|  6 +-
> >  10 files changed, 71 insertions(+), 77 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/ps8622.c 
> > b/drivers/gpu/drm/bridge/ps8622.c
> > index b604326..d686235 100644
> > --- a/drivers/gpu/drm/bridge/ps8622.c
> > +++ b/drivers/gpu/drm/bridge/ps8622.c
> > @@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct 
> > drm_connector *connector)
> >  }
> >  
> >  static const struct drm_connector_funcs ps8622_connector_funcs = {
> > -   .dpms = drm_helper_connector_dpms,
> > +   .dpms = drm_atomic_helper_connector_dpms,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > .detect = ps8622_detect,
> > .destroy = ps8622_connector_destroy,
> > diff --git a/drivers/gpu/drm/bridge/ptn3460.c 
> > b/drivers/gpu/drm/bridge/ptn3460.c
> > index 8ed3617..260bc9f 100644
> > --- a/drivers/gpu/drm/bridge/ptn3460.c
> > +++ b/drivers/gpu/drm/bridge/ptn3460.c
> > @@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct 
> > drm_connector *connector)
> >  }
> >  
> >  static struct drm_connector_funcs ptn3460_connector_funcs = {
> > -   .dpms = drm_helper_connector_dpms,
> > +   .dpms = drm_atomic_helper_connector_dpms,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > .detect = ptn3460_detect,
> > .destroy = ptn3460_connector_destroy,
> > diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
> > b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > index 195fe60..c9995b1 100644
> > --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> > +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
> > @@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct 
> > drm_connector *connector)
> >  }
> >  
> >  static struct drm_connector_funcs exynos_dp_connector_funcs = {
> > -   .dpms = drm_helper_connector_dpms,
> > +   .dpms = drm_atomic_helper_connector_dpms,
> > .fill_modes = drm_helper_probe_single_connector_modes,
> > .detect = exynos_dp_detect,
> > .destroy = exynos_dp_connector_destroy,
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> > b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > index 3251652..92a5595 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > @@ -22,51 +22,57 @@
> >  #include "exynos_drm_encoder.h"
> >  #include "exynos_drm_plane.h"
> >  
> > -static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
> > +static void exynos_drm_crtc_enable(struct drm_crtc *crtc)
> >  {
> > struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> > +   struct exynos_drm_plane *exynos_plane = to_exynos_plane(crtc->primary);
> >  
> > -   DRM_DEBUG_KMS("crtc[%d] mode[%d]\n", crtc->base.id, mode);
> > -
> > -   if (exynos_crtc->dpms == mode) {
> > -   DRM_DEBUG_KMS("desired dpms mode is same as previous one.\n");
> > +   if (exynos_crtc->enabled)
> > return;
> > -   }
> > -
> > -   if (mode > DRM_MODE_DPMS_ON) {
> > -   /* wait for the completion of page flip. */
> > -   if (!wait_event_timeout(exynos_crtc->pending_flip_queue,
> > -   (exynos_crtc->event == NULL), HZ/20))
> > -   exynos_crtc->event = NULL;
> > -   drm_crtc_vblank_off(crtc);
> > -   }
> >  
> > if (exynos_crtc->ops->dpms)
> > -   exynos_crtc->ops->dpms(exynos_crtc, mode);
> > +   exynos_crtc->ops->dpms(exynos_crtc, DRM_MODE_DPMS_ON);
> >  
> > -   exynos_crtc->dpms = mode;
> > +   exynos_crtc->enabled = true;
> >  
> > -   if (mode == DRM_MODE_DPMS_ON)
> > -   drm_crtc_vblank_on(crtc);
> > -}
> > +   drm_crtc_vblank_on(crtc);
> >  
> > -static void exynos_drm_crtc_prepare(struct drm_crtc *crtc)
> > -{
> > -   /* drm framework doesn't check NULL. */
> > +   if 

[PATCH v6 03/12] drm/exynos: atomic phase 1: add .mode_set_nofb() callback

2015-05-22 Thread Gustavo Padovan
Hi Joonyoung,

2015-05-22 Joonyoung Shim :

> On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > The new atomic infrastructure needs the .mode_set_nofb() callback to
> > update CRTC timings before setting any plane.
> > 
> > Signed-off-by: Gustavo Padovan 
> > ---
> >  drivers/gpu/drm/exynos/exynos_drm_crtc.c | 60 
> > +---
> >  1 file changed, 9 insertions(+), 51 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> > b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > index 61b8cfe..54b74e1 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > @@ -81,59 +81,16 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,
> > return true;
> >  }
> >  
> > -static int
> > -exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode 
> > *mode,
> > - struct drm_display_mode *adjusted_mode, int x, int y,
> > - struct drm_framebuffer *old_fb)
> > -{
> > -   struct drm_framebuffer *fb = crtc->primary->fb;
> > -   unsigned int crtc_w;
> > -   unsigned int crtc_h;
> > -   int ret;
> > -
> > -   /*
> > -* copy the mode data adjusted by mode_fixup() into crtc->mode
> > -* so that hardware can be seet to proper mode.
> > -*/
> > -   memcpy(>mode, adjusted_mode, sizeof(*adjusted_mode));
> 
> This can cause any problem because exynos drm drivers use crtc->mode
> directly as adjusted_mode. It's necessary to consider using
> crtc_state->adjusted_mode in exynos drm drivers.

Yes, we are moving to use adjusted_mode in exynos, see this patch from
Tobias. It makes crtc uses the adjusted_mode instead. So I think it is
okay to remove this memcpy from here.

http://www.spinics.net/lists/linux-samsung-soc/msg44790.html

> 
> Please refer a patch of Daniel Stone using hwmode instead of mode but it
> cannot use for atomic.
> 
> http://lists.freedesktop.org/archives/dri-devel/2015-March/079546.html

> 
> > -
> > -   ret = exynos_check_plane(crtc->primary, fb);
> > -   if (ret < 0)
> > -   return ret;
> > -
> > -   crtc_w = fb->width - x;
> > -   crtc_h = fb->height - y;
> > -   exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
> > - crtc_w, crtc_h, x, y, crtc_w, crtc_h);
> > -
> > -   return 0;
> > -}
> > -
> > -static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int 
> > y,
> > - struct drm_framebuffer *old_fb)
> > +static void
> > +exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
> >  {
> > struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
> > -   struct drm_framebuffer *fb = crtc->primary->fb;
> > -   unsigned int crtc_w;
> > -   unsigned int crtc_h;
> > -   int ret;
> >  
> > -   /* when framebuffer changing is requested, crtc's dpms should be on */
> > -   if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
> > -   DRM_ERROR("failed framebuffer changing request.\n");
> > -   return -EPERM;
> > -   }
> > -
> > -   ret = exynos_check_plane(crtc->primary, fb);
> > -   if (ret)
> > -   return ret;
> > -
> > -   crtc_w = fb->width - x;
> > -   crtc_h = fb->height - y;
> > -   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> > -   crtc_w, crtc_h, x, y, crtc_w, crtc_h);
> > +   if (WARN_ON(!crtc->state))
> > +   return;
> >  
> > -   return 0;
> > +   if (exynos_crtc->ops->commit)
> > +   exynos_crtc->ops->commit(exynos_crtc);
> 
> This will be called again by crtc_funcs->commit from
> drm_crtc_helper_set_mode. It seems to need to remove the call from
> exynos_drm_crtc_commit like below.
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> index 48ccab7..aa981c2 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> @@ -63,9 +63,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)
>  
>   if (exynos_crtc->ops->win_commit)
>   exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
> -
> - if (exynos_crtc->ops->commit)
> - exynos_crtc->ops->commit(exynos_crtc);
>  }

Okay. Removed.

Gustavo


[PATCH v6 02/12] drm/exynos: atomic phase 1: use drm_plane_helper_disable()

2015-05-22 Thread Gustavo Padovan
Hi Joonyoung,

2015-05-22 Joonyoung Shim :

> On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > The atomic helper to disable planes also uses the optional
> > .atomic_disable() helper. The unique operation it does is calling
> > .win_disable()
> > 
> > exynos_drm_fb_get_buf_cnt() needs a fb check too to avoid a null pointer.
> > 
> > Signed-off-by: Gustavo Padovan 
> > ---
> >  drivers/gpu/drm/exynos/exynos_drm_fb.c|  2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_plane.c | 29 
> > -
> >  2 files changed, 17 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c 
> > b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> > index 142eb4e..bf814c8 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
> > @@ -136,7 +136,7 @@ unsigned int exynos_drm_fb_get_buf_cnt(struct 
> > drm_framebuffer *fb)
> >  
> > exynos_fb = to_exynos_fb(fb);
> >  
> > -   return exynos_fb->buf_cnt;
> > +   return exynos_fb ? exynos_fb->buf_cnt : 0;
> 
> I think this should be checked by exynos_check_plane on plane disabling
> routine whether fb is NULL or not.

Yeah, this makes more sense. I fixed this and checkpatch error.

Gustavo


[PATCH v6 01/12] drm/exynos: atomic phase 1: use drm_plane_helper_update()

2015-05-22 Thread Gustavo Padovan
Hi Joonyoung,

2015-05-22 Joonyoung Shim :

> On 05/22/2015 05:02 AM, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Rip out the check from exynos_update_plane() and create
> > exynos_check_plane() for the check phase enabling use to use
> > the atomic helpers to call our check and update phases when updating
> > planes.
> > 
> > Update all users of exynos_update_plane() accordingly to call
> > exynos_check_plane() before.
> > 
> > Signed-off-by: Gustavo Padovan 
> > ---
> >  drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 29 +++---
> >  drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 
> > +++
> >  drivers/gpu/drm/exynos/exynos_drm_plane.h |  2 +-
> >  3 files changed, 46 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c 
> > b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > index 9006b94..61b8cfe 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
> > @@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct 
> > drm_crtc *crtc, int x, int y,
> > struct drm_framebuffer *fb = crtc->primary->fb;
> > unsigned int crtc_w;
> > unsigned int crtc_h;
> > +   int ret;
> >  
> > /* when framebuffer changing is requested, crtc's dpms should be on */
> > if (exynos_crtc->dpms > DRM_MODE_DPMS_ON) {
> > @@ -123,11 +124,16 @@ static int exynos_drm_crtc_mode_set_base(struct 
> > drm_crtc *crtc, int x, int y,
> > return -EPERM;
> > }
> >  
> > +   ret = exynos_check_plane(crtc->primary, fb);
> > +   if (ret)
> > +   return ret;
> > +
> > crtc_w = fb->width - x;
> > crtc_h = fb->height - y;
> > +   exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> > +   crtc_w, crtc_h, x, y, crtc_w, crtc_h);
> >  
> > -   return exynos_update_plane(crtc->primary, crtc, fb, 0, 0,
> > -  crtc_w, crtc_h, x, y, crtc_w, crtc_h);
> 
> I still think to need "[PATCH] drm/exynos: fix source data argument for
> plane" before merged atomic patches for bisect.
> 
> http://lists.freedesktop.org/archives/dri-devel/2015-April/081368.html

Right. I'll send this patch along with my v7 already rebased on it, so
it will be easier to pick up everything.

Gustavo


[PATCH 3/4] drm/tegra: Add VIC support

2015-05-22 Thread Thierry Reding
On Thu, May 21, 2015 at 05:40:31PM +0300, Mikko Perttunen wrote:
> On 05/21/2015 04:20 PM, Arto Merilainen wrote:
[...]
> > +static int vic_is_addr_reg(struct device *dev, u32 class, u32 offset, u32 
> > val)
> > +{
> > +   struct vic *vic = dev_get_drvdata(dev);
> > +
> > +   /* handle host class */
> > +   if (class == HOST1X_CLASS_HOST1X) {
> > +   if (offset == 0x2b)
> > +   return true;
> > +   return false;
> 
> "return (offset == 0x2b);" perhaps?

I think this should really be extracted into a separate helper. If we
ever need to take into account additional offsets we would otherwise
have to extend every driver rather than just the helper.

Also I think the 0x2b should be replaced by some symbolic name.
According to the TRM 0x2b is the host1x class method named
NV_CLASS_HOST_INDCTRL_0. Oddly enough that doesn't seem to be an address
register. Instead the address seems to be in the INDOFF2 and INDOFF
methods (0x2c and 0x2d). I also can't tell from the TRM what exactly
these are supposed to do.

Arto, can you clarify?

> > +   if (IS_ERR(vic->rst)) {
> > +   dev_err(>dev, "cannot get reset\n");
> > +   return PTR_ERR(vic->rst);
> > +   }
> > +
> > +   platform_set_drvdata(pdev, vic);
> > +
> > +   INIT_LIST_HEAD(>client.base.list);
> > +   vic->client.base.ops = _client_ops;
> > +   vic->client.base.dev = dev;
> > +   vic->client.base.class = vic_config->class_id;
> > +   vic->client.base.syncpts = syncpts;
> > +   vic->client.base.num_syncpts = 1;
> > +   vic->dev = dev;
> > +   vic->config = vic_config;
> > +
> > +   INIT_LIST_HEAD(>client.list);
> > +   vic->client.ops = _ops;
> > +
> > +   err = tegra_powergate_sequence_power_up(vic->config->powergate_id,
> > +   vic->clk, vic->rst);
> > +   if (err) {
> > +   dev_err(dev, "cannot turn on the device\n");
> > +   return err;
> > +   }
> > +
> > +   err = host1x_client_register(>client.base);
> > +   if (err < 0) {
> 
> You used 'if (err) {' previously, so maybe also here.

For consistency with other Tegra DRM code these checks should use (at
least where possible) the (err < 0) notation.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150522/e894d08b/attachment.sig>


[Bug 90537] radeonsi bo/va conflict on RADEON_GEM_VA (rscreen->ws->buffer_from_handle returns NULL)

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90537

--- Comment #10 from pstglia at gmail.com ---
> BTW: Is it sufficient to put the ISO on an USB stick with usb-creator-gtk to
> get a bootable Android?
> 
> If yes then I'm clearly going to try that sooner or later.

Never tried usb-creator-gtk. But "dd" works just fine (/dev/sdb is the device
mapped to my usb flash drive):

dd if=android-x86-5.1_kernel_4.0.3_mesa_10.5.4_radeonsi_test_20150521.iso
of=/dev/sdb bs=65535

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


[Bug 90537] radeonsi bo/va conflict on RADEON_GEM_VA (rscreen->ws->buffer_from_handle returns NULL)

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90537

--- Comment #9 from Christian König  ---
(In reply to pstglia from comment #8)
> We've tested current patch on E1 2100 and Radeon HD 7750 - No problems
> observed so far.

Sounds good.

BTW: Is it sufficient to put the ISO on an USB stick with usb-creator-gtk to
get a bootable Android?

If yes then I'm clearly going to try that sooner or later.

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


[PATCH v2] drm: Only create a cmdline mode if no probed modes match

2015-05-22 Thread Ville Syrjälä
On Mon, Apr 20, 2015 at 02:28:56PM +0100, Chris Wilson wrote:
> The intention of using video=: is primarily to select
> the user's preferred resolution at startup. Currently we always create a
> new mode irrespective of whether the monitor has a native mode at the
> desired resolution. This has the issue that we may then select the fake
> mode rather the native mode during fb_helper->inital_config() and so
> if the fake mode is invalid we then end up with a loss of signal. Oops.
> This invalid fake mode would also be exported to userspace, who
> potentially may make the same mistake.
> 
> To avoid this issue, we filter out the added command line mode if we
> detect the desired resolution (and clock if specified) amongst the
> probed modes. This fixes the immediate problem of adding a duplicate
> mode, but perhaps more generically we should avoid adding a GTF mode if
> the monitor has an EDID that is not GTF-compatible, or similarly for
> CVT.
> 
> A second issue sneaked into this patch is to add the cmdline mode mode
> ahead of the absolute fallback 1024x768 mode. That is if the user has
> specified a mode that we create as a fallback, we do not need to add a
> second unused fallback mode.
> 
> Fixes regression from
> 
> commit eaf99c749d43ae74ac7ffece5512f3c73f01dfd2
> Author: Chris Wilson 
> Date:   Wed Aug 6 10:08:32 2014 +0200
> 
> drm: Perform cmdline mode parsing during connector initialisation
> 
> that breaks HDMI output on BeagleBone Black with LG TV (model 19LS4R-ZA).
> 
> v2: Explicitly delete our earlier cmdline mode
> 
> Reported-by: Radek Dostál 
> Signed-off-by: Chris Wilson 
> Cc: Radek Dostál 
> Cc: Jesse Barnes 
> Cc: Ville Syrjälä 
> Cc: Daniel Vetter 
> Cc: dri-devel at lists.freedesktop.org
> Cc: Julia Lemire 
> Cc: Dave Airlie 
> Cc: stable at vger.kernel.org
> ---
>  drivers/gpu/drm/drm_modes.c|  2 +-
>  drivers/gpu/drm/drm_probe_helper.c | 39 
> +++---
>  2 files changed, 37 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 213b11ea69b5..13293e009990 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1400,7 +1400,7 @@ drm_mode_create_from_cmdline_mode(struct drm_device 
> *dev,
>   if (!mode)
>   return NULL;
>  
> - mode->type |= DRM_MODE_TYPE_USERDEF;
> + mode->type |= DRM_MODE_TYPE_USERDEF | DRM_MODE_TYPE_DRIVER;

Why do we need the DRIVER flag here?

>   drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
>   return mode;
>  }
> diff --git a/drivers/gpu/drm/drm_probe_helper.c 
> b/drivers/gpu/drm/drm_probe_helper.c
> index 63503879a676..2ad8aaf46318 100644
> --- a/drivers/gpu/drm/drm_probe_helper.c
> +++ b/drivers/gpu/drm/drm_probe_helper.c
> @@ -79,13 +79,46 @@ drm_mode_validate_flag(const struct drm_display_mode 
> *mode,
>  
>  static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
>  {
> + struct drm_cmdline_mode *cmdline_mode;
>   struct drm_display_mode *mode;
>  
> - if (!connector->cmdline_mode.specified)
> + cmdline_mode = >cmdline_mode;
> + if (!cmdline_mode->specified)
>   return 0;
>  
> + /* Only add a GTF mode if we find no matching probed modes */
> + list_for_each_entry(mode, >probed_modes, head) {
> + if (mode->hdisplay != cmdline_mode->xres ||
> + mode->vdisplay != cmdline_mode->yres)
> + continue;
> +
> + if (cmdline_mode->refresh_specified &&
> + mode->vrefresh != cmdline_mode->refresh)
> + continue;
> +
> + /* Remove the existing fake mode */
> + list_for_each_entry(mode, >modes, head) {
> + if ((mode->type & (DRM_MODE_TYPE_DRIVER | 
> DRM_MODE_TYPE_USERDEF)) != (DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_USERDEF))
> + continue;

Doesn't drm_mode_connector_list_update() kill it from the list
eventually if there's no matching mode present on the
probed_modes list?

> +
> + if (mode->hdisplay != cmdline_mode->xres ||
> + mode->vdisplay != cmdline_mode->yres)
> + continue;
> +
> + if (cmdline_mode->refresh_specified &&
> + mode->vrefresh != cmdline_mode->refresh)
> + continue;
> +
> + list_del(>head);
> + drm_mode_destroy(connector->dev, mode);
> + break;
> + }
> +
> + return 0;
> + }
> +
>   mode = drm_mode_create_from_cmdline_mode(connector->dev,
> -  >cmdline_mode);
> +  cmdline_mode);
>   if (mode == NULL)
>   return 0;
>  
> @@ -179,9 +212,9 @@ static int 
> drm_helper_probe_single_connector_modes_merge_bits(struct 

[PATCH 3/4] drm/tegra: Add VIC support

2015-05-22 Thread Thierry Reding
On Thu, May 21, 2015 at 06:44:08PM +0300, Mikko Perttunen wrote:
> On 05/21/2015 06:10 PM, Arto Merilainen wrote:
> >...
> >>>+
> >>>+vic->rst = devm_reset_control_get(dev, "vic03");
> >>
> >>I might prefer just "vic" as the clock/reset name. The name is often
> >>used as a sort of "role" for the clock/reset for the device, not
> >>necessarily the raw name of the "correct" clock/reset.
> >>
> >
> >I considered that - but I then noticed that
> >drivers/clk/tegra/clk-tegra124.c was already using vic03 variant. I can
> >write a patch for changing that too.
> 
> Well, the two can be different; the clock-name in device tree kind of means
> "string that i use to refer to a clock that powers the VIC unit". It's not
> really a big deal though, both ways are used in DT bindings.

I'll insist on calling this vic in the clock-names property. The 03 is
as far as I can tell an encoding of the version number, so if you want
to call this vic04 in some future version we'll have to needlessly
patch the driver.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20150522/1582c555/attachment-0001.sig>


[PATCH 4/5] drm/exynos: mixer: do blending setup in mixer_cfg_layer()

2015-05-22 Thread Tobias Jakobi
Hello Joonyoung,

On 2015-05-22 11:12, Joonyoung Shim wrote:
> On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
>> This updates the blending setup when the layer configuration
>> changes (triggered by mixer_win_{commit,disable}).
>> 
>> Extra care has to be taken for the layer that is currently
>> being enabled/disabled.
>> 
>> Signed-off-by: Tobias Jakobi 
>> ---
>>  drivers/gpu/drm/exynos/exynos_mixer.c | 23 +++
>>  1 file changed, 23 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
>> b/drivers/gpu/drm/exynos/exynos_mixer.c
>> index 3ab7a01..430d10c 100644
>> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
>> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
>> @@ -177,6 +177,18 @@ static inline bool is_alpha_format(const struct 
>> mixer_context* ctx, unsigned int
>>  }
>>  }
>> 
>> +static inline unsigned int layer_bitmask(const struct mixer_context* 
>> ctx)
>> +{
>> +unsigned int i, mask = 0;
>> +
>> +for (i = 0; i < MIXER_WIN_NR; ++i) {
>> +if (ctx->planes[i].enabled)
>> +mask |= (1 << i);
>> +}
>> +
>> +return mask;
>> +}
>> +
>>  static inline u32 vp_reg_read(struct mixer_resources *res, u32 
>> reg_id)
>>  {
>>  return readl(res->vp_regs + reg_id);
>> @@ -513,6 +525,7 @@ static void mixer_cfg_rgb_fmt(struct mixer_context 
>> *ctx, unsigned int height)
>>  static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int 
>> win, bool enable)
>>  {
>>  struct mixer_resources *res = >mixer_res;
>> +unsigned int enable_state;
>>  u32 val = enable ? ~0 : 0;
>> 
>>  switch (win) {
>> @@ -530,6 +543,16 @@ static void mixer_cfg_layer(struct mixer_context 
>> *ctx, unsigned int win, bool en
>>  }
>>  break;
>>  }
>> +
>> +/* Determine the current enabled/disabled state of the layers. */
>> +enable_state = layer_bitmask(ctx);
>> +if (enable)
>> +enable_state |= (1 << win);
>> +else
>> +enable_state &= ~(1 << win);
> 
> I think way to remove to get enable_state of plane everytime, maybe
> using atomic state information?
I had the same idea, but I don't know even about the atomic 
infrastructure to evaluate if this is possible. I guess Gustavo would be 
the one who could answer this.



> 
>> +
>> +/* Layer configuration has changed, update blending setup. */
>> +mixer_layer_blending(ctx, enable_state);
>>  }
>> 
>>  static void mixer_run(struct mixer_context *ctx)
>> 

With best wishes,
Tobias



[Bug 90537] radeonsi bo/va conflict on RADEON_GEM_VA (rscreen->ws->buffer_from_handle returns NULL)

2015-05-22 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90537

--- Comment #8 from pstglia at gmail.com ---
Christian,
Thanks for the explanations.

Michel/Christian,

If there's anything I can do to provide more info/debug please let me now. 

We've tested current patch on E1 2100 and Radeon HD 7750 - No problems observed
so far.

Thanks,
pstglia

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


[PATCH 2/5] drm/exynos: mixer: introduce mixer_layer_blending()

2015-05-22 Thread Tobias Jakobi
Hello Joonyoung,

On 2015-05-22 11:12, Joonyoung Shim wrote:
> On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
>> This analyses the current layer configuration (which layers
>> are enabled, which have alpha-pixelformat, etc.) and setups
>> blending accordingly.
>> 
>> We currently disable all kinds of blending for the bottom-most
>> layer, since configuration of the mixer background is not
>> yet exposed.
>> Also blending is only enabled when the layer has a pixelformat
>> with alpha attached.
>> 
>> Signed-off-by: Tobias Jakobi 
>> ---
>>  drivers/gpu/drm/exynos/exynos_mixer.c | 108 
>> ++
>>  drivers/gpu/drm/exynos/regs-mixer.h   |   1 +
>>  2 files changed, 109 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
>> b/drivers/gpu/drm/exynos/exynos_mixer.c
>> index e4a5e76..5e95ef2 100644
>> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
>> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
>> @@ -165,6 +165,18 @@ static const u8 filter_cr_horiz_tap4[] = {
>>  70, 59, 48, 37, 27, 19, 11, 5,
>>  };
>> 
>> +static inline bool is_alpha_format(const struct mixer_context* ctx, 
>> unsigned int win)
>> +{
>> +switch (ctx->planes[win].pixel_format) {
>> +case DRM_FORMAT_ARGB:
>> +case DRM_FORMAT_ARGB1555:
>> +case DRM_FORMAT_ARGB:
>> +return true;
>> +default:
>> +return false;
>> +}
>> +}
>> +
>>  static inline u32 vp_reg_read(struct mixer_resources *res, u32 
>> reg_id)
>>  {
>>  return readl(res->vp_regs + reg_id);
>> @@ -322,6 +334,102 @@ static void mixer_layer_priority(struct 
>> mixer_context *ctx)
>>  mixer_reg_write(>mixer_res, MXR_LAYER_CFG, val);
>>  }
>> 
>> +/* Configure blending for bottom-most layer. */
>> +static void mixer_bottom_layer(struct mixer_context *ctx,
>> +const struct layer_config *cfg)
>> +{
>> +u32 val;
>> +struct mixer_resources *res = >mixer_res;
>> +
>> +if (cfg->index == 2) {
>> +val = 0; /* use defaults for video layer */
>> +mixer_reg_write(res, MXR_VIDEO_CFG, val);
>> +} else {
>> +val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */
>> +
>> +/* Don't blend bottom-most layer onto the mixer background. */
>> +mixer_reg_writemask(res, MXR_GRAPHIC_CFG(cfg->index),
>> +val, MXR_GRP_CFG_MISC_MASK);
>> +}
>> +}
>> +
>> +static void mixer_general_layer(struct mixer_context *ctx,
>> +const struct layer_config *cfg)
>> +{
>> +u32 val;
>> +struct mixer_resources *res = >mixer_res;
>> +
>> +if (is_alpha_format(ctx, cfg->index)) {
>> +val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */
>> +val |= MXR_GRP_CFG_BLEND_PRE_MUL;
>> +val |= MXR_GRP_CFG_PIXEL_BLEND_EN; /* blending based on pixel 
>> alpha 
>> */
>> +
>> +/* The video layer never has an alpha pixelformat. */
>> +mixer_reg_writemask(res, MXR_GRAPHIC_CFG(cfg->index),
>> +val, MXR_GRP_CFG_MISC_MASK);
>> +} else {
>> +if (cfg->index == 2) {
>> +/*
>> + * No blending at the moment since the NV12/NV21 
>> pixelformats 
>> don't
>> + * have an alpha channel. However the mixer supports a 
>> global 
>> alpha
>> + * value for a layer. Once this functionality is 
>> exposed, we can
>> + * support blending of the video layer through this.
>> + */
>> +val = 0;
>> +mixer_reg_write(res, MXR_VIDEO_CFG, val);
>> +} else {
>> +val = MXR_GRP_CFG_COLOR_KEY_DISABLE;
>> +mixer_reg_writemask(res, MXR_GRAPHIC_CFG(cfg->index),
>> +val, MXR_GRP_CFG_MISC_MASK);
>> +}
>> +}
>> +}
>> +
>> +static void mixer_layer_blending(struct mixer_context *ctx, unsigned 
>> int enable_state)
>> +{
>> +const struct layer_config *cfg;
>> +unsigned int i = 0;
>> +unsigned int index;
>> +
>> +/* Find bottom-most enabled layer. */
>> +cfg = NULL;
>> +while (i < ctx->num_layer) {
>> +index = ctx->layer_config[i].index;
>> +++i;
> 
> Don't use priority?
Used in mixer_layer_priority(), see first patch.



> 
>> +
>> +if (enable_state & (1 << index)) {
>> +cfg = >layer_config[i-1];
>> +break;
>> +}
>> +}
>> +
>> +/* No enabled layers found, nothing to do. */
>> +if (!cfg)
>> +return;
>> +
>> +mixer_bottom_layer(ctx, cfg);
>> +
>> +while (1) {
>> +/* Find the next layer. */
>> +cfg = NULL;
>> +while (i < ctx->num_layer) {
>> +index = ctx->layer_config[i].index;
>> +++i;
>> +
>> +if (enable_state & (1 

[PATCH 1/5] drm/exynos: mixer: refactor layer setup

2015-05-22 Thread Tobias Jakobi
Hello Joonyoung,

On 2015-05-22 11:12, Joonyoung Shim wrote:
> On 05/06/2015 10:36 PM, Tobias Jakobi wrote:
>> First step in allowing a more generic way to setup complex
>> blending for the different layers.
>> 
>> Signed-off-by: Tobias Jakobi 
>> ---
>>  drivers/gpu/drm/exynos/exynos_mixer.c | 90 
>> ++-
>>  1 file changed, 79 insertions(+), 11 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
>> b/drivers/gpu/drm/exynos/exynos_mixer.c
>> index 4a1656b..e4a5e76 100644
>> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
>> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
>> @@ -63,6 +63,11 @@ struct mixer_resources {
>>  struct clk  *mout_mixer;
>>  };
>> 
>> +struct layer_config {
>> +unsigned int index;
>> +unsigned int priority;
> 
> I think layer index and priority information can go to struct
> exynos_drm_plane.
No, because of two reasons:
- plane configuration is done at run-time while this here is const 
static
- this is specific to the mixer


> 
>> +};
>> +
>>  enum mixer_version_id {
>>  MXR_VER_0_0_0_16,
>>  MXR_VER_16_0_33_0,
>> @@ -75,6 +80,8 @@ struct mixer_context {
>>  struct drm_device   *drm_dev;
>>  struct exynos_drm_crtc  *crtc;
>>  struct exynos_drm_plane planes[MIXER_WIN_NR];
>> +const struct layer_config *layer_config;
>> +unsigned int num_layer;
>>  int pipe;
>>  boolinterlace;
>>  boolpowered;
>> @@ -95,6 +102,40 @@ struct mixer_drv_data {
>>  boolhas_sclk;
>>  };
>> 
>> +/*
>> + * The default layer priorities. A higher priority means that
>> + * the layer is at the top of layer stack.
>> + * The current configuration assumes the following usage scenario:
>> + * layer1: OSD [top]
>> + * layer0: main framebuffer
>> + * video layer: video overlay [bottom]
>> + * Note that the video layer is only usable when the
>> + * video processor is available.
>> + */
>> +
>> +static const struct layer_config default_layer_config[] = {
>> +{
>> +.index = 0, /* layer0 */
>> +.priority = 1
>> +}, {
>> +.index = 1, /* layer1 */
>> +.priority = 2
>> +}
>> +};
>> +
>> +static const struct layer_config vp_layer_config[] = {
>> +{
>> +.index = 2, /* video layer */
>> +.priority = 1
>> +}, {
>> +.index = 0, /* layer0 */
>> +.priority = 2
>> +}, {
>> +.index = 1, /* layer1 */
>> +.priority = 3
>> +}
>> +};
>> +
> 
> I feel there is no reason to split config, actually video layer exists
> and video layer isn't enabled if no vp even if we use 3 layer.
Well, as you point out yourself the current code is totally broken. Even 
if we don't support the video processor we still expose the 
corresponding DRM plane to userspace, but then just ignore any 
operations to it. This needs fixing (!), and my series is a first step 
in that direction.


With best wishes,
Tobias



[PATCH v4 1/2] arm, imx6, dts: add DT for aristainetos2 board

2015-05-22 Thread Heiko Schocher
Hello Philipp,

Am 22.05.2015 11:14, schrieb Philipp Zabel:
> Hi Heiko,
>
> Am Freitag, den 22.05.2015, 10:25 +0200 schrieb Heiko Schocher:
> [...]
>> diff --git a/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts 
>> b/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts
>> new file mode 100644
>> index 000..ae50c8b
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts
>> @@ -0,0 +1,158 @@
>> +/*
>> + * Copyright (C) 2014 Rabeeh Khoury (rabeeh at solid-run.com)
>> + * Based on dt work by Russell King
>
> This is new. Copy & paste error?

Argh... Good catch! I fix this .. but wait a while before posting v5
to get some more comments.

> With proper copyright information restored,
> Reviewed-by: Philipp Zabel 

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


[PATCH v4 1/2] arm, imx6, dts: add DT for aristainetos2 board

2015-05-22 Thread Philipp Zabel
Hi Heiko,

Am Freitag, den 22.05.2015, 10:25 +0200 schrieb Heiko Schocher:
[...]
> diff --git a/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts 
> b/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts
> new file mode 100644
> index 000..ae50c8b
> --- /dev/null
> +++ b/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts
> @@ -0,0 +1,158 @@
> +/*
> + * Copyright (C) 2014 Rabeeh Khoury (rabeeh at solid-run.com)
> + * Based on dt work by Russell King

This is new. Copy & paste error?

With proper copyright information restored,
Reviewed-by: Philipp Zabel 

regards
Philipp



[PATCH v2] drm: Only create a cmdline mode if no probed modes match

2015-05-22 Thread Chris Wilson
On Fri, May 22, 2015 at 12:03:27PM +0300, Ville Syrjälä wrote:
> On Mon, Apr 20, 2015 at 02:28:56PM +0100, Chris Wilson wrote:
> > The intention of using video=: is primarily to select
> > the user's preferred resolution at startup. Currently we always create a
> > new mode irrespective of whether the monitor has a native mode at the
> > desired resolution. This has the issue that we may then select the fake
> > mode rather the native mode during fb_helper->inital_config() and so
> > if the fake mode is invalid we then end up with a loss of signal. Oops.
> > This invalid fake mode would also be exported to userspace, who
> > potentially may make the same mistake.
> > 
> > To avoid this issue, we filter out the added command line mode if we
> > detect the desired resolution (and clock if specified) amongst the
> > probed modes. This fixes the immediate problem of adding a duplicate
> > mode, but perhaps more generically we should avoid adding a GTF mode if
> > the monitor has an EDID that is not GTF-compatible, or similarly for
> > CVT.
> > 
> > A second issue sneaked into this patch is to add the cmdline mode mode
> > ahead of the absolute fallback 1024x768 mode. That is if the user has
> > specified a mode that we create as a fallback, we do not need to add a
> > second unused fallback mode.
> > 
> > Fixes regression from
> > 
> > commit eaf99c749d43ae74ac7ffece5512f3c73f01dfd2
> > Author: Chris Wilson 
> > Date:   Wed Aug 6 10:08:32 2014 +0200
> > 
> > drm: Perform cmdline mode parsing during connector initialisation
> > 
> > that breaks HDMI output on BeagleBone Black with LG TV (model 19LS4R-ZA).
> > 
> > v2: Explicitly delete our earlier cmdline mode
> > 
> > Reported-by: Radek Dostál 
> > Signed-off-by: Chris Wilson 
> > Cc: Radek Dostál 
> > Cc: Jesse Barnes 
> > Cc: Ville Syrjälä 
> > Cc: Daniel Vetter 
> > Cc: dri-devel at lists.freedesktop.org
> > Cc: Julia Lemire 
> > Cc: Dave Airlie 
> > Cc: stable at vger.kernel.org
> > ---
> >  drivers/gpu/drm/drm_modes.c|  2 +-
> >  drivers/gpu/drm/drm_probe_helper.c | 39 
> > +++---
> >  2 files changed, 37 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> > index 213b11ea69b5..13293e009990 100644
> > --- a/drivers/gpu/drm/drm_modes.c
> > +++ b/drivers/gpu/drm/drm_modes.c
> > @@ -1400,7 +1400,7 @@ drm_mode_create_from_cmdline_mode(struct drm_device 
> > *dev,
> > if (!mode)
> > return NULL;
> >  
> > -   mode->type |= DRM_MODE_TYPE_USERDEF;
> > +   mode->type |= DRM_MODE_TYPE_USERDEF | DRM_MODE_TYPE_DRIVER;
> 
> Why do we need the DRIVER flag here?

So we can differentiate it from an equivalent mode added by the user
later on.

> > +   /* Remove the existing fake mode */
> > +   list_for_each_entry(mode, >modes, head) {
> > +   if ((mode->type & (DRM_MODE_TYPE_DRIVER | 
> > DRM_MODE_TYPE_USERDEF)) != (DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_USERDEF))
> > +   continue;
> 
> Doesn't drm_mode_connector_list_update() kill it from the list
> eventually if there's no matching mode present on the
> probed_modes list?

Hmm, that's what I thought I tried at first. If I remember correctly we
had to set mode->status in order to prune it since
drm_mode_connector_list_update() itself doesn't do the deletion. Using
the mode->status was problematic, and the simplest way to do delete the
original cmdline mode was by explicitly removing it ourselves.

> > @@ -179,9 +212,9 @@ static int 
> > drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
> > count = (*connector_funcs->get_modes)(connector);
> > }
> >  
> > +   count += drm_helper_probe_add_cmdline_mode(connector);
> > if (count == 0 && connector->status == connector_status_connected)
> > count = drm_add_modes_noedid(connector, 1024, 768);
> > -   count += drm_helper_probe_add_cmdline_mode(connector);
> 
> Hmm. This means drm_add_modes_noedid() will never be called if the
> cmdline mode is present, and hence the mode list will only ever have
> that single mode user specified mode. Not sure if that can be considered
> a real problem or not.

I consider it to a real problem as it goes against my expectations as a
user, that is if I specify a mode to use, I expect that mode to be used.
Doesn't need to be in this patch though.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[PATCH v4 2/2] drm/panel: Add support for LG LB070WV8 800x480 7" panel

2015-05-22 Thread Heiko Schocher
This adds support for the LG LB070WV8 7" 800x480 panel to the
DRM simple panel driver.

Signed-off-by: Heiko Schocher 
---

Changes in v4:
- new in version 4, as Philipp Zabel suggested to use
  simple panel driver

Changes in v3: None
Changes in v2: None

 .../devicetree/bindings/panel/lg,lb070wv8.txt  |  7 ++
 drivers/gpu/drm/panel/panel-simple.c   | 27 ++
 2 files changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/panel/lg,lb070wv8.txt

diff --git a/Documentation/devicetree/bindings/panel/lg,lb070wv8.txt 
b/Documentation/devicetree/bindings/panel/lg,lb070wv8.txt
new file mode 100644
index 000..a7588e5
--- /dev/null
+++ b/Documentation/devicetree/bindings/panel/lg,lb070wv8.txt
@@ -0,0 +1,7 @@
+LG 7" (800x480 pixels) TFT LCD panel
+
+Required properties:
+- compatible: should be "lg,lb070wv8"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 30904a9..a06d9d3 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -872,6 +872,30 @@ static const struct panel_desc innolux_zj070na_01p = {
},
 };

+static const struct drm_display_mode lg_lb070wv8_mode = {
+   .clock = 33246,
+   .hdisplay = 800,
+   .hsync_start = 800 + 88,
+   .hsync_end = 800 + 88 + 80,
+   .htotal = 800 + 88 + 80 + 88,
+   .vdisplay = 480,
+   .vsync_start = 480 + 10,
+   .vsync_end = 480 + 10 + 25,
+   .vtotal = 480 + 10 + 25 + 10,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc lg_lb070wv8 = {
+   .modes = _lb070wv8_mode,
+   .num_modes = 1,
+   .bpc = 16,
+   .size = {
+   .width = 151,
+   .height = 91,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+};
+
 static const struct drm_display_mode lg_lp129qe_mode = {
.clock = 285250,
.hdisplay = 2560,
@@ -1056,6 +1080,9 @@ static const struct of_device_id platform_of_match[] = {
.compatible = "innolux,zj070na-01p",
.data = _zj070na_01p,
}, {
+   .compatible = "lg,lb070wv8",
+   .data = _lb070wv8,
+   }, {
.compatible = "lg,lp129qe",
.data = _lp129qe,
}, {
-- 
2.1.0



[PATCH v4 1/2] arm, imx6, dts: add DT for aristainetos2 board

2015-05-22 Thread Heiko Schocher
This patch add support for the imx6dl based aristainetos2 board
with following configuration:

CPU:   Freescale i.MX6DL rev1.1 at 792 MHz
MReset cause: POR
MBoard: aristaitenos2
DRAM:  1 GiB
NAND:  1024 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
SF: Detected N25Q128A with page size 256 Bytes, erase size 64 KiB, total 16 MiB
Display: lb07wv8 (800x480)

As this board can used with 2 different display types, the
differences between them are extracted into 2 DTS files, and
the common settings are collected in a common file.

Signed-off-by: Heiko Schocher 
---

Changes in v4:
- add comments from Philipp Zabel:
  - fix some typos
  - fix license text
  - fix pmic compatible name to "dlg,da9063"
  - remove clocks property from i2c4 node
  - use simple panel driver, so remove the fsl,data-mapping
and fsl,data-width properties and the display-timings node.
need patch: "drm/panel: Add support for LG LB070WV8 800x480 7" panel"

Changes in v3:
- add comments from Shawn Guo
  - change license to GPL/X11 dual licence
  - rename touch node name to "touch"
  - add DTB in Makefile
  - remove "status = "okay"" from backlight node
  - rename "pinctrl_ipu1_1_80Ohm_clk" to "pinctrl_ipu_disp"
  - remove "status = "okay"" from "display at di0" node
  - remove "dma-names;" in ecspix nodes
  - use macro for clock ID and gpio
  - move iomuxc to the bottom of the file
  - configure pinctrl_backlight in the device node, not from
the hog group
  - provide a proper pad configuration value rather than 0x800.
  - in the iomuxc node, save one level of the sub-node
needs patch:
LinusW queued patch 5fcdf6a7ed95 ("pinctrl: imx: Allow
parsing DT without function nodes")
- add comments from Philipp Zabel
  - get rid of "fsl,panel" to connect a drm_panel to the parallel-display
instead switch to the common of-graph bindings.
need patch: "drm/imx: parallel-display: fix drm_panel support"
from Philipp Zabel

Changes in v2:
- add comments from Sascha Hauer:
  - remove "clock-frequency" property in i2c nodes
  - correct indentation in some pinctrl nodes
  - move pin settings out of "gpiogrp" where it was possible
led pins not moved, as they used through sysfs

 arch/arm/boot/dts/Makefile   |   2 +
 arch/arm/boot/dts/imx6dl-aristainetos2_4.dts | 158 +++
 arch/arm/boot/dts/imx6dl-aristainetos2_7.dts |  97 
 arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi | 632 +++
 4 files changed, 889 insertions(+)
 create mode 100644 arch/arm/boot/dts/imx6dl-aristainetos2_4.dts
 create mode 100644 arch/arm/boot/dts/imx6dl-aristainetos2_7.dts
 create mode 100644 arch/arm/boot/dts/imx6qdl-aristainetos2.dtsi

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 86217db..583fbeb 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -256,6 +256,8 @@ dtb-$(CONFIG_SOC_IMX53) += \
 dtb-$(CONFIG_SOC_IMX6Q) += \
imx6dl-aristainetos_4.dtb \
imx6dl-aristainetos_7.dtb \
+   imx6dl-aristainetos2_4.dtb \
+   imx6dl-aristainetos2_7.dtb \
imx6dl-cubox-i.dtb \
imx6dl-dfi-fs700-m60.dtb \
imx6dl-gw51xx.dtb \
diff --git a/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts 
b/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts
new file mode 100644
index 000..ae50c8b
--- /dev/null
+++ b/arch/arm/boot/dts/imx6dl-aristainetos2_4.dts
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2014 Rabeeh Khoury (rabeeh at solid-run.com)
+ * Based on dt work by Russell King
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 

[PATCH] drm/msm/mdp5: Always generate active-high sync signals for DSI

2015-05-22 Thread Hai Li
DSI video mode engine can only take active-high sync signals. This
change prevents MDP5 sending active-low sync signals to DSI in any
case.

Signed-off-by: Hai Li 
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
index 53bb1f7..2e98ce0 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c
@@ -144,10 +144,14 @@ static void mdp5_encoder_mode_set(struct drm_encoder 
*encoder,
mode->type, mode->flags);

ctrl_pol = 0;
-   if (mode->flags & DRM_MODE_FLAG_NHSYNC)
-   ctrl_pol |= MDP5_INTF_POLARITY_CTL_HSYNC_LOW;
-   if (mode->flags & DRM_MODE_FLAG_NVSYNC)
-   ctrl_pol |= MDP5_INTF_POLARITY_CTL_VSYNC_LOW;
+
+   /* DSI controller cannot handle active-low sync signals. */
+   if (mdp5_encoder->intf.type != INTF_DSI) {
+   if (mode->flags & DRM_MODE_FLAG_NHSYNC)
+   ctrl_pol |= MDP5_INTF_POLARITY_CTL_HSYNC_LOW;
+   if (mode->flags & DRM_MODE_FLAG_NVSYNC)
+   ctrl_pol |= MDP5_INTF_POLARITY_CTL_VSYNC_LOW;
+   }
/* probably need to get DATA_EN polarity from panel.. */

dtv_hsync_skew = 0;  /* get this from panel? */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



  1   2   >