Re: [PATCH v4 05/11] drm/atomic: Use drm_framebuffer_print_info()

2017-11-01 Thread Laurent Pinchart
Hi Noralf,

Thank you for the patch.

On Monday, 30 October 2017 18:29:39 EET Noralf Trønnes wrote:
> Use drm_framebuffer_print_info() to print framebuffer info in
> drm_atomic_plane_print_state(). This will give optional GEM info as well.
> 
> Reviewed-by: Daniel Vetter 
> Signed-off-by: Noralf Trønnes 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/drm_atomic.c | 18 +++---
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 6c9c4a8e09af..6d626355ba4e 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -33,6 +33,7 @@
>  #include 
> 
>  #include "drm_crtc_internal.h"
> +#include "drm_internal.h"
> 
>  void __drm_crtc_commit_free(struct kref *kref)
>  {
> @@ -934,21 +935,8 @@ static void drm_atomic_plane_print_state(struct
> drm_printer *p, drm_printf(p, "plane[%u]: %s\n", plane->base.id,
> plane->name);
>   drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : 
> "(null)");
>   drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0);
> - if (state->fb) {
> - struct drm_framebuffer *fb = state->fb;
> - int i, n = fb->format->num_planes;
> - struct drm_format_name_buf format_name;
> -
> - drm_printf(p, "\t\tformat=%s\n",
> -   drm_get_format_name(fb->format->format, 
> _name));
> - drm_printf(p, "\t\t\tmodifier=0x%llx\n", fb->modifier);
> - drm_printf(p, "\t\tsize=%dx%d\n", fb->width, fb->height);
> - drm_printf(p, "\t\tlayers:\n");
> - for (i = 0; i < n; i++) {
> - drm_printf(p, "\t\t\tpitch[%d]=%u\n", i, 
> fb->pitches[i]);
> - drm_printf(p, "\t\t\toffset[%d]=%u\n", i, 
> fb->offsets[i]);
> - }
> - }
> + if (state->fb)
> + drm_framebuffer_print_info(p, 2, state->fb);
>   drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG());
>   drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG());
>   drm_printf(p, "\trotation=%x\n", state->rotation);


-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v4 04/11] drm/framebuffer: Add framebuffer debugfs file

2017-11-01 Thread Laurent Pinchart
Hi Noralf,

Thank you for the patch.

On Monday, 30 October 2017 18:29:38 EET Noralf Trønnes wrote:
> Add debugfs file that dumps info about the framebuffers and its planes.
> Also dump info about any connected gem object(s).
> 
> Reviewed-by: Daniel Vetter 
> Signed-off-by: Noralf Trønnes 
> ---
>  drivers/gpu/drm/drm_debugfs.c |  6 
>  drivers/gpu/drm/drm_framebuffer.c | 59 
>  drivers/gpu/drm/drm_gem.c | 17 +++
>  drivers/gpu/drm/drm_internal.h|  7 +
>  include/drm/drm_drv.h | 11 
>  5 files changed, 100 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index c1807d5754b2..550f29de6c1f 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -158,6 +158,12 @@ int drm_debugfs_init(struct drm_minor *minor, int
> minor_id, }
>   }
> 
> + ret = drm_framebuffer_debugfs_init(minor);
> + if (ret) {
> + DRM_ERROR("Failed to create framebuffer debugfs file\n");
> + return ret;
> + }
> +
>   if (dev->driver->debugfs_init) {
>   ret = dev->driver->debugfs_init(minor);
>   if (ret) {
> diff --git a/drivers/gpu/drm/drm_framebuffer.c
> b/drivers/gpu/drm/drm_framebuffer.c index af279844d7ce..4f7873a1b922 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -25,7 +25,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
> 
> +#include "drm_internal.h"
>  #include "drm_crtc_internal.h"
> 
>  /**
> @@ -955,3 +957,60 @@ int drm_framebuffer_plane_height(int height,
>   return fb_plane_height(height, fb->format, plane);
>  }
>  EXPORT_SYMBOL(drm_framebuffer_plane_height);
> +
> +void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
> + const struct drm_framebuffer *fb)
> +{
> + struct drm_format_name_buf format_name;
> + int i;

i is never negative, you can make it an unsigned int.

> + drm_printf_indent(p, indent, "refcount=%d\n",
> +   drm_framebuffer_read_refcount(fb));

drm_framebuffer_read_refcount() returns an unsigned int, the printk format 
should be %u.

> + drm_printf_indent(p, indent, "format=%s\n",
> +   drm_get_format_name(fb->format->format, 
> _name));
> + drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier);
> + drm_printf_indent(p, indent, "size=%dx%d\n", fb->width, fb->height);

Ditto here, %ux%u.

> + drm_printf_indent(p, indent, "layers:\n");
> +
> + for (i = 0; i < fb->format->num_planes; i++) {
> + drm_printf_indent(p, indent + 1, "size[%d]=%dx%d\n", i,
> +   drm_framebuffer_plane_width(fb->width, fb, i),
> +   drm_framebuffer_plane_height(fb->height, fb, 
> i));
> + drm_printf_indent(p, indent + 1, "pitch[%d]=%u\n", i, 
> fb->pitches[i]);
> + drm_printf_indent(p, indent + 1, "offset[%d]=%u\n", i, 
> fb->offsets[i]);
> + drm_printf_indent(p, indent + 1, "obj[%d]:%s\n", i,
> +   fb->obj[i] ? "" : "(null)");

And in various places here too.

> + if (fb->obj[i])
> + drm_gem_print_info(p, indent + 2, fb->obj[i]);
> + }
> +}
> +
> +#ifdef CONFIG_DEBUG_FS
> +static int drm_framebuffer_info(struct seq_file *m, void *data)
> +{
> + struct drm_info_node *node = m->private;
> + struct drm_device *dev = node->minor->dev;
> + struct drm_printer p = drm_seq_file_printer(m);
> + struct drm_framebuffer *fb;
> +
> + mutex_lock(>mode_config.fb_lock);
> + drm_for_each_fb(fb, dev) {
> + drm_printf(, "framebuffer[%d]:\n", fb->base.id);

fb->base.id is an unsigned int, the printk format should be %u.

> + drm_framebuffer_print_info(, 1, fb);
> + }
> + mutex_unlock(>mode_config.fb_lock);
> +
> + return 0;
> +}
> +
> +static const struct drm_info_list drm_framebuffer_debugfs_list[] = {
> + { "framebuffer", drm_framebuffer_info, 0 },
> +};
> +
> +int drm_framebuffer_debugfs_init(struct drm_minor *minor)
> +{
> + return drm_debugfs_create_files(drm_framebuffer_debugfs_list,
> + ARRAY_SIZE(drm_framebuffer_debugfs_list),
> + minor->debugfs_root, minor);
> +}
> +#endif
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 4c84b23d37cc..152bd6210dde 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -40,6 +40,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include "drm_internal.h"
> 
>  /** @file drm_gem.c
> @@ -1040,3 +1041,19 @@ int drm_gem_mmap(struct file *filp, struct
> vm_area_struct *vma) return ret;
>  }
>  EXPORT_SYMBOL(drm_gem_mmap);
> +
> +void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
> + 

Re: [PATCH v4 03/11] drm/print: Add drm_printf_indent()

2017-11-01 Thread Laurent Pinchart
Hi Noralf,

Thank you for the patch.

On Monday, 30 October 2017 18:29:37 EET Noralf Trønnes wrote:
> Add drm_printf_indent() that adds tab indentation according to argument.
> Indentation overflow is marked with an X.

I wonder if this kind of thing would be useful to add to printk somehow. 
That's not a blocker though, we can switch to a more generic implementation 
later when one will be available.

> Reviewed-by: Daniel Vetter 
> Signed-off-by: Noralf Trønnes 

Reviewed-by: Laurent Pinchart 

> ---
> 
> Changes since version 3:
> - Turn drm_printf_indent() into a macro (Ville)
> - drm_printf_indent() add overflow marker (Jani)
> 
>  include/drm/drm_print.h | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 7b9c86a6ca3e..7dbfdebec973 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -80,6 +80,14 @@ void __drm_printfn_debug(struct drm_printer *p, struct
> va_format *vaf); __printf(2, 3)
>  void drm_printf(struct drm_printer *p, const char *f, ...);
> 
> +/**
> + * drm_printf_indent - Print to a _printer stream with indentation
> + * @printer: DRM printer
> + * @indent: Tab indentation level (max 5)
> + * @fmt: Format string
> + */
> +#define drm_printf_indent(printer, indent, fmt, ...) \
> + drm_printf((printer), "%.*s" fmt, (indent), "\t\t\t\t\tX", 
> ##__VA_ARGS__)
> 
>  /**
>   * drm_seq_file_printer - construct a _printer that outputs to
> _file


-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v4 02/11] drm/framebuffer: drm_framebuffer_read_refcount() constify argument

2017-11-01 Thread Laurent Pinchart
Hi Noralf,

Thank you for the patch.

On Monday, 30 October 2017 18:29:36 EET Noralf Trønnes wrote:
> Constify argument so functions calling into this take a const argument.
> 
> Reviewed-by: Ville Syrjälä 
> Signed-off-by: Noralf Trønnes 

Reviwed-by: Laurent Pinchart 

> ---
>  include/drm/drm_framebuffer.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
> index b6996ddb19d6..6cce22e1a0f2 100644
> --- a/include/drm/drm_framebuffer.h
> +++ b/include/drm/drm_framebuffer.h
> @@ -263,7 +263,7 @@ static inline void drm_framebuffer_unreference(struct
> drm_framebuffer *fb) *
>   * This functions returns the framebuffer's reference count.
>   */
> -static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer
> *fb) +static inline uint32_t drm_framebuffer_read_refcount(const struct
> drm_framebuffer *fb) {
>   return kref_read(>base.refcount);
>  }


-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v4 01/11] drm/vma-manager: drm_vma_node_start() constify argument

2017-11-01 Thread Laurent Pinchart
Hi Noralf,

Thank you for the patch.

On Monday, 30 October 2017 18:29:35 EET Noralf Trønnes wrote:
> Constify argument so functions calling into this take a const argument.
> 
> Reviewed-by: Ville Syrjälä 
> Signed-off-by: Noralf Trønnes 

Reviewed-by: Laurent Pinchart 

> ---
>  include/drm/drm_vma_manager.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
> index d84d52f6d2b1..8758df94e9a0 100644
> --- a/include/drm/drm_vma_manager.h
> +++ b/include/drm/drm_vma_manager.h
> @@ -152,7 +152,7 @@ static inline void drm_vma_node_reset(struct
> drm_vma_offset_node *node) * Start address of @node for page-based
> addressing. 0 if the node does not * have an offset allocated.
>   */
> -static inline unsigned long drm_vma_node_start(struct drm_vma_offset_node
> *node) +static inline unsigned long drm_vma_node_start(const struct
> drm_vma_offset_node *node) {
>   return node->vm_node.start;
>  }

-- 
Regards,

Laurent Pinchart

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


[Bug 101475] Max Core Profile for OpenGL showing 0.0

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

--- Comment #11 from vinf...@gmail.com ---

Hello, sorry to reopen this thread. 

I am still having the same problem i.e. the max core profile is showing at
0.0. 

glxinfo  | grep version returns:

server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
Max core profile version: 0.0
Max compat profile version: 2.1
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 2.0
OpenGL version string: 2.1 Mesa 17.2.4
OpenGL shading language version string: 1.30
OpenGL ES profile version string: OpenGL ES 2.0 Mesa 17.2.4
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.0.16

glxinfo | grep renderer:
GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: AMD REDWOOD (DRM 2.49.0 / 4.10.0-38-generic, LLVM
4.0.0)

It used to show 3.3, but why does it now show the wrong version.

Also, when I try to use MESA_GL_VERSION_OVERRIDE, it always fails for
values above 2.1

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


[Bug 101475] Max Core Profile for OpenGL showing 0.0

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

--- Comment #10 from vinf...@gmail.com ---
Hello, sorry to reopen this thread. 

I am still having the same problem i.e. the max core profile is showing at 0.0. 

glxinfo

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


[pull] amdgpu drm-fixes-4.14

2017-11-01 Thread Alex Deucher
Hi Dave,

Just two small patches for stable to fix the driver failing to load on polaris
cards with harvested VCE or UVD blocks.

The following changes since commit d3daa2c7865cbfa830651b11c8ad1df23465b46e:

  drm/amd/amdgpu: Remove workaround check for UVD6 on APUs (2017-10-25 09:32:14 
-0400)

are available in the git repository at:

  git://people.freedesktop.org/~agd5f/linux drm-fixes-4.14

for you to fetch changes up to 32bec2afa525149288e6696079bc85f747fa2138:

  drm/amdgpu: allow harvesting check for Polaris VCE (2017-11-01 23:37:16 -0400)


Leo Liu (2):
  drm/amdgpu: return -ENOENT from uvd 6.0 early init for harvesting
  drm/amdgpu: allow harvesting check for Polaris VCE

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


Re: [PATCH] drm/drm_mm.h: Fix the name of the referenced function in comment

2017-11-01 Thread Alex Deucher
On Wed, Nov 1, 2017 at 10:04 AM, Liviu Dudau  wrote:
> drm_mm_insert_node_generic() is a simplified version of
> drm_mm_insert_node_in_range(), update comment to reflect correct
> function name.
>
> Signed-off-by: Liviu Dudau 

Reviewed-by: Alex Deucher 

> ---
>  include/drm/drm_mm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
> index 8d10fc97801ce..101f566ae43d0 100644
> --- a/include/drm/drm_mm.h
> +++ b/include/drm/drm_mm.h
> @@ -386,7 +386,7 @@ int drm_mm_insert_node_in_range(struct drm_mm *mm,
>   * @color: opaque tag value to use for this node
>   * @mode: fine-tune the allocation search and placement
>   *
> - * This is a simplified version of drm_mm_insert_node_in_range_generic() 
> with no
> + * This is a simplified version of drm_mm_insert_node_in_range() with no
>   * range restrictions applied.
>   *
>   * The preallocated node must be cleared to 0.
> --
> 2.14.3
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] dma-buf: Cleanup comments on dma_buf_map_attachment()

2017-11-01 Thread Alex Deucher
On Wed, Nov 1, 2017 at 10:06 AM, Liviu Dudau  wrote:
> Mappings need to be unmapped by calling dma_buf_unmap_attachment() and
> not by calling again dma_buf_map_attachment(). Also fix some spelling
> mistakes.
>
> Signed-off-by: Liviu Dudau 

Reviewed-by: Alex Deucher 

> ---
>  drivers/dma-buf/dma-buf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index bc1cb284111cb..1792385405f0e 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -351,13 +351,13 @@ static inline int is_dma_buf_file(struct file *file)
>   *
>   * 2. Userspace passes this file-descriptors to all drivers it wants this 
> buffer
>   *to share with: First the filedescriptor is converted to a _buf 
> using
> - *dma_buf_get(). The the buffer is attached to the device using
> + *dma_buf_get(). Then the buffer is attached to the device using
>   *dma_buf_attach().
>   *
>   *Up to this stage the exporter is still free to migrate or reallocate 
> the
>   *backing storage.
>   *
> - * 3. Once the buffer is attached to all devices userspace can inniate DMA
> + * 3. Once the buffer is attached to all devices userspace can initiate DMA
>   *access to the shared buffer. In the kernel this is done by calling
>   *dma_buf_map_attachment() and dma_buf_unmap_attachment().
>   *
> @@ -617,7 +617,7 @@ EXPORT_SYMBOL_GPL(dma_buf_detach);
>   * Returns sg_table containing the scatterlist to be returned; returns 
> ERR_PTR
>   * on error. May return -EINTR if it is interrupted by a signal.
>   *
> - * A mapping must be unmapped again using dma_buf_map_attachment(). Note that
> + * A mapping must be unmapped by using dma_buf_unmap_attachment(). Note that
>   * the underlying backing storage is pinned for as long as a mapping exists,
>   * therefore users/importers should not hold onto a mapping for undue 
> amounts of
>   * time.
> --
> 2.14.3
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/7] drm/edid and drivers: ELD refactoring

2017-11-01 Thread Alex Deucher
On Wed, Nov 1, 2017 at 10:20 AM, Jani Nikula  wrote:
> We were recently bitten by drm_edid_to_eld() clearing the connector
> type, and us failing to set it back for DP. Here's a few ELD related
> patches to try to unify ELD handling and make it a bit simpler for
> drivers to get it right.
>
> Apologies for the massive Cc list; it's the maintainers of all drivers
> that call drm_edid_to_eld().
>
> I'm open to splitting up patch 6 to driver specific patches as needed,
> but I'd think it would be just fine to merge via drm-misc as-is too.

Nice!  Series is:
Reviewed-by: Alex Deucher 


>
> BR,
> Jani.
>
> Cc: Alex Deucher 
> Cc: Christian König 
> Cc: Archit Taneja 
> Cc: Andrzej Hajda 
> Cc: Russell King 
> Cc: CK Hu 
> Cc: Philipp Zabel 
> Cc: Ben Skeggs 
> Cc: Mark Yao 
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
> Cc: Thierry Reding 
> Cc: Eric Anholt 
>
>
> Jani Nikula (7):
>   drm/edid: use macros for ELD offsets and values
>   drm/edid: set ELD connector type in drm_edid_to_eld()
>   drm/i915: remove redundant ELD connector type update
>   drm/edid: abstract connector ELD clearing
>   drm/edid: build ELD in drm_add_edid_modes()
>   drm/drivers: drop redundant drm_edid_to_eld() calls
>   drm/edid: make drm_edid_to_eld() static
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |  1 -
>  drivers/gpu/drm/bridge/analogix-anx78xx.c  |  2 -
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  2 -
>  drivers/gpu/drm/drm_edid.c | 70 
> +++---
>  drivers/gpu/drm/i2c/tda998x_drv.c  |  1 -
>  drivers/gpu/drm/i915/intel_dp.c|  1 -
>  drivers/gpu/drm/i915/intel_modes.c | 18 ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c|  1 -
>  drivers/gpu/drm/nouveau/nv50_display.c |  5 +-
>  drivers/gpu/drm/radeon/radeon_connectors.c |  1 -
>  drivers/gpu/drm/radeon/radeon_dp_mst.c |  1 -
>  drivers/gpu/drm/rockchip/cdn-dp-core.c |  4 +-
>  drivers/gpu/drm/sti/sti_hdmi.c |  1 -
>  drivers/gpu/drm/tegra/output.c |  1 -
>  drivers/gpu/drm/vc4/vc4_hdmi.c |  1 -
>  include/drm/drm_edid.h |  1 -
>  include/drm/drm_modeset_helper_vtables.h   |  3 --
>  17 files changed, 44 insertions(+), 70 deletions(-)
>
> --
> 2.11.0
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 1/4] devicetree/bindings: display: Add doucument for RGB panels

2017-11-01 Thread Rob Herring
On Wed, Nov 01, 2017 at 03:52:38PM +0800, Sandy Huang wrote:
> Describe the panel property rgb-mode for parallel and serial
> RGB output interface, include the connection relations for each
> mode.
> 
> Signed-off-by: Sandy Huang 
> ---
> Changes:
>  .../bindings/display/panel/panel-rgb.txt   | 116 
> +
>  1 file changed, 116 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/panel-rgb.txt

There's a couple of attempts to do the same thing[1] and I'm not taking 
more than 1. I'd suggest you split this from the rest of your series and 
work out this part separately with others.

Rob

[1] https://patchwork.kernel.org/patch/407/
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PULL] drm-intel-fixes

2017-11-01 Thread Rodrigo Vivi
Hi Dave,

Here goes drm-intel-fixes-2017-11-01.

Fixes for Stable:

- Fix KBL Blank Screen (Jani)
- Fix FIFO Underrun on SNB (Maarten)

Other fixes:

- Fix GPU Hang on i915gm (Chris)
- Fix gem_tiled_pread_pwrite IGT case (Chris)
- Cancel modeset retry work during modeset clean-up (Manasi)

Thanks,
Rodrigo.

The following changes since commit 0b07194bb55ed836c2cc7c22e866b87a14681984:

  Linux 4.14-rc7 (2017-10-29 13:58:38 -0700)

are available in the git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-fixes-2017-11-01

for you to fetch changes up to bb5cf3386327c9cb5ca3fbb85242e940751649c8:

  drm/i915: Check incoming alignment for unfenced buffers (on i915gm) 
(2017-11-01 10:28:28 -0700)


drm-intel-fixes-2017-11-01:

Fixes for Stable:

- Fix KBL Blank Screen (Jani)
- Fix FIFO Underrun on SNB (Maarten)

Other fixes:

- Fix GPU Hang on i915gm (Chris)
- Fix gem_tiled_pread_pwrite IGT case (Chris)
- Cancel modeset retry work during modeset clean-up (Manasi)


Chris Wilson (3):
  drm/i915: Hold rcu_read_lock when iterating over the radixtree (objects)
  drm/i915: Hold rcu_read_lock when iterating over the radixtree (vma idr)
  drm/i915: Check incoming alignment for unfenced buffers (on i915gm)

Jani Nikula (1):
  drm/i915/edp: read edp display control registers unconditionally

Maarten Lankhorst (1):
  drm/i915: Do not rely on wm preservation for ILK watermarks

Manasi Navare (1):
  drm/i915: Cancel the modeset retry work during modeset cleanup

 drivers/gpu/drm/i915/i915_gem.c|  2 ++
 drivers/gpu/drm/i915/i915_gem_context.c|  2 ++
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  4 +++
 drivers/gpu/drm/i915/intel_display.c   | 19 ++-
 drivers/gpu/drm/i915/intel_dp.c| 13 ++--
 drivers/gpu/drm/i915/intel_drv.h   |  1 -
 drivers/gpu/drm/i915/intel_pm.c| 51 --
 7 files changed, 57 insertions(+), 35 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103519] wayland egl apps crash on start with mesa 17.2

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

--- Comment #5 from Apostolos B.  ---
Dereks patch was tested on 17.2.4 and 17.3.0-rc2 and solves the problem. EFL
apps and weston-simple-egl work fine.

Merge and close.

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


Re: [PATCH v2 01/10] dt-bindings: fix the binding of Allwinner DE2 CCU of A83T and H3

2017-11-01 Thread Rob Herring
On Fri, Oct 27, 2017 at 11:06:49PM +0800, Icenowy Zheng wrote:
> The DE2 CCU is different on A83T and H3 -- the parent of the clocks on
> A83T is PLL_DE but on H3 it's the DE module clock. This is not noticed
> when I develop the DE2 CCU driver.
> 
> Fix the binding by using different compatibles for A83T and H3, adding
> notes for the PLL_DE usage on A83T, and change the binding example's
> compatible from A83T to H3 (as it specifies the DE module clock).
> 
> Fixes: ed74f8a8a679 ("dt-bindings: add binding for the Allwinner DE2 CCU")
> Signed-off-by: Icenowy Zheng 
> ---
>  Documentation/devicetree/bindings/clock/sun8i-de2.txt | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Acked-by: Rob Herring 

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


Re: [PATCH v2 08/10] dt-bindings: add binding for A64 DE2 CCU SRAM

2017-11-01 Thread Rob Herring
On Fri, Oct 27, 2017 at 11:06:56PM +0800, Icenowy Zheng wrote:
> A64's Display Engine 2.0 needs a section of SRAM (SRAM C) to be claimed,
> otherwise the whole DE2 memory zone cannot be accessed (kept to all 0).
> 
> Add binding for this, in order to make the DE2 CCU able to claim the
> SRAM and enable access to the DE2 clock and reset registers.
> 
> Signed-off-by: Icenowy Zheng 
> ---
> Changes in v2:
> - Adds description of the situation when the SRAM is not claimed.
> 
>  Documentation/devicetree/bindings/clock/sun8i-de2.txt | 5 +
>  1 file changed, 5 insertions(+)

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


[PATCH v2 5/5] drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

drm_plane_helper_check_update() isn't a transitional helper, so let's
rename it to drm_atomic_helper_check_plane_state() and move it into
drm_atomic_helper.c.

v2: Fix the WARNs about plane_state->crtc matching crtc_state->crtc

Cc: Daniel Vetter 
Suggested-by: Daniel Vetter 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/arm/hdlcd_crtc.c|   8 +--
 drivers/gpu/drm/arm/malidp_planes.c |   4 +-
 drivers/gpu/drm/drm_atomic_helper.c |  94 +
 drivers/gpu/drm/drm_plane_helper.c  | 102 ++--
 drivers/gpu/drm/drm_simple_kms_helper.c |   9 +--
 drivers/gpu/drm/i915/intel_display.c|  22 +++---
 drivers/gpu/drm/imx/ipuv3-plane.c   |   8 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c|   8 +--
 drivers/gpu/drm/meson/meson_plane.c |   8 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c  |  20 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |   8 +--
 drivers/gpu/drm/zte/zx_plane.c  |  15 ++--
 include/drm/drm_atomic_helper.h |   7 ++
 include/drm/drm_plane_helper.h  |   6 --
 17 files changed, 169 insertions(+), 165 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 14721723fa8a..63511a3bbf6c 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane 
