[Bug 97585] Genymotion won't start on 12.1

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97585

Bug ID: 97585
   Summary: Genymotion won't start on 12.1
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: darekdeoniziak at gmail.com
QA Contact: dri-devel at lists.freedesktop.org

I use genymotion (virtualbox based android emulator) Since I updated drivers to
use oibaf PPA I can't start genymotion emulator device with DRI_PRIME=1, it
hangs at loading screen. But by checking running processes it looks like device
runs in the background.

The problem with genymotion occured to me while using DRI_PRIME=1 genymotion
after updating drivers using oibaf ppa:
https://launchpad.net/~oibaf/+archive/ubuntu/graphics-drivers on Ubuntu 16.04.

I have Dell Inspirion 7548 with Radeon Opal R7 M265. Genymotion on Intel 5500
Broadwell G2 still works.

DRI_PRIME=1 glxinfo OpenGL renderer: Gallium 0.4 on AMD OLAND (DRM 2.43.0 /
4.4.0-36-generic, LLVM 3.9.0)

DRI_PRIME=1 glxinfo OpenGL version: OpenGL version string: 3.0 Mesa
12.1.0-devel

While running genymotion with DRI_PRIME=1 and LIBGL_DEBUG=verbose I am getting
these errors: http://pastebin.com/VFqgRDt8

The main panel does start, I can select different options, problem happens when
I want to run genymotion device (in above case Samsung Galaxy S3 was runned).
The log from genymotion-player.log is: http://pastebin.com/UG3hmGCx

I've searched around the web and added this to my .profile:
export LD_PRELOAD='/usr/$LIB/libstdc++.so.6'
export DISPLAY=:0

That helped with running steam using DRI_PRIME=1 but not genymotion device.

Also part from genymotion.log for starting device, nothing seems to be wrong
here: http://pastebin.com/dCv9Y6uq

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


[Bug 97585] Genymotion won't start on 12.1

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97585

--- Comment #1 from Darek Deoniziak  ---
Just in case.

"nie można otworzyć pliku obiektu dzielonego: Nie ma takiego pliku ani
katalogu" 

means: "can't open file of shared object: no such file or directory"

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


[PATCH] drm: amdgpu: add missing header dependencies

2016-09-03 Thread Christian König
Am 03.09.2016 um 08:01 schrieb Baoyou Xie:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c:113:6: warning: no previous prototype 
> for 'amdgpu_pll_compute' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/cz_smc.c:38:10: warning: no previous prototype for 
> 'cz_get_argument' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/cz_smc.c:302:5: warning: no previous prototype for 
> 'cz_smu_start' [-Wmissing-prototypes]
> 
>
> In fact, these functions are declared in
> drivers/gpu/drm/amd/amdgpu/atombios_i2c.h
> drivers/gpu/drm/amd/amdgpu/amdgpu_pll.h
> drivers/gpu/drm/amd/amdgpu/cz_dpm.h
> drivers/gpu/drm/amd/amdgpu/vi_dpm.h.
> So this patch adds missing header dependencies.
>
> Signed-off-by: Baoyou Xie 

Reviewed-by: Christian König .

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c   | 1 +
>   drivers/gpu/drm/amd/amdgpu/atombios_i2c.c | 1 +
>   drivers/gpu/drm/amd/amdgpu/cz_smc.c   | 2 ++
>   3 files changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c
> index d153149..8e67c12 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c
> @@ -25,6 +25,7 @@
>   #include "amdgpu.h"
>   #include "atom.h"
>   #include "atombios_encoders.h"
> +#include "amdgpu_pll.h"
>   #include 
>   #include 
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c 
> b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
> index bc56c8a..b374653 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
> @@ -27,6 +27,7 @@
>   #include "amdgpu.h"
>   #include "atom.h"
>   #include "amdgpu_atombios.h"
> +#include "atombios_i2c.h"
>   
>   #define TARGET_HW_I2C_CLOCK 50
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c 
> b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> index c80c2e9..95887e4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> @@ -29,6 +29,8 @@
>   #include "cz_smumgr.h"
>   #include "smu_ucode_xfer_cz.h"
>   #include "amdgpu_ucode.h"
> +#include "cz_dpm.h"
> +#include "vi_dpm.h"
>   
>   #include "smu/smu_8_0_d.h"
>   #include "smu/smu_8_0_sh_mask.h"




[PATCH] drm: amdgpu: mark symbols static where possible

2016-09-03 Thread Christian König
Am 03.09.2016 um 07:57 schrieb Baoyou Xie:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/cz_smc.c:51:5: warning: no previous prototype for 
> 'cz_send_msg_to_smc_async' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/cz_smc.c:143:5: warning: no previous prototype for 
> 'cz_write_smc_sram_dword' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/iceland_smc.c:124:6: warning: no previous 
> prototype for 'iceland_start_smc' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:3926:6: warning: no previous prototype 
> for 'gfx_v8_0_rlc_stop' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c:94:6: warning: no previous prototype 
> for 'amdgpu_job_free_cb' [-Wmissing-prototypes]
> 
>
> In fact, these functions are only used in the file in which they are
> declared and don't need a declaration, but can be made static.
> So this patch marks these functions with 'static'.
>
> Signed-off-by: Baoyou Xie 

