Re: [PATCH 0/9] drm/syncobj: Add full-featured wait support (v2)

2017-08-13 Thread Jason Ekstrand

On August 13, 2017 4:14:45 PM Jason Ekstrand  wrote:


On August 13, 2017 8:52:21 AM Christian König  wrote:


Am 13.08.2017 um 17:26 schrieb Jason Ekstrand:

On August 13, 2017 6:19:53 AM Christian König
 wrote:


Patches #1-#4 are Acked-by: Christian König .

Patch #5: NAK, that will break radeon.

On radeon we need the non-default wait or otherwise we can run into a
situation where we never signal a fence.

The general question is why do you need this?


Because i915 sets a non-default wait function so calling wait_any just
bails with fences from i915 immediately bails with -EINVAL. This makes
it work even with non-default waits.


Ok well, let me refine the question: Why does i915 sets a non-default
wait function?


I have no idea.


In radeon we have it because we need to handle 10+ years of different
hardware generation, each which a bunch of separate bugs in their fence
handling (and some even not solved by today).


So how does wait_any returning -EINVAL for non-default waits help radeon?


Patch #6: Yes, please. Patch is Reviewed-by: Christian König
.

Patch #7: Already gave my rb on the patch Chris send out earlier.

Patch #8: NAK to the whole approach.

IIRC we discussed a very similar thing during the initial fence bringup
and also during the fence_array development.

The problem is that you can easily build ring dependencies and so
deadlocks with it.

I would really prefer an approach which is completely contained inside
the syncobj code base.


Are you use to the approach of internally making a proxy so long as
all the proxy code is inside syncobj?

Yes, that would be a start.

In general if possible I would rather like to avoid the whole handling
with the proxy/callback altogether, but that possible only works with
wait for any if the waitqueue is global and that wouldn't be ideal either.


I'm happy to get rid of the proxies.  They did work nicely but I'm not
really attached to them


Is also be happy to go back to the original approach with v3 of the
last patch.

v3 looked like it should work as well, I would just drop abusing the
fence callback structure for the signaling.

Ideally we would finally come up with an interface to wait for multiple
waitqueue at the same time, but that probably goes a bit to far.

For now just use a single linked list to start all processes waiting for
a fence to arrive or something like this.


I don't really know what you're suggesting.  Patch v3 has a single
waitqueue per process.  Are you suggesting one per fence?


I apologize for my plethora of questions.  I'm still very new to this stuff 
and don't know what all is out there.



--Jason


Regards,
Christian.




Regards,
Christian.

Am 12.08.2017 um 00:39 schrieb Jason Ekstrand:

This series does the same thing as my earlier series in that it adds
a sync
object wait interface complete with WAIT_FOR_SUBMIT flag. While the
uapi
remains unchanged, the guts look a bit different.  Instead of adding a
callback mechanism to drm_syncobj that fired whenever replace_fence was
called, it's now using proxy fences.  The drm_syncobj_fence_get still
returns NULL whenever the sync object is in an unsubmitted state but
there
is a new drm_syncobj_fence_proxy_get which returns either the real
fence or
a proxy fence that will be triggered the next time replace_fence is
called
with a non-NULL replacement.  This does make both
drm_syncobj_fence_get and
drm_syncobj_replace_fence a tiny bit more expensive, but it lets us
do it
all without locking.

This series can be found as a branch here:

https://cgit.freedesktop.org/~jekstrand/linux/log/?h=drm-syncobj-wait-submit-v4


IGT tests for DRM_IOCTL_SYNCOBJ_WAIT and DRM_IOCTL_SYNCOBJ_RESET can be
found on patchwork here:

https://patchwork.freedesktop.org/series/28666/

Patches to the Intel Vulkan driver to implement
VK_KHR_external_fence on
top of this kernel interface can be found here:

https://cgit.freedesktop.org/~jekstrand/mesa/log/?h=wip/anv-external-fence


Cc: Dave Airlie 
Cc: Chris Wilson 
Cc: Christian König 

Chris Wilson (2):
   dma-buf/dma-fence: Signal all callbacks from dma_fence_release()
   dma-buf/dma-fence: Add a mechanism for proxy fences

Dave Airlie (1):
   drm/syncobj: add sync obj wait interface. (v8)

Jason Ekstrand (6):
   drm/syncobj: Rename fence_get to find_fence
   drm/syncobj: Add a race-free drm_syncobj_fence_get helper
   i915: Add support for drm syncobjs
   dma-buf/dma-fence: Allow wait_any_timeout without default_wait (v2)
   drm/syncobj: Add a reset ioctl
   drm/syncobj: Allow wait for submit and signal behavior (v4)

  drivers/dma-buf/Makefile   |   4 +-
  drivers/dma-buf/dma-fence-proxy.c  | 186 +++
  drivers/dma-buf/dma-fence.c|  34 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |   2 

Re: [PATCH 3/3] drm/rockchip: Add support for Rockchip Soc LVDS

2017-08-13 Thread Sandy Huang



在 2017/8/11 22:44, Sean Paul 写道:

On Fri, Aug 11, 2017 at 10:15:16AM +0800, Sandy Huang wrote:



在 2017/8/11 2:05, Sean Paul 写道:

On Thu, Aug 10, 2017 at 05:35:52PM +0800, Sandy Huang wrote:

Hi Sean Paul,
  Thanks for your review.

在 2017/8/10 3:58, Sean Paul 写道:

On Wed, Aug 09, 2017 at 06:00:59PM +0800, Sandy Huang wrote:

This adds support for Rockchip soc lvds found on rk3288
Based on the patches from Mark yao and Heiko Stuebner

Signed-off-by: Sandy Huang 
Signed-off-by: Mark yao 
Signed-off-by: Heiko Stuebner 
---
drivers/gpu/drm/rockchip/Kconfig |   9 +
drivers/gpu/drm/rockchip/Makefile|   1 +
drivers/gpu/drm/rockchip/rockchip_lvds.c | 734 
+++
drivers/gpu/drm/rockchip/rockchip_lvds.h | 112 +
4 files changed, 856 insertions(+)
create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h






diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
new file mode 100644
index 000..a4ad3f0
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c





+   lvds->drm_dev = drm_dev;
+   port = of_graph_get_port_by_id(dev->of_node, 1);
+   if (!port) {
+   dev_err(dev, "can't found port point, please init lvds panel 
port!\n");
+   return -EINVAL;
+   }
+
+   for_each_child_of_node(port, endpoint) {
+   remote = of_graph_get_remote_port_parent(endpoint);
+   if (!remote) {
+   dev_err(dev, "can't found panel node, please init!\n");
+   ret = -EINVAL;
+   goto err_put_port;
+   }
+   if (!of_device_is_available(remote)) {
+   of_node_put(remote);
+   remote = NULL;
+   continue;
+   }
+   break;
+   }
+   if (!remote) {
+   dev_err(dev, "can't found remote node, please init!\n");
+   ret = -EINVAL;
+   goto err_put_port;
+   }
+
+   lvds->panel = of_drm_find_panel(remote);
+   if (!lvds->panel)
+   lvds->bridge = of_drm_find_bridge(remote);


drm_of_find_panel_or_bridge()



because the lvds ports maybe connect to lvds-panel or connect to
rk1000(which is convert RGB to CVBS output), so i have to get the remote
port parent and check the status, and final get the active remote point.






lvds_panel: lvds-panel {
status = "disabled";
ports {
panel_in_lvds: endpoint {
remote-endpoint = <_out_panel>;
};
};
};

rk1000: rk1000@0xff00 {
status = "okay";
ports {
rk1000_in_lvds: endpoint {
remote-endpoint = <_out_panel>;
};
};
};

 {
status = "okay";
ports {
lvds_out: port@1 {
reg = <1>;
lvds_out_panel: endpoint@0 {
reg = <0>;
remote-endpoint = <_in_lvds>;
};
lvds_out_rk1000: endpoint@1 {
reg = <1>;
remote-endpoint = <_in_lvds>;
};
};

};
};


Hi Sandy,
Forgive me, this is probably a stupid question. I don't see how this usecase is
unique from the other users of drm_of_find_panel_or_bridge. Couldn't you change
your devicetree bindings to conform to something drm_of_find_panel_or_bridge()
can work with?

Thank you,


Hi sean,
 Maybe i can use the following method to use
drm_of_find_panel_or_bridge() and no need to change my DT, but there is
another question:
 The LVDS output format(rockchip,output、rockchip,data-mapping etc.)
depend on different panel, so it should be put under remote panel point.
If use drm_of_find_panel_or_bridge(), this just return panel or bridge, so
i have to back to get remote panel point and get the output format.


This should be easy since you can grab dev->of_node from panel or bridge once
it's found.


ok, thanks.


ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, >panel,
   >bridge);
if (ret)
 ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 1, >panel,
   >bridge);


Would be easier to read in a for loop.

Sean


ok, thanks.


if (ret) {
 DRM_DEV_ERROR(dev, "failed to find panel and bridge node\n");
 ret  = -EPROBE_DEFER;
 goto err_put_remote;
}






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


[Bug 102184] Logs flooded with [drm:drm_mode_addfb2 [drm]] messages

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102184

Michel Dänzer  changed:

   What|Removed |Added

 Resolution|--- |INVALID
 Status|NEW |RESOLVED

--- Comment #1 from Michel Dänzer  ---
This happens because you set drm.debug=0xe on the kernel command line. Just
remove that.

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


Re: [PATCH 3/9] i915: Add support for drm syncobjs

2017-08-13 Thread Jason Ekstrand
We now have reviewed userspace for this:

https://lists.freedesktop.org/archives/mesa-dev/2017-August/166200.html

On Fri, Aug 11, 2017 at 3:39 PM, Jason Ekstrand 
wrote:

> This commit adds support for waiting on or signaling DRM syncobjs as
> part of execbuf.  It does so by hijacking the currently unused cliprects
> pointer to instead point to an array of i915_gem_exec_fence structs
> which containe a DRM syncobj and a flags parameter which specifies
> whether to wait on it or to signal it.  This implementation
> theoretically allows for both flags to be set in which case it waits on
> the dma_fence that was in the syncobj and then immediately replaces it
> with the dma_fence from the current execbuf.
>
> v2:
>  - Rebase on new syncobj API
> v3:
>  - Pull everything out into helpers
>  - Do all allocation in gem_execbuffer2
>  - Pack the flags in the bottom 2 bits of the drm_syncobj*
> v4:
>  - Prevent a potential race on syncobj->fence
>
> Testcase: igt/gem_exec_fence/syncobj*
> Signed-off-by: Jason Ekstrand 
> Reviewed-by: Chris Wilson 
> Signed-off-by: Chris Wilson 
> ---
>  drivers/gpu/drm/i915/i915_drv.c|   3 +-
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 146
> -
>  include/uapi/drm/i915_drm.h|  30 +-
>  3 files changed, 171 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_
> drv.c
> index 4c96a72..50db490 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -388,6 +388,7 @@ static int i915_getparam(struct drm_device *dev, void
> *data,
> case I915_PARAM_HAS_EXEC_FENCE:
> case I915_PARAM_HAS_EXEC_CAPTURE:
> case I915_PARAM_HAS_EXEC_BATCH_FIRST:
> +   case I915_PARAM_HAS_EXEC_FENCE_ARRAY:
> /* For the time being all of these are always true;
>  * if some supported hardware does not have one of these
>  * features this value needs to be provided from
> @@ -2738,7 +2739,7 @@ static struct drm_driver driver = {
>  */
> .driver_features =
> DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
> DRIVER_PRIME |
> -   DRIVER_RENDER | DRIVER_MODESET | DRIVER_ATOMIC,
> +   DRIVER_RENDER | DRIVER_MODESET | DRIVER_ATOMIC |
> DRIVER_SYNCOBJ,
> .release = i915_driver_release,
> .open = i915_driver_open,
> .lastclose = i915_driver_lastclose,
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 929f275..8df845b 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -33,6 +33,7 @@
>
>  #include 
>  #include 
> +#include 
>
>  #include "i915_drv.h"
>  #include "i915_gem_clflush.h"
> @@ -1882,8 +1883,10 @@ static bool i915_gem_check_execbuffer(struct
> drm_i915_gem_execbuffer2 *exec)
> return false;
>
> /* Kernel clipping was a DRI1 misfeature */
> -   if (exec->num_cliprects || exec->cliprects_ptr)
> -   return false;
> +   if (!(exec->flags & I915_EXEC_FENCE_ARRAY)) {
> +   if (exec->num_cliprects || exec->cliprects_ptr)
> +   return false;
> +   }
>
> if (exec->DR4 == 0x) {
> DRM_DEBUG("UXA submitting garbage DR4, fixing up\n");
> @@ -2114,11 +2117,125 @@ eb_select_engine(struct drm_i915_private
> *dev_priv,
> return engine;
>  }
>
> +static void __free_fence_array(struct drm_syncobj **fences, unsigned int
> n)
> +{
> +   while (n--)
> +   drm_syncobj_put(ptr_mask_bits(fences[n], 2));
> +   kvfree(fences);
> +}
> +
> +static struct drm_syncobj **get_fence_array(struct
> drm_i915_gem_execbuffer2 *args,
> +   struct drm_file *file)
> +{
> +   const unsigned int nfences = args->num_cliprects;
> +   struct drm_i915_gem_exec_fence __user *user;
> +   struct drm_syncobj **fences;
> +   unsigned int n;
> +   int err;
> +
> +   if (!(args->flags & I915_EXEC_FENCE_ARRAY))
> +   return NULL;
> +
> +   if (nfences > SIZE_MAX / sizeof(*fences))
> +   return ERR_PTR(-EINVAL);
> +
> +   user = u64_to_user_ptr(args->cliprects_ptr);
> +   if (!access_ok(VERIFY_READ, user, nfences * 2 * sizeof(u32)))
> +   return ERR_PTR(-EFAULT);
> +
> +   fences = kvmalloc_array(args->num_cliprects, sizeof(*fences),
> +   __GFP_NOWARN | GFP_TEMPORARY);
> +   if (!fences)
> +   return ERR_PTR(-ENOMEM);
> +
> +   for (n = 0; n < nfences; n++) {
> +   struct drm_i915_gem_exec_fence fence;
> +   struct drm_syncobj *syncobj;
> +
> +   if (__copy_from_user(, user++, sizeof(fence))) {
> +   

Re: [PATCH] drm/tegra: Prevent BOs from being freed during job submission

2017-08-13 Thread Dmitry Osipenko
On 11.08.2017 20:59, Thierry Reding wrote:
> From: Dmitry Osipenko 
> 
> Since DRM IOCTL's are lockless, there is a chance that BOs could be
> released while a job submission is in progress. To avoid that, keep the
> GEM reference until the job has been pinned, part of which will be to
> take another reference.
> 
> Signed-off-by: Dmitry Osipenko 
> Signed-off-by: Thierry Reding 
> ---
>  drivers/gpu/drm/tegra/drm.c | 42 +-
>  1 file changed, 33 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index f01db33fa20f..e5d19e1c9bc8 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -320,8 +320,6 @@ host1x_bo_lookup(struct drm_file *file, u32 handle)
>   if (!gem)
>   return NULL;
>  
> - drm_gem_object_unreference_unlocked(gem);
> -
>   bo = to_tegra_bo(gem);
>   return >base;
>  }
> @@ -410,8 +408,10 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>   (void __user *)(uintptr_t)args->waitchks;
>   struct drm_tegra_syncpt syncpt;
>   struct host1x *host1x = dev_get_drvdata(drm->dev->parent);
> + struct drm_gem_object **refs;

Should be "**refs = NULL" in conjunction with a missed kfree() below.

>   struct host1x_syncpt *sp;
>   struct host1x_job *job;
> + unsigned int num_refs;
>   int err;
>  
>   /* We don't yet support other than one syncpt_incr struct per submit */
> @@ -433,6 +433,26 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>   job->class = context->client->base.class;
>   job->serialize = true;
>  
> + /*
> +  * Track referenced BOs so that they can be unreferenced after the
> +  * submission is complete.
> +  */
> + num_refs = num_cmdbufs + num_relocs * 2 + num_waitchks;
> +
> + if (sizeof(*refs) * num_refs > ULONG_MAX) {
> + err = -EINVAL;
> + goto fail;
> + }
> +
> + refs = kmalloc_array(num_refs, sizeof(*refs), GFP_KERNEL);
> + if (!refs) {
> + err = -ENOMEM;
> + goto fail;
> + }
> +
> + /* reuse as an iterator later */
> + num_refs = 0;
> +
>   while (num_cmdbufs) {
>   struct drm_tegra_cmdbuf cmdbuf;
>   struct host1x_bo *bo;
> @@ -461,6 +481,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>  
>   offset = (u64)cmdbuf.offset + (u64)cmdbuf.words * sizeof(u32);
>   obj = host1x_to_tegra_bo(bo);
> + refs[num_refs++] = >gem;
>  
>   /*
>* Gather buffer base address must be 4-bytes aligned,
> @@ -490,6 +511,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>  
>   reloc = >relocarray[num_relocs];
>   obj = host1x_to_tegra_bo(reloc->cmdbuf.bo);
> + refs[num_refs++] = >gem;
>  
>   /*
>* The unaligned cmdbuf offset will cause an unaligned write
> @@ -503,6 +525,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>   }
>  
>   obj = host1x_to_tegra_bo(reloc->target.bo);
> + refs[num_refs++] = >gem;
>  
>   if (reloc->target.offset >= obj->gem.size) {
>   err = -EINVAL;
> @@ -522,6 +545,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>   goto fail;
>  
>   obj = host1x_to_tegra_bo(wait->bo);
> + refs[num_refs++] = >gem;
>  
>   /*
>* The unaligned offset will cause an unaligned write during
> @@ -561,17 +585,17 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>   goto fail;
>  
>   err = host1x_job_submit(job);
> - if (err)
> - goto fail_submit;
> + if (err) {
> + host1x_job_unpin(job);
> + goto fail;
> + }
>  
>   args->fence = job->syncpt_end;
>  
> - host1x_job_put(job);
> - return 0;
> -
> -fail_submit:
> - host1x_job_unpin(job);
>  fail:
> + while (num_refs--)
> + drm_gem_object_put_unlocked(refs[num_refs]);
> +

kfree(refs) is missed here.

>   host1x_job_put(job);
>   return err;
>  }
> 


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


Re: [PATCH] drm/tegra: Prevent BOs from being freed during job submission

2017-08-13 Thread Dmitry Osipenko
On 11.08.2017 21:16, Dmitry Osipenko wrote:
> On 11.08.2017 20:59, Thierry Reding wrote:
>> From: Dmitry Osipenko 
>>
>> Since DRM IOCTL's are lockless, there is a chance that BOs could be
>> released while a job submission is in progress. To avoid that, keep the
>> GEM reference until the job has been pinned, part of which will be to
>> take another reference.
>>
>> Signed-off-by: Dmitry Osipenko 
>> Signed-off-by: Thierry Reding 
>> ---
>>  drivers/gpu/drm/tegra/drm.c | 42 +-
>>  1 file changed, 33 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
>> index f01db33fa20f..e5d19e1c9bc8 100644
>> --- a/drivers/gpu/drm/tegra/drm.c
>> +++ b/drivers/gpu/drm/tegra/drm.c
>> @@ -320,8 +320,6 @@ host1x_bo_lookup(struct drm_file *file, u32 handle)
>>  if (!gem)
>>  return NULL;
>>  
>> -drm_gem_object_unreference_unlocked(gem);
>> -
>>  bo = to_tegra_bo(gem);
>>  return >base;
>>  }
>> @@ -410,8 +408,10 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>>  (void __user *)(uintptr_t)args->waitchks;
>>  struct drm_tegra_syncpt syncpt;
>>  struct host1x *host1x = dev_get_drvdata(drm->dev->parent);
>> +struct drm_gem_object **refs;
>>  struct host1x_syncpt *sp;
>>  struct host1x_job *job;
>> +unsigned int num_refs;
>>  int err;
>>  
>>  /* We don't yet support other than one syncpt_incr struct per submit */
>> @@ -433,6 +433,26 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>>  job->class = context->client->base.class;
>>  job->serialize = true;
>>  
>> +/*
>> + * Track referenced BOs so that they can be unreferenced after the
>> + * submission is complete.
>> + */
>> +num_refs = num_cmdbufs + num_relocs * 2 + num_waitchks;
>> +
>> +if (sizeof(*refs) * num_refs > ULONG_MAX) {
> 
> Thierry, since you've omitted (u64) here (comparing to the original patch), I
> think it should be better to write as:
> 
>   if (num_refs > ULONG_MAX / sizeof(*refs)) {
> 
> To avoid integer overflow in the check.
> 

Moreover, this check isn't needed at all because it duplicates same checking
done by kmalloc_array().

>> +err = -EINVAL;
>> +goto fail;
>> +}
>> +
>> +refs = kmalloc_array(num_refs, sizeof(*refs), GFP_KERNEL);
>> +if (!refs) {
>> +err = -ENOMEM;
>> +goto fail;
>> +}
>> +
>> +/* reuse as an iterator later */
>> +num_refs = 0;
>> +
>>  while (num_cmdbufs) {
>>  struct drm_tegra_cmdbuf cmdbuf;
>>  struct host1x_bo *bo;
>> @@ -461,6 +481,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>>  
>>  offset = (u64)cmdbuf.offset + (u64)cmdbuf.words * sizeof(u32);
>>  obj = host1x_to_tegra_bo(bo);
>> +refs[num_refs++] = >gem;
>>  
>>  /*
>>   * Gather buffer base address must be 4-bytes aligned,
>> @@ -490,6 +511,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>>  
>>  reloc = >relocarray[num_relocs];
>>  obj = host1x_to_tegra_bo(reloc->cmdbuf.bo);
>> +refs[num_refs++] = >gem;
>>  
>>  /*
>>   * The unaligned cmdbuf offset will cause an unaligned write
>> @@ -503,6 +525,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>>  }
>>  
>>  obj = host1x_to_tegra_bo(reloc->target.bo);
>> +refs[num_refs++] = >gem;
>>  
>>  if (reloc->target.offset >= obj->gem.size) {
>>  err = -EINVAL;
>> @@ -522,6 +545,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>>  goto fail;
>>  
>>  obj = host1x_to_tegra_bo(wait->bo);
>> +refs[num_refs++] = >gem;
>>  
>>  /*
>>   * The unaligned offset will cause an unaligned write during
>> @@ -561,17 +585,17 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>>  goto fail;
>>  
>>  err = host1x_job_submit(job);
>> -if (err)
>> -goto fail_submit;
>> +if (err) {
>> +host1x_job_unpin(job);
>> +goto fail;
>> +}
>>  
>>  args->fence = job->syncpt_end;
>>  
>> -host1x_job_put(job);
>> -return 0;
>> -
>> -fail_submit:
>> -host1x_job_unpin(job);
>>  fail:
>> +while (num_refs--)
>> +drm_gem_object_put_unlocked(refs[num_refs]);
>> +
>>  host1x_job_put(job);
>>  return err;
>>  }
>>
> 
> 


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


[Bug 101731] System freeze with AMDGPU when playing The Witcher 3

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101731

--- Comment #29 from Shmerl  ---
(In reply to Samuel Pitoiset from comment #27)
> An apitrace that reproduces the issue would be very useful.

See the trace here: https://ufile.io/i6czx

It's using Wine 2.14 with these patches: dark ground patch and:

ntdll-Grow_Virtual_Heap wined3d-buffer_create wined3d-sample_c_lz
wined3d-Copy_Resource_Typeless xaudio2-get_al_format

And commented out portion that checks for GLX_OML_sync_control (as per
recommendation from Józef Kucia in the wine bug, since apitrace chokes on
GLX_OML_sync_control).

However, while it freezes the system when the game is run on its own in the
above configuration, when it's being traced, the freeze doesn't happen.

Anyway, this will probably be of interest to find some issue in Mesa / amdgpu,
but otherwise, I figured out that the freeze is gone if Wine is built skipping
this patchset: wined3d-Copy_Resource_Typeless.

-- 
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 102203] Using hardware video encoding with amdgpu/vaapi crashes system immediately

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102203

Bug ID: 102203
   Summary: Using hardware video encoding with amdgpu/vaapi
crashes system immediately
   Product: DRI
   Version: DRI git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: jb5sgc1n@20mm.eu

I tried using hardware video encoding with amdgpu/vaapi, but every attempt
immediately crashes the system.

The latest command line (amongst many with the same crash result) I tried:

ffmpeg -vaapi_device /dev/dri/renderD128 -t 10 -i somevideo.mp4 -vf
'scale=1920:1072,hwupload' -aspect 1920:1072 -map 0:0 -y -c:a copy -threads 1
-slices 1 -vcodec h264_vaapi -b:v 12500k -profile:v 77 -bf 0 test.mkv

ffmpeg/libva/mesa/dri etc. are the most recent ones currently shipped with Arch
Linux (ffmpeg version 3.3.3 built with gcc 7.1.1).

I am currently using
https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next as my
kernel, but experienced the same error also with previous kernel versions (like
4.12)

Video card is a Radeon RX 460.

-- 
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 100964] RX-480 [drm:gfx_v8_0_ring_test_ring [amdgpu]] *ERROR* amdgpu: ring 0 test failed (scratch(0xC040)=0xCAFEDEAD)

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100964

Maxim Cournoyer  changed:

   What|Removed |Added

 CC||maxim.courno...@gmail.com

--- Comment #11 from Maxim Cournoyer  ---
Created attachment 133478
  --> https://bugs.freedesktop.org/attachment.cgi?id=133478=edit
dmesg failed init with 4.13.0-rc4

Failure to initialize a R9 285 on Asus M2N Sli Deluxe motherboard with
4.13.0-rc4 kernel.

-- 
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 100375] forced EDID's can cause a amdgpu to null ptr deref

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100375

--- Comment #6 from dwagner  ---
(I filed bug https://bugs.freedesktop.org/show_bug.cgi?id=102202 on what might
be a related issue.)

-- 
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 100964] RX-480 [drm:gfx_v8_0_ring_test_ring [amdgpu]] *ERROR* amdgpu: ring 0 test failed (scratch(0xC040)=0xCAFEDEAD)

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=100964

--- Comment #10 from Maxim Cournoyer  ---
A few more data points. None of the 'vanilla' kernel could initialize the R9
285 (tonga 1.2) card on this Asus M2N SLI Deluxe card (remember that the same
card works easily on an Asus P5W DH Deluxe based system).

I've tried building the following kernels (reusing the Debian 9 stable 4.9.0
kernel config as a starting point) and booted them, but I would always get a
CAFEDEAD error:

* 4.11.0 from stretch-backports (didn't need to build this one)
* 4.12.7 from kernel.org
* 4.13.0-rc4-1 from kernel.org

None of them worked. So my only success so far is with the drm-next-4.14-wip
branch from git://people.freedesktop.org/~agd5f/linux.

I've included the dmesg I get when booting off the 4.13.0-rc4 kernel, it has
new error output talking about powerplay:

[5.514767] amdgpu: [powerplay] 
failed to send message 254 ret is 0 
[5.514793] amdgpu: [powerplay] Can't find requested voltage id in
vdd_dep_on_sclk table!
[5.515491] amdgpu: [powerplay] Invalid VDDGFX value!
[5.515491] amdgpu: [powerplay] Get EVV Voltage Failed.  Abort Driver
loading!
[5.515493] amdgpu: [powerplay] amdgpu: powerplay initialization failed
[5.703544] [drm:gfx_v8_0_ring_test_ring [amdgpu]] *ERROR* amdgpu: ring 0
test failed (scratch(0xC040)=0xCAFEDEAD)
[5.703601] [drm:amdgpu_device_init [amdgpu]] *ERROR* hw_init of IP block
 failed -22
[5.703630] amdgpu :03:00.0: amdgpu_init failed

-- 
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 102201] [regression, SI] GPU crash in Unigine Valley

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102201

Bug ID: 102201
   Summary: [regression, SI] GPU crash in Unigine Valley
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: gr.mue...@gmail.com
QA Contact: dri-devel@lists.freedesktop.org

Created attachment 133476
  --> https://bugs.freedesktop.org/attachment.cgi?id=133476=edit
dmesg crash log

I get random GPU lockups in Unigine Valley. Sometimes it happens at Test 5 and
sometimes in Test 9. Basically the screen is freezing but music continues
playing. After sometime there is only noise on the screen. The performance went
also down, I saw 57 fps in Test 1 and now only 54 fps.
I also experience something similar during playing Shadow Warrior, in the
Prologue mission, GPU hangs forever.

Bisected this to:
064550238ef0b44e341b2a50c3147f83c2a6d5b0 is the first bad commit
commit 064550238ef0b44e341b2a50c3147f83c2a6d5b0
Author: Marek Olšák 
Date:   Thu Jul 27 02:40:34 2017 +0200

radeonsi: use CLEAR_STATE to initialize some registers

Reviewed-by: Nicolai Hähnle 

:04 04 621668e602ccd2f36299e329b096586baa920ba0
68d43945fde8fbbfad6ae444546a981af2507b03 M  src

During regression testing I faced
https://bugs.freedesktop.org/show_bug.cgi?id=101969 where I saw some serious
corruption of the graphics in Valley so I used this patch to overcome
https://cgit.freedesktop.org/mesa/mesa/commit/?id=b9fc9d3f241758ed8a274be7abf68bf448653508
But its the same issue like in the bug report mentioned above. Seems the patch
hasnt fixed all issues.

Device: AMD TAHITI (DRM 2.50.0 / 4.11.0-1-amd-staging, LLVM 5.0.0) (0x6798)
Radeon HD 7970

-- 
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 101977] UE4 4.17 causes Assertion `G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr)' failed

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101977

--- Comment #18 from Timothee Besset  ---
https://github.com/EpicGames/UnrealEngine/pull/3901

-- 
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 91880] Radeonsi on Grenada cards (r9 390) exceptionally unstable and poorly performing

2017-08-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91880

--- Comment #158 from janweber...@gmail.com ---
asus strix 390 owner.

gentoo kernel 4.12.3 and amdgpu 1.3.0.


get crash after 10-30seconds dwm.

only think that helps: "echo  high >
/sys/class/device/drm/card0/power_dpm_force_performance_level" but you have to
do this everytime the system start and before launch xserver.


i found this here (at bottom):
https://wiki.archlinux.org/index.php/AMDGPU

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


Re: [PATCH 0/9] drm/syncobj: Add full-featured wait support (v2)

2017-08-13 Thread Jason Ekstrand

On August 13, 2017 6:19:53 AM Christian König  wrote:


Patches #1-#4 are Acked-by: Christian König .

Patch #5: NAK, that will break radeon.

On radeon we need the non-default wait or otherwise we can run into a
situation where we never signal a fence.

The general question is why do you need this?


Because i915 sets a non-default wait function so calling wait_any just 
bails with fences from i915 immediately bails with -EINVAL.  This makes it 
work even with non-default waits.



Patch #6: Yes, please. Patch is Reviewed-by: Christian König
.

Patch #7: Already gave my rb on the patch Chris send out earlier.

Patch #8: NAK to the whole approach.

IIRC we discussed a very similar thing during the initial fence bringup
and also during the fence_array development.

The problem is that you can easily build ring dependencies and so
deadlocks with it.

I would really prefer an approach which is completely contained inside
the syncobj code base.


Are you use to the approach of internally making a proxy so long as all the 
proxy code is inside syncobj?  Is also be happy to go back to the original 
approach with v3 of the last patch.



Regards,
Christian.

Am 12.08.2017 um 00:39 schrieb Jason Ekstrand:

This series does the same thing as my earlier series in that it adds a sync
object wait interface complete with WAIT_FOR_SUBMIT flag.  While the uapi
remains unchanged, the guts look a bit different.  Instead of adding a
callback mechanism to drm_syncobj that fired whenever replace_fence was
called, it's now using proxy fences.  The drm_syncobj_fence_get still
returns NULL whenever the sync object is in an unsubmitted state but there
is a new drm_syncobj_fence_proxy_get which returns either the real fence or
a proxy fence that will be triggered the next time replace_fence is called
with a non-NULL replacement.  This does make both drm_syncobj_fence_get and
drm_syncobj_replace_fence a tiny bit more expensive, but it lets us do it
all without locking.

This series can be found as a branch here:

https://cgit.freedesktop.org/~jekstrand/linux/log/?h=drm-syncobj-wait-submit-v4

IGT tests for DRM_IOCTL_SYNCOBJ_WAIT and DRM_IOCTL_SYNCOBJ_RESET can be
found on patchwork here:

https://patchwork.freedesktop.org/series/28666/

Patches to the Intel Vulkan driver to implement VK_KHR_external_fence on
top of this kernel interface can be found here:

https://cgit.freedesktop.org/~jekstrand/mesa/log/?h=wip/anv-external-fence

Cc: Dave Airlie 
Cc: Chris Wilson 
Cc: Christian König 

Chris Wilson (2):
   dma-buf/dma-fence: Signal all callbacks from dma_fence_release()
   dma-buf/dma-fence: Add a mechanism for proxy fences

Dave Airlie (1):
   drm/syncobj: add sync obj wait interface. (v8)

Jason Ekstrand (6):
   drm/syncobj: Rename fence_get to find_fence
   drm/syncobj: Add a race-free drm_syncobj_fence_get helper
   i915: Add support for drm syncobjs
   dma-buf/dma-fence: Allow wait_any_timeout without default_wait (v2)
   drm/syncobj: Add a reset ioctl
   drm/syncobj: Allow wait for submit and signal behavior (v4)

  drivers/dma-buf/Makefile   |   4 +-
  drivers/dma-buf/dma-fence-proxy.c  | 186 +++
  drivers/dma-buf/dma-fence.c|  34 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c |   2 +-
  drivers/gpu/drm/drm_internal.h |   4 +
  drivers/gpu/drm/drm_ioctl.c|   4 +
  drivers/gpu/drm/drm_syncobj.c  | 275 +++--
  drivers/gpu/drm/i915/i915_drv.c|   3 +-
  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 146 ++-
  include/drm/drm_syncobj.h  |  15 +-
  include/linux/dma-fence-proxy.h|  25 +++
  include/uapi/drm/drm.h |  19 ++
  include/uapi/drm/i915_drm.h|  30 +++-
  13 files changed, 710 insertions(+), 37 deletions(-)
  create mode 100644 drivers/dma-buf/dma-fence-proxy.c
  create mode 100644 include/linux/dma-fence-proxy.h






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


[PATCH 1/4] drm/tve200: Add DT bindings

2017-08-13 Thread Linus Walleij
This adds device tree bindings for the Faraday TVE200 IP block.
This IP block is present in the Gemini ARM SoC and also in some
Grain Media GM SoCs.

Cc: devicet...@vger.kernel.org
Signed-off-by: Linus Walleij 
---
 .../devicetree/bindings/display/faraday,tve200.txt | 41 ++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/faraday,tve200.txt

diff --git a/Documentation/devicetree/bindings/display/faraday,tve200.txt 
b/Documentation/devicetree/bindings/display/faraday,tve200.txt
new file mode 100644
index ..95d588fbb2f2
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/faraday,tve200.txt
@@ -0,0 +1,41 @@
+* Faraday TV Encoder TVE200
+
+Required properties:
+
+- compatible: must be one of:
+   "faraday,tve200"
+   "cortina,gemini-tvc", "faraday,tve200"
+
+- reg: base address and size of the control registers block
+
+- interrupts: contains an interrupt specifier for the interrupt
+   line from the TVE200
+
+- clock-names: should contain "PCLK" for the clock line clocking the
+   silicon and "TVE" for the 27MHz clock to the video driver
+
+- clocks: contains phandle and clock specifier pairs for the entries
+   in the clock-names property. See
+   Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Optional properties:
+
+- resets: contains the reset line phandle for the block
+
+Required sub-nodes:
+
+- port: describes LCD panel signals, following the common binding
+   for video transmitter interfaces; see
+   Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+
+tvc@6a00 {
+   compatible = "faraday,tve200";
+   reg = <0x6a00 0x1000>;
+   interrupts = <13 IRQ_TYPE_EDGE_RISING>;
+   resets = < GEMINI_RESET_TVC>;
+   clocks = < GEMINI_CLK_GATE_TVC>,
+< GEMINI_CLK_TVC>;
+   clock-names = "PCLK", "TVE";
+};
-- 
2.13.4

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


[PATCH 4/4] ARM: dts: Add TVE/TVC and ILI9322 panel to DIR-685

2017-08-13 Thread Linus Walleij
This adds the TVE200/TVC TV-encoder and the Ilitek ILI9322 panel
to the DIR-685 device tree.

This brings graphics to this funky router and it is possible to
even run a console on its tiny screen.

Incidentally this requires us to disable the access to the
parallel (NOR) flash, as the communication pins to the panel
are shared with the flash memory.

To access the flash, a separate kernel with the panel disabled
and the flash enabled should be booted. The pin control selecting
whether to use the lines cannot be altered at runtime due to
hardware constraints.

Signed-off-by: Linus Walleij 
---
DRM developers: I will merge this patch through the ARM SoC
tree. It is only included in this series for completion.
---
 arch/arm/boot/dts/gemini-dlink-dir-685.dts | 77 +-
 1 file changed, 76 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/gemini-dlink-dir-685.dts 
b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
index 094a29624b8d..6c8d3d839ae6 100644
--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
@@ -46,6 +46,59 @@
};
};
 
+   vdisp: regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "display-power";
+   regulator-min-microvolt = <360>;
+   regulator-max-microvolt = <360>;
+   /* Collides with LCD E */
+   gpio = < 16 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
+
+   spi {
+   compatible = "spi-gpio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   /* Collides with IDE pins, that's cool (we do not use them) */
+   gpio-sck = < 5 GPIO_ACTIVE_HIGH>;
+   gpio-miso = < 8 GPIO_ACTIVE_HIGH>;
+   gpio-mosi = < 7 GPIO_ACTIVE_HIGH>;
+   /* Collides with pflash CE1, not so cool */
+   cs-gpios = < 20 GPIO_ACTIVE_HIGH>;
+   num-chipselects = <1>;
+
+   panel: display@0 {
+   compatible = "ilitek,ili9322";
+   reg = <0>;
+   /* 50 ns min period = 20 MHz */
+   spi-max-frequency = <2000>;
+   spi-cpol; /* Clock active low */
+
+   /* Panel LM918A01-1A SY-B4-091116-E0199 */
+   width-mm = <65>;
+   height-mm = <50>;
+   ilitek,entry-mode = <11>;
+   ilitek,vreg1out-microvolt = <4600>;
+   ilitek,vcom-high-percent = <91>;
+   ilitek,vcom-amplitude-percent = <114>;
+   ilitek,gamma-correction-neg = <0xa>, <0x5>, <0x7>,
+   <0x7>, <0x7>, <0x5>, <0x1>, <0x6>;
+   ilitek,gamma-correction-pos = <0x7>, <0x7>, <0x3>,
+   <0x2>, <0x3>, <0x5>, <0x7>, <0x2>;
+   vcc-supply = <>;
+   iovcc-supply = <>;
+   vci-supply = <>;
+
+   port {
+   panel_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
+   };
+
leds {
compatible = "gpio-leds";
led@7 {
@@ -114,7 +167,16 @@
 
soc {
flash@3000 {
-   status = "okay";
+   /*
+* Flash access is by default disabled, because it
+* collides with the Chip Enable signal for the display
+* panel, that reuse the parallel flash Chip Select 1
+* (CS1). Enabling flash makes graphics stop working.
+*
+* We might be able to hack around this by letting
+* GPIO poke around in the flash controller registers.
+*/
+   /* status = "okay"; */
/* 32MB of flash */
reg = <0x3000 0x0200>;
 
@@ -241,5 +303,18 @@
ata@6300 {
status = "okay";
};
+
+   tvc@6a00 {
+   status = "okay";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   display_out: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
};
 };
-- 
2.13.4

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

[PATCH 2/4] drm/tve200: Add new driver for TVE200

2017-08-13 Thread Linus Walleij
This adds a new DRM driver for the Faraday Technology TVE200
block. This "TV Encoder" encodes a ITU-T BT.656 stream and can
be found in the StorLink SL3516 (later Cortina Systems CS3516)
as well as the Grain Media GM8180.

I do not have definitive word from anyone at Faraday that this
IP block is theirs, but it bears the hallmark of their 3-digit
version code (200) and is used in two SoCs from completely
different companies. (Grain Media was fully owned by Faraday
until it was transferred to NovoTek this january, and
Faraday did lots of work on the StorLink SoCs.)

The D-Link DIR-685 uses this in connection with the Ilitek
ILI9322 panel driver that supports BT.656 input, while the
GM8180 apparently has been used with the Cirrus Logic CS4954
digital video encoder. The oldest user seems to be
something called Techwall 2835.

This driver is heavily inspired by Eric Anholt's PL111
driver and therefore I have mentioned all the ancestor authors
in the header file.

Signed-off-by: Linus Walleij 
---
 Documentation/gpu/index.rst   |   1 +
 Documentation/gpu/tve200.rst  |   6 +
 MAINTAINERS   |   6 +
 drivers/gpu/drm/Kconfig   |   2 +
 drivers/gpu/drm/Makefile  |   1 +
 drivers/gpu/drm/tve200/Kconfig|  15 ++
 drivers/gpu/drm/tve200/Makefile   |   5 +
 drivers/gpu/drm/tve200/tve200_connector.c | 126 +++
 drivers/gpu/drm/tve200/tve200_display.c   | 346 ++
 drivers/gpu/drm/tve200/tve200_drm.h   | 129 +++
 drivers/gpu/drm/tve200/tve200_drv.c   | 277 
 11 files changed, 914 insertions(+)
 create mode 100644 Documentation/gpu/tve200.rst
 create mode 100644 drivers/gpu/drm/tve200/Kconfig
 create mode 100644 drivers/gpu/drm/tve200/Makefile
 create mode 100644 drivers/gpu/drm/tve200/tve200_connector.c
 create mode 100644 drivers/gpu/drm/tve200/tve200_display.c
 create mode 100644 drivers/gpu/drm/tve200/tve200_drm.h
 create mode 100644 drivers/gpu/drm/tve200/tve200_drv.c

diff --git a/Documentation/gpu/index.rst b/Documentation/gpu/index.rst
index 35d673bf9b56..c36586dad29d 100644
--- a/Documentation/gpu/index.rst
+++ b/Documentation/gpu/index.rst
@@ -15,6 +15,7 @@ Linux GPU Driver Developer's Guide
pl111
tegra
tinydrm
+   tve200
vc4
vga-switcheroo
vgaarbiter
diff --git a/Documentation/gpu/tve200.rst b/Documentation/gpu/tve200.rst
new file mode 100644
index ..69b17b324e12
--- /dev/null
+++ b/Documentation/gpu/tve200.rst
@@ -0,0 +1,6 @@
+==
+ drm/tve200 Faraday TV Encoder 200
+==
+
+.. kernel-doc:: drivers/gpu/drm/tve200/tve200_drv.c
+   :doc: Faraday TV Encoder 200
diff --git a/MAINTAINERS b/MAINTAINERS
index e87cba115ea4..c3d42d68253a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4305,6 +4305,12 @@ T:   git git://anongit.freedesktop.org/drm/drm-misc
 S: Maintained
 F: drivers/gpu/drm/bochs/
 
+DRM DRIVER FOR FARADAY TVE200 TV ENCODER
+M: Linus Walleij 
+T: git git://anongit.freedesktop.org/drm/drm-misc
+S: Maintained
+F: drivers/gpu/drm/tve200/
+
 DRM DRIVER FOR INTEL I810 VIDEO CARDS
 S: Orphan / Obsolete
 F: drivers/gpu/drm/i810/
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 83cb2a88c204..c5e1a8409285 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -278,6 +278,8 @@ source "drivers/gpu/drm/tinydrm/Kconfig"
 
 source "drivers/gpu/drm/pl111/Kconfig"
 
+source "drivers/gpu/drm/tve200/Kconfig"
+
 # Keep legacy drivers last
 
 menuconfig DRM_LEGACY
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 24a066e1841c..cc81813e2238 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -100,3 +100,4 @@ obj-$(CONFIG_DRM_ZTE)   += zte/
 obj-$(CONFIG_DRM_MXSFB)+= mxsfb/
 obj-$(CONFIG_DRM_TINYDRM) += tinydrm/
 obj-$(CONFIG_DRM_PL111) += pl111/
+obj-$(CONFIG_DRM_TVE200) += tve200/
diff --git a/drivers/gpu/drm/tve200/Kconfig b/drivers/gpu/drm/tve200/Kconfig
new file mode 100644
index ..21d9841ddb88
--- /dev/null
+++ b/drivers/gpu/drm/tve200/Kconfig
@@ -0,0 +1,15 @@
+config DRM_TVE200
+   tristate "DRM Support for Faraday TV Encoder TVE200"
+   depends on DRM
+   depends on CMA
+   depends on ARM || COMPILE_TEST
+   depends on OF
+   select DRM_PANEL
+   select DRM_KMS_HELPER
+   select DRM_KMS_CMA_HELPER
+   select DRM_GEM_CMA_HELPER
+   select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE
+   help
+ Choose this option for DRM support for the Faraday TV Encoder
+ TVE200 Controller.
+ If M is selected the module will be called tve200_drm.
diff --git a/drivers/gpu/drm/tve200/Makefile b/drivers/gpu/drm/tve200/Makefile
new file mode 100644
index ..a9dba54f7ee5
--- /dev/null
+++ 

[PATCH 0/4] DRM driver for Faraday TVE200

2017-08-13 Thread Linus Walleij
I finally got my act together to clean up my patches and post
this DRM driver.

It's an old hardware, but using all the new fancy CMA helpers
and integrating really nicely I think. Most important: it
JustWorks(TM) and i have a little penguin and interactive
console on my D-Link DIR-685 router (!). Well that is not
a serious usecase, but it kind of proves that it does all it
should. Vblank interrupts work like a charm and all.

It would not have been possible if I hadn't had Eric Anholts
excellent PL11x driver to use as role model.

Daniel, Eric: please help me out with the next steps in your
maintenance model, so I learn how to do this upstream work
right with the DRM community.

I posted the display driver separately since it is, well
a separate business. I guess Thierry collects these drivers,
else tell me.

Linus Walleij (4):
  drm/tve200: Add DT bindings
  drm/tve200: Add new driver for TVE200
  ARM: dts: Add TVE200 to the Gemini SoC DTSI
  ARM: dts: Add TVE/TVC and ILI9322 panel to DIR-685

 .../devicetree/bindings/display/faraday,tve200.txt |  41 +++
 Documentation/gpu/index.rst|   1 +
 Documentation/gpu/tve200.rst   |   6 +
 MAINTAINERS|   6 +
 arch/arm/boot/dts/gemini-dlink-dir-685.dts |  77 -
 arch/arm/boot/dts/gemini.dtsi  |  19 ++
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/tve200/Kconfig |  15 +
 drivers/gpu/drm/tve200/Makefile|   5 +
 drivers/gpu/drm/tve200/tve200_connector.c  | 126 
 drivers/gpu/drm/tve200/tve200_display.c| 346 +
 drivers/gpu/drm/tve200/tve200_drm.h| 129 
 drivers/gpu/drm/tve200/tve200_drv.c| 277 +
 14 files changed, 1050 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/display/faraday,tve200.txt
 create mode 100644 Documentation/gpu/tve200.rst
 create mode 100644 drivers/gpu/drm/tve200/Kconfig
 create mode 100644 drivers/gpu/drm/tve200/Makefile
 create mode 100644 drivers/gpu/drm/tve200/tve200_connector.c
 create mode 100644 drivers/gpu/drm/tve200/tve200_display.c
 create mode 100644 drivers/gpu/drm/tve200/tve200_drm.h
 create mode 100644 drivers/gpu/drm/tve200/tve200_drv.c

-- 
2.13.4

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


[PATCH v3 15/22] drm/shmobile: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Laurent Pinchart 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/shmobile/shmob_drm_kms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/shmobile/shmob_drm_kms.c 
b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
index 388a0fc..d36919b 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_kms.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_kms.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -131,7 +132,7 @@ shmob_drm_fb_create(struct drm_device *dev, struct drm_file 
*file_priv,
}
}
 
-   return drm_fb_cma_create(dev, file_priv, mode_cmd);
+   return drm_gem_fb_create(dev, file_priv, mode_cmd);
 }
 
 static const struct drm_mode_config_funcs shmob_drm_mode_config_funcs = {
-- 
2.7.4

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


[PATCH v3 11/22] drm/meson: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Neil Armstrong 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/meson/meson_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index 5375e6d..5eaf9a4 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -78,7 +79,7 @@ static const struct drm_mode_config_funcs 
meson_mode_config_funcs = {
.output_poll_changed = meson_fb_output_poll_changed,
.atomic_check= drm_atomic_helper_check,
.atomic_commit   = drm_atomic_helper_commit,
-   .fb_create   = drm_fb_cma_create,
+   .fb_create   = drm_gem_fb_create,
 };
 
 static irqreturn_t meson_irq(int irq, void *arg)
-- 
2.7.4

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


[PATCH v3 21/22] drm/zte: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Shawn Guo 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/zte/zx_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index 4524482..e8b8266 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -40,7 +41,7 @@ static void zx_drm_fb_output_poll_changed(struct drm_device 
*drm)
 }
 
 static const struct drm_mode_config_funcs zx_drm_mode_config_funcs = {
-   .fb_create = drm_fb_cma_create,
+   .fb_create = drm_gem_fb_create,
.output_poll_changed = zx_drm_fb_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
-- 
2.7.4

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


[PATCH v3 18/22] drm/sun4i: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Maxime Ripard 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/sun4i/sun4i_framebuffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c 
b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
index 9872e0f..2992f0a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_framebuffer.c
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "sun4i_drv.h"
@@ -28,7 +29,7 @@ static const struct drm_mode_config_funcs 
sun4i_de_mode_config_funcs = {
.output_poll_changed= sun4i_de_output_poll_changed,
.atomic_check   = drm_atomic_helper_check,
.atomic_commit  = drm_atomic_helper_commit,
-   .fb_create  = drm_fb_cma_create,
+   .fb_create  = drm_gem_fb_create,
 };
 
 struct drm_fbdev_cma *sun4i_framebuffer_init(struct drm_device *drm)
-- 
2.7.4

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


[PATCH v3 10/22] drm/imx: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() and drm_fb_cma_prepare_fb() are just wrappers now,
use drm_gem_fb_create() and drm_gem_fb_prepare_fb() directly.

Cc: Philipp Zabel 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/imx/imx-drm-core.c | 3 ++-
 drivers/gpu/drm/imx/ipuv3-plane.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index f91cb72..93c7e3f 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -105,7 +106,7 @@ static int imx_drm_atomic_check(struct drm_device *dev,
 }
 
 static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = {
-   .fb_create = drm_fb_cma_create,
+   .fb_create = drm_gem_fb_create,
.output_poll_changed = imx_drm_output_poll_changed,
.atomic_check = imx_drm_atomic_check,
.atomic_commit = drm_atomic_helper_commit,
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index debde2d..82e1c50 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "video/imx-ipu-v3.h"
@@ -661,7 +662,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
 }
 
 static const struct drm_plane_helper_funcs ipu_plane_helper_funcs = {
-   .prepare_fb = drm_fb_cma_prepare_fb,
+   .prepare_fb = drm_gem_fb_prepare_fb,
.atomic_check = ipu_plane_atomic_check,
.atomic_disable = ipu_plane_atomic_disable,
.atomic_update = ipu_plane_atomic_update,
-- 
2.7.4

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


[PATCH v3 20/22] drm/vc4: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Eric Anholt 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/vc4/vc4_kms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index dfe7554..50c4959 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "vc4_drv.h"
 
 static void vc4_output_poll_changed(struct drm_device *dev)
@@ -189,7 +190,7 @@ static struct drm_framebuffer *vc4_fb_create(struct 
drm_device *dev,
mode_cmd = _cmd_local;
}
 
-   return drm_fb_cma_create(dev, file_priv, mode_cmd);
+   return drm_gem_fb_create(dev, file_priv, mode_cmd);
 }
 
 static const struct drm_mode_config_funcs vc4_mode_funcs = {
-- 
2.7.4

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


[PATCH v3 09/22] drm/hisilicon/kirin: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Xinliang Liu 
Cc: Rongrong Zou 
Cc: Xinwei Kong 
Cc: Chen Feng 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index 79fcce7..7a06d3b 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -56,7 +57,7 @@ static void kirin_fbdev_output_poll_changed(struct drm_device 
*dev)
 }
 
 static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = {
-   .fb_create = drm_fb_cma_create,
+   .fb_create = drm_gem_fb_create,
.output_poll_changed = kirin_fbdev_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
-- 
2.7.4

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


[PATCH v3 00/22] drm: Add GEM backed framebuffer library

2017-08-13 Thread Noralf Trønnes
This adds helpers for drivers that don't subclass drm_framebuffer and
are backed by drm_gem_object(s). drm_fb_cma_helper is converted to use
the helpers.

This patchset is part of a process to add a shmem gem library like the
cma library. The common parts between the two goes into core or helpers.

Noralf.

Changes since version 2:
- Expanded docs (Daniel)
- Add drm_gem_fbdev_fb_create() instead of exporting drm_gem_fb_alloc().
  This function is used by drivers/helpers to create a drm_framebuffer for
  use with fbdev emulation.
- drm_gem_object_put_unlocked() is NULL tolerant (Joe Kniss)
- Rebase tinydrm patch on new st7586 driver
- Rebase arc and pl111 patches on 'drm: make drm_mode_config_func const'

Changes since version 1:
- Pushed the new functions out to the cma drivers, so I could clean up
  the cma library.

Noralf Trønnes (22):
  drm: Add GEM backed framebuffer library
  drm/fb-cma-helper: Use drm_gem_framebuffer_helper
  drm/tinydrm: Use drm_gem_framebuffer_helper
  drm/arc: Use drm_gem_fb_create()
  drm/arm/hdlcd: Use drm_gem_fb_create()
  drm/arm/mali: Use drm_gem_fb_create()
  drm/atmel-hlcdc: Use drm_gem_fb_create()
  drm/fsl-dcu: Use drm_gem_fb_create()
  drm/hisilicon/kirin: Use drm_gem_fb_create()
  drm/imx: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
  drm/meson: Use drm_gem_fb_create()
  drm/mxsfb: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
  drm/pl111: Use drm_gem_fb_create() and drm_gem_fb_prepare_fb()
  drm/rcar-du: Use drm_gem_fb_create()
  drm/shmobile: Use drm_gem_fb_create()
  drm/sti: Use drm_gem_fb_create()
  drm/stm: Use drm_gem_fb_create()
  drm/sun4i: Use drm_gem_fb_create()
  drm/tilcdc: Use drm_gem_fb_create()
  drm/vc4: Use drm_gem_fb_create()
  drm/zte: Use drm_gem_fb_create()
  drm/fb-cma-helper: Remove unused functions

 Documentation/gpu/drm-kms-helpers.rst   |   9 +
 drivers/gpu/drm/Makefile|   2 +-
 drivers/gpu/drm/arc/arcpgu_drv.c|   3 +-
 drivers/gpu/drm/arm/hdlcd_drv.c |   3 +-
 drivers/gpu/drm/arm/malidp_drv.c|   3 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c|   2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h|   1 +
 drivers/gpu/drm/drm_fb_cma_helper.c | 248 +++--
 drivers/gpu/drm/drm_gem_framebuffer_helper.c| 283 
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c   |   3 +-
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |   3 +-
 drivers/gpu/drm/imx/imx-drm-core.c  |   3 +-
 drivers/gpu/drm/imx/ipuv3-plane.c   |   3 +-
 drivers/gpu/drm/meson/meson_drv.c   |   3 +-
 drivers/gpu/drm/mxsfb/mxsfb_drv.c   |   5 +-
 drivers/gpu/drm/pl111/pl111_display.c   |   3 +-
 drivers/gpu/drm/pl111/pl111_drv.c   |   3 +-
 drivers/gpu/drm/rcar-du/rcar_du_kms.c   |   3 +-
 drivers/gpu/drm/shmobile/shmob_drm_kms.c|   3 +-
 drivers/gpu/drm/sti/sti_drv.c   |   3 +-
 drivers/gpu/drm/stm/drv.c   |   3 +-
 drivers/gpu/drm/sun4i/sun4i_framebuffer.c   |   3 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c |   3 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c |   3 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c |   5 +-
 drivers/gpu/drm/tinydrm/mipi-dbi.c  |   5 +-
 drivers/gpu/drm/tinydrm/repaper.c   |   5 +-
 drivers/gpu/drm/tinydrm/st7586.c|   5 +-
 drivers/gpu/drm/vc4/vc4_kms.c   |   3 +-
 drivers/gpu/drm/zte/zx_drm_drv.c|   3 +-
 include/drm/drm_fb_cma_helper.h |  13 --
 include/drm/drm_framebuffer.h   |   7 +
 include/drm/drm_gem_framebuffer_helper.h|  37 
 33 files changed, 420 insertions(+), 264 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_gem_framebuffer_helper.c
 create mode 100644 include/drm/drm_gem_framebuffer_helper.h

--
2.7.4

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


[PATCH v3 04/22] drm/arc: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Alexey Brodkin 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/arc/arcpgu_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index f75c341..0e7867b 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -32,7 +33,7 @@ static void arcpgu_fb_output_poll_changed(struct drm_device 
*dev)
 }
 
 static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = {
-   .fb_create  = drm_fb_cma_create,
+   .fb_create  = drm_gem_fb_create,
.output_poll_changed = arcpgu_fb_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
-- 
2.7.4

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


[PATCH v3 05/22] drm/arm/hdlcd: Use drm_gem_fb_create()

2017-08-13 Thread Noralf Trønnes
drm_fb_cma_create() is just a wrapper around drm_gem_fb_create() now,
so use the function directly.

Cc: Liviu Dudau 
Cc: Brian Starkey 
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index f9bda7b..764d0c8 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "hdlcd_drv.h"
@@ -106,7 +107,7 @@ static void hdlcd_fb_output_poll_changed(struct drm_device 
*drm)
 }
 
 static const struct drm_mode_config_funcs hdlcd_mode_config_funcs = {
-   .fb_create = drm_fb_cma_create,
+   .fb_create = drm_gem_fb_create,
.output_poll_changed = hdlcd_fb_output_poll_changed,
.atomic_check = drm_atomic_helper_check,
.atomic_commit = drm_atomic_helper_commit,
-- 
2.7.4

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


[PATCH v3 02/22] drm/fb-cma-helper: Use drm_gem_framebuffer_helper

2017-08-13 Thread Noralf Trønnes
Use the new drm_gem_framebuffer_helper who's code was copied
from this helper.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 181 ++--
 1 file changed, 30 insertions(+), 151 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index ade319d..e1befee 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -18,27 +18,17 @@
  */
 
 #include 
-#include 
-#include 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
-#include 
-#include 
 #include 
-#include 
 
 #define DEFAULT_FBDEFIO_DELAY_MS 50
 
-struct drm_fb_cma {
-   struct drm_framebuffer  fb;
-   struct drm_gem_cma_object   *obj[4];
-};
-
 struct drm_fbdev_cma {
struct drm_fb_helperfb_helper;
-   struct drm_fb_cma   *fb;
const struct drm_framebuffer_funcs *fb_funcs;
 };
 
@@ -90,69 +80,19 @@ static inline struct drm_fbdev_cma *to_fbdev_cma(struct 
drm_fb_helper *helper)
return container_of(helper, struct drm_fbdev_cma, fb_helper);
 }
 
-static inline struct drm_fb_cma *to_fb_cma(struct drm_framebuffer *fb)
-{
-   return container_of(fb, struct drm_fb_cma, fb);
-}
-
 void drm_fb_cma_destroy(struct drm_framebuffer *fb)
 {
-   struct drm_fb_cma *fb_cma = to_fb_cma(fb);
-   int i;
-
-   for (i = 0; i < 4; i++) {
-   if (fb_cma->obj[i])
-   drm_gem_object_put_unlocked(_cma->obj[i]->base);
-   }
-
-   drm_framebuffer_cleanup(fb);
-   kfree(fb_cma);
+   drm_gem_fb_destroy(fb);
 }
 EXPORT_SYMBOL(drm_fb_cma_destroy);
 
 int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
struct drm_file *file_priv, unsigned int *handle)
 {
-   struct drm_fb_cma *fb_cma = to_fb_cma(fb);
-
-   return drm_gem_handle_create(file_priv,
-   _cma->obj[0]->base, handle);
+   return drm_gem_fb_create_handle(fb, file_priv, handle);
 }
 EXPORT_SYMBOL(drm_fb_cma_create_handle);
 
-static struct drm_framebuffer_funcs drm_fb_cma_funcs = {
-   .destroy= drm_fb_cma_destroy,
-   .create_handle  = drm_fb_cma_create_handle,
-};
-
-static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev,
-   const struct drm_mode_fb_cmd2 *mode_cmd,
-   struct drm_gem_cma_object **obj,
-   unsigned int num_planes, const struct drm_framebuffer_funcs *funcs)
-{
-   struct drm_fb_cma *fb_cma;
-   int ret;
-   int i;
-
-   fb_cma = kzalloc(sizeof(*fb_cma), GFP_KERNEL);
-   if (!fb_cma)
-   return ERR_PTR(-ENOMEM);
-
-   drm_helper_mode_fill_fb_struct(dev, _cma->fb, mode_cmd);
-
-   for (i = 0; i < num_planes; i++)
-   fb_cma->obj[i] = obj[i];
-
-   ret = drm_framebuffer_init(dev, _cma->fb, funcs);
-   if (ret) {
-   dev_err(dev->dev, "Failed to initialize framebuffer: %d\n", 
ret);
-   kfree(fb_cma);
-   return ERR_PTR(ret);
-   }
-
-   return fb_cma;
-}
-
 /**
  * drm_fb_cma_create_with_funcs() - helper function for the
  *  _mode_config_funcs.fb_create
@@ -170,53 +110,7 @@ struct drm_framebuffer 
*drm_fb_cma_create_with_funcs(struct drm_device *dev,
struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd,
const struct drm_framebuffer_funcs *funcs)
 {
-   const struct drm_format_info *info;
-   struct drm_fb_cma *fb_cma;
-   struct drm_gem_cma_object *objs[4];
-   struct drm_gem_object *obj;
-   int ret;
-   int i;
-
-   info = drm_get_format_info(dev, mode_cmd);
-   if (!info)
-   return ERR_PTR(-EINVAL);
-
-   for (i = 0; i < info->num_planes; i++) {
-   unsigned int width = mode_cmd->width / (i ? info->hsub : 1);
-   unsigned int height = mode_cmd->height / (i ? info->vsub : 1);
-   unsigned int min_size;
-
-   obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]);
-   if (!obj) {
-   dev_err(dev->dev, "Failed to lookup GEM object\n");
-   ret = -ENOENT;
-   goto err_gem_object_put;
-   }
-
-   min_size = (height - 1) * mode_cmd->pitches[i]
-+ width * info->cpp[i]
-+ mode_cmd->offsets[i];
-
-   if (obj->size < min_size) {
-   drm_gem_object_put_unlocked(obj);
-   ret = -EINVAL;
-   goto err_gem_object_put;
-   }
-   objs[i] = to_drm_gem_cma_obj(obj);
-   }
-
-   fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, funcs);
-   if (IS_ERR(fb_cma)) {
-   ret = PTR_ERR(fb_cma);
-   goto err_gem_object_put;
-   }
-
-   return _cma->fb;
-
-err_gem_object_put:
-   for (i--; i >= 0; i--)
-   

[PATCH v3 01/22] drm: Add GEM backed framebuffer library

2017-08-13 Thread Noralf Trønnes
This library provides helpers for drivers that don't subclass
drm_framebuffer and are backed by drm_gem_object. The code is
taken from drm_fb_cma_helper.

Signed-off-by: Noralf Trønnes 
Reviewed-by: Daniel Vetter 
---
 Documentation/gpu/drm-kms-helpers.rst|   9 +
 drivers/gpu/drm/Makefile |   2 +-
 drivers/gpu/drm/drm_gem_framebuffer_helper.c | 283 +++
 include/drm/drm_framebuffer.h|   7 +
 include/drm/drm_gem_framebuffer_helper.h |  37 
 5 files changed, 337 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/drm_gem_framebuffer_helper.c
 create mode 100644 include/drm/drm_gem_framebuffer_helper.h

diff --git a/Documentation/gpu/drm-kms-helpers.rst 
b/Documentation/gpu/drm-kms-helpers.rst
index 7c5e254..13dd237 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -296,3 +296,12 @@ Auxiliary Modeset Helpers
 
 .. kernel-doc:: drivers/gpu/drm/drm_modeset_helper.c
:export:
+
+Framebuffer GEM Helper Reference
+
+
+.. kernel-doc:: drivers/gpu/drm/drm_gem_framebuffer_helper.c
+   :doc: overview
+
+.. kernel-doc:: drivers/gpu/drm/drm_gem_framebuffer_helper.c
+   :export:
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 24a066e..a8acc19 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -33,7 +33,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o 
drm_probe_helper.o \
drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
drm_kms_helper_common.o drm_dp_dual_mode_helper.o \
drm_simple_kms_helper.o drm_modeset_helper.o \
-   drm_scdc_helper.o
+   drm_scdc_helper.o drm_gem_framebuffer_helper.o
 
 drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
 drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c 
b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
new file mode 100644
index 000..068a630
--- /dev/null
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -0,0 +1,283 @@
+/*
+ * drm gem framebuffer helper functions
+ *
+ * Copyright (C) 2017 Noralf Trønnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * DOC: overview
+ *
+ * This library provides helpers for drivers that don't subclass
+ * _framebuffer and and use _gem_object for their backing storage.
+ *
+ * Drivers without additional needs to validate framebuffers can simply use
+ * drm_gem_fb_create() and everything is wired up automatically. But all
+ * parts can be used individually.
+ */
+
+/**
+ * drm_gem_fb_get_obj() - Get GEM object for framebuffer
+ * @fb: The framebuffer
+ * @plane: Which plane
+ *
+ * Returns the GEM object for given framebuffer.
+ */
+struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
+ unsigned int plane)
+{
+   if (plane >= 4)
+   return NULL;
+
+   return fb->obj[plane];
+}
+EXPORT_SYMBOL_GPL(drm_gem_fb_get_obj);
+
+static struct drm_framebuffer *
+drm_gem_fb_alloc(struct drm_device *dev,
+const struct drm_mode_fb_cmd2 *mode_cmd,
+struct drm_gem_object **obj, unsigned int num_planes,
+const struct drm_framebuffer_funcs *funcs)
+{
+   struct drm_framebuffer *fb;
+   int ret, i;
+
+   fb = kzalloc(sizeof(*fb), GFP_KERNEL);
+   if (!fb)
+   return ERR_PTR(-ENOMEM);
+
+   drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
+
+   for (i = 0; i < num_planes; i++)
+   fb->obj[i] = obj[i];
+
+   ret = drm_framebuffer_init(dev, fb, funcs);
+   if (ret) {
+   DRM_DEV_ERROR(dev->dev, "Failed to init framebuffer: %d\n",
+ ret);
+   kfree(fb);
+   return ERR_PTR(ret);
+   }
+
+   return fb;
+}
+
+/**
+ * drm_gem_fb_destroy - Free GEM backed framebuffer
+ * @fb: DRM framebuffer
+ *
+ * Frees a GEM backed framebuffer with it's backing buffer(s) and the structure
+ * itself. Drivers can use this as their _framebuffer_funcs->destroy
+ * callback.
+ */
+void drm_gem_fb_destroy(struct drm_framebuffer *fb)
+{
+   int i;
+
+   for (i = 0; i < 4; i++)
+   drm_gem_object_put_unlocked(fb->obj[i]);
+
+   drm_framebuffer_cleanup(fb);
+   kfree(fb);
+}
+EXPORT_SYMBOL(drm_gem_fb_destroy);
+
+/**
+ * drm_gem_fb_create_handle - Create handle for GEM backed framebuffer
+ * @fb: DRM framebuffer
+ * @file: drm 

Re: [PATCH] dma-buf/dma-fence: Signal all callbacks from dma_fence_release()

2017-08-13 Thread Christian König

Am 11.08.2017 um 19:01 schrieb Chris Wilson:

This is an illegal scenario, to free the fence whilst there are pending
callbacks. Currently, we emit a WARN and then cast aside the callbacks
leaving them dangling. Alternatively, we could set an error on the fence
and then signal fence so that any dependency chains from the fence can
be tidied up, and if they care they can check for the error.

The question is whether or not the cure is worse than the disease
(premature fence signaling is never pretty).

Signed-off-by: Chris Wilson 


Not sure if -EDEADLK is the best error code, but in general the approach 
sounds like the least evil to me.


Patch is Reviewed-by: Christian König .


---
  drivers/dma-buf/dma-fence.c | 14 +-
  1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 9a302799040e..ed311edbeefa 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -172,7 +172,19 @@ void dma_fence_release(struct kref *kref)
  
  	trace_dma_fence_destroy(fence);
  
-	WARN_ON(!list_empty(>cb_list));

+   if (WARN_ON(!list_empty(>cb_list))) {
+   unsigned long flags;
+
+   /*
+* This should never happen, but if it does make sure that we
+* don't leave chains dangling. We set the error flag first
+* so that the callbacks know this signal is due to an error.
+*/
+   spin_lock_irqsave(fence->lock, flags);
+   fence->error = -EDEADLK;
+   dma_fence_signal_locked(fence);
+   spin_unlock_irqrestore(fence->lock, flags);
+   }
  
  	if (fence->ops->release)

fence->ops->release(fence);



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


[PATCH 6/6] [media] tuners: make snd_pcm_hardware const

2017-08-13 Thread Bhumika Goyal
Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/media/tuners/tda18271-maps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/tuners/tda18271-maps.c 
b/drivers/media/tuners/tda18271-maps.c
index 7d11467..9679804 100644
--- a/drivers/media/tuners/tda18271-maps.c
+++ b/drivers/media/tuners/tda18271-maps.c
@@ -1182,7 +1182,7 @@ int tda18271_lookup_map(struct dvb_frontend *fe,
 
 /*-*/
 
-static struct tda18271_std_map tda18271c1_std_map = {
+static const struct tda18271_std_map tda18271c1_std_map = {
.fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
  .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
.atv_b= { .if_freq = 6750, .fm_rfn = 0, .agc_mode = 1, .std = 6,
@@ -1215,7 +1215,7 @@ int tda18271_lookup_map(struct dvb_frontend *fe,
  .if_lvl = 1, .rfagc_top = 0x37, }, /* EP3[4:0] 0x1f */
 };
 
-static struct tda18271_std_map tda18271c2_std_map = {
+static const struct tda18271_std_map tda18271c2_std_map = {
.fm_radio = { .if_freq = 1250, .fm_rfn = 1, .agc_mode = 3, .std = 0,
  .if_lvl = 0, .rfagc_top = 0x2c, }, /* EP3[4:0] 0x18 */
.atv_b= { .if_freq = 6000, .fm_rfn = 0, .agc_mode = 1, .std = 5,
-- 
1.9.1

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


[PATCH 4/6] usb: gadget: make snd_pcm_hardware const

2017-08-13 Thread Bhumika Goyal
Make this const as it is only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/usb/gadget/function/u_audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/u_audio.c 
b/drivers/usb/gadget/function/u_audio.c
index d4caa21..3971bba 100644
--- a/drivers/usb/gadget/function/u_audio.c
+++ b/drivers/usb/gadget/function/u_audio.c
@@ -79,7 +79,7 @@ struct snd_uac_chip {
unsigned int p_framesize;
 };
 
-static struct snd_pcm_hardware uac_pcm_hardware = {
+static const struct snd_pcm_hardware uac_pcm_hardware = {
.info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER
 | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID
 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME,
-- 
1.9.1

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


[PATCH 3/6] drm: bridge: dw-hdmi: make snd_pcm_hardware const

2017-08-13 Thread Bhumika Goyal
Make this const as it is only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
index cf3f0ca..b161439 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c
@@ -298,7 +298,7 @@ static irqreturn_t snd_dw_hdmi_irq(int irq, void *data)
return IRQ_HANDLED;
 }
 
-static struct snd_pcm_hardware dw_hdmi_hw = {
+static const struct snd_pcm_hardware dw_hdmi_hw = {
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP |
-- 
1.9.1

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


[PATCH 1/6] [media] usb: make snd_pcm_hardware const

2017-08-13 Thread Bhumika Goyal
Make these const as they are only used during a copy operation.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal 
---
 drivers/media/usb/cx231xx/cx231xx-audio.c | 2 +-
 drivers/media/usb/em28xx/em28xx-audio.c   | 2 +-
 drivers/media/usb/go7007/snd-go7007.c | 2 +-
 drivers/media/usb/tm6000/tm6000-alsa.c| 2 +-
 drivers/media/usb/usbtv/usbtv-audio.c | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c 
b/drivers/media/usb/cx231xx/cx231xx-audio.c
index a050d12..06f10d7 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -403,7 +403,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct 
snd_pcm_substream *subs,
return 0;
 }
 
-static struct snd_pcm_hardware snd_cx231xx_hw_capture = {
+static const struct snd_pcm_hardware snd_cx231xx_hw_capture = {
.info = SNDRV_PCM_INFO_BLOCK_TRANSFER   |
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED  |
diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index ffad7f1..261620a 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -216,7 +216,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct 
snd_pcm_substream *subs,
return 0;
 }
 
-static struct snd_pcm_hardware snd_em28xx_hw_capture = {
+static const struct snd_pcm_hardware snd_em28xx_hw_capture = {
.info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP   |
SNDRV_PCM_INFO_INTERLEAVED|
diff --git a/drivers/media/usb/go7007/snd-go7007.c 
b/drivers/media/usb/go7007/snd-go7007.c
index 070871f..c618764 100644
--- a/drivers/media/usb/go7007/snd-go7007.c
+++ b/drivers/media/usb/go7007/snd-go7007.c
@@ -52,7 +52,7 @@ struct go7007_snd {
int capturing;
 };
 
-static struct snd_pcm_hardware go7007_snd_capture_hw = {
+static const struct snd_pcm_hardware go7007_snd_capture_hw = {
.info   = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
diff --git a/drivers/media/usb/tm6000/tm6000-alsa.c 
b/drivers/media/usb/tm6000/tm6000-alsa.c
index 4223225..3717a68 100644
--- a/drivers/media/usb/tm6000/tm6000-alsa.c
+++ b/drivers/media/usb/tm6000/tm6000-alsa.c
@@ -143,7 +143,7 @@ static int dsp_buffer_alloc(struct snd_pcm_substream 
*substream, int size)
  */
 #define DEFAULT_FIFO_SIZE  4096
 
-static struct snd_pcm_hardware snd_tm6000_digital_hw = {
+static const struct snd_pcm_hardware snd_tm6000_digital_hw = {
.info = SNDRV_PCM_INFO_BATCH |
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
diff --git a/drivers/media/usb/usbtv/usbtv-audio.c 
b/drivers/media/usb/usbtv/usbtv-audio.c
index 9db31db..2c2ca77 100644
--- a/drivers/media/usb/usbtv/usbtv-audio.c
+++ b/drivers/media/usb/usbtv/usbtv-audio.c
@@ -43,7 +43,7 @@
 
 #include "usbtv.h"
 
-static struct snd_pcm_hardware snd_usbtv_digital_hw = {
+static const struct snd_pcm_hardware snd_usbtv_digital_hw = {
.info = SNDRV_PCM_INFO_BATCH |
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
-- 
1.9.1

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


[PATCH 0/6] drivers: make snd_pcm_hardware const

2017-08-13 Thread Bhumika Goyal
Make snd_pcm_hardware structures const.

Bhumika Goyal (6):
  [media] usb: make snd_pcm_hardware const
  [media] pci: make snd_pcm_hardware const
  drm: bridge: dw-hdmi: make snd_pcm_hardware const
  usb: gadget: make snd_pcm_hardware const
  staging: bcm2835-audio:  make snd_pcm_hardware const
  [media] tuners: make snd_pcm_hardware const

 drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c   | 2 +-
 drivers/media/pci/cobalt/cobalt-alsa-pcm.c| 4 ++--
 drivers/media/pci/cx18/cx18-alsa-pcm.c| 2 +-
 drivers/media/pci/cx23885/cx23885-alsa.c  | 2 +-
 drivers/media/pci/cx25821/cx25821-alsa.c  | 2 +-
 drivers/media/pci/ivtv/ivtv-alsa-pcm.c| 2 +-
 drivers/media/pci/saa7134/saa7134-alsa.c  | 2 +-
 drivers/media/tuners/tda18271-maps.c  | 4 ++--
 drivers/media/usb/cx231xx/cx231xx-audio.c | 2 +-
 drivers/media/usb/em28xx/em28xx-audio.c   | 2 +-
 drivers/media/usb/go7007/snd-go7007.c | 2 +-
 drivers/media/usb/tm6000/tm6000-alsa.c| 2 +-
 drivers/media/usb/usbtv/usbtv-audio.c | 2 +-
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 4 ++--
 drivers/usb/gadget/function/u_audio.c | 2 +-
 15 files changed, 18 insertions(+), 18 deletions(-)

-- 
1.9.1

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


[PATCH 2/3] drm/panel: Add DT bindings for Ilitek ILI9322

2017-08-13 Thread Linus Walleij
This adds device tree bindings for the Ilitek ILI9322
320x240 TFT panel driver.

Cc: devicet...@vger.kernel.org
Signed-off-by: Linus Walleij 
---
 .../bindings/display/panel/ilitek,ili9322.txt  | 120 +
 1 file changed, 120 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/ilitek,ili9322.txt

diff --git a/Documentation/devicetree/bindings/display/panel/ilitek,ili9322.txt 
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9322.txt
new file mode 100644
index ..d619b1ad14a6
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9322.txt
@@ -0,0 +1,120 @@
+Ilitek ILI9322 TFT panel driver with SPI control bus
+
+This is a driver for 320x240 TFT panels, accepting a variety of input
+streams that get adapted and scaled to the panel. The panel output has
+960 TFT source driver pins and 240 TFT gate driver pins, VCOM, VCOML and
+VCOMH outputs.
+
+Required properties:
+  - compatible: "ilitek,ili9322"
+  - reg: address of the panel on the SPI bus
+
+Optional properties:
+  - width-mm: physical panel width [mm]
+  - height-mm: physical panel height [mm]
+  - vcc-supply: core voltage supply, see regulator/regulator.txt
+  - iovcc-supply: voltage supply for the interface input/output signals,
+see regulator/regulator.txt
+  - vci-supply: voltage supply for analog parts, see regulator/regulator.txt
+  - reset-gpios: a GPIO spec for the reset pin, see gpio/gpio.txt
+  - ilitek,vreg1out-microvolt: the output in microvolts for the VREGOUT1
+regulator used to drive the physical display. Valid ranges are 3600 thru
+6000 in 100 microvolt increments. If not specified, hardware defaults will
+be used (4.5V).
+  - ilitek,vcom-amplitude-percent: the percentage of VREGOUT1 used for the
+peak-to-peak amplitude of the communcation signals to the physical display.
+Valid ranges are 70 thru 132 percent in increments if two percent. Odd
+percentages will be truncated. If not specified, hardware defaults will be
+used (114%).
+  - ilitek,vcom-high-percent: the percentage of VREGOUT1 used for the peak
+voltage on the communications link. Valid ranges are 37 thru 100 percent.
+If not specified, hardware defaults will be used (91%).
+  - ilitek,gamma-correction-neg: a set of 8 nybbles describing negative
+gamma correction for voltages V1 thru V8. Valid range 0..15
+  - ilitek,gamma-correction-pos: a set of 8 nybbles describing positive
+gamma correction for voltages V1 thru V8. Valid range 0..15
+These adjust what grayscale voltage will be output for input data V1 = 0,
+V2 = 16, V3 = 48, V4 = 96, V5 = 160, V6 = 208, V7 = 240 and V8 = 255.
+The curve is shaped like this:
+
+^
+|V8
+|   V7
+|  V6
+|   V5
+|V4
+|V3
+| V2
+| V1
++--->
+  0   16 48  96 160208  240  255
+
+The negative and postive gamma values adjust the V1 thru V8 up/down
+according to the datasheet specifications. This is a property of the
+physical display connected to the display controller and may vary.
+If defined, both arrays must be supplied in full. If the properties
+are not supplied, hardware defaults will be used.
+
+  - ilitek,entry-mode: the panel can be connected to various input streams
+and four of them can be selected by electronic straps on the display.
+However it is possible to select another mode or override the
+electronic default with this property. Valid values:
+0: 8 bit serial RGB through
+1: 8 bit serial RGB aligned
+2: 8 bit serial RGB dummy 320x240
+3: 8 bit serial RGB dummy 360x240
+4: disabled
+5: 24 bit parallel RGB through
+6: 24 bit parallel RGB aligned
+7: 24 bit YUV 640Y 320CbCr
+8: 24 bit YUV 720Y 360CbCr
+9: disabled
+10: 8 bit ITU-R BT.656 720Y 360CbCr
+11: 8 bit ITU-R BT.656 640Y 320CbCr
+
+  The following optional properties only apply to RGB and YUV input modes and
+  can be omitted for BT.656 input modes:
+
+  - flip-horizontal: flip the image horizontally (right-to-left scan)
+  - flip-vertical: flip the image vertically (down-to-up scan)
+  - pixelclk-active: see display/panel/display-timing.txt
+  - de-active: see display/panel/display-timing.txt
+  - hsync-active: see display/panel/display-timing.txt
+  - vsync-active: see display/panel/display-timing.txt
+
+The panel must obey the rules for a SPI slave device as specified in
+spi/spi-bus.txt
+
+The device node can contain one 'port' child node with one child
+'endpoint' node, according to the bindings defined in
+media/video-interfaces.txt. This node should describe panel's video bus.
+

[PATCH 3/3] drm/panel: Add Ilitek ILI9322 driver

2017-08-13 Thread Linus Walleij
This adds support for the Ilitek ILI9322 QVGA (320x240)
TFT panel driver.

This panel driver supports serial or parallel RGB or
YUV input and also ITU-T BT.656 input streams.

The controller is combined with a physical panel and
configured through the device tree.

Signed-off-by: Linus Walleij 
---
 drivers/gpu/drm/panel/Kconfig|   8 +
 drivers/gpu/drm/panel/Makefile   |   1 +
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 936 +++
 3 files changed, 945 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-ilitek-ili9322.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index d84a031fae24..0159747c59fc 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -28,6 +28,14 @@ config DRM_PANEL_SIMPLE
  that it can be automatically turned off when the panel goes into a
  low power state.
 
+config DRM_PANEL_ILITEK_IL9322
+   tristate "Ilitek ILI9322 320x240 QVGA panels"
+   depends on OF && SPI
+   select REGMAP
+   help
+ Say Y here if you want to enable support for Ilitek IL9322
+ QVGA (320x240) RGB, YUV and ITU-T BT.656 panels.
+
 config DRM_PANEL_INNOLUX_P079ZCA
tristate "Innolux P079ZCA panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 9f6610d08b00..76f722aaa6ac 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
+obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9322.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
new file mode 100644
index ..7eed6814184e
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9322.c
@@ -0,0 +1,936 @@
+/*
+ * Ilitek ILI9322 TFT LCD drm_panel driver.
+ *
+ * This panel can be configured to support:
+ * - 8-bit serial RGB interface
+ * - 24-bit parallel RGB interface
+ * - 8-bit ITU-R BT.601 interface
+ * - 8-bit ITU-R BT.656 interface
+ * - Up to 320RGBx240 dots resolution TFT LCD displays
+ * - Scaling, brightness and contrast
+ *
+ * The scaling means that the display accepts a 640x480 or 720x480
+ * input and rescales it to fit to the 320x240 display. So what we
+ * present to the system is something else than what comes out on the
+ * actual display.
+ *
+ * Copyright (C) 2017 Linus Walleij 
+ * Derived from drivers/drm/gpu/panel/panel-samsung-ld9040.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define ILI9322_CHIP_ID0x00
+#define ILI9322_CHIP_ID_MAGIC  0x96
+
+/*
+ * Voltage on the communication interface, from 0.7 (0x00)
+ * to 1.32 (0x1f) times the VREG1OUT voltage in 2% increments.
+ * 1.00 (0x0f) is the default.
+ */
+#define ILI9322_VCOM_AMP   0x01
+
+/*
+ * High voltage on the communication signals, from 0.37 (0x00) to
+ * 1.0 (0x3f) times the VREGOUT1 voltage in 1% increments.
+ * 0.83 (0x2e) is the default.
+ */
+#define ILI9322_VCOM_HIGH  0x02
+
+/*
+ * VREG1 voltage regulator from 3.6V (0x00) to 6.0V (0x18) in 0.1V
+ * increments. 5.4V (0x12) is the default. This is the reference
+ * voltage for the VCOM levels and the greyscale level.
+ */
+#define ILI9322_VREG1_VOLTAGE  0x03
+
+/* Describes the incoming signal */
+#define ILI9322_ENTRY  0x06
+/* 0 = right-to-left, 1 = left-to-right (default), horizontal flip */
+#define ILI9322_ENTRY_HDIR BIT(0)
+/* 0 = down-to-up, 1 = up-to-down (default), vertical flip  */
+#define ILI9322_ENTRY_VDIR BIT(1)
+/* NTSC, PAL or autodetect */
+#define ILI9322_ENTRY_NTSC (0 << 2)
+#define ILI9322_ENTRY_PAL  (1 << 2)
+#define ILI9322_ENTRY_AUTODETECT   (3 << 2)
+/* Input format */
+#define ILI9322_ENTRY_SERIAL_RGB_THROUGH (0 << 4)
+#define ILI9322_ENTRY_SERIAL_RGB_ALIGNED (1 << 4)
+#define ILI9322_ENTRY_SERIAL_RGB_DUMMY_320X240 (2 << 4)
+#define ILI9322_ENTRY_SERIAL_RGB_DUMMY_360X240 (3 << 4)
+#define ILI9322_ENTRY_DISABLE_1(4 << 4)
+#define ILI9322_ENTRY_PARALLEL_RGB_THROUGH (5 << 4)
+#define ILI9322_ENTRY_PARALLEL_RGB_ALIGNED (6 << 4)
+#define ILI9322_ENTRY_YUV_640Y_320CBCR_25_54_MHZ (7 << 4)
+#define ILI9322_ENTRY_YUV_720Y_360CBCR_27_MHZ (8 << 4)
+#define ILI9322_ENTRY_DISABLE_2(9 << 4)
+#define 

[PATCH 1/3] dt-bindings: Add Ilitek vendor ID

2017-08-13 Thread Linus Walleij
Ili Technology Corporation (Ilitek) is a vendor of display drivers
and touch input controllers for embedded devices.

Cc: devicet...@vger.kernel.org
Signed-off-by: Linus Walleij 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index daf465bef758..3e7e33484e5b 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -147,6 +147,7 @@ i2seI2SE GmbH
 ibmInternational Business Machines (IBM)
 idtIntegrated Device Technologies, Inc.
 ifiIngenieurburo Fur Ic-Technologie (I/F/I)
+ilitek Ili Technology Corporation
 imgImagination Technologies Ltd.
 infineon Infineon Technologies
 inforceInforce Computing
-- 
2.13.4

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


[Bug 196615] amdgpu - resume from suspend is no longer working on rx480

2017-08-13 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=196615

--- Comment #5 from Peter Spiess-Knafl (p...@autistici.org) ---
Alex, do you need further infos?

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