*plane,
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-   return drm_plane_helper_check_state(state, crtc_state, ,
-   DRM_PLANE_HELPER_NO_SCALING,
-   DRM_PLANE_HELPER_NO_SCALING,
-   false, true);
+   return drm_atomic_helper_check_plane_state(state, crtc_state, ,
+  DRM_PLANE_HELPER_NO_SCALING,
+  DRM_PLANE_HELPER_NO_SCALING,
+  false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/arm/malidp_planes.c 
b/drivers/gpu/drm/arm/malidp_planes.c
index 492d99dd55d4..72a07950167e 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
-   ret = drm_plane_helper_check_state(state, crtc_state, ,
-  0, INT_MAX, true, true);
+   ret = drm_atomic_helper_check_plane_state(state, crtc_state, ,
+ 0, INT_MAX, true, true);
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 71d712f1b56a..a381913c894d 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -696,6 +696,100 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
 
 /**
+ * drm_atomic_helper_check_plane_state() - Check plane state for validity
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
+ * @clip: integer clipping coordinates
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *doesn't cover the entire crtc?  This will generally
+ *only be false for primary planes.
+ * @can_update_disabled: can the plane be updated while the crtc
+ *   is disabled?
+ *
+ * Checks that a desired plane update is valid, and updates various
+ * bits of derived state (clipped coordinates etc.). Drivers that provide
+ * their own plane handling rather than helper-provided implementations may
+ * still wish to call this function to avoid duplication of error checking
+ * code.
+ *
+ * RETURNS:
+ * Zero if update appears valid, error code on failure
+ */
+int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
+   const struct drm_crtc_state *crtc_state,
+   const struct drm_rect *clip,
+   int min_scale,
+   int max_scale,
+   bool can_position,
+   

[PATCH v2 4/5] drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

drm_plane_helper_check_state() is supposed to do things the atomic way,
so it should not be inspecting crtc->enabled. Rather we should be
looking at crtc_state->enable.

We have a slight complication due to drm_plane_helper_check_update()
reusing drm_plane_helper_check_state() for non-atomic drivers. Thus
we'll have to pass the crtc_state in manally and construct a fake
crtc_state in drm_plane_helper_check_update().

v2: Fix the WARNs about plane_state->crtc matching crtc_state->crtc

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/arm/hdlcd_crtc.c|  2 +-
 drivers/gpu/drm/arm/malidp_planes.c |  3 +-
 drivers/gpu/drm/drm_plane_helper.c  | 51 -
 drivers/gpu/drm/drm_simple_kms_helper.c |  2 +-
 drivers/gpu/drm/i915/intel_display.c|  2 ++
 drivers/gpu/drm/imx/ipuv3-plane.c   |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c|  2 +-
 drivers/gpu/drm/meson/meson_plane.c |  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |  4 +--
 drivers/gpu/drm/nouveau/nv50_display.c  |  6 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  2 +-
 drivers/gpu/drm/tegra/dc.c  |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |  2 +-
 drivers/gpu/drm/zte/zx_plane.c  |  4 +--
 include/drm/drm_plane_helper.h  |  3 +-
 15 files changed, 52 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 72b22b805412..14721723fa8a 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -252,7 +252,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-   return drm_plane_helper_check_state(state, ,
+   return drm_plane_helper_check_state(state, crtc_state, ,
DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING,
false, true);
diff --git a/drivers/gpu/drm/arm/malidp_planes.c 
b/drivers/gpu/drm/arm/malidp_planes.c
index 94e7e3fa3408..492d99dd55d4 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -150,7 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
-   ret = drm_plane_helper_check_state(state, , 0, INT_MAX, true, 
true);
+   ret = drm_plane_helper_check_state(state, crtc_state, ,
+  0, INT_MAX, true, true);
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 759ed93f4ba8..eef0ffcd7ed5 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -101,7 +101,8 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
 
 /**
  * drm_plane_helper_check_state() - Check plane state for validity
- * @state: plane state to check
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
  * @clip: integer clipping coordinates
  * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
  * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
@@ -120,35 +121,37 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
  * RETURNS:
  * Zero if update appears valid, error code on failure
  */
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+const struct drm_crtc_state *crtc_state,
 const struct drm_rect *clip,
 int min_scale,
 int max_scale,
 bool can_position,
 bool can_update_disabled)
 {
-   struct drm_crtc *crtc = state->crtc;
-   struct drm_framebuffer *fb = state->fb;
-   struct drm_rect *src = >src;
-   struct drm_rect *dst = >dst;
-   unsigned int rotation = state->rotation;
+   struct drm_framebuffer *fb = plane_state->fb;
+   struct drm_rect *src = _state->src;
+   struct drm_rect *dst = _state->dst;
+   unsigned int rotation = plane_state->rotation;
int hscale, vscale;
 
-   *src = drm_plane_state_src(state);
-   *dst = drm_plane_state_dest(state);
+   WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc);
+
+   *src = drm_plane_state_src(plane_state);
+   *dst = drm_plane_state_dest(plane_state);
 
if (!fb) {
-   state->visible = false;
+   plane_state->visible = false;
return 0;
}

[Bug 103486] Tonga DC vblank_mode=0 not working as expected fullscreen

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

--- Comment #11 from Andy Furniss  ---
Patch is good for me as well, thanks.

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


Re: [PATCH v6 00/10] rockchip: kevin: Enable edp display

2017-11-01 Thread Sean Paul
On Tue, Oct 31, 2017 at 12:37:43PM +0800, JeffyChen wrote:
> Hi Heiko,
> 
> On 10/31/2017 07:01 AM, Heiko Stuebner wrote:
> > As I was just looking at the edp dts change in patch1 again, does this
> > series also contain a fix for the issue below [0] ?
> > 
> > I'm still seeing this on 4.14-rc6 with the most recent drm tree merged in.
> > 
> i saw that too, it should due to our psr code...i think Zain has solved
> these in chromeos kernel, i will ask Zain if he have time to upstream them,
> or maybe i'll try to upstream them.

You need the patchset where I've refactored the psr locking/workers. I have a
version of it based on Heiko's tree at
https://cgit.freedesktop.org/~seanpaul/dogwood/log/?h=rk3399-display

With this kernel, the backlight comes on, but I don't have anything on the
display (which is why I didn't post it). I'll try putting this set on top and
see what happens.

Sean

> > 
> > Heiko
> > 
> > [0]
> > 
> > [   27.960120] BUG: scheduling while atomic: kworker/1:1/68/0x0002
> > [   27.974429] Modules linked in: rockchipdrm dw_hdmi analogix_dp 
> > drm_kms_helper panel_simple crc32_ce drm crct10dif_ce rockchip_saradc 
> > pwm_bl pwm_cros_ec rockchip_thermal ip_tables x_tabl
> > es ipv6 smsc95xx smsc75xx ax88179_178a asix usbnet phy_rockchip_pcie 
> > pcie_rockchip
> > [   28.008769] CPU: 1 PID: 68 Comm: kworker/1:1 Tainted: GW   
> > 4.14.0-rc7-03201-g12490811b353 #559
> > [   28.008774] Hardware name: Google Kevin (DT)
> > [   28.008825] Workqueue: events analogix_dp_psr_work [rockchipdrm]
> > [   28.008828] Call trace:
> > [   28.008838] [] dump_backtrace+0x0/0x378
> > [   28.008842] [] show_stack+0x14/0x20
> > [   28.008847] [] dump_stack+0x9c/0xbc
> > [   28.008852] [] __schedule_bug+0x4c/0x70
> > [   28.008856] [] __schedule+0x558/0x5e8
> > [   28.008859] [] schedule+0x38/0xa0
> > [   28.008864] [] schedule_hrtimeout_range_clock+0x84/0xe8
> > [   28.008867] [] schedule_hrtimeout_range+0x10/0x18
> > [   28.008870] [] usleep_range+0x64/0x78
> > [   28.008882] [] analogix_dp_transfer+0x16c/0xa88 
> > [analogix_dp]
> > [   28.008891] [] analogix_dpaux_transfer+0x10/0x18 
> > [analogix_dp]
> > [   28.008950] [] drm_dp_dpcd_access+0x4c/0xf8 
> > [drm_kms_helper]
> > [   28.008994] [] drm_dp_dpcd_write+0x1c/0x28 
> > [drm_kms_helper]
> > [   28.009002] [] analogix_dp_disable_psr+0x60/0xb0 
> > [analogix_dp]
> > [   28.009036] [] analogix_dp_psr_work+0x4c/0xc0 
> > [rockchipdrm]
> > [   28.009040] [] process_one_work+0x1d4/0x348
> > [   28.009043] [] worker_thread+0x48/0x470
> > [   28.009048] [] kthread+0x12c/0x130
> > [   28.009052] [] ret_from_fork+0x10/0x18
> > 
> > 
> > 
> > 
> 
> 

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


[pull] drm/msm: msm-next for 4.15 (take 2)

2017-11-01 Thread Rob Clark
Hi Dave,

Updated pull request, which adds the patch I lost from Arnd to correct
a warning on armv7.

Original pull req description:

Updates for 4.15.. highlights include:

 + preemption support for a5xx[1][2]

 + display fixes for 8x96 (snapdragon 820) including fixes for 4k scanout
   (hwpipe assignment re-work to handle multiple hwpipe assigned to plane
   for wide scanout)

 + async cursor plane updates and fixes

 + refactor adreno_bind/hwinit.. still defer fw loading until device open,
   but move clk/irq/etc to probe/bind time to fix issues when fw isn't
   present in filesys

 + clk/dt bindings cleanups w/ backward compat via msm_clk_get() (dt docs
   part ack'ed by Rob Herring)

 + fw loading re-work with helper to handle either /lib/firmware/qcom/$fw
   or /lib/firmware/$fw.. background, we've started landing fw for some of
   generations in linux-firmware, but there is a preference to put fw files
   under 'qcom' subdirectory, which is not what was done on android or for
   people who copied fw from android.  So now we first look in qcom subdir
   and then fallback to the original location.

 + bunch of GPU debugging enhancements, to dump full cmdline of processes
   that trigger faults, and to add a new debugfs to capture cmdstream of
   just submits that triggered faults.. both quite useful for piglit ;-)

Note that first patch was also included in -fixes pr for 4.14, but
including it here again was the sanest way to avoid bad merge
conflicts.

[1] libdrm: https://github.com/freedreno/libdrm/commits/context-priority
[2] mesa: 
https://lists.freedesktop.org/archives/mesa-dev/2017-October/174100.html

The following changes since commit 62884cd386b876638720ef88374b31a84ca7ee5f:

  drm: Add four ioctls for managing drm mode object leases [v7]
(2017-10-25 16:31:30 +1000)

are available in the git repository at:

  git://people.freedesktop.org/~robclark/linux drm-msm-next-2017-11-01

for you to fetch changes up to 39ae0d3e561d360e41f2a3d1c427d5d9142468da:

  drm/msm: use %z format modifier for printing size_t (2017-11-01
11:16:28 -0400)


Archit Taneja (5):
  drm/msm/hdmi: Remove mmagic_iface_clk from the 8x96 PHY clocks
  drm/msm/mdp5: Prepare mdp5_pipe_assign for some rework
  drm/msm/mdp5: Update mdp5_pipe_assign to spit out both planes
  drm/msm/mdp5: mdp5_crtc: Restore cursor state only if LM cursors
are enabled
  drm/msm/mdp5: Don't use async plane update path if plane
visibility changes

Arnd Bergmann (1):
  drm/msm: use %z format modifier for printing size_t

Gustavo Padovan (2):
  drm/msm: update cursors asynchronously through atomic
  drm/msm: remove mdp5_cursor_plane_funcs

Jordan Crouse (9):
  drm/msm: Add per-instance submit queues
  drm/msm: Move memptrs to msm_gpu
  drm/msm: Support multiple ringbuffers
  drm/msm: Add a parameter query for the number of ringbuffers
  drm/msm: Shadow current pointer in the ring until command is complete
  drm/msm: Make the value of RB_CNTL (almost) generic
  drm/msm: Implement preemption for A5XX targets
  drm/msm: Removed unused struct_mutex_task
  drm/msm: dump a rd GPUADDR header for all buffers in the command

Rob Clark (21):
  drm/msm: fix _NO_IMPLICIT fencing case
  drm/msm/adreno: load gpu at probe/bind time
  drm/msm/adreno: split out helper to load fw
  drm/msm/adreno: deal with linux-firmware fw paths
  drm/msm/mdp5: always print mdp5 version
  drm/msm/dsi: convert to msm_clk_get()
  drm/msm/edp: convert to msm_clk_get()
  drm/msm/hdmi: convert to msm_clk_get()
  dt-bindings: display: msm: update clk names
  drm/msm/mdp4: disable vblanks when crtc is off
  drm/msm/mdp5: disable vblanks when crtc is off
  drm/msm: show task cmdline in gpu recovery messages
  drm/msm: add special _get_vaddr_active() for cmdstream dumps
  drm/msm: split rd debugfs file
  drm/msm/rd: allow adding addition msg to top of dump
  drm/msm: preserve IOVAs in submit's bo table
  drm/msm: dump submits which triggered gpu hang
  drm/msm/mdp5: ignore planes that are not visible
  drm/msm/mdp5: don't use autosuspend
  drm/msm/mdp5: restore cursor state when enabling crtc
  drm/msm/atomic: switch to drm_atomic_helper_check

 .../devicetree/bindings/display/msm/dsi.txt|  36 +-
 .../devicetree/bindings/display/msm/edp.txt|  20 +-
 .../devicetree/bindings/display/msm/hdmi.txt   |   8 +-
 .../devicetree/bindings/display/msm/mdp5.txt   |  32 +-
 drivers/gpu/drm/msm/Makefile   |   4 +-
 drivers/gpu/drm/msm/adreno/a3xx_gpu.c  |  10 +-
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c  |  10 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c  | 261 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.h  | 109 ++-
 drivers/gpu/drm/msm/adreno/a5xx_power.c|   9 +-
 

[PATCH] drm: Print the fb dimensions when the src coord check fails

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

When debugging bad plane source coordinates it helps to have an
idea of what the framebuffer dimensions are.

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/drm_atomic.c  | 5 +++--
 drivers/gpu/drm/drm_framebuffer.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index c2da5585e201..83fd86534552 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -907,11 +907,12 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
state->src_h > fb_height ||
state->src_y > fb_height - state->src_h) {
DRM_DEBUG_ATOMIC("Invalid source coordinates "
-"%u.%06ux%u.%06u+%u.%06u+%u.%06u\n",
+"%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n",
 state->src_w >> 16, ((state->src_w & 0x) * 
15625) >> 10,
 state->src_h >> 16, ((state->src_h & 0x) * 
15625) >> 10,
 state->src_x >> 16, ((state->src_x & 0x) * 
15625) >> 10,
-state->src_y >> 16, ((state->src_y & 0x) * 
15625) >> 10);
+state->src_y >> 16, ((state->src_y & 0x) * 
15625) >> 10,
+state->fb->width, state->fb->height);
return -ENOSPC;
}
 
diff --git a/drivers/gpu/drm/drm_framebuffer.c 
b/drivers/gpu/drm/drm_framebuffer.c
index 2affe53f3fda..0354dcf57038 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -78,11 +78,12 @@ int drm_framebuffer_check_src_coords(uint32_t src_x, 
uint32_t src_y,
src_h > fb_height ||
src_y > fb_height - src_h) {
DRM_DEBUG_KMS("Invalid source coordinates "
- "%u.%06ux%u.%06u+%u.%06u+%u.%06u\n",
+ "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n",
  src_w >> 16, ((src_w & 0x) * 15625) >> 10,
  src_h >> 16, ((src_h & 0x) * 15625) >> 10,
  src_x >> 16, ((src_x & 0x) * 15625) >> 10,
- src_y >> 16, ((src_y & 0x) * 15625) >> 10);
+ src_y >> 16, ((src_y & 0x) * 15625) >> 10,
+ fb->width, fb->height);
return -ENOSPC;
}
 
-- 
2.13.6

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


[PATCH 5/5] drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

drm_plane_helper_check_update() isn't a transitional helper, so let's
rename it to drm_atomic_helper_check_plane_state() and move it into
drm_atomic_helper.c.

Cc: Daniel Vetter 
Suggested-by: Daniel Vetter 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/arm/hdlcd_crtc.c|   8 +--
 drivers/gpu/drm/arm/malidp_planes.c |   4 +-
 drivers/gpu/drm/drm_atomic_helper.c |  95 +
 drivers/gpu/drm/drm_plane_helper.c  | 103 ++--
 drivers/gpu/drm/drm_simple_kms_helper.c |   9 +--
 drivers/gpu/drm/i915/intel_display.c|  22 +++---
 drivers/gpu/drm/imx/ipuv3-plane.c   |   8 +--
 drivers/gpu/drm/mediatek/mtk_drm_plane.c|   8 +--
 drivers/gpu/drm/meson/meson_plane.c |   8 +--
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c  |  20 +++---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |   8 +--
 drivers/gpu/drm/zte/zx_plane.c  |  15 ++--
 include/drm/drm_atomic_helper.h |   7 ++
 include/drm/drm_plane_helper.h  |   6 --
 17 files changed, 170 insertions(+), 166 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 14721723fa8a..63511a3bbf6c 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -252,10 +252,10 @@ static int hdlcd_plane_atomic_check(struct drm_plane 
*plane,
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-   return drm_plane_helper_check_state(state, crtc_state, ,
-   DRM_PLANE_HELPER_NO_SCALING,
-   DRM_PLANE_HELPER_NO_SCALING,
-   false, true);
+   return drm_atomic_helper_check_plane_state(state, crtc_state, ,
+  DRM_PLANE_HELPER_NO_SCALING,
+  DRM_PLANE_HELPER_NO_SCALING,
+  false, true);
 }
 
 static void hdlcd_plane_atomic_update(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/arm/malidp_planes.c 
b/drivers/gpu/drm/arm/malidp_planes.c
index 492d99dd55d4..72a07950167e 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -150,8 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
-   ret = drm_plane_helper_check_state(state, crtc_state, ,
-  0, INT_MAX, true, true);
+   ret = drm_atomic_helper_check_plane_state(state, crtc_state, ,
+ 0, INT_MAX, true, true);
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 71d712f1b56a..7595ad8ad2f3 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -696,6 +696,101 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
 
 /**
+ * drm_atomic_helper_check_plane_state() - Check plane state for validity
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
+ * @clip: integer clipping coordinates
+ * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
+ * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
+ * @can_position: is it legal to position the plane such that it
+ *doesn't cover the entire crtc?  This will generally
+ *only be false for primary planes.
+ * @can_update_disabled: can the plane be updated while the crtc
+ *   is disabled?
+ *
+ * Checks that a desired plane update is valid, and updates various
+ * bits of derived state (clipped coordinates etc.). Drivers that provide
+ * their own plane handling rather than helper-provided implementations may
+ * still wish to call this function to avoid duplication of error checking
+ * code.
+ *
+ * RETURNS:
+ * Zero if update appears valid, error code on failure
+ */
+int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
+   const struct drm_crtc_state *crtc_state,
+   const struct drm_rect *clip,
+   int min_scale,
+   int max_scale,
+   bool can_position,
+   bool can_update_disabled)
+{
+   struct 

[PATCH 4/5] drm: Check crtc_state->enable rather than crtc->enabled in drm_plane_helper_check_state()

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

drm_plane_helper_check_state() is supposed to do things the atomic way,
so it should not be inspecting crtc->enabled. Rather we should be
looking at crtc_state->enable.

We have a slight complication due to drm_plane_helper_check_update()
reusing drm_plane_helper_check_state() for non-atomic drivers. Thus
we'll have to pass the crtc_state in manally and construct a fake
crtc_state in drm_plane_helper_check_update().

Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/arm/hdlcd_crtc.c|  2 +-
 drivers/gpu/drm/arm/malidp_planes.c |  3 +-
 drivers/gpu/drm/drm_plane_helper.c  | 52 +
 drivers/gpu/drm/drm_simple_kms_helper.c |  2 +-
 drivers/gpu/drm/i915/intel_display.c|  2 ++
 drivers/gpu/drm/imx/ipuv3-plane.c   |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c|  2 +-
 drivers/gpu/drm/meson/meson_plane.c |  2 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |  4 +--
 drivers/gpu/drm/nouveau/nv50_display.c  |  6 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  2 +-
 drivers/gpu/drm/tegra/dc.c  |  4 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |  2 +-
 drivers/gpu/drm/zte/zx_plane.c  |  4 +--
 include/drm/drm_plane_helper.h  |  3 +-
 15 files changed, 53 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 72b22b805412..14721723fa8a 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -252,7 +252,7 @@ static int hdlcd_plane_atomic_check(struct drm_plane *plane,
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
 
-   return drm_plane_helper_check_state(state, ,
+   return drm_plane_helper_check_state(state, crtc_state, ,
DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING,
false, true);
diff --git a/drivers/gpu/drm/arm/malidp_planes.c 
b/drivers/gpu/drm/arm/malidp_planes.c
index 94e7e3fa3408..492d99dd55d4 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -150,7 +150,8 @@ static int malidp_se_check_scaling(struct malidp_plane *mp,
 
clip.x2 = crtc_state->adjusted_mode.hdisplay;
clip.y2 = crtc_state->adjusted_mode.vdisplay;
-   ret = drm_plane_helper_check_state(state, , 0, INT_MAX, true, 
true);
+   ret = drm_plane_helper_check_state(state, crtc_state, ,
+  0, INT_MAX, true, true);
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c 
b/drivers/gpu/drm/drm_plane_helper.c
index 759ed93f4ba8..adb8d94484f2 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -101,7 +101,8 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
 
 /**
  * drm_plane_helper_check_state() - Check plane state for validity
- * @state: plane state to check
+ * @plane_state: plane state to check
+ * @crtc_state: crtc state to check
  * @clip: integer clipping coordinates
  * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
  * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
@@ -120,35 +121,38 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
  * RETURNS:
  * Zero if update appears valid, error code on failure
  */
-int drm_plane_helper_check_state(struct drm_plane_state *state,
+int drm_plane_helper_check_state(struct drm_plane_state *plane_state,
+const struct drm_crtc_state *crtc_state,
 const struct drm_rect *clip,
 int min_scale,
 int max_scale,
 bool can_position,
 bool can_update_disabled)
 {
-   struct drm_crtc *crtc = state->crtc;
-   struct drm_framebuffer *fb = state->fb;
-   struct drm_rect *src = >src;
-   struct drm_rect *dst = >dst;
-   unsigned int rotation = state->rotation;
+   struct drm_framebuffer *fb = plane_state->fb;
+   struct drm_rect *src = _state->src;
+   struct drm_rect *dst = _state->dst;
+   unsigned int rotation = plane_state->rotation;
int hscale, vscale;
 
-   *src = drm_plane_state_src(state);
-   *dst = drm_plane_state_dest(state);
+   WARN_ON(!crtc_state != !plane_state->crtc);
+   WARN_ON(crtc_state && crtc_state->crtc != plane_state->crtc);
+
+   *src = drm_plane_state_src(plane_state);
+   *dst = drm_plane_state_dest(plane_state);
 
if (!fb) {
-   state->visible = false;
+   plane_state->visible = false;
return 0;
}
 
/* crtc 

[PATCH 3/5] drm/vmwgfx: Try to fix plane clipping

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

Try to fix the code to actually clip the plane to the crtc bounds
instead of the user provided crtc coordinates (which would be a no-op
since those are exactly the coordinates before clipping).

Cc: VMware Graphics 
Cc: Sinclair Yeh 
Cc: Thomas Hellstrom 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 515b67783a41..efa41c086198 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -441,20 +441,23 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
  struct drm_plane_state *state)
 {
+   struct drm_crtc_state *crtc_state = NULL;
struct drm_framebuffer *new_fb = state->fb;
-   struct drm_rect clip = {
-   .x1 = state->crtc_x,
-   .y1 = state->crtc_y,
-   .x2 = state->crtc_x + state->crtc_w,
-   .y2 = state->crtc_y + state->crtc_h,
-   };
+   struct drm_rect clip = {};
int ret;
 
-   ret = drm_plane_helper_check_state(state, ,
-   DRM_PLANE_HELPER_NO_SCALING,
-   DRM_PLANE_HELPER_NO_SCALING,
-   false, true);
+   if (state->crtc)
+   crtc_state = drm_atomic_get_new_crtc_state(state->state, 
state->crtc);
 
+   if (crtc_state && crtc_state->enable) {
+   clip.x2 = crtc_state->adjusted_mode.hdisplay;
+   clip.y2 = crtc_state->adjusted_mode.vdisplay;
+   }
+
+   ret = drm_plane_helper_check_state(state, ,
+  DRM_PLANE_HELPER_NO_SCALING,
+  DRM_PLANE_HELPER_NO_SCALING,
+  false, true);
 
if (!ret && new_fb) {
struct drm_crtc *crtc = state->crtc;
-- 
2.13.6

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


[PATCH 1/5] drm/vmwgfx: Remove bogus crtc coords vs fb size check

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

Throw away the bugs crtc coords vs. fb size check. Crtc coords don't
define the viewport inside the fb, that's a job for the src coords,
which have been checked by the core already.

Cc: VMware Graphics 
Cc: Sinclair Yeh 
Cc: Thomas Hellstrom 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 0545740b3724..a4b56699679a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -476,12 +476,6 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane 
*plane,
 
vcs = vmw_connector_state_to_vcs(du->connector.state);
 
-   if ((dest.x2 > new_fb->width ||
-dest.y2 > new_fb->height)) {
-   DRM_ERROR("CRTC area outside of framebuffer\n");
-   return -EINVAL;
-   }
-
/* Only one active implicit framebuffer at a time. */
mutex_lock(_priv->global_kms_state_mutex);
if (vcs->is_implicit && dev_priv->implicit_fb &&
-- 
2.13.6

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


[PATCH 2/5] drm/vmwgfx: Use drm_plane_helper_check_state()

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

Atomic drivers have no reason to use drm_plane_helper_check_update()
instead of drm_plane_helper_check_state(). So let's switch over.

Cc: VMware Graphics 
Cc: Sinclair Yeh 
Cc: Thomas Hellstrom 
Signed-off-by: Ville Syrjälä 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index a4b56699679a..515b67783a41 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -442,29 +442,18 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane 
*plane,
  struct drm_plane_state *state)
 {
struct drm_framebuffer *new_fb = state->fb;
-   bool visible;
-
-   struct drm_rect src = {
-   .x1 = state->src_x,
-   .y1 = state->src_y,
-   .x2 = state->src_x + state->src_w,
-   .y2 = state->src_y + state->src_h,
-   };
-   struct drm_rect dest = {
+   struct drm_rect clip = {
.x1 = state->crtc_x,
.y1 = state->crtc_y,
.x2 = state->crtc_x + state->crtc_w,
.y2 = state->crtc_y + state->crtc_h,
};
-   struct drm_rect clip = dest;
int ret;
 
-   ret = drm_plane_helper_check_update(plane, state->crtc, new_fb,
-   , , ,
-   DRM_MODE_ROTATE_0,
+   ret = drm_plane_helper_check_state(state, ,
DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING,
-   false, true, );
+   false, true);
 
 
if (!ret && new_fb) {
-- 
2.13.6

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


[PATCH 0/5] drm: drm_plane_helper_check_state() related stuff

2017-11-01 Thread Ville Syrjala
From: Ville Syrjälä 

While trawling the tree I spotted some issues with the way vmwgfx
uses drm_plane_helper_check_state(). Here's my attempt at fixing it.
Do note that I haven't actually tested the resulting code at all,
but it does build at least.

And while touching that general area I took up Daniel's suggestion from
long ago that drm_plane_helper_check_state() should be renamed and
relocated to better reflect its status.

Here's a branch with the entire series:
git://github.com/vsyrjala/linux.git atomic_helper_plane_stuff

Cc: VMware Graphics 
Cc: Sinclair Yeh 
Cc: Thomas Hellstrom 
Cc: Daniel Vetter 

Ville Syrjälä (5):
  drm/vmwgfx: Remove bogus crtc coords vs fb size check
  drm/vmwgfx: Use drm_plane_helper_check_state()
  drm/vmwgfx: Try to fix plane clipping
  drm: Check crtc_state->enable rather than crtc->enabled in
drm_plane_helper_check_state()
  drm: Move drm_plane_helper_check_state() into drm_atomic_helper.c

 drivers/gpu/drm/arm/hdlcd_crtc.c|   8 +-
 drivers/gpu/drm/arm/malidp_planes.c |   3 +-
 drivers/gpu/drm/drm_atomic_helper.c |  95 
 drivers/gpu/drm/drm_plane_helper.c  | 111 +++-
 drivers/gpu/drm/drm_simple_kms_helper.c |   9 ++-
 drivers/gpu/drm/i915/intel_display.c|  20 ++---
 drivers/gpu/drm/imx/ipuv3-plane.c   |   8 +-
 drivers/gpu/drm/mediatek/mtk_drm_plane.c|   8 +-
 drivers/gpu/drm/meson/meson_plane.c |   8 +-
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c   |   5 +-
 drivers/gpu/drm/nouveau/nv50_display.c  |  18 +++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   6 +-
 drivers/gpu/drm/tegra/dc.c  |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |  40 --
 drivers/gpu/drm/zte/zx_plane.c  |  15 ++--
 include/drm/drm_atomic_helper.h |   7 ++
 include/drm/drm_plane_helper.h  |   5 --
 17 files changed, 187 insertions(+), 183 deletions(-)

-- 
2.13.6

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


Re: [PATCH hwc] drm_hwcomposer: Add HDMI connector as a valid type

2017-11-01 Thread Robert Foss
Hi Rob,

Pushed to master.


Rob.

On Wed, 2017-11-01 at 12:50 -0500, Rob Herring wrote:
> From: Robert Foss 
> 
> Accept DRM_MODE_CONNECTOR_HDMIA connector type.
> 
> Look for primary DrmConnector amongst external connectors
> after looking for primary amongst internal ones first.
> 
> Signed-off-by: Robert Foss 
> Signed-off-by: Rob Herring 
> ---
> This is needed to get dev boards like DB410c to work.
> 
>  drmconnector.cpp | 10 +-
>  drmconnector.h   |  4 +++-
>  drmresources.cpp | 16 ++--
>  3 files changed, 26 insertions(+), 4 deletions(-)
> 
> diff --git a/drmconnector.cpp b/drmconnector.cpp
> index ccb38e2f00dc..247f56bde748 100644
> --- a/drmconnector.cpp
> +++ b/drmconnector.cpp
> @@ -67,11 +67,19 @@ void DrmConnector::set_display(int display) {
>display_ = display;
>  }
>  
> -bool DrmConnector::built_in() const {
> +bool DrmConnector::internal() const {
>return type_ == DRM_MODE_CONNECTOR_LVDS || type_ ==
> DRM_MODE_CONNECTOR_eDP ||
>   type_ == DRM_MODE_CONNECTOR_DSI || type_ ==
> DRM_MODE_CONNECTOR_VIRTUAL;
>  }
>  
> +bool DrmConnector::external() const {
> +  return type_ == DRM_MODE_CONNECTOR_HDMIA;
> +}
> +
> +bool DrmConnector::valid_type() const {
> +  return internal() || external();
> +}
> +
>  int DrmConnector::UpdateModes() {
>int fd = drm_->fd();
>  
> diff --git a/drmconnector.h b/drmconnector.h
> index e1488bb42a9a..5601e069f003 100644
> --- a/drmconnector.h
> +++ b/drmconnector.h
> @@ -44,7 +44,9 @@ class DrmConnector {
>int display() const;
>void set_display(int display);
>  
> -  bool built_in() const;
> +  bool internal() const;
> +  bool external() const;
> +  bool valid_type() const;
>  
>int UpdateModes();
>  
> diff --git a/drmresources.cpp b/drmresources.cpp
> index 67a853c587b3..32dd37636e73 100644
> --- a/drmresources.cpp
> +++ b/drmresources.cpp
> @@ -154,16 +154,28 @@ int DrmResources::Init() {
>break;
>  }
>  
> -if (conn->built_in() && !found_primary) {
> +connectors_.emplace_back(std::move(conn));
> +  }
> +
> +  // First look for primary amongst internal connectors
> +  for (auto  : connectors_) {
> +if (conn->internal() && !found_primary) {
>conn->set_display(0);
>found_primary = true;
>  } else {
>conn->set_display(display_num);
>++display_num;
>  }
> +  }
>  
> -connectors_.emplace_back(std::move(conn));
> +  // Then look for primary amongst external connectors
> +  for (auto  : connectors_) {
> +if (conn->external() && !found_primary) {
> +  conn->set_display(0);
> +  found_primary = true;
> +}
>}
> +
>if (res)
>  drmModeFreeResources(res);
>  

signature.asc
Description: This is a digitally signed message part
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH hwc] drm_hwcomposer: correct handling of DRM_MODE_ROTATE_0

2017-11-01 Thread Robert Foss
Hi Rob,

On Wed, 2017-11-01 at 12:50 -0500, Rob Herring wrote:
> On Wed, Nov 1, 2017 at 11:37 AM, Rob Herring  wrote:
> > If the rotation property is supported for a plane, then the
> > rotation
> > value must be non-zero. For the case of 0 degree rotation,
> > DRM_MODE_ROTATE_0 needs to be set.
> > 
> > Signed-off-by: Rob Herring 
> > ---
> >  drmdisplaycompositor.cpp | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> Pushed to master.

Thanks :)


signature.asc
Description: This is a digitally signed message part
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH hwc] drm_hwcomposer: correct handling of DRM_MODE_ROTATE_0

2017-11-01 Thread Rob Herring
On Wed, Nov 1, 2017 at 11:37 AM, Rob Herring  wrote:
> If the rotation property is supported for a plane, then the rotation
> value must be non-zero. For the case of 0 degree rotation,
> DRM_MODE_ROTATE_0 needs to be set.
>
> Signed-off-by: Rob Herring 
> ---
>  drmdisplaycompositor.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

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


[PATCH hwc] drm_hwcomposer: Add HDMI connector as a valid type

2017-11-01 Thread Rob Herring
From: Robert Foss 

Accept DRM_MODE_CONNECTOR_HDMIA connector type.

Look for primary DrmConnector amongst external connectors
after looking for primary amongst internal ones first.

Signed-off-by: Robert Foss 
Signed-off-by: Rob Herring 
---
This is needed to get dev boards like DB410c to work.

 drmconnector.cpp | 10 +-
 drmconnector.h   |  4 +++-
 drmresources.cpp | 16 ++--
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/drmconnector.cpp b/drmconnector.cpp
index ccb38e2f00dc..247f56bde748 100644
--- a/drmconnector.cpp
+++ b/drmconnector.cpp
@@ -67,11 +67,19 @@ void DrmConnector::set_display(int display) {
   display_ = display;
 }
 
-bool DrmConnector::built_in() const {
+bool DrmConnector::internal() const {
   return type_ == DRM_MODE_CONNECTOR_LVDS || type_ == DRM_MODE_CONNECTOR_eDP ||
  type_ == DRM_MODE_CONNECTOR_DSI || type_ == 
DRM_MODE_CONNECTOR_VIRTUAL;
 }
 
+bool DrmConnector::external() const {
+  return type_ == DRM_MODE_CONNECTOR_HDMIA;
+}
+
+bool DrmConnector::valid_type() const {
+  return internal() || external();
+}
+
 int DrmConnector::UpdateModes() {
   int fd = drm_->fd();
 
diff --git a/drmconnector.h b/drmconnector.h
index e1488bb42a9a..5601e069f003 100644
--- a/drmconnector.h
+++ b/drmconnector.h
@@ -44,7 +44,9 @@ class DrmConnector {
   int display() const;
   void set_display(int display);
 
-  bool built_in() const;
+  bool internal() const;
+  bool external() const;
+  bool valid_type() const;
 
   int UpdateModes();
 
diff --git a/drmresources.cpp b/drmresources.cpp
index 67a853c587b3..32dd37636e73 100644
--- a/drmresources.cpp
+++ b/drmresources.cpp
@@ -154,16 +154,28 @@ int DrmResources::Init() {
   break;
 }
 
-if (conn->built_in() && !found_primary) {
+connectors_.emplace_back(std::move(conn));
+  }
+
+  // First look for primary amongst internal connectors
+  for (auto  : connectors_) {
+if (conn->internal() && !found_primary) {
   conn->set_display(0);
   found_primary = true;
 } else {
   conn->set_display(display_num);
   ++display_num;
 }
+  }
 
-connectors_.emplace_back(std::move(conn));
+  // Then look for primary amongst external connectors
+  for (auto  : connectors_) {
+if (conn->external() && !found_primary) {
+  conn->set_display(0);
+  found_primary = true;
+}
   }
+
   if (res)
 drmModeFreeResources(res);
 
-- 
2.14.1

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


Re: [Intel-gfx] [maintainer-tools PATCH] dim: Sign commits in addition to tags

2017-11-01 Thread Sean Paul
On Wed, Nov 1, 2017 at 1:00 PM, Eric Anholt  wrote:
> Sean Paul  writes:
>
>> On Wed, Nov 1, 2017 at 7:12 AM, Gustavo Padovan  wrote:
>>> 2017-10-31 Sean Paul :
>>>
 On Tue, Oct 31, 2017 at 1:31 PM, Daniel Vetter  wrote:
 > On Tue, Oct 31, 2017 at 5:14 PM, Sean Paul  wrote:
 >> On Tue, Oct 31, 2017 at 4:27 AM, Jani Nikula
 >>  wrote:
 >>>
 >>> Reminder, we have this new list dim-to...@lists.freedesktop.org for
 >>> maintainer tools patches. Cc'd.
 >>>
 >>
 >> Ahh, cool. I didn't realize dim grew up!
 >>
 >>> On Mon, 30 Oct 2017, Sean Paul  wrote:
  Expanding on Jani's work to sign tags, this patch adds signing for git
  commit/am.
 >>>
 >>> I guess I'd like more rationale here. Is this something we should be
 >>> doing? Is anyone else doing this?
 >>>
 >>
 >> Sure thing. Signing commits allows Dave to use --verify-signatures
 >> when pulling. If something is not signed, we'll know it was either not
 >> applied with dim, or was altered on fdo (both warrant investigation).
 >>
 >> I suspect no one else is doing this since most trees are single
 >> maintainer, and it's not possible to sign commits via git send-email.
 >> Since we have the committer model, and a bunch of people with access
 >> to fdo and the tree, I think it's important to add this. Especially
 >> since we can do it in dim without overhead.
 >>
  Signed-off-by: Sean Paul 
  ---
 
  This has been lightly tested with dim apply-branch/dim push-branch.
 
  Sean
 
   dim | 78 
  +
   1 file changed, 51 insertions(+), 27 deletions(-)
 
  diff --git a/dim b/dim
  index 527989aff9ad..cd5e41f89a3a 100755
  --- a/dim
  +++ b/dim
  @@ -67,9 +67,6 @@ 
  DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature}
   # dim pull-request tag summary template
   
  DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-$HOME/.dim.template.tagsummary}
 
  -# GPG key id for signing tags. If unset, don't sign.
  -DIM_GPG_KEYID=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
  -
   #
   # Internal configuration.
   #
  @@ -104,6 +101,20 @@ test_request_recipients=(
   # integration configuration
   integration_config=nightly.conf
 
  +# GPG key id for signing tags. If unset, don't sign.
  +function gpg_keyid_for_tag
  +{
  + echo "${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}"
  + return 0
  +}
  +
  +# GPG key id for committing (git commit/am). If unset, don't sign.
  +function gpg_keyid_for_commit
  +{
  + echo "${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}"
  + return 0
  +}
 >>>
 >>> This seems like an overly complicated way to achieve what you want.
 >>>
 >>> Just put these under "Internal configuration." instead:
 >>>
 >>> dim_gpg_sign_tag=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
 >>> dim_gpg_sign_commit=${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}
 >>>
 >>> And use directly in git tag and commit, respectively?
 >>>
 >>
 >> Yep, sounds good.
 >>
 >>> Although... perhaps starting to sign tags should not force signing
 >>> commits?
 >>>
 >>
 >> Why would it be desirable to *not* sign tags?
 >
 > Again, what's the threat model you're trying to defend against? Atm
 > anyone with commit rights to fd.o can push whatever they want to. If
 > they want to be evil, they can also push whatever kind of garbage they
 > want to, including commit signature and and fake Link: and review
 > tags. With pull requests/tags signing them prevents a
 > man-in-the-midddle attack of the unprotected pull request in the mail,
 > but I still don't see what signing commits protects against.

 This is protecting against a bad actor (either through a committer's
 account, or some other fdo account) gaining access to the tree on fdo
 and either adding a malicious commit, or altering an existing commit.
>>>
>>> Yeah, but then we need to enforce it for all committer
>>
>> My hope is that dim makes it easy enough to get everyone on board
>> eventually. In the interim, the people with signing commits will be
>> able to attest that those commits were applied by them.
>>
>>> and we also need
>>> a signing party to sign each others keys.
>>
>> I feel like most of us see each other often enough to make this
>> possible. Even without a signing party, we still get 

Re: [Intel-gfx] [PATCH] drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.

2017-11-01 Thread Maarten Lankhorst
Op 01-11-17 om 18:00 schreef Ville Syrjälä:
> On Wed, Nov 01, 2017 at 04:55:06PM +0100, Maarten Lankhorst wrote:
>> Op 01-11-17 om 16:29 schreef Ville Syrjälä:
>>> On Wed, Nov 01, 2017 at 04:04:33PM +0100, Maarten Lankhorst wrote:
 This introduces a slight behavioral change to rmfb. Instead of
 disabling a crtc when the primary plane is disabled, we try to
 preserve it.

 Apart from old versions of the vmwgfx xorg driver, there is
 nothing depending on rmfb disabling a crtc.

 Vmwgfx' and simple kms helper atomic implementation rejects CRTC
 enabled without plane, so we can do this safely.
> The code for those seems a bit inconsistent. The crtc check requires
> that the crtc state and plane state match. But the plane check allows
> the plane to be enabled w/o the crtc being enabled. I guess it doesn't
> matter really since you can't enable the plane without a crtc, and the
> crtc check would then catch the case where the crtc would be disabled.
>
> Oh and looks like drm_plane_helper_check_state() is a bit buggy. It
> still uses crtc->enabled instead of crtc_state->enable to check the
> state of the crtc. I guess to keep drm_plane_helper_check_update()
> working we may have to pass in the crtc state manually.
This is the transitional helper. i915 gets away with it because it passes the 
flag that ignores crtc->enabled.
> The vmwgfx plane check looks a bit bogus in other ways too. I guess
> I'll have to fire off a couple of patches.
>
 If the atomic commit is rejected by the driver then we will still
 fall back to the old behavior and turn off the crtc.

 Changes since v1:
 - Restart completely when rmfb with crtc on fails (Sean Paul).

 Signed-off-by: Maarten Lankhorst 
 Cc: Sean Paul 
 Cc: Daniel Vetter 
 ---
  drivers/gpu/drm/drm_framebuffer.c | 23 +--
  1 file changed, 17 insertions(+), 6 deletions(-)

 diff --git a/drivers/gpu/drm/drm_framebuffer.c 
 b/drivers/gpu/drm/drm_framebuffer.c
 index 2affe53f3fda..f0679468f421 100644
 --- a/drivers/gpu/drm/drm_framebuffer.c
 +++ b/drivers/gpu/drm/drm_framebuffer.c
 @@ -765,14 +765,18 @@ static int atomic_remove_fb(struct drm_framebuffer 
 *fb)
struct drm_plane *plane;
struct drm_connector *conn;
struct drm_connector_state *conn_state;
 -  int i, ret = 0;
 +  int i, ret;
unsigned plane_mask;
 +  bool disable_crtcs = false;
  
 -  state = drm_atomic_state_alloc(dev);
 -  if (!state)
 -  return -ENOMEM;
 -
 +retry_disable:
drm_modeset_acquire_init(, 0);
 +
 +  state = drm_atomic_state_alloc(dev);
 +  if (!state) {
 +  ret = -ENOMEM;
 +  goto out;
 +  }
state->acquire_ctx = 
  
  retry:
 @@ -793,7 +797,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
goto unlock;
}
  
 -  if (plane_state->crtc->primary == plane) {
 +  if (disable_crtcs && plane_state->crtc->primary == plane) {
struct drm_crtc_state *crtc_state;
  
crtc_state = drm_atomic_get_existing_crtc_state(state, 
 plane_state->crtc);
 @@ -818,6 +822,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
plane->old_fb = plane->fb;
}
  
 +  /* This list is only filled when disable_crtcs is set. */
for_each_new_connector_in_state(state, conn, conn_state, i) {
>>> WARN_ON(!disable_crtcs) maybe?
>> Would be overkill, nothing before it adds connector state, and if atomic 
>> check does then that's fine, but it won't be run here. :)
> It would serve as a way to document that fact, even without the comment.
> But I won't insist on it.
>
ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
  
 @@ -840,9 +845,15 @@ static int atomic_remove_fb(struct drm_framebuffer 
 *fb)
  
drm_atomic_state_put(state);
  
 +out:
drm_modeset_drop_locks();
drm_modeset_acquire_fini();
  
 +  if (ret == -EINVAL && !disable_crtcs) {
>>> Hmm. -EINVAL seems rather specific. Not sure if we could just check for
>>> any error?
>>>
>>> Or... I'm not sure if we have any central place where we do the
>>> "can I disable the primary plane w/o disabling the crtc?" check. If we
>>> do then we could also add a comment there informing people that the
>>> -EINVAL is important.
>> We don't have a central place, I check for EINVAL since that is the generic 
>> atomic_check() failed error. If it fails for any other reason then we don't 
>> have to retry, but pass it along. :)
> Oh well. I guess people just have to be careful with their error
> values. I suppoe anyone depending on the retry will notice this
> issue rather quickly.
Yes. :)



[Bug 103486] Tonga DC vblank_mode=0 not working as expected fullscreen

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

Bhawan Lakha  changed:

   What|Removed |Added

 Attachment #135202|0   |1
is obsolete||

--- Comment #10 from Bhawan Lakha  ---
Created attachment 135203
  --> https://bugs.freedesktop.org/attachment.cgi?id=135203=edit
Unix-style line terminators

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


[Bug 103486] Tonga DC vblank_mode=0 not working as expected fullscreen

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

--- Comment #9 from Michel Dänzer  ---
(In reply to Bhawan Lakha from comment #8)
> Created attachment 135202 [details] [review]
> Patch to fix vblank_mode not working properly

Tested-by: Michel Dänzer 

P.S. I had to convert the patch from DOS- to Unix-style line terminators before
applying it.

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


[Bug 103486] Tonga DC vblank_mode=0 not working as expected fullscreen

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

Bhawan Lakha  changed:

   What|Removed |Added

 CC||bhawanpreet.la...@amd.com

--- Comment #8 from Bhawan Lakha  ---
Created attachment 135202
  --> https://bugs.freedesktop.org/attachment.cgi?id=135202=edit
Patch to fix vblank_mode not working properly

Please try this patch

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


Re: [Intel-gfx] [PATCH] drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.

2017-11-01 Thread Ville Syrjälä
On Wed, Nov 01, 2017 at 04:55:06PM +0100, Maarten Lankhorst wrote:
> Op 01-11-17 om 16:29 schreef Ville Syrjälä:
> > On Wed, Nov 01, 2017 at 04:04:33PM +0100, Maarten Lankhorst wrote:
> >> This introduces a slight behavioral change to rmfb. Instead of
> >> disabling a crtc when the primary plane is disabled, we try to
> >> preserve it.
> >>
> >> Apart from old versions of the vmwgfx xorg driver, there is
> >> nothing depending on rmfb disabling a crtc.
> >>
> >> Vmwgfx' and simple kms helper atomic implementation rejects CRTC
> >> enabled without plane, so we can do this safely.

The code for those seems a bit inconsistent. The crtc check requires
that the crtc state and plane state match. But the plane check allows
the plane to be enabled w/o the crtc being enabled. I guess it doesn't
matter really since you can't enable the plane without a crtc, and the
crtc check would then catch the case where the crtc would be disabled.

Oh and looks like drm_plane_helper_check_state() is a bit buggy. It
still uses crtc->enabled instead of crtc_state->enable to check the
state of the crtc. I guess to keep drm_plane_helper_check_update()
working we may have to pass in the crtc state manually.

The vmwgfx plane check looks a bit bogus in other ways too. I guess
I'll have to fire off a couple of patches.

> >>
> >> If the atomic commit is rejected by the driver then we will still
> >> fall back to the old behavior and turn off the crtc.
> >>
> >> Changes since v1:
> >> - Restart completely when rmfb with crtc on fails (Sean Paul).
> >>
> >> Signed-off-by: Maarten Lankhorst 
> >> Cc: Sean Paul 
> >> Cc: Daniel Vetter 
> >> ---
> >>  drivers/gpu/drm/drm_framebuffer.c | 23 +--
> >>  1 file changed, 17 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_framebuffer.c 
> >> b/drivers/gpu/drm/drm_framebuffer.c
> >> index 2affe53f3fda..f0679468f421 100644
> >> --- a/drivers/gpu/drm/drm_framebuffer.c
> >> +++ b/drivers/gpu/drm/drm_framebuffer.c
> >> @@ -765,14 +765,18 @@ static int atomic_remove_fb(struct drm_framebuffer 
> >> *fb)
> >>struct drm_plane *plane;
> >>struct drm_connector *conn;
> >>struct drm_connector_state *conn_state;
> >> -  int i, ret = 0;
> >> +  int i, ret;
> >>unsigned plane_mask;
> >> +  bool disable_crtcs = false;
> >>  
> >> -  state = drm_atomic_state_alloc(dev);
> >> -  if (!state)
> >> -  return -ENOMEM;
> >> -
> >> +retry_disable:
> >>drm_modeset_acquire_init(, 0);
> >> +
> >> +  state = drm_atomic_state_alloc(dev);
> >> +  if (!state) {
> >> +  ret = -ENOMEM;
> >> +  goto out;
> >> +  }
> >>state->acquire_ctx = 
> >>  
> >>  retry:
> >> @@ -793,7 +797,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
> >>goto unlock;
> >>}
> >>  
> >> -  if (plane_state->crtc->primary == plane) {
> >> +  if (disable_crtcs && plane_state->crtc->primary == plane) {
> >>struct drm_crtc_state *crtc_state;
> >>  
> >>crtc_state = drm_atomic_get_existing_crtc_state(state, 
> >> plane_state->crtc);
> >> @@ -818,6 +822,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
> >>plane->old_fb = plane->fb;
> >>}
> >>  
> >> +  /* This list is only filled when disable_crtcs is set. */
> >>for_each_new_connector_in_state(state, conn, conn_state, i) {
> > WARN_ON(!disable_crtcs) maybe?
> Would be overkill, nothing before it adds connector state, and if atomic 
> check does then that's fine, but it won't be run here. :)

It would serve as a way to document that fact, even without the comment.
But I won't insist on it.

> >>ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
> >>  
> >> @@ -840,9 +845,15 @@ static int atomic_remove_fb(struct drm_framebuffer 
> >> *fb)
> >>  
> >>drm_atomic_state_put(state);
> >>  
> >> +out:
> >>drm_modeset_drop_locks();
> >>drm_modeset_acquire_fini();
> >>  
> >> +  if (ret == -EINVAL && !disable_crtcs) {
> > Hmm. -EINVAL seems rather specific. Not sure if we could just check for
> > any error?
> >
> > Or... I'm not sure if we have any central place where we do the
> > "can I disable the primary plane w/o disabling the crtc?" check. If we
> > do then we could also add a comment there informing people that the
> > -EINVAL is important.
> We don't have a central place, I check for EINVAL since that is the generic 
> atomic_check() failed error. If it fails for any other reason then we don't 
> have to retry, but pass it along. :)

Oh well. I guess people just have to be careful with their error
values. I suppoe anyone depending on the retry will notice this
issue rather quickly.

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


Re: [Intel-gfx] [maintainer-tools PATCH] dim: Sign commits in addition to tags

2017-11-01 Thread Eric Anholt
Sean Paul  writes:

> On Wed, Nov 1, 2017 at 7:12 AM, Gustavo Padovan  wrote:
>> 2017-10-31 Sean Paul :
>>
>>> On Tue, Oct 31, 2017 at 1:31 PM, Daniel Vetter  wrote:
>>> > On Tue, Oct 31, 2017 at 5:14 PM, Sean Paul  wrote:
>>> >> On Tue, Oct 31, 2017 at 4:27 AM, Jani Nikula
>>> >>  wrote:
>>> >>>
>>> >>> Reminder, we have this new list dim-to...@lists.freedesktop.org for
>>> >>> maintainer tools patches. Cc'd.
>>> >>>
>>> >>
>>> >> Ahh, cool. I didn't realize dim grew up!
>>> >>
>>> >>> On Mon, 30 Oct 2017, Sean Paul  wrote:
>>>  Expanding on Jani's work to sign tags, this patch adds signing for git
>>>  commit/am.
>>> >>>
>>> >>> I guess I'd like more rationale here. Is this something we should be
>>> >>> doing? Is anyone else doing this?
>>> >>>
>>> >>
>>> >> Sure thing. Signing commits allows Dave to use --verify-signatures
>>> >> when pulling. If something is not signed, we'll know it was either not
>>> >> applied with dim, or was altered on fdo (both warrant investigation).
>>> >>
>>> >> I suspect no one else is doing this since most trees are single
>>> >> maintainer, and it's not possible to sign commits via git send-email.
>>> >> Since we have the committer model, and a bunch of people with access
>>> >> to fdo and the tree, I think it's important to add this. Especially
>>> >> since we can do it in dim without overhead.
>>> >>
>>>  Signed-off-by: Sean Paul 
>>>  ---
>>> 
>>>  This has been lightly tested with dim apply-branch/dim push-branch.
>>> 
>>>  Sean
>>> 
>>>   dim | 78 
>>>  +
>>>   1 file changed, 51 insertions(+), 27 deletions(-)
>>> 
>>>  diff --git a/dim b/dim
>>>  index 527989aff9ad..cd5e41f89a3a 100755
>>>  --- a/dim
>>>  +++ b/dim
>>>  @@ -67,9 +67,6 @@ 
>>>  DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature}
>>>   # dim pull-request tag summary template
>>>   
>>>  DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-$HOME/.dim.template.tagsummary}
>>> 
>>>  -# GPG key id for signing tags. If unset, don't sign.
>>>  -DIM_GPG_KEYID=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
>>>  -
>>>   #
>>>   # Internal configuration.
>>>   #
>>>  @@ -104,6 +101,20 @@ test_request_recipients=(
>>>   # integration configuration
>>>   integration_config=nightly.conf
>>> 
>>>  +# GPG key id for signing tags. If unset, don't sign.
>>>  +function gpg_keyid_for_tag
>>>  +{
>>>  + echo "${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}"
>>>  + return 0
>>>  +}
>>>  +
>>>  +# GPG key id for committing (git commit/am). If unset, don't sign.
>>>  +function gpg_keyid_for_commit
>>>  +{
>>>  + echo "${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}"
>>>  + return 0
>>>  +}
>>> >>>
>>> >>> This seems like an overly complicated way to achieve what you want.
>>> >>>
>>> >>> Just put these under "Internal configuration." instead:
>>> >>>
>>> >>> dim_gpg_sign_tag=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
>>> >>> dim_gpg_sign_commit=${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}
>>> >>>
>>> >>> And use directly in git tag and commit, respectively?
>>> >>>
>>> >>
>>> >> Yep, sounds good.
>>> >>
>>> >>> Although... perhaps starting to sign tags should not force signing
>>> >>> commits?
>>> >>>
>>> >>
>>> >> Why would it be desirable to *not* sign tags?
>>> >
>>> > Again, what's the threat model you're trying to defend against? Atm
>>> > anyone with commit rights to fd.o can push whatever they want to. If
>>> > they want to be evil, they can also push whatever kind of garbage they
>>> > want to, including commit signature and and fake Link: and review
>>> > tags. With pull requests/tags signing them prevents a
>>> > man-in-the-midddle attack of the unprotected pull request in the mail,
>>> > but I still don't see what signing commits protects against.
>>>
>>> This is protecting against a bad actor (either through a committer's
>>> account, or some other fdo account) gaining access to the tree on fdo
>>> and either adding a malicious commit, or altering an existing commit.
>>
>> Yeah, but then we need to enforce it for all committer
>
> My hope is that dim makes it easy enough to get everyone on board
> eventually. In the interim, the people with signing commits will be
> able to attest that those commits were applied by them.
>
>> and we also need
>> a signing party to sign each others keys.
>
> I feel like most of us see each other often enough to make this
> possible. Even without a signing party, we still get *some* amount of
> coverage by virtue of TOFU [1].
>
> Is anyone against the idea of signing commits? Is there a reason that
> we shouldn't?

We've used GPG a bunch in fdo infrastructure, and 

Re: [PATCH 6/7] drm/drivers: drop redundant drm_edid_to_eld() calls

2017-11-01 Thread Eric Anholt
Jani Nikula  writes:

> drm_add_edid_modes() now fills in the ELD automatically, so the calls to
> drm_edid_to_eld() are redundant. Remove them.
>
> All the other places are obvious, but nv50 has detached
> drm_edid_to_eld() from the drm_add_edid_modes() call.

Nice!  For vc4,

Acked-by: Eric Anholt 


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


Re: [PATCH] drm/vc4: Fix wrong printk format in vc4_bo_stats_debugfs()

2017-11-01 Thread Eric Anholt
Boris Brezillon  writes:

> vc4->purgeable.size and vc4->purgeable.purged_size are size_t fields
> and should be printed with a %zd specifier.
>
> Fixes: b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl")
> Signed-off-by: Boris Brezillon 

Reviewed-by: Eric Anholt 


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


[PATCH hwc] drm_hwcomposer: correct handling of DRM_MODE_ROTATE_0

2017-11-01 Thread Rob Herring
If the rotation property is supported for a plane, then the rotation
value must be non-zero. For the case of 0 degree rotation,
DRM_MODE_ROTATE_0 needs to be set.

Signed-off-by: Rob Herring 
---
 drmdisplaycompositor.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index 8225726df5cd..dceb78d452c4 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -581,6 +581,8 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition 
*display_comp,
 rotation |= DRM_MODE_ROTATE_180;
   else if (layer.transform & DrmHwcTransform::kRotate270)
 rotation |= DRM_MODE_ROTATE_270;
+  else
+rotation |= DRM_MODE_ROTATE_0;
 
   if (fence_fd < 0) {
 int prop_id = plane->in_fence_fd_property().id();
@@ -610,7 +612,7 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition 
*display_comp,
 }
 
 // TODO: Once we have atomic test, this should fall back to GL
-if (rotation && plane->rotation_property().id() == 0) {
+if (rotation != DRM_MODE_ROTATE_0 && plane->rotation_property().id() == 0) 
{
   ALOGE("Rotation is not supported on plane %d", plane->id());
   ret = -EINVAL;
   break;
-- 
2.14.1

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


RE: [Intel-gfx] [maintainer-tools PATCH] dim: Sign commits in addition to tags

2017-11-01 Thread Deucher, Alexander
> -Original Message-
> From: dim-tools [mailto:dim-tools-boun...@lists.freedesktop.org] On Behalf
> Of Sean Paul
> Sent: Wednesday, November 01, 2017 8:52 AM
> To: Gustavo Padovan
> Cc: Daniel Vetter; Intel Graphics Development; dim-
> to...@lists.freedesktop.org; dri-devel; Daniel Vetter
> Subject: Re: [Intel-gfx] [maintainer-tools PATCH] dim: Sign commits in
> addition to tags
> 
> On Wed, Nov 1, 2017 at 7:12 AM, Gustavo Padovan 
> wrote:
> > 2017-10-31 Sean Paul :
> >
> >> On Tue, Oct 31, 2017 at 1:31 PM, Daniel Vetter  wrote:
> >> > On Tue, Oct 31, 2017 at 5:14 PM, Sean Paul 
> wrote:
> >> >> On Tue, Oct 31, 2017 at 4:27 AM, Jani Nikula
> >> >>  wrote:
> >> >>>
> >> >>> Reminder, we have this new list dim-to...@lists.freedesktop.org for
> >> >>> maintainer tools patches. Cc'd.
> >> >>>
> >> >>
> >> >> Ahh, cool. I didn't realize dim grew up!
> >> >>
> >> >>> On Mon, 30 Oct 2017, Sean Paul  wrote:
> >>  Expanding on Jani's work to sign tags, this patch adds signing for git
> >>  commit/am.
> >> >>>
> >> >>> I guess I'd like more rationale here. Is this something we should be
> >> >>> doing? Is anyone else doing this?
> >> >>>
> >> >>
> >> >> Sure thing. Signing commits allows Dave to use --verify-signatures
> >> >> when pulling. If something is not signed, we'll know it was either not
> >> >> applied with dim, or was altered on fdo (both warrant investigation).
> >> >>
> >> >> I suspect no one else is doing this since most trees are single
> >> >> maintainer, and it's not possible to sign commits via git send-email.
> >> >> Since we have the committer model, and a bunch of people with
> access
> >> >> to fdo and the tree, I think it's important to add this. Especially
> >> >> since we can do it in dim without overhead.
> >> >>
> >>  Signed-off-by: Sean Paul 
> >>  ---
> >> 
> >>  This has been lightly tested with dim apply-branch/dim push-
> branch.
> >> 
> >>  Sean
> >> 
> >>   dim | 78
> +--
> --
> >>   1 file changed, 51 insertions(+), 27 deletions(-)
> >> 
> >>  diff --git a/dim b/dim
> >>  index 527989aff9ad..cd5e41f89a3a 100755
> >>  --- a/dim
> >>  +++ b/dim
> >>  @@ -67,9 +67,6 @@
> DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-
> $HOME/.dim.template.signature}
> >>   # dim pull-request tag summary template
> >> 
> DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-
> $HOME/.dim.template.tagsummary}
> >> 
> >>  -# GPG key id for signing tags. If unset, don't sign.
> >>  -DIM_GPG_KEYID=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
> >>  -
> >>   #
> >>   # Internal configuration.
> >>   #
> >>  @@ -104,6 +101,20 @@ test_request_recipients=(
> >>   # integration configuration
> >>   integration_config=nightly.conf
> >> 
> >>  +# GPG key id for signing tags. If unset, don't sign.
> >>  +function gpg_keyid_for_tag
> >>  +{
> >>  + echo "${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}"
> >>  + return 0
> >>  +}
> >>  +
> >>  +# GPG key id for committing (git commit/am). If unset, don't sign.
> >>  +function gpg_keyid_for_commit
> >>  +{
> >>  + echo "${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}"
> >>  + return 0
> >>  +}
> >> >>>
> >> >>> This seems like an overly complicated way to achieve what you want.
> >> >>>
> >> >>> Just put these under "Internal configuration." instead:
> >> >>>
> >> >>> dim_gpg_sign_tag=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
> >> >>> dim_gpg_sign_commit=${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}
> >> >>>
> >> >>> And use directly in git tag and commit, respectively?
> >> >>>
> >> >>
> >> >> Yep, sounds good.
> >> >>
> >> >>> Although... perhaps starting to sign tags should not force signing
> >> >>> commits?
> >> >>>
> >> >>
> >> >> Why would it be desirable to *not* sign tags?
> >> >
> >> > Again, what's the threat model you're trying to defend against? Atm
> >> > anyone with commit rights to fd.o can push whatever they want to. If
> >> > they want to be evil, they can also push whatever kind of garbage they
> >> > want to, including commit signature and and fake Link: and review
> >> > tags. With pull requests/tags signing them prevents a
> >> > man-in-the-midddle attack of the unprotected pull request in the mail,
> >> > but I still don't see what signing commits protects against.
> >>
> >> This is protecting against a bad actor (either through a committer's
> >> account, or some other fdo account) gaining access to the tree on fdo
> >> and either adding a malicious commit, or altering an existing commit.
> >
> > Yeah, but then we need to enforce it for all committer
> 
> My hope is that dim makes it easy enough to get everyone on board
> eventually. In the interim, the people with signing commits 

[PATCH] drm/ttm: Always and only destroy bo->ttm_resv in ttm_bo_release_list

2017-11-01 Thread Michel Dänzer
From: Michel Dänzer 

Fixes a use-after-free due to a race condition in
ttm_bo_cleanup_refs_and_unlock, which allows one task to reserve a BO
and destroy its ttm_resv while another task is waiting for it to signal
in reservation_object_wait_timeout_rcu.

Fixes: 0d2bd2ae045d "drm/ttm: fix memory leak while individualizing BOs"
Signed-off-by: Michel Dänzer 
---
 drivers/gpu/drm/ttm/ttm_bo.c | 13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 379ec41d2c69..a19a0ebf32ac 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -150,8 +150,7 @@ static void ttm_bo_release_list(struct kref *list_kref)
ttm_tt_destroy(bo->ttm);
atomic_dec(>glob->bo_count);
dma_fence_put(bo->moving);
-   if (bo->resv == >ttm_resv)
-   reservation_object_fini(>ttm_resv);
+   reservation_object_fini(>ttm_resv);
mutex_destroy(>wu_mutex);
if (bo->destroy)
bo->destroy(bo);
@@ -406,10 +405,8 @@ static int ttm_bo_individualize_resv(struct 
ttm_buffer_object *bo)
BUG_ON(!reservation_object_trylock(>ttm_resv));
 
r = reservation_object_copy_fences(>ttm_resv, bo->resv);
-   if (r) {
+   if (r)
reservation_object_unlock(>ttm_resv);
-   reservation_object_fini(>ttm_resv);
-   }
 
return r;
 }
@@ -457,10 +454,8 @@ static void ttm_bo_cleanup_refs_or_queue(struct 
ttm_buffer_object *bo)
if (reservation_object_test_signaled_rcu(>ttm_resv, true)) {
ttm_bo_del_from_lru(bo);
spin_unlock(>lru_lock);
-   if (bo->resv != >ttm_resv) {
+   if (bo->resv != >ttm_resv)
reservation_object_unlock(>ttm_resv);
-   reservation_object_fini(>ttm_resv);
-   }
 
ttm_bo_cleanup_memtype_use(bo);
return;
@@ -560,8 +555,6 @@ static int ttm_bo_cleanup_refs_and_unlock(struct 
ttm_buffer_object *bo,
}
 
ttm_bo_del_from_lru(bo);
-   if (!list_empty(>ddestroy) && (bo->resv != >ttm_resv))
-   reservation_object_fini(>ttm_resv);
list_del_init(>ddestroy);
kref_put(>list_kref, ttm_bo_ref_bug);
 
-- 
2.15.0.rc2

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


Re: [Intel-gfx] [PATCH v2 2/2] Test case for drm_vblank_cleanup refcount validation patch

2017-11-01 Thread PrasannaKumar Muralidharan
Hi Daniel,

On 1 November 2017 at 14:23, Daniel Vetter  wrote:
> On Wed, Nov 01, 2017 at 09:48:28AM +0530, PrasannaKumar Muralidharan wrote:
>> Hi Daniel,
>>
>> On 31 October 2017 at 21:57, Daniel Vetter  wrote:
>> > On Tue, Oct 31, 2017 at 08:37:21PM +0530, PrasannaKumar Muralidharan wrote:
>> >> My patch is supposed to catch problem with drivers. It warns when
>> >> vblank refcount is non-zero in drm_vblank_cleanup call. From CI log it
>> >> can be seen that warning being triggered. I feel that my patch is
>> >> exposing existing issue.
>> >>
>> >> If I misinterpreted something please let me know.
>> >
>> > This is probably what's happening, but I can't merge a patch that breaks
>> > CI. So we need to track down that issue before merging.
>>
>> I understand. Being new to DRM subsystem I don't know if I can
>> contribute in finding the issue. I would be able to help if I could
>> get some guidance.
>
> If you have an intel laptop anywhere at hand that you could use to
> reproduce the issue, that would be a good start.

I do have one but it is my primary machine.

> Then go through the setup for the kms/drm validation suite:
>
> https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#testing-and-validation
>
> That should allow you to locally reproduce the issue (it seems to affect
> many machines, so I'd assume it doesn't matter which one you have).

If this setup is going to affect my normal workflow setup I would
prefer not to use it.

> Once you can reproduce it should be doable to figure out where we leak
> this reference (but usually it's a bit of hard work).

Anyway I will give it a try and see how far I can go.

> Btw I discussed your patch a bit on irc, a first step would be to also
> print the refcount when it's leaked, not just warn about it. Knowing how
> many references are leaked is sometimes a good hint about what's going on.

I will send a v4.

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

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


Re: [Intel-gfx] [PATCH] drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.

2017-11-01 Thread Maarten Lankhorst
Op 01-11-17 om 16:29 schreef Ville Syrjälä:
> On Wed, Nov 01, 2017 at 04:04:33PM +0100, Maarten Lankhorst wrote:
>> This introduces a slight behavioral change to rmfb. Instead of
>> disabling a crtc when the primary plane is disabled, we try to
>> preserve it.
>>
>> Apart from old versions of the vmwgfx xorg driver, there is
>> nothing depending on rmfb disabling a crtc.
>>
>> Vmwgfx' and simple kms helper atomic implementation rejects CRTC
>> enabled without plane, so we can do this safely.
>>
>> If the atomic commit is rejected by the driver then we will still
>> fall back to the old behavior and turn off the crtc.
>>
>> Changes since v1:
>> - Restart completely when rmfb with crtc on fails (Sean Paul).
>>
>> Signed-off-by: Maarten Lankhorst 
>> Cc: Sean Paul 
>> Cc: Daniel Vetter 
>> ---
>>  drivers/gpu/drm/drm_framebuffer.c | 23 +--
>>  1 file changed, 17 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_framebuffer.c 
>> b/drivers/gpu/drm/drm_framebuffer.c
>> index 2affe53f3fda..f0679468f421 100644
>> --- a/drivers/gpu/drm/drm_framebuffer.c
>> +++ b/drivers/gpu/drm/drm_framebuffer.c
>> @@ -765,14 +765,18 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>>  struct drm_plane *plane;
>>  struct drm_connector *conn;
>>  struct drm_connector_state *conn_state;
>> -int i, ret = 0;
>> +int i, ret;
>>  unsigned plane_mask;
>> +bool disable_crtcs = false;
>>  
>> -state = drm_atomic_state_alloc(dev);
>> -if (!state)
>> -return -ENOMEM;
>> -
>> +retry_disable:
>>  drm_modeset_acquire_init(, 0);
>> +
>> +state = drm_atomic_state_alloc(dev);
>> +if (!state) {
>> +ret = -ENOMEM;
>> +goto out;
>> +}
>>  state->acquire_ctx = 
>>  
>>  retry:
>> @@ -793,7 +797,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>>  goto unlock;
>>  }
>>  
>> -if (plane_state->crtc->primary == plane) {
>> +if (disable_crtcs && plane_state->crtc->primary == plane) {
>>  struct drm_crtc_state *crtc_state;
>>  
>>  crtc_state = drm_atomic_get_existing_crtc_state(state, 
>> plane_state->crtc);
>> @@ -818,6 +822,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>>  plane->old_fb = plane->fb;
>>  }
>>  
>> +/* This list is only filled when disable_crtcs is set. */
>>  for_each_new_connector_in_state(state, conn, conn_state, i) {
> WARN_ON(!disable_crtcs) maybe?
Would be overkill, nothing before it adds connector state, and if atomic check 
does then that's fine, but it won't be run here. :)
>>  ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
>>  
>> @@ -840,9 +845,15 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>>  
>>  drm_atomic_state_put(state);
>>  
>> +out:
>>  drm_modeset_drop_locks();
>>  drm_modeset_acquire_fini();
>>  
>> +if (ret == -EINVAL && !disable_crtcs) {
> Hmm. -EINVAL seems rather specific. Not sure if we could just check for
> any error?
>
> Or... I'm not sure if we have any central place where we do the
> "can I disable the primary plane w/o disabling the crtc?" check. If we
> do then we could also add a comment there informing people that the
> -EINVAL is important.
We don't have a central place, I check for EINVAL since that is the generic 
atomic_check() failed error. If it fails for any other reason then we don't 
have to retry, but pass it along. :)

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


[drm-intel:for-linux-next 3/4] drivers/gpu/drm/i915/intel_engine_cs.c:1620:30: error: 'dev_priv' undeclared

2017-11-01 Thread kbuild test robot
tree:   git://anongit.freedesktop.org/drm-intel for-linux-next
head:   3265124a2d3744d789ede58452ab6f8a9b454be8
commit: 680273879d125d644831b8de42c66576e6290378 [3/4] drm/i915: Move 
parking-while-active warning to intel_engines_park()
config: i386-randconfig-x003-201744 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
git checkout 680273879d125d644831b8de42c66576e6290378
# save the attached .config to linux build tree
make ARCH=i386 

Note: the drm-intel/for-linux-next HEAD 
3265124a2d3744d789ede58452ab6f8a9b454be8 builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_engine_cs.c: In function 'intel_engines_park':
>> drivers/gpu/drm/i915/intel_engine_cs.c:1620:30: error: 'dev_priv' undeclared 
>> (first use in this function)
 if (!intel_engines_are_idle(dev_priv))
 ^~~~
   drivers/gpu/drm/i915/intel_engine_cs.c:1620:30: note: each undeclared 
identifier is reported only once for each function it appears in

vim +/dev_priv +1620 drivers/gpu/drm/i915/intel_engine_cs.c

  1602  
  1603  /**
  1604   * intel_engines_park: called when the GT is transitioning from 
busy->idle
  1605   * @i915: the i915 device
  1606   *
  1607   * The GT is now idle and about to go to sleep (maybe never to wake 
again?).
  1608   * Time for us to tidy and put away our toys (release resources back to 
the
  1609   * system).
  1610   */
  1611  void intel_engines_park(struct drm_i915_private *i915)
  1612  {
  1613  struct intel_engine_cs *engine;
  1614  enum intel_engine_id id;
  1615  
  1616  /*
  1617   * We are committed now to parking the engines, make sure there
  1618   * will be no more interrupts arriving later.
  1619   */
> 1620  if (!intel_engines_are_idle(dev_priv))
  1621  DRM_ERROR("Timeout waiting for engines to idle\n");
  1622  
  1623  for_each_engine(engine, i915, id) {
  1624  if (engine->park)
  1625  engine->park(engine);
  1626  
  1627  intel_engine_disarm_breadcrumbs(engine);
  1628  tasklet_kill(>execlists.irq_tasklet);
  1629  
  1630  i915_gem_batch_pool_fini(>batch_pool);
  1631  engine->execlists.no_priolist = false;
  1632  }
  1633  }
  1634  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/2] drm/rcar-du: Adjust 14 checks for null pointers

2017-11-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 1 Nov 2017 16:00:46 +0100

The script "checkpatch.pl" pointed information out like the following.

Comparison to NULL could be written !...

Thus fix the affected source code places.

Signed-off-by: Markus Elfring 
---

v2:
The commit message was written only with ASCII characters.

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 6 +++---
 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 2 +-
 drivers/gpu/drm/rcar-du/rcar_du_plane.c   | 6 +++---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 6 +++---
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 301ea1a8018e..67567af6e348 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -410,7 +410,7 @@ void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc 
*rcrtc)
rcrtc->event = NULL;
spin_unlock_irqrestore(>event_lock, flags);
 
-   if (event == NULL)
+   if (!event)
return;
 
spin_lock_irqsave(>event_lock, flags);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index d2f29e6b1112..cf80476783bf 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -318,7 +318,7 @@ static int rcar_du_probe(struct platform_device *pdev)
 
/* Allocate and initialize the R-Car device structure. */
rcdu = devm_kzalloc(>dev, sizeof(*rcdu), GFP_KERNEL);
-   if (rcdu == NULL)
+   if (!rcdu)
return -ENOMEM;
 
rcdu->dev = >dev;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index ba8d2804c1d1..8a9f7fa69ecc 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -166,7 +166,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
int ret;
 
renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
-   if (renc == NULL)
+   if (!renc)
return -ENOMEM;
 
renc->output = output;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index b6b341164aab..c15aa38fe308 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -181,7 +181,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file 
*file_priv,
unsigned int i;
 
format = rcar_du_format_info(mode_cmd->pixel_format);
-   if (format == NULL) {
+   if (!format) {
dev_dbg(dev->dev, "unsupported pixel format %08x\n",
mode_cmd->pixel_format);
return ERR_PTR(-EINVAL);
@@ -419,7 +419,7 @@ static int rcar_du_properties_init(struct rcar_du_device 
*rcdu)
 {
rcdu->props.alpha =
drm_property_create_range(rcdu->ddev, 0, "alpha", 0, 255);
-   if (rcdu->props.alpha == NULL)
+   if (!rcdu->props.alpha)
return -ENOMEM;
 
/*
@@ -430,7 +430,7 @@ static int rcar_du_properties_init(struct rcar_du_device 
*rcdu)
rcdu->props.colorkey =
drm_property_create_range(rcdu->ddev, 0, "colorkey",
  0, 0x01ff);
-   if (rcdu->props.colorkey == NULL)
+   if (!rcdu->props.colorkey)
return -ENOMEM;
 
return 0;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c 
b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
index b373ad48ef5f..189e71b3d5d4 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
@@ -63,7 +63,7 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,
int ret;
 
rcon = devm_kzalloc(rcdu->dev, sizeof(*rcon), GFP_KERNEL);
-   if (rcon == NULL)
+   if (!rcon)
return -ENOMEM;
 
connector = >connector;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
index 12d22f3db1af..ab2576e5d700 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
@@ -253,7 +253,7 @@ int rcar_du_lvdsenc_init(struct rcar_du_device *rcdu)
 
for (i = 0; i < rcdu->info->num_lvds; ++i) {
lvds = devm_kzalloc(>dev, sizeof(*lvds), GFP_KERNEL);
-   if (lvds == NULL)
+   if (!lvds)
return -ENOMEM;
 
lvds->dev = rcdu;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 61833cc1c699..f48a990214ed 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ 

[PATCH v2 1/2] drm/rcar-du: Use common error handling code in rcar_du_encoders_init()

2017-11-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 1 Nov 2017 15:57:31 +0100

* Add a jump target so that a bit of exception handling can be better
  reused at the end of this function.

* Increase the scope for the variable "ret".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---

v2:
The declaration for the variable "ret" was moved out of a loop.

 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 566d1a948c8f..b6b341164aab 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -365,6 +365,7 @@ static int rcar_du_encoders_init(struct rcar_du_device 
*rcdu)
struct device_node *np = rcdu->dev->of_node;
struct device_node *ep_node;
unsigned int num_encoders = 0;
+   int ret;
 
/*
 * Iterate over the endpoints and create one encoder for each output
@@ -374,13 +375,10 @@ static int rcar_du_encoders_init(struct rcar_du_device 
*rcdu)
enum rcar_du_output output;
struct of_endpoint ep;
unsigned int i;
-   int ret;
 
ret = of_graph_parse_endpoint(ep_node, );
-   if (ret < 0) {
-   of_node_put(ep_node);
-   return ret;
-   }
+   if (ret < 0)
+   goto put_node;
 
/* Find the output route corresponding to the port number. */
for (i = 0; i < RCAR_DU_OUTPUT_MAX; ++i) {
@@ -401,10 +399,8 @@ static int rcar_du_encoders_init(struct rcar_du_device 
*rcdu)
/* Process the output pipeline. */
ret = rcar_du_encoders_init_one(rcdu, output, );
if (ret < 0) {
-   if (ret == -EPROBE_DEFER) {
-   of_node_put(ep_node);
-   return ret;
-   }
+   if (ret == -EPROBE_DEFER)
+   goto put_node;
 
continue;
}
@@ -413,6 +409,10 @@ static int rcar_du_encoders_init(struct rcar_du_device 
*rcdu)
}
 
return num_encoders;
+
+put_node:
+   of_node_put(ep_node);
+   return ret;
 }
 
 static int rcar_du_properties_init(struct rcar_du_device *rcdu)
-- 
2.14.3

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


[PATCH v2 0/2] R-Car Display Unit: Fine-tuning for some function implementations

2017-11-01 Thread SF Markus Elfring
From: Markus Elfring 
Date: Wed, 1 Nov 2017 16:23:45 +0100

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  drm/rcar-du: Use common error handling code in rcar_du_encoders_init()
  drm/rcar-du: Adjust 14 checks for null pointers
---

v2:
Advice was taken into account from the first round of corresponding
source code review.

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c|  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c | 24 
 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_plane.c   |  6 +++---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c |  6 +++---
 8 files changed, 23 insertions(+), 23 deletions(-)

-- 
2.14.3

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


[Bug 99843] Geometry Shader - Incorrect Output

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

--- Comment #12 from Ilia Mirkin  ---
No one has been able to reproduce, tried on various hardware including a Radeon
6870 (BARTS).

Without more information, it's unlikely that anything will happen. At the very
least (a) recheck on mesa master and if it's still broken, (b) supply
information about your GPU.

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


Re: [Intel-gfx] [PATCH] drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.

2017-11-01 Thread Ville Syrjälä
On Wed, Nov 01, 2017 at 04:04:33PM +0100, Maarten Lankhorst wrote:
> This introduces a slight behavioral change to rmfb. Instead of
> disabling a crtc when the primary plane is disabled, we try to
> preserve it.
> 
> Apart from old versions of the vmwgfx xorg driver, there is
> nothing depending on rmfb disabling a crtc.
> 
> Vmwgfx' and simple kms helper atomic implementation rejects CRTC
> enabled without plane, so we can do this safely.
> 
> If the atomic commit is rejected by the driver then we will still
> fall back to the old behavior and turn off the crtc.
> 
> Changes since v1:
> - Restart completely when rmfb with crtc on fails (Sean Paul).
> 
> Signed-off-by: Maarten Lankhorst 
> Cc: Sean Paul 
> Cc: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_framebuffer.c | 23 +--
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_framebuffer.c 
> b/drivers/gpu/drm/drm_framebuffer.c
> index 2affe53f3fda..f0679468f421 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -765,14 +765,18 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>   struct drm_plane *plane;
>   struct drm_connector *conn;
>   struct drm_connector_state *conn_state;
> - int i, ret = 0;
> + int i, ret;
>   unsigned plane_mask;
> + bool disable_crtcs = false;
>  
> - state = drm_atomic_state_alloc(dev);
> - if (!state)
> - return -ENOMEM;
> -
> +retry_disable:
>   drm_modeset_acquire_init(, 0);
> +
> + state = drm_atomic_state_alloc(dev);
> + if (!state) {
> + ret = -ENOMEM;
> + goto out;
> + }
>   state->acquire_ctx = 
>  
>  retry:
> @@ -793,7 +797,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>   goto unlock;
>   }
>  
> - if (plane_state->crtc->primary == plane) {
> + if (disable_crtcs && plane_state->crtc->primary == plane) {
>   struct drm_crtc_state *crtc_state;
>  
>   crtc_state = drm_atomic_get_existing_crtc_state(state, 
> plane_state->crtc);
> @@ -818,6 +822,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>   plane->old_fb = plane->fb;
>   }
>  
> + /* This list is only filled when disable_crtcs is set. */
>   for_each_new_connector_in_state(state, conn, conn_state, i) {

WARN_ON(!disable_crtcs) maybe?

>   ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
>  
> @@ -840,9 +845,15 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
>  
>   drm_atomic_state_put(state);
>  
> +out:
>   drm_modeset_drop_locks();
>   drm_modeset_acquire_fini();
>  
> + if (ret == -EINVAL && !disable_crtcs) {

Hmm. -EINVAL seems rather specific. Not sure if we could just check for
any error?

Or... I'm not sure if we have any central place where we do the
"can I disable the primary plane w/o disabling the crtc?" check. If we
do then we could also add a comment there informing people that the
-EINVAL is important.

> + disable_crtcs = true;
> + goto retry_disable;
> + }
> +
>   return ret;
>  }
>  
> -- 
> 2.14.1
> 
> ___
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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


[Bug 99843] Geometry Shader - Incorrect Output

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

--- Comment #11 from d...@jerber.co.uk ---
Hi,

Is it likely this will be looked into or are there no plans to look into issues
for older cards?

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


[Bug 97055] Black screens on A10-8780P (Carrizo) + R7 M260/M265 (Topaz) Combo

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

--- Comment #20 from Jan Vesely  ---
(In reply to James Payne from comment #18)
> Would be good to get to the bottom of this one as it affects my wife's
> laptop :(
> 
> Currently stuck with Windows 10 which is sluggish to do anything...
> 
> Running the kernels from
> https://github.com/M-Bab/linux-kernel-amdgpu-binaries did actually allow it
> to boot to a proper desktop. Though was a little flakey, mainly very fast
> flickering of the screen when logged out and additionally when the laptop
> was tried to move to sleep mode it just went nuts, the screen was just
> overdrawing on itself until the entire screen was white!
> 
> Still it does look as if the DC merge in the kernel may help significantly
> with this problem if those kernels are anything to go by. Saying that my
> wireless is completely broken with this kernel :( 
> 
> Just can't win!

Have you tried running ROCK(ROCm) kernel? my machine (acer E5 fx-9800P + topaz)
works OKish with 1.6.x branch, even my wireless works(Atheros QCA9377).

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


Re: [PATCH 6/7] drm/drivers: drop redundant drm_edid_to_eld() calls

2017-11-01 Thread Ville Syrjälä
On Wed, Nov 01, 2017 at 04:21:02PM +0200, Jani Nikula wrote:
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c 
> b/drivers/gpu/drm/nouveau/nv50_display.c
> index e4751f92b342..e0a190a0f029 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -2688,7 +2688,6 @@ nv50_audio_enable(struct drm_encoder *encoder, struct 
> drm_display_mode *mode)
>   if (!drm_detect_monitor_audio(nv_connector->edid))
>   return;
>  
> - drm_edid_to_eld(_connector->base, nv_connector->edid);
>   memcpy(args.data, nv_connector->base.eld, sizeof(args.data));
>  
>   nvif_mthd(disp->disp, 0, ,

This being the only call outside a .get_modes() hook means this is the
only one that might change some behaviour.

Looks like nv_connector->edid gets updated in .detect() as one might
expect, so in theory we might get a mismatch between the
drm_detect_monitor_audio(edid) check above and the actual eld contents
here if .detect() gets called without .get_modes(). Not a problem for
the probe helper's .fill_modes(), but eg. the poll helper does do that.

I guess we could always consider doing the edid_to_eld() already from
.detect()/.force() for all drivers if we think there would be a good
reason to populate the ELD even if .get_modes()/.fill_modes() hasn't
been called.

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


[PATCH] drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2.

2017-11-01 Thread Maarten Lankhorst
This introduces a slight behavioral change to rmfb. Instead of
disabling a crtc when the primary plane is disabled, we try to
preserve it.

Apart from old versions of the vmwgfx xorg driver, there is
nothing depending on rmfb disabling a crtc.

Vmwgfx' and simple kms helper atomic implementation rejects CRTC
enabled without plane, so we can do this safely.

If the atomic commit is rejected by the driver then we will still
fall back to the old behavior and turn off the crtc.

Changes since v1:
- Restart completely when rmfb with crtc on fails (Sean Paul).

Signed-off-by: Maarten Lankhorst 
Cc: Sean Paul 
Cc: Daniel Vetter 
---
 drivers/gpu/drm/drm_framebuffer.c | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_framebuffer.c 
b/drivers/gpu/drm/drm_framebuffer.c
index 2affe53f3fda..f0679468f421 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -765,14 +765,18 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
struct drm_plane *plane;
struct drm_connector *conn;
struct drm_connector_state *conn_state;
-   int i, ret = 0;
+   int i, ret;
unsigned plane_mask;
+   bool disable_crtcs = false;
 
-   state = drm_atomic_state_alloc(dev);
-   if (!state)
-   return -ENOMEM;
-
+retry_disable:
drm_modeset_acquire_init(, 0);
+
+   state = drm_atomic_state_alloc(dev);
+   if (!state) {
+   ret = -ENOMEM;
+   goto out;
+   }
state->acquire_ctx = 
 
 retry:
@@ -793,7 +797,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
goto unlock;
}
 
-   if (plane_state->crtc->primary == plane) {
+   if (disable_crtcs && plane_state->crtc->primary == plane) {
struct drm_crtc_state *crtc_state;
 
crtc_state = drm_atomic_get_existing_crtc_state(state, 
plane_state->crtc);
@@ -818,6 +822,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
plane->old_fb = plane->fb;
}
 
+   /* This list is only filled when disable_crtcs is set. */
for_each_new_connector_in_state(state, conn, conn_state, i) {
ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
 
@@ -840,9 +845,15 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
 
drm_atomic_state_put(state);
 
+out:
drm_modeset_drop_locks();
drm_modeset_acquire_fini();
 
+   if (ret == -EINVAL && !disable_crtcs) {
+   disable_crtcs = true;
+   goto retry_disable;
+   }
+
return ret;
 }
 
-- 
2.14.1

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


Re: [Intel-gfx] [PATCH 0/7] drm/edid and drivers: ELD refactoring

2017-11-01 Thread Ville Syrjälä
On Wed, Nov 01, 2017 at 04:20:56PM +0200, Jani Nikula wrote:
> We were recently bitten by drm_edid_to_eld() clearing the connector
> type, and us failing to set it back for DP. Here's a few ELD related
> patches to try to unify ELD handling and make it a bit simpler for
> drivers to get it right.
> 
> Apologies for the massive Cc list; it's the maintainers of all drivers
> that call drm_edid_to_eld().
> 
> I'm open to splitting up patch 6 to driver specific patches as needed,
> but I'd think it would be just fine to merge via drm-misc as-is too.

Entire series lgtm so
Reviewed-by: Ville Syrjälä 

> 
> BR,
> Jani.
> 
> Cc: Alex Deucher 
> Cc: Christian König 
> Cc: Archit Taneja 
> Cc: Andrzej Hajda 
> Cc: Russell King 
> Cc: CK Hu 
> Cc: Philipp Zabel 
> Cc: Ben Skeggs 
> Cc: Mark Yao 
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
> Cc: Thierry Reding 
> Cc: Eric Anholt 
> 
> 
> Jani Nikula (7):
>   drm/edid: use macros for ELD offsets and values
>   drm/edid: set ELD connector type in drm_edid_to_eld()
>   drm/i915: remove redundant ELD connector type update
>   drm/edid: abstract connector ELD clearing
>   drm/edid: build ELD in drm_add_edid_modes()
>   drm/drivers: drop redundant drm_edid_to_eld() calls
>   drm/edid: make drm_edid_to_eld() static
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |  1 -
>  drivers/gpu/drm/bridge/analogix-anx78xx.c  |  2 -
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  2 -
>  drivers/gpu/drm/drm_edid.c | 70 
> +++---
>  drivers/gpu/drm/i2c/tda998x_drv.c  |  1 -
>  drivers/gpu/drm/i915/intel_dp.c|  1 -
>  drivers/gpu/drm/i915/intel_modes.c | 18 ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c|  1 -
>  drivers/gpu/drm/nouveau/nv50_display.c |  5 +-
>  drivers/gpu/drm/radeon/radeon_connectors.c |  1 -
>  drivers/gpu/drm/radeon/radeon_dp_mst.c |  1 -
>  drivers/gpu/drm/rockchip/cdn-dp-core.c |  4 +-
>  drivers/gpu/drm/sti/sti_hdmi.c |  1 -
>  drivers/gpu/drm/tegra/output.c |  1 -
>  drivers/gpu/drm/vc4/vc4_hdmi.c |  1 -
>  include/drm/drm_edid.h |  1 -
>  include/drm/drm_modeset_helper_vtables.h   |  3 --
>  17 files changed, 44 insertions(+), 70 deletions(-)
> 
> -- 
> 2.11.0
> 
> ___
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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


[Bug 97055] Black screens on A10-8780P (Carrizo) + R7 M260/M265 (Topaz) Combo

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

--- Comment #19 from Josh  ---
(In reply to Thomas J. Moore from comment #17)
> Is this the place for AMD-related kernel bugs to die? 
Yes. Unfortunately, the only solution is to get a computer that is already
known to be supported. You won't get any proper support, because there is no
company or support to go to. Nobody who knows how to fix these posts actually
reads these posts. This is the power of open source. Think I'll just bite the
bullet and buy a Mac.

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


Re: [PATCH v2] drm/drm_vma_manager.c: Remove useless goto statement

2017-11-01 Thread Chris Wilson
Quoting Liviu Dudau (2017-11-01 14:44:58)
> Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded
> interval-tree in drm_mm") removed a line in drm_vma_offset_add() function that
> makes checking the result of calling drm_mm_insert_node() and the goto
> call redundant. Rework the function (as suggested by Chris Wilson) to
> eliminate the need for the goto and associated label.
> 
> v2: rewrite function to remove all goto statements.
> 
> Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree 
> in drm_mm")
> Cc: Chris Wilson 
> Signed-off-by: Liviu Dudau 
Reviewed-by: Chris Wilson 
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2] drm/drm_vma_manager.c: Remove useless goto statement

2017-11-01 Thread Liviu Dudau
Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded
interval-tree in drm_mm") removed a line in drm_vma_offset_add() function that
makes checking the result of calling drm_mm_insert_node() and the goto
call redundant. Rework the function (as suggested by Chris Wilson) to
eliminate the need for the goto and associated label.

v2: rewrite function to remove all goto statements.

Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree 
in drm_mm")
Cc: Chris Wilson 
Signed-off-by: Liviu Dudau 
---
 drivers/gpu/drm/drm_vma_manager.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_vma_manager.c 
b/drivers/gpu/drm/drm_vma_manager.c
index 28f1226576f8c..23c749c05b5aa 100644
--- a/drivers/gpu/drm/drm_vma_manager.c
+++ b/drivers/gpu/drm/drm_vma_manager.c
@@ -203,21 +203,16 @@ EXPORT_SYMBOL(drm_vma_offset_lookup_locked);
 int drm_vma_offset_add(struct drm_vma_offset_manager *mgr,
   struct drm_vma_offset_node *node, unsigned long pages)
 {
-   int ret;
+   int ret = 0;
 
write_lock(>vm_lock);
 
-   if (drm_mm_node_allocated(>vm_node)) {
-   ret = 0;
-   goto out_unlock;
-   }
+   if (!drm_mm_node_allocated(>vm_node))
+   ret = drm_mm_insert_node(>vm_addr_space_mm,
+>vm_node, pages);
 
-   ret = drm_mm_insert_node(>vm_addr_space_mm, >vm_node, pages);
-   if (ret)
-   goto out_unlock;
-
-out_unlock:
write_unlock(>vm_lock);
+
return ret;
 }
 EXPORT_SYMBOL(drm_vma_offset_add);
-- 
2.14.3

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


Re: [PATCH] drm: hdlcd: Skip checking the clock provider when CRTC is disabled.

2017-11-01 Thread Brian Starkey

On Wed, Nov 01, 2017 at 02:16:25PM +, Liviu Dudau wrote:

Some clock providers (clk-vexpress-osc) trigger a WARN() when the
requested rate falls outside its capabilities, as is the case when
a CRTC gets disabled. Check if the CRTC's new state is enabled and
skip the clk_round_rate() call if it is not.


In itself, this seems like a fine patch. However, the motivation
maybe isn't.

IMO the WARN() in clk-vexpress-osc is bogus and should be removed -
the clk_round_rate() API is intended to convert from a desired rate to
something the clock actually supports - so it's basically expected
that the input rate might not be achievable.

Spewing a WARN when the API is used as-intended seems a little off :-)

Cheers,
-Brian



Reported-by: Vladimir Murzin 
Signed-off-by: Liviu Dudau 
Tested-by: Vladimir Murzin 
---
drivers/gpu/drm/arm/hdlcd_crtc.c | 4 
1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 72b22b805412b..a1387a8bf78c4 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -193,6 +193,10 @@ static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_display_mode *mode = >adjusted_mode;
long rate, clk_rate = mode->clock * 1000;

+   /* if the crtc is disabled, skip the clock check */
+   if (!state->enable)
+   return 0;
+
rate = clk_round_rate(hdlcd->clk, clk_rate);
if (rate != clk_rate) {
/* clock required by mode not supported by hardware */
--
2.14.1


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


Re: [PATCH 1/2] drm/i915: Reject unknown syncobj flags

2017-11-01 Thread Chris Wilson
Quoting Tvrtko Ursulin (2017-10-31 10:23:25)
> From: Tvrtko Ursulin 
> 
> We have to reject unknown flags for uAPI considerations, and also
> because the curent implementation limits their i915 storage space
> to two bits.
> 
> v2: (Chris Wilson)
>  * Fix fail in ABI check.
>  * Added unknown flags and BUILD_BUG_ON.
> 
> v3:
>  * Use ARCH_KMALLOC_MINALIGN instead of alignof. (Chris Wilson)
> 
> Signed-off-by: Tvrtko Ursulin 
> Fixes: cf6e7bac6357 ("drm/i915: Add support for drm syncobjs")
> Cc: Jason Ekstrand 
> Cc: Chris Wilson 
> Cc: Jani Nikula 
> Cc: Joonas Lahtinen 
> Cc: Rodrigo Vivi 
> Cc: David Airlie 
> Cc: intel-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 
>  include/uapi/drm/i915_drm.h| 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
> b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 3d7190764f10..a53be7d01055 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
> goto err;
> }
>  
> +   if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) {
> +   err = -EINVAL;
> +   goto err;
> +   }
> +
> syncobj = drm_syncobj_find(file, fence.handle);
> if (!syncobj) {
> DRM_DEBUG("Invalid syncobj handle provided\n");
> @@ -2107,6 +2112,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
> goto err;
> }
>  
> +   BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) &
> +~__I915_EXEC_FENCE_UNKNOWN_FLAGS);
> +
> fences[n] = ptr_pack_bits(syncobj, fence.flags, 2);

Was pondering how to tie the .n=2 into the BUILD_BUG_ON, but that
doesn't limit the improvement and fixes in this patch, so

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


Re: [PATCH] drm: Spelling fixes

2017-11-01 Thread Alex Deucher
On Wed, Nov 1, 2017 at 10:04 AM, Liviu Dudau  wrote:
> Minor spelling fix for 'monster' and replace 'on' with 'own' in
> comments.
>
> Signed-off-by: Liviu Dudau 

Reviewed-by: Alex Deucher 

> ---
>  drivers/gpu/drm/drm_atomic.c | 2 +-
>  drivers/gpu/drm/drm_mm.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index c2da5585e2012..11614ea03fc8b 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1808,7 +1808,7 @@ int drm_atomic_debugfs_init(struct drm_minor *minor)
>  #endif
>
>  /*
> - * The big monstor ioctl
> + * The big monster ioctl
>   */
>
>  static struct drm_pending_vblank_event *create_vblank_event(
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index 61a1c8ea74bc5..eb86bc3f753b3 100644
> --- a/drivers/gpu/drm/drm_mm.c
> +++ b/drivers/gpu/drm/drm_mm.c
> @@ -92,7 +92,7 @@
>   * some basic allocator dumpers for debugging.
>   *
>   * Note that this range allocator is not thread-safe, drivers need to protect
> - * modifications with their on locking. The idea behind this is that for a 
> full
> + * modifications with their own locking. The idea behind this is that for a 
> full
>   * memory manager additional data needs to be protected anyway, hence 
> internal
>   * locking would be fully redundant.
>   */
> --
> 2.14.3
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/drm_vma_manager.c: Remove useless goto statement

2017-11-01 Thread Chris Wilson
Quoting Liviu Dudau (2017-11-01 14:20:53)
> On Wed, Nov 01, 2017 at 02:11:44PM +, Chris Wilson wrote:
> > Quoting Liviu Dudau (2017-11-01 14:04:24)
> > > Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded
> > > interval-tree in drm_mm") removed a line in drm_vma_offset_add() function
> > > that makes checking the result of calling drm_mm_insert_node() and the
> > > goto call redundant. Remove them.
> > > 
> > > Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded 
> > > interval-tree in drm_mm")
> > > Cc: Chris Wilson 
> > > Signed-off-by: Liviu Dudau 
> > > ---
> > >  drivers/gpu/drm/drm_vma_manager.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_vma_manager.c 
> > > b/drivers/gpu/drm/drm_vma_manager.c
> > > index 28f1226576f8c..e545a7b2bcafc 100644
> > > --- a/drivers/gpu/drm/drm_vma_manager.c
> > > +++ b/drivers/gpu/drm/drm_vma_manager.c
> > > @@ -213,8 +213,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager 
> > > *mgr,
> > > }
> > >  
> > > ret = drm_mm_insert_node(>vm_addr_space_mm, >vm_node, 
> > > pages);
> > > -   if (ret)
> > > -   goto out_unlock;
> > 
> > Whilst you are here, you might consider this function too simple to even
> > require the out_unlock...
> 
> Actually, looking at the function as it stands after the patch, if I
> want to remove the out_unlock label I need to re-write the whole
> function. Are you OK with me doing that?

Yes. My suggestion is along the lines of

diff --git a/drivers/gpu/drm/drm_vma_manager.c 
b/drivers/gpu/drm/drm_vma_manager.c
index 28f1226576f8..ba7857ed4361 100644
--- a/drivers/gpu/drm/drm_vma_manager.c
+++ b/drivers/gpu/drm/drm_vma_manager.c
@@ -207,17 +207,13 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr,
 
write_lock(>vm_lock);
 
-   if (drm_mm_node_allocated(>vm_node)) {
-   ret = 0;
-   goto out_unlock;
-   }
+   ret = 0;
+   if (!drm_mm_node_allocated(>vm_node))
+   ret = drm_mm_insert_node(>vm_addr_space_mm,
+>vm_node, pages);
 
-   ret = drm_mm_insert_node(>vm_addr_space_mm, >vm_node, pages);
-   if (ret)
-   goto out_unlock;
-
-out_unlock:
write_unlock(>vm_lock);
+
return ret;
 }

Can you please cc functional patches like this to
intel-...@lists.freedesktop.org? That will give us some reassurance that
the change isn't outright horrible. ;)
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/drm_vma_manager.c: Remove useless goto statement

2017-11-01 Thread Liviu Dudau
On Wed, Nov 01, 2017 at 02:11:44PM +, Chris Wilson wrote:
> Quoting Liviu Dudau (2017-11-01 14:04:24)
> > Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded
> > interval-tree in drm_mm") removed a line in drm_vma_offset_add() function
> > that makes checking the result of calling drm_mm_insert_node() and the
> > goto call redundant. Remove them.
> > 
> > Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded 
> > interval-tree in drm_mm")
> > Cc: Chris Wilson 
> > Signed-off-by: Liviu Dudau 
> > ---
> >  drivers/gpu/drm/drm_vma_manager.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vma_manager.c 
> > b/drivers/gpu/drm/drm_vma_manager.c
> > index 28f1226576f8c..e545a7b2bcafc 100644
> > --- a/drivers/gpu/drm/drm_vma_manager.c
> > +++ b/drivers/gpu/drm/drm_vma_manager.c
> > @@ -213,8 +213,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager 
> > *mgr,
> > }
> >  
> > ret = drm_mm_insert_node(>vm_addr_space_mm, >vm_node, 
> > pages);
> > -   if (ret)
> > -   goto out_unlock;
> 
> Whilst you are here, you might consider this function too simple to even
> require the out_unlock...

Actually, looking at the function as it stands after the patch, if I
want to remove the out_unlock label I need to re-write the whole
function. Are you OK with me doing that?

Best regards,
Liviu

> -Chris

-- 

| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---
¯\_(ツ)_/¯
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 6/7] drm/drivers: drop redundant drm_edid_to_eld() calls

2017-11-01 Thread Jani Nikula
drm_add_edid_modes() now fills in the ELD automatically, so the calls to
drm_edid_to_eld() are redundant. Remove them.

All the other places are obvious, but nv50 has detached
drm_edid_to_eld() from the drm_add_edid_modes() call.

Cc: Alex Deucher 
Cc: Christian König 
Cc: Archit Taneja 
Cc: Andrzej Hajda 
Cc: Russell King 
Cc: CK Hu 
Cc: Philipp Zabel 
Cc: Ben Skeggs 
Cc: Mark Yao 
Cc: Benjamin Gaignard 
Cc: Vincent Abriou 
Cc: Thierry Reding 
Cc: Eric Anholt 
Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 1 -
 drivers/gpu/drm/bridge/analogix-anx78xx.c  | 2 --
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  | 2 --
 drivers/gpu/drm/i2c/tda998x_drv.c  | 1 -
 drivers/gpu/drm/i915/intel_dp.c| 1 -
 drivers/gpu/drm/i915/intel_modes.c | 1 -
 drivers/gpu/drm/mediatek/mtk_hdmi.c| 1 -
 drivers/gpu/drm/nouveau/nv50_display.c | 5 +
 drivers/gpu/drm/radeon/radeon_connectors.c | 1 -
 drivers/gpu/drm/radeon/radeon_dp_mst.c | 1 -
 drivers/gpu/drm/rockchip/cdn-dp-core.c | 4 +---
 drivers/gpu/drm/sti/sti_hdmi.c | 1 -
 drivers/gpu/drm/tegra/output.c | 1 -
 drivers/gpu/drm/vc4/vc4_hdmi.c | 1 -
 14 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index df9cbc78e168..8ca3783f2deb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -358,7 +358,6 @@ static int amdgpu_connector_ddc_get_modes(struct 
drm_connector *connector)
if (amdgpu_connector->edid) {
drm_mode_connector_update_edid_property(connector, 
amdgpu_connector->edid);
ret = drm_add_edid_modes(connector, amdgpu_connector->edid);
-   drm_edid_to_eld(connector, amdgpu_connector->edid);
return ret;
}
drm_mode_connector_update_edid_property(connector, NULL);
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix-anx78xx.c
index 9385eb0b1ee4..ed12a7ddd64a 100644
--- a/drivers/gpu/drm/bridge/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c
@@ -977,8 +977,6 @@ static int anx78xx_get_modes(struct drm_connector 
*connector)
}
 
num_modes = drm_add_edid_modes(connector, anx78xx->edid);
-   /* Store the ELD */
-   drm_edid_to_eld(connector, anx78xx->edid);
 
 unlock:
mutex_unlock(>lock);
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index bf14214fa464..a64ce7112288 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -1910,8 +1910,6 @@ static int dw_hdmi_connector_get_modes(struct 
drm_connector *connector)
drm_mode_connector_update_edid_property(connector, edid);
cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid);
ret = drm_add_edid_modes(connector, edid);
-   /* Store the ELD */
-   drm_edid_to_eld(connector, edid);
kfree(edid);
} else {
dev_dbg(hdmi->dev, "failed to get edid\n");
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 4d1f45acf2cd..60981505763c 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -1100,7 +1100,6 @@ static int tda998x_connector_get_modes(struct 
drm_connector *connector)
 
drm_mode_connector_update_edid_property(connector, edid);
n = drm_add_edid_modes(connector, edid);
-   drm_edid_to_eld(connector, edid);
 
kfree(edid);
 
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index d27c0145ac91..cddd96b24878 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -5889,7 +5889,6 @@ static bool intel_edp_init_connector(struct intel_dp 
*intel_dp,
if (drm_add_edid_modes(connector, edid)) {
drm_mode_connector_update_edid_property(connector,
edid);
-   drm_edid_to_eld(connector, edid);
} else {
kfree(edid);
edid = ERR_PTR(-EINVAL);
diff --git a/drivers/gpu/drm/i915/intel_modes.c 
b/drivers/gpu/drm/i915/intel_modes.c
index 951e834dd274..b39846613e3c 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -42,7 +42,6 @@ int 

[PATCH 5/7] drm/edid: build ELD in drm_add_edid_modes()

2017-11-01 Thread Jani Nikula
Call drm_edid_to_eld() from drm_add_edid_modes() to fill in the ELD
automatically. There's no harm in doing this for connectors that do not
support audio.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/drm_edid.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3162ea58e450..4e3ef3d91b95 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4612,8 +4612,8 @@ static int add_displayid_detailed_modes(struct 
drm_connector *connector,
  * @edid: EDID data
  *
  * Add the specified modes to the connector's mode list. Also fills out the
- * _display_info structure in @connector with any information which can be
- * derived from the edid.
+ * _display_info structure and ELD in @connector with any information which
+ * can be derived from the edid.
  *
  * Return: The number of modes added or 0 if we couldn't find any.
  */
@@ -4623,9 +4623,11 @@ int drm_add_edid_modes(struct drm_connector *connector, 
struct edid *edid)
u32 quirks;
 
if (edid == NULL) {
+   clear_eld(connector);
return 0;
}
if (!drm_edid_is_valid(edid)) {
+   clear_eld(connector);
dev_warn(connector->dev->dev, "%s: EDID invalid.\n",
 connector->name);
return 0;
@@ -4633,6 +4635,8 @@ int drm_add_edid_modes(struct drm_connector *connector, 
struct edid *edid)
 
quirks = edid_get_quirks(edid);
 
+   drm_edid_to_eld(connector, edid);
+
/*
 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks.
 * To avoid multiple parsing of same block, lets parse that map
-- 
2.11.0

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


[PATCH 4/7] drm/edid: abstract connector ELD clearing

2017-11-01 Thread Jani Nikula
Preparation for future work. No functional changes.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/drm_edid.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3139c2e90e32..3162ea58e450 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3829,6 +3829,18 @@ void drm_edid_get_monitor_name(struct edid *edid, char 
*name, int bufsize)
 }
 EXPORT_SYMBOL(drm_edid_get_monitor_name);
 
+static void clear_eld(struct drm_connector *connector)
+{
+   memset(connector->eld, 0, sizeof(connector->eld));
+
+   connector->latency_present[0] = false;
+   connector->latency_present[1] = false;
+   connector->video_latency[0] = 0;
+   connector->audio_latency[0] = 0;
+   connector->video_latency[1] = 0;
+   connector->audio_latency[1] = 0;
+}
+
 /**
  * drm_edid_to_eld - build ELD from EDID
  * @connector: connector corresponding to the HDMI/DP sink
@@ -3846,14 +3858,7 @@ void drm_edid_to_eld(struct drm_connector *connector, 
struct edid *edid)
int mnl;
int dbl;
 
-   memset(eld, 0, sizeof(connector->eld));
-
-   connector->latency_present[0] = false;
-   connector->latency_present[1] = false;
-   connector->video_latency[0] = 0;
-   connector->audio_latency[0] = 0;
-   connector->video_latency[1] = 0;
-   connector->audio_latency[1] = 0;
+   clear_eld(connector);
 
if (!edid)
return;
-- 
2.11.0

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


[PATCH 3/7] drm/i915: remove redundant ELD connector type update

2017-11-01 Thread Jani Nikula
drm_edid_to_eld() now sets ELD connector type, remove the redundant
update.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/intel_modes.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_modes.c 
b/drivers/gpu/drm/i915/intel_modes.c
index 28a778b785ac..951e834dd274 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -30,21 +30,6 @@
 #include "intel_drv.h"
 #include "i915_drv.h"
 
-static void intel_connector_update_eld_conn_type(struct drm_connector 
*connector)
-{
-   u8 conn_type;
-
-   if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
-   connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
-   conn_type = DRM_ELD_CONN_TYPE_DP;
-   } else {
-   conn_type = DRM_ELD_CONN_TYPE_HDMI;
-   }
-
-   connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] &= ~DRM_ELD_CONN_TYPE_MASK;
-   connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= conn_type;
-}
-
 /**
  * intel_connector_update_modes - update connector from edid
  * @connector: DRM connector device to use
@@ -59,8 +44,6 @@ int intel_connector_update_modes(struct drm_connector 
*connector,
ret = drm_add_edid_modes(connector, edid);
drm_edid_to_eld(connector, edid);
 
-   intel_connector_update_eld_conn_type(connector);
-
return ret;
 }
 
-- 
2.11.0

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


[PATCH 7/7] drm/edid: make drm_edid_to_eld() static

2017-11-01 Thread Jani Nikula
This is no longer needed outside of drm_edid.c.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/drm_edid.c   | 5 ++---
 include/drm/drm_edid.h   | 1 -
 include/drm/drm_modeset_helper_vtables.h | 3 ---
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 4e3ef3d91b95..749d07a01772 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3841,7 +3841,7 @@ static void clear_eld(struct drm_connector *connector)
connector->audio_latency[1] = 0;
 }
 
-/**
+/*
  * drm_edid_to_eld - build ELD from EDID
  * @connector: connector corresponding to the HDMI/DP sink
  * @edid: EDID to parse
@@ -3849,7 +3849,7 @@ static void clear_eld(struct drm_connector *connector)
  * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The
  * HDCP and Port_ID ELD fields are left for the graphics driver to fill in.
  */
-void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
+static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 {
uint8_t *eld = connector->eld;
u8 *cea;
@@ -3934,7 +3934,6 @@ void drm_edid_to_eld(struct drm_connector *connector, 
struct edid *edid)
DRM_DEBUG_KMS("ELD size %d, SAD count %d\n",
  drm_eld_size(eld), total_sad_count);
 }
-EXPORT_SYMBOL(drm_edid_to_eld);
 
 /**
  * drm_edid_to_sad - extracts SADs from EDID
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 6f35909b8add..9e4e23524840 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -333,7 +333,6 @@ struct drm_encoder;
 struct drm_connector;
 struct drm_display_mode;
 
-void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid);
 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
 int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb);
 int drm_av_sync_delay(struct drm_connector *connector,
diff --git a/include/drm/drm_modeset_helper_vtables.h 
b/include/drm/drm_modeset_helper_vtables.h
index 16646c44b7df..3e76ca805b0f 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -801,9 +801,6 @@ struct drm_connector_helper_funcs {
 * resolution can call drm_add_modes_noedid(), and mark the preferred
 * one using drm_set_preferred_mode().
 *
-* Finally drivers that support audio probably want to update the ELD
-* data, too, using drm_edid_to_eld().
-*
 * This function is only called after the @detect hook has indicated
 * that a sink is connected and when the EDID isn't overridden through
 * sysfs or the kernel commandline.
-- 
2.11.0

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


[PATCH 0/7] drm/edid and drivers: ELD refactoring

2017-11-01 Thread Jani Nikula
We were recently bitten by drm_edid_to_eld() clearing the connector
type, and us failing to set it back for DP. Here's a few ELD related
patches to try to unify ELD handling and make it a bit simpler for
drivers to get it right.

Apologies for the massive Cc list; it's the maintainers of all drivers
that call drm_edid_to_eld().

I'm open to splitting up patch 6 to driver specific patches as needed,
but I'd think it would be just fine to merge via drm-misc as-is too.

BR,
Jani.

Cc: Alex Deucher 
Cc: Christian König 
Cc: Archit Taneja 
Cc: Andrzej Hajda 
Cc: Russell King 
Cc: CK Hu 
Cc: Philipp Zabel 
Cc: Ben Skeggs 
Cc: Mark Yao 
Cc: Benjamin Gaignard 
Cc: Vincent Abriou 
Cc: Thierry Reding 
Cc: Eric Anholt 


Jani Nikula (7):
  drm/edid: use macros for ELD offsets and values
  drm/edid: set ELD connector type in drm_edid_to_eld()
  drm/i915: remove redundant ELD connector type update
  drm/edid: abstract connector ELD clearing
  drm/edid: build ELD in drm_add_edid_modes()
  drm/drivers: drop redundant drm_edid_to_eld() calls
  drm/edid: make drm_edid_to_eld() static

 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c |  1 -
 drivers/gpu/drm/bridge/analogix-anx78xx.c  |  2 -
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c  |  2 -
 drivers/gpu/drm/drm_edid.c | 70 +++---
 drivers/gpu/drm/i2c/tda998x_drv.c  |  1 -
 drivers/gpu/drm/i915/intel_dp.c|  1 -
 drivers/gpu/drm/i915/intel_modes.c | 18 ---
 drivers/gpu/drm/mediatek/mtk_hdmi.c|  1 -
 drivers/gpu/drm/nouveau/nv50_display.c |  5 +-
 drivers/gpu/drm/radeon/radeon_connectors.c |  1 -
 drivers/gpu/drm/radeon/radeon_dp_mst.c |  1 -
 drivers/gpu/drm/rockchip/cdn-dp-core.c |  4 +-
 drivers/gpu/drm/sti/sti_hdmi.c |  1 -
 drivers/gpu/drm/tegra/output.c |  1 -
 drivers/gpu/drm/vc4/vc4_hdmi.c |  1 -
 include/drm/drm_edid.h |  1 -
 include/drm/drm_modeset_helper_vtables.h   |  3 --
 17 files changed, 44 insertions(+), 70 deletions(-)

-- 
2.11.0

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


[PATCH 2/7] drm/edid: set ELD connector type in drm_edid_to_eld()

2017-11-01 Thread Jani Nikula
Since drm_edid_to_eld() knows the connector type, we can set the type in
ELD while at it. Most connectors this gets called on are not DP
encoders, and with the HDMI type being 0, this does not change behaviour
for non-DP.

For i915 having this in place earlier would have saved a considerable
amount of debugging that lead to the fix 2d8f63297b9f ("drm/i915: always
update ELD connector type after get modes"). I don't see other drivers,
even the ones calling drm_edid_to_eld() on DP connectors, setting the
connector type in ELD.

Cc: Alex Deucher 
Cc: Christian König 
Cc: Archit Taneja 
Cc: Andrzej Hajda 
Cc: Russell King 
Cc: CK Hu 
Cc: Philipp Zabel 
Cc: Ben Skeggs 
Cc: Mark Yao 
Cc: Benjamin Gaignard 
Cc: Vincent Abriou 
Cc: Thierry Reding 
Cc: Eric Anholt 
Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/drm_edid.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 6229735ecc15..3139c2e90e32 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3835,8 +3835,7 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name);
  * @edid: EDID to parse
  *
  * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The
- * Conn_Type, HDCP and Port_ID ELD fields are left for the graphics driver to
- * fill in.
+ * HDCP and Port_ID ELD fields are left for the graphics driver to fill in.
  */
 void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
 {
@@ -3918,6 +3917,12 @@ void drm_edid_to_eld(struct drm_connector *connector, 
struct edid *edid)
}
eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= total_sad_count << 
DRM_ELD_SAD_COUNT_SHIFT;
 
+   if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
+   connector->connector_type == DRM_MODE_CONNECTOR_eDP)
+   eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_CONN_TYPE_DP;
+   else
+   eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_CONN_TYPE_HDMI;
+
eld[DRM_ELD_BASELINE_ELD_LEN] =
DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4);
 
-- 
2.11.0

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


[PATCH 1/7] drm/edid: use macros for ELD offsets and values

2017-11-01 Thread Jani Nikula
We have the macros, use them. No functional changes.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/drm_edid.c | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 00ddabfbf980..6229735ecc15 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3756,8 +3756,8 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector 
*connector, const u8 *db)
 {
u8 len = cea_db_payload_len(db);
 
-   if (len >= 6)
-   connector->eld[5] |= (db[6] >> 7) << 1;  /* Supports_AI */
+   if (len >= 6 && (db[6] & (1 << 7)))
+   connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= 
DRM_ELD_SUPPORTS_AI;
if (len >= 8) {
connector->latency_present[0] = db[8] >> 7;
connector->latency_present[1] = (db[8] >> 6) & 1;
@@ -3865,17 +3865,18 @@ void drm_edid_to_eld(struct drm_connector *connector, 
struct edid *edid)
return;
}
 
-   mnl = get_monitor_name(edid, eld + 20);
+   mnl = get_monitor_name(edid, [DRM_ELD_MONITOR_NAME_STRING]);
+   DRM_DEBUG_KMS("ELD monitor %s\n", [DRM_ELD_MONITOR_NAME_STRING]);
 
-   eld[4] = (cea[1] << 5) | mnl;
-   DRM_DEBUG_KMS("ELD monitor %s\n", eld + 20);
+   eld[DRM_ELD_CEA_EDID_VER_MNL] = cea[1] << DRM_ELD_CEA_EDID_VER_SHIFT;
+   eld[DRM_ELD_CEA_EDID_VER_MNL] |= mnl;
 
-   eld[0] = 2 << 3;/* ELD version: 2 */
+   eld[DRM_ELD_VER] = DRM_ELD_VER_CEA861D;
 
-   eld[16] = edid->mfg_id[0];
-   eld[17] = edid->mfg_id[1];
-   eld[18] = edid->prod_code[0];
-   eld[19] = edid->prod_code[1];
+   eld[DRM_ELD_MANUFACTURER_NAME0] = edid->mfg_id[0];
+   eld[DRM_ELD_MANUFACTURER_NAME1] = edid->mfg_id[1];
+   eld[DRM_ELD_PRODUCT_CODE0] = edid->prod_code[0];
+   eld[DRM_ELD_PRODUCT_CODE1] = edid->prod_code[1];
 
if (cea_revision(cea) >= 3) {
int i, start, end;
@@ -3896,14 +3897,14 @@ void drm_edid_to_eld(struct drm_connector *connector, 
struct edid *edid)
/* Audio Data Block, contains SADs */
sad_count = min(dbl / 3, 15 - total_sad_count);
if (sad_count >= 1)
-   memcpy(eld + 20 + mnl + total_sad_count 
* 3,
+   memcpy([DRM_ELD_CEA_SAD(mnl, 
total_sad_count)],
   [1], sad_count * 3);
total_sad_count += sad_count;
break;
case SPEAKER_BLOCK:
/* Speaker Allocation Data Block */
if (dbl >= 1)
-   eld[7] = db[1];
+   eld[DRM_ELD_SPEAKER] = db[1];
break;
case VENDOR_BLOCK:
/* HDMI Vendor-Specific Data Block */
@@ -3915,7 +3916,7 @@ void drm_edid_to_eld(struct drm_connector *connector, 
struct edid *edid)
}
}
}
-   eld[5] |= total_sad_count << 4;
+   eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= total_sad_count << 
DRM_ELD_SAD_COUNT_SHIFT;
 
eld[DRM_ELD_BASELINE_ELD_LEN] =
DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4);
-- 
2.11.0

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


Re: [PATCH] drm/drm_vma_manager.c: Remove useless goto statement

2017-11-01 Thread Liviu Dudau
On Wed, Nov 01, 2017 at 02:11:44PM +, Chris Wilson wrote:
> Quoting Liviu Dudau (2017-11-01 14:04:24)
> > Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded
> > interval-tree in drm_mm") removed a line in drm_vma_offset_add() function
> > that makes checking the result of calling drm_mm_insert_node() and the
> > goto call redundant. Remove them.
> > 
> > Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded 
> > interval-tree in drm_mm")
> > Cc: Chris Wilson 
> > Signed-off-by: Liviu Dudau 
> > ---
> >  drivers/gpu/drm/drm_vma_manager.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_vma_manager.c 
> > b/drivers/gpu/drm/drm_vma_manager.c
> > index 28f1226576f8c..e545a7b2bcafc 100644
> > --- a/drivers/gpu/drm/drm_vma_manager.c
> > +++ b/drivers/gpu/drm/drm_vma_manager.c
> > @@ -213,8 +213,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager 
> > *mgr,
> > }
> >  
> > ret = drm_mm_insert_node(>vm_addr_space_mm, >vm_node, 
> > pages);
> > -   if (ret)
> > -   goto out_unlock;
> 
> Whilst you are here, you might consider this function too simple to even
> require the out_unlock...

Bah, you are right, should've removed that one too :)

Will send an update shortly.

Thanks!
Liviu

> -Chris

-- 

| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---
¯\_(ツ)_/¯
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4 2/9] drm/exynos: ipp: Add IPP v2 framework

2017-11-01 Thread Tobias Jakobi
Dave Airlie wrote:
> On 23 October 2017 at 17:54, Marek Szyprowski  
> wrote:
>> This patch adds Exynos IPP v2 subsystem and userspace API.
>>
>> New userspace API is focused ONLY on memory-to-memory image processing.
>> The two remainging IPP operation modes (framebuffer writeback and
>> local-path output with image processing) can be implemented using
>> standard DRM features: writeback connectors and additional DRM planes with
>> scaling features.
>>
>> V2 IPP userspace API is not compatible with old IPP ioctls. This is a
>> significant change, but the old IPP subsystem in mainline Linux kernel was
>> partially disfunctional anyway and not used in any open-source project.
>>
>> V2 IPP userspace API is based on stateless approach, which much better fits
>> to memory-to-memory image processing model. It also provides support for
>> all image formats, which are both already defined in DRM API and supported
>> by the existing IPP hardware modules.
>>
>> The API consists of the following ioctls:
>> - DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES: to enumerate all available image
>>   processing modules,
>> - DRM_IOCTL_EXYNOS_IPP_GET_CAPS: to query capabilities and supported image
>>   formats of given IPP module,
>> - DRM_IOCTL_EXYNOS_IPP_GET_LIMITS: to query hardware limitiations for
>>   selected image format of given IPP module,
>> - DRM_IOCTL_EXYNOS_IPP_COMMIT: to perform operation described by the
>>   provided structures (source and destination buffers, operation rectangle,
>>   transformation, etc).
>>
>> The proposed userspace API is extensible. In the future more advanced image
>> processing operations can be defined to support for example blending.
>>
>> Userspace API is fully functional also on DRM render nodes, so it is not
>> limited to the root/privileged client.
>>
>> Internal driver API also has been completely rewritten. New IPP core
>> performs all possible input validation, checks and object life-time
>> control. The drivers can focus only on writing configuration to hardware
>> registers. Stateless nature of DRM_IOCTL_EXYNOS_IPP_COMMIT ioctl simplifies
>> the driver API. Minimal driver needs to provide a single callback for
>> starting processing and an array with supported image formats.
> 
> Is there userspace user for this? This is pretty significant
> driver-specific API addition.
> 
> The commit should contain pointers to a userspace project using this,
> or patches to one.
The pointers are in the cover letter of the series.

- Tobias

> Dave.
> 

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


[PATCH] drm: hdlcd: Skip checking the clock provider when CRTC is disabled.

2017-11-01 Thread Liviu Dudau
Some clock providers (clk-vexpress-osc) trigger a WARN() when the
requested rate falls outside its capabilities, as is the case when
a CRTC gets disabled. Check if the CRTC's new state is enabled and
skip the clk_round_rate() call if it is not.

Reported-by: Vladimir Murzin 
Signed-off-by: Liviu Dudau 
Tested-by: Vladimir Murzin 
---
 drivers/gpu/drm/arm/hdlcd_crtc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index 72b22b805412b..a1387a8bf78c4 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -193,6 +193,10 @@ static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_display_mode *mode = >adjusted_mode;
long rate, clk_rate = mode->clock * 1000;
 
+   /* if the crtc is disabled, skip the clock check */
+   if (!state->enable)
+   return 0;
+
rate = clk_round_rate(hdlcd->clk, clk_rate);
if (rate != clk_rate) {
/* clock required by mode not supported by hardware */
-- 
2.14.1

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


[PATCH] drm: gem_cma_helper.c: Allow importing of contiguous scatterlists with nents > 1

2017-11-01 Thread Liviu Dudau
drm_gem_cma_prime_import_sg_table() will fail if the number of entries
in the sg_table > 1. However, you can have a device that uses an IOMMU
engine and can map a discontiguous buffer with multiple entries that
have consecutive sg_dma_addresses, effectively making it contiguous.
Allow for that scenario by testing the entries in the sg_table for
contiguous coverage.

Reviewed-by: Brian Starkey 
Signed-off-by: Liviu Dudau 
---

Hi,

This patch is the only change I need in order to be able to use existing
IOMMU domain infrastructure with the Mali DP driver. I have tested the
patch and I know it works correctly for my setup, but I would like to get
some comments on whether I am on the right path or if CMA really wants to
see an sg_table with only one entry.

Best regards,
Liviu

 drivers/gpu/drm/drm_gem_cma_helper.c | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c 
b/drivers/gpu/drm/drm_gem_cma_helper.c
index 020e7668dfaba..43b179212052d 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -482,8 +482,26 @@ drm_gem_cma_prime_import_sg_table(struct drm_device *dev,
 {
struct drm_gem_cma_object *cma_obj;
 
-   if (sgt->nents != 1)
-   return ERR_PTR(-EINVAL);
+   if (sgt->nents != 1) {
+   /* check if the entries in the sg_table are contiguous */
+   dma_addr_t next_addr = sg_dma_address(sgt->sgl);
+   struct scatterlist *s;
+   unsigned int i;
+
+   for_each_sg(sgt->sgl, s, sgt->nents, i) {
+   /*
+* sg_dma_address(s) is only valid for entries
+* that have sg_dma_len(s) != 0
+*/
+   if (!sg_dma_len(s))
+   continue;
+
+   if (sg_dma_address(s) != next_addr)
+   return ERR_PTR(-EINVAL);
+
+   next_addr = sg_dma_address(s) + sg_dma_len(s);
+   }
+   }
 
/* Create a CMA GEM buffer. */
cma_obj = __drm_gem_cma_create(dev, attach->dmabuf->size);
-- 
2.14.3

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


[PATCH] drm: mali-dp: Disable planes when their CRTC gets disabled.

2017-11-01 Thread Liviu Dudau
Make sure only the planes on the active CRTCs get committed and
that all planes on the disabled CRTCs get turned off.

Reviewed-by: Brian Starkey 
Signed-off-by: Liviu Dudau 
---
 drivers/gpu/drm/arm/malidp_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/arm/malidp_crtc.c 
b/drivers/gpu/drm/arm/malidp_crtc.c
index 153a496706262..904fff80917ba 100644
--- a/drivers/gpu/drm/arm/malidp_crtc.c
+++ b/drivers/gpu/drm/arm/malidp_crtc.c
@@ -77,6 +77,9 @@ static void malidp_crtc_atomic_disable(struct drm_crtc *crtc,
struct malidp_hw_device *hwdev = malidp->dev;
int err;
 
+   /* always disable planes on the CRTC that is being turned off */
+   drm_atomic_helper_disable_planes_on_crtc(old_state, false);
+
drm_crtc_vblank_off(crtc);
hwdev->hw->enter_config_mode(hwdev);
 
-- 
2.14.3

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


[PATCH] drm: mali-dp: Separate static internal data into a read-only structure.

2017-11-01 Thread Liviu Dudau
The malidp_hw_device structure that the driver uses to handle the
differences between versions of the IP contains both non-changeable
data and fields that get updated at probe time. Previously we were
copying the read-only part into allocated memory, but that can be
completely avoided by splitting the structure into a read-only part
and keeping the runtime modifiable fields into the old structure.

Reviewed-by: Brian Starkey 
Signed-off-by: Liviu Dudau 
---
 drivers/gpu/drm/arm/malidp_crtc.c   | 13 
 drivers/gpu/drm/arm/malidp_drv.c| 30 -
 drivers/gpu/drm/arm/malidp_hw.c | 46 ++
 drivers/gpu/drm/arm/malidp_hw.h | 65 ++---
 drivers/gpu/drm/arm/malidp_planes.c | 19 +--
 5 files changed, 93 insertions(+), 80 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_crtc.c 
b/drivers/gpu/drm/arm/malidp_crtc.c
index 3615d18a7ddf3..153a496706262 100644
--- a/drivers/gpu/drm/arm/malidp_crtc.c
+++ b/drivers/gpu/drm/arm/malidp_crtc.c
@@ -65,8 +65,8 @@ static void malidp_crtc_atomic_enable(struct drm_crtc *crtc,
/* We rely on firmware to set mclk to a sensible level. */
clk_set_rate(hwdev->pxlclk, crtc->state->adjusted_mode.crtc_clock * 
1000);
 
-   hwdev->modeset(hwdev, );
-   hwdev->leave_config_mode(hwdev);
+   hwdev->hw->modeset(hwdev, );
+   hwdev->hw->leave_config_mode(hwdev);
drm_crtc_vblank_on(crtc);
 }
 
@@ -78,7 +78,8 @@ static void malidp_crtc_atomic_disable(struct drm_crtc *crtc,
int err;
 
drm_crtc_vblank_off(crtc);
-   hwdev->enter_config_mode(hwdev);
+   hwdev->hw->enter_config_mode(hwdev);
+
clk_disable_unprepare(hwdev->pxlclk);
 
err = pm_runtime_put(crtc->dev->dev);
@@ -319,7 +320,7 @@ static int malidp_crtc_atomic_check_scaling(struct drm_crtc 
*crtc,
 
 mclk_calc:
drm_display_mode_to_videomode(>adjusted_mode, );
-   ret = hwdev->se_calc_mclk(hwdev, s, );
+   ret = hwdev->hw->se_calc_mclk(hwdev, s, );
if (ret < 0)
return -EINVAL;
return 0;
@@ -475,7 +476,7 @@ static int malidp_crtc_enable_vblank(struct drm_crtc *crtc)
struct malidp_hw_device *hwdev = malidp->dev;
 
malidp_hw_enable_irq(hwdev, MALIDP_DE_BLOCK,
-hwdev->map.de_irq_map.vsync_irq);
+hwdev->hw->map.de_irq_map.vsync_irq);
return 0;
 }
 
@@ -485,7 +486,7 @@ static void malidp_crtc_disable_vblank(struct drm_crtc 
*crtc)
struct malidp_hw_device *hwdev = malidp->dev;
 
malidp_hw_disable_irq(hwdev, MALIDP_DE_BLOCK,
- hwdev->map.de_irq_map.vsync_irq);
+ hwdev->hw->map.de_irq_map.vsync_irq);
 }
 
 static const struct drm_crtc_funcs malidp_crtc_funcs = {
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index a2b698c983b45..91f2b0191368c 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -47,10 +47,10 @@ static void malidp_write_gamma_table(struct 
malidp_hw_device *hwdev,
 * directly.
 */
malidp_hw_write(hwdev, gamma_write_mask,
-   hwdev->map.coeffs_base + MALIDP_COEF_TABLE_ADDR);
+   hwdev->hw->map.coeffs_base + MALIDP_COEF_TABLE_ADDR);
for (i = 0; i < MALIDP_COEFFTAB_NUM_COEFFS; ++i)
malidp_hw_write(hwdev, data[i],
-   hwdev->map.coeffs_base +
+   hwdev->hw->map.coeffs_base +
MALIDP_COEF_TABLE_DATA);
 }
 
@@ -103,7 +103,7 @@ void malidp_atomic_commit_update_coloradj(struct drm_crtc 
*crtc,
for (i = 0; i < MALIDP_COLORADJ_NUM_COEFFS; ++i)
malidp_hw_write(hwdev,
mc->coloradj_coeffs[i],
-   hwdev->map.coeffs_base +
+   hwdev->hw->map.coeffs_base +
MALIDP_COLOR_ADJ_COEF + 4 * i);
 
malidp_hw_setbits(hwdev, MALIDP_DISP_FUNC_CADJ,
@@ -120,8 +120,8 @@ static void malidp_atomic_commit_se_config(struct drm_crtc 
*crtc,
struct malidp_hw_device *hwdev = malidp->dev;
struct malidp_se_config *s = >scaler_config;
struct malidp_se_config *old_s = _cs->scaler_config;
-   u32 se_control = hwdev->map.se_base +
-((hwdev->map.features & MALIDP_REGMAP_HAS_CLEARIRQ) ?
+   u32 se_control = hwdev->hw->map.se_base +
+((hwdev->hw->map.features & 
MALIDP_REGMAP_HAS_CLEARIRQ) ?
 0x10 : 0xC);
u32 layer_control = se_control + MALIDP_SE_LAYER_CONTROL;
u32 scr = se_control + MALIDP_SE_SCALING_CONTROL;
@@ -135,7 +135,7 @@ static void 

Re: [PATCH] drm/drm_vma_manager.c: Remove useless goto statement

2017-11-01 Thread Chris Wilson
Quoting Liviu Dudau (2017-11-01 14:04:24)
> Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded
> interval-tree in drm_mm") removed a line in drm_vma_offset_add() function
> that makes checking the result of calling drm_mm_insert_node() and the
> goto call redundant. Remove them.
> 
> Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree 
> in drm_mm")
> Cc: Chris Wilson 
> Signed-off-by: Liviu Dudau 
> ---
>  drivers/gpu/drm/drm_vma_manager.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_vma_manager.c 
> b/drivers/gpu/drm/drm_vma_manager.c
> index 28f1226576f8c..e545a7b2bcafc 100644
> --- a/drivers/gpu/drm/drm_vma_manager.c
> +++ b/drivers/gpu/drm/drm_vma_manager.c
> @@ -213,8 +213,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr,
> }
>  
> ret = drm_mm_insert_node(>vm_addr_space_mm, >vm_node, 
> pages);
> -   if (ret)
> -   goto out_unlock;

Whilst you are here, you might consider this function too simple to even
require the out_unlock...
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm: Spelling fixes

2017-11-01 Thread Liviu Dudau
Minor spelling fix for 'monster' and replace 'on' with 'own' in
comments.

Signed-off-by: Liviu Dudau 
---
 drivers/gpu/drm/drm_atomic.c | 2 +-
 drivers/gpu/drm/drm_mm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index c2da5585e2012..11614ea03fc8b 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1808,7 +1808,7 @@ int drm_atomic_debugfs_init(struct drm_minor *minor)
 #endif
 
 /*
- * The big monstor ioctl
+ * The big monster ioctl
  */
 
 static struct drm_pending_vblank_event *create_vblank_event(
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 61a1c8ea74bc5..eb86bc3f753b3 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -92,7 +92,7 @@
  * some basic allocator dumpers for debugging.
  *
  * Note that this range allocator is not thread-safe, drivers need to protect
- * modifications with their on locking. The idea behind this is that for a full
+ * modifications with their own locking. The idea behind this is that for a 
full
  * memory manager additional data needs to be protected anyway, hence internal
  * locking would be fully redundant.
  */
-- 
2.14.3

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


[PATCH] drm/drm_vma_manager.c: Remove useless goto statement

2017-11-01 Thread Liviu Dudau
Commit db2395eccf08i ("drm: Convert drm_vma_manager to embedded
interval-tree in drm_mm") removed a line in drm_vma_offset_add() function
that makes checking the result of calling drm_mm_insert_node() and the
goto call redundant. Remove them.

Fixes: db2395eccf08i ("drm: Convert drm_vma_manager to embedded interval-tree 
in drm_mm")
Cc: Chris Wilson 
Signed-off-by: Liviu Dudau 
---
 drivers/gpu/drm/drm_vma_manager.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_vma_manager.c 
b/drivers/gpu/drm/drm_vma_manager.c
index 28f1226576f8c..e545a7b2bcafc 100644
--- a/drivers/gpu/drm/drm_vma_manager.c
+++ b/drivers/gpu/drm/drm_vma_manager.c
@@ -213,8 +213,6 @@ int drm_vma_offset_add(struct drm_vma_offset_manager *mgr,
}
 
ret = drm_mm_insert_node(>vm_addr_space_mm, >vm_node, pages);
-   if (ret)
-   goto out_unlock;
 
 out_unlock:
write_unlock(>vm_lock);
-- 
2.14.3

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


[PATCH] drm/drm_mm.h: Fix the name of the referenced function in comment

2017-11-01 Thread Liviu Dudau
drm_mm_insert_node_generic() is a simplified version of
drm_mm_insert_node_in_range(), update comment to reflect correct
function name.

Signed-off-by: Liviu Dudau 
---
 include/drm/drm_mm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 8d10fc97801ce..101f566ae43d0 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -386,7 +386,7 @@ int drm_mm_insert_node_in_range(struct drm_mm *mm,
  * @color: opaque tag value to use for this node
  * @mode: fine-tune the allocation search and placement
  *
- * This is a simplified version of drm_mm_insert_node_in_range_generic() with 
no
+ * This is a simplified version of drm_mm_insert_node_in_range() with no
  * range restrictions applied.
  *
  * The preallocated node must be cleared to 0.
-- 
2.14.3

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


[PATCH] dma-buf: Cleanup comments on dma_buf_map_attachment()

2017-11-01 Thread Liviu Dudau
Mappings need to be unmapped by calling dma_buf_unmap_attachment() and
not by calling again dma_buf_map_attachment(). Also fix some spelling
mistakes.

Signed-off-by: Liviu Dudau 
---
 drivers/dma-buf/dma-buf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index bc1cb284111cb..1792385405f0e 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -351,13 +351,13 @@ static inline int is_dma_buf_file(struct file *file)
  *
  * 2. Userspace passes this file-descriptors to all drivers it wants this 
buffer
  *to share with: First the filedescriptor is converted to a _buf using
- *dma_buf_get(). The the buffer is attached to the device using
+ *dma_buf_get(). Then the buffer is attached to the device using
  *dma_buf_attach().
  *
  *Up to this stage the exporter is still free to migrate or reallocate the
  *backing storage.
  *
- * 3. Once the buffer is attached to all devices userspace can inniate DMA
+ * 3. Once the buffer is attached to all devices userspace can initiate DMA
  *access to the shared buffer. In the kernel this is done by calling
  *dma_buf_map_attachment() and dma_buf_unmap_attachment().
  *
@@ -617,7 +617,7 @@ EXPORT_SYMBOL_GPL(dma_buf_detach);
  * Returns sg_table containing the scatterlist to be returned; returns ERR_PTR
  * on error. May return -EINTR if it is interrupted by a signal.
  *
- * A mapping must be unmapped again using dma_buf_map_attachment(). Note that
+ * A mapping must be unmapped by using dma_buf_unmap_attachment(). Note that
  * the underlying backing storage is pinned for as long as a mapping exists,
  * therefore users/importers should not hold onto a mapping for undue amounts 
of
  * time.
-- 
2.14.3

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


Re: [PATCH] drm: Require __GFP_NOFAIL for the legacy drm_modeset_lock_all

2017-11-01 Thread Chris Wilson
Quoting Daniel Vetter (2017-10-31 16:38:26)
> On Tue, Oct 31, 2017 at 03:28:01PM +0200, Ville Syrjälä wrote:
> > On Tue, Oct 31, 2017 at 11:55:35AM +, Chris Wilson wrote:
> > > To acquire all modeset locks requires a ww_ctx to be allocated. As this
> > > is the legacy path and the allocation small, to reduce the changes
> > > required (and complex untested error handling) to the legacy drivers, we
> > > simply assume that the allocation succeeds. At present, it relies on the
> > > too-small-to-fail rule, but syzbot found that by injecting a failure
> > > here we would hit the WARN. Document that this allocation must succeed
> > > with __GFP_NOFAIL.
> 
> Note that for atomic drivers at least all the core/helper paths are fixed
> up correctly. But e.g. i915 has still plenty of callsites in its own code,
> mostly debugfs.
> 
> > > Reported-by: syzbot (syzkaller)
> > > Signed-off-by: Chris Wilson 
> > > Cc: Daniel Vetter 
> > 
> > Reviewed-by: Ville Syrjälä 
> 
> Applied, thanks.

Just curious as it hasn't shown up in drm-tip yet, so I'm worrying if it
found a crack to hide in.
-Chris
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103404] HDMI Audio with RX Vega not working on drm-next-4.15-dc (device listed as unconnected)

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

Leo Li  changed:

   What|Removed |Added

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

--- Comment #13 from Leo Li  ---
Thanks for the confirmation, marking this as resolved.

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


Re: RFC: Add drm_dev_suspend/resume() ?

2017-11-01 Thread Noralf Trønnes


Den 01.11.2017 09.47, skrev Daniel Vetter:

On Tue, Oct 31, 2017 at 05:37:23PM +0100, Noralf Trønnes wrote:

Den 30.10.2017 10.34, skrev Daniel Vetter:

Hi Noralf,

On Sun, Oct 22, 2017 at 06:52:41PM +0200, Noralf Trønnes wrote:

Hi,

I've spent some time in the fbdev emulation code and discovered a
recurring pattern around suspend/resume.
Should we add some more helpers :-)

You're maybe a bit too good at spotting these for your own good :-)

But yeah, a "suspend for dummies" is one of the things which would be nice
I think ... Especially since we now have the atomic suspend/resume
helpers.


struct drm_device {
      /**
       * @suspend_state:
       *
       * Atomic state when suspended.
       * Set by drm_dev_suspend(), cleared by drm_dev_resume().
       */
      struct drm_atomic_state *suspend_state;
};

Imo fits better when we put it into drm_mode_config.


int drm_dev_suspend(struct drm_device *dev)
{
      struct drm_atomic_state *state;

      if (!dev)
          return 0;

      drm_kms_helper_poll_disable(dev);
      drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
      state = drm_atomic_helper_suspend(dev);
      if (IS_ERR(state)) {
          drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
          drm_kms_helper_poll_enable(dev);
          return PTR_ERR(state);
      }

      dev->suspend_state = state;

      return 0;
}

This is all about suspending the modeset side ... I'd give it a
drm_mode_config prefix instead of the drm_dev_ (that's maybe a bit too
generic), but then maybe type a general suspend/resume kernel-doc text in
the drm-internals.rst (maybe pulled in from drm_dev.c) which references
these 2 functions as the recommended way to suspend/resume the modeset
side of a driver. These won't suspend/resume a render part (if present),
so drm_dev_ seems a bit too much.

I just realised that this is pulling helpers (atomic, crtc, fbdev) into
the core which IIRC is something that you didn't want?

Ugh right. I think starting a new drm_mode_config_helper.c for top-level
helper stuff would be a reasonable solution. Or some other name if you
have a better one.


Does it fit in drm_modeset_helper.c ?

/**
 * DOC: aux kms helpers
 *
 * This helper library contains various one-off functions which don't 
really fit

 * anywhere else in the DRM modeset helper library.
 */

Noralf.


-Daniel



diff --git a/drivers/gpu/drm/drm_mode_config.c
b/drivers/gpu/drm/drm_mode_config.c
index 74f6ff5df656..72f8fe1e83cb 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -20,7 +20,10 @@
   * OF THIS SOFTWARE.
   */

+#include 
+#include 
  #include 
+#include 
  #include 
  #include 

@@ -473,3 +476,49 @@ void drm_mode_config_cleanup(struct drm_device *dev)
drm_modeset_lock_fini(>mode_config.connection_mutex);
  }
  EXPORT_SYMBOL(drm_mode_config_cleanup);
+
+/**
+ * drm_mode_config_suspend
+ * @dev: DRM device
+ *
+ */
+int drm_mode_config_suspend(struct drm_device *dev)
+{
+   struct drm_atomic_state *state;
+
+   if (!dev)
+   return 0;
+
+   drm_kms_helper_poll_disable(dev);
+   drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
+   state = drm_atomic_helper_suspend(dev);
+   if (IS_ERR(state)) {
+ drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
+   drm_kms_helper_poll_enable(dev);
+   return PTR_ERR(state);
+   }
+
+   dev->mode_config.suspend_state = state;
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_mode_config_suspend);
+
+int drm_mode_config_resume(struct drm_device *dev)
+{
+   int ret;
+
+   if (!dev || WARN_ON(!dev->mode_config.suspend_state))
+   return 0;
+
+   ret = drm_atomic_helper_resume(dev, dev->mode_config.suspend_state);
+   if (ret)
+   DRM_ERROR("Failed to resume (%d)\n", ret);
+   dev->mode_config.suspend_state = NULL;
+
+   drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
+   drm_kms_helper_poll_enable(dev);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_mode_config_resume);
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 1b37368416c8..86ef327a996d 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -766,11 +766,21 @@ struct drm_mode_config {
     /* cursor size */
     uint32_t cursor_width, cursor_height;

+   /**
+    * @suspend_state:
+    *
+    * Atomic state when suspended. Set by drm_mode_config_suspend(),
+    * cleared by drm_mode_config_resume().
+    */
+   struct drm_atomic_state *suspend_state;
+
     const struct drm_mode_config_helper_funcs *helper_private;
  };

  void drm_mode_config_init(struct drm_device *dev);
  void drm_mode_config_reset(struct drm_device *dev);
  void drm_mode_config_cleanup(struct drm_device *dev);
+int drm_mode_config_suspend(struct drm_device *dev);
+int drm_mode_config_resume(struct drm_device *dev);

  #endif


Noralf.


int drm_dev_resume(struct 

Re: [Intel-gfx] [maintainer-tools PATCH] dim: Sign commits in addition to tags

2017-11-01 Thread Sean Paul
On Wed, Nov 1, 2017 at 7:12 AM, Gustavo Padovan  wrote:
> 2017-10-31 Sean Paul :
>
>> On Tue, Oct 31, 2017 at 1:31 PM, Daniel Vetter  wrote:
>> > On Tue, Oct 31, 2017 at 5:14 PM, Sean Paul  wrote:
>> >> On Tue, Oct 31, 2017 at 4:27 AM, Jani Nikula
>> >>  wrote:
>> >>>
>> >>> Reminder, we have this new list dim-to...@lists.freedesktop.org for
>> >>> maintainer tools patches. Cc'd.
>> >>>
>> >>
>> >> Ahh, cool. I didn't realize dim grew up!
>> >>
>> >>> On Mon, 30 Oct 2017, Sean Paul  wrote:
>>  Expanding on Jani's work to sign tags, this patch adds signing for git
>>  commit/am.
>> >>>
>> >>> I guess I'd like more rationale here. Is this something we should be
>> >>> doing? Is anyone else doing this?
>> >>>
>> >>
>> >> Sure thing. Signing commits allows Dave to use --verify-signatures
>> >> when pulling. If something is not signed, we'll know it was either not
>> >> applied with dim, or was altered on fdo (both warrant investigation).
>> >>
>> >> I suspect no one else is doing this since most trees are single
>> >> maintainer, and it's not possible to sign commits via git send-email.
>> >> Since we have the committer model, and a bunch of people with access
>> >> to fdo and the tree, I think it's important to add this. Especially
>> >> since we can do it in dim without overhead.
>> >>
>>  Signed-off-by: Sean Paul 
>>  ---
>> 
>>  This has been lightly tested with dim apply-branch/dim push-branch.
>> 
>>  Sean
>> 
>>   dim | 78 
>>  +
>>   1 file changed, 51 insertions(+), 27 deletions(-)
>> 
>>  diff --git a/dim b/dim
>>  index 527989aff9ad..cd5e41f89a3a 100755
>>  --- a/dim
>>  +++ b/dim
>>  @@ -67,9 +67,6 @@ 
>>  DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature}
>>   # dim pull-request tag summary template
>>   
>>  DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-$HOME/.dim.template.tagsummary}
>> 
>>  -# GPG key id for signing tags. If unset, don't sign.
>>  -DIM_GPG_KEYID=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
>>  -
>>   #
>>   # Internal configuration.
>>   #
>>  @@ -104,6 +101,20 @@ test_request_recipients=(
>>   # integration configuration
>>   integration_config=nightly.conf
>> 
>>  +# GPG key id for signing tags. If unset, don't sign.
>>  +function gpg_keyid_for_tag
>>  +{
>>  + echo "${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}"
>>  + return 0
>>  +}
>>  +
>>  +# GPG key id for committing (git commit/am). If unset, don't sign.
>>  +function gpg_keyid_for_commit
>>  +{
>>  + echo "${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}"
>>  + return 0
>>  +}
>> >>>
>> >>> This seems like an overly complicated way to achieve what you want.
>> >>>
>> >>> Just put these under "Internal configuration." instead:
>> >>>
>> >>> dim_gpg_sign_tag=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
>> >>> dim_gpg_sign_commit=${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}
>> >>>
>> >>> And use directly in git tag and commit, respectively?
>> >>>
>> >>
>> >> Yep, sounds good.
>> >>
>> >>> Although... perhaps starting to sign tags should not force signing
>> >>> commits?
>> >>>
>> >>
>> >> Why would it be desirable to *not* sign tags?
>> >
>> > Again, what's the threat model you're trying to defend against? Atm
>> > anyone with commit rights to fd.o can push whatever they want to. If
>> > they want to be evil, they can also push whatever kind of garbage they
>> > want to, including commit signature and and fake Link: and review
>> > tags. With pull requests/tags signing them prevents a
>> > man-in-the-midddle attack of the unprotected pull request in the mail,
>> > but I still don't see what signing commits protects against.
>>
>> This is protecting against a bad actor (either through a committer's
>> account, or some other fdo account) gaining access to the tree on fdo
>> and either adding a malicious commit, or altering an existing commit.
>
> Yeah, but then we need to enforce it for all committer

My hope is that dim makes it easy enough to get everyone on board
eventually. In the interim, the people with signing commits will be
able to attest that those commits were applied by them.

> and we also need
> a signing party to sign each others keys.

I feel like most of us see each other often enough to make this
possible. Even without a signing party, we still get *some* amount of
coverage by virtue of TOFU [1].

Is anyone against the idea of signing commits? Is there a reason that
we shouldn't?

Sean

[1]- https://lists.gnupg.org/pipermail/gnupg-users/2015-October/054608.html

>
> Gustavo
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org

Re: [PATCH] drm/vc4: Fix wrong printk format in vc4_bo_stats_debugfs()

2017-11-01 Thread Gustavo Padovan
Hi Boris,

2017-11-01 Boris Brezillon :

> vc4->purgeable.size and vc4->purgeable.purged_size are size_t fields
> and should be printed with a %zd specifier.
> 
> Fixes: b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl")
> Signed-off-by: Boris Brezillon 
> ---
>  drivers/gpu/drm/vc4/vc4_bo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
> index 3c3d11236910..4ae45d7dac42 100644
> --- a/drivers/gpu/drm/vc4/vc4_bo.c
> +++ b/drivers/gpu/drm/vc4/vc4_bo.c
> @@ -88,11 +88,11 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
>  
>   mutex_lock(>purgeable.lock);
>   if (vc4->purgeable.num)
> - seq_printf(m, "%30s: %6dkb BOs (%d)\n", "userspace BO cache",
> + seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "userspace BO cache",
>  vc4->purgeable.size / 1024, vc4->purgeable.num);
>  
>   if (vc4->purgeable.purged_num)
> - seq_printf(m, "%30s: %6dkb BOs (%d)\n", "total purged BO",
> + seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "total purged BO",
>  vc4->purgeable.purged_size / 1024,
>  vc4->purgeable.purged_num);
>   mutex_unlock(>purgeable.lock);

Reviewed-by: Gustavo Padovan 

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


Re: [PATCH] drm/stm: checkpatch strict minor updates

2017-11-01 Thread Gustavo Padovan
2017-10-26 Philippe Cornu :

> Minor fixes detected with "scripts/checkpatch.pl --strict"
> 
> Signed-off-by: Philippe Cornu 
> ---
>  drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 4 ++--
>  drivers/gpu/drm/stm/ltdc.c| 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c 
> b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> index 10b2b77..3e8b9ed 100644
> --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> @@ -129,7 +129,7 @@ static int dsi_pll_get_params(int clkin_khz, int 
> clkout_khz,
>   int fvco_min, fvco_max, delta, best_delta; /* all in khz */
>  
>   /* Early checks preventing division by 0 & odd results */
> - if ((clkin_khz <= 0) || (clkout_khz <= 0))
> + if (clkin_khz <= 0 || clkout_khz <= 0)
>   return -EINVAL;
>  
>   fvco_min = LANE_MIN_KBPS * 2 * ODF_MAX;
> @@ -155,7 +155,7 @@ static int dsi_pll_get_params(int clkin_khz, int 
> clkout_khz,
>   for (o = ODF_MIN; o <= ODF_MAX; o *= 2) {
>   n = DIV_ROUND_CLOSEST(i * o * clkout_khz, clkin_khz);
>   /* Check ndiv according to vco range */
> - if ((n < n_min) || (n > n_max))
> + if (n < n_min || n > n_max)
>   continue;
>   /* Check if new delta is better & saves parameters */
>   delta = dsi_pll_get_clkout_khz(clkin_khz, i, n, o) -
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 735c908..7be6710 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -556,7 +556,7 @@ static int ltdc_plane_atomic_check(struct drm_plane 
> *plane,
>   src_h = state->src_h >> 16;
>  
>   /* Reject scaling */
> - if ((src_w != state->crtc_w) || (src_h != state->crtc_h)) {
> + if (src_w != state->crtc_w || src_h != state->crtc_h) {
>   DRM_ERROR("Scaling is not supported");
>   return -EINVAL;

Reviewed-by: Gustavo Padovan 

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


Re: [PATCH] drm/stm: dsi: Rename driver name

2017-11-01 Thread Gustavo Padovan
Hi Philippe,

2017-10-26 Philippe Cornu :

> Rename the driver name from "dw_mipi_dsi-stm" to
> "stm32-display-dsi" for a better readability
> in /sys/bus/platform/drivers entries.
> 
> Signed-off-by: Philippe Cornu 
> ---
>  drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c 
> b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> index e5b6310..10b2b77 100644
> --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> @@ -342,7 +342,7 @@ static int dw_mipi_dsi_stm_remove(struct platform_device 
> *pdev)
>   .remove = dw_mipi_dsi_stm_remove,
>   .driver = {
>   .of_match_table = dw_mipi_dsi_stm_dt_ids,
> - .name   = "dw_mipi_dsi-stm",
> + .name   = "stm32-display-dsi",

Reviewed-by: Gustavo Padovan 

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


Re: [PATCH 6/6] drm/msm/mdp5: Don't use async plane update path if plane visibility changes

2017-11-01 Thread Gustavo Padovan
Hi Archit,

2017-10-27 Archit Taneja :

> When a plane moves out of bounds (i.e, outside the crtc clip region), the
> plane state's "visible" parameter changes to false. When this happens, we
> (a) release the hwpipe resources away from it, and
> (b) unstage the corresponding hwpipe(s) from the Layer Mixers in the CRTC.
> 
> (a) requires use to acquire the global atomic state and assign a new
> hwpipe. (b) requires us to re-configure the Layer Mixer, which is done in
> the CRTC. We don't want to do these things in the async plane update path,
> so return an error if the new state's "visible" isn't the same as the
> current state's "visible".
> 
> Cc: Gustavo Padovan 
> Signed-off-by: Archit Taneja 
> ---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 25 +
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c 
> b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index f1cf367e853d..be50445f9901 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -470,6 +470,9 @@ static int mdp5_plane_atomic_async_check(struct drm_plane 
> *plane,
>  {
>   struct mdp5_plane_state *mdp5_state = to_mdp5_plane_state(state);
>   struct drm_crtc_state *crtc_state;
> + struct drm_rect clip;
> + int min_scale, max_scale;
> + int ret;
>  
>   crtc_state = drm_atomic_get_existing_crtc_state(state->state,
>   state->crtc);
> @@ -495,6 +498,28 @@ static int mdp5_plane_atomic_async_check(struct 
> drm_plane *plane,
>   plane->state->fb != state->fb)
>   return -EINVAL;
>  
> + clip.x1 = 0;
> + clip.y1 = 0;
> + clip.x2 = crtc_state->adjusted_mode.hdisplay;
> + clip.y2 = crtc_state->adjusted_mode.vdisplay;
> + min_scale = FRAC_16_16(1, 8);
> + max_scale = FRAC_16_16(8, 1);
> +
> + ret = drm_plane_helper_check_state(state, , min_scale,
> +max_scale, true, true);
> + if (ret)
> + return ret;
> +
> + /*
> +  * if the visibility of the plane changes (i.e, if the cursor is
> +  * clipped out completely, we can't take the async path because
> +  * we need to stage/unstage the plane from the Layer Mixer(s). We
> +  * also assign/unassign the hwpipe(s) tied to the plane. We avoid
> +  * taking the fast path for both these reasons.
> +  */
> + if (state->visible != plane->state->visible)
> + return -EINVAL;
> +
>   return 0;
>  }

Reviewed-by: Gustavo Padovan 

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


Re: [Intel-gfx] [maintainer-tools PATCH] dim: Sign commits in addition to tags

2017-11-01 Thread Gustavo Padovan
2017-10-31 Sean Paul :

> On Tue, Oct 31, 2017 at 1:31 PM, Daniel Vetter  wrote:
> > On Tue, Oct 31, 2017 at 5:14 PM, Sean Paul  wrote:
> >> On Tue, Oct 31, 2017 at 4:27 AM, Jani Nikula
> >>  wrote:
> >>>
> >>> Reminder, we have this new list dim-to...@lists.freedesktop.org for
> >>> maintainer tools patches. Cc'd.
> >>>
> >>
> >> Ahh, cool. I didn't realize dim grew up!
> >>
> >>> On Mon, 30 Oct 2017, Sean Paul  wrote:
>  Expanding on Jani's work to sign tags, this patch adds signing for git
>  commit/am.
> >>>
> >>> I guess I'd like more rationale here. Is this something we should be
> >>> doing? Is anyone else doing this?
> >>>
> >>
> >> Sure thing. Signing commits allows Dave to use --verify-signatures
> >> when pulling. If something is not signed, we'll know it was either not
> >> applied with dim, or was altered on fdo (both warrant investigation).
> >>
> >> I suspect no one else is doing this since most trees are single
> >> maintainer, and it's not possible to sign commits via git send-email.
> >> Since we have the committer model, and a bunch of people with access
> >> to fdo and the tree, I think it's important to add this. Especially
> >> since we can do it in dim without overhead.
> >>
>  Signed-off-by: Sean Paul 
>  ---
> 
>  This has been lightly tested with dim apply-branch/dim push-branch.
> 
>  Sean
> 
>   dim | 78 
>  +
>   1 file changed, 51 insertions(+), 27 deletions(-)
> 
>  diff --git a/dim b/dim
>  index 527989aff9ad..cd5e41f89a3a 100755
>  --- a/dim
>  +++ b/dim
>  @@ -67,9 +67,6 @@ 
>  DIM_TEMPLATE_SIGNATURE=${DIM_TEMPLATE_SIGNATURE:-$HOME/.dim.template.signature}
>   # dim pull-request tag summary template
>   
>  DIM_TEMPLATE_TAG_SUMMARY=${DIM_TEMPLATE_TAG_SUMMARY:-$HOME/.dim.template.tagsummary}
> 
>  -# GPG key id for signing tags. If unset, don't sign.
>  -DIM_GPG_KEYID=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
>  -
>   #
>   # Internal configuration.
>   #
>  @@ -104,6 +101,20 @@ test_request_recipients=(
>   # integration configuration
>   integration_config=nightly.conf
> 
>  +# GPG key id for signing tags. If unset, don't sign.
>  +function gpg_keyid_for_tag
>  +{
>  + echo "${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}"
>  + return 0
>  +}
>  +
>  +# GPG key id for committing (git commit/am). If unset, don't sign.
>  +function gpg_keyid_for_commit
>  +{
>  + echo "${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}"
>  + return 0
>  +}
> >>>
> >>> This seems like an overly complicated way to achieve what you want.
> >>>
> >>> Just put these under "Internal configuration." instead:
> >>>
> >>> dim_gpg_sign_tag=${DIM_GPG_KEYID:+-u $DIM_GPG_KEYID}
> >>> dim_gpg_sign_commit=${DIM_GPG_KEYID:+-S$DIM_GPG_KEYID}
> >>>
> >>> And use directly in git tag and commit, respectively?
> >>>
> >>
> >> Yep, sounds good.
> >>
> >>> Although... perhaps starting to sign tags should not force signing
> >>> commits?
> >>>
> >>
> >> Why would it be desirable to *not* sign tags?
> >
> > Again, what's the threat model you're trying to defend against? Atm
> > anyone with commit rights to fd.o can push whatever they want to. If
> > they want to be evil, they can also push whatever kind of garbage they
> > want to, including commit signature and and fake Link: and review
> > tags. With pull requests/tags signing them prevents a
> > man-in-the-midddle attack of the unprotected pull request in the mail,
> > but I still don't see what signing commits protects against.
> 
> This is protecting against a bad actor (either through a committer's
> account, or some other fdo account) gaining access to the tree on fdo
> and either adding a malicious commit, or altering an existing commit.

Yeah, but then we need to enforce it for all committer and we also need
a signing party to sign each others keys.

Gustavo

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


[PATCH] drm/vc4: Fix wrong printk format in vc4_bo_stats_debugfs()

2017-11-01 Thread Boris Brezillon
vc4->purgeable.size and vc4->purgeable.purged_size are size_t fields
and should be printed with a %zd specifier.

Fixes: b9f19259b84d ("drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl")
Signed-off-by: Boris Brezillon 
---
 drivers/gpu/drm/vc4/vc4_bo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 3c3d11236910..4ae45d7dac42 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -88,11 +88,11 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
 
mutex_lock(>purgeable.lock);
if (vc4->purgeable.num)
-   seq_printf(m, "%30s: %6dkb BOs (%d)\n", "userspace BO cache",
+   seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "userspace BO cache",
   vc4->purgeable.size / 1024, vc4->purgeable.num);
 
if (vc4->purgeable.purged_num)
-   seq_printf(m, "%30s: %6dkb BOs (%d)\n", "total purged BO",
+   seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "total purged BO",
   vc4->purgeable.purged_size / 1024,
   vc4->purgeable.purged_num);
mutex_unlock(>purgeable.lock);
-- 
2.11.0

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


Re: [PATCH] drm: gma500: Convert timers to use timer_setup()

2017-11-01 Thread Daniel Vetter
On Tue, Oct 31, 2017 at 08:08:14AM -0700, Kees Cook wrote:
> On Tue, Oct 31, 2017 at 3:18 AM, Daniel Vetter  wrote:
> > On Mon, Oct 30, 2017 at 03:05:29PM -0700, Kees Cook wrote:
> >> On Mon, Oct 30, 2017 at 3:08 AM, Daniel Vetter  wrote:
> >> > On Tue, Oct 24, 2017 at 08:16:09AM -0700, Kees Cook wrote:
> >> >> In preparation for unconditionally passing the struct timer_list 
> >> >> pointer to
> >> >> all timer callbacks, switch to using the new timer_setup() and 
> >> >> from_timer()
> >> >> to pass the timer pointer explicitly.
> >> >>
> >> >> Cc: Patrik Jakobsson 
> >> >> Cc: David Airlie 
> >> >> Cc: dri-devel@lists.freedesktop.org
> >> >> Signed-off-by: Kees Cook 
> >> >
> >> > Do you expect drm folks to apply this, or is this part of a larger 
> >> > refactoring?
> >>
> >> If the drm tree includes -rc3, you can carry these. If you don't want
> >> to carry these and want the timer tree to carry them, we can do that
> >> too.
> >
> > Applied to drm-misc-next for 4.16 (we're way past freeze for 4.15
> > already).
> 
> Since this is one of the few remaining "non-trivial" users of the
> ancient init_timer() API, would you mind if the timers tree carried
> this for 4.15? I'm trying to entirely remove the init_timer() API (and
> if I can, remove the old setup_*timer() API too).

I was contemplating before applying it whether I should ask ...

Oh well, problem is that drm-misc is non-rebasing, but you can just apply
it twice. git usually figures it out.

Acked-by: Daniel Vetter 

in case you do so.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103486] Tonga DC vblank_mode=0 not working as expected fullscreen

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

--- Comment #7 from Michel Dänzer  ---
FWIW, I've been testing with glxgears, either

 glxgears -fullscreen

or making the window fullscreen manually. This may not work depending on the
window manager, I'm using xfwm4 with compositing disabled for testing.

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


Re: [PATCH v2 hwc] drm_hwcomposer: provide a common gralloc handle definition

2017-11-01 Thread Daniel Vetter
On Tue, Oct 31, 2017 at 04:10:52PM -0500, Rob Herring wrote:
> On Tue, Oct 31, 2017 at 11:44 AM, Daniel Vetter  wrote:
> > On Tue, Oct 31, 2017 at 09:59:20AM -0500, Rob Herring wrote:
> >> EGL, gralloc, and HWC must all have a common definition of fd's and int's
> >> in native_handle_t to share the fd and width, height, format, etc. of a
> >> dmabuf.
> 
> [...]
> 
> >> +#define GRALLOC_HANDLE_MAGIC 0x5f47424d
> >
> > Maybe add a
> >
> > #define GRALLOC_HANDLE_VERSION 1
> > #define GRALLOC_HANDLE_MAGIC (0x5f47424d + GRALLOC_HANDLE_VERSION)
> >
> > and a comment that the version needs to be incremented for every change,
> > to catch mismatching mesa/hwc versions? Given the layout there's no way to
> > add more fds in a backwards-compatible way, so we need full versioning I
> > think, and treat any change as a breaking one.
> 
> If we add or remove anything that will already be caught because sizes
> are stored and checked.
> 
> The magic corresponds to 'GBM_'. Maybe we want to change that to
> something else. However, I'd like to not change it just yet. My
> intention was to keep it compatible, update gbm_gralloc and mesa
> dependencies, then make any changes to this struct.

Hm, start out with version 0 then, to match? Anyway, was just a
suggestion, feel free to ignore :-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [PATCH v2 2/2] Test case for drm_vblank_cleanup refcount validation patch

2017-11-01 Thread Daniel Vetter
On Wed, Nov 01, 2017 at 09:48:28AM +0530, PrasannaKumar Muralidharan wrote:
> Hi Daniel,
> 
> On 31 October 2017 at 21:57, Daniel Vetter  wrote:
> > On Tue, Oct 31, 2017 at 08:37:21PM +0530, PrasannaKumar Muralidharan wrote:
> >> My patch is supposed to catch problem with drivers. It warns when
> >> vblank refcount is non-zero in drm_vblank_cleanup call. From CI log it
> >> can be seen that warning being triggered. I feel that my patch is
> >> exposing existing issue.
> >>
> >> If I misinterpreted something please let me know.
> >
> > This is probably what's happening, but I can't merge a patch that breaks
> > CI. So we need to track down that issue before merging.
> 
> I understand. Being new to DRM subsystem I don't know if I can
> contribute in finding the issue. I would be able to help if I could
> get some guidance.

If you have an intel laptop anywhere at hand that you could use to
reproduce the issue, that would be a good start.

Then go through the setup for the kms/drm validation suite:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#testing-and-validation

That should allow you to locally reproduce the issue (it seems to affect
many machines, so I'd assume it doesn't matter which one you have).

Once you can reproduce it should be doable to figure out where we leak
this reference (but usually it's a bit of hard work).

Btw I discussed your patch a bit on irc, a first step would be to also
print the refcount when it's leaked, not just warn about it. Knowing how
many references are leaked is sometimes a good hint about what's going on.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: RFC: Add drm_dev_suspend/resume() ?

2017-11-01 Thread Daniel Vetter
On Tue, Oct 31, 2017 at 05:37:23PM +0100, Noralf Trønnes wrote:
> 
> Den 30.10.2017 10.34, skrev Daniel Vetter:
> > Hi Noralf,
> > 
> > On Sun, Oct 22, 2017 at 06:52:41PM +0200, Noralf Trønnes wrote:
> > > Hi,
> > > 
> > > I've spent some time in the fbdev emulation code and discovered a
> > > recurring pattern around suspend/resume.
> > > Should we add some more helpers :-)
> > You're maybe a bit too good at spotting these for your own good :-)
> > 
> > But yeah, a "suspend for dummies" is one of the things which would be nice
> > I think ... Especially since we now have the atomic suspend/resume
> > helpers.
> > 
> > > struct drm_device {
> > >      /**
> > >       * @suspend_state:
> > >       *
> > >       * Atomic state when suspended.
> > >       * Set by drm_dev_suspend(), cleared by drm_dev_resume().
> > >       */
> > >      struct drm_atomic_state *suspend_state;
> > > };
> > Imo fits better when we put it into drm_mode_config.
> > 
> > > int drm_dev_suspend(struct drm_device *dev)
> > > {
> > >      struct drm_atomic_state *state;
> > > 
> > >      if (!dev)
> > >          return 0;
> > > 
> > >      drm_kms_helper_poll_disable(dev);
> > >      drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
> > >      state = drm_atomic_helper_suspend(dev);
> > >      if (IS_ERR(state)) {
> > >          drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
> > >          drm_kms_helper_poll_enable(dev);
> > >          return PTR_ERR(state);
> > >      }
> > > 
> > >      dev->suspend_state = state;
> > > 
> > >      return 0;
> > > }
> > This is all about suspending the modeset side ... I'd give it a
> > drm_mode_config prefix instead of the drm_dev_ (that's maybe a bit too
> > generic), but then maybe type a general suspend/resume kernel-doc text in
> > the drm-internals.rst (maybe pulled in from drm_dev.c) which references
> > these 2 functions as the recommended way to suspend/resume the modeset
> > side of a driver. These won't suspend/resume a render part (if present),
> > so drm_dev_ seems a bit too much.
> 
> I just realised that this is pulling helpers (atomic, crtc, fbdev) into
> the core which IIRC is something that you didn't want?

Ugh right. I think starting a new drm_mode_config_helper.c for top-level
helper stuff would be a reasonable solution. Or some other name if you
have a better one.
-Daniel

> 
> 
> diff --git a/drivers/gpu/drm/drm_mode_config.c
> b/drivers/gpu/drm/drm_mode_config.c
> index 74f6ff5df656..72f8fe1e83cb 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -20,7 +20,10 @@
>   * OF THIS SOFTWARE.
>   */
> 
> +#include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
> 
> @@ -473,3 +476,49 @@ void drm_mode_config_cleanup(struct drm_device *dev)
> drm_modeset_lock_fini(>mode_config.connection_mutex);
>  }
>  EXPORT_SYMBOL(drm_mode_config_cleanup);
> +
> +/**
> + * drm_mode_config_suspend
> + * @dev: DRM device
> + *
> + */
> +int drm_mode_config_suspend(struct drm_device *dev)
> +{
> +   struct drm_atomic_state *state;
> +
> +   if (!dev)
> +   return 0;
> +
> +   drm_kms_helper_poll_disable(dev);
> +   drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
> +   state = drm_atomic_helper_suspend(dev);
> +   if (IS_ERR(state)) {
> + drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
> +   drm_kms_helper_poll_enable(dev);
> +   return PTR_ERR(state);
> +   }
> +
> +   dev->mode_config.suspend_state = state;
> +
> +   return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_config_suspend);
> +
> +int drm_mode_config_resume(struct drm_device *dev)
> +{
> +   int ret;
> +
> +   if (!dev || WARN_ON(!dev->mode_config.suspend_state))
> +   return 0;
> +
> +   ret = drm_atomic_helper_resume(dev, dev->mode_config.suspend_state);
> +   if (ret)
> +   DRM_ERROR("Failed to resume (%d)\n", ret);
> +   dev->mode_config.suspend_state = NULL;
> +
> +   drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
> +   drm_kms_helper_poll_enable(dev);
> +
> +   return 0;
> +}
> +EXPORT_SYMBOL(drm_mode_config_resume);
> diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
> index 1b37368416c8..86ef327a996d 100644
> --- a/include/drm/drm_mode_config.h
> +++ b/include/drm/drm_mode_config.h
> @@ -766,11 +766,21 @@ struct drm_mode_config {
>     /* cursor size */
>     uint32_t cursor_width, cursor_height;
> 
> +   /**
> +    * @suspend_state:
> +    *
> +    * Atomic state when suspended. Set by drm_mode_config_suspend(),
> +    * cleared by drm_mode_config_resume().
> +    */
> +   struct drm_atomic_state *suspend_state;
> +
>     const struct drm_mode_config_helper_funcs *helper_private;
>  };
> 
>  void drm_mode_config_init(struct drm_device *dev);
>  void drm_mode_config_reset(struct drm_device *dev);
>  void drm_mode_config_cleanup(struct drm_device *dev);
> 

[PATCH 1/2] drm/i915: Reject unknown syncobj flags

2017-11-01 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

We have to reject unknown flags for uAPI considerations, and also
because the curent implementation limits their i915 storage space
to two bits.

v2: (Chris Wilson)
 * Fix fail in ABI check.
 * Added unknown flags and BUILD_BUG_ON.

v3:
 * Use ARCH_KMALLOC_MINALIGN instead of alignof. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin 
Fixes: cf6e7bac6357 ("drm/i915: Add support for drm syncobjs")
Cc: Jason Ekstrand 
Cc: Chris Wilson 
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: David Airlie 
Cc: intel-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 
 include/uapi/drm/i915_drm.h| 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3d7190764f10..a53be7d01055 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
goto err;
}
 
+   if (fence.flags & __I915_EXEC_FENCE_UNKNOWN_FLAGS) {
+   err = -EINVAL;
+   goto err;
+   }
+
syncobj = drm_syncobj_find(file, fence.handle);
if (!syncobj) {
DRM_DEBUG("Invalid syncobj handle provided\n");
@@ -2107,6 +2112,9 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args,
goto err;
}
 
+   BUILD_BUG_ON(~(ARCH_KMALLOC_MINALIGN - 1) &
+~__I915_EXEC_FENCE_UNKNOWN_FLAGS);
+
fences[n] = ptr_pack_bits(syncobj, fence.flags, 2);
}
 
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 125bde7d9504..ac3c6503ca27 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -839,6 +839,7 @@ struct drm_i915_gem_exec_fence {
 
 #define I915_EXEC_FENCE_WAIT(1<<0)
 #define I915_EXEC_FENCE_SIGNAL  (1<<1)
+#define __I915_EXEC_FENCE_UNKNOWN_FLAGS (-(I915_EXEC_FENCE_SIGNAL << 1))
__u32 flags;
 };
 
-- 
2.9.5

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


  1   2   >