[Intel-gfx] [PATCH 2/3] drm/vgem: Enable dmabuf interface for export

2016-07-01 Thread Chris Wilson
On Fri, Jul 01, 2016 at 05:56:25PM +0100, Matthew Auld wrote:
> > +static struct sg_table *vgem_prime_get_sg_table(struct drm_gem_object *obj)
> > +{
> > +   long n_pages = obj->size >> PAGE_SHIFT;
> > +   struct sg_table *st;
> > +   struct page **pages;
> > +   int ret;
> > +
> > +   st = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
> > +   if (st == NULL)
> > +   return ERR_PTR(-ENOMEM);
> > +
> > +   pages = drm_gem_get_pages(obj);
> > +   if (IS_ERR(pages)) {
> > +   ret = PTR_ERR(pages);
> > +   goto err;
> > +   }
> > +
> > +   ret = sg_alloc_table_from_pages(st, pages, n_pages,
> > +   0, obj->size, GFP_KERNEL);
> > +   drm_gem_put_pages(obj, pages, false, false);
> > +   if (ret)
> > +   goto err;
> > +
> > +   return st;
> > +
> > +err:
> > +   kfree(st);
> > +   return ERR_PTR(ret);
> > +}
> > +
> Couldn't this be written more simply as:
> 
> pages = drm_gem_get_pages(obj);
> if (IS_ERR(pages))
> return ERR_CAST(pages);
> 
> st = drm_prime_pages_to_sg(pages, n_pages);
> drm_gem_put_pages(obj, pages, false, false);
> 
> return st;

That looks better, thanks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[PATCH 1/6] lib: string: add function strtolower()

2016-07-01 Thread Jani Nikula
On Fri, 01 Jul 2016, Markus Mayer  wrote:
> On 1 July 2016 at 03:52, Jani Nikula  wrote:
>> On Fri, 01 Jul 2016, Markus Mayer  wrote:
>>> Add a function called strtolower() to convert strings to lower case
>>> in-place, overwriting the original string.
>>>
>>> This seems to be a recurring requirement in the kernel that is
>>> currently being solved by several duplicated implementations doing the
>>> same thing.
>>>
>>> Signed-off-by: Markus Mayer 
>>> ---
>>>  include/linux/string.h |  1 +
>>>  lib/string.c   | 14 ++
>>>  2 files changed, 15 insertions(+)
>>>
>>> diff --git a/include/linux/string.h b/include/linux/string.h
>>> index 26b6f6a..aad605e 100644
>>> --- a/include/linux/string.h
>>> +++ b/include/linux/string.h
>>> @@ -116,6 +116,7 @@ extern void * memchr(const void *,int,__kernel_size_t);
>>>  #endif
>>>  void *memchr_inv(const void *s, int c, size_t n);
>>>  char *strreplace(char *s, char old, char new);
>>> +char *strtolower(char *s);
>>>
>>>  extern void kfree_const(const void *x);
>>>
>>> diff --git a/lib/string.c b/lib/string.c
>>> index ed83562..6e3b560 100644
>>> --- a/lib/string.c
>>> +++ b/lib/string.c
>>> @@ -952,3 +952,17 @@ char *strreplace(char *s, char old, char new)
>>>   return s;
>>>  }
>>>  EXPORT_SYMBOL(strreplace);
>>> +
>>
>> This needs a kernel-doc comment right here.
>
> Will add it.
>
>>> +char *strtolower(char *s)
>>> +{
>>> + char *p;
>>> +
>>> +if (unlikely(!s))
>>> +return NULL;
>>
>> Using spaces for indentation? See scripts/checkpatch.pl.
>
> Not on purpose. Thanks for spotting it.
>
>>> +
>>> + for (p = s; *p; p++)
>>> + *p = tolower(*p);
>>> +
>>> + return s;
>>
>> Why does it return a value? Could be void?
>
> It could be void, but I thought that would make the function's use
> less flexible. As is, the return value is there if anybody wants it,
> but it can be ignored if it is not needed. Also, it seems customary
> for string functions to be returning the string that was passed in.
>
> I'll change it to void if there are strong opinions leaning that way.
> Personally, I like that it returns a char * better.

I don't have strong opinions on this. Just a general aversion to
returning something redundant. Avoids questions like, does it allocate a
new string, should I use the return value instead of the string I passed
in, should I check the return value or can I ignore it, should I check
both the string I pass in and the return value for != NULL, etc. But I
could be persuaded either way.

BR,
Jani.


>
>> BR,
>> Jani.
>>
>>> +}
>>> +EXPORT_SYMBOL(strtolower);
>>
>> --
>> Jani Nikula, Intel Open Source Technology Center

-- 
Jani Nikula, Intel Open Source Technology Center


[Bug 96768] Black screen past login with RX 480, Ubuntu 16.04 and AMDgpu-pro 16.30

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96768

Bug ID: 96768
   Summary: Black screen past login with RX 480, Ubuntu 16.04 and
AMDgpu-pro 16.30
   Product: DRI
   Version: unspecified
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu-pro
  Assignee: dri-devel at lists.freedesktop.org
  Reporter: pyrignis at gmail.com

Created attachment 124845
  --> https://bugs.freedesktop.org/attachment.cgi?id=124845=edit
output of the dmesg command

Symptoms:
Login screen renders properly
Past login, the screen turns black, with the pointer visible and a blank pixel
in the upper left corner.
On some occasion the pointer turns from the arrow to the vertical bar.
crtl+alt+F works and brings the user to the tty.

all symptoms are reverted when the llvm driver is used.

System:
Ubuntu 16.04 Gnome edition (but even with unity installed and configured as
default the symptoms are the same)
AMD Radeon RX 480 8G
AMDgpu-pro 16.30
4.4 kernel

The dmesg file is the output of the command after a tty return with
ctrl+alt+F4.

original description here:
https://www.phoronix.com/forums/forum/linux-graphics-x-org-drivers/amd-linux/881991-rx-480-on-ubuntu-has-anyone-been-able-to-use-it

-- 
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/20160701/08d73044/attachment.html>


[Bug 96762] [radeonsi,apitrace] Firewatch: nothing rendered in scrollable (text) areas

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96762

Kai  changed:

   What|Removed |Added

Summary|[radeonsi] Firewatch:   |[radeonsi,apitrace]
   |nothing rendered in |Firewatch: nothing rendered
   |scrollable (text) areas |in scrollable (text) areas
 Whiteboard||apitrace

--- Comment #4 from Kai  ---
NB: IMHO the "Keywords" field should be extended to also allow "apitrace"

-- 
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/20160701/7fb99bf0/attachment.html>


[Intel-gfx] [PATCH 2/3] drm/vgem: Enable dmabuf interface for export

2016-07-01 Thread Matthew Auld
> +static struct sg_table *vgem_prime_get_sg_table(struct drm_gem_object *obj)
> +{
> +   long n_pages = obj->size >> PAGE_SHIFT;
> +   struct sg_table *st;
> +   struct page **pages;
> +   int ret;
> +
> +   st = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
> +   if (st == NULL)
> +   return ERR_PTR(-ENOMEM);
> +
> +   pages = drm_gem_get_pages(obj);
> +   if (IS_ERR(pages)) {
> +   ret = PTR_ERR(pages);
> +   goto err;
> +   }
> +
> +   ret = sg_alloc_table_from_pages(st, pages, n_pages,
> +   0, obj->size, GFP_KERNEL);
> +   drm_gem_put_pages(obj, pages, false, false);
> +   if (ret)
> +   goto err;
> +
> +   return st;
> +
> +err:
> +   kfree(st);
> +   return ERR_PTR(ret);
> +}
> +
Couldn't this be written more simply as:

pages = drm_gem_get_pages(obj);
if (IS_ERR(pages))
return ERR_CAST(pages);

st = drm_prime_pages_to_sg(pages, n_pages);
drm_gem_put_pages(obj, pages, false, false);

return st;

But either way:
Reviewed-by: Matthew Auld 


[Bug 96762] [radeonsi] Firewatch: nothing rendered in scrollable (text) areas

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96762

--- Comment #3 from Kai  ---
(In reply to Nicolai Hähnle from comment #2)
> Do you see the issue also in an apitrace? If so, could you upload it?

Yes, I can! Find the trace at
<http://dev.carbon-project.org/debian/mesa.bugs/96762/firewatch.trace>. You'll
need your login credentials – you should have from a previous trace file – 
to
download it (I just want to prevent needless traffic, if I should reset your
password, let me know and I e-mail you a new one); other known Mesa developers
without login credentials can contact me by private e-mail and I'm happy to set
them up.

The trace shows the launch of the game and then the graphics settings menu as
shown in attachment 124836.

Let me know, if you need something else.

-- 
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/20160701/b6744c2c/attachment.html>


[PATCH v3 4/4] drm/rockchip: analogix_dp: implement PSR function

2016-07-01 Thread Yakir Yang
Alway enable the PSR function for Rockchip analogix_dp driver. If panel
don't support PSR, then the core analogix_dp would ignore this setting.

Signed-off-by: Yakir Yang 
---
Changes in v3:
- split the common psr logic into a seperate driver, make this to a
  simple sub-psr device driver.

Changes in v2:
- remove vblank notify out (Daniel)
- create a psr_active() callback in vop data struct.

 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 52 +
 1 file changed, 52 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index e81e19a..80a60a6 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -32,6 +32,7 @@
 #include 

 #include "rockchip_drm_drv.h"
+#include "rockchip_drm_psr.h"
 #include "rockchip_drm_vop.h"

 #define RK3288_GRF_SOC_CON60x25c
@@ -68,11 +69,53 @@ struct rockchip_dp_device {
struct regmap*grf;
struct reset_control *rst;

+   struct delayed_work  psr_work;
+   unsigned int psr_state;
+
const struct rockchip_dp_chip_data *data;

struct analogix_dp_plat_data plat_data;
 };

+static int analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled)
+{
+   struct rockchip_dp_device *dp = to_dp(encoder);
+
+   dev_dbg(dp->dev, "%s PSR...\n", enabled ? "Entry" : "Exit");
+
+   if (enabled)
+   dp->psr_state = EDP_VSC_PSR_STATE_ACTIVE;
+   else
+   dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
+
+   schedule_delayed_work(>psr_work, msecs_to_jiffies(10));
+
+   return 0;
+}
+
+static void analogix_dp_psr_work(struct work_struct *work)
+{
+   struct rockchip_dp_device *dp =
+   container_of(work, typeof(*dp), psr_work.work);
+   struct drm_crtc *crtc = dp->encoder.crtc;
+   int psr_state = dp->psr_state;
+   int vact_end;
+   int ret;
+
+   if (!crtc)
+   return;
+
+   vact_end = crtc->mode.vtotal - crtc->mode.vsync_start + 
crtc->mode.vdisplay;
+
+   ret = rockchip_drm_wait_line_flag(dp->encoder.crtc, vact_end, 100);
+   if (ret == 0) {
+   if (psr_state == EDP_VSC_PSR_STATE_ACTIVE)
+   analogix_dp_active_psr(dp->dev);
+   else
+   analogix_dp_inactive_psr(dp->dev);
+   }
+}
+
 static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
 {
reset_control_assert(dp->rst);
@@ -340,12 +383,21 @@ static int rockchip_dp_bind(struct device *dev, struct 
device *master,
dp->plat_data.power_off = rockchip_dp_powerdown;
dp->plat_data.get_modes = rockchip_dp_get_modes;

+   dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
+   INIT_DELAYED_WORK(>psr_work, analogix_dp_psr_work);
+
+   rockchip_drm_psr_register(>encoder, analogix_dp_psr_set);
+
return analogix_dp_bind(dev, dp->drm_dev, >plat_data);
 }

 static void rockchip_dp_unbind(struct device *dev, struct device *master,
   void *data)
 {
+   struct rockchip_dp_device *dp = dev_get_drvdata(dev);
+
+   rockchip_drm_psr_unregister(>encoder);
+
return analogix_dp_unbind(dev, master, data);
 }

-- 
1.9.1




[PATCH v3 3/4] drm/bridge: analogix_dp: add the PSR function support

2016-07-01 Thread Yakir Yang
The full name of PSR is Panel Self Refresh, panel device could refresh
itself with the hardware framebuffer in panel, this would make lots of
sense to save the power consumption.

This patch have exported two symbols for platform driver to implement
the PSR function in hardware side:
- analogix_dp_active_psr()
- analogix_dp_inactive_psr()

Signed-off-by: Yakir Yang 
---
Changes in v3:
- split analogix_dp_enable_psr(), make it more clearly
analogix_dp_detect_sink_psr()
analogix_dp_enable_sink_psr()
- remove some nosie register setting comments

Changes in v2:
- introduce in v2, splite the common Analogix DP changes out

 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 64 ++
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  4 ++
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  | 54 ++
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h  | 28 ++
 include/drm/bridge/analogix_dp.h   |  3 +
 5 files changed, 153 insertions(+)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 32715da..b557097 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -97,6 +97,66 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device 
*dp)
return 0;
 }

+int analogix_dp_active_psr(struct device *dev)
+{
+   struct analogix_dp_device *dp = dev_get_drvdata(dev);
+
+   if (!dp->psr_support)
+   return -EINVAL;
+
+   analogix_dp_send_psr_spd(dp, EDP_VSC_PSR_STATE_ACTIVE |
+EDP_VSC_PSR_CRC_VALUES_VALID);
+   return 0;
+}
+EXPORT_SYMBOL_GPL(analogix_dp_active_psr);
+
+int analogix_dp_inactive_psr(struct device *dev)
+{
+   struct analogix_dp_device *dp = dev_get_drvdata(dev);
+
+   if (!dp->psr_support)
+   return -EINVAL;
+
+   analogix_dp_send_psr_spd(dp, 0);
+   return 0;
+}
+EXPORT_SYMBOL_GPL(analogix_dp_inactive_psr);
+
+static bool analogix_dp_detect_sink_psr(struct analogix_dp_device *dp)
+{
+   unsigned char psr_version;
+
+   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_SUPPORT, _version);
+   dev_info(dp->dev, "Panel PSR version : %x\n", psr_version);
+
+   return (psr_version & DP_PSR_IS_SUPPORTED) ? true : false;
+}
+
+static int analogix_dp_enable_sink_psr(struct analogix_dp_device *dp)
+{
+   unsigned char psr_en;
+
+   /* Disable psr function */
+   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_EN_CFG, _en);
+   psr_en &= ~DP_PSR_ENABLE;
+   analogix_dp_write_byte_to_dpcd(dp, DP_PSR_EN_CFG, psr_en);
+
+   /* Main-Link transmitter remains active during PSR active states */
+   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_EN_CFG, _en);
+   psr_en = DP_PSR_MAIN_LINK_ACTIVE | DP_PSR_CRC_VERIFICATION;
+   analogix_dp_write_byte_to_dpcd(dp, DP_PSR_EN_CFG, psr_en);
+
+   /* Enable psr function */
+   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_EN_CFG, _en);
+   psr_en = DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE |
+DP_PSR_CRC_VERIFICATION;
+   analogix_dp_write_byte_to_dpcd(dp, DP_PSR_EN_CFG, psr_en);
+
+   analogix_dp_enable_psr_crc(dp);
+
+   return 0;
+}
+
 static unsigned char analogix_dp_calc_edid_check_sum(unsigned char *edid_data)
 {
int i;
@@ -921,6 +981,10 @@ static void analogix_dp_commit(struct analogix_dp_device 
*dp)

/* Enable video */
analogix_dp_start_video(dp);
+
+   dp->psr_support = analogix_dp_detect_sink_psr(dp);
+   if (dp->psr_support)
+   analogix_dp_enable_sink_psr(dp);
 }

 int analogix_dp_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
index b456380..6ca5dde 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
@@ -177,6 +177,7 @@ struct analogix_dp_device {
int hpd_gpio;
boolforce_hpd;
unsigned char   edid[EDID_BLOCK_LENGTH * 2];
+   boolpsr_support;

struct analogix_dp_plat_data *plat_data;
 };