Reviewed-by: Christian König .

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c  | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c   | 2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_job.c  | 2 +-
>   drivers/gpu/drm/amd/amdgpu/cz_smc.c  | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c| 2 +-
>   drivers/gpu/drm/amd/amdgpu/iceland_smc.c | 8 
>   6 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
> index bc0440f..a831218 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
> @@ -616,7 +616,7 @@ static int amdgpu_cgs_irq_put(struct cgs_device 
> *cgs_device, unsigned src_id, un
>   return amdgpu_irq_put(adev, adev->irq.sources[src_id], type);
>   }
>   
> -int amdgpu_cgs_set_clockgating_state(struct cgs_device *cgs_device,
> +static int amdgpu_cgs_set_clockgating_state(struct cgs_device *cgs_device,
> enum amd_ip_block_type block_type,
> enum amd_clockgating_state state)
>   {
> @@ -637,7 +637,7 @@ int amdgpu_cgs_set_clockgating_state(struct cgs_device 
> *cgs_device,
>   return r;
>   }
>   
> -int amdgpu_cgs_set_powergating_state(struct cgs_device *cgs_device,
> +static int amdgpu_cgs_set_powergating_state(struct cgs_device *cgs_device,
> enum amd_ip_block_type block_type,
> enum amd_powergating_state state)
>   {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 0307ff5..f65bdaf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -287,7 +287,7 @@ static u64 amdgpu_cs_get_threshold_for_moves(struct 
> amdgpu_device *adev)
>   return max(bytes_moved_threshold, 1024*1024ull);
>   }
>   
> -int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
> +static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
>   struct list_head *validated)
>   {
>   struct amdgpu_bo_list_entry *lobj;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 6674d40..31bfe3a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -91,7 +91,7 @@ void amdgpu_job_free_resources(struct amdgpu_job *job)
>   amdgpu_ib_free(job->adev, &job->ibs[i], f);
>   }
>   
> -void amdgpu_job_free_cb(struct amd_sched_job *s_job)
> +static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
>   {
>   struct amdgpu_job *job = container_of(s_job, struct amdgpu_job, base);
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c 
> b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> index ac7fee7..c80c2e9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> @@ -48,7 +48,7 @@ static struct cz_smu_private_data *cz_smu_get_priv(struct 
> amdgpu_device *adev)
>   return priv;
>   }
>   
> -int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
> +static int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
>   {
>   int i;
>   u32 content = 0, tmp;
> @@ -140,7 +140,7 @@ int cz_read_smc_sram_dword(struct amdgpu_device *adev, 
> u32 smc_address,
>   return 0;
>   }
>   
> -int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address,
> +static int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 
> smc_address,
>   u32 value, u32 limit)
>   {
>   int ret;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index bff8668..6997f7c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -3923,7 +3923,7 @@ static void gfx_v8_0_init_pg(struct amdgpu_device *adev)
>   }
>   }
>   
> -void gfx_v8_0_rlc_stop(str

[PATCH] drm: amdgpu: mark symbols static where possible

2016-09-03 Thread Huang Rui
On Sat, Sep 03, 2016 at 01:57:14PM +0800, Baoyou Xie wrote:
> We get a few warnings when building kernel with W=1:
> drivers/gpu/drm/amd/amdgpu/cz_smc.c:51:5: warning: no previous prototype for 
> 'cz_send_msg_to_smc_async' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/cz_smc.c:143:5: warning: no previous prototype for 
> 'cz_write_smc_sram_dword' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/iceland_smc.c:124:6: warning: no previous 
> prototype for 'iceland_start_smc' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:3926:6: warning: no previous prototype 
> for 'gfx_v8_0_rlc_stop' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/amdgpu_job.c:94:6: warning: no previous prototype 
> for 'amdgpu_job_free_cb' [-Wmissing-prototypes]
> 
> 
> In fact, these functions are only used in the file in which they are
> declared and don't need a declaration, but can be made static.
> So this patch marks these functions with 'static'.
> 
> Signed-off-by: Baoyou Xie 

Thanks.

Acked-by: Huang Rui 


[PATCH] drm/fsl-dcu: Add gamma set for crtc

2016-09-03 Thread Mark Brown
On Fri, Sep 02, 2016 at 02:22:46PM -0700, Stefan Agner wrote:
> Hi Meng, hi Mark,
> 
> [added Mark Brown to discuss the endian issue]

Please delete unneeded context from mails when replying.  Doing this
makes it much easier to find your reply in the message, helping ensure
it won't be missed by people scrolling through the irrelevant quoted
material.

> > + */
> > +static u32 swap_bytes(u16 var)

> We certainly don't want a byte swapping function in the driver. I am
> sure Linux has appropriate functions for that already, however, I am not
> convinced that we need that at all.

cpu_to_be16() and so on.

> I guess the problem is that regmap_write does byte swapping because
> ls1021a.dtsi defines the whole DCU register space to be big-endian. So
> you end up doing byte swapping twice.

> If the gamma area is really little-endian, then DCU on LS1021a seems to
> be quite a mess... :-(

Let's figure out what the hardware does first, espcially given that it's
this chip where we seem to be seeing a lot of confusion about endianness
issues.

> @Mark, what do you think? Do we have a (better) solution for such cases?

Is this area of the register map perhaps supposed to be accessed as a
byte stream?

Please don't add randomm characters that don't mean anything before
people's names, it doesn't help make things legible especially when
they're scanning through enormous quantities of text.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160903/40a6d8b2/attachment.sig>


[Bug 95358] Tonga no hdmi audio on DAL 4.7 works on DAL 4.6

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=95358

Andy Furniss  changed:

   What|Removed |Added

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

--- Comment #6 from Andy Furniss  ---
I guess DAL work is all happening in the staging branches now and with current
amd-staging-4.7 HDMI sound is working OK for me.

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


[Bug 97409] Tonga lock up on boot with amd-staging-4.6/7 since drm/amd/dal: track display state based on sink and stream for freesync

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97409

Andy Furniss  changed:

   What|Removed |Added

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

--- Comment #1 from Andy Furniss  ---
Current revisions of amd-staging-4.6/7  are working OK for me.

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


[PATCH v5 6/7] drm: add SimpleDRM driver

2016-09-03 Thread David Herrmann
Hey

On Sat, Sep 3, 2016 at 2:01 PM, Noralf Trønnes  wrote:
>
> Den 02.09.2016 10:22, skrev David Herrmann:
>>
>> The SimpleDRM driver binds to simple-framebuffer devices and provides a
>> DRM/KMS API. It provides only a single CRTC+encoder+connector combination
>> plus one initial mode.
>>
>> Userspace can create dumb-buffers which can be blit into the real
>> framebuffer similar to UDL. No access to the real framebuffer is allowed
>> (compared to earlier version of this driver) to avoid security issues.
>> Furthermore, this way we can support arbitrary modes as long as we have a
>> conversion-helper.
>>
>> Signed-off-by: David Herrmann 
>> ---
>
>
> [...]
>
>> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c
>> b/drivers/gpu/drm/simpledrm/simpledrm_drv.c
>
>
> [...]
>
>> +static int sdrm_fop_mmap(struct file *file, struct vm_area_struct *vma)
>> +{
>> +   struct drm_file *dfile = file->private_data;
>> +   struct drm_device *dev = dfile->minor->dev;
>> +   struct drm_gem_object *obj = NULL;
>> +   struct drm_vma_offset_node *node;
>> +   int r;
>> +
>> +   drm_vma_offset_lock_lookup(dev->vma_offset_manager);
>> +   node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager,
>> + vma->vm_pgoff,
>> + vma_pages(vma));
>> +   if (likely(node)) {
>> +   obj = container_of(node, struct drm_gem_object, vma_node);
>> +   if (!kref_get_unless_zero(&obj->refcount))
>> +   obj = NULL;
>> +   }
>> +   drm_vma_offset_unlock_lookup(dev->vma_offset_manager);
>> +
>> +   if (!obj)
>> +   return -EINVAL;
>> +
>> +   if (!drm_vma_node_is_allowed(node, dfile)) {
>
>
> I get:
> drivers/gpu/drm/simpledrm/simpledrm_drv.c:320:2: warning: passing argument 2
> of ‘drm_vma_node_is_allowed’ from incompatible pointer type [enabled by
> default]
>
> dfile -> file

Yeah, either change that, or apply "[PATCH 0/6] DRM Core Cleanups"
before. I suspect the cleanups to go in before this driver, so didn't
bother changing it.

>> +   drm_gem_object_unreference_unlocked(obj);
>> +   return -EACCES;
>> +   }
>> +
>> +   if (vma->vm_file)
>> +   fput(vma->vm_file);
>> +   vma->vm_file = get_file(obj->filp);
>> +   vma->vm_pgoff = 0;
>> +
>> +   r = obj->filp->f_op->mmap(obj->filp, vma);
>> +   drm_gem_object_unreference_unlocked(obj);
>> +   return r;
>> +}
>
>
> [...]
>
>> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_kms.c
>> b/drivers/gpu/drm/simpledrm/simpledrm_kms.c
>
>
> [...]
>
>
>> +static void sdrm_crtc_send_vblank_event(struct drm_crtc *crtc)
>> +{
>> +   if (crtc->state && crtc->state->event) {
>> +   spin_lock_irq(&crtc->dev->event_lock);
>> +   drm_crtc_send_vblank_event(crtc, crtc->state->event);
>> +   spin_unlock_irq(&crtc->dev->event_lock);
>> +   crtc->state->event = NULL;
>> +   }
>> +}
>> +
>> +void sdrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
>> + struct drm_plane_state *plane_state)
>> +{
>> +   struct drm_framebuffer *dfb = pipe->plane.state->fb;
>> +   struct sdrm_fb *fb;
>> +
>> +   sdrm_crtc_send_vblank_event(&pipe->crtc);
>> +
>> +   if (dfb) {
>> +   fb = container_of(dfb, struct sdrm_fb, base);
>> +   pipe->plane.fb = dfb;
>> +   sdrm_dirty(fb, 0, 0, dfb->width, dfb->height);
>> +   }
>> +}
>> +
>> +static void sdrm_display_pipe_enable(struct drm_simple_display_pipe
>> *pipe,
>> +struct drm_crtc_state *crtc_state)
>> +{
>> +   sdrm_crtc_send_vblank_event(&pipe->crtc);
>> +}
>> +
>> +static void sdrm_display_pipe_disable(struct drm_simple_display_pipe
>> *pipe)
>> +{
>> +   sdrm_crtc_send_vblank_event(&pipe->crtc);
>> +}
>> +
>> +static const struct drm_simple_display_pipe_funcs sdrm_pipe_funcs = {
>> +   .update = sdrm_display_pipe_update,
>> +   .enable = sdrm_display_pipe_enable,
>> +   .disable= sdrm_display_pipe_disable,
>> +};
>
>
> The enable and disable callbacks can be removed.
> This commit in drm-misc fixed the flip done timeout:
> drm/simple-helpers: Always add planes to the state update

Right, Daniel told me on IRC already. With this fix applied, I can run
Xorg on top of it just fine.

I dropped the enable/disable callbacks as well now.

Thanks
David


[PATCH v5 4/7] video: add generic framebuffer eviction

2016-09-03 Thread Noralf Trønnes

Den 02.09.2016 10:22, skrev David Herrmann:
> There are several situations where we want hardware handover from an early
> boot GFX driver (e.g., vgacon, vesafb, efifb, simplefb) to a full fletched
> GFX driver (e.g., most DRM drivers). So far, we relied on
> remove_conflicting_framebuffers() to do this for us, however, this had a
> bunch of downsides:
>
>o It only removes conflicting fbdev drivers. It does not drop vgacon,
>  early boot console drivers, conflicting DRM drivers, etc.
>
>o It only unloads the fbdev driver, it does not modify the underlying
>  device or resources. In case of "screen_info" drivers (e.g., efifb)
>  this is fine, since no resources are pinned. However, if the driver
>  binds to a platform-device like "simple-framebuffer", we must make
>  sure to unregister that device as well. Otherwise, pinned resources
>  like IORESOURCE_MEM stay around, triggering WARN_ONs if the following
>  driver requests those resources.
>
>o It is only available if CONFIG_FB is selected.
>
> This commit adds a new infrastructure that manages system-framebuffers
> (short: sysfb). The initial commit provides conflict-resolution for
> system-framebuffers. At its core it provides sysfb_evict_conflicts(),
> which implements conflict detection and removal for all known types of
> GFX driver hand-overs. So far, this includes platform-device removal,
> fbdev-firmware-device removal, vgacon removal and VBE detection. To
> further simplify the callers, it also provides helpers to figure out what
> hand-over to do, based on the device the new drivers binds to:
>
>o PCI drivers can use sysfb_evict_conflicts_pci(), which will figure out
>  the apertures automatically, and does VGA/VBE detection.
>
>o Generic firmware drivers that might be shadowed at any address in
>  memory can use sysfb_evict_conflicts_firmware(), basically removing
>  *all* firmware framebuffers in effect.
>
> This only adds the generic sysfb helpers. No users are converted, yet.
>
> Signed-off-by: David Herrmann 
> ---
>   drivers/video/Kconfig  |   4 +
>   drivers/video/Makefile |   1 +
>   drivers/video/sysfb.c  | 327 
> +
>   include/linux/sysfb.h  |  34 +
>   4 files changed, 366 insertions(+)
>   create mode 100644 drivers/video/sysfb.c
>   create mode 100644 include/linux/sysfb.h
>
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 3c20af9..56a8294 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -36,6 +36,10 @@ config VIDEOMODE_HELPERS
>   config HDMI
>   bool
>   
> +config SYSFB
> + bool
> + select DUMMY_CONSOLE if VT
> +
>   if VT
>   source "drivers/video/console/Kconfig"
>   endif
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index 9ad3c17..df7bd75 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -1,5 +1,6 @@
>   obj-$(CONFIG_VGASTATE)+= vgastate.o
>   obj-$(CONFIG_HDMI)+= hdmi.o
> +obj-$(CONFIG_SYSFB)+= sysfb.o
>   
>   obj-$(CONFIG_VT)  += console/
>   obj-$(CONFIG_LOGO)+= logo/
> diff --git a/drivers/video/sysfb.c b/drivers/video/sysfb.c
> new file mode 100644
> index 000..00585c9
> --- /dev/null
> +++ b/drivers/video/sysfb.c
> @@ -0,0 +1,327 @@
> +/*
> + * Copyright (C) 2013-2016 Red Hat, Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as published by 
> the
> + * Free Software Foundation; either version 2.1 of the License, or (at your
> + * option) any later version.
> + */
> +
> +#define pr_fmt(fmt) "sysfb: " fmt
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +static bool sysfb_evict_match_resource(struct sysfb_evict_ctx *ctx,
> +struct resource *mem)
> +{
> + struct aperture *g;
> + unsigned int i;
> +
> + for (i = 0; i < ctx->ap->count; ++i) {
> + g = &ctx->ap->ranges[i];
> +
> + if (mem->start == g->base)
> + return true;
> + if (mem->start >= g->base && mem->end < g->base + g->size)
> + return true;
> + if ((ctx->flags & SYSFB_EVICT_VBE) && mem->start == 0xA)
> + return true;
> + }
> +
> + return false;
> +}
> +
> +static int sysfb_evict_platform_device(struct device *dev, void *userdata)
> +{
> + struct sysfb_evict_ctx *ctx = userdata;
> + struct platform_device *pdev = to_platform_device(dev);
> + struct resource *mem;
> +
> + if (!pdev->name)
> + return 0;
> +
> + if (!strcmp(pdev->name, "simple-framebuffer")) {

This doesn't work in my case where the device comes from DT and the name
also contains the addre

[PATCH v5 6/7] drm: add SimpleDRM driver

2016-09-03 Thread Noralf Trønnes

Den 02.09.2016 10:22, skrev David Herrmann:
> The SimpleDRM driver binds to simple-framebuffer devices and provides a
> DRM/KMS API. It provides only a single CRTC+encoder+connector combination
> plus one initial mode.
>
> Userspace can create dumb-buffers which can be blit into the real
> framebuffer similar to UDL. No access to the real framebuffer is allowed
> (compared to earlier version of this driver) to avoid security issues.
> Furthermore, this way we can support arbitrary modes as long as we have a
> conversion-helper.
>
> Signed-off-by: David Herrmann 
> ---

[...]

> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_drv.c 
> b/drivers/gpu/drm/simpledrm/simpledrm_drv.c

[...]

> +static int sdrm_fop_mmap(struct file *file, struct vm_area_struct *vma)
> +{
> + struct drm_file *dfile = file->private_data;
> + struct drm_device *dev = dfile->minor->dev;
> + struct drm_gem_object *obj = NULL;
> + struct drm_vma_offset_node *node;
> + int r;
> +
> + drm_vma_offset_lock_lookup(dev->vma_offset_manager);
> + node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager,
> +   vma->vm_pgoff,
> +   vma_pages(vma));
> + if (likely(node)) {
> + obj = container_of(node, struct drm_gem_object, vma_node);
> + if (!kref_get_unless_zero(&obj->refcount))
> + obj = NULL;
> + }
> + drm_vma_offset_unlock_lookup(dev->vma_offset_manager);
> +
> + if (!obj)
> + return -EINVAL;
> +
> + if (!drm_vma_node_is_allowed(node, dfile)) {

I get:
drivers/gpu/drm/simpledrm/simpledrm_drv.c:320:2: warning: passing 
argument 2 of ‘drm_vma_node_is_allowed’ from incompatible pointer type 
[enabled by default]

dfile -> file

> + drm_gem_object_unreference_unlocked(obj);
> + return -EACCES;
> + }
> +
> + if (vma->vm_file)
> + fput(vma->vm_file);
> + vma->vm_file = get_file(obj->filp);
> + vma->vm_pgoff = 0;
> +
> + r = obj->filp->f_op->mmap(obj->filp, vma);
> + drm_gem_object_unreference_unlocked(obj);
> + return r;
> +}

[...]

> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_kms.c 
> b/drivers/gpu/drm/simpledrm/simpledrm_kms.c

[...]

> +static void sdrm_crtc_send_vblank_event(struct drm_crtc *crtc)
> +{
> + if (crtc->state && crtc->state->event) {
> + spin_lock_irq(&crtc->dev->event_lock);
> + drm_crtc_send_vblank_event(crtc, crtc->state->event);
> + spin_unlock_irq(&crtc->dev->event_lock);
> + crtc->state->event = NULL;
> + }
> +}
> +
> +void sdrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
> +   struct drm_plane_state *plane_state)
> +{
> + struct drm_framebuffer *dfb = pipe->plane.state->fb;
> + struct sdrm_fb *fb;
> +
> + sdrm_crtc_send_vblank_event(&pipe->crtc);
> +
> + if (dfb) {
> + fb = container_of(dfb, struct sdrm_fb, base);
> + pipe->plane.fb = dfb;
> + sdrm_dirty(fb, 0, 0, dfb->width, dfb->height);
> + }
> +}
> +
> +static void sdrm_display_pipe_enable(struct drm_simple_display_pipe *pipe,
> +  struct drm_crtc_state *crtc_state)
> +{
> + sdrm_crtc_send_vblank_event(&pipe->crtc);
> +}
> +
> +static void sdrm_display_pipe_disable(struct drm_simple_display_pipe *pipe)
> +{
> + sdrm_crtc_send_vblank_event(&pipe->crtc);
> +}
> +
> +static const struct drm_simple_display_pipe_funcs sdrm_pipe_funcs = {
> + .update = sdrm_display_pipe_update,
> + .enable = sdrm_display_pipe_enable,
> + .disable= sdrm_display_pipe_disable,
> +};

The enable and disable callbacks can be removed.
This commit in drm-misc fixed the flip done timeout:
drm/simple-helpers: Always add planes to the state update


Noralf.



[PATCH v5 7/7] drm/simpledrm: add fbdev fallback support

2016-09-03 Thread Noralf Trønnes

Den 02.09.2016 10:22, skrev David Herrmann:
> Create a simple fbdev device during SimpleDRM setup so legacy user-space
> and fbcon can use it.
>
> Signed-off-by: David Herrmann 

[...]

> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_fbdev.c 
> b/drivers/gpu/drm/simpledrm/simpledrm_fbdev.c

[...]

> +void sdrm_fbdev_bind(struct sdrm_device *sdrm)
> +{
> + struct drm_fb_helper *fbdev;
> + int r;
> +
> + fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
> + if (!fbdev)
> + return;
> +
> + drm_fb_helper_prepare(sdrm->ddev, fbdev, &sdrm_fbdev_funcs);
> +
> + r = drm_fb_helper_init(sdrm->ddev, fbdev, 1, 1);
> + if (r < 0)
> + goto error;
> +
> + r = drm_fb_helper_single_add_all_connectors(fbdev);
> + if (r < 0)
> + goto error;
> +
> + r = drm_fb_helper_initial_config(fbdev,
> + sdrm->ddev->mode_config.preferred_depth);
> + if (r < 0)
> + goto error;
> +
> + if (!fbdev->fbdev)
> + goto error;
> +
> + sdrm->fbdev = fbdev;
> + return;
> +
> +error:
> + drm_fb_helper_fini(fbdev);
> + kfree(fbdev);
> +}
> +
> +void sdrm_fbdev_unbind(struct sdrm_device *sdrm)
> +{
> + struct drm_fb_helper *fbdev = sdrm->fbdev;
> +
> + if (!fbdev)
> + return;
> +
> + sdrm->fbdev = NULL;
> + drm_fb_helper_unregister_fbi(fbdev);
> + cancel_work_sync(&fbdev->dirty_work);
> + drm_fb_helper_release_fbi(fbdev);
> + drm_framebuffer_unreference(fbdev->fb);

I get a warning that there are still fb's left during unbind:

[   48.666003] WARNING: CPU: 0 PID: 716 at 
drivers/gpu/drm/drm_crtc.c:3855 drm_mode_config_cleanup+0x180/0x1f4 [drm]

This worked:

-   drm_framebuffer_unreference(fbdev->fb);
+   drm_framebuffer_unregister_private(fbdev->fb);
+   drm_framebuffer_cleanup(fbdev->fb);


Noralf.

> + fbdev->fb = NULL;
> + drm_fb_helper_fini(fbdev);
> + kfree(fbdev);
> +}



[Bug 97585] Genymotion won't start on 12.1

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97585

--- Comment #2 from Nicolai Hähnle  ---
This seems to be the crucial message:

libGL: dlopen /usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so failed
(/usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so: undefined symbol:
drmFreeDevice)

drmFreeDevice should be provided by libdrm. You can use `ldd
/usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so` or additional LD_DEBUG flags to
check where libdrm.so comes from. Probably something went wrong while
installing the PPA.

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


[PATCH v5 5/7] drm: switch to sysfb_evict_conflicts()

2016-09-03 Thread Noralf Trønnes

Den 02.09.2016 10:22, skrev David Herrmann:
> Switch over all DRM drivers to use the new sysfb_evict_conflicts()
> infrastructure. The only non-trivial conversion is i915, since it does not
> make use of the generic PCI resources, but assembles the apertures via
> intel ggtt queries.
>
> Signed-off-by: David Herrmann 
> ---

This doesn't apply now with Daniel's wrapper added:
drm_fb_helper_remove_conflicting_framebuffers().

Noralf.

>   drivers/gpu/drm/Kconfig  |  1 +
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c  | 24 +--
>   drivers/gpu/drm/bochs/bochs_drv.c| 19 +
>   drivers/gpu/drm/i915/i915_drv.c  | 73 
> ++--
>   drivers/gpu/drm/mgag200/mgag200_drv.c| 27 +++-
>   drivers/gpu/drm/mgag200/mgag200_main.c   |  9 
>   drivers/gpu/drm/nouveau/nouveau_drm.c| 33 +++
>   drivers/gpu/drm/radeon/radeon_drv.c  | 24 +--
>   drivers/gpu/drm/sun4i/sun4i_drv.c| 24 +++
>   drivers/gpu/drm/vc4/vc4_drv.c| 25 +++
>   drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 24 +--
>   11 files changed, 44 insertions(+), 239 deletions(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index fc35731..f27f9b5 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -12,6 +12,7 @@ menuconfig DRM
>   select I2C
>   select I2C_ALGOBIT
>   select DMA_SHARED_BUFFER
> + select SYSFB
>   help
> Kernel-level support for the Direct Rendering Infrastructure (DRI)
> introduced in XFree86 4.0. If you say Y here, you need to select
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 9aa533c..a1e67da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -38,6 +38,7 @@
>   #include 
>   #include 
>   #include 
> +#include 
>   #include 
>   #include "drm_crtc_helper.h"
>   
> @@ -326,27 +327,6 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
>   
>   static struct drm_driver kms_driver;
>   
> -static int amdgpu_kick_out_firmware_fb(struct pci_dev *pdev)
> -{
> - struct apertures_struct *ap;
> - bool primary = false;
> -
> - ap = alloc_apertures(1);
> - if (!ap)
> - return -ENOMEM;
> -
> - ap->ranges[0].base = pci_resource_start(pdev, 0);
> - ap->ranges[0].size = pci_resource_len(pdev, 0);
> -
> -#ifdef CONFIG_X86
> - primary = pdev->resource[PCI_ROM_RESOURCE].flags & 
> IORESOURCE_ROM_SHADOW;
> -#endif
> - remove_conflicting_framebuffers(ap, "amdgpudrmfb", primary);
> - kfree(ap);
> -
> - return 0;
> -}
> -
>   static int amdgpu_pci_probe(struct pci_dev *pdev,
>   const struct pci_device_id *ent)
>   {
> @@ -368,7 +348,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>   return ret;
>   
>   /* Get rid of things like offb */
> - ret = amdgpu_kick_out_firmware_fb(pdev);
> + ret = sysfb_evict_conflicts_pci(pdev);
>   if (ret)
>   return ret;
>   
> diff --git a/drivers/gpu/drm/bochs/bochs_drv.c 
> b/drivers/gpu/drm/bochs/bochs_drv.c
> index abace82..99c4ea3 100644
> --- a/drivers/gpu/drm/bochs/bochs_drv.c
> +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> @@ -8,6 +8,7 @@
>   #include 
>   #include 
>   #include 
> +#include 
>   
>   #include "bochs.h"
>   
> @@ -143,28 +144,12 @@ static const struct dev_pm_ops bochs_pm_ops = {
>   /* -- */
>   /* pci interface  */
>   
> -static int bochs_kick_out_firmware_fb(struct pci_dev *pdev)
> -{
> - struct apertures_struct *ap;
> -
> - ap = alloc_apertures(1);
> - if (!ap)
> - return -ENOMEM;
> -
> - ap->ranges[0].base = pci_resource_start(pdev, 0);
> - ap->ranges[0].size = pci_resource_len(pdev, 0);
> - remove_conflicting_framebuffers(ap, "bochsdrmfb", false);
> - kfree(ap);
> -
> - return 0;
> -}
> -
>   static int bochs_pci_probe(struct pci_dev *pdev,
>  const struct pci_device_id *ent)
>   {
>   int ret;
>   
> - ret = bochs_kick_out_firmware_fb(pdev);
> + ret = sysfb_evict_conflicts_pci(pdev);
>   if (ret)
>   return ret;
>   
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 95ddd56..4d6a65dd 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -36,6 +36,7 @@
>   #include 
>   #include 
>   #include 
> +#include 
>   #include 
>   #include 
>   #include 
> @@ -687,70 +688,32 @@ out:
>   return ret;
>   }
>   
> -#if IS_ENABLED(CONFIG_FB)
>   static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
>   {
> - struct apertures_struct *ap;
> + struct sysfb_evict_ctx ctx = {};
>   struct pci_dev *pdev = dev_priv->drm.pdev;
>   struct i91

[Bug 97585] Genymotion won't start on 12.1

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97585

--- Comment #3 from Darek Deoniziak  ---
Thanks, this is the output of `ldd
/usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so`: http://pastebin.com/TwYQAtr8

And this is `LD_DEBUG=libs ldd /usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so`:
http://pastebin.com/JwhtLSYH

Not sure how the output is supposed to look like or how to read it to find the
problem.

Can I solve the problem without rolling back the ppa? Or it would be best to
stick with default drivers provided in Ubuntu repositories (I think it is mesa
11.0 in Ubuntu 16.04)?

Everything works rather fine except the genymotion. "Rather" because I still
have few different issues with amdgpu drivers, but I had these too before
installing new ppa. It's subject for different report, but since I did mention
it here already can I ask where to report this issue for amdgpu (open source
ones, not pro): Some programs (like Steam client, genymotion emulator before it
stopped working) runned in window mode with amdgpu don't draw content until I
resize the window. Or maybe these issues are related?

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


[Bug 97585] Genymotion won't start on 12.1

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97585

--- Comment #4 from Nicolai Hähnle  ---
Thanks. The LD_DEBUG output is only really useful if it comes from the failed
genymotion session. Can you provide that?

Also, what does `objdump -T /usr/lib/x86_64-linux-gnu/libdrm.so.2 | grep
drmFreeDevice` say?

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


[PATCH v5 7/7] drm/simpledrm: add fbdev fallback support

2016-09-03 Thread Noralf Trønnes

Den 03.09.2016 14:04, skrev Noralf Trønnes:
>
> Den 02.09.2016 10:22, skrev David Herrmann:
>> Create a simple fbdev device during SimpleDRM setup so legacy user-space
>> and fbcon can use it.
>>
>> Signed-off-by: David Herrmann 
>
> [...]
>
>> diff --git a/drivers/gpu/drm/simpledrm/simpledrm_fbdev.c 
>> b/drivers/gpu/drm/simpledrm/simpledrm_fbdev.c
>
> [...]
>
>> +void sdrm_fbdev_bind(struct sdrm_device *sdrm)
>> +{
>> +struct drm_fb_helper *fbdev;
>> +int r;
>> +
>> +fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
>> +if (!fbdev)
>> +return;
>> +
>> +drm_fb_helper_prepare(sdrm->ddev, fbdev, &sdrm_fbdev_funcs);
>> +
>> +r = drm_fb_helper_init(sdrm->ddev, fbdev, 1, 1);
>> +if (r < 0)
>> +goto error;
>> +
>> +r = drm_fb_helper_single_add_all_connectors(fbdev);
>> +if (r < 0)
>> +goto error;
>> +
>> +r = drm_fb_helper_initial_config(fbdev,
>> +sdrm->ddev->mode_config.preferred_depth);
>> +if (r < 0)
>> +goto error;
>> +
>> +if (!fbdev->fbdev)
>> +goto error;
>> +
>> +sdrm->fbdev = fbdev;
>> +return;
>> +
>> +error:
>> +drm_fb_helper_fini(fbdev);
>> +kfree(fbdev);
>> +}
>> +
>> +void sdrm_fbdev_unbind(struct sdrm_device *sdrm)
>> +{
>> +struct drm_fb_helper *fbdev = sdrm->fbdev;
>> +
>> +if (!fbdev)
>> +return;
>> +
>> +sdrm->fbdev = NULL;
>> +drm_fb_helper_unregister_fbi(fbdev);
>> +cancel_work_sync(&fbdev->dirty_work);
>> +drm_fb_helper_release_fbi(fbdev);
>> +drm_framebuffer_unreference(fbdev->fb);
>
> I get a warning that there are still fb's left during unbind:
>
> [   48.666003] WARNING: CPU: 0 PID: 716 at 
> drivers/gpu/drm/drm_crtc.c:3855 drm_mode_config_cleanup+0x180/0x1f4 [drm]
>
> This worked:
>
> -   drm_framebuffer_unreference(fbdev->fb);
> +   drm_framebuffer_unregister_private(fbdev->fb);
> +   drm_framebuffer_cleanup(fbdev->fb);
>

Well not quite, this doesn't free the bo, so maybe this:

-   drm_framebuffer_unreference(fbdev->fb);
+   drm_framebuffer_unregister_private(fbdev->fb);
+   sdrm_fb_destroy(fbdev->fb);

IIRC the reason ref count doesn't drop to zero, had something to do with 
multiple
fb_set_par calls taking reference but not being dropped later.

Noralf.

>
> Noralf.
>
>> +fbdev->fb = NULL;
>> +drm_fb_helper_fini(fbdev);
>> +kfree(fbdev);
>> +}
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>



[Bug 97585] Genymotion won't start on 12.1

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97585

Darek Deoniziak  changed:

   What|Removed |Added

 Resolution|--- |NOTABUG
 Status|NEW |RESOLVED

--- Comment #5 from Darek Deoniziak  ---
The `objdump -T /usr/lib/x86_64-linux-gnu/libdrm.so.2 | grep drmFreeDevice`
output:
7270 gDF .text  001b  BasedrmFreeDevice
73b0 gDF .text  003f  BasedrmFreeDevices

And the `LD_DEBUG=libs DRI_PRIME=1 genymotion` outputs.
First after just runned genymotion panel (which works):
http://pastebin.com/P6aD00rR
Then part after running device when it hangs at the loading/setting up device:
http://pastebin.com/p3BQVJef

Anyway, I've found people had same problem here:
https://aur.archlinux.org/packages/genymotion/?comments=all
Comments are long, search for "radeonsi_dri.so: undefined symbol"

Someone suggested to remove /opt/genymotion/libdrm.so.2.

Works for me, genymotion is fine again. :) I'm not an expert but looks like
problem was related more to this shared object, mesa itself is fine. I'll mark
"bug" as resolved.

One more question related to my previous message if that won't be a problem.
Where I can submit bug for amdgpu rendering driver. I have few main problems
related to it:
1. Few windowed mode applications don't draw content until window is resized.
Alsoo right-click context menu doesn't always appear
2. I have screen tearing for fullscreen apps (screen is cutted to the half from
top-left to bottom-right)
3. tearing and flickering when running programs like "Atom", "Blender".

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


[Bug 97119] screen flickerin under KDE when compositor was dis- and reenabled

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97119

--- Comment #15 from Johannes Hirte  ---
(In reply to Michel Dänzer from comment #14)
> Which 'Tearing prevention ("vsync")' mode are you using in the kwin
> compositor settings? Maybe attach a screenshot of that settings page.

Was "Automatic" , but test with "Never" shows the same behavior. I've suspected
glamor to be related here, but a test on Sumo with AccelMethod glamor doesn't
reproduce the error.

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


[Bug 97249] R290x combined with Mg279q, Dp link fail in ubuntu-multihead setup.

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97249

--- Comment #7 from ramsland at hotmail.com  ---
Tried with kernel 4.7.2. The problem continues. 

I have switched around, and the HDMI works with the screen, though only 60hz. 
The screen is on at post, but dissapears during ubuntu startup, after grub the
screen remains dark. 


DRM 2.45.0 / 4.7.2-040702-generic, LLVM 4.0.0


kind regards B.

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


[Bug 93649] [radeonsi] Graphics lockup while playing tf2

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93649

--- Comment #29 from AmarildoJr  ---
I just tested the oldest firmware available in the Arch Linux Archive, namely
linux-firmware 20130725-1, and the crashes don't happen. This is with current
Arch, not a single package is old and all packages are up-to-date according to
the repos.

I'm hitting 10 to 30 FPS in-game, but at least the crashes don't happen which
IMO is a very good sign of where the problem might be.

I'll report the firmware problem to AMD.

In the mean time, does anyone know how I can try running the firmware from
Catalyst?

@Marek, where is the best place to report this?

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


[Bug 93649] [radeonsi] Graphics lockup while playing tf2

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93649

--- Comment #30 from AmarildoJr  ---
(In reply to Vedran Miletić from comment #28)
> Is the elephant in the room in this case the LLVM version difference between
> the two setups?

According to a Gentoo user who compiled llvm 3.5 and and older version of mesa
against it, the problem still occurs.

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


[Bug 97524] Invalid sampler settings cause full GPU reset

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97524

--- Comment #2 from Matias N. Goldberg  ---
Created attachment 126190
  --> https://bugs.freedesktop.org/attachment.cgi?id=126190&action=edit
Kern.log when it managed to reset

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


[Bug 97524] Invalid sampler settings cause full GPU reset

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97524

--- Comment #3 from Matias N. Goldberg  ---
Created attachment 126191
  --> https://bugs.freedesktop.org/attachment.cgi?id=126191&action=edit
Kern.log when it failed to reset

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


[Bug 97524] Invalid sampler settings cause full GPU reset

2016-09-03 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=97524

--- Comment #4 from Matias N. Goldberg  ---
Ah, you're on bleeding edge HW. Stopping showing off!

It's an AMD Radeon HD 7770 1GB. The audio is not in use but I'm including it
just in case.

Vendor and Device ID 1682:3231

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape
Verde XT [Radeon HD 7770/8760 / R7 250X] (prog-if 00 [VGA controller])
Subsystem: XFX Pine Group Inc. Cape Verde XT [Radeon HD 7770/8760 / R7
250X]
Flags: bus master, fast devsel, latency 0, IRQ 27
Memory at e000 (64-bit, prefetchable) [size=256M]
Memory at f7d0 (64-bit, non-prefetchable) [size=256K]
I/O ports at e000 [size=256]
Expansion ROM at 000c [disabled] [size=128K]
Capabilities: [48] Vendor Specific Information: Len=08 
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Legacy Endpoint, MSI 00
Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 
Capabilities: [150] Advanced Error Reporting
Capabilities: [270] #19
Kernel driver in use: radeon
Kernel modules: radeon

Vendor and Device ID 1682:aab0

01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape
Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
Subsystem: XFX Pine Group Inc. Cape Verde/Pitcairn HDMI Audio [Radeon
HD 7700/7800 Series]
Flags: bus master, fast devsel, latency 0, IRQ 32
Memory at f7d6 (64-bit, non-prefetchable) [size=16K]
Capabilities: [48] Vendor Specific Information: Len=08 
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Legacy Endpoint, MSI 00
Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 
Capabilities: [150] Advanced Error Reporting
Kernel driver in use: snd_hda_intel


I'll be attaching two logs. One of them from a few days ago where the GPU
managed to recover (if we can call that "recover" it was barely functional and
had to reset via Ctrl+Alt+Supr). Another from today I just repro again and was
totally unable to recover, screen flashed several times as if it tried to soft
reset more than once (I'm not certain that's what happened), still could do
Ctrl+Alt+Supr to reset.

I've been thinking these few days this bug MIGHT be related (causing):
https://bugs.freedesktop.org/show_bug.cgi?id=93649
If the game for just one frame randomly presents an invalid setup for one
measly small object, it would hang Radeon 7770s but it would work fine for
everybody else including these users in Windows (seriously, in my own program I
could not visually tell what was missing, it was some small object in a cubemap
render used for reflections) and nobody would notice.

If you have a suspect on where I should look (i.e. you have Mesa code that
SHOULD be catching this incorrect setup but isn't; I can analyze why it's not
catching the error) I can insert a few printfs or hook gdb. As a graphics
programmer I have my pride to keep.

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


[PATCH 1/5] Documentation: bindings: add dt documentation for dfi controller

2016-09-03 Thread Lin Huang
This patch adds the documentation for rockchip dfi devfreq-event driver.

Signed-off-by: Lin Huang 
---
Changes in v8:
- delete a unuse blank line

Changes in v7:
- None

Changes in v6:
- None

Changes in v5:
- None

Changes in v4:
- None

Changes in v3:
- None

Changes in v2:
- None 

Changes in v1:
- None

 .../bindings/devfreq/event/rockchip-dfi.txt   | 19 +++
 1 file changed, 19 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt

diff --git a/Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt 
b/Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt
new file mode 100644
index 000..d66aca6
--- /dev/null
+++ b/Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt
@@ -0,0 +1,19 @@
+
+* Rockchip rk3399 DFI device
+
+Required properties:
+- compatible: Must be "rockchip,rk3399-dfi".
+- reg: physical base address of each DFI and length of memory mapped region
+- rockchip,pmu: phandle to the syscon managing the "pmu general register files"
+- clocks: phandles for clock specified in "clock-names" property
+- clock-names : the name of clock used by the DFI, must be "pclk_ddr_mon";
+
+Example:
+   dfi: dfi at 0xff63 {
+   reg = <0x00 0xff63 0x00 0x4000>;
+   compatible = "rockchip,rk3399-dfi";
+   rockchip,pmu = <&pmugrf>;
+   clocks = <&cru PCLK_DDR_MON>;
+   clock-names = "pclk_ddr_mon";
+   status = "disabled";
+   };
-- 
2.6.6



[PATCH v9 4/5] PM / devfreq: rockchip: add devfreq driver for rk3399 dmc

2016-09-03 Thread Lin Huang
base on dfi result, we do ddr frequency scaling, register
dmc driver to devfreq framework, and use simple-ondemand
policy.

Signed-off-by: Lin Huang 
Signed-off-by: MyngJoo Ham 
Reviewed-by: Chanwoo Choi 
---
Changes in v8:
- None

Changes in v8:
- do not use ddr_timing node, get ddr timing directly

Changes in v7:
- remove a blank line

Changes in v6:
- fix some nit suggest by Chanwoo Choi

Changes in v5:
- improve dmc driver suggest by Chanwoo Choi

Changes in v4:
- use arm_smccc_smc() function talk to bl31
- delete rockchip_dmc.c file and config
- delete dmc_notify
- adjust probe order

Changes in v3:
- operate dram setting through sip call
- imporve set rate flow

Changes in v2:
- None

Changes in v1:
- move dfi controller to event
- fix set voltage sequence when set rate fail
- change Kconfig type from tristate to bool
- move unuse EXPORT_SYMBOL_GPL()

 drivers/devfreq/Kconfig  |  11 +
 drivers/devfreq/Makefile |   1 +
 drivers/devfreq/rk3399_dmc.c | 480 +++
 3 files changed, 492 insertions(+)
 create mode 100644 drivers/devfreq/rk3399_dmc.c

diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig
index a5be56e..e848121 100644
--- a/drivers/devfreq/Kconfig
+++ b/drivers/devfreq/Kconfig
@@ -100,6 +100,17 @@ config ARM_TEGRA_DEVFREQ
  It reads ACTMON counters of memory controllers and adjusts the
  operating frequencies and voltages with OPP support.

+config ARM_RK3399_DMC_DEVFREQ
+   tristate "ARM RK3399 DMC DEVFREQ Driver"
+   depends on ARCH_ROCKCHIP
+   select DEVFREQ_EVENT_ROCKCHIP_DFI
+   select DEVFREQ_GOV_SIMPLE_ONDEMAND
+   select PM_OPP
+   help
+  This adds the DEVFREQ driver for the RK3399 DMC(Dynamic Memory 
Controller).
+  It sets the frequency for the memory controller and reads the usage 
counts
+  from hardware.
+
 source "drivers/devfreq/event/Kconfig"

 endif # PM_DEVFREQ
diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile
index 09f11d9..fbff40a 100644
--- a/drivers/devfreq/Makefile
+++ b/drivers/devfreq/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE)   += governor_passive.o

 # DEVFREQ Drivers
 obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ)   += exynos-bus.o
+obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ)   += rk3399_dmc.o
 obj-$(CONFIG_ARM_TEGRA_DEVFREQ)+= tegra-devfreq.o

 # DEVFREQ Event Drivers
diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
new file mode 100644
index 000..54d65f2
--- /dev/null
+++ b/drivers/devfreq/rk3399_dmc.c
@@ -0,0 +1,480 @@
+/*
+ * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd.
+ * Author: Lin Huang 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+struct dram_timing {
+   unsigned int ddr3_speed_bin;
+   unsigned int pd_idle;
+   unsigned int sr_idle;
+   unsigned int sr_mc_gate_idle;
+   unsigned int srpd_lite_idle;
+   unsigned int standby_idle;
+   unsigned int auto_pd_dis_freq;
+   unsigned int dram_dll_dis_freq;
+   unsigned int phy_dll_dis_freq;
+   unsigned int ddr3_odt_dis_freq;
+   unsigned int ddr3_drv;
+   unsigned int ddr3_odt;
+   unsigned int phy_ddr3_ca_drv;
+   unsigned int phy_ddr3_dq_drv;
+   unsigned int phy_ddr3_odt;
+   unsigned int lpddr3_odt_dis_freq;
+   unsigned int lpddr3_drv;
+   unsigned int lpddr3_odt;
+   unsigned int phy_lpddr3_ca_drv;
+   unsigned int phy_lpddr3_dq_drv;
+   unsigned int phy_lpddr3_odt;
+   unsigned int lpddr4_odt_dis_freq;
+   unsigned int lpddr4_drv;
+   unsigned int lpddr4_dq_odt;
+   unsigned int lpddr4_ca_odt;
+   unsigned int phy_lpddr4_ca_drv;
+   unsigned int phy_lpddr4_ck_cs_drv;
+   unsigned int phy_lpddr4_dq_drv;
+   unsigned int phy_lpddr4_odt;
+};
+
+struct rk3399_dmcfreq {
+   struct device *dev;
+   struct devfreq *devfreq;
+   struct devfreq_simple_ondemand_data ondemand_data;
+   struct clk *dmc_clk;
+   struct devfreq_event_dev *edev;
+   struct mutex lock;
+   struct dram_timing timing;
+
+   /*
+* DDR Converser of Frequency (DCF) is used to implement DDR frequency
+* conversion without the participation of CPU, we will implement and
+* control it in arm trust firmware.
+*/
+   wait_queue_head_t   wait_dcf_queue;
+   int irq;
+   int wait_dcf_flag;
+  

[PATCH] drm: amdgpu: mark symbols static where possible

2016-09-03 Thread Edward O'Callaghan
024ull);
> >  }
> >
> > -int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
> > +static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
> >   struct list_head *validated)
> >  {
> >   struct amdgpu_bo_list_entry *lobj;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> > index 6674d40..31bfe3a 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> > @@ -91,7 +91,7 @@ void amdgpu_job_free_resources(struct amdgpu_job
> *job)
> >   amdgpu_ib_free(job->adev, &job->ibs[i], f);
> >  }
> >
> > -void amdgpu_job_free_cb(struct amd_sched_job *s_job)
> > +static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
> >  {
> >   struct amdgpu_job *job = container_of(s_job, struct
> amdgpu_job, base);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > index ac7fee7..c80c2e9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > @@ -48,7 +48,7 @@ static struct cz_smu_private_data
> *cz_smu_get_priv(struct amdgpu_device *adev)
> >   return priv;
> >  }
> >
> > -int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
> > +static int cz_send_msg_to_smc_async(struct amdgpu_device *adev,
> u16 msg)
> >  {
> >   int i;
> >   u32 content = 0, tmp;
> > @@ -140,7 +140,7 @@ int cz_read_smc_sram_dword(struct
> amdgpu_device *adev, u32 smc_address,
> >   return 0;
> >  }
> >
> > -int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32
> smc_address,
> > +static int cz_write_smc_sram_dword(struct amdgpu_device *adev,
> u32 smc_address,
> >   u32 value, u32 limit)
> >  {
> >   int ret;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > index bff8668..6997f7c 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > @@ -3923,7 +3923,7 @@ static void gfx_v8_0_init_pg(struct
> amdgpu_device *adev)
> >   }
> >  }
> >
> > -void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
> > +static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
> >  {
> >   u32 tmp = RREG32(mmRLC_CNTL);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > index 2118399..ef7c27d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > @@ -121,7 +121,7 @@ out:
> >   return result;
> >  }
> >
> > -void iceland_start_smc(struct amdgpu_device *adev)
> > +static void iceland_start_smc(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
> >
> > @@ -129,7 +129,7 @@ void iceland_start_smc(struct amdgpu_device *adev)
> >   WREG32_SMC(ixSMC_SYSCON_RESET_CNTL, val);
> >  }
> >
> > -void iceland_reset_smc(struct amdgpu_device *adev)
> > +static void iceland_reset_smc(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
> >
> > @@ -145,7 +145,7 @@ static int
> iceland_program_jump_on_start(struct amdgpu_device *adev)
> >   return 0;
> >  }
> >
> > -void iceland_stop_smc_clock(struct amdgpu_device *adev)
> > +static void iceland_stop_smc_clock(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
> >
> > @@ -153,7 +153,7 @@ void iceland_stop_smc_clock(struct
> amdgpu_device *adev)
> >   WREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0, val);
> >  }
> >
> > -void iceland_start_smc_clock(struct amdgpu_device *adev)
> > +static void iceland_start_smc_clock(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
> >
> >
> 
> 

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160903/b476f729/attachment-0001.sig>


[PATCH 0/5] rk3399 support ddr frequency scaling

2016-09-03 Thread Lin Huang
rk3399 platform have dfi controller can monitor ddr load,
and dcf controller to handle ddr register so we can get the
right ddr frequency and make ddr controller happy work(which
will implement in bl31). So we do ddr frequency scaling with
following flow:

 kernelbl31

monitor ddr load
|
|
get_target_rate
|
|   pass rate to bl31
clk_set_rate(ddr) ->run dcf flow
|   |
|   |
wait dcf interrupt<---trigger dcf interrupt
|
|
  return


Lin Huang (5):
  Documentation: bindings: add dt documentation for dfi controller
  PM / devfreq: event: support rockchip dfi controller
  Documentation: bindings: add dt documentation for rk3399 dmc
  PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
  drm/rockchip: Add dmc notifier in vop driver

Following patch:
clk: rockchip: add new clock-type for the ddrclk
clk: rockchip: rk3399: add SCLK_DDRCLK ID for ddrc
clk: rockchip: rk3399: add ddrc clock support
have applied to:
http://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git/v4.9-clk/next


 .../bindings/devfreq/event/rockchip-dfi.txt|  19 +
 .../devicetree/bindings/devfreq/rk3399_dmc.txt | 173 
 drivers/devfreq/Kconfig|  11 +
 drivers/devfreq/Makefile   |   1 +
 drivers/devfreq/event/Kconfig  |   7 +
 drivers/devfreq/event/Makefile |   1 +
 drivers/devfreq/event/rockchip-dfi.c   | 256 +++
 drivers/devfreq/rk3399_dmc.c   | 480 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 116 +
 9 files changed, 1064 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt
 create mode 100644 Documentation/devicetree/bindings/devfreq/rk3399_dmc.txt
 create mode 100644 drivers/devfreq/event/rockchip-dfi.c
 create mode 100644 drivers/devfreq/rk3399_dmc.c

-- 
2.6.6



[PATCH v9 0/5] rk3399 support ddr frequency scaling

2016-09-03 Thread Lin Huang
rk3399 platform have dfi controller can monitor ddr load,
and dcf controller to handle ddr register so we can get the
right ddr frequency and make ddr controller happy work(which
will implement in bl31). So we do ddr frequency scaling with
following flow:

 kernelbl31

monitor ddr load
|
|
get_target_rate
|
|   pass rate to bl31
clk_set_rate(ddr) ->run dcf flow
|   |
|   |
wait dcf interrupt<---trigger dcf interrupt
|
|
  return


Lin Huang (5):
  Documentation: bindings: add dt documentation for dfi controller
  PM / devfreq: event: support rockchip dfi controller
  Documentation: bindings: add dt documentation for rk3399 dmc
  PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
  drm/rockchip: Add dmc notifier in vop driver

Following patch:
clk: rockchip: add new clock-type for the ddrclk
clk: rockchip: rk3399: add SCLK_DDRCLK ID for ddrc
clk: rockchip: rk3399: add ddrc clock support
have applied to:
http://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git/v4.9-clk/next


 .../bindings/devfreq/event/rockchip-dfi.txt|  19 +
 .../devicetree/bindings/devfreq/rk3399_dmc.txt | 202 +
 drivers/devfreq/Kconfig|  11 +
 drivers/devfreq/Makefile   |   1 +
 drivers/devfreq/event/Kconfig  |   7 +
 drivers/devfreq/event/Makefile |   1 +
 drivers/devfreq/event/rockchip-dfi.c   | 256 +++
 drivers/devfreq/rk3399_dmc.c   | 480 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 116 +
 9 files changed, 1093 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt
 create mode 100644 Documentation/devicetree/bindings/devfreq/rk3399_dmc.txt
 create mode 100644 drivers/devfreq/event/rockchip-dfi.c
 create mode 100644 drivers/devfreq/rk3399_dmc.c

-- 
2.6.6



[PATCH v9 1/5] Documentation: bindings: add dt documentation for dfi controller

2016-09-03 Thread Lin Huang
This patch adds the documentation for rockchip dfi devfreq-event driver.

Signed-off-by: Lin Huang 
---
Changes in v9:
- reorder compatible and reg

Changes in v8:
- delete a unuse blank line

Changes in v7:
- None

Changes in v6:
- None

Changes in v5:
- None

Changes in v4:
- None

Changes in v3:
- None

Changes in v2:
- None 

Changes in v1:
- None

 .../bindings/devfreq/event/rockchip-dfi.txt   | 19 +++
 1 file changed, 19 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt

diff --git a/Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt 
b/Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt
new file mode 100644
index 000..f223313
--- /dev/null
+++ b/Documentation/devicetree/bindings/devfreq/event/rockchip-dfi.txt
@@ -0,0 +1,19 @@
+
+* Rockchip rk3399 DFI device
+
+Required properties:
+- compatible: Must be "rockchip,rk3399-dfi".
+- reg: physical base address of each DFI and length of memory mapped region
+- rockchip,pmu: phandle to the syscon managing the "pmu general register files"
+- clocks: phandles for clock specified in "clock-names" property
+- clock-names : the name of clock used by the DFI, must be "pclk_ddr_mon";
+
+Example:
+   dfi: dfi at 0xff63 {
+   compatible = "rockchip,rk3399-dfi";
+   reg = <0x00 0xff63 0x00 0x4000>;
+   rockchip,pmu = <&pmugrf>;
+   clocks = <&cru PCLK_DDR_MON>;
+   clock-names = "pclk_ddr_mon";
+   status = "disabled";
+   };
-- 
2.6.6



[PATCH v9 2/5] PM / devfreq: event: support rockchip dfi controller

2016-09-03 Thread Lin Huang
on rk3399 platform, there is dfi conroller can monitor
ddr load, base on this result, we can do ddr freqency
scaling.

Signed-off-by: Lin Huang 
Signed-off-by: MyungJoo Ham 
Acked-by: Chanwoo Choi 
---
Changes in v9:
-None

Changes in v8:
-None

Changes in v7:
-access need to *4 to get right DDR loading

Changes in v6:
-None

Changes in v5:
-None

Changes in v4:
-None

Changes in v3:
-None

Changes in v2:
-None 

Changes in v1:
-None

 drivers/devfreq/event/Kconfig|   7 +
 drivers/devfreq/event/Makefile   |   1 +
 drivers/devfreq/event/rockchip-dfi.c | 256 +++
 3 files changed, 264 insertions(+)
 create mode 100644 drivers/devfreq/event/rockchip-dfi.c

diff --git a/drivers/devfreq/event/Kconfig b/drivers/devfreq/event/Kconfig
index eb6f74a..20d82c2 100644
--- a/drivers/devfreq/event/Kconfig
+++ b/drivers/devfreq/event/Kconfig
@@ -30,4 +30,11 @@ config DEVFREQ_EVENT_EXYNOS_PPMU
  (Platform Performance Monitoring Unit) counters to estimate the
  utilization of each module.

+config DEVFREQ_EVENT_ROCKCHIP_DFI
+   tristate "ROCKCHIP DFI DEVFREQ event Driver"
+   depends on ARCH_ROCKCHIP
+   help
+ This add the devfreq-event driver for Rockchip SoC. It provides DFI
+ (DDR Monitor Module) driver to count ddr load.
+
 endif # PM_DEVFREQ_EVENT
diff --git a/drivers/devfreq/event/Makefile b/drivers/devfreq/event/Makefile
index 3d6afd3..dda7090 100644
--- a/drivers/devfreq/event/Makefile
+++ b/drivers/devfreq/event/Makefile
@@ -2,3 +2,4 @@

 obj-$(CONFIG_DEVFREQ_EVENT_EXYNOS_NOCP) += exynos-nocp.o
 obj-$(CONFIG_DEVFREQ_EVENT_EXYNOS_PPMU) += exynos-ppmu.o
+obj-$(CONFIG_DEVFREQ_EVENT_ROCKCHIP_DFI) += rockchip-dfi.o
diff --git a/drivers/devfreq/event/rockchip-dfi.c 
b/drivers/devfreq/event/rockchip-dfi.c
new file mode 100644
index 000..43fcc5a
--- /dev/null
+++ b/drivers/devfreq/event/rockchip-dfi.c
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd
+ * Author: Lin Huang 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define RK3399_DMC_NUM_CH  2
+
+/* DDRMON_CTRL */
+#define DDRMON_CTRL0x04
+#define CLR_DDRMON_CTRL(0x1f << 0)
+#define LPDDR4_EN  (0x10001 << 4)
+#define HARDWARE_EN(0x10001 << 3)
+#define LPDDR3_EN  (0x10001 << 2)
+#define SOFTWARE_EN(0x10001 << 1)
+#define SOFTWARE_DIS   (0x1 << 1)
+#define TIME_CNT_EN(0x10001 << 0)
+
+#define DDRMON_CH0_COUNT_NUM   0x28
+#define DDRMON_CH0_DFI_ACCESS_NUM  0x2c
+#define DDRMON_CH1_COUNT_NUM   0x3c
+#define DDRMON_CH1_DFI_ACCESS_NUM  0x40
+
+/* pmu grf */
+#define PMUGRF_OS_REG2 0x308
+#define DDRTYPE_SHIFT  13
+#define DDRTYPE_MASK   7
+
+enum {
+   DDR3 = 3,
+   LPDDR3 = 6,
+   LPDDR4 = 7,
+   UNUSED = 0xFF
+};
+
+struct dmc_usage {
+   u32 access;
+   u32 total;
+};
+
+/*
+ * The dfi controller can monitor DDR load. It has an upper and lower threshold
+ * for the operating points. Whenever the usage leaves these bounds an event is
+ * generated to indicate the DDR frequency should be changed.
+ */
+struct rockchip_dfi {
+   struct devfreq_event_dev *edev;
+   struct devfreq_event_desc *desc;
+   struct dmc_usage ch_usage[RK3399_DMC_NUM_CH];
+   struct device *dev;
+   void __iomem *regs;
+   struct regmap *regmap_pmu;
+   struct clk *clk;
+};
+
+static void rockchip_dfi_start_hardware_counter(struct devfreq_event_dev *edev)
+{
+   struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
+   void __iomem *dfi_regs = info->regs;
+   u32 val;
+   u32 ddr_type;
+
+   /* get ddr type */
+   regmap_read(info->regmap_pmu, PMUGRF_OS_REG2, &val);
+   ddr_type = (val >> DDRTYPE_SHIFT) & DDRTYPE_MASK;
+
+   /* clear DDRMON_CTRL setting */
+   writel_relaxed(CLR_DDRMON_CTRL, dfi_regs + DDRMON_CTRL);
+
+   /* set ddr type to dfi */
+   if (ddr_type == LPDDR3)
+   writel_relaxed(LPDDR3_EN, dfi_regs + DDRMON_CTRL);
+   else if (ddr_type == LPDDR4)
+   writel_relaxed(LPDDR4_EN, dfi_regs + DDRMON_CTRL);
+
+   /* enable count, use software mode */
+   writel_relaxed(SOFTWARE_EN, dfi_regs + DDRMON_CTRL);
+}
+
+static void rockchip_dfi_stop_hardware_counter(struct devfreq_event_dev *edev)
+{
+   struct rockchip_dfi *info = devfreq_event_get_drvdata(edev);
+   void __iomem *dfi_regs = info->regs;
+
+

[PATCH v9 5/5] drm/rockchip: Add dmc notifier in vop driver

2016-09-03 Thread Lin Huang
when in ddr frequency scaling process, vop can not do enable or
disable operation, since in dcf we check vop clock to see whether
vop work. If vop work, dcf do ddr frequency scaling when vop
in vblank status, and we need to read vop register to check whether
vop go into vblank status. If vop not work, dcf can do ddr frequency
any time. So when do ddr frequency scaling, you disabled or enable
vop, there may two bad thing happen: 1, the panel flicker(when vop from
disable status change to enable). 2, kernel hang (when vop from enable
status change to disable, dcf need to read vblank status, but if you disable
vop clock, it can not get the status, it will lead soc dead) So we need
register to devfreq notifier, and we can get the dmc status. Also, when
there have two vop enabled, we need to disable dmc, since dcf only base
on one vop vblank time, so the other panel will flicker when do ddr
frequency scaling.

Signed-off-by: Lin Huang 
Reviewed-by: Chanwoo Choi 
---
Changes in v9:
- None

Changes in v8:
- None

Changes in v7:
- None

Changes in v6:
- fix a build error

Changes in v5:
- improve some nits

Changes in v4:
- register notifier to devfreq_register_notifier
- use DEVFREQ_PRECHANGE and DEVFREQ_POSTCHANGE to get dmc status
- when two vop enable, disable dmc
- when two vop back to one vop, enable dmc

Changes in v3:
- when do vop eanble/disable, dmc will wait until it finish

Changes in v2:
- None

Changes in v1:
- use wait_event instead usleep

 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 116 
 1 file changed, 116 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index efbc41a..a73f3aa 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -19,6 +19,8 @@
 #include 
 #include 

+#include 
+#include 
 #include 
 #include 
 #include 
@@ -118,6 +120,13 @@ struct vop {

const struct vop_data *data;

+   struct devfreq *devfreq;
+   struct devfreq_event_dev *devfreq_event_dev;
+   struct notifier_block dmc_nb;
+   int dmc_in_process;
+   int vop_switch_status;
+   wait_queue_head_t wait_dmc_queue;
+   wait_queue_head_t wait_vop_switch_queue;
uint32_t *regsbak;
void __iomem *regs;

@@ -428,11 +437,47 @@ static void vop_dsp_hold_valid_irq_disable(struct vop 
*vop)
spin_unlock_irqrestore(&vop->irq_lock, flags);
 }

+static int dmc_notify(struct notifier_block *nb, unsigned long event,
+ void *data)
+{
+   struct vop *vop = container_of(nb, struct vop, dmc_nb);
+
+   if (event == DEVFREQ_PRECHANGE) {
+   /*
+* check if vop in enable or disable process,
+* if yes, wait until it finishes, use 200ms as
+* timeout.
+*/
+   if (!wait_event_timeout(vop->wait_vop_switch_queue,
+   !vop->vop_switch_status, HZ / 5))
+   dev_warn(vop->dev,
+"Timeout waiting for vop swtich status\n");
+   vop->dmc_in_process = 1;
+   } else if (event == DEVFREQ_POSTCHANGE) {
+   vop->dmc_in_process = 0;
+   wake_up(&vop->wait_dmc_queue);
+   }
+
+   return NOTIFY_OK;
+}
+
 static int vop_enable(struct drm_crtc *crtc)
 {
struct vop *vop = to_vop(crtc);
+   int num_enabled_crtc = 0;
int ret;

+   /*
+* if in dmc scaling frequency process, wait until it finishes
+* use 200ms as timeout time.
+*/
+   if (!wait_event_timeout(vop->wait_dmc_queue,
+   !vop->dmc_in_process, HZ / 5))
+   dev_warn(vop->dev,
+"Timeout waiting for dmc when vop enable\n");
+
+   vop->vop_switch_status = 1;
+
ret = pm_runtime_get_sync(vop->dev);
if (ret < 0) {
dev_err(vop->dev, "failed to get pm runtime: %d\n", ret);
@@ -479,6 +524,21 @@ static int vop_enable(struct drm_crtc *crtc)

drm_crtc_vblank_on(crtc);

+   vop->vop_switch_status = 0;
+   wake_up(&vop->wait_vop_switch_queue);
+
+   /* check how many VOPs in use now */
+   drm_for_each_crtc(crtc, vop->drm_dev) {
+   if (crtc->state->enable)
+   num_enabled_crtc++;
+   }
+
+   /* if enable two vop, need to disable dmc */
+   if ((num_enabled_crtc > 1) && vop->devfreq) {
+   if (vop->devfreq_event_dev)
+   devfreq_event_disable_edev(vop->devfreq_event_dev);
+   devfreq_suspend_device(vop->devfreq);
+   }
return 0;

 err_disable_aclk:
@@ -489,17 +549,31 @@ err_disable_hclk:
clk_disable(vop->hclk);
 err_put_pm_runtime:
pm_runtime_put_sync(vop->dev);
+   vop->vop_switch_status = 0;
+   wake_up(&vop->wait_vop_switch_queue);
return ret;
 }

 static void vop_crtc_d

[PATCH] drm: amdgpu: mark symbols static where possible

2016-09-03 Thread Baoyou Xie
We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/cz_smc.c:51:5: warning: no previous prototype for 
'cz_send_msg_to_smc_async' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/cz_smc.c:143:5: warning: no previous prototype for 
'cz_write_smc_sram_dword' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/iceland_smc.c:124:6: warning: no previous prototype 
for 'iceland_start_smc' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:3926:6: warning: no previous prototype 
for 'gfx_v8_0_rlc_stop' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c:94:6: warning: no previous prototype 
for 'amdgpu_job_free_cb' [-Wmissing-prototypes]


In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c  | 4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c  | 2 +-
 drivers/gpu/drm/amd/amdgpu/cz_smc.c  | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c| 2 +-
 drivers/gpu/drm/amd/amdgpu/iceland_smc.c | 8 
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index bc0440f..a831218 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -616,7 +616,7 @@ static int amdgpu_cgs_irq_put(struct cgs_device 
*cgs_device, unsigned src_id, un
return amdgpu_irq_put(adev, adev->irq.sources[src_id], type);
 }

-int amdgpu_cgs_set_clockgating_state(struct cgs_device *cgs_device,
+static int amdgpu_cgs_set_clockgating_state(struct cgs_device *cgs_device,
  enum amd_ip_block_type block_type,
  enum amd_clockgating_state state)
 {
@@ -637,7 +637,7 @@ int amdgpu_cgs_set_clockgating_state(struct cgs_device 
*cgs_device,
return r;
 }

-int amdgpu_cgs_set_powergating_state(struct cgs_device *cgs_device,
+static int amdgpu_cgs_set_powergating_state(struct cgs_device *cgs_device,
  enum amd_ip_block_type block_type,
  enum amd_powergating_state state)
 {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 0307ff5..f65bdaf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -287,7 +287,7 @@ static u64 amdgpu_cs_get_threshold_for_moves(struct 
amdgpu_device *adev)
return max(bytes_moved_threshold, 1024*1024ull);
 }

-int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
+static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
struct list_head *validated)
 {
struct amdgpu_bo_list_entry *lobj;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
index 6674d40..31bfe3a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
@@ -91,7 +91,7 @@ void amdgpu_job_free_resources(struct amdgpu_job *job)
amdgpu_ib_free(job->adev, &job->ibs[i], f);
 }

-void amdgpu_job_free_cb(struct amd_sched_job *s_job)
+static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
 {
struct amdgpu_job *job = container_of(s_job, struct amdgpu_job, base);

diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c 
b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
index ac7fee7..c80c2e9 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
@@ -48,7 +48,7 @@ static struct cz_smu_private_data *cz_smu_get_priv(struct 
amdgpu_device *adev)
return priv;
 }

-int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
+static int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
 {
int i;
u32 content = 0, tmp;
@@ -140,7 +140,7 @@ int cz_read_smc_sram_dword(struct amdgpu_device *adev, u32 
smc_address,
return 0;
 }

-int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address,
+static int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address,
u32 value, u32 limit)
 {
int ret;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index bff8668..6997f7c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -3923,7 +3923,7 @@ static void gfx_v8_0_init_pg(struct amdgpu_device *adev)
}
 }

-void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
+static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
 {
u32 tmp = RREG32(mmRLC_CNTL);

diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c 
b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
index 2118399..ef7c27d 100644
--- a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
+++ b/dr

[PATCH] drm: amdgpu: add missing header dependencies

2016-09-03 Thread Baoyou Xie
We get a few warnings when building kernel with W=1:
drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c:113:6: warning: no previous prototype 
for 'amdgpu_pll_compute' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/cz_smc.c:38:10: warning: no previous prototype for 
'cz_get_argument' [-Wmissing-prototypes]
drivers/gpu/drm/amd/amdgpu/cz_smc.c:302:5: warning: no previous prototype for 
'cz_smu_start' [-Wmissing-prototypes]


In fact, these functions are declared in
drivers/gpu/drm/amd/amdgpu/atombios_i2c.h
drivers/gpu/drm/amd/amdgpu/amdgpu_pll.h
drivers/gpu/drm/amd/amdgpu/cz_dpm.h
drivers/gpu/drm/amd/amdgpu/vi_dpm.h.
So this patch adds missing header dependencies.

Signed-off-by: Baoyou Xie 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c   | 1 +
 drivers/gpu/drm/amd/amdgpu/atombios_i2c.c | 1 +
 drivers/gpu/drm/amd/amdgpu/cz_smc.c   | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c
index d153149..8e67c12 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pll.c
@@ -25,6 +25,7 @@
 #include "amdgpu.h"
 #include "atom.h"
 #include "atombios_encoders.h"
+#include "amdgpu_pll.h"
 #include 
 #include 

diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c 
b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
index bc56c8a..b374653 100644
--- a/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
+++ b/drivers/gpu/drm/amd/amdgpu/atombios_i2c.c
@@ -27,6 +27,7 @@
 #include "amdgpu.h"
 #include "atom.h"
 #include "amdgpu_atombios.h"
+#include "atombios_i2c.h"

 #define TARGET_HW_I2C_CLOCK 50

diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c 
b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
index c80c2e9..95887e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
@@ -29,6 +29,8 @@
 #include "cz_smumgr.h"
 #include "smu_ucode_xfer_cz.h"
 #include "amdgpu_ucode.h"
+#include "cz_dpm.h"
+#include "vi_dpm.h"

 #include "smu/smu_8_0_d.h"
 #include "smu/smu_8_0_sh_mask.h"
-- 
2.7.4



[PATCH] drm: amdgpu: mark symbols static where possible

2016-09-03 Thread Edward O'Callaghan
ice *adev, u16 msg)
> +static int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
>  {
>   int i;
>   u32 content = 0, tmp;
> @@ -140,7 +140,7 @@ int cz_read_smc_sram_dword(struct amdgpu_device *adev, 
> u32 smc_address,
>   return 0;
>  }
>  
> -int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address,
> +static int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 
> smc_address,
>   u32 value, u32 limit)
>  {
>   int ret;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index bff8668..6997f7c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -3923,7 +3923,7 @@ static void gfx_v8_0_init_pg(struct amdgpu_device *adev)
>   }
>  }
>  
> -void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
> +static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
>  {
>   u32 tmp = RREG32(mmRLC_CNTL);
>  
> diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c 
> b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> index 2118399..ef7c27d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> @@ -121,7 +121,7 @@ out:
>   return result;
>  }
>  
> -void iceland_start_smc(struct amdgpu_device *adev)
> +static void iceland_start_smc(struct amdgpu_device *adev)
>  {
>   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
>  
> @@ -129,7 +129,7 @@ void iceland_start_smc(struct amdgpu_device *adev)
>   WREG32_SMC(ixSMC_SYSCON_RESET_CNTL, val);
>  }
>  
> -void iceland_reset_smc(struct amdgpu_device *adev)
> +static void iceland_reset_smc(struct amdgpu_device *adev)
>  {
>   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
>  
> @@ -145,7 +145,7 @@ static int iceland_program_jump_on_start(struct 
> amdgpu_device *adev)
>   return 0;
>  }
>  
> -void iceland_stop_smc_clock(struct amdgpu_device *adev)
> +static void iceland_stop_smc_clock(struct amdgpu_device *adev)
>  {
>   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
>  
> @@ -153,7 +153,7 @@ void iceland_stop_smc_clock(struct amdgpu_device *adev)
>   WREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0, val);
>  }
>  
> -void iceland_start_smc_clock(struct amdgpu_device *adev)
> +static void iceland_start_smc_clock(struct amdgpu_device *adev)
>  {
>   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
>  
> 

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160903/4d82b78e/attachment-0001.sig>


[PATCH] drm: amdgpu: mark symbols static where possible

2016-09-03 Thread Baoyou Xie
b_free_resources(struct amdgpu_job *job)
> >   amdgpu_ib_free(job->adev, &job->ibs[i], f);
> >  }
> >
> > -void amdgpu_job_free_cb(struct amd_sched_job *s_job)
> > +static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
> >  {
> >   struct amdgpu_job *job = container_of(s_job, struct amdgpu_job,
> base);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > index ac7fee7..c80c2e9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > @@ -48,7 +48,7 @@ static struct cz_smu_private_data
> *cz_smu_get_priv(struct amdgpu_device *adev)
> >   return priv;
> >  }
> >
> > -int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
> > +static int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16
> msg)
> >  {
> >   int i;
> >   u32 content = 0, tmp;
> > @@ -140,7 +140,7 @@ int cz_read_smc_sram_dword(struct amdgpu_device
> *adev, u32 smc_address,
> >   return 0;
> >  }
> >
> > -int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address,
> > +static int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32
> smc_address,
> >   u32 value, u32 limit)
> >  {
> >   int ret;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > index bff8668..6997f7c 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > @@ -3923,7 +3923,7 @@ static void gfx_v8_0_init_pg(struct amdgpu_device
> *adev)
> >   }
> >  }
> >
> > -void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
> > +static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
> >  {
> >   u32 tmp = RREG32(mmRLC_CNTL);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > index 2118399..ef7c27d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > @@ -121,7 +121,7 @@ out:
> >   return result;
> >  }
> >
> > -void iceland_start_smc(struct amdgpu_device *adev)
> > +static void iceland_start_smc(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
> >
> > @@ -129,7 +129,7 @@ void iceland_start_smc(struct amdgpu_device *adev)
> >   WREG32_SMC(ixSMC_SYSCON_RESET_CNTL, val);
> >  }
> >
> > -void iceland_reset_smc(struct amdgpu_device *adev)
> > +static void iceland_reset_smc(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
> >
> > @@ -145,7 +145,7 @@ static int iceland_program_jump_on_start(struct
> amdgpu_device *adev)
> >   return 0;
> >  }
> >
> > -void iceland_stop_smc_clock(struct amdgpu_device *adev)
> > +static void iceland_stop_smc_clock(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
> >
> > @@ -153,7 +153,7 @@ void iceland_stop_smc_clock(struct amdgpu_device
> *adev)
> >   WREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0, val);
> >  }
> >
> > -void iceland_start_smc_clock(struct amdgpu_device *adev)
> > +static void iceland_start_smc_clock(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
> >
> >
>
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160903/322c5fb4/attachment-0001.html>


[PATCH] drm: amdgpu: mark symbols static where possible

2016-09-03 Thread Baoyou Xie
 > -void amdgpu_job_free_cb(struct amd_sched_job *s_job)
> > +static void amdgpu_job_free_cb(struct amd_sched_job *s_job)
> >  {
> >   struct amdgpu_job *job = container_of(s_job, struct amdgpu_job,
> base);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > index ac7fee7..c80c2e9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/cz_smc.c
> > @@ -48,7 +48,7 @@ static struct cz_smu_private_data
> *cz_smu_get_priv(struct amdgpu_device *adev)
> >   return priv;
> >  }
> >
> > -int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16 msg)
> > +static int cz_send_msg_to_smc_async(struct amdgpu_device *adev, u16
> msg)
> >  {
> >   int i;
> >   u32 content = 0, tmp;
> > @@ -140,7 +140,7 @@ int cz_read_smc_sram_dword(struct amdgpu_device
> *adev, u32 smc_address,
> >   return 0;
> >  }
> >
> > -int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address,
> > +static int cz_write_smc_sram_dword(struct amdgpu_device *adev, u32
> smc_address,
> >   u32 value, u32 limit)
> >  {
> >   int ret;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > index bff8668..6997f7c 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > @@ -3923,7 +3923,7 @@ static void gfx_v8_0_init_pg(struct amdgpu_device
> *adev)
> >   }
> >  }
> >
> > -void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
> > +static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
> >  {
> >   u32 tmp = RREG32(mmRLC_CNTL);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > index 2118399..ef7c27d 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
> > @@ -121,7 +121,7 @@ out:
> >   return result;
> >  }
> >
> > -void iceland_start_smc(struct amdgpu_device *adev)
> > +static void iceland_start_smc(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
> >
> > @@ -129,7 +129,7 @@ void iceland_start_smc(struct amdgpu_device *adev)
> >   WREG32_SMC(ixSMC_SYSCON_RESET_CNTL, val);
> >  }
> >
> > -void iceland_reset_smc(struct amdgpu_device *adev)
> > +static void iceland_reset_smc(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_RESET_CNTL);
> >
> > @@ -145,7 +145,7 @@ static int iceland_program_jump_on_start(struct
> amdgpu_device *adev)
> >   return 0;
> >  }
> >
> > -void iceland_stop_smc_clock(struct amdgpu_device *adev)
> > +static void iceland_stop_smc_clock(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
> >
> > @@ -153,7 +153,7 @@ void iceland_stop_smc_clock(struct amdgpu_device
> *adev)
> >   WREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0, val);
> >  }
> >
> > -void iceland_start_smc_clock(struct amdgpu_device *adev)
> > +static void iceland_start_smc_clock(struct amdgpu_device *adev)
> >  {
> >   uint32_t val = RREG32_SMC(ixSMC_SYSCON_CLOCK_CNTL_0);
> >
> >
>
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160903/74ebce5c/attachment-0001.html>


[PATCH] drm: flip-work: Simplify code

2016-09-03 Thread Christophe JAILLET
Calling 'list_splice_tail' followed by 'INIT_LIST_HEAD' is equivalent to
'list_splice_tail_init'.

This has been spotted with the following coccinelle script:
/
@@
expression y,z;
@@

-   list_splice_tail(y,z);
-   INIT_LIST_HEAD(y);
+   list_splice_tail_init(y,z);

Signed-off-by: Christophe JAILLET 
---
 drivers/gpu/drm/drm_flip_work.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_flip_work.c b/drivers/gpu/drm/drm_flip_work.c
index 12dea16f22a8..c8b54a6694f6 100644
--- a/drivers/gpu/drm/drm_flip_work.c
+++ b/drivers/gpu/drm/drm_flip_work.c
@@ -101,8 +101,7 @@ void drm_flip_work_commit(struct drm_flip_work *work,
unsigned long flags;

spin_lock_irqsave(&work->lock, flags);
-   list_splice_tail(&work->queued, &work->commited);
-   INIT_LIST_HEAD(&work->queued);
+   list_splice_tail_init(&work->queued, &work->commited);
spin_unlock_irqrestore(&work->lock, flags);
queue_work(wq, &work->worker);
 }
@@ -119,8 +118,7 @@ static void flip_worker(struct work_struct *w)

INIT_LIST_HEAD(&tasks);
spin_lock_irqsave(&work->lock, flags);
-   list_splice_tail(&work->commited, &tasks);
-   INIT_LIST_HEAD(&work->commited);
+   list_splice_tail_init(&work->commited, &tasks);
spin_unlock_irqrestore(&work->lock, flags);

if (list_empty(&tasks))
-- 
2.7.4



[PATCH v9 3/5] Documentation: bindings: add dt documentation for rk3399 dmc

2016-09-03 Thread Lin Huang
This patch adds the documentation for rockchip rk3399 dmc driver.

Signed-off-by: Lin Huang 
---
Changes in v9:
- add ddr timing property to node

Changes in v8:
- add ddr timing properties

Changes in v7:
- None

Changes in v6:
-Add more detail in Documentation

Changes in v5:
-None

Changes in v4:
-None

Changes in v3:
-None

Changes in v2:
-None 

Changes in v1:
-None
 .../devicetree/bindings/devfreq/rk3399_dmc.txt | 202 +
 1 file changed, 202 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/devfreq/rk3399_dmc.txt

diff --git a/Documentation/devicetree/bindings/devfreq/rk3399_dmc.txt 
b/Documentation/devicetree/bindings/devfreq/rk3399_dmc.txt
new file mode 100644
index 000..f187c8fa
--- /dev/null
+++ b/Documentation/devicetree/bindings/devfreq/rk3399_dmc.txt
@@ -0,0 +1,202 @@
+* Rockchip rk3399 DMC(Dynamic Memory Controller) device
+
+Required properties:
+- compatible:   Must be "rockchip,rk3399-dmc".
+- devfreq-events:   Node to get DDR loading, Refer to
+Documentation/devicetree/bindings/devfreq/
+rockchip-dfi.txt
+- interrupts:   The interrupt number to the CPU. The interrupt
+specifier format depends on the interrupt controller.
+It should be DCF interrupts, when DDR dvfs finish,
+it will happen.
+- clocks:   Phandles for clock specified in "clock-names" property
+- clock-names : The name of clock used by the DFI, must be
+"pclk_ddr_mon";
+- operating-points-v2:  Refer to 
Documentation/devicetree/bindings/power/opp.txt
+for details.
+- center-supply:DMC supply node.
+- status:   Marks the node enabled/disabled.
+
+Following properties are ddr timing:
+
+- dram_speed_bin :  Value is defined at include/dt-bindings/clock/ddr.h,
+it select ddr3 cl-trp-trcd type, default value
+"DDR3_DEFAULT".it must selected according to
+"Speed Bin" in ddr3 datasheet, DO NOT use smaller
+"Speed Bin" than ddr3 exactly is.
+
+- pd_idle : Config the PD_IDLE value, defined the power-down idle
+period, memories are places into power-down mode if
+bus is idle for PD_IDLE DFI clocks.
+
+- sr_idle : Configure the SR_IDLE value, defined the selfrefresh
+idle period, memories are places into self-refresh
+mode if bus is idle for SR_IDLE*1024 DFI clocks
+(DFI clocks freq is half of dram's clocks), defaule
+value is "0".
+
+- sr_mc_gate_idle : Defined the self-refresh with memory and controller
+clock gating idle period, memories are places into
+self-refresh mode and memory controller clock arg
+gating if bus is idle for sr_mc_gate_idle*1024 DFI
+clocks.
+
+- srpd_lite_idle :  Defined the self-refresh power down idle period,
+memories are places into self-refresh power down
+mode if bus is idle for srpd_lite_idle*1024 DFI
+clocks. This parameter is for LPDDR4 only.
+
+- standby_idle :Defined the standby idle period, memories are places
+into self-refresh than controller, pi, phy and dram
+clock will gating if bus is idle for
+standby_idle * DFI clocks.
+
+- dram_dll_disb_freq :  It's defined the DDR3 dll bypass frequency in MHz
+when ddr freq less than DRAM_DLL_DISB_FREQ, ddr3
+dll will bypssed note: if dll was bypassed, the
+odt also stop working.
+
+- phy_dll_disb_freq :   Defined the PHY dll bypass frequency in MHz (Mega Hz),
+when ddr freq less than DRAM_DLL_DISB_FREQ, phy dll
+will bypssed. note: phy dll and phy odt are
+independent
+
+- ddr3_odt_disb_freq :  When dram type is DDR3, this parameter defined the
+odt disable frequency in MHz (Mega Hz), when ddr
+frequency less then ddr3_odt_disb_freq, the odt
+on dram side and controller side are both disabled.
+
+- ddr3_drv :When dram type is DDR3, this parameter define the
+dram side driver stength in ohm, default value is
+DDR3_DS_40ohm.
+
+- ddr3_odt :When dram type is DDR3, this parameter define the
+dram side ODT stength in ohm, default value is
+DDR3_ODT_120ohm.
+
+- phy_ddr3_ca_drv : When dram type is DDR3, this parameter define the phy
+ 

[PATCH 0/7] drm/sun4i: Introduce A33 display driver

2016-09-03 Thread Chen-Yu Tsai
On Sat, Sep 3, 2016 at 3:06 AM, Maxime Ripard
 wrote:
> Hi Icenowy,
>
> On Fri, Sep 02, 2016 at 09:30:05AM +0800, Icenowy Zheng wrote:
>>
>>
>> 01.09.2016, 23:40, "Maxime Ripard" :
>> > Hi everyone,
>> >
>> > This serie introduces the support in the sun4i-drm driver for the A33.
>> >
>> > Beside the new IPs and special cases for the A33 new IPs, there's
>> > nothing really outstanding, and is now at feature parity with the A13.
>>
>> How can the driver be modified to support LVDS screen?
>>
>> I have an A33 tablet with a 1024x768 LVDS panel. (iNet D978 Rev2 board,
>> which I pushed a dt a few days ago)
>
> Awesome, I don't have such a screen myself, so feel free to work on
> it.
>
> I haven't looked into the details of LVDS, but it should be something
> along the lines of commit 29e57fab97fc ("drm: sun4i: Add RGB output").

The implementation might be along the lines of

  1. having multiple output ports, each for a different interface type.
 (Some platforms go this route)

Or

  2. having a DT property describe what the output interface is.

The RGB/TCON driver would then setup the registers accordingly.


ChenYu