@@ -278,4 +279,7 @@ int analogix_dp_is_video_stream_on(struct 
analogix_dp_device *dp);
 void analogix_dp_config_video_slave_mode(struct analogix_dp_device *dp);
 void analogix_dp_enable_scrambling(struct analogix_dp_device *dp);
 void analogix_dp_disable_scrambling(struct analogix_dp_device *dp);
+void analogix_dp_enable_psr_crc(struct analogix_dp_device *dp);
+void analogix_dp_send_psr_spd(struct analogix_dp_device *dp, int db1);
+
 #endif /* _ANALOGIX_DP_CORE_H */
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index 48030f0..e8372c7 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ 

[PATCH v3 2/4] drm/rockchip: add an common abstracted PSR driver

2016-07-01 Thread Yakir Yang
The PSR driver have exported four symbols for specific device driver:
- rockchip_drm_psr_register()
- rockchip_drm_psr_unregister()
- rockchip_drm_psr_enable()
- rockchip_drm_psr_disable()
- rockchip_drm_psr_flush()

Encoder driver should call the register/unregister interfaces to hook
itself into common PSR driver, encoder have implement the 'psr_set'
callback which use the set PSR state in hardware side.

Crtc driver would call the enable/disable interfaces when vblank is
enable/disable, after that the common PSR driver would call the encoder
registered callback to set the PSR state.

Fb driver would call the flush interface in 'fb->dirty' callback, this
helper function would force all PSR enabled encoders to exit from PSR
for 3 seconds.

Signed-off-by: Yakir Yang 
---
Changes in v3:
- split the psr flow into an common abstracted PSR driver
- implement the 'fb->dirty' callback function (Daniel)
- avoid to use notify to acqiure for vact event (Daniel)
- remove psr_active() callback which introduce in v2

Changes in v2: None

 drivers/gpu/drm/rockchip/Makefile   |   2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  |  12 ++
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 200 
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h |  12 ++
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  24 
 5 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h

diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index 05d0713..9746365 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -3,7 +3,7 @@
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.

 rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
-   rockchip_drm_gem.o rockchip_drm_vop.o
+   rockchip_drm_gem.o rockchip_drm_psr.o rockchip_drm_vop.o
 rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o

 obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index 20f12bc..0fec18f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -21,6 +21,7 @@

 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_gem.h"
+#include "rockchip_drm_psr.h"

 #define to_rockchip_fb(x) container_of(x, struct rockchip_drm_fb, fb)

@@ -66,9 +67,20 @@ static int rockchip_drm_fb_create_handle(struct 
drm_framebuffer *fb,
 rockchip_fb->obj[0], handle);
 }

+static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb,
+struct drm_file *file,
+unsigned int flags, unsigned int color,
+struct drm_clip_rect *clips,
+unsigned int num_clips)
+{
+   rockchip_drm_psr_flush();
+   return 0;
+}
+
 static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = {
.destroy= rockchip_drm_fb_destroy,
.create_handle  = rockchip_drm_fb_create_handle,
+   .dirty  = rockchip_drm_fb_dirty,
 };

 static struct rockchip_drm_fb *
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
new file mode 100644
index 000..c03
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
@@ -0,0 +1,200 @@
+#include 
+
+#include "rockchip_drm_psr.h"
+
+#define PSR_FLUSH_TIMEOUT  msecs_to_jiffies(3000) /* 3 seconds */
+
+static LIST_HEAD(psr_list);
+static DEFINE_MUTEX(psr_list_mutex);
+
+enum psr_state {
+   PSR_FLUSH,
+   PSR_ENABLE,
+   PSR_DISABLE,
+};
+
+struct psr_drv {
+   struct list_head list;
+   enum psr_state state;
+   struct mutex state_mutex;
+
+   struct timer_list flush_timer;
+
+   struct drm_encoder *encoder;
+   int (*set)(struct drm_encoder *encoder, bool enable);
+};
+
+static struct psr_drv *find_psr_by_crtc(struct drm_crtc *crtc)
+{
+   struct psr_drv *psr;
+
+   mutex_lock(_list_mutex);
+   list_for_each_entry(psr, _list, list) {
+   if (psr->encoder->crtc == crtc) {
+   mutex_unlock(_list_mutex);
+   return psr;
+   }
+   }
+   mutex_unlock(_list_mutex);
+
+   return ERR_PTR(-ENODEV);
+}
+
+static void psr_enable(struct psr_drv *psr)
+{
+   if (psr->state == PSR_ENABLE)
+   return;
+
+   mutex_lock(>state_mutex);
+   psr->state = PSR_ENABLE;
+   psr->set(psr->encoder, true);
+   mutex_unlock(>state_mutex);
+}
+
+static void psr_disable(struct psr_drv *psr)
+{
+   if (psr->state == PSR_DISABLE)
+   return;
+
+   mutex_lock(>state_mutex);
+   psr->state = PSR_DISABLE;
+   psr->set(psr->encoder, false);
+   

[PATCH v3 1/4] drm/rockchip: vop: export line flag function

2016-07-01 Thread Yakir Yang
VOP have integrated a hardware counter which indicate the exact display
line that vop is scanning. And if we're interested in a specific line,
we can set the line number to vop line_flag register, and then vop would
generate a line_flag interrupt for it.

For example eDP PSR function is interested in the vertical blanking
period, then driver could set the line number to zero.

This patch have exported a symbol that allow other driver to listen the
line flag event with given timeout limit:
-  rockchip_drm_wait_line_flag()

Signed-off-by: Yakir Yang 
---
Changes in v3:
- Export the 'rockchip_drm_wait_line_flag' symbol, and document it.
- Add 'line_flag_num_0' for RK3288/RK3036
- Remove the notify for waiting line_flag event (Daniel)

Changes in v2:
- Introduce in v2, split VOP line flag changes out

 drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   3 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 103 
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h |   3 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c |   4 ++
 4 files changed, 113 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index ea39329..239b830 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -70,4 +70,7 @@ int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
   struct device *dev);
 void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
struct device *dev);
+int rockchip_drm_wait_line_flag(struct drm_crtc *crtc, unsigned int line_num,
+   unsigned int mstimeout);
+
 #endif /* _ROCKCHIP_DRM_DRV_H_ */
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index c8a62a8..cd3cac5 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -121,6 +121,8 @@ struct vop {
/* protected by dev->event_lock */
struct drm_pending_vblank_event *event;

+   struct completion line_flag_completion;
+
const struct vop_data *data;

uint32_t *regsbak;
@@ -431,6 +433,59 @@ static void vop_dsp_hold_valid_irq_disable(struct vop *vop)
spin_unlock_irqrestore(>irq_lock, flags);
 }

+/*
+ * (1) each frame starts at the start of the Vsync pulse which is signaled by
+ * the "FRAME_SYNC" interrupt.
+ * (2) the active data region of each frame ends at dsp_vact_end
+ * (3) we should program this same number (dsp_vact_end) into 
dsp_line_frag_num,
+ *  to get "LINE_FLAG" interrupt at the end of the active on screen data.
+ *
+ * VOP_INTR_CTRL0.dsp_line_frag_num = VOP_DSP_VACT_ST_END.dsp_vact_end
+ * Interrupts
+ * LINE_FLAG ---+
+ * FRAME_SYNC + |
+ *| |
+ *v v
+ *| Vsync | Vbp |  Vactive  | Vfp |
+ *^ ^   ^ ^
+ *| |   | |
+ *| |   | |
+ * dsp_vs_end + |   | |   VOP_DSP_VTOTAL_VS_END
+ * dsp_vact_start --+   | |   VOP_DSP_VACT_ST_END
+ * dsp_vact_end + |   VOP_DSP_VACT_ST_END
+ * dsp_total -+   VOP_DSP_VTOTAL_VS_END
+ */
+
+static void vop_line_flag_irq_enable(struct vop *vop, int line_num)
+{
+   unsigned long flags;
+
+   if (WARN_ON(!vop->is_enabled))
+   return;
+
+   spin_lock_irqsave(>irq_lock, flags);
+
+   VOP_CTRL_SET(vop, line_flag_num_0, line_num);
+   VOP_INTR_SET_TYPE(vop, enable, LINE_FLAG_INTR, 1);
+   vop_cfg_done(vop);
+
+   spin_unlock_irqrestore(>irq_lock, flags);
+}
+
+static void vop_line_flag_irq_disable(struct vop *vop)
+{
+   unsigned long flags;
+
+   if (WARN_ON(!vop->is_enabled))
+   return;
+
+   spin_lock_irqsave(>irq_lock, flags);
+
+   VOP_INTR_SET_TYPE(vop, enable, LINE_FLAG_INTR, 0);
+
+   spin_unlock_irqrestore(>irq_lock, flags);
+}
+
 static void vop_enable(struct drm_crtc *crtc)
 {
struct vop *vop = to_vop(crtc);
@@ -1157,6 +1212,13 @@ static irqreturn_t vop_isr(int irq, void *data)
ret = IRQ_HANDLED;
}

+   if (active_irqs & LINE_FLAG_INTR) {
+   if (!completion_done(>line_flag_completion))
+   complete(>line_flag_completion);
+   active_irqs &= ~LINE_FLAG_INTR;
+   ret = IRQ_HANDLED;
+   }
+
if (active_irqs & FS_INTR) {
drm_crtc_handle_vblank(crtc);
vop_handle_vblank(vop);
@@ -1255,6 +1317,7 @@ static int vop_create_crtc(struct vop *vop)

init_completion(>dsp_hold_completion);
init_completion(>wait_update_complete);
+   

[PATCH v3 0/4] Add PSR function support for Analogix/Rockchip DP

2016-07-01 Thread Yakir Yang
Hi all,

The full name of PSR is Panel Self Refresh, panel device could refresh
itself with the hardware framebuffer in panel, this would make a lots
of sense to save the power consumption.

This v3 version have splited an common PSR driver for Rockchip, which is
biggest changes from v2.

This thread is based on Mark's RK3399 VOP thread[0] and my RK3399 eDP
thread[1].

[0]: https://patchwork.kernel.org/patch/8886041/
[1]: https://patchwork.kernel.org/patch/9204497/

Thanks,
- Yakir


Changes in v3:
- Remove the notify for waiting line_flag event (Daniel)
- implement the 'fb->dirty' callback function (Daniel)
- avoid to use notify to acqiure for vact event (Daniel)
- split the psr flow into an common abstracted PSR driver
- Export the 'rockchip_drm_wait_line_flag' symbol, and document it.
- Add 'line_flag_num_0' for RK3288/RK3036
- remove psr_active() callback which introduce in v2
- split analogix_dp_enable_psr(), make it more clearly
analogix_dp_detect_sink_psr()
analogix_dp_enable_sink_psr()
- remove some nosie register setting comments
- split the common psr logic into a seperate driver, make this to a
  simple sub-psr device driver.

Changes in v2:
- Introduce in v2, split VOP line flag changes out
- introduce in v2, splite the common Analogix DP changes out
- remove vblank notify out (Daniel)
- create a psr_active() callback in vop data struct.

Yakir Yang (4):
  drm/rockchip: vop: export line flag function
  drm/rockchip: add an common abstracted PSR driver
  drm/bridge: analogix_dp: add the PSR function support
  drm/rockchip: analogix_dp: implement PSR function

 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  64 +++
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |   4 +
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  |  54 ++
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h  |  28 +++
 drivers/gpu/drm/rockchip/Makefile  |   2 +-
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c|  52 ++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h|   3 +
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c |  12 ++
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c| 200 +
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h|  12 ++
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c| 127 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.h|   3 +
 drivers/gpu/drm/rockchip/rockchip_vop_reg.c|   4 +
 include/drm/bridge/analogix_dp.h   |   3 +
 14 files changed, 567 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h

-- 
1.9.1




[Bug 80419] XCOM: Enemy Unknown Causes lockup

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=80419

--- Comment #135 from Alassane Maiga  ---
I had something interesting happen with kernel 4.7 rc5 and mesa 12.1 git1591e66
The system would lock up, and the console would fill with the stalling ring
messages. But then it won't lock up and will recover somewhat. The game
wouldn't crash either, allowing me to exit it cleanly. Plasmashell would crash
though, and there is a lot of video corruption on the desktop afterwards until
the reboot. Happened two times in a row

-- 
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/20160701/dbf8c779/attachment.html>


[patch] drm/mediatek/mtk_mipi_tx: checking the wrong variable

2016-07-01 Thread Dan Carpenter
We should be checking "phy_provider" here not "phy".

Fixes: 2e54c14e310f ('drm/mediatek: Add DSI sub driver')
Signed-off-by: Dan Carpenter 

diff --git a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c 
b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
index cf8f38d..1c366f8 100644
--- a/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
+++ b/drivers/gpu/drm/mediatek/mtk_mipi_tx.c
@@ -431,7 +431,7 @@ static int mtk_mipi_tx_probe(struct platform_device *pdev)
phy_set_drvdata(phy, mipi_tx);

phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
-   if (IS_ERR(phy)) {
+   if (IS_ERR(phy_provider)) {
ret = PTR_ERR(phy_provider);
return ret;
}


[PATCH] drm/imx: parallel-display: add bridge support

2016-07-01 Thread Philipp Zabel
Add support for bridge chips connected externally to the i.MX
DISP0/DISP1 DPI interfaces.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/parallel-display.c | 71 --
 1 file changed, 59 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 2d1fd02..830e56b 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -37,6 +37,7 @@ struct imx_parallel_display {
u32 bus_format;
struct drm_display_mode mode;
struct drm_panel *panel;
+   struct drm_bridge *bridge;
 };

 static enum drm_connector_status imx_pd_connector_detect(
@@ -103,8 +104,23 @@ static void imx_pd_encoder_dpms(struct drm_encoder 
*encoder, int mode)
 static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
 {
struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
-   imx_drm_set_bus_config(encoder, imxpd->bus_format, 2, 3,
-  imxpd->connector.display_info.bus_flags);
+   struct drm_connector *connector;
+   u32 bus_format = imxpd->bus_format;
+   u32 bus_flags;
+
+   drm_for_each_connector(connector, encoder->dev) {
+   struct drm_display_info *di = >display_info;
+
+   if (connector->encoder != encoder)
+   continue;
+
+   bus_flags = di->bus_flags;
+   if (!bus_format && di->num_bus_formats)
+   bus_format = di->bus_formats[0];
+   break;
+   }
+
+   imx_drm_set_bus_config(encoder, bus_format, 2, 3, bus_flags);
 }

 static void imx_pd_encoder_commit(struct drm_encoder *encoder)
@@ -174,15 +190,29 @@ static int imx_pd_register(struct drm_device *drm,
drm_encoder_init(drm, >encoder, _pd_encoder_funcs,
 DRM_MODE_ENCODER_NONE, NULL);

-   drm_connector_helper_add(>connector,
-   _pd_connector_helper_funcs);
-   drm_connector_init(drm, >connector, _pd_connector_funcs,
-  DRM_MODE_CONNECTOR_VGA);
+   if (!imxpd->bridge) {
+   drm_connector_helper_add(>connector,
+   _pd_connector_helper_funcs);
+   drm_connector_init(drm, >connector,
+  _pd_connector_funcs,
+  DRM_MODE_CONNECTOR_VGA);
+   }

if (imxpd->panel)
drm_panel_attach(imxpd->panel, >connector);
-
-   drm_mode_connector_attach_encoder(>connector, >encoder);
+   if (imxpd->bridge) {
+   imxpd->bridge->encoder = >encoder;
+   imxpd->encoder.bridge = imxpd->bridge;
+   ret = drm_bridge_attach(drm, imxpd->bridge);
+   if (ret < 0) {
+   dev_err(imxpd->dev, "failed to attach bridge: %d\n",
+   ret);
+   return ret;
+   }
+   } else {
+   drm_mode_connector_attach_encoder(>connector,
+ >encoder);
+   }

return 0;
 }
@@ -223,13 +253,30 @@ static int imx_pd_bind(struct device *dev, struct device 
*master, void *data)
struct device_node *remote;

remote = of_graph_get_remote_port_parent(ep);
+   if (!remote) {
+   dev_warn(dev, "endpoint %s not connected\n",
+ep->full_name);
+   of_node_put(ep);
+   return -ENODEV;
+   }
of_node_put(ep);
-   if (remote) {
-   imxpd->panel = of_drm_find_panel(remote);
-   of_node_put(remote);
+
+   imxpd->panel = of_drm_find_panel(remote);
+   if (imxpd->panel) {
+   dev_dbg(dev, "found panel %s\n", remote->full_name);
+   } else {
+   imxpd->bridge = of_drm_find_bridge(remote);
+   if (imxpd->bridge)
+   dev_dbg(dev, "found bridge %s\n",
+   remote->full_name);
}
-   if (!imxpd->panel)
+   if (!imxpd->panel && !imxpd->bridge) {
+   dev_dbg(dev, "waiting for panel or bridge %s\n",
+   remote->full_name);
+   of_node_put(remote);
return -EPROBE_DEFER;
+   }
+   of_node_put(remote);
}

imxpd->dev = dev;
-- 
2.8.1



[PATCH 2/2] drm/bridge: tc358767: Add DPI to eDP bridge driver

2016-07-01 Thread Philipp Zabel
From: Andrey Gusakov 

Add a drm_bridge driver for the Toshiba TC358767 DPI/DSI to
eDP/DP bridge. Currently only DPI input with 24-bit RGB is
supported.

Signed-off-by: Andrey Gusakov 
Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/bridge/Kconfig|8 +
 drivers/gpu/drm/bridge/Makefile   |1 +
 drivers/gpu/drm/bridge/tc358767.c | 1419 +
 3 files changed, 1428 insertions(+)
 create mode 100644 drivers/gpu/drm/bridge/tc358767.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 8f7423f..04c2b6d 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -50,6 +50,14 @@ config DRM_PARADE_PS8622
---help---
  Parade eDP-LVDS bridge chip driver.

+config DRM_TOSHIBA_TC358767
+   tristate "Toshiba TC358767 eDP bridge"
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   select DRM_PANEL
+   ---help---
+ Toshiba TC358767 eDP bridge chip driver.
+
 source "drivers/gpu/drm/bridge/analogix/Kconfig"

 endmenu
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 96b13b3..7c21a3c 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o
 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
+obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
diff --git a/drivers/gpu/drm/bridge/tc358767.c 
b/drivers/gpu/drm/bridge/tc358767.c
new file mode 100644
index 000..515f123
--- /dev/null
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -0,0 +1,1419 @@
+/*
+ * tc358767 eDP bridge driver
+ *
+ * Copyright (C) 2016 CogentEmbedded Inc
+ * Author: Andrey Gusakov 
+ *
+ * Copyright (C) 2016 Pengutronix, Philipp Zabel 
+ *
+ * Initially based on: drivers/gpu/drm/i2c/tda998x_drv.c
+ *
+ * Copyright (C) 2012 Texas Instruments
+ * Author: Rob Clark 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Registers */
+
+/* Display Parallel Interface */
+#define DPIPXLFMT  0x0440
+#define VS_POL_ACTIVE_LOW  (1 << 10)
+#define HS_POL_ACTIVE_LOW  (1 << 9)
+#define DE_POL_ACTIVE_HIGH (0 << 8)
+#define SUB_CFG_TYPE_CONFIG1   (0 << 2) /* LSB aligned */
+#define SUB_CFG_TYPE_CONFIG2   (1 << 2) /* Loosely Packed */
+#define SUB_CFG_TYPE_CONFIG3   (2 << 2) /* LSB aligned 8-bit */
+#define DPI_BPP_RGB888 (0 << 0)
+#define DPI_BPP_RGB666 (1 << 0)
+#define DPI_BPP_RGB565 (2 << 0)
+
+/* Video Path */
+#define VPCTRL00x0450
+#define OPXLFMT_RGB666 (0 << 8)
+#define OPXLFMT_RGB888 (1 << 8)
+#define FRMSYNC_DISABLED   (0 << 4) /* Video Timing Gen Disabled */
+#define FRMSYNC_ENABLED(1 << 4) /* Video Timing Gen 
Enabled */
+#define MSF_DISABLED   (0 << 0) /* Magic Square FRC disabled */
+#define MSF_ENABLED(1 << 0) /* Magic Square FRC enabled */
+#define HTIM01 0x0454
+#define HTIM02 0x0458
+#define VTIM01 0x045c
+#define VTIM02 0x0460
+#define VFUEN0 0x0464
+#define VFUEN  BIT(0)   /* Video Frame Timing Upload */
+
+/* System */
+#define TC_IDREG   0x0500
+#define SYSCTRL0x0510
+#define DP0_AUDSRC_NO_INPUT(0 << 3)
+#define DP0_AUDSRC_I2S_RX  (1 << 3)
+#define DP0_VIDSRC_NO_INPUT(0 << 0)
+#define DP0_VIDSRC_DSI_RX  (1 << 0)
+#define DP0_VIDSRC_DPI_RX  (2 << 0)
+#define DP0_VIDSRC_COLOR_BAR   (3 << 0)
+
+/* Control */
+#define DP0CTL 0x0600
+#define VID_MN_GEN BIT(6)   /* Auto-generate M/N values */
+#define EF_EN  BIT(5)   /* Enable Enhanced Framing */
+#define VID_EN BIT(1)   /* Video transmission enable */
+#define DP_EN  BIT(0)   /* Enable DPTX function */
+
+/* Clocks */
+#define DP0_VIDMNGEN0  0x0610
+#define DP0_VIDMNGEN1  0x0614

[PATCH 1/2] dt-bindings: tc358767: add DT documentation

2016-07-01 Thread Philipp Zabel
Add DT binding documentation for the Toshiba TC358767 eDP bridge.

Signed-off-by: Philipp Zabel 
---
 .../bindings/display/bridge/toshiba,tc358767.txt   | 48 ++
 1 file changed, 48 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt

diff --git 
a/Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt 
b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt
new file mode 100644
index 000..c58a59f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt
@@ -0,0 +1,48 @@
+Toshiba TC358767 eDP bridge bindings
+
+Required properties:
+ - compatible: "toshiba,tc358767"
+ - reg: i2c address of the bridge, 0x68 or 0x0f, depending on bootstrap pins
+ - clock-names: should be "ref"
+ - clocks: OF device-tree clock specification for refclk input. The reference
+   clock rate must be 13 MHz, 19.2 MHz, 26 MHz, or 38.4 MHz.
+
+Optional properties:
+ - shutdown-gpios: OF device-tree gpio specification for SD pin
+   (active high shutdown input)
+ - reset-gpios: OF device-tree gpio specification for RSTX pin
+(active low system reset)
+ - ports: the ports node can contain video interface port nodes to connect
+   to a DPI/DSI source and to an eDP/DP sink according to [1][2].
+
+[1]: Documentation/devicetree/bindings/graph.txt
+[2]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+   edp-bridge at 68 {
+   compatible = "toshiba,tc358767";
+   reg = <0x68>;
+   shutdown-gpios = < 23 GPIO_ACTIVE_HIGH>;
+   reset-gpios = < 24 GPIO_ACTIVE_LOW>;
+   clock-names = "ref";
+   clocks = <_refclk>;
+
+   ports {
+   port at 0 {
+   reg = <0>;
+
+   bridge_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+
+   port at 1 {
+   reg = <1>;
+
+   bridge_out: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+   };
+
-- 
2.8.1



[PATCH 0/2] Toshiba TC358767 eDP bridge driver

2016-07-01 Thread Philipp Zabel
Hi,

this patchset adds DT binding docs and a drm_bridge driver for the
Toshiba TC358767 eDP bridge, currently supporting only 24-bit DPI input
and control via I2C. The chip is also capable to act as a DSI sink, but
the driver doesn't support that yet.
It is based on Andrey's initial driver, which can be found at
https://github.com/CogentEmbedded/linux-zodiac.git, commit 4abb1d0a9a1c
("drm/i2c: tc358767 eDP encoder initial commit"). I have turned it into
a drm_bridge driver and changed it to use regmap and the drm_dp helpers.

regards
Philipp

Andrey Gusakov (1):
  drm/bridge: tc358767: Add DPI to eDP bridge driver

Philipp Zabel (1):
  dt-bindings: tc358767: add DT documentation

 .../bindings/display/bridge/toshiba,tc358767.txt   |   48 +
 drivers/gpu/drm/bridge/Kconfig |8 +
 drivers/gpu/drm/bridge/Makefile|1 +
 drivers/gpu/drm/bridge/tc358767.c  | 1419 
 4 files changed, 1476 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/bridge/toshiba,tc358767.txt
 create mode 100644 drivers/gpu/drm/bridge/tc358767.c

-- 
2.8.1



[PATCH v3 4/4] drm/rockchip: analogix_dp: implement PSR function

2016-07-01 Thread Sean Paul
On Fri, Jul 1, 2016 at 5:19 AM, Yakir Yang  wrote:
> Alway enable the PSR function for Rockchip analogix_dp driver. If panel
> don't support PSR, then the core analogix_dp would ignore this setting.
>
> Signed-off-by: Yakir Yang 
> ---
> Changes in v3:
> - split the common psr logic into a seperate driver, make this to a
>   simple sub-psr device driver.
>
> Changes in v2:
> - remove vblank notify out (Daniel)
> - create a psr_active() callback in vop data struct.
>
>  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 52 
> +
>  1 file changed, 52 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
> b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> index e81e19a..80a60a6 100644
> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> @@ -32,6 +32,7 @@
>  #include 
>
>  #include "rockchip_drm_drv.h"
> +#include "rockchip_drm_psr.h"
>  #include "rockchip_drm_vop.h"
>
>  #define RK3288_GRF_SOC_CON60x25c
> @@ -68,11 +69,53 @@ struct rockchip_dp_device {
> struct regmap*grf;
> struct reset_control *rst;
>
> +   struct delayed_work  psr_work;
> +   unsigned int psr_state;
> +
> const struct rockchip_dp_chip_data *data;
>
> struct analogix_dp_plat_data plat_data;
>  };
>
> +static int analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled)

Again, this function doesn't fail, but its return type is int.
Fortunately you don't check the return in rockchip_drm_psr.c, so this
also seems like a good void candidate.

> +{
> +   struct rockchip_dp_device *dp = to_dp(encoder);
> +
> +   dev_dbg(dp->dev, "%s PSR...\n", enabled ? "Entry" : "Exit");
> +
> +   if (enabled)
> +   dp->psr_state = EDP_VSC_PSR_STATE_ACTIVE;
> +   else
> +   dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
> +
> +   schedule_delayed_work(>psr_work, msecs_to_jiffies(10));

Pull 10 out into a #define

> +
> +   return 0;
> +}
> +
> +static void analogix_dp_psr_work(struct work_struct *work)
> +{
> +   struct rockchip_dp_device *dp =
> +   container_of(work, typeof(*dp), 
> psr_work.work);
> +   struct drm_crtc *crtc = dp->encoder.crtc;
> +   int psr_state = dp->psr_state;
> +   int vact_end;
> +   int ret;
> +
> +   if (!crtc)
> +   return;
> +
> +   vact_end = crtc->mode.vtotal - crtc->mode.vsync_start + 
> crtc->mode.vdisplay;
> +
> +   ret = rockchip_drm_wait_line_flag(dp->encoder.crtc, vact_end, 100);


Pull 100 out into a #define

> +   if (ret == 0) {

if (ret) {
dev_err(... "line flag interrupt did not arrive");
return;
}

> +   if (psr_state == EDP_VSC_PSR_STATE_ACTIVE)
> +   analogix_dp_active_psr(dp->dev);
> +   else
> +   analogix_dp_inactive_psr(dp->dev);
> +   }
> +}
> +
>  static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
>  {
> reset_control_assert(dp->rst);
> @@ -340,12 +383,21 @@ static int rockchip_dp_bind(struct device *dev, struct 
> device *master,
> dp->plat_data.power_off = rockchip_dp_powerdown;
> dp->plat_data.get_modes = rockchip_dp_get_modes;
>
> +   dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
> +   INIT_DELAYED_WORK(>psr_work, analogix_dp_psr_work);
> +
> +   rockchip_drm_psr_register(>encoder, analogix_dp_psr_set);
> +
> return analogix_dp_bind(dev, dp->drm_dev, >plat_data);
>  }
>
>  static void rockchip_dp_unbind(struct device *dev, struct device *master,
>void *data)
>  {
> +   struct rockchip_dp_device *dp = dev_get_drvdata(dev);
> +
> +   rockchip_drm_psr_unregister(>encoder);
> +
> return analogix_dp_unbind(dev, master, data);
>  }
>
> --
> 1.9.1
>
>


DMA, CMA and SWIOTLB

2016-07-01 Thread Liviu Dudau
On Wed, Jun 29, 2016 at 10:52:02AM +0100, Jose Abreu wrote:
> Hi all,
> 
> I am writing a very simple KMS driver that uses Xilinx VDMA to
> transfer data between the host and a FPGA. To handle memory
> allocation for DMA I am using the CMA helpers available in the
> DRM subsystem. When setting for low video modes (small memory
> requirements) everything works fine, but if I try to set a large
> video mode (specifically a 4k HDMI mode) I get SWIOTLB errors
> saying the buffer is full.
> 
> The distinction between CMA and SWIOTLB is not clear to me, but
> these are two different allocation engines, right?
> 
> One important aspect in my configuration is that the Xilinx VDMA
> can only access up to 28 bits of the host memory so I set the DMA
> mask to 28 bits and force the CMA region to be allocated bellow
> these 28 bits. I also tried increasing the CMA size and the
> SWIOTLB size without success.
> 
> Any comments on this?

You're not telling us which architecture you are using. For AArch64,
for example, the CMA expects DMA-able memory for the buffers. If
the driver does not call the dma_set_mask_and_coherent() function then
the arch core code will assume that the driver can't directly access
that memory and will use the SWIOTLB area for bouncing buffers around.
When the size of the buffers you are using for framebuffers increases,
you are likely to run out of SWIOTLB space.

Best regards,
Liviu

> 
> Thanks in advance for your help.
> 
> Best regards,
> Jose Miguel Abreu
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
---
   .oooO
   (   )
\ (  Oooo.
 \_) (   )
  ) /
 (_/

 One small step
   for me ...


[Bug 96762] [radeonsi] Firewatch: nothing rendered in scrollable (text) areas

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96762

--- Comment #2 from Nicolai Hähnle  ---
Do you see the issue also in an apitrace? If so, could you upload it? If not,
yes, probably a duplicate to bug 95551.

-- 
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/20160701/419a3e83/attachment.html>


[PATCH v3 3/4] drm/bridge: analogix_dp: add the PSR function support

2016-07-01 Thread Sean Paul
On Fri, Jul 1, 2016 at 5:19 AM, Yakir Yang  wrote:
> The full name of PSR is Panel Self Refresh, panel device could refresh
> itself with the hardware framebuffer in panel, this would make lots of
> sense to save the power consumption.
>
> This patch have exported two symbols for platform driver to implement
> the PSR function in hardware side:
> - analogix_dp_active_psr()
> - analogix_dp_inactive_psr()
>
> Signed-off-by: Yakir Yang 
> ---
> Changes in v3:
> - split analogix_dp_enable_psr(), make it more clearly
> analogix_dp_detect_sink_psr()
> analogix_dp_enable_sink_psr()
> - remove some nosie register setting comments
>
> Changes in v2:
> - introduce in v2, splite the common Analogix DP changes out
>
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 64 
> ++
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  4 ++
>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  | 54 ++
>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.h  | 28 ++
>  include/drm/bridge/analogix_dp.h   |  3 +
>  5 files changed, 153 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
> b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index 32715da..b557097 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> @@ -97,6 +97,66 @@ static int analogix_dp_detect_hpd(struct 
> analogix_dp_device *dp)
> return 0;
>  }
>
> +int analogix_dp_active_psr(struct device *dev)
> +{
> +   struct analogix_dp_device *dp = dev_get_drvdata(dev);
> +
> +   if (!dp->psr_support)
> +   return -EINVAL;
> +
> +   analogix_dp_send_psr_spd(dp, EDP_VSC_PSR_STATE_ACTIVE |
> +EDP_VSC_PSR_CRC_VALUES_VALID);
> +   return 0;
> +}
> +EXPORT_SYMBOL_GPL(analogix_dp_active_psr);
> +
> +int analogix_dp_inactive_psr(struct device *dev)
> +{
> +   struct analogix_dp_device *dp = dev_get_drvdata(dev);
> +
> +   if (!dp->psr_support)
> +   return -EINVAL;
> +
> +   analogix_dp_send_psr_spd(dp, 0);
> +   return 0;
> +}
> +EXPORT_SYMBOL_GPL(analogix_dp_inactive_psr);
> +
> +static bool analogix_dp_detect_sink_psr(struct analogix_dp_device *dp)
> +{
> +   unsigned char psr_version;
> +
> +   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_SUPPORT, _version);
> +   dev_info(dp->dev, "Panel PSR version : %x\n", psr_version);
> +

This info message is likely to be spammy since it's printed everytime
the panel toggle on. Perhaps downgrade to debug level.

> +   return (psr_version & DP_PSR_IS_SUPPORTED) ? true : false;
> +}
> +
> +static int analogix_dp_enable_sink_psr(struct analogix_dp_device *dp)

Return type is int, but the function never fails and you don't check
the return value when calling it. Seems like this should be void.

> +{
> +   unsigned char psr_en;
> +
> +   /* Disable psr function */
> +   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_EN_CFG, _en);
> +   psr_en &= ~DP_PSR_ENABLE;
> +   analogix_dp_write_byte_to_dpcd(dp, DP_PSR_EN_CFG, psr_en);
> +
> +   /* Main-Link transmitter remains active during PSR active states */
> +   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_EN_CFG, _en);
> +   psr_en = DP_PSR_MAIN_LINK_ACTIVE | DP_PSR_CRC_VERIFICATION;

Why read psr_en if you're just going to overwrite it? Perhaps you meant |= here.

> +   analogix_dp_write_byte_to_dpcd(dp, DP_PSR_EN_CFG, psr_en);
> +
> +   /* Enable psr function */
> +   analogix_dp_read_byte_from_dpcd(dp, DP_PSR_EN_CFG, _en);
> +   psr_en = DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE |
> +DP_PSR_CRC_VERIFICATION;

Again, no need to read if you're just overwriting.

> +   analogix_dp_write_byte_to_dpcd(dp, DP_PSR_EN_CFG, psr_en);
> +
> +   analogix_dp_enable_psr_crc(dp);
> +
> +   return 0;
> +}
> +
>  static unsigned char analogix_dp_calc_edid_check_sum(unsigned char 
> *edid_data)
>  {
> int i;
> @@ -921,6 +981,10 @@ static void analogix_dp_commit(struct analogix_dp_device 
> *dp)
>
> /* Enable video */
> analogix_dp_start_video(dp);
> +
> +   dp->psr_support = analogix_dp_detect_sink_psr(dp);
> +   if (dp->psr_support)
> +   analogix_dp_enable_sink_psr(dp);
>  }
>
>  int analogix_dp_get_modes(struct drm_connector *connector)
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h 
> b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
> index b456380..6ca5dde 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
> @@ -177,6 +177,7 @@ struct analogix_dp_device {
> int hpd_gpio;
> boolforce_hpd;
> unsigned char   edid[EDID_BLOCK_LENGTH * 2];
> +   boolpsr_support;
>
> struct analogix_dp_plat_data *plat_data;
>  };

[PATCH] drm/tegra: add missing include

2016-07-01 Thread Thierry Reding
On Fri, Jul 01, 2016 at 12:16:20PM +0200, Arnd Bergmann wrote:
> A newly merged patch to configure the XBAR caused a build failure
> in some configurations:
> 
> drivers/gpu/drm/tegra/sor.c: In function 'tegra_sor_set_pinmux':
> drivers/gpu/drm/tegra/sor.c:252:10: error: implicit declaration of function 
> 'pinctrl_lookup_state' [-Werror=implicit-function-declaration]
>   state = pinctrl_lookup_state(sor->pinctrl, name);
>   ^~~~
> drivers/gpu/drm/tegra/sor.c:252:8: error: assignment makes pointer from 
> integer without a cast [-Werror=int-conversion]
>   state = pinctrl_lookup_state(sor->pinctrl, name);
> 
> The functions are declared in linux/pinctrl/consumer.h, so we need
> to include that file instead of relying on the inclusion to happen
> through another header.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: 9e9d1315f4f4 ("drm/tegra: sor: Make XBAR configurable per SoC")
> ---
>  drivers/gpu/drm/tegra/sor.c | 1 +
>  1 file changed, 1 insertion(+)

This was actually introduced in 035f79bcd5e5 ("drm/tegra: sor: Support
DPAUX pin control"), which is causing other problems at runtime, so I've
backed it out again.

Thanks,
Thierry
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160701/086c58c6/attachment.sig>


[Bug 90481] Radeonsi driver, X crash while playing "Spec ops: the line"

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90481

--- Comment #13 from Daniel Scharrer  ---
Is there anything else I could try to help track this down?

I tried running the game with R600_DEBUG=nodma and while that seemed to fix the
issue at first, I still got a lockup after a couple of runs. Perhaps nodma just
made the lockup less likely by slowing things down (although perf was not
*that* different).

Btw, jaycee1980 in #radeon seemed open to providing AMD Mesa devs keys to
Virtual Programming games, so you could try to reproduce this on your end as
well.

-- 
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/20160701/70a6bc66/attachment.html>


[Bug 96762] [radeonsi] Firewatch: nothing rendered in scrollable (text) areas

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96762

--- Comment #1 from Kai  ---
Created attachment 124837
  --> https://bugs.freedesktop.org/attachment.cgi?id=124837=edit
Firewatch: the notes reader doesn't show the text

-- 
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/20160701/2a57708c/attachment.html>


[Bug 96762] [radeonsi] Firewatch: nothing rendered in scrollable (text) areas

2016-07-01 Thread bugzilla-dae...@freedesktop.org
t/Bumped Diffuse IBL 
> Double Faces' - Pass 'FORWARD' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Diffuse IBL 
> Double Faces' - Pass 'FORWARD' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Diffuse IBL 
> Double Faces' - Pass 'PREPASS' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Diffuse IBL 
> Double Faces' - Pass 'PREPASS' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Diffuse IBL 
> Double Faces' - Pass 'DEFERRED' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Specular IBL' - 
> Pass 'FORWARD' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Specular IBL' - 
> Pass 'FORWARD' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Specular IBL' - 
> Pass 'PREPASS' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Specular IBL' - 
> Pass 'PREPASS' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Specular IBL' - 
> Pass 'DEFERRED' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Specular IBL' - All 
> passes removed
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Specular 
> IBL' - Pass 'FORWARD' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Specular 
> IBL' - Pass 'FORWARD' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Specular 
> IBL' - Pass 'PREPASS' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Specular 
> IBL' - Pass 'PREPASS' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Specular 
> IBL' - Pass 'DEFERRED' has no vertex shader
> WARNING: Shader Unsupported: 'Marmoset/Transparent/Cutout/Bumped Specular 
> IBL' - All passes removed
> WARNING: Shader Unsupported: 'Hidden/Dof/DX11Dof' - Pass '' has no vertex 
> shader
> WARNING: Shader Unsupported: 'Hidden/Dof/DX11Dof' - Setting to default shader.
> WARNING: Shader Unsupported: 'Hidden/NoiseAndGrainDX11' - Pass '' has no 
> vertex shader
> WARNING: Shader Unsupported: 'Hidden/NoiseAndGrainDX11' - Setting to default 
> shader.

There is also a couple of audio-related (WWise) warnings and a null pointer
exception in there, but the exception is probably "on close" as it's the very
last entry in the log. Let me know, if you want to see the full log file from
Unity3D.

The stack used was (Debian testing, fully updated, as a base):
GPU: Hawaii PRO [Radeon R9 290] (ChipID = 0x67b1)
Mesa: Git:master/d8d6091a84
libdrm: 2.4.68-1
LLVM: SVN:trunk/r274279 (3.9 devel) +
<http://reviews.llvm.org/D21551?id=61349=true>
X.Org: 2:1.18.3-1
Linux: 4.6.3
Firmware: firmware-amd-graphics/20160110-1
libclc: Git:master/20d977a3e6
DDX: 1:7.7.0-1

Let me know, if you need something else (shader dump, apitrace, etc.). Please
specify if you want me to provide these with or without the override variables
mentioned above.


Referenced Bugs:

https://bugs.freedesktop.org/show_bug.cgi?id=77449
[Bug 77449] Tracker bug for all bugs related to Steam titles
-- 
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/20160701/50733f4e/attachment-0001.html>


[PATCH 3/3] arm64: tegra: Populate SOR power domain for DSI

2016-07-01 Thread Jon Hunter
The DSI device requires that the SOR power partition is enabled when
active. Populate this power partition for the Tegra210 DSI nodes.

Signed-off-by: Jon Hunter 
---
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi 
b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
index 99c5e9f69f72..2885a119b430 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
@@ -109,6 +109,7 @@
clock-names = "dsi", "lp", "parent";
resets = <_car 48>;
reset-names = "dsi";
+   power-domains = <_sor>;
nvidia,mipi-calibrate = < 0x0c0>; /* DSIA & DSIB 
pads */

status = "disabled";
@@ -138,6 +139,7 @@
clock-names = "dsi", "lp", "parent";
resets = <_car 82>;
reset-names = "dsi";
+   power-domains = <_sor>;
nvidia,mipi-calibrate = < 0x300>; /* DSIC & DSID 
pads */

status = "disabled";
-- 
2.1.4



[PATCH 2/3] drm/tegra: Prepare SOR for supporting generic PM domains

2016-07-01 Thread Jon Hunter
The SOR driver for Tegra requires the SOR power partition to be enabled.
Now that Tegra supports the generic PM domain framework we manage the
SOR power partition via this framework. However, the sequence for
gating/ungating the SOR power partition requires that the SOR reset is
asserted/de-asserted at the time the SOR power partition is
gated/ungated, respectively. Now that the reset control core assumes
that resets are exclusive, the Tegra generic PM domain code and the SOR
driver cannot request the same reset unless we mark the reset as shared.
Sharing resets will not work in this case because we cannot guarantee
that the reset will be asserted/de-asserted at the appropriate time.
Therefore, given that the Tegra generic PM domain code will handle the
resets, do not request the reset in the SOR driver if the SOR device has
a PM domain associated.

Signed-off-by: Jon Hunter 
---
 drivers/gpu/drm/tegra/sor.c | 57 -
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8425edaa4e8a..82b0519a7c7f 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -2384,10 +2384,13 @@ static int tegra_sor_init(struct host1x_client *client)
 * XXX: Remove this reset once proper hand-over from firmware to
 * kernel is possible.
 */
-   err = reset_control_assert(sor->rst);
-   if (err < 0) {
-   dev_err(sor->dev, "failed to assert SOR reset: %d\n", err);
-   return err;
+   if (sor->rst) {
+   err = reset_control_assert(sor->rst);
+   if (err < 0) {
+   dev_err(sor->dev, "failed to assert SOR reset: %d\n",
+   err);
+   return err;
+   }
}

err = clk_prepare_enable(sor->clk);
@@ -2398,10 +2401,13 @@ static int tegra_sor_init(struct host1x_client *client)

usleep_range(1000, 3000);

-   err = reset_control_deassert(sor->rst);
-   if (err < 0) {
-   dev_err(sor->dev, "failed to deassert SOR reset: %d\n", err);
-   return err;
+   if (sor->rst) {
+   err = reset_control_deassert(sor->rst);
+   if (err < 0) {
+   dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
+   err);
+   return err;
+   }
}

err = clk_prepare_enable(sor->clk_safe);
@@ -2639,11 +2645,14 @@ static int tegra_sor_probe(struct platform_device *pdev)
goto remove;
}

-   sor->rst = devm_reset_control_get(>dev, "sor");
-   if (IS_ERR(sor->rst)) {
-   err = PTR_ERR(sor->rst);
-   dev_err(>dev, "failed to get reset control: %d\n", err);
-   goto remove;
+   if (!pdev->dev.pm_domain) {
+   sor->rst = devm_reset_control_get(>dev, "sor");
+   if (IS_ERR(sor->rst)) {
+   err = PTR_ERR(sor->rst);
+   dev_err(>dev, "failed to get reset control: %d\n",
+   err);
+   goto remove;
+   }
}

sor->clk = devm_clk_get(>dev, NULL);
@@ -2746,10 +2755,12 @@ static int tegra_sor_suspend(struct device *dev)
struct tegra_sor *sor = dev_get_drvdata(dev);
int err;

-   err = reset_control_assert(sor->rst);
-   if (err < 0) {
-   dev_err(dev, "failed to assert reset: %d\n", err);
-   return err;
+   if (sor->rst) {
+   err = reset_control_assert(sor->rst);
+   if (err < 0) {
+   dev_err(dev, "failed to assert reset: %d\n", err);
+   return err;
+   }
}

usleep_range(1000, 2000);
@@ -2772,11 +2783,13 @@ static int tegra_sor_resume(struct device *dev)

usleep_range(1000, 2000);

-   err = reset_control_deassert(sor->rst);
-   if (err < 0) {
-   dev_err(dev, "failed to deassert reset: %d\n", err);
-   clk_disable_unprepare(sor->clk);
-   return err;
+   if (sor->rst) {
+   err = reset_control_deassert(sor->rst);
+   if (err < 0) {
+   dev_err(dev, "failed to deassert reset: %d\n", err);
+   clk_disable_unprepare(sor->clk);
+   return err;
+   }
}

return 0;
-- 
2.1.4



[PATCH 1/3] drm/tegra: Prepare DSI for supporting generic PM domains

2016-07-01 Thread Jon Hunter
The DSI driver for Tegra requires the SOR power partition to be enabled.
Now that Tegra supports the generic PM domain framework we manage the
SOR power partition via this framework. However, the sequence for
gating/ungating the SOR power partition requires that the DSI reset is
asserted/de-asserted at the time the SOR power partition is
gated/ungated, respectively. Now that the reset control core assumes
that resets are exclusive, the Tegra generic PM domain code and the DSI
driver cannot request the same reset unless we mark the reset as shared.
Sharing resets will not work in this case because we cannot guarantee
that the reset will be asserted/de-asserted at the appropriate time.
Therefore, given that the Tegra generic PM domain code will handle the
resets, do not request the reset in the DSI driver if the DSI device has
a PM domain associated.

Signed-off-by: Jon Hunter 
---
 drivers/gpu/drm/tegra/dsi.c | 28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 730e6d21801a..3d228ad90e0f 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -1488,9 +1488,11 @@ static int tegra_dsi_probe(struct platform_device *pdev)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->lanes = 4;

-   dsi->rst = devm_reset_control_get(>dev, "dsi");
-   if (IS_ERR(dsi->rst))
-   return PTR_ERR(dsi->rst);
+   if (!pdev->dev.pm_domain) {
+   dsi->rst = devm_reset_control_get(>dev, "dsi");
+   if (IS_ERR(dsi->rst))
+   return PTR_ERR(dsi->rst);
+   }

dsi->clk = devm_clk_get(>dev, NULL);
if (IS_ERR(dsi->clk)) {
@@ -1591,10 +1593,12 @@ static int tegra_dsi_suspend(struct device *dev)
struct tegra_dsi *dsi = dev_get_drvdata(dev);
int err;

-   err = reset_control_assert(dsi->rst);
-   if (err < 0) {
-   dev_err(dev, "failed to assert reset: %d\n", err);
-   return err;
+   if (dsi->rst) {
+   err = reset_control_assert(dsi->rst);
+   if (err < 0) {
+   dev_err(dev, "failed to assert reset: %d\n", err);
+   return err;
+   }
}

usleep_range(1000, 2000);
@@ -1632,10 +1636,12 @@ static int tegra_dsi_resume(struct device *dev)

usleep_range(1000, 2000);

-   err = reset_control_deassert(dsi->rst);
-   if (err < 0) {
-   dev_err(dev, "cannot assert reset: %d\n", err);
-   goto disable_clk_lp;
+   if (dsi->rst) {
+   err = reset_control_deassert(dsi->rst);
+   if (err < 0) {
+   dev_err(dev, "cannot assert reset: %d\n", err);
+   goto disable_clk_lp;
+   }
}

return 0;
-- 
2.1.4



[PATCH v2 3/4] dma-buf/sync_file: add sync_file_get_fence()

2016-07-01 Thread Chris Wilson
On Fri, Jul 01, 2016 at 10:05:06AM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan 
> 
> Creates a function that given an sync file descriptor returns a
> fence containing all fences in the sync_file.
> 
> v2: Comments by Daniel Vetter
>   - Adapt to new version of fence_collection_init()
>   - Hold a reference for the fence we return
> 
> v3:
>   - Adapt to use fput() directly
>   - rename to sync_file_get_fence() as we always return one fence
> 
> v4: Adapt to use fence_array
> 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/dma-buf/sync_file.c | 24 
>  include/linux/sync_file.h   |  1 +
>  2 files changed, 25 insertions(+)
> 
> diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
> index 12dbf17..3ffaea8 100644
> --- a/drivers/dma-buf/sync_file.c
> +++ b/drivers/dma-buf/sync_file.c
> @@ -116,6 +116,30 @@ err:
>   return NULL;
>  }
>  
> +/**
> + * sync_file_get_fence - get the fence related to the sync_file fd
> + * @fd:  sync_file fd to get the fence from
> + *
> + * Ensures @fd references a valid sync_file and returns a fence that
> + * represents all fence in the sync_file. On error NULL is returned.
> + */
> +struct fence *sync_file_get_fence(int fd)
> +{
> + struct sync_file *sync_file;
> + struct fence *fence;
> +
> + sync_file = sync_file_fdget(fd);
> + if (!sync_file)
> + return NULL;
> +
> + fence = sync_file->fence;
> + fence_get(fence);

Or just fence = get_fence(sync_file->fence);

> + fput(sync_file->file);

Reviewed-by: Chris Wilson 

Using fence-array for this works very nicely, as we can then inspect the
fences returned and handle native fences for fd passed around.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[PATCH v2 2/4] dma-buf/sync_file: rework fence storage in struct file

2016-07-01 Thread Chris Wilson
On Fri, Jul 01, 2016 at 10:05:05AM -0300, Gustavo Padovan wrote:
> @@ -333,16 +384,16 @@ static long sync_file_ioctl_fence_info(struct sync_file 
> *sync_file,
>   if (!info.num_fences)
>   goto no_fences;
>  
> - if (info.num_fences < sync_file->num_fences)
> + if (info.num_fences < num_fences)
>   return -EINVAL;
>  
> - size = sync_file->num_fences * sizeof(*fence_info);
> + size = num_fences * sizeof(*fence_info);
>   fence_info = kzalloc(size, GFP_KERNEL);

Does size get used elsewhere? Otherwise it would be safer to reduce this
to kcalloc(num_fences, sizeof(*fence_info), GFP_KERNEL)

>   if (!fence_info)
>   return -ENOMEM;
>  

> diff --git a/drivers/staging/android/sync_debug.c 
> b/drivers/staging/android/sync_debug.c
> index 5f57499..0638a06 100644
> --- a/drivers/staging/android/sync_debug.c
> +++ b/drivers/staging/android/sync_debug.c
> @@ -159,10 +159,15 @@ static void sync_print_sync_file(struct seq_file *s,
>   int i;
>  
>   seq_printf(s, "[%p] %s: %s\n", sync_file, sync_file->name,
> -sync_status_str(atomic_read(_file->status)));
> -
> - for (i = 0; i < sync_file->num_fences; ++i)
> - sync_print_fence(s, sync_file->cbs[i].fence, true);
> +sync_status_str(!fence_is_signaled(sync_file->fence)));
> +
> + if (fence_is_array(sync_file->fence)) {
> + struct fence_array *array = to_fence_array(sync_file->fence);

checkpatch will complain about the missing line between decl and code
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[PATCH v3 2/4] drm/rockchip: add an common abstracted PSR driver

2016-07-01 Thread Sean Paul
On Fri, Jul 1, 2016 at 5:19 AM, Yakir Yang  wrote:
> The PSR driver have exported four symbols for specific device driver:
> - rockchip_drm_psr_register()
> - rockchip_drm_psr_unregister()
> - rockchip_drm_psr_enable()
> - rockchip_drm_psr_disable()
> - rockchip_drm_psr_flush()
>
> Encoder driver should call the register/unregister interfaces to hook
> itself into common PSR driver, encoder have implement the 'psr_set'
> callback which use the set PSR state in hardware side.
>
> Crtc driver would call the enable/disable interfaces when vblank is
> enable/disable, after that the common PSR driver would call the encoder
> registered callback to set the PSR state.
>

This feels overly complicated. It seems like you could cut out a bunch
of code by just coding the psr functions into vop and
analogix_dp-rockchip. I suppose the only reason to keep it abstracted
would be if you plan on supporting psr in a different encoder or crtc
in rockchip, or if you're planning on moving this into drm core.

Perhaps others will disagree with this sentiment and this is the right
thing to do.

> Fb driver would call the flush interface in 'fb->dirty' callback, this
> helper function would force all PSR enabled encoders to exit from PSR
> for 3 seconds.
>
> Signed-off-by: Yakir Yang 
> ---
> Changes in v3:
> - split the psr flow into an common abstracted PSR driver
> - implement the 'fb->dirty' callback function (Daniel)
> - avoid to use notify to acqiure for vact event (Daniel)
> - remove psr_active() callback which introduce in v2
>
> Changes in v2: None
>
>  drivers/gpu/drm/rockchip/Makefile   |   2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_fb.c  |  12 ++
>  drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 200 
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_psr.h |  12 ++
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  24 
>  5 files changed, 249 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.c
>  create mode 100644 drivers/gpu/drm/rockchip/rockchip_drm_psr.h
>
> diff --git a/drivers/gpu/drm/rockchip/Makefile 
> b/drivers/gpu/drm/rockchip/Makefile
> index 05d0713..9746365 100644
> --- a/drivers/gpu/drm/rockchip/Makefile
> +++ b/drivers/gpu/drm/rockchip/Makefile
> @@ -3,7 +3,7 @@
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>
>  rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o \
> -   rockchip_drm_gem.o rockchip_drm_vop.o
> +   rockchip_drm_gem.o rockchip_drm_psr.o rockchip_drm_vop.o
>  rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o
>
>  obj-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> index 20f12bc..0fec18f 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
> @@ -21,6 +21,7 @@
>
>  #include "rockchip_drm_drv.h"
>  #include "rockchip_drm_gem.h"
> +#include "rockchip_drm_psr.h"
>
>  #define to_rockchip_fb(x) container_of(x, struct rockchip_drm_fb, fb)
>
> @@ -66,9 +67,20 @@ static int rockchip_drm_fb_create_handle(struct 
> drm_framebuffer *fb,
>  rockchip_fb->obj[0], handle);
>  }
>
> +static int rockchip_drm_fb_dirty(struct drm_framebuffer *fb,
> +struct drm_file *file,
> +unsigned int flags, unsigned int color,
> +struct drm_clip_rect *clips,
> +unsigned int num_clips)
> +{
> +   rockchip_drm_psr_flush();
> +   return 0;
> +}
> +
>  static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = {
> .destroy= rockchip_drm_fb_destroy,
> .create_handle  = rockchip_drm_fb_create_handle,
> +   .dirty  = rockchip_drm_fb_dirty,
>  };
>
>  static struct rockchip_drm_fb *
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
> new file mode 100644
> index 000..c03
> --- /dev/null
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
> @@ -0,0 +1,200 @@
> +#include 
> +
> +#include "rockchip_drm_psr.h"
> +
> +#define PSR_FLUSH_TIMEOUT  msecs_to_jiffies(3000) /* 3 seconds */
> +
> +static LIST_HEAD(psr_list);
> +static DEFINE_MUTEX(psr_list_mutex);

I'm not crazy about these globals. Perhaps you can initialize them
with the rockchip driver and tuck them in a driver-level struct
(rockchip_drm_private or something).


> +
> +enum psr_state {
> +   PSR_FLUSH,
> +   PSR_ENABLE,
> +   PSR_DISABLE,
> +};
> +
> +struct psr_drv {
> +   struct list_head list;
> +   enum psr_state state;
> +   struct mutex state_mutex;
> +
> +   struct timer_list flush_timer;
> +
> +   struct drm_encoder *encoder;
> +   int (*set)(struct drm_encoder *encoder, bool enable);
> +};
> +
> +static struct psr_drv 

[PATCH 1/6] lib: string: add function strtolower()

2016-07-01 Thread Jani Nikula
On Fri, 01 Jul 2016, Markus Mayer  wrote:
> Add a function called strtolower() to convert strings to lower case
> in-place, overwriting the original string.
>
> This seems to be a recurring requirement in the kernel that is
> currently being solved by several duplicated implementations doing the
> same thing.
>
> Signed-off-by: Markus Mayer 
> ---
>  include/linux/string.h |  1 +
>  lib/string.c   | 14 ++
>  2 files changed, 15 insertions(+)
>
> diff --git a/include/linux/string.h b/include/linux/string.h
> index 26b6f6a..aad605e 100644
> --- a/include/linux/string.h
> +++ b/include/linux/string.h
> @@ -116,6 +116,7 @@ extern void * memchr(const void *,int,__kernel_size_t);
>  #endif
>  void *memchr_inv(const void *s, int c, size_t n);
>  char *strreplace(char *s, char old, char new);
> +char *strtolower(char *s);
>  
>  extern void kfree_const(const void *x);
>  
> diff --git a/lib/string.c b/lib/string.c
> index ed83562..6e3b560 100644
> --- a/lib/string.c
> +++ b/lib/string.c
> @@ -952,3 +952,17 @@ char *strreplace(char *s, char old, char new)
>   return s;
>  }
>  EXPORT_SYMBOL(strreplace);
> +

This needs a kernel-doc comment right here.

> +char *strtolower(char *s)
> +{
> + char *p;
> +
> +if (unlikely(!s))
> +return NULL;

Using spaces for indentation? See scripts/checkpatch.pl.

> +
> + for (p = s; *p; p++)
> + *p = tolower(*p);
> +
> + return s;

Why does it return a value? Could be void?

BR,
Jani.

> +}
> +EXPORT_SYMBOL(strtolower);

-- 
Jani Nikula, Intel Open Source Technology Center


[Bug 93341] GPU lockups on RadeonHD 7770 (radeonsi driver) when running OpenGL games or after extended periods of time

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93341

--- Comment #8 from Nicolai Hähnle  ---
Sorry for your troubles. Non-deterministic lockups are just very hard to debug,
and silence mostly means that nobody has an idea.

For future record, which browser reproduces the lockup for you on that website?

-- 
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/20160701/2fe04320/attachment.html>


[Bug 96731] [RADEONSI] [LLVM] [bisected] GPU lockups when running Alien: Isolation

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96731

--- Comment #7 from Nicolai Hähnle  ---
There is nothing obviously wrong with the last shader(s) in the bad log - and
unfortunately, the logs are not really comparable: the first genuine difference
is in TGSI, which means that a different sequence of OpenGL calls happened in
the two runs. This makes it basically impossible to figure out the problem.

To make progress on this bug, could you please record an apitrace of the game,
and see if you can reproduce the lockups by playing back the trace? If this
works, please provide

1. the trace file itself (e.g. upload on Google Drive)
2. before and after logs of playing back the trace like Michel asked for.

-- 
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/20160701/fe9f0af9/attachment.html>


[Bug 50325] Glyphy bad render on r600g (software render is fine) - too many registers?

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=50325

--- Comment #7 from cyberkm at gmail.com ---
Yep, latest mesa git.

05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI]
Antilles [Radeon HD 6990]

mesa r600 gallium.

The app works fine if i switch to software renderer.

-- 
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/20160701/e0b1283a/attachment.html>


[Bug 96678] Awesomenauts cannot launch AMD PITCAIRN

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96678

--- Comment #1 from Nicolai Hähnle  ---
This is a crash while compiling a shader.

Could you please check whether the crash also occurs with latest LLVM? The
padoka PPA has it. If it does, please provide the output with the environment
variable R600_DEBUG=ps,vs,gs,tes,tcs,cs set.

-- 
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/20160701/3fe7851b/attachment.html>


[PATCH] drm/tegra: add missing include

2016-07-01 Thread Arnd Bergmann
A newly merged patch to configure the XBAR caused a build failure
in some configurations:

drivers/gpu/drm/tegra/sor.c: In function 'tegra_sor_set_pinmux':
drivers/gpu/drm/tegra/sor.c:252:10: error: implicit declaration of function 
'pinctrl_lookup_state' [-Werror=implicit-function-declaration]
  state = pinctrl_lookup_state(sor->pinctrl, name);
  ^~~~
drivers/gpu/drm/tegra/sor.c:252:8: error: assignment makes pointer from integer 
without a cast [-Werror=int-conversion]
  state = pinctrl_lookup_state(sor->pinctrl, name);

The functions are declared in linux/pinctrl/consumer.h, so we need
to include that file instead of relying on the inclusion to happen
through another header.

Signed-off-by: Arnd Bergmann 
Fixes: 9e9d1315f4f4 ("drm/tegra: sor: Make XBAR configurable per SoC")
---
 drivers/gpu/drm/tegra/sor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 8425edaa4e8a..9ff6aa7585cf 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.9.0



[PATCH v3 1/4] drm/rockchip: vop: export line flag function

2016-07-01 Thread Sean Paul
On Fri, Jul 1, 2016 at 11:30 AM, Sean Paul  wrote:
> On Fri, Jul 1, 2016 at 5:19 AM, Yakir Yang  wrote:
>> VOP have integrated a hardware counter which indicate the exact display
>> line that vop is scanning. And if we're interested in a specific line,
>> we can set the line number to vop line_flag register, and then vop would
>> generate a line_flag interrupt for it.
>>
>> For example eDP PSR function is interested in the vertical blanking
>> period, then driver could set the line number to zero.
>>
>> This patch have exported a symbol that allow other driver to listen the
>> line flag event with given timeout limit:
>> -  rockchip_drm_wait_line_flag()
>>
>> Signed-off-by: Yakir Yang 
>> ---
>> Changes in v3:
>> - Export the 'rockchip_drm_wait_line_flag' symbol, and document it.
>> - Add 'line_flag_num_0' for RK3288/RK3036
>> - Remove the notify for waiting line_flag event (Daniel)
>>
>> Changes in v2:
>> - Introduce in v2, split VOP line flag changes out
>>
>>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   3 +
>>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 103 
>> 
>>  drivers/gpu/drm/rockchip/rockchip_drm_vop.h |   3 +
>>  drivers/gpu/drm/rockchip/rockchip_vop_reg.c |   4 ++
>>  4 files changed, 113 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h 
>> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
>> index ea39329..239b830 100644
>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
>> @@ -70,4 +70,7 @@ int rockchip_drm_dma_attach_device(struct drm_device 
>> *drm_dev,
>>struct device *dev);
>>  void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
>> struct device *dev);
>> +int rockchip_drm_wait_line_flag(struct drm_crtc *crtc, unsigned int 
>> line_num,
>> +   unsigned int mstimeout);
>> +
>>  #endif /* _ROCKCHIP_DRM_DRV_H_ */
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
>> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>> index c8a62a8..cd3cac5 100644
>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
>> @@ -121,6 +121,8 @@ struct vop {
>> /* protected by dev->event_lock */
>> struct drm_pending_vblank_event *event;
>>
>> +   struct completion line_flag_completion;
>> +
>> const struct vop_data *data;
>>
>> uint32_t *regsbak;
>> @@ -431,6 +433,59 @@ static void vop_dsp_hold_valid_irq_disable(struct vop 
>> *vop)
>> spin_unlock_irqrestore(>irq_lock, flags);
>>  }
>>
>> +/*
>> + * (1) each frame starts at the start of the Vsync pulse which is signaled 
>> by
>> + * the "FRAME_SYNC" interrupt.
>> + * (2) the active data region of each frame ends at dsp_vact_end
>> + * (3) we should program this same number (dsp_vact_end) into 
>> dsp_line_frag_num,
>> + *  to get "LINE_FLAG" interrupt at the end of the active on screen 
>> data.
>> + *
>> + * VOP_INTR_CTRL0.dsp_line_frag_num = VOP_DSP_VACT_ST_END.dsp_vact_end
>> + * Interrupts
>> + * LINE_FLAG ---+
>> + * FRAME_SYNC + |
>> + *| |
>> + *v v
>> + *| Vsync | Vbp |  Vactive  | Vfp |
>> + *^ ^   ^ ^
>> + *| |   | |
>> + *| |   | |
>> + * dsp_vs_end + |   | |   VOP_DSP_VTOTAL_VS_END
>> + * dsp_vact_start --+   | |   VOP_DSP_VACT_ST_END
>> + * dsp_vact_end + |   VOP_DSP_VACT_ST_END
>> + * dsp_total -+   VOP_DSP_VTOTAL_VS_END
>> + */
>> +
>> +static void vop_line_flag_irq_enable(struct vop *vop, int line_num)
>> +{
>> +   unsigned long flags;
>> +
>> +   if (WARN_ON(!vop->is_enabled))
>> +   return;
>> +
>> +   spin_lock_irqsave(>irq_lock, flags);
>> +
>> +   VOP_CTRL_SET(vop, line_flag_num_0, line_num);
>> +   VOP_INTR_SET_TYPE(vop, enable, LINE_FLAG_INTR, 1);
>> +   vop_cfg_done(vop);
>> +
>> +   spin_unlock_irqrestore(>irq_lock, flags);
>> +}
>> +
>> +static void vop_line_flag_irq_disable(struct vop *vop)
>> +{
>> +   unsigned long flags;
>> +
>> +   if (WARN_ON(!vop->is_enabled))
>> +   return;
>> +
>> +   spin_lock_irqsave(>irq_lock, flags);
>> +
>> +   VOP_INTR_SET_TYPE(vop, enable, LINE_FLAG_INTR, 0);
>> +
>> +   spin_unlock_irqrestore(>irq_lock, flags);
>> +}
>> +
>>  static void vop_enable(struct drm_crtc *crtc)
>>  {
>> struct vop *vop = to_vop(crtc);
>> @@ -1157,6 +1212,13 @@ static irqreturn_t vop_isr(int irq, void *data)
>> ret = IRQ_HANDLED;
>> }
>>
>> +   if (active_irqs & LINE_FLAG_INTR) {
>> +   if 

[Intel-gfx] [PATCH 1/3] drm/vgem: Fix mmaping

2016-07-01 Thread Rodrigo Vivi
Is this something that Dave or Jani could help us with?

This is a critical fix that blocking some projects around.

Thanks,
Rodrigo.

On Sat, Jun 25, 2016 at 3:39 AM, Chris Wilson  
wrote:
> On Thu, Jun 23, 2016 at 03:35:32PM +0100, Chris Wilson wrote:
>> The vGEM mmap code has bitrotted slightly and now immediately BUGs.
>> Since vGEM was last updated, there are new core GEM facilities to
>> provide more common functions, so let's use those here.
>>
>> v2: drm_gem_free_mmap_offset() is performed from
>> drm_gem_object_release() so we can remove the redundant call.
>>
>> Testcase: igt/vgem_basic/mmap
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96603
>> Signed-off-by: Chris Wilson 
>> Cc: Sean Paul 
>> Cc: Zach Reizner 
>> Cc: Matthew Auld 
>> Tested-by: Humberto Israel Perez Rodriguez > intel.com>
>> Reviewed-by: Matthew Auld 
>
> Hi Thierry, Daniel recommended to bug you for stewardship of drm-misc in
> his absence. Could you please consider this patch? Our CI is now
> tripping over this issue.
>
> Sean or Zach could you please ack? And have a look at the following pair
> of dma-buf fence patches? I have tests ready for our CI that use the
> vgem dma-buf to demonstrate the lack of synchronisation in i915.ko (and
> so exercise the fixes without requiring a second piece of hardware).
> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre
> ___
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br


[PATCH v3 1/4] drm/rockchip: vop: export line flag function

2016-07-01 Thread Sean Paul
On Fri, Jul 1, 2016 at 5:19 AM, Yakir Yang  wrote:
> VOP have integrated a hardware counter which indicate the exact display
> line that vop is scanning. And if we're interested in a specific line,
> we can set the line number to vop line_flag register, and then vop would
> generate a line_flag interrupt for it.
>
> For example eDP PSR function is interested in the vertical blanking
> period, then driver could set the line number to zero.
>
> This patch have exported a symbol that allow other driver to listen the
> line flag event with given timeout limit:
> -  rockchip_drm_wait_line_flag()
>
> Signed-off-by: Yakir Yang 
> ---
> Changes in v3:
> - Export the 'rockchip_drm_wait_line_flag' symbol, and document it.
> - Add 'line_flag_num_0' for RK3288/RK3036
> - Remove the notify for waiting line_flag event (Daniel)
>
> Changes in v2:
> - Introduce in v2, split VOP line flag changes out
>
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h |   3 +
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 103 
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.h |   3 +
>  drivers/gpu/drm/rockchip/rockchip_vop_reg.c |   4 ++
>  4 files changed, 113 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h 
> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> index ea39329..239b830 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> @@ -70,4 +70,7 @@ int rockchip_drm_dma_attach_device(struct drm_device 
> *drm_dev,
>struct device *dev);
>  void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
> struct device *dev);
> +int rockchip_drm_wait_line_flag(struct drm_crtc *crtc, unsigned int line_num,
> +   unsigned int mstimeout);
> +
>  #endif /* _ROCKCHIP_DRM_DRV_H_ */
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index c8a62a8..cd3cac5 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -121,6 +121,8 @@ struct vop {
> /* protected by dev->event_lock */
> struct drm_pending_vblank_event *event;
>
> +   struct completion line_flag_completion;
> +
> const struct vop_data *data;
>
> uint32_t *regsbak;
> @@ -431,6 +433,59 @@ static void vop_dsp_hold_valid_irq_disable(struct vop 
> *vop)
> spin_unlock_irqrestore(>irq_lock, flags);
>  }
>
> +/*
> + * (1) each frame starts at the start of the Vsync pulse which is signaled by
> + * the "FRAME_SYNC" interrupt.
> + * (2) the active data region of each frame ends at dsp_vact_end
> + * (3) we should program this same number (dsp_vact_end) into 
> dsp_line_frag_num,
> + *  to get "LINE_FLAG" interrupt at the end of the active on screen data.
> + *
> + * VOP_INTR_CTRL0.dsp_line_frag_num = VOP_DSP_VACT_ST_END.dsp_vact_end
> + * Interrupts
> + * LINE_FLAG ---+
> + * FRAME_SYNC + |
> + *| |
> + *v v
> + *| Vsync | Vbp |  Vactive  | Vfp |
> + *^ ^   ^ ^
> + *| |   | |
> + *| |   | |
> + * dsp_vs_end + |   | |   VOP_DSP_VTOTAL_VS_END
> + * dsp_vact_start --+   | |   VOP_DSP_VACT_ST_END
> + * dsp_vact_end + |   VOP_DSP_VACT_ST_END
> + * dsp_total -+   VOP_DSP_VTOTAL_VS_END
> + */
> +
> +static void vop_line_flag_irq_enable(struct vop *vop, int line_num)
> +{
> +   unsigned long flags;
> +
> +   if (WARN_ON(!vop->is_enabled))
> +   return;
> +
> +   spin_lock_irqsave(>irq_lock, flags);
> +
> +   VOP_CTRL_SET(vop, line_flag_num_0, line_num);
> +   VOP_INTR_SET_TYPE(vop, enable, LINE_FLAG_INTR, 1);
> +   vop_cfg_done(vop);
> +
> +   spin_unlock_irqrestore(>irq_lock, flags);
> +}
> +
> +static void vop_line_flag_irq_disable(struct vop *vop)
> +{
> +   unsigned long flags;
> +
> +   if (WARN_ON(!vop->is_enabled))
> +   return;
> +
> +   spin_lock_irqsave(>irq_lock, flags);
> +
> +   VOP_INTR_SET_TYPE(vop, enable, LINE_FLAG_INTR, 0);
> +
> +   spin_unlock_irqrestore(>irq_lock, flags);
> +}
> +
>  static void vop_enable(struct drm_crtc *crtc)
>  {
> struct vop *vop = to_vop(crtc);
> @@ -1157,6 +1212,13 @@ static irqreturn_t vop_isr(int irq, void *data)
> ret = IRQ_HANDLED;
> }
>
> +   if (active_irqs & LINE_FLAG_INTR) {
> +   if (!completion_done(>line_flag_completion))
> +   complete(>line_flag_completion);

I think there's potential to miss flags here if the timing is just
right because the 

[PATCH 3/3] drm/vmwgfx: Delay pinning fbdev framebuffer until after mode set

2016-07-01 Thread s...@vmware.com
From: Sinclair Yeh 

For the Screen Object display unit, we need to reserve a
guest-invisible region equal to the size of the framebuffer for
the host.  This region can only be reserved in VRAM, whereas
the guest-visible framebuffer can be reserved in either VRAM or
GMR.

As such priority should be given to the guest-invisible
region otherwise in a limited VRAM situation, we can fail to
allocate this region.

This patch makes it so that vmw_sou_backing_alloc() is called
before the framebuffer is pinned.

Signed-off-by: Sinclair Yeh 
Reviewed-by: Thomas Hellstrom 
Cc: 
---
This is the last patch of a 3-patch series to fix console black
screen issue on Ubuntu 16.04 server
---
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 47 --
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 679a4cb..66eaa30 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -517,28 +517,6 @@ static int vmw_fb_kms_framebuffer(struct fb_info *info)

par->set_fb = >base;

-   if (!par->bo_ptr) {
-   /*
-* Pin before mapping. Since we don't know in what placement
-* to pin, call into KMS to do it for us.
-*/
-   ret = vfb->pin(vfb);
-   if (ret) {
-   DRM_ERROR("Could not pin the fbdev framebuffer.\n");
-   return ret;
-   }
-
-   ret = ttm_bo_kmap(>vmw_bo->base, 0,
- par->vmw_bo->base.num_pages, >map);
-   if (ret) {
-   vfb->unpin(vfb);
-   DRM_ERROR("Could not map the fbdev framebuffer.\n");
-   return ret;
-   }
-
-   par->bo_ptr = ttm_kmap_obj_virtual(>map, >bo_iowrite);
-   }
-
return 0;
 }

@@ -601,6 +579,31 @@ static int vmw_fb_set_par(struct fb_info *info)
if (ret)
goto out_unlock;

+   if (!par->bo_ptr) {
+   struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(set.fb);
+
+   /*
+* Pin before mapping. Since we don't know in what placement
+* to pin, call into KMS to do it for us.
+*/
+   ret = vfb->pin(vfb);
+   if (ret) {
+   DRM_ERROR("Could not pin the fbdev framebuffer.\n");
+   return ret;
+   }
+
+   ret = ttm_bo_kmap(>vmw_bo->base, 0,
+ par->vmw_bo->base.num_pages, >map);
+   if (ret) {
+   vfb->unpin(vfb);
+   DRM_ERROR("Could not map the fbdev framebuffer.\n");
+   return ret;
+   }
+
+   par->bo_ptr = ttm_kmap_obj_virtual(>map, >bo_iowrite);
+   }
+
+
vmw_fb_dirty_mark(par, par->fb_x, par->fb_y,
  par->set_fb->width, par->set_fb->height);

-- 
2.8.2



[PATCH 2/3] drm/vmwgfx: Check pin count before attempting to move a buffer

2016-07-01 Thread s...@vmware.com
From: Sinclair Yeh 

In certain scenarios, e.g. when fbdev is enabled, we can get into
a situation where a vmw_framebuffer_pin() is called on a buffer
that is already pinned.

When this happens, ttm_bo_validate() will unintentially remove the
TTM_PL_FLAG_NO_EVICT flag, thus unpinning it, and leaving no way
to actually pin the buffer again.

To prevent this, if a buffer is already pinned, then instead of
calling ttm_bo_validate(), just make sure the proposed placement is
compatible with the existing placement.

Signed-off-by: Sinclair Yeh 
Reviewed-by: Thomas Hellstrom 
Cc: 
---
This is the 2nd patch in a 3-patch series to fix a console black
screen issue on Ubuntu 16.04 server.  This fixes a BUG_ON()
condition where a pinned buffer gets accidentally put onto the
LRU list.
---
 drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
index 9b078a4..0cd8890 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
@@ -49,6 +49,7 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv,
 {
struct ttm_buffer_object *bo = >base;
int ret;
+   uint32_t new_flags;

ret = ttm_write_lock(_priv->reservation_sem, interruptible);
if (unlikely(ret != 0))
@@ -60,7 +61,12 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv,
if (unlikely(ret != 0))
goto err;

-   ret = ttm_bo_validate(bo, placement, interruptible, false);
+   if (buf->pin_count > 0)
+   ret = ttm_bo_mem_compat(placement, >mem,
+   _flags) == true ? 0 : -EINVAL;
+   else
+   ret = ttm_bo_validate(bo, placement, interruptible, false);
+
if (!ret)
vmw_bo_pin_reserved(buf, true);

@@ -91,6 +97,7 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private 
*dev_priv,
 {
struct ttm_buffer_object *bo = >base;
int ret;
+   uint32_t new_flags;

ret = ttm_write_lock(_priv->reservation_sem, interruptible);
if (unlikely(ret != 0))
@@ -102,6 +109,12 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private 
*dev_priv,
if (unlikely(ret != 0))
goto err;

+   if (buf->pin_count > 0) {
+   ret = ttm_bo_mem_compat(_vram_gmr_placement, >mem,
+   _flags) == true ? 0 : -EINVAL;
+   goto out_unreserve;
+   }
+
ret = ttm_bo_validate(bo, _vram_gmr_placement, interruptible,
  false);
if (likely(ret == 0) || ret == -ERESTARTSYS)
@@ -161,6 +174,7 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private 
*dev_priv,
struct ttm_placement placement;
struct ttm_place place;
int ret = 0;
+   uint32_t new_flags;

place = vmw_vram_placement.placement[0];
place.lpfn = bo->num_pages;
@@ -185,10 +199,15 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private 
*dev_priv,
 */
if (bo->mem.mem_type == TTM_PL_VRAM &&
bo->mem.start < bo->num_pages &&
-   bo->mem.start > 0)
+   bo->mem.start > 0 &&
+   buf->pin_count == 0)
(void) ttm_bo_validate(bo, _sys_placement, false, false);

-   ret = ttm_bo_validate(bo, , interruptible, false);
+   if (buf->pin_count > 0)
+   ret = ttm_bo_mem_compat(, >mem,
+   _flags) == true ? 0 : -EINVAL;
+   else
+   ret = ttm_bo_validate(bo, , interruptible, false);

/* For some reason we didn't end up at the start of vram */
WARN_ON(ret == 0 && bo->offset != 0);
-- 
2.8.2



[PATCH 1/3] drm/ttm: Make ttm_bo_mem_compat available

2016-07-01 Thread s...@vmware.com
From: Sinclair Yeh 

There are cases where it is desired to see if a proposed placement
is compatible with a buffer object before calling ttm_bo_validate().

Signed-off-by: Sinclair Yeh 
Reviewed-by: Thomas Hellstrom 
Cc: 
---
This is the first of a 3-patch series to fix a black screen
issue observed on Ubuntu 16.04 server.
---
 drivers/gpu/drm/ttm/ttm_bo.c |  7 ---
 include/drm/ttm/ttm_bo_api.h | 14 ++
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 39386f5..a71cf98 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1034,9 +1034,9 @@ out_unlock:
return ret;
 }

-static bool ttm_bo_mem_compat(struct ttm_placement *placement,
- struct ttm_mem_reg *mem,
- uint32_t *new_flags)
+bool ttm_bo_mem_compat(struct ttm_placement *placement,
+  struct ttm_mem_reg *mem,
+  uint32_t *new_flags)
 {
int i;

@@ -1068,6 +1068,7 @@ static bool ttm_bo_mem_compat(struct ttm_placement 
*placement,

return false;
 }
+EXPORT_SYMBOL(ttm_bo_mem_compat);

 int ttm_bo_validate(struct ttm_buffer_object *bo,
struct ttm_placement *placement,
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index c801d90..4cecb0b 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -316,6 +316,20 @@ ttm_bo_reference(struct ttm_buffer_object *bo)
  */
 extern int ttm_bo_wait(struct ttm_buffer_object *bo,
   bool interruptible, bool no_wait);
+
+/**
+ * ttm_bo_mem_compat - Check if proposed placement is compatible with a bo
+ *
+ * @placement:  Return immediately if buffer is busy.
+ * @mem:  The struct ttm_mem_reg indicating the region where the bo resides
+ * @new_flags: Describes compatible placement found
+ *
+ * Returns true if the placement is compatible
+ */
+extern bool ttm_bo_mem_compat(struct ttm_placement *placement,
+ struct ttm_mem_reg *mem,
+ uint32_t *new_flags);
+
 /**
  * ttm_bo_validate
  *
-- 
2.8.2



[PATCH 1/6] lib: string: add function strtolower()

2016-07-01 Thread Markus Mayer
On 1 July 2016 at 03:52, Jani Nikula  wrote:
> On Fri, 01 Jul 2016, Markus Mayer  wrote:
>> Add a function called strtolower() to convert strings to lower case
>> in-place, overwriting the original string.
>>
>> This seems to be a recurring requirement in the kernel that is
>> currently being solved by several duplicated implementations doing the
>> same thing.
>>
>> Signed-off-by: Markus Mayer 
>> ---
>>  include/linux/string.h |  1 +
>>  lib/string.c   | 14 ++
>>  2 files changed, 15 insertions(+)
>>
>> diff --git a/include/linux/string.h b/include/linux/string.h
>> index 26b6f6a..aad605e 100644
>> --- a/include/linux/string.h
>> +++ b/include/linux/string.h
>> @@ -116,6 +116,7 @@ extern void * memchr(const void *,int,__kernel_size_t);
>>  #endif
>>  void *memchr_inv(const void *s, int c, size_t n);
>>  char *strreplace(char *s, char old, char new);
>> +char *strtolower(char *s);
>>
>>  extern void kfree_const(const void *x);
>>
>> diff --git a/lib/string.c b/lib/string.c
>> index ed83562..6e3b560 100644
>> --- a/lib/string.c
>> +++ b/lib/string.c
>> @@ -952,3 +952,17 @@ char *strreplace(char *s, char old, char new)
>>   return s;
>>  }
>>  EXPORT_SYMBOL(strreplace);
>> +
>
> This needs a kernel-doc comment right here.

Will add it.

>> +char *strtolower(char *s)
>> +{
>> + char *p;
>> +
>> +if (unlikely(!s))
>> +return NULL;
>
> Using spaces for indentation? See scripts/checkpatch.pl.

Not on purpose. Thanks for spotting it.

>> +
>> + for (p = s; *p; p++)
>> + *p = tolower(*p);
>> +
>> + return s;
>
> Why does it return a value? Could be void?

It could be void, but I thought that would make the function's use
less flexible. As is, the return value is there if anybody wants it,
but it can be ignored if it is not needed. Also, it seems customary
for string functions to be returning the string that was passed in.

I'll change it to void if there are strong opinions leaning that way.
Personally, I like that it returns a char * better.

> BR,
> Jani.
>
>> +}
>> +EXPORT_SYMBOL(strtolower);
>
> --
> Jani Nikula, Intel Open Source Technology Center


[PATCH v2 4/4] Documentation: add doc for sync_file_get_fence()

2016-07-01 Thread Gustavo Padovan
From: Gustavo Padovan 

Document the new function added to sync_file.c

v2: Adapt to fence_array

Signed-off-by: Gustavo Padovan 
---
 Documentation/sync_file.txt | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/sync_file.txt b/Documentation/sync_file.txt
index e8e2eba..ae2dbad1 100644
--- a/Documentation/sync_file.txt
+++ b/Documentation/sync_file.txt
@@ -64,6 +64,21 @@ The sync_file fd now can be sent to userspace.
 If the creation process fail, or the sync_file needs to be released by any
 other reason fput(sync_file->file) should be used.

+Receiving Sync Files from Userspace
+---
+
+When userspace needs to send an in-fence to the driver it pass file descriptor
+of the Sync File to the kernel. The kernel then can retrieve the fences
+from it.
+
+Interface:
+   struct fence *sync_file_get_fence(int fd);
+
+
+The function return a struct fence pointer referencing the fence(s) in the Sync
+File.
+
+
 References:
 [1] struct sync_file in include/linux/sync_file.h
 [2] All interfaces mentioned above defined in include/linux/sync_file.h
-- 
2.5.5



[PATCH v2 3/4] dma-buf/sync_file: add sync_file_get_fence()

2016-07-01 Thread Gustavo Padovan
From: Gustavo Padovan 

Creates a function that given an sync file descriptor returns a
fence containing all fences in the sync_file.

v2: Comments by Daniel Vetter
- Adapt to new version of fence_collection_init()
- Hold a reference for the fence we return

v3:
- Adapt to use fput() directly
- rename to sync_file_get_fence() as we always return one fence

v4: Adapt to use fence_array

Signed-off-by: Gustavo Padovan 
---
 drivers/dma-buf/sync_file.c | 24 
 include/linux/sync_file.h   |  1 +
 2 files changed, 25 insertions(+)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 12dbf17..3ffaea8 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -116,6 +116,30 @@ err:
return NULL;
 }

+/**
+ * sync_file_get_fence - get the fence related to the sync_file fd
+ * @fd:sync_file fd to get the fence from
+ *
+ * Ensures @fd references a valid sync_file and returns a fence that
+ * represents all fence in the sync_file. On error NULL is returned.
+ */
+struct fence *sync_file_get_fence(int fd)
+{
+   struct sync_file *sync_file;
+   struct fence *fence;
+
+   sync_file = sync_file_fdget(fd);
+   if (!sync_file)
+   return NULL;
+
+   fence = sync_file->fence;
+   fence_get(fence);
+   fput(sync_file->file);
+
+   return fence;
+}
+EXPORT_SYMBOL(sync_file_get_fence);
+
 static int sync_file_set_fence(struct sync_file *sync_file,
   struct fence **fences, int num_fences)
 {
diff --git a/include/linux/sync_file.h b/include/linux/sync_file.h
index 2efc5ec..f7de5a0 100644
--- a/include/linux/sync_file.h
+++ b/include/linux/sync_file.h
@@ -46,5 +46,6 @@ struct sync_file {
 };

 struct sync_file *sync_file_create(struct fence *fence);
+struct fence *sync_file_get_fence(int fd);

 #endif /* _LINUX_SYNC_H */
-- 
2.5.5



[PATCH v2 2/4] dma-buf/sync_file: rework fence storage in struct file

2016-07-01 Thread Gustavo Padovan
From: Gustavo Padovan 

Create sync_file->fence to abstract the type of fence we are using for
each sync_file. If only one fence is present we use a normal struct fence
but if there is more fences to be added to the sync_file a fence_array
is created.

This change cleans up sync_file a bit. We don't need to have sync_file_cb
array anymore. Instead, as we always have  one fence, only one fence
callback is registered per sync_file.

v4: Comments from Chris Wilson
- use sizeof(*fence) to reallocate array
- fix typo in comments
- protect num_fences sum against overflows
- use array->base instead of casting the to struct fence

v3: Comments from Chris Wilson and Christian König
- struct sync_file lost status member in favor of fence_is_signaled()
- drop use of fence_array_teardown()
- use sizeof(*fence) to allocate only an array on fence pointers

v2: Comments from Chris Wilson and Christian König
- Not using fence_ops anymore
- fence_is_array() was created to differentiate fence from fence_array
- fence_array_teardown() is now exported and used under fence_is_array()
- struct sync_file lost num_fences member

Cc: Chris Wilson 
Cc: Christian König 
Signed-off-by: Gustavo Padovan 
Reviewed-by: Chris Wilson 
---
 drivers/dma-buf/sync_file.c  | 166 ++-
 drivers/staging/android/sync_debug.c |  13 ++-
 include/linux/sync_file.h|  17 ++--
 3 files changed, 121 insertions(+), 75 deletions(-)

diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c
index 9aaa608..12dbf17 100644
--- a/drivers/dma-buf/sync_file.c
+++ b/drivers/dma-buf/sync_file.c
@@ -28,11 +28,11 @@

 static const struct file_operations sync_file_fops;

-static struct sync_file *sync_file_alloc(int size)
+static struct sync_file *sync_file_alloc(void)
 {
struct sync_file *sync_file;

-   sync_file = kzalloc(size, GFP_KERNEL);
+   sync_file = kzalloc(sizeof(*sync_file), GFP_KERNEL);
if (!sync_file)
return NULL;

@@ -45,6 +45,8 @@ static struct sync_file *sync_file_alloc(int size)

init_waitqueue_head(_file->wq);

+   INIT_LIST_HEAD(_file->cb.node);
+
return sync_file;

 err:
@@ -54,14 +56,11 @@ err:

 static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
 {
-   struct sync_file_cb *check;
struct sync_file *sync_file;

-   check = container_of(cb, struct sync_file_cb, cb);
-   sync_file = check->sync_file;
+   sync_file = container_of(cb, struct sync_file, cb);

-   if (atomic_dec_and_test(_file->status))
-   wake_up_all(_file->wq);
+   wake_up_all(_file->wq);
 }

 /**
@@ -76,22 +75,18 @@ struct sync_file *sync_file_create(struct fence *fence)
 {
struct sync_file *sync_file;

-   sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1]));
+   sync_file = sync_file_alloc();
if (!sync_file)
return NULL;

-   sync_file->num_fences = 1;
-   atomic_set(_file->status, 1);
+   sync_file->fence = fence;
+
snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%llu-%d",
 fence->ops->get_driver_name(fence),
 fence->ops->get_timeline_name(fence), fence->context,
 fence->seqno);

-   sync_file->cbs[0].fence = fence;
-   sync_file->cbs[0].sync_file = sync_file;
-   if (fence_add_callback(fence, _file->cbs[0].cb,
-  fence_check_cb_func))
-   atomic_dec(_file->status);
+   fence_add_callback(fence, _file->cb, fence_check_cb_func);

return sync_file;
 }
@@ -121,14 +116,48 @@ err:
return NULL;
 }

-static void sync_file_add_pt(struct sync_file *sync_file, int *i,
-struct fence *fence)
+static int sync_file_set_fence(struct sync_file *sync_file,
+  struct fence **fences, int num_fences)
+{
+   struct fence_array *array;
+
+   /*
+* The reference for the fences in the new sync_file and held
+* in add_fence() during the merge procedure, so for num_fences == 1
+* we already own a new reference to the fence. For num_fence > 1
+* we own the reference of the fence_array creation.
+*/
+   if (num_fences == 1) {
+   sync_file->fence = fences[0];
+   } else {
+   array = fence_array_create(num_fences, fences,
+  fence_context_alloc(1), 1, false);
+   if (!array)
+   return -ENOMEM;
+
+   sync_file->fence = >base;
+   }
+
+   return 0;
+}
+
+static struct fence **get_fences(struct sync_file *sync_file, int *num_fences)
+{
+   if (fence_is_array(sync_file->fence)) {
+   struct fence_array *array = to_fence_array(sync_file->fence);
+   

[PATCH v2 1/4] dma-buf/fence-array: add fence_is_array()

2016-07-01 Thread Gustavo Padovan
From: Gustavo Padovan 

Add helper to check if fence is array.

v2: Comments from Chris Wilson
- remove ternary if from ops comparison
- add EXPORT_SYMBOL(fence_array_ops)

Cc: Chris Wilson 
Cc: Christian König 
Signed-off-by: Gustavo Padovan 
Reviewed-by: Chris Wilson 
---
 drivers/dma-buf/fence-array.c |  1 +
 include/linux/fence-array.h   | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/dma-buf/fence-array.c b/drivers/dma-buf/fence-array.c
index a8731c8..ee50022 100644
--- a/drivers/dma-buf/fence-array.c
+++ b/drivers/dma-buf/fence-array.c
@@ -99,6 +99,7 @@ const struct fence_ops fence_array_ops = {
.wait = fence_default_wait,
.release = fence_array_release,
 };
+EXPORT_SYMBOL(fence_array_ops);

 /**
  * fence_array_create - Create a custom fence array
diff --git a/include/linux/fence-array.h b/include/linux/fence-array.h
index 86baaa4..a44794e 100644
--- a/include/linux/fence-array.h
+++ b/include/linux/fence-array.h
@@ -52,6 +52,16 @@ struct fence_array {
 extern const struct fence_ops fence_array_ops;

 /**
+ * fence_is_array - check if a fence is from the array subsclass
+ *
+ * Return true if it is a fence_array and false otherwise.
+ */
+static inline bool fence_is_array(struct fence *fence)
+{
+   return fence->ops == _array_ops;
+}
+
+/**
  * to_fence_array - cast a fence to a fence_array
  * @fence: fence to cast to a fence_array
  *
-- 
2.5.5



[PATCH v2 0/4] dma-buf/sync_file: rework fences on struct sync_file

2016-07-01 Thread Gustavo Padovan
From: Gustavo Padovan 

Hi all,

This is an attempt to improve fence support on Sync File. The basic idea
is to have only sync_file->fence and store all fences there, either as
normal fences or fence_arrays. That way we can remove some potential
duplication when using fence_array with sync_file: the duplication of the array
of fences and the duplication of fence_add_callback() for all fences.

Now when creating a new sync_file during the merge process sync_file_set_fence()
will set sync_file->fence based on the number of fences for that sync_file. If
there is more than one fence a fence_array is created. One important advantage
approach is that we only add one fence callback now, no matter how many fences
there are in a sync_file - the individual callbacks are added by fence_array.

This patchset also adds sync_file_get_fence() to retrieve fence from a sync_file
file descriptor.

Please review! Thanks!

Gustavo

---
Changes since PATCH v1 Comments from Chris Wilson)
 - use sizeof(*fence) to reallocate array 
 - fix typo in comments
 - protect num_fences sum against overflows
 - use array->base instead of casting the to struct fence
 - remove ternary if from ops comparison in fence_is_array()
 - add EXPORT_SYMBOL(fence_array_ops)

Changes since RFC v2 (Comments from Chris Wilson and Christian König):
 - struct sync_file lost status member in favor of fence_is_signaled()
 - drop use of fence_array_teardown()
 - use sizeof(*fence) to allocate only an array on fence pointers

Changes since RFC v1 (Comments from Chris Wilson and Christian König):
 - Not using fence_ops anymore.
 - fence_is_array() was created to differentiate fence from fence_array
 - fence_array_teardown() is now exported and used under fence_is_array()
 - struct sync_file lost num_fences member

Gustavo Padovan (4):
  dma-buf/fence-array: add fence_is_array()
  dma-buf/sync_file: rework fence storage in struct file
  dma-buf/sync_file: add sync_file_get_fence()
  Documentation: add doc for sync_file_get_fence()

 Documentation/sync_file.txt  |  15 +++
 drivers/dma-buf/fence-array.c|   1 +
 drivers/dma-buf/sync_file.c  | 190 ---
 drivers/staging/android/sync_debug.c |  13 ++-
 include/linux/fence-array.h  |  10 ++
 include/linux/sync_file.h|  18 ++--
 6 files changed, 172 insertions(+), 75 deletions(-)

-- 
2.5.5



[PATCH] drm/omap: remove unneeded conversions to bool

2016-07-01 Thread Andrew F. Davis
Found with scripts/coccinelle/misc/boolconv.cocci.

Signed-off-by: Andrew F. Davis 
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
b/drivers/gpu/drm/omapdrm/dss/dispc.c
index f83608b..495094b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -1655,7 +1655,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane 
plane,
 {
int scale_x = out_width != orig_width;
int scale_y = out_height != orig_height;
-   bool chroma_upscale = plane != OMAP_DSS_WB ? true : false;
+   bool chroma_upscale = plane != OMAP_DSS_WB;

if (!dss_has_feature(FEAT_HANDLE_UV_SEPARATE))
return;
@@ -3086,9 +3086,9 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel,
unsigned long pclk)
 {
if (dss_mgr_is_lcd(channel))
-   return pclk <= dispc.feat->max_lcd_pclk ? true : false;
+   return pclk <= dispc.feat->max_lcd_pclk;
else
-   return pclk <= dispc.feat->max_tv_pclk ? true : false;
+   return pclk <= dispc.feat->max_tv_pclk;
 }

 bool dispc_mgr_timings_ok(enum omap_channel channel,
-- 
2.9.0



[PATCH 2/2] drm/amd/powerplay: remove unneeded conversions to bool

2016-07-01 Thread Andrew F. Davis
Found with scripts/coccinelle/misc/boolconv.cocci.

Signed-off-by: Andrew F. Davis 
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c 
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index e629f8a..e5f2596 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -299,7 +299,7 @@ static int pp_set_powergating_state(void *handle,

/* Enable/disable GFX per cu powergating through SMU */
return hwmgr->hwmgr_func->enable_per_cu_power_gating(hwmgr,
-   state == AMD_PG_STATE_GATE ? true : false);
+   state == AMD_PG_STATE_GATE);
 }

 static int pp_suspend(void *handle)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c 
b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
index efb77ed..dd8050d 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
@@ -147,7 +147,7 @@ int phm_enable_dynamic_state_management(struct pp_hwmgr 
*hwmgr)
NULL, NULL);
}

-   enabled = ret == 0 ? true : false;
+   enabled = ret == 0;

cgs_notify_dpm_enabled(hwmgr->device, enabled);

-- 
2.9.0



[PATCH 1/2] drm/amdgpu: remove unneeded conversions to bool

2016-07-01 Thread Andrew F. Davis
Found with scripts/coccinelle/misc/boolconv.cocci.

Signed-off-by: Andrew F. Davis 
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  |  8 
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c  |  4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vi.c| 14 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 1a5cbaf..f3c8c37 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5144,13 +5144,13 @@ static int gfx_v8_0_set_powergating_state(void *handle,
case CHIP_POLARIS11:
if (adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG)
polaris11_enable_gfx_static_mg_power_gating(adev,
-   state == AMD_PG_STATE_GATE ? true : 
false);
+   state == AMD_PG_STATE_GATE);
else if (adev->pg_flags & AMD_PG_SUPPORT_GFX_DMG)
polaris11_enable_gfx_dynamic_mg_power_gating(adev,
-   state == AMD_PG_STATE_GATE ? true : 
false);
+   state == AMD_PG_STATE_GATE);
else
polaris11_enable_gfx_quick_mg_power_gating(adev,
-   state == AMD_PG_STATE_GATE ? true : 
false);
+   state == AMD_PG_STATE_GATE);
break;
default:
break;
@@ -5583,7 +5583,7 @@ static int gfx_v8_0_set_clockgating_state(void *handle,
case CHIP_CARRIZO:
case CHIP_STONEY:
gfx_v8_0_update_gfx_clock_gating(adev,
-state == AMD_CG_STATE_GATE ? 
true : false);
+state == AMD_CG_STATE_GATE);
break;
default:
break;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 9945d5b..6c3c730 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1406,9 +1406,9 @@ static int gmc_v8_0_set_clockgating_state(void *handle,
switch (adev->asic_type) {
case CHIP_FIJI:
fiji_update_mc_medium_grain_clock_gating(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
fiji_update_mc_light_sleep(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
break;
default:
break;
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 532ea88..e57cab6 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -1547,9 +1547,9 @@ static int sdma_v3_0_set_clockgating_state(void *handle,
case CHIP_CARRIZO:
case CHIP_STONEY:
sdma_v3_0_update_sdma_medium_grain_clock_gating(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
sdma_v3_0_update_sdma_medium_grain_light_sleep(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
break;
default:
break;
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index a65c960..d3404ef 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -1393,22 +1393,22 @@ static int vi_common_set_clockgating_state(void *handle,
switch (adev->asic_type) {
case CHIP_FIJI:
vi_update_bif_medium_grain_light_sleep(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
vi_update_hdp_medium_grain_clock_gating(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
vi_update_hdp_light_sleep(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
vi_update_rom_medium_grain_clock_gating(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
break;
case CHIP_CARRIZO:
case CHIP_STONEY:
vi_update_bif_medium_grain_light_sleep(adev,
-   state == AMD_CG_STATE_GATE ? true : false);
+   state == AMD_CG_STATE_GATE);
   

[benjamin.gaignard:sti-drm-next-2016-06-30 4/4] drivers/gpu/drm/sti/sti_hdmi.c:478:41: error: 'struct sti_hdmi' has no member named 'audio'

2016-07-01 Thread Benjamin Gaignard
 ^
>drivers/gpu/drm/sti/sti_hdmi.c: In function
> 'sti_hdmi_register_audio_driver':
>drivers/gpu/drm/sti/sti_hdmi.c:1267:6: error: 'struct sti_hdmi' has no
> member named 'audio'
>  hdmi->audio.enabled = 0;
>  ^
> >> drivers/gpu/drm/sti/sti_hdmi.c:1269:6: error: 'struct sti_hdmi' has no
> member named 'audio_pdev'
>  hdmi->audio_pdev = platform_device_register_data(
>  ^
>drivers/gpu/drm/sti/sti_hdmi.c:1273:17: error: 'struct sti_hdmi' has no
> member named 'audio_pdev'
>  if (IS_ERR(hdmi->audio_pdev))
> ^
>drivers/gpu/drm/sti/sti_hdmi.c:1274:22: error: 'struct sti_hdmi' has no
> member named 'audio_pdev'
>   return PTR_ERR(hdmi->audio_pdev);
>  ^
>drivers/gpu/drm/sti/sti_hdmi.c: In function 'sti_hdmi_bind':
>drivers/gpu/drm/sti/sti_hdmi.c:1327:6: error: 'struct sti_hdmi' has no
> member named 'drm_connector'
>  hdmi->drm_connector = drm_connector;
>  ^
>drivers/gpu/drm/sti/sti_hdmi.c:1342:39: error: 'struct sti_hdmi' has no
> member named 'audio'
>  err = hdmi_audio_infoframe_init(>audio.cea);
>   ^
>drivers/gpu/drm/sti/sti_hdmi.c:1355:6: error: 'struct sti_hdmi' has no
> member named 'drm_connector'
>  hdmi->drm_connector = NULL;
>  ^
>drivers/gpu/drm/sti/sti_hdmi.c: In function 'sti_hdmi_remove':
>drivers/gpu/drm/sti/sti_hdmi.c:1505:10: error: 'struct sti_hdmi' has no
> member named 'audio_pdev'
>  if (hdmi->audio_pdev)
>  ^
>drivers/gpu/drm/sti/sti_hdmi.c:1506:34: error: 'struct sti_hdmi' has no
> member named 'audio_pdev'
>   platform_device_unregister(hdmi->audio_pdev);
>  ^
>
> vim +478 drivers/gpu/drm/sti/sti_hdmi.c
>
>472   * @hdmi: pointer on the hdmi internal structure
>473   *
>474   * Return negative value if error occurs
>475   */
>476  static int hdmi_audio_infoframe_config(struct sti_hdmi *hdmi)
>477  {
>  > 478  struct hdmi_audio_params *audio = >audio;
>479  u8 buffer[HDMI_INFOFRAME_SIZE(AUDIO)];
>480  int ret, val;
>481
>482  DRM_DEBUG_DRIVER("enter %s, AIF %s\n", __func__,
>  > 483   audio->enabled ? "enable" : "disable");
>484  if (audio->enabled) {
>485  /* set audio parameters stored*/
>486  ret = hdmi_audio_infoframe_pack(>cea,
> buffer,
>
> ---
> 0-DAY kernel test infrastructureOpen Source Technology
> Center
> https://lists.01.org/pipermail/kbuild-all   Intel
> Corporation
>



-- 

Benjamin Gaignard

Graphic Working Group

Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs

Follow *Linaro: *Facebook <http://www.facebook.com/pages/Linaro> | Twitter
<http://twitter.com/#!/linaroorg> | Blog
<http://www.linaro.org/linaro-blog/>
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160701/e9347ea2/attachment-0001.html>


Patch for drm-next WAS Re: [PATCH] kref: prefer atomic_inc_not_zero to atomic_add_unless

2016-07-01 Thread Thomas Hellstrom
Dave,

Since kref_get_unless_zero() was brought in by drm, could we add this to
drm-next?

Thanks,
Thomas


On 06/30/2016 12:52 AM, Jason A. Donenfeld wrote:
> This was positively reviewed by maintainers but never picked up. Can
> someone queue this for 4.7 or 4.8?
>
> Thanks,
> Jason
>
> On Mon, Feb 1, 2016 at 10:53 PM, Jason A. Donenfeld  
> wrote:
>> This was positively reviewed but never picked up. Can someone queue
>> this for rc3?
>>
>> Thanks,
>> Jason
>>
>> On Sun, Oct 11, 2015 at 9:59 PM, Thomas Hellstrom  
>> wrote:
>>> Reviewed-by: Thomas Hellstrom 
>>>
>>>
>>> On 10/10/2015 12:56 PM, Jason A. Donenfeld wrote:
 On most platforms, there exists this ifdef:

  #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

 This makes this patch functionally useless. However, on PPC, there is
 actually an explicit definition of atomic_inc_not_zero with its own
 assembly that is slightly more optimized than atomic_add_unless. So,
 this patch changes kref to use atomic_inc_not_zero instead, for PPC and
 any future platforms that might provide an explicit implementation.

 This also puts this usage of kref more in line with a verbatim reading
 of the examples in Paul McKenney's paper [1] in the section titled "2.4
 Atomic Counting With Check and Release Memory Barrier", which uses
 atomic_inc_not_zero.

 [1] 
 https://urldefense.proofpoint.com/v2/url?u=http-3A__open-2Dstd.org_jtc1_sc22_wg21_docs_papers_2007_n2167.pdf=BQIBAg=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs=vpukPkBtpoNQp2IUKuFviOmPNYWVKmen3Jeeu55zmEA=z5Nd9sYiJMKiphNjyZp6XT5CbayXMBlcb903f260pDY=HEHX3CuXRs2GRRQWuC4Vef6iJMwdilKVRkiZgJpjEpA=

 Signed-off-by: Jason A. Donenfeld 
 ---
  include/linux/kref.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/include/linux/kref.h b/include/linux/kref.h
 index 484604d..83d1f94 100644
 --- a/include/linux/kref.h
 +++ b/include/linux/kref.h
 @@ -166,6 +166,6 @@ static inline int kref_put_mutex(struct kref *kref,
   */
  static inline int __must_check kref_get_unless_zero(struct kref *kref)
  {
 - return atomic_add_unless(>refcount, 1, 0);
 + return atomic_inc_not_zero(>refcount);
  }
  #endif /* _KREF_H_ */




[Bug 96580] GPU lockup on AMD 7970M when playing games

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96580

Saad Naji  changed:

   What|Removed |Added

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

--- Comment #6 from Saad Naji  ---
I switched to Windows environment to check if my GPU was the culprit by playing
some games. The result was on my Windows environment my GPU would shut off
after overheating. So I figured I am getting this bug because my GPU was also
overheating on my GNU/Linux environment. I disassembled my GPU and cleaned it.
As result, I do not have this bug anymore.

-- 
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/20160701/a46fc75f/attachment.html>


[Bug 93341] GPU lockups on RadeonHD 7770 (radeonsi driver) when running OpenGL games or after extended periods of time

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93341

--- Comment #7 from Jean-François Fortin Tam  ---
Um hello, any developers around?

As previously mentioned, although it happens even when idle, it's quite easy to
trigger and reproduce by using 3D/openGL content. And it's extremely easy to
trigger with http://demo.f4map.com/#lat=45.4946369=-73.5661827=19 ;
just have to sit around that page for a minute or two, maybe pan around the
map, and your driver (and kernel) will crash with the screen turning off.

-- 
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/20160701/c1535c2a/attachment.html>


[benjamin.gaignard:sti-drm-next-2016-06-30 4/4] drivers/gpu/drm/sti/sti_hdmi.c:478:41: error: 'struct sti_hdmi' has no member named 'audio'

2016-07-01 Thread kbuild test robot
hdmi' has no 
member named 'audio_pdev'
 if (IS_ERR(hdmi->audio_pdev))
^
   drivers/gpu/drm/sti/sti_hdmi.c:1274:22: error: 'struct sti_hdmi' has no 
member named 'audio_pdev'
  return PTR_ERR(hdmi->audio_pdev);
 ^
   drivers/gpu/drm/sti/sti_hdmi.c: In function 'sti_hdmi_bind':
   drivers/gpu/drm/sti/sti_hdmi.c:1327:6: error: 'struct sti_hdmi' has no 
member named 'drm_connector'
 hdmi->drm_connector = drm_connector;
 ^
   drivers/gpu/drm/sti/sti_hdmi.c:1342:39: error: 'struct sti_hdmi' has no 
member named 'audio'
 err = hdmi_audio_infoframe_init(>audio.cea);
  ^
   drivers/gpu/drm/sti/sti_hdmi.c:1355:6: error: 'struct sti_hdmi' has no 
member named 'drm_connector'
 hdmi->drm_connector = NULL;
 ^
   drivers/gpu/drm/sti/sti_hdmi.c: In function 'sti_hdmi_remove':
   drivers/gpu/drm/sti/sti_hdmi.c:1505:10: error: 'struct sti_hdmi' has no 
member named 'audio_pdev'
 if (hdmi->audio_pdev)
 ^
   drivers/gpu/drm/sti/sti_hdmi.c:1506:34: error: 'struct sti_hdmi' has no 
member named 'audio_pdev'
  platform_device_unregister(hdmi->audio_pdev);
 ^

vim +478 drivers/gpu/drm/sti/sti_hdmi.c

   472   * @hdmi: pointer on the hdmi internal structure
   473   *
   474   * Return negative value if error occurs
   475   */
   476  static int hdmi_audio_infoframe_config(struct sti_hdmi *hdmi)
   477  {
 > 478  struct hdmi_audio_params *audio = >audio;
   479  u8 buffer[HDMI_INFOFRAME_SIZE(AUDIO)];
   480  int ret, val;
   481  
   482  DRM_DEBUG_DRIVER("enter %s, AIF %s\n", __func__,
 > 483   audio->enabled ? "enable" : "disable");
   484  if (audio->enabled) {
   485  /* set audio parameters stored*/
   486  ret = hdmi_audio_infoframe_pack(>cea, buffer,

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
-- next part --
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 56886 bytes
Desc: not available
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160701/9e308c13/attachment-0001.obj>


[Bug 95528] BioShock Infinite graphical glitches on radeonsi

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=95528

--- Comment #18 from Matt Arsenault  ---
(In reply to Matt Arsenault from comment #17)
> This is going to be a pre-existing bug. Can you narrow it down to a
> particular shader? I'm not familiar with debugging graphics

I didn't notice the second trimmed set

-- 
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/20160701/8160407f/attachment.html>


[Bug 95528] BioShock Infinite graphical glitches on radeonsi

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=95528

--- Comment #17 from Matt Arsenault  ---
This is going to be a pre-existing bug. Can you narrow it down to a particular
shader? I'm not familiar with debugging graphics

-- 
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/20160701/e97b6fdc/attachment-0001.html>


[Bug 96731] [RADEONSI] [LLVM] [bisected] GPU lockups when running Alien: Isolation

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96731

--- Comment #6 from Matt Arsenault  ---
The only obvious difference I see in the dump diffs without looking at any
particular shader is the number of used registers changed. This is probably
because previously the implicit uses of the super registers were missing when
the AsmPrinter counts them. If the dynamic was out of bounds, it is more likely
to be out of bounds of the allocated VGPRs, in which case the hardware behavior
is to return v0. If there are out of bounds accesses, it would now read an
undefined register. I don't know if there are any actual  out of bounds dynamic
vector accesses

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 



[Bug 96672] [radeonsi][LLVM 3.9] ARK: Survival Evolved, Missing text glyphs

2016-07-01 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=96672

--- Comment #2 from Shawn Starr  ---
apitrace can be found here: 
https://drive.google.com/open?id=0Bze7CJKD12nOR2x1NjBheF81MHc

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: