[PATCH] dim: autodetect branches in rebuild-nightly

2016-10-18 Thread Daniel Vetter
Needs new url-mapping information in nightly.conf to work properly.

v2:
- Fix typo when calling rr_cache_dir. Oops.
- Use cut -f 1 instead of sed/regex horrors (jani).

Signed-off-by: Daniel Vetter 
---
 dim | 50 +-
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/dim b/dim
index 48d5e7b6477a..09879b166cee 100755
--- a/dim
+++ b/dim
@@ -197,7 +197,7 @@ function get_remote_name
local remote_url=$1

local remote=`git remote -v | grep $remote_url | \
-   head -n1 | sed -e 's/^\(.*\)\t.*/\1/'`
+   head -n1 | cut -f 1`

if [[ $remote == "" ]] ; then
echoerr No git remote for $remote_url found in `pwd`.
@@ -235,20 +235,30 @@ function dim_commit_add_tag
done
 }

+function map_nightly_remote
+{
+   local nightly_remote=$1
+   local remote_url=`eval echo 
"\\\$nightly_remote_url_${nightly_remote/-/_}"`
+
+   get_remote_name $remote_url
+}
+
 function update_linux_next
 {
cd $DIM_PREFIX/drm-intel-nightly

+   local nightly_origin=`map_nightly_remote origin`
+
# always update drm-intel-fixes
echo -n "Pushing drm-intel-fixes to for-linux-next-fixes... "
-   git push $DRY_RUN origin +origin/drm-intel-fixes:for-linux-next-fixes 
>& /dev/null
+   git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-fixes:for-linux-next-fixes >& /dev/null
echo "Done."

-   if git merge-base --is-ancestor origin/drm-intel-next-fixes 
origin/drm-intel-fixes ; then
+   if git merge-base --is-ancestor $nightly_origin/drm-intel-next-fixes 
$nightly_origin/drm-intel-fixes ; then
# -fixes has caught up to dinf, i.e. we're out of the merge
# window. Push the next queue.
echo -n "Out of merge window. Pushing drm-intel-next-queued to 
for-linux-next... "
-   git push $DRY_RUN origin 
+origin/drm-intel-next-queued:for-linux-next >& /dev/null
+   git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-next-queued:for-linux-next >& /dev/null
echo "Done."
else
# dinf is ahead of -fixes, i.e. drm-next has already closed for
@@ -256,7 +266,7 @@ function update_linux_next
# for the current -next cycle. Push dinf

echo -n "Pushing drm-intel-next-fixes to for-linux-next... "
-   git push $DRY_RUN origin 
+origin/drm-intel-next-fixes:for-linux-next >& /dev/null
+   git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-next-fixes:for-linux-next >& /dev/null
echo "Done."
fi
 }
@@ -272,11 +282,20 @@ function check_conflicts
true
 }

+function rr_cache_dir
+{
+   if [ -d $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ ] ; then
+   echo $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/
+   else
+   echo $DIM_PREFIX/$DIM_DRM_INTEL/.git/rr-cache/
+   fi
+}
+
 function update_rerere_cache
 {
cd $DIM_PREFIX/drm-intel-rerere/
git pull
-   cp rr-cache/* $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ -r
+   cp rr-cache/* `rr_cache_dir` -r
cd -
 }

@@ -307,9 +326,10 @@ function dim_rebuild_nightly
fi

for remote in $(echo $nightly_branches | tr " " "\n" | sed 's|/.*$||g' 
| sort -u); do
-   echo -n "Fetching $remote... "
+   local nightly_remote=`map_nightly_remote $remote`
+   echo -n "Fetching $remote (as $nightly_remote) ... "
# git fetch returns 128 if there's nothing to be fetched
-   git fetch $remote >& /dev/null || true
+   git fetch $nightly_remote >& /dev/null || true
echo "Done."
done

@@ -329,12 +349,14 @@ function dim_rebuild_nightly
if [[ -n $sha1 ]] ; then
echo -n "Using override sha1: $sha1... "
else
-   sha1=$branch
+   local remote=${branch%%/*}
+   local nightly_remote=`map_nightly_remote $remote`
+   sha1=`echo $branch | sed -e s/^$remote/$nightly_remote/`
fi

if [ $first == 1 ] ; then
+   git reset --hard $sha1 &> /dev/null
echo "Reset. Done."
-   git reset --hard $sha1 >& /dev/null
first=0
elif git merge --rerere-autoupdate --ff-only $sha1 >& /dev/null 
; then
# nothing to do if just fast-forward
@@ -370,14 +392,16 @@ function dim_rebuild_nightly
git commit --quiet -m "$integration_branch: $time integration manifest"
echo "Done."

+   local nightly_origin=`map_nightly_remote origin`
+
echo -n "Pushing $integration_branch... "
-   git push $DRY_RUN origin +HEAD >& /dev/null && echo "Done."
+   git push $DRY_RUN $nightly_origin +HEAD >& 

[Intel-gfx] [PATCH 07/10] dim: autodetect branches in rebuild-nightly

2016-10-18 Thread Daniel Vetter
On Tue, Oct 18, 2016 at 3:52 PM, Jani Nikula
 wrote:
> On Tue, 18 Oct 2016, Daniel Vetter  wrote:
>> Needs new url-mapping information in nightly.conf to work properly.
>
> I think in the long run the right fix would be to make nightly.conf
> independent of remote names. Not sure if that's worth the trouble at
> this point.

It is with this. The remote names in nightly.conf are now entirely
fiction. The magic here takes those, then looks up the corresponding
url (againg from nigthly.conf) and then uses get_remote_name to figure
out the appropriate git remote in the local repo. Or complain and quit
if it doesn't exist. My drm-tip now has an "origin" remote pointing at
Linus' repo, while the "origin" from nightly.conf gets remapped to
"drm-tip". Sample output from running rebuild-nightly:

Updating rerere cache and nightly.conf... Done.
Fetching drm-intel (as danvet) ... Done.
Fetching drm-upstream (as airlied) ... Done.
Fetching sound-upstream (as takashi) ... Done.
Merging drm-intel/drm-intel-fixes... Reset. Done.
Merging drm-upstream/drm-fixes... Fast-forward. Done.
Merging drm-intel/drm-intel-next-fixes... Fast-forward. Done.
...

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[PATCH 06/10] dim: Nuke nightly-forget

2016-10-18 Thread Daniel Vetter
On Tue, Oct 18, 2016 at 3:39 PM, Jani Nikula
 wrote:
> On Tue, 18 Oct 2016, Daniel Vetter  wrote:
>> With our proliferation of branches it's become long useless. Nowadays
>> my MO is to revert the offending commit in the rerere-cache branch
>> explicitly, remove drm-intel-nightly/.git/rr-cache and then re-run
>> rebuild-nightly. That works much better, hence nuke this helper.
>
> Agreed.
>
> Later, we should add a helper to do the better MO.

dim revert-rerere  sounds like a sweet thing. Let
me type that up and write some docs for it.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[Intel-gfx] [PATCH 05/10] dim: support git worktree for aux checkouts

2016-10-18 Thread Daniel Vetter
On Tue, Oct 18, 2016 at 3:38 PM, Jani Nikula
 wrote:
>> + if git help worktree &> /dev/null ; then
>> + cd $DIM_PREFIX/$DIM_DRM_INTEL
>> + remote=`get_remote_name $remote_url`
>> + if ! git branch | grep $name > /dev/null ; then
>
> The failure modes are annoying if there's a substring match for
> $name. Unfortunately grep -w is no good if you need to handle "-" too.

Hm, right. I copypasted this all over, but with drm-intel-* we have a
few clashes. Played around, and the following does exact matches and
gets the job done:

if [[ `git branch --list $name` != "" ]]

I'll roll this out in a follow up patch everywhere.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[Bug 98005] VCE dual instance encoding inconsistent since st/va: enable dual instances encode by sync surface

2016-10-18 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=98005

--- Comment #5 from Andy Furniss  ---
I normally test with raw, but this sample also shows the issue with transcode,

I tried harder and it is possible since the patch to get a normal size vbr -
just a lot harder than before.

1080p50.mkv -
https://drive.google.com/file/d/0BxP5-S1t9VEEczlMd2ZzUElldms/view?usp=sharing

Here's a paste testing with your settings.

andy [vce-vbr-test]$ gst-launch-1.0 -f filesrc location=1080p50.mkv !
matroskademux ! vaapidecode ! vaapih264enc rate-control=vbr bitrate=21428 !
video/x-h264,profile=baseline ! filesink location=vbr.264
Setting pipeline to PAUSED ...
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Pipeline is PREROLLING ...
Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context,
gst.vaapi.Display=(GstVaapiDisplay)NULL;
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:05.440943972
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...



andy [vce-vbr-test]$ gst-launch-1.0 -f filesrc location=1080p50.mkv !
matroskademux ! vaapidecode ! vaapih264enc rate-control=cbr bitrate=15000 !
video/x-h264,profile=baseline ! filesink location=cbr.264
Setting pipeline to PAUSED ...
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Pipeline is PREROLLING ...
Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context,
gst.vaapi.Display=(GstVaapiDisplay)NULL;
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:05.162493127
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...


andy [vce-vbr-test]$ ls -lh
total 85M
-rw-rw-r-- 1 andy andy 35M Sep 28 16:05 1080p50.mkv
-rw-rw-r-- 1 andy andy 35M Oct 18 21:17 cbr.264
-rw-rw-r-- 1 andy andy 15M Oct 18 21:16 vbr.264

-- 
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/20161018/26c81277/attachment.html>


[PATCH 0/5] drm/sun4i: Handle TV overscan

2016-10-18 Thread Jean-Francois Moine
On Tue, 18 Oct 2016 12:03:49 +0200
Maxime Ripard  wrote:

> The fourth one being the major one. Every time I raised the issue on
> IRC, the answer basically was "we don't care about analog", so I'm a
> bit pessimistic about whether dealing with this in the core would be
> accepted, hence why I chose to deal with this at the driver level.

The same problem exists with HDMI and old TVs (mine is an ASUS 22T1E):
these TVs overscan as soon as AVI frames are in the stream.

-- 
Ken ar c'hentañ| ** Breizh ha Linux atav! **
Jef |   http://moinejf.free.fr/


[PATCH 0/6] R-Car DU fixes and cleanups

2016-10-18 Thread Laurent Pinchart
Hi Tomi and Dave,

On Tuesday 04 Oct 2016 15:31:33 Laurent Pinchart wrote:
> Hello,
> 
> This patch series contains five simple cleanups and fixes for the
> rcar-du-drm driver, as well as an argument constification patch for
> video/of.
> 
> The patches themselves are straightforward, see individual commit messages
> for details. Patch 2/6 (normally merged through the DRM tree) depends on
> patch 1/6 (normally merged through the fbdev tree). As they don't conflict
> with patches 3/6 to 6/6, we can either merge the whole series through the
> DRM tree, or merge patches 1/6 and 2/6 through the fbdev tree and the rest
> through the DRM tree.
> 
> My preference would go for merging the whole series through the DRM tree to
> avoid potential conflicts with the other patches I'm working on for v4.10.
> There is no foreseen conflict at the moment, but I might rework encoder
> handling in the driver that could possibly result in a conflict. Dave, Tomi,
> any preference ? If you're fine with patches not going through your tree,
> could you please ack them ?

Ping ? Tomi, would you be fine with merging 1/6 through the DRM tree ? If so, 
could you please ack it ?

> Cc: David Airlie 
> Cc: Tomi Valkeinen 
> 
> Laurent Pinchart (6):
>   video: of: Constify node argument to display timing functions
>   drm: rcar-du: Constify node argument to rcar_du_lvds_connector_init()
>   drm: rcar-du: Bring HDMI encoder comments in line with the driver
>   drm: rcar-du: Remove test for impossible error condition
>   drm: rcar-du: Remove memory allocation error message
>   drm: rcar-du: Fix crash in encoder failure error path
> 
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c |  6 --
>  drivers/gpu/drm/rcar-du/rcar_du_hdmienc.c |  4 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 10 +-
>  drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c |  2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_lvdscon.h |  2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c |  4 +---
>  drivers/video/of_display_timing.c |  6 +++---
>  include/video/of_display_timing.h | 15 ---
>  8 files changed, 21 insertions(+), 28 deletions(-)

-- 
Regards,

Laurent Pinchart



[Bug 178221] radeon performance drop from 4.8 to 4.9-rc1 in Shadow of Mordor

2016-10-18 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=178221

--- Comment #2 from Christian Nissen  ---
(In reply to Alex Deucher from comment #1)
> Does reverting that commit fix your issue?

Yes that did it. 

Only tested Full HD with Very High Details.

Kernel compiled from; Min FPS; Avg FPS; Max FPS
d66ba15bde22703b3c0cec6782519cb0765a6777; 21,14; 36,85; 63,29
87744ab3832b83ba71b931f86f9cfdb000d07da5; 15,78; 30,47; 59,13

Had to compile with CONFIG_OPROFILE and CONFIG_FRAME_POINTER disabled, to avoid
this error: https://patchwork.kernel.org/patch/9364811/

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH v4 3/9] drm/hisilicon/hibmc: Add support for frame buffer

2016-10-18 Thread Rongrong Zou
Hi Daniel,

Thanks for your review!

在 2016/10/18 15:49, Daniel Vetter 写道:
> On Tue, Oct 18, 2016 at 12:01:18PM +0800, Rongrong Zou wrote:
>> Add support for fbdev and framebuffer.
>>
>> Signed-off-by: Rongrong Zou 
>> ---
>>   drivers/gpu/drm/hisilicon/hibmc/Makefile  |   2 +-
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   |  25 +++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  25 +++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 257 
>> ++
>>   drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   |  67 ++
>>   5 files changed, 375 insertions(+), 1 deletion(-)
>>   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
>>
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile 
>> b/drivers/gpu/drm/hisilicon/hibmc/Makefile
>> index d5c40b8..810a37e 100644
>> --- a/drivers/gpu/drm/hisilicon/hibmc/Makefile
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
>> @@ -1,5 +1,5 @@
>>   ccflags-y := -Iinclude/drm
>> -hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o hibmc_ttm.o
>> +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_fbdev.o hibmc_drm_power.o 
>> hibmc_ttm.o
>>
>>   obj-$(CONFIG_DRM_HISI_HIBMC)   +=hibmc-drm.o
>>   #obj-y += hibmc-drm.o
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> index e118f3b..8ddb763 100644
>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
>> @@ -66,11 +66,31 @@ static void hibmc_disable_vblank(struct drm_device *dev, 
>> unsigned int pipe)
>>
>>   static int hibmc_pm_suspend(struct device *dev)
>>   {
>> +struct pci_dev *pdev = to_pci_dev(dev);
>> +struct drm_device *drm_dev = pci_get_drvdata(pdev);
>> +struct hibmc_drm_device *hidev = drm_dev->dev_private;
>> +
>> +if (hidev->fbdev.initialized) {
>
> What do you need these checks for? This looks a bit fishy tbh ...

It is delivered from the bochs driver, and I will fix if there are
any problems, Thanks.

>
>> +console_lock();
>> +drm_fb_helper_set_suspend(>fbdev.helper, 1);
>> +console_unlock();
>
> drm_fb_helper_set_suspend_unlocked is the new fancy one. Please use that
> one instead. Also, that has the check you might need already included,
> which means you can nuke this entire function here and just call it
> directly.

So it should be wrote as:
static int hibmc_pm_suspend(struct device *dev)
{
...
drm_kms_helper_poll_disable(drm_dev);
drm_fb_helper_set_suspend_unlocked(>fbdev.helper, 1);
...
}

static int hibmc_pm_resume(struct device *dev)
{
...
drm_helper_resume_force_mode(drm_dev);
drm_fb_helper_set_suspend_unlocked(>fbdev.helper, 0);
drm_kms_helper_poll_enable(drm_dev);
...
}, is it ?

Regards
Rongrong.

> -Daniel
>
>> +}
>> +
>>  return 0;
>>   }
>>
>>   static int hibmc_pm_resume(struct device *dev)
>>   {
>> +struct pci_dev *pdev = to_pci_dev(dev);
>> +struct drm_device *drm_dev = pci_get_drvdata(pdev);
>> +struct hibmc_drm_device *hidev = drm_dev->dev_private;
>> +
>> +if (hidev->fbdev.initialized) {
>> +console_lock();
>> +drm_fb_helper_set_suspend(>fbdev.helper, 0);
>> +console_unlock();
>> +}
>> +
>>  return 0;
>>   }
>>
>> @@ -170,6 +190,7 @@ static int hibmc_unload(struct drm_device *dev)
>>   {
>>  struct hibmc_drm_device *hidev = dev->dev_private;
>>
>> +hibmc_fbdev_fini(hidev);
>>  hibmc_hw_fini(hidev);
>>  dev->dev_private = NULL;
>>  return 0;
>> @@ -194,6 +215,10 @@ static int hibmc_load(struct drm_device *dev, unsigned 
>> long flags)
>>  if (ret)
>>  goto err;
>>
>> +ret = hibmc_fbdev_init(hidev);
>> +if (ret)
>> +goto err;
>> +
>>  return 0;
>>
>>   err:
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h 
>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>> index 00bb153..4f5887f 100644
>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
>> @@ -20,9 +20,23 @@
>>   #define HIBMC_DRM_DRV_H
>>
>>   #include 
>> +#include 
>>   #include 
>>   #include 
>>
>> +struct hibmc_framebuffer {
>> +struct drm_framebuffer fb;
>> +struct drm_gem_object *obj;
>> +bool is_fbdev_fb;
>> +};
>> +
>> +struct hibmc_fbdev {
>> +struct drm_fb_helper helper;
>> +struct hibmc_framebuffer fb;
>> +int size;
>> +bool initialized;
>> +};
>> +
>>   struct hibmc_drm_device {
>>  /* hw */
>>  void __iomem   *mmio;
>> @@ -41,9 +55,13 @@ struct hibmc_drm_device {
>>  bool initialized;
>>  } ttm;
>>
>> +/* fbdev */
>> +struct hibmc_fbdev fbdev;
>>  bool mm_inited;
>>   };
>>
>> +#define to_hibmc_framebuffer(x) container_of(x, struct hibmc_framebuffer, 
>> fb)
>> +
>>   struct hibmc_bo {
>>  struct ttm_buffer_object bo;
>>  

[PATCH 2/3] dt-bindings: it6251: add bindings for IT6251 LVDS-to-eDP bridge

2016-10-18 Thread Marek Vasut
On 10/18/2016 06:30 PM, Rob Herring wrote:
> On Mon, Oct 17, 2016 at 06:33:28PM +0200, Marek Vasut wrote:
>> Add DT bindings for ITE IT6251 LVDS-to-eDP bridge.
>>
>> Signed-off-by: Marek Vasut 
>> Cc: devicetree at vger.kernel.org
>> Cc: Daniel Vetter 
>> Cc: Rob Herring 
>> Cc: Sean Cross 
>> ---
>>  .../bindings/display/bridge/ite,it6251.txt | 35 
>> ++
>>  1 file changed, 35 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/display/bridge/ite,it6251.txt
>>
>> diff --git a/Documentation/devicetree/bindings/display/bridge/ite,it6251.txt 
>> b/Documentation/devicetree/bindings/display/bridge/ite,it6251.txt
>> new file mode 100644
>> index 000..c5db82c
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/display/bridge/ite,it6251.txt
>> @@ -0,0 +1,35 @@
>> +ITE IT6251 LVDS-to-eDP bridge bindings
>> +
>> +Required properties:
>> +- compatible:   Should be "ite,it6251"
>> +- reg:  i2c address of the bridge, i2c address of the 
>> LVDS part
>> +- reg-names:Should be "bridge", "lvds"
>> +- power-supply: Regulator to provide the supply voltage
> 
> The input pin is called "power"?

The chip has about 7 power rails, but the design I have only has an
upstream regulator which toggles them all. I wonder, shall we model
all the rails ?

>> +- video interfaces: Device node can contain video interface port nodes
>> +for panel according to [1].
>> +
>> +[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
>> +
>> +Example:
>> +
>> +it6251 at 5c {
>> +compatible = "ite,it6251";
>> +reg = <0x5c>, <0x5e>;
>> +reg-names = "bridge", "lvds";
>> +power-supply = <_display>;
>> +
>> +ports {
>> +port at 0 {
>> +bridge_out_edp0: endpoint {
>> +remote-endpoint = <_in_edp0>;
>> +};
>> +};
>> +
>> +port at 1 {
>> +bridge_in_lvds0: endpoint {
>> +remote-endpoint = <_out>;
>> +};
>> +};
>> +};
>> +};
>> +
>> -- 
>> 2.9.3
>>


-- 
Best regards,
Marek Vasut


[Bug 178281] wine-staging apps freezes the machine with RX460

2016-10-18 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=178281

--- Comment #4 from fin4478 at hotmail.com ---
I have tested Mesa 12.1.0-devel - padoka and Oibaf ppa and Debian testing
12.0.3-1. Same problem with kernel that have latest powerplay code. Now I am
using kernel 4.7.8 that has a poor graphics performance but seems to stable and
Rosegarden works. My RX460 is as fast my A8-7600 that I had before. Amd linux
drivers have been going down hill since I bought the A8-7600 two years ago,
Then it was a surprise how well it worked with Catalyst. Only solution I found
now is to install win10 to my test partition If I want to enjoy rx460. At the
same time my kid plays fine with Nvidia 750ti and Debian testing while I am
searching drivers.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH 1/3] x86/pat: export io memory reserve/free api.

2016-10-18 Thread Dave Airlie
On 18 Oct. 2016 17:23, "Edward O'Callaghan" 
wrote:
>
> NACK,
>
> I think you want to use 'iomap_create_wc()' instead to avoid aliasing.

Please explain what can alias here?

Dave.

>
> Kind Regards,
> Edward.
>
> On 10/18/2016 05:13 PM, Dave Airlie wrote:
> > From: Dave Airlie 
> >
> > These functions are needed for gpu/ttm drivers to reserve the
> > VRAM area as write combined. In a lot of places we don't ioremap
> > but still need to insert pfn from it into a VMA using vm_insert_mixed,
> > but a recent change in mixed insertion means we need to reserve
> > VRAM as WC upfront, so we need these APIs exported.
> >
> > Signed-off-by: Dave Airlie 
> > ---
> >  arch/x86/mm/pat.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
> > index 170cc4f..5ce2fbb 100644
> > --- a/arch/x86/mm/pat.c
> > +++ b/arch/x86/mm/pat.c
> > @@ -719,6 +719,7 @@ out_free:
> >  out_err:
> >   return ret;
> >  }
> > +EXPORT_SYMBOL(io_reserve_memtype);
> >
> >  /**
> >   * io_free_memtype - Release a memory type mapping for a region of
memory
> > @@ -729,6 +730,7 @@ void io_free_memtype(resource_size_t start,
resource_size_t end)
> >  {
> >   free_memtype(start, end);
> >  }
> > +EXPORT_SYMBOL(io_free_memtype);
> >
> >  pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
> >   unsigned long size, pgprot_t vma_prot)
> >
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20161018/434ffdbf/attachment.html>


[PATCH 1/3] x86/pat: export io memory reserve/free api.

2016-10-18 Thread Edward O'Callaghan
NACK,

I think you want to use 'iomap_create_wc()' instead to avoid aliasing.

Kind Regards,
Edward.

On 10/18/2016 05:13 PM, Dave Airlie wrote:
> From: Dave Airlie 
> 
> These functions are needed for gpu/ttm drivers to reserve the
> VRAM area as write combined. In a lot of places we don't ioremap
> but still need to insert pfn from it into a VMA using vm_insert_mixed,
> but a recent change in mixed insertion means we need to reserve
> VRAM as WC upfront, so we need these APIs exported.
> 
> Signed-off-by: Dave Airlie 
> ---
>  arch/x86/mm/pat.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
> index 170cc4f..5ce2fbb 100644
> --- a/arch/x86/mm/pat.c
> +++ b/arch/x86/mm/pat.c
> @@ -719,6 +719,7 @@ out_free:
>  out_err:
>   return ret;
>  }
> +EXPORT_SYMBOL(io_reserve_memtype);
>  
>  /**
>   * io_free_memtype - Release a memory type mapping for a region of memory
> @@ -729,6 +730,7 @@ void io_free_memtype(resource_size_t start, 
> resource_size_t end)
>  {
>   free_memtype(start, end);
>  }
> +EXPORT_SYMBOL(io_free_memtype);
>  
>  pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
>   unsigned long size, pgprot_t vma_prot)
> 

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


[PATCH 9/9] gpu: ipu-v3: initially clear all interrupts

2016-10-18 Thread Philipp Zabel
If we want to stop resetting the IPU in the future, masking all
interrupts before registering the irq handlers will not be enough to
avoid spurious interrupts. We also have to clear them.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/ipu-v3/ipu-common.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index b7d7bd6..97218af 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1286,8 +1286,11 @@ static int ipu_irq_init(struct ipu_soc *ipu)
return ret;
}

-   for (i = 0; i < IPU_NUM_IRQS; i += 32)
+   /* Mask and clear all interrupts */
+   for (i = 0; i < IPU_NUM_IRQS; i += 32) {
ipu_cm_write(ipu, 0, IPU_INT_CTRL(i / 32));
+   ipu_cm_write(ipu, ~unused[i / 32], IPU_INT_STAT(i / 32));
+   }

for (i = 0; i < IPU_NUM_IRQS; i += 32) {
gc = irq_get_domain_generic_chip(ipu->domain, i);
-- 
2.9.3



[PATCH 8/9] drm/imx: ipuv3-plane: add support for YUV 4:2:2 and 4:4:4, NV12, and NV16 formats

2016-10-18 Thread Philipp Zabel
Hook up support for DRM_FORMAT_YUV422, DRM_FORMAT_YVU422,
DRM_FORMAT_YUV444, DRM_FORMAT_YVU444, DRM_FORMAT_NV12,
and DRM_FORMAT_NV16.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/ipuv3-plane.c | 52 +--
 1 file changed, 44 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index 88829b9..991b3f1 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -50,6 +50,12 @@ static const uint32_t ipu_plane_formats[] = {
DRM_FORMAT_YVYU,
DRM_FORMAT_YUV420,
DRM_FORMAT_YVU420,
+   DRM_FORMAT_YUV422,
+   DRM_FORMAT_YVU422,
+   DRM_FORMAT_YUV444,
+   DRM_FORMAT_YVU444,
+   DRM_FORMAT_NV12,
+   DRM_FORMAT_NV16,
DRM_FORMAT_RGB565,
 };

@@ -292,6 +298,10 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
switch (fb->pixel_format) {
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
+   case DRM_FORMAT_YUV422:
+   case DRM_FORMAT_YVU422:
+   case DRM_FORMAT_YUV444:
+   case DRM_FORMAT_YVU444:
/*
 * Multiplanar formats have to meet the following restrictions:
 * - The (up to) three plane addresses are EBA, EBA+UBO, EBA+VBO
@@ -300,25 +310,34 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
 * - Only EBA may be changed while scanout is active
 * - The strides of U and V planes must be identical.
 */
-   ubo = drm_plane_state_to_ubo(state);
vbo = drm_plane_state_to_vbo(state);

-   if ((ubo & 0x7) || (vbo & 0x7))
-   return -EINVAL;
-
-   if ((ubo > 0xf8) || (vbo > 0xf8))
+   if (vbo & 0x7 || vbo > 0xf8)
return -EINVAL;

if (old_fb && (fb->pixel_format == old_fb->pixel_format)) {
-   old_ubo = drm_plane_state_to_ubo(old_state);
old_vbo = drm_plane_state_to_vbo(old_state);
-   if (ubo != old_ubo || vbo != old_vbo)
+   if (vbo != old_vbo)
crtc_state->mode_changed = true;
}

if (fb->pitches[1] != fb->pitches[2])
return -EINVAL;

+   /* fall-through */
+   case DRM_FORMAT_NV12:
+   case DRM_FORMAT_NV16:
+   ubo = drm_plane_state_to_ubo(state);
+
+   if (ubo & 0x7 || ubo > 0xf8)
+   return -EINVAL;
+
+   if (old_fb && (fb->pixel_format == old_fb->pixel_format)) {
+   old_ubo = drm_plane_state_to_ubo(old_state);
+   if (ubo != old_ubo)
+   crtc_state->mode_changed = true;
+   }
+
if (fb->pitches[1] < 1 || fb->pitches[1] > 16384)
return -EINVAL;

@@ -406,10 +425,16 @@ static void ipu_plane_atomic_update(struct drm_plane 
*plane,
switch (fb->pixel_format) {
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
+   case DRM_FORMAT_YUV422:
+   case DRM_FORMAT_YVU422:
+   case DRM_FORMAT_YUV444:
+   case DRM_FORMAT_YVU444:
ubo = drm_plane_state_to_ubo(state);
vbo = drm_plane_state_to_vbo(state);

-   if (fb->pixel_format == DRM_FORMAT_YUV420)
+   if (fb->pixel_format != DRM_FORMAT_YVU420 &&
+   fb->pixel_format != DRM_FORMAT_YVU422 &&
+   fb->pixel_format != DRM_FORMAT_YVU444)
ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
  fb->pitches[1], ubo, vbo);
else
@@ -420,6 +445,17 @@ static void ipu_plane_atomic_update(struct drm_plane 
*plane,
"phy = %lu %lu %lu, x = %d, y = %d", eba, ubo, vbo,
state->src_x >> 16, state->src_y >> 16);
break;
+   case DRM_FORMAT_NV12:
+   case DRM_FORMAT_NV16:
+   ubo = drm_plane_state_to_ubo(state);
+
+   ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
+ fb->pitches[1], ubo, ubo);
+
+   dev_dbg(ipu_plane->base.dev->dev,
+   "phy = %lu %lu, x = %d, y = %d", eba, ubo,
+   state->src_x >> 16, state->src_y >> 16);
+   break;
default:
dev_dbg(ipu_plane->base.dev->dev, "phys = %lu, x = %d, y = %d",
eba, state->src_x >> 16, state->src_y >> 16);
-- 
2.9.3



[PATCH 7/9] gpu: ipu-v3: add YUV 4:4:4 support

2016-10-18 Thread Philipp Zabel
The IDMAC does support reading and writing DRM_FORMAT_YUV444 and
DRM_FORMAT_YVU444.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/ipu-v3/ipu-common.c |  2 ++
 drivers/gpu/ipu-v3/ipu-cpmem.c  | 17 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index b9539f7..b7d7bd6 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -88,6 +88,8 @@ enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 
drm_fourcc)
case DRM_FORMAT_YVU420:
case DRM_FORMAT_YUV422:
case DRM_FORMAT_YVU422:
+   case DRM_FORMAT_YUV444:
+   case DRM_FORMAT_YVU444:
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV21:
case DRM_FORMAT_NV16:
diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c
index e6b8bae..4db7475 100644
--- a/drivers/gpu/ipu-v3/ipu-cpmem.c
+++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
@@ -445,6 +445,16 @@ void ipu_cpmem_set_yuv_planar(struct ipuv3_channel *ch,
v_offset = stride * height;
u_offset = v_offset + (uv_stride * height);
break;
+   case DRM_FORMAT_YUV444:
+   uv_stride = stride;
+   u_offset = stride * height;
+   v_offset = u_offset + (uv_stride * height);
+   break;
+   case DRM_FORMAT_YVU444:
+   uv_stride = stride;
+   v_offset = stride * height;
+   u_offset = v_offset + (uv_stride * height);
+   break;
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
uv_stride = stride;
@@ -595,6 +605,13 @@ int ipu_cpmem_set_fmt(struct ipuv3_channel *ch, u32 
drm_fourcc)
/* burst size */
ipu_ch_param_write_field(ch, IPU_FIELD_NPB, 31);
break;
+   case DRM_FORMAT_YUV444:
+   case DRM_FORMAT_YVU444:
+   /* pix format */
+   ipu_ch_param_write_field(ch, IPU_FIELD_PFS, 0);
+   /* burst size */
+   ipu_ch_param_write_field(ch, IPU_FIELD_NPB, 31);
+   break;
case DRM_FORMAT_NV12:
/* pix format */
ipu_ch_param_write_field(ch, IPU_FIELD_PFS, 4);
-- 
2.9.3



[PATCH 6/9] gpu: ipu-cpmem: Add missing YVU422 case to ipu_cpmem_set_yuv_planar

2016-10-18 Thread Philipp Zabel
ipu_cpmem_set_fmt is already prepared to handle DRM_FORMAT_YVU422.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/ipu-v3/ipu-cpmem.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c
index fcb7dc8..e6b8bae 100644
--- a/drivers/gpu/ipu-v3/ipu-cpmem.c
+++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
@@ -440,6 +440,11 @@ void ipu_cpmem_set_yuv_planar(struct ipuv3_channel *ch,
u_offset = stride * height;
v_offset = u_offset + (uv_stride * height);
break;
+   case DRM_FORMAT_YVU422:
+   uv_stride = stride / 2;
+   v_offset = stride * height;
+   u_offset = v_offset + (uv_stride * height);
+   break;
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
uv_stride = stride;
-- 
2.9.3



[PATCH 5/9] drm/imx: ipuv3-plane: let drm_plane_state_to_ubo/vbo handle chroma subsampling other than 4:2:0

2016-10-18 Thread Philipp Zabel
To support 4:2:2 or 4:4:4 chroma subsampling, divide the x/y offsets in
drm_plane_state_to_ubo/vbo only if necessary for the given pixel format.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/ipuv3-plane.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index 70fd55d..88829b9 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -64,13 +64,14 @@ drm_plane_state_to_eba(struct drm_plane_state *state)
 {
struct drm_framebuffer *fb = state->fb;
struct drm_gem_cma_object *cma_obj;
+   int x = state->src_x >> 16;
+   int y = state->src_y >> 16;

cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
BUG_ON(!cma_obj);

-   return cma_obj->paddr + fb->offsets[0] +
-  fb->pitches[0] * (state->src_y >> 16) +
-  (fb->bits_per_pixel >> 3) * (state->src_x >> 16);
+   return cma_obj->paddr + fb->offsets[0] + fb->pitches[0] * y +
+  drm_format_plane_cpp(fb->pixel_format, 0) * x;
 }

 static inline unsigned long
@@ -79,13 +80,17 @@ drm_plane_state_to_ubo(struct drm_plane_state *state)
struct drm_framebuffer *fb = state->fb;
struct drm_gem_cma_object *cma_obj;
unsigned long eba = drm_plane_state_to_eba(state);
+   int x = state->src_x >> 16;
+   int y = state->src_y >> 16;

cma_obj = drm_fb_cma_get_gem_obj(fb, 1);
BUG_ON(!cma_obj);

-   return cma_obj->paddr + fb->offsets[1] +
-  fb->pitches[1] * (state->src_y >> 16) / 2 +
-  (state->src_x >> 16) / 2 - eba;
+   x /= drm_format_horz_chroma_subsampling(fb->pixel_format);
+   y /= drm_format_vert_chroma_subsampling(fb->pixel_format);
+
+   return cma_obj->paddr + fb->offsets[1] + fb->pitches[1] * y +
+  drm_format_plane_cpp(fb->pixel_format, 1) * x - eba;
 }

 static inline unsigned long
@@ -94,13 +99,17 @@ drm_plane_state_to_vbo(struct drm_plane_state *state)
struct drm_framebuffer *fb = state->fb;
struct drm_gem_cma_object *cma_obj;
unsigned long eba = drm_plane_state_to_eba(state);
+   int x = state->src_x >> 16;
+   int y = state->src_y >> 16;

cma_obj = drm_fb_cma_get_gem_obj(fb, 2);
BUG_ON(!cma_obj);

-   return cma_obj->paddr + fb->offsets[2] +
-  fb->pitches[2] * (state->src_y >> 16) / 2 +
-  (state->src_x >> 16) / 2 - eba;
+   x /= drm_format_horz_chroma_subsampling(fb->pixel_format);
+   y /= drm_format_vert_chroma_subsampling(fb->pixel_format);
+
+   return cma_obj->paddr + fb->offsets[2] + fb->pitches[2] * y +
+  drm_format_plane_cpp(fb->pixel_format, 2) * x - eba;
 }

 void ipu_plane_put_resources(struct ipu_plane *ipu_plane)
-- 
2.9.3



[PATCH 4/9] drm/imx: ipuv3-plane: merge ipu_plane_atomic_set_base into atomic_update

2016-10-18 Thread Philipp Zabel
ipu_plane_atomic_set_base is called from ipu_plane_atomic_update in two
different places, depending on whether drm_atomic_crtc_needs_modeset is
true. Also depending on the same condition, this function does two
different things.
This patch removes the indirection by merging the relevant parts into
ipu_plane_atomic_update, making the actual code flow more obvious as a
result. Also remove the duplicate planar format comment, which is
already found in ipu_plane_atomic_check.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/ipuv3-plane.c | 97 ++-
 1 file changed, 34 insertions(+), 63 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index f217444..70fd55d 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -103,62 +103,6 @@ drm_plane_state_to_vbo(struct drm_plane_state *state)
   (state->src_x >> 16) / 2 - eba;
 }

-static void ipu_plane_atomic_set_base(struct ipu_plane *ipu_plane)
-{
-   struct drm_plane *plane = _plane->base;
-   struct drm_plane_state *state = plane->state;
-   struct drm_crtc_state *crtc_state = state->crtc->state;
-   struct drm_framebuffer *fb = state->fb;
-   unsigned long eba, ubo, vbo;
-   int active;
-
-   eba = drm_plane_state_to_eba(state);
-
-   switch (fb->pixel_format) {
-   case DRM_FORMAT_YUV420:
-   case DRM_FORMAT_YVU420:
-   if (!drm_atomic_crtc_needs_modeset(crtc_state))
-   break;
-
-   /*
-* Multiplanar formats have to meet the following restrictions:
-* - The (up to) three plane addresses are EBA, EBA+UBO, EBA+VBO
-* - EBA, UBO and VBO are a multiple of 8
-* - UBO and VBO are unsigned and not larger than 0xf8
-* - Only EBA may be changed while scanout is active
-* - The strides of U and V planes must be identical.
-*/
-   ubo = drm_plane_state_to_ubo(state);
-   vbo = drm_plane_state_to_vbo(state);
-
-   if (fb->pixel_format == DRM_FORMAT_YUV420)
-   ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
- fb->pitches[1], ubo, vbo);
-   else
-   ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
- fb->pitches[1], vbo, ubo);
-
-   dev_dbg(ipu_plane->base.dev->dev,
-   "phy = %lu %lu %lu, x = %d, y = %d", eba, ubo, vbo,
-   state->src_x >> 16, state->src_y >> 16);
-   break;
-   default:
-   dev_dbg(ipu_plane->base.dev->dev, "phys = %lu, x = %d, y = %d",
-   eba, state->src_x >> 16, state->src_y >> 16);
-
-   break;
-   }
-
-   if (!drm_atomic_crtc_needs_modeset(crtc_state)) {
-   active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch);
-   ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba);
-   ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active);
-   } else {
-   ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 0, eba);
-   ipu_cpmem_set_buffer(ipu_plane->ipu_ch, 1, eba);
-   }
-}
-
 void ipu_plane_put_resources(struct ipu_plane *ipu_plane)
 {
if (!IS_ERR_OR_NULL(ipu_plane->dp))
@@ -394,15 +338,19 @@ static void ipu_plane_atomic_update(struct drm_plane 
*plane,
 {
struct ipu_plane *ipu_plane = to_ipu_plane(plane);
struct drm_plane_state *state = plane->state;
+   struct drm_crtc_state *crtc_state = state->crtc->state;
+   struct drm_framebuffer *fb = state->fb;
+   unsigned long eba, ubo, vbo;
enum ipu_color_space ics;
+   int active;

-   if (old_state->fb) {
-   struct drm_crtc_state *crtc_state = state->crtc->state;
+   eba = drm_plane_state_to_eba(state);

-   if (!drm_atomic_crtc_needs_modeset(crtc_state)) {
-   ipu_plane_atomic_set_base(ipu_plane);
-   return;
-   }
+   if (old_state->fb && !drm_atomic_crtc_needs_modeset(crtc_state)) {
+   active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch);
+   ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba);
+   ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active);
+   return;
}

switch (ipu_plane->dp_flow) {
@@ -446,7 +394,30 @@ static void ipu_plane_atomic_update(struct drm_plane 
*plane,
ipu_cpmem_set_high_priority(ipu_plane->ipu_ch);
ipu_idmac_set_double_buffer(ipu_plane->ipu_ch, 1);
ipu_cpmem_set_stride(ipu_plane->ipu_ch, state->fb->pitches[0]);
-   ipu_plane_atomic_set_base(ipu_plane);
+   switch (fb->pixel_format) {
+   case DRM_FORMAT_YUV420:
+   case DRM_FORMAT_YVU420:
+   

[PATCH 3/9] drm/imx: ipuv3-plane: request modeset if plane offsets changed

2016-10-18 Thread Philipp Zabel
If the framebuffer pixel format is planar YUV and unchanged, but the U
or V plane offsets change, do not return an error, but request a modeset
instead.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/ipuv3-plane.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index d4a771c..f217444 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -356,13 +356,11 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
if ((ubo > 0xf8) || (vbo > 0xf8))
return -EINVAL;

-   if (old_fb &&
-   (old_fb->pixel_format == DRM_FORMAT_YUV420 ||
-old_fb->pixel_format == DRM_FORMAT_YVU420)) {
+   if (old_fb && (fb->pixel_format == old_fb->pixel_format)) {
old_ubo = drm_plane_state_to_ubo(old_state);
old_vbo = drm_plane_state_to_vbo(old_state);
if (ubo != old_ubo || vbo != old_vbo)
-   return -EINVAL;
+   crtc_state->mode_changed = true;
}

if (fb->pitches[1] != fb->pitches[2])
-- 
2.9.3



[PATCH 2/9] drm/imx: ipuv3-plane: disable local alpha for planes without alpha channel

2016-10-18 Thread Philipp Zabel
Without this patch, after enabling the overlay plane with an RGBA
framebuffer, switching to a framebuffer without alpha channel would
cause the plane to vanish, since the pixel local alpha is constant
zero in that case. Disable local alpha again when setting an opaque
framebuffer.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/ipuv3-plane.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index 3a03fd8..d4a771c 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -434,6 +434,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
ipu_dp_set_global_alpha(ipu_plane->dp, false, 0, false);
break;
default:
+   ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true);
break;
}
}
-- 
2.9.3



[PATCH 1/9] drm/imx: ipuv3-plane: make sure x/y offsets are even in case of chroma subsampling

2016-10-18 Thread Philipp Zabel
Odd x/y offsets are not allowed for chroma subsampled planar YUV
formats.

Signed-off-by: Philipp Zabel 
---
 drivers/gpu/drm/imx/ipuv3-plane.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index 5c34299..3a03fd8 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -259,6 +259,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
struct drm_framebuffer *fb = state->fb;
struct drm_framebuffer *old_fb = old_state->fb;
unsigned long eba, ubo, vbo, old_ubo, old_vbo;
+   int hsub, vsub;

/* Ok to disable */
if (!fb)
@@ -372,6 +373,13 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,

if (old_fb && old_fb->pitches[1] != fb->pitches[1])
crtc_state->mode_changed = true;
+
+   /* x and y offsets must be even in case of chroma subsampling */
+   hsub = drm_format_horz_chroma_subsampling(fb->pixel_format);
+   vsub = drm_format_vert_chroma_subsampling(fb->pixel_format);
+   if (((state->src_x >> 16) & (hsub - 1)) ||
+   ((state->src_y >> 16) & (vsub - 1)))
+   return -EINVAL;
}

return 0;
-- 
2.9.3



[Bug 98005] VCE dual instance encoding inconsistent since st/va: enable dual instances encode by sync surface

2016-10-18 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=98005

--- Comment #4 from Boyuan Zhang  ---
(In reply to Andy Furniss from comment #3)
> (In reply to Boyuan Zhang from comment #2)
> > Hi Andy,
> > 
> > The corruption/out of order issue has been reproduced locally. Root cause
> > and fix can be found at
> > https://lists.freedesktop.org/archives/mesa-dev/2016-October/132268.html
> > 
> > Please give a try.
> > 
> > Regards,
> > Boyuan
> 
> Thanks, that does fix the out of order and corruption.
> 
> As you explained in the thread above, dual instance bitrate control is a
> separate issue, but this patch does change behavior a bit.
> 
> cbr is unaffected by patch and could be seen as OK (unless I find a better
> test to break it). md5sums may vary but the bitrate/file size is only
> different by a tiny amount and visually things seem OK.
> 
> vbr is different, before patch it may be OK, but there was a chance of some
> files being less that half size/rate than they should.
> 
> With the patch it seems that they are all now less than half rate. So at
> least it's consistent (md5sums do still vary).
> 
> Will test more tomorrow as it's late here.

Hi Andy,

Regarding to the bitrate/file size issue, I didn't see it with my local tests. 

For example, "vaapih264enc rate-control=cbr bitrate=15000" and "vaapih264enc
rate-control=vbr bitrate=21428" will give me almost same output file size,
which is expected results since 21428*70%=15000.

Maybe the command/clip we tested are different. Can you share the command &
clip where you saw vbr got half of the expected value please?

Regards,
Boyuan

-- 
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/20161018/ee14b519/attachment-0001.html>


[PATCH v2] drm/mediatek: fix a typo

2016-10-18 Thread CK Hu
Acked-by: CK Hu 

On Tue, 2016-10-18 at 16:23 +0800, Bibby Hsieh wrote:
> If we want to set the hardware OD to relay mode,
> we have to set OD_CFG register rather than
> OD_RELAYMODE; otherwise, the system will access
> the wrong address.
> 
> Fixes: 7216436420414144646f5d8343d061355fd23483 ("drm/mediatek: set mt8173 
> dithering function")
> Cc: stable at vger.kernel.org # v4.9+
> Signed-off-by: Bibby Hsieh 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index df33b3c..aa5f20f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -123,7 +123,7 @@ static void mtk_od_config(struct mtk_ddp_comp *comp, 
> unsigned int w,
> unsigned int bpc)
>  {
>   writel(w << 16 | h, comp->regs + DISP_OD_SIZE);
> - writel(OD_RELAYMODE, comp->regs + OD_RELAYMODE);
> + writel(OD_RELAYMODE, comp->regs + OD_CFG);
>   mtk_dither_set(comp, bpc, DISP_OD_CFG);
>  }
>  




[PATCH 0/4 v2] Audio support for adv7511 hdmi bridge

2016-10-18 Thread Laurent Pinchart
Hi John,

(CC'ing Morimoto-san)

On Tuesday 06 Sep 2016 15:17:58 John Stultz wrote:
> On Tue, Aug 30, 2016 at 2:23 AM, Laurent Pinchart wrote:
> > Hi John,
> > 
> > Thank you for the patches.
> 
> Thanks so much for the review! I'm reworking the patchset now and will
> be sending out an updated set soon!
> 
> >> This patchset, along with the i2s driver and dts changes allows
> >> HDMI audio to work on the HiKey board.
> > 
> > Where are the dts changes ?
> 
> Here's what I'm using to get it working:
> https://git.linaro.org/people/john.stultz/android-dev.git/commitdiff/1024cb4
> 85b6f00a7e355ce60425f04a584481148

Thank you.

We need to standardize DT bindings for HDMI sound output. Morimoto-san, could 
you have a look at the DT bindings proposal for HDMI sound output with the 
ADV7511, and comment on whether it matches the approach you've taken for HDMI 
sound output on R-Car Gen3 ?

> But again, that's dependent on the k3dma driver (queued), the hi6210
> i2s driver (still being reworked), and adv7511 audio (this patchset).

-- 
Regards,

Laurent Pinchart



[PATCH 00/10] mm: adjust get_user_pages* functions to explicitly pass FOLL_* flags

2016-10-18 Thread Michal Hocko
On Thu 13-10-16 01:20:10, Lorenzo Stoakes wrote:
> This patch series adjusts functions in the get_user_pages* family such that
> desired FOLL_* flags are passed as an argument rather than implied by flags.
> 
> The purpose of this change is to make the use of FOLL_FORCE explicit so it is
> easier to grep for and clearer to callers that this flag is being used. The 
> use
> of FOLL_FORCE is an issue as it overrides missing VM_READ/VM_WRITE flags for 
> the
> VMA whose pages we are reading from/writing to, which can result in surprising
> behaviour.
> 
> The patch series came out of the discussion around commit 38e0885, which
> addressed a BUG_ON() being triggered when a page was faulted in with PROT_NONE
> set but having been overridden by FOLL_FORCE. do_numa_page() was run on the
> assumption the page _must_ be one marked for NUMA node migration as an actual
> PROT_NONE page would have been dealt with prior to this code path, however
> FOLL_FORCE introduced a situation where this assumption did not hold.
> 
> See https://marc.info/?l=linux-mm=147585445805166 for the patch proposal.

I like this cleanup. Tracking FOLL_FORCE users was always a nightmare
and the flag behavior is really subtle so we should better be explicit
about it. I haven't gone through each patch separately but rather
applied the whole series and checked the resulting diff. This all seems
OK to me and feel free to add
Acked-by: Michal Hocko 

I am wondering whether we can go further. E.g. it is not really clear to
me whether we need an explicit FOLL_REMOTE when we can in fact check
mm != current->mm and imply that. Maybe there are some contexts which
wouldn't work, I haven't checked.

Then I am also wondering about FOLL_TOUCH behavior.
__get_user_pages_unlocked has only few callers which used to be
get_user_pages_unlocked before 1e9877902dc7e ("mm/gup: Introduce
get_user_pages_remote()"). To me a dropped FOLL_TOUCH seems
unintentional. Now that get_user_pages_unlocked has gup_flags argument I
guess we might want to get rid of the __g-u-p-u version altogether, no?

__get_user_pages is quite low level and imho shouldn't be exported. It's
only user - kvm - should rather pull those two functions to gup instead
and export them. There is nothing really KVM specific in them.

I also cannot say I would be entirely thrilled about get_user_pages_locked,
we only have one user which can simply do lock g-u-p unlock AFAICS.

I guess there is more work in that area and I do not want to impose all
that work on you, but I couldn't resist once I saw you playing in that
area ;) Definitely a good start!
-- 
Michal Hocko
SUSE Labs


[RFC] dma-buf/fence: avoid holding lock while calling cb

2016-10-18 Thread Christian König
Am 18.10.2016 um 16:23 schrieb Rob Clark:
> On Tue, Oct 18, 2016 at 6:07 AM, Christian König
>  wrote:
>> Am 16.10.2016 um 18:03 schrieb Rob Clark:
>>> Currently with fence-array, we have a potential deadlock situation.  If we
>>> fence_add_callback() on an array-fence, the array-fence's lock is aquired
>>> first, and in it's ->enable_signaling() callback, it will install cb's on
>>> it's array-member fences, so the array-member's lock is acquired second.
>>>
>>> But in the signal path, the array-member's lock is acquired first, and the
>>> array-fence's lock acquired second.
>>>
>>> One approach to deal with this is avoid holding the fence's lock when
>>> calling the cb.  It is a bit intrusive and I haven't fixed up all the
>>> other drivers that call directly or indirectly fence_signal_locked().
>>
>> In general: Oh! Yes! Please! We have the same issue in the AMD scheduler
>> when we want to register a new callback on the next fence in the list.
>>
>>> I guess the other option would be introduce a work-queue for array-fence?
>>
>> That's what we do in the GPU scheduler and it adds quite a bunch of extra
>> overhead.
>>
>> So my preferences are clearly to fix calling the cb with any locks held
>> before using another work item for the array fences. But I'm not sure if
>> that is possible with all drivers.
> I guess it is probably not 100% possible to ensure driver isn't
> holding other of it's own locks when cb is called.. so I guess wq for
> cb that needs to take other locks is a safe solution.
>
> That said, and maybe I need more coffee, but I think the spinlock for
> iterating cb_list is probably not needed.. I think we could arrange
> things so the test_and_set(SIGNALED) is enough to protect iterating
> the list and calling the cb's.  (Maybe protect the
> test_and_set(SIGNALED) w/ fence->lock just so it doesn't race someone
> who already got past the test_bit(SIGNALED) in _add_callback()?)
>
> Then "all" we have to do is figure out how to kill the
> fence_signal_locked()/fence_is_signaled_locked() paths..
>
> I think I also wouldn't mind pushing the locking down into the
> ->enable_signaling() cb too for drivers that need that.  Maybe we
> don't strictly need that.  From quick look, seems like half the
> drivers just 'return true;' and seems a bit silly to grab a lock for
> that.
>
> Maybe wq in fence-array in the short term at least is the best way
> just to get things working without such an invasive change.  But seems
> like if we could kill the current _locked() paths that there is
> potential to make the fence->lock situation less annoying.

Maybe a heretic question, but do we really need the lock after all ?

I mean the only use case for a double linked list I can see is removing 
the callbacks in the case of a timed out wait and that should be a 
rather rare operation.

So wouldn't a single linked list with atomic swaps do as well?

Christian.

>
> BR,
> -R
>
>> Regards,
>> Christian.
>>
>>
>>> Or??
>>>
>>> lockdep splat:
>>>
>>>==
>>> [ INFO: possible circular locking dependency detected ]
>>> 4.7.0-rc7+ #489 Not tainted
>>> ---
>>> surfaceflinger/2034 is trying to acquire lock:
>>>(&(>lock)->rlock){..}, at: []
>>> fence_signal+0x5c/0xf8
>>>
>>> but task is already holding lock:
>>>(&(>child_list_lock)->rlock){..}, at: []
>>> sw_sync_ioctl+0x228/0x3b0
>>>
>>> which lock already depends on the new lock.
>>>
>>> the existing dependency chain (in reverse order) is:
>>>
>>> -> #1 (&(>child_list_lock)->rlock){..}:
>>>  [] __lock_acquire+0x173c/0x18d8
>>>  [] lock_acquire+0x4c/0x68
>>>  [] _raw_spin_lock_irqsave+0x54/0x70
>>>  [] fence_add_callback+0x3c/0x100
>>>  [] fence_array_enable_signaling+0x80/0x170
>>>  [] fence_add_callback+0xb8/0x100
>>>  [] sync_file_poll+0xd4/0xf0
>>>  [] do_sys_poll+0x220/0x438
>>>  [] SyS_ppoll+0x1b0/0x1d8
>>>  [] el0_svc_naked+0x24/0x28
>>>
>>> -> #0 (&(>lock)->rlock){..}:
>>>  [] print_circular_bug+0x80/0x2e0
>>>  [] __lock_acquire+0x17c4/0x18d8
>>>  [] lock_acquire+0x4c/0x68
>>>  [] _raw_spin_lock_irqsave+0x54/0x70
>>>  [] fence_signal+0x5c/0xf8
>>>  [] fence_array_cb_func+0x78/0x88
>>>  [] fence_signal_locked+0x80/0xe0
>>>  [] sw_sync_ioctl+0x2f8/0x3b0
>>>  [] do_vfs_ioctl+0xa4/0x790
>>>  [] SyS_ioctl+0x8c/0xa0
>>>  [] el0_svc_naked+0x24/0x28
>>>
>>> other info that might help us debug this:
>>>
>>>Possible unsafe locking scenario:
>>>
>>>  CPU0CPU1
>>>  
>>> lock(&(>child_list_lock)->rlock);
>>>  lock(&(>lock)->rlock);
>>>  lock(&(>child_list_lock)->rlock);
>>> lock(&(>lock)->rlock);
>>>
>>>*** DEADLOCK ***
>>>
>>> 1 lock held 

[PATCH] i915: don't call drm_atomic_state_put on invalid pointer

2016-10-18 Thread Arnd Bergmann
The introduction of reference counting on the state structures caused
sanitize_watermarks() in i915 to break in the error handling case,
as pointed out by gcc -Wmaybe-uninitialized

drivers/gpu/drm/i915/intel_display.c: In function ‘intel_modeset_init’:
include/drm/drm_atomic.h:224:2: error: ‘state’ may be used uninitialized in 
this function [-Werror=maybe-uninitialized]

This changes the function back to only drop the reference count
when it was successfully allocated first.

Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
Cc: Chris Wilson 
Cc: Daniel Vetter 
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/i915/intel_display.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 6d168685bbda..6a26da143aa6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -16314,7 +16314,7 @@ static void sanitize_watermarks(struct drm_device *dev)
 * BIOS-programmed watermarks untouched and hope for the best.
 */
WARN(true, "Could not determine valid watermarks for inherited 
state\n");
-   goto fail;
+   goto put_state;
}

/* Write calculated watermark values back */
@@ -16325,8 +16325,9 @@ static void sanitize_watermarks(struct drm_device *dev)
dev_priv->display.optimize_watermarks(cs);
}

-fail:
+put_state:
drm_atomic_state_put(state);
+fail:
drm_modeset_drop_locks();
drm_modeset_acquire_fini();
 }
-- 
2.9.0



[Bug 178281] wine-staging apps freezes the machine with RX460

2016-10-18 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=178281

--- Comment #3 from Alex Deucher  ---
What version of mesa are you using?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


Unix Device Memory Allocation project

2016-10-18 Thread James Jones
Thanks for the detailed writeup, and it was good to meet you at XDC.  Below:

On 10/18/2016 04:40 PM, Marek Olšák wrote:
> Hi,
>
> The text below describes how open source AMDGPU buffer sharing works.
> I hope you'll find some useful bits in it.
>
>
> Producer = allocates a buffer (or texture), and exports its handle
> (DMABUF, etc.), and can use the buffer in various ways
>
> Consumer = imports the handle, and can use the buffer in various ways
>
>
> *** Producer-consumer interaction. ***
>
> 1) On handle export, the producer receives these flags:
>
> - READ, WRITE, READ+WRITE: Describe the expected usage in the consumer.
>   * The producer decides if it needs to disable compression based on
> those flags.
>
> - EXPLICIT_FLUSH flag: Meaning that the producer will explicitly
> receive a "flush_resource" call before the consumer starts using the
> buffer. This is a hint that the producer doesn't have to keep track of
> "when to do decompression" when sharing the buffer with the consumer.
>
>
> 2) Passing metadata (tiling, pixel ordering, format, layout) info
> between the producer and consumer:
>
> - All AMDGPU buffer/texture allocations have 256 bytes (64 dwords) of
> internal per-allocation metadata storage that lives in the kernel
> space. There are amdgpu-specific ioctls that can "set" and "get" the
> metadata. Any process that has a buffer handle can do that.
>   * The produces writes the metadata, the consumer reads it.
>
> - The producer-consumer interop API doesn't know about the metadata.
> All you need to pass around is a buffer handle. (KMS, DMABUF, etc.)
>   * There was a note during the talk that DMABUF doesn't have any
> metadata. Well, I just told you that it has, but it's private to
> amdgpu and possibly accessible to other kernel drivers too.

OK.  I believe someone pointed this out during my talk or afterwards as 
well.  Some drivers are using this method, but there seems to be some 
debate over whether this is the preferred general design.  Others have 
told me this isn't the right mechanism to store this sort of metadata, 
but I'm not familiar with the specific counter arguments.

>   * We can build upon this idea. I think the worst thing to do would
> be to add metadata handling to driver-agnostic userspace APIs. Really,
> driver-agnostic APIs shouldn't know about that, because they can't
> understand all the hw-specific information encoded in the metadata.
> Also, when you want to change the metadata format, you only have to
> update the affected drivers, not userspace APIs.

How does this kernel-side metadata interact with userspace driver 
suballocation, or application-managed suballocation in APIs such as Vulkan?

Thanks,
-James

> 3) Internal AMDGPU metadata storage format
> - The header contains: Vendor ID, PCI ID, and version number.
> - The header is followed by PCI-ID-specific data. The PCI ID and the
> version number define the format.
> - If the consumer runs on a different device, it must read the header
> and parse the metadata based on that. It implies that the
> driver-specific consumer code needs to know about all potential
> producer devices.
>
>
> Bottom line: DMABUF handles alone are fully sufficient for sharing
> buffers/textures between devices and processes from the AMDGPU point
> of view.
>
> HW driver implementation: The driver doesn't know anything about the
> users of exported or imported buffers. It only acts based on the few
> flags described in section 1. So far that's all we've needed.
>
>
> *** Use cases ***
>
> 1) DRI (producer: application; consumer: X server)
> - The producer receives these flags: READ, EXPLICIT_FLUSH. The X
> server will treat the shared "texture" as read-only. EXPLICIT_FLUSH
> ensures the texture can be compressed, and "flush_resource" will be
> called as part of SwapBuffers and "glFlush: GL_FRONT".
> - The X server can run on a different device. In that case, the window
> system API passes the "LINEAR" flag to the driver during allocation.
> That's suboptimal and fixable.
>
>
> 2) OpenGL-OpenCL interop (OpenGL always exports handles, OpenCL always
> imports handles)
> - Possible flags: READ, WRITE, READ+WRITE
> - OpenCL doesn't give us any other flags, so we are stuck with those.
> - Inter-device sharing is possible if the consumer understands the
> producer's metadata and tiling layouts.
>
> (amdgpu actually stores 2 different metadata blocks per allocation,
> but the simpler one is too limited and has only 8 bytes)
>
> Marek
>
>
> On Wed, Oct 5, 2016 at 1:47 AM, James Jones  wrote:
>> Hello everyone,
>>
>> As many are aware, we took up the issue of surface/memory allocation at XDC
>> this year.  The outcome of that discussion was the beginnings of a design
>> proposal for a library that would server as a cross-device, cross-process
>> surface allocator.  In the past week I've started to condense some of my
>> notes from that discussion down to code & a design document.  I've posted
>> the first pieces to a github repository 

[Intel-gfx] [PATCH 04/10] dim: autodetect remotes, first part for dim_setup

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Ville Syrjälä  wrote:
> On Tue, Oct 18, 2016 at 04:27:05PM +0300, Jani Nikula wrote:
>> On Tue, 18 Oct 2016, Daniel Vetter  wrote:
>> > The goals here are multiple:
>> > - simpler configuration through autodetection
>> > - allows seamless upgrading to git worktree for the aux checkouts
>> > - eventually I want to split up drm-misc into a separate remote ...
>> >
>> > And yes this is just a start.
>> >
>> > v2: Print errors to stderr, otherwise they can't be seen when directly
>> > assigning the result of get_remote_name to a variable.
>> >
>> > Signed-off-by: Daniel Vetter 
>> > ---
>> >  dim | 112 
>> > +++-
>> >  1 file changed, 58 insertions(+), 54 deletions(-)
>> >
>> > diff --git a/dim b/dim
>> > index 2601bb7dbbad..90eb553c6575 100755
>> > --- a/dim
>> > +++ b/dim
>> > @@ -192,6 +192,24 @@ if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
>> >  dim_uptodate
>> >  fi
>> >  
>> > +function get_remote_name
>> > +{
>> > +  local remote_url=$1
>> > +
>> > +  local remote=`git remote -v | grep $remote_url | \
>> > +  head -n1 | sed -e 's/^\(.*\)\t.*/\1/'`
>> 
>> 'cut -f 1' seems cleaner than the sed.
>
> Or just replace the lot with awk?

Then I'd have to refresh my awk-fu, but awk is not trendy anymore...

J.


>
>> 
>> > +
>> > +  if [[ $remote == "" ]] ; then
>> 
>> I'd prefer
>> 
>>  if [[ -z "$remote" ]]; then
>> 
>> > +  echoerr No git remote for $remote_url found in `pwd`.
>> > +  echoerr Please set it up using
>> > +  echoerr $ git remote add '' $remote_url
>> > +  echoerr with a name of your choice.
>> 
>> I'm fond of wrapping the strings in double quotes. Gives me nicer
>> highlighting in the editor. ;)
>> 
>> Otherwise seems nice.
>> 
>> BR,
>> Jani.
>> 
>> > +  exit 1
>> > +  fi
>> > +
>> > +  echo $remote
>> > +}
>> > +
>> >  # get message id from file
>> >  # $1 = file
>> >  message_get_id ()
>> > @@ -1044,8 +1062,36 @@ function dim_update_branches
>> >update_rerere_cache
>> >  }
>> >  
>> > +function setup_aux_checkout # name remote
>> > +{
>> > +  local name=$1
>> > +  local remote_url=$2
>> > +  local dir=$3
>> > +  local remote
>> > +
>> > +  echo "Setting up $dir ..."
>> > +
>> > +  if [ ! -d $dir ]; then
>> > +  git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
>> > $remote_url $dir
>> > +  cd $dir
>> > +  git config remote.origin.url $remote_url
>> > +  echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
>> > .git/objects/info/alternates
>> > +  git repack -a -d -l
>> > +  remote=origin
>> > +  else
>> > +  cd $dir
>> > +  remote=`get_remote_name $drm_intel_ssh`
>> > +  fi
>> > +  if ! git branch | grep $name > /dev/null ; then
>> > +  git checkout -t $remote/$name
>> > +  fi
>> > +  cd ..
>> > +}
>> > +
>> >  function dim_setup
>> >  {
>> > +  local remote
>> > +
>> >if [ ! -d $DIM_PREFIX ]; then
>> >echo "please set up your repository directory with:"
>> >echo "mkdir -p $DIM_PREFIX"
>> > @@ -1062,76 +1108,34 @@ function dim_setup
>> >exit 1
>> >fi
>> >cd $DIM_DRM_INTEL
>> > -  if ! git remote -v | grep "^origin[[:space:]]" | grep 
>> > $linux_upstream_git > /dev/null; then
>> > -  echo "please set up remote origin for $linux_upstream_git"
>> > -  exit 1
>> > -  fi
>> > -  if ! git remote -v | grep "^$DIM_DRM_INTEL_REMOTE[[:space:]]" | grep 
>> > $drm_intel_ssh > /dev/null; then
>> > -  echo "please set up remote $DIM_DRM_INTEL_REMOTE for 
>> > $drm_intel_ssh with:"
>> > -  echo "git remote add $DIM_DRM_INTEL_REMOTE $drm_intel_ssh"
>> > -  echo "or update your configuration."
>> > -  exit 1
>> > -  fi
>> > -  if ! git remote -v | grep "^$DIM_DRM_UPSTREAM_REMOTE[[:space:]]" | grep 
>> > $drm_upstream_git > /dev/null; then
>> > -  echo "please set up remote $DIM_DRM_UPSTREAM_REMOTE for 
>> > $drm_upstream_git with:"
>> > -  echo "git remote add $DIM_DRM_UPSTREAM_REMOTE 
>> > $drm_upstream_git"
>> > -  echo "or update your configuration."
>> > -  exit 1
>> > -  fi
>> > -  cd ..
>> >  
>> > -  echo "Setting up maintainer-tools ..."
>> > -  if [ ! -d maintainer-tools ]; then
>> > -  git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
>> > $drm_intel_ssh maintainer-tools
>> > -  fi
>> > -  cd maintainer-tools
>> > -  git config remote.origin.url $drm_intel_ssh
>> > -  echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
>> > .git/objects/info/alternates
>> > -  git repack -a -d -l
>> > -  if ! git branch | grep maintainer-tools > /dev/null ; then
>> > -  git checkout -t origin/maintainer-tools
>> > -  fi
>> > -  cd ..
>> > +  # check remote configuration
>> > +  remote=`get_remote_name $linux_upstream_git`
>> > +  remote=`get_remote_name $drm_intel_ssh`
>> > +  remote=`get_remote_name $drm_upstream_git`
>> >  
>> 

[PATCH 02/10] dim: Autocheck for up-to-dateness

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> On Tue, Oct 18, 2016 at 04:15:01PM +0300, Jani Nikula wrote:
>> On Tue, 18 Oct 2016, Daniel Vetter  wrote:
>> > Exits script to annoy people roughly every 100th time ...
>> 
>> Annoyingly random, but we can improve this later.
>
> I had it non-random, then realized it makes improving dim impossible ;-)

I thought about just warning on every Nth day $((`date +%j` % N)) == 0,
and not exiting the script. Warning every time is annoying because it
talks to the network.

BR,
Jani.

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH] i915: don't call drm_atomic_state_put on invalid pointer

2016-10-18 Thread Chris Wilson
On Tue, Oct 18, 2016 at 05:16:23PM +0200, Arnd Bergmann wrote:
> The introduction of reference counting on the state structures caused
> sanitize_watermarks() in i915 to break in the error handling case,
> as pointed out by gcc -Wmaybe-uninitialized
> 
> drivers/gpu/drm/i915/intel_display.c: In function ‘intel_modeset_init’:
> include/drm/drm_atomic.h:224:2: error: ‘state’ may be used uninitialized 
> in this function [-Werror=maybe-uninitialized]
> 
> This changes the function back to only drop the reference count
> when it was successfully allocated first.
> 
> Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
> Cc: Chris Wilson 
> Cc: Daniel Vetter 
> Signed-off-by: Arnd Bergmann 

Yup, missed that it jumps to fail before allocating state.

Function still looks a bit odd, but nvm
Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[Intel-gfx] [PATCH 07/10] dim: autodetect branches in rebuild-nightly

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> Needs new url-mapping information in nightly.conf to work properly.

I think in the long run the right fix would be to make nightly.conf
independent of remote names. Not sure if that's worth the trouble at
this point.

BR,
Jani.



>
> Signed-off-by: Daniel Vetter 
> ---
>  dim | 48 
>  1 file changed, 36 insertions(+), 12 deletions(-)
>
> diff --git a/dim b/dim
> index 48d5e7b6477a..f9b28d5fd241 100755
> --- a/dim
> +++ b/dim
> @@ -235,20 +235,30 @@ function dim_commit_add_tag
>   done
>  }
>  
> +function map_nightly_remote
> +{
> + local nightly_remote=$1
> + local remote_url=`eval echo 
> "\\\$nightly_remote_url_${nightly_remote/-/_}"`
> +
> + get_remote_name $remote_url
> +}
> +
>  function update_linux_next
>  {
>   cd $DIM_PREFIX/drm-intel-nightly
>  
> + local nightly_origin=`map_nightly_remote origin`
> +
>   # always update drm-intel-fixes
>   echo -n "Pushing drm-intel-fixes to for-linux-next-fixes... "
> - git push $DRY_RUN origin +origin/drm-intel-fixes:for-linux-next-fixes 
> >& /dev/null
> + git push $DRY_RUN $nightly_origin 
> +$nightly_origin/drm-intel-fixes:for-linux-next-fixes >& /dev/null
>   echo "Done."
>  
> - if git merge-base --is-ancestor origin/drm-intel-next-fixes 
> origin/drm-intel-fixes ; then
> + if git merge-base --is-ancestor $nightly_origin/drm-intel-next-fixes 
> $nightly_origin/drm-intel-fixes ; then
>   # -fixes has caught up to dinf, i.e. we're out of the merge
>   # window. Push the next queue.
>   echo -n "Out of merge window. Pushing drm-intel-next-queued to 
> for-linux-next... "
> - git push $DRY_RUN origin 
> +origin/drm-intel-next-queued:for-linux-next >& /dev/null
> + git push $DRY_RUN $nightly_origin 
> +$nightly_origin/drm-intel-next-queued:for-linux-next >& /dev/null
>   echo "Done."
>   else
>   # dinf is ahead of -fixes, i.e. drm-next has already closed for
> @@ -256,7 +266,7 @@ function update_linux_next
>   # for the current -next cycle. Push dinf
>  
>   echo -n "Pushing drm-intel-next-fixes to for-linux-next... "
> - git push $DRY_RUN origin 
> +origin/drm-intel-next-fixes:for-linux-next >& /dev/null
> + git push $DRY_RUN $nightly_origin 
> +$nightly_origin/drm-intel-next-fixes:for-linux-next >& /dev/null
>   echo "Done."
>   fi
>  }
> @@ -272,11 +282,20 @@ function check_conflicts
>   true
>  }
>  
> +function rr_cache_dir
> +{
> + if [ -d $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ ] ; then
> + echo $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/
> + else
> + echo $DIM_PREFIX/$DIM_DRM_INTEL/.git/rr-cache/
> + fi
> +}
> +
>  function update_rerere_cache
>  {
>   cd $DIM_PREFIX/drm-intel-rerere/
>   git pull
> - cp rr-cache/* $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ -r
> + cp rr-cache/* `rr_cache-dir` -r
>   cd -
>  }
>  
> @@ -307,9 +326,10 @@ function dim_rebuild_nightly
>   fi
>  
>   for remote in $(echo $nightly_branches | tr " " "\n" | sed 's|/.*$||g' 
> | sort -u); do
> - echo -n "Fetching $remote... "
> + local nightly_remote=`map_nightly_remote $remote`
> + echo -n "Fetching $remote (as $nightly_remote) ... "
>   # git fetch returns 128 if there's nothing to be fetched
> - git fetch $remote >& /dev/null || true
> + git fetch $nightly_remote >& /dev/null || true
>   echo "Done."
>   done
>  
> @@ -329,12 +349,14 @@ function dim_rebuild_nightly
>   if [[ -n $sha1 ]] ; then
>   echo -n "Using override sha1: $sha1... "
>   else
> - sha1=$branch
> + local remote=${branch%%/*}
> + local nightly_remote=`map_nightly_remote $remote`
> + sha1=`echo $branch | sed -e s/^$remote/$nightly_remote/`
>   fi
>  
>   if [ $first == 1 ] ; then
> + git reset --hard $sha1 &> /dev/null
>   echo "Reset. Done."
> - git reset --hard $sha1 >& /dev/null
>   first=0
>   elif git merge --rerere-autoupdate --ff-only $sha1 >& /dev/null 
> ; then
>   # nothing to do if just fast-forward
> @@ -370,14 +392,16 @@ function dim_rebuild_nightly
>   git commit --quiet -m "$integration_branch: $time integration manifest"
>   echo "Done."
>  
> + local nightly_origin=`map_nightly_remote origin`
> +
>   echo -n "Pushing $integration_branch... "
> - git push $DRY_RUN origin +HEAD >& /dev/null && echo "Done."
> + git push $DRY_RUN $nightly_origin +HEAD >& /dev/null && echo "Done."
>  
>   echo -n "Updating rerere cache... "
>   cd $rerere
>   if git 

[PATCH v2] drm/imx: ipuv3-plane: Access old u/vbo properly in ->atomic_check for YU12/YV12

2016-10-18 Thread Liu Ying
Before accessing the u/v offset(aka, u/vbo for IPUv3) of the old plane state's
relevant fb, we should make sure the fb is in YU12 or YV12 pixel format(which
are the two YUV pixel formats we support only), otherwise, we are likely to
trigger BUG_ON() in drm_plane_state_to_u/vbo() since the fb's pixel format is
probably not YU12 or YV12.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=98150
Fixes: c6c1f9bc798b ("drm/imx: Add active plane reconfiguration support")
Cc: stable at vger.kernel.org # 4.8
Signed-off-by: Liu Ying 
---
v1->v2:
* Correct the condition under which we may access old u/vbo - old->pixel_format
  is not necessarily the same to fb->pixel_format, instead, it could be YU12
  or YV12.  This may cover the case in which we switch fb pixel format
  bewteen YU12 and YV12.

 drivers/gpu/drm/imx/ipuv3-plane.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c
index e33110e..08d0fd5 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -359,7 +359,9 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
if ((ubo > 0xf8) || (vbo > 0xf8))
return -EINVAL;

-   if (old_fb) {
+   if (old_fb &&
+   (old_fb->pixel_format == DRM_FORMAT_YUV420 ||
+old_fb->pixel_format == DRM_FORMAT_YVU420)) {
old_ubo = drm_plane_state_to_ubo(old_state);
old_vbo = drm_plane_state_to_vbo(old_state);
if (ubo != old_ubo || vbo != old_vbo)
-- 
2.7.4



[Bug 178281] wine-staging apps freezes the machine with RX460

2016-10-18 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=178281

--- Comment #2 from fin4478 at hotmail.com ---
So tell your driver page for non ubuntu users what mesa and kernel works so
that rx460 has best performance, works with wine-staging and gallium nine and
Rosegarden  plays midi and sw synth tracks. I have now 2 days searching and
testing and not found. After 4.7.8 Rosegarden does not work and before that
rx460 performance is bad. My current amd-staging-4.7 have sudden panics boot
and next I try drm-next-4.10 where Rosegarden do not work but I will see how
are the graphics and system stability.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH 06/10] dim: Nuke nightly-forget

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> With our proliferation of branches it's become long useless. Nowadays
> my MO is to revert the offending commit in the rerere-cache branch
> explicitly, remove drm-intel-nightly/.git/rr-cache and then re-run
> rebuild-nightly. That works much better, hence nuke this helper.

Agreed.

Later, we should add a helper to do the better MO.

BR,
Jani.


>
> Signed-off-by: Daniel Vetter 
> ---
>  TODO | 2 --
>  dim  | 9 -
>  2 files changed, 11 deletions(-)
>
> diff --git a/TODO b/TODO
> index ac0f27763dfa..c1c6e20eb0e3 100644
> --- a/TODO
> +++ b/TODO
> @@ -1,8 +1,6 @@
>  dim:
>  - extract the integration tree logic and make it generally useful, maybe for 
> a
>drm-integration tree ...
> -- Improve nightly-forget to forget a specific merge instead of just the first
> -  dinq/dif merge.
>  - add option to check-patch to check stdin
>  - integrate ninja-check? Or too much checkers considered harmful?
>
> https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2014-May/000554.html
> diff --git a/dim b/dim
> index 80baf24e4ad7..48d5e7b6477a 100755
> --- a/dim
> +++ b/dim
> @@ -395,15 +395,6 @@ function dim_rebuild_nightly
>   update_linux_next
>  }
>  
> -function dim_nightly_forget
> -{
> - cd $DIM_PREFIX/drm-intel-nightly
> - git fetch origin >& /dev/null
> - git reset --hard origin/drm-intel-next-queued >& /dev/null
> - git merge origin/drm-intel-fixes
> - git rerere forget
> -}
> -
>  # push branch $1, rebuild nightly. the rest of the arguments are passed to 
> git
>  # push.
>  function dim_push_branch

-- 
Jani Nikula, Intel Open Source Technology Center


[Intel-gfx] [PATCH 05/10] dim: support git worktree for aux checkouts

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> If available by default. This saves quite a pile of disk-space that
> imo making it the default is justified.
>
> Note that this will break the rebuild-nightly script for now,
> follow-up patches will fix that.
>
> Signed-off-by: Daniel Vetter 
> ---
>  dim | 23 ---
>  1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/dim b/dim
> index 90eb553c6575..80baf24e4ad7 100755
> --- a/dim
> +++ b/dim
> @@ -1072,15 +1072,24 @@ function setup_aux_checkout # name remote
>   echo "Setting up $dir ..."
>  
>   if [ ! -d $dir ]; then
> - git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> $remote_url $dir
> - cd $dir
> - git config remote.origin.url $remote_url
> - echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
> .git/objects/info/alternates
> - git repack -a -d -l
> - remote=origin
> + if git help worktree &> /dev/null ; then
> + cd $DIM_PREFIX/$DIM_DRM_INTEL
> + remote=`get_remote_name $remote_url`
> + if ! git branch | grep $name > /dev/null ; then

The failure modes are annoying if there's a substring match for
$name. Unfortunately grep -w is no good if you need to handle "-" too.

> + git branch --track $name $remote/$name
> + fi
> + git worktree add ../$dir $name
> + else
> + git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> $remote_url $dir
> + cd $dir
> + git config remote.origin.url $remote_url
> + echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
> .git/objects/info/alternates
> + git repack -a -d -l
> + remote=origin
> + fi
>   else
>   cd $dir
> - remote=`get_remote_name $drm_intel_ssh`
> + remote=`get_remote_name $remote_url`
>   fi
>   if ! git branch | grep $name > /dev/null ; then
>   git checkout -t $remote/$name

-- 
Jani Nikula, Intel Open Source Technology Center


[v17 2/2] drm/bridge: Add I2C based driver for ps8640 bridge

2016-10-18 Thread Enric Balletbo Serra
Hi Jitao,

2016-08-27 8:44 GMT+02:00 Jitao Shi :
> This patch adds drm_bridge driver for parade DSI to eDP bridge chip.
>
> Signed-off-by: Jitao Shi 
> Reviewed-by: Daniel Kurtz 
> ---
> Changes since v16:
>  - Disable ps8640 DSI MCS Function.
>  - Rename gpios name more clearly.
>  - Tune the ps8640 power on sequence.
>
> Changes since v15:
>  - Drop drm_connector_(un)register calls from parade ps8640.
>The main DRM driver mtk_drm_drv now calls
>drm_connector_register_all() after drm_dev_register() in the
>mtk_drm_bind() function. That function should iterate over all
>connectors and call drm_connector_register() for each of them.
>So, remove drm_connector_(un)register calls from parade ps8640.
>
> Changes since v14:
>  - update copyright info.
>  - change bridge_to_ps8640 and connector_to_ps8640 to inline function.
>  - fix some coding style.
>  - use sizeof as array counter.
>  - use drm_get_edid when read edid.
>  - add mutex when firmware updating.
>
> Changes since v13:
>  - add const on data, ps8640_write_bytes(struct i2c_client *client, const u8 
> *data, u16 data_len)
>  - fix PAGE2_SW_REST tyro.
>  - move the buf[3] init to entrance of the function.
>
> Changes since v12:
>  - fix hw_chip_id build warning
>
> Changes since v11:
>  - Remove depends on I2C, add DRM depends
>  - Reuse ps8640_write_bytes() in ps8640_write_byte()
>  - Use timer check for polling like the routines in 
>  - Fix no drm_connector_unregister/drm_connector_cleanup when 
> ps8640_bridge_attach fail
>  - Check the ps8640 hardware id in ps8640_validate_firmware
>  - Remove fw_version check
>  - Move ps8640_validate_firmware before ps8640_enter_bl
>  - Add ddc_i2c unregister when probe fail and ps8640_remove
> ---
>  drivers/gpu/drm/bridge/Kconfig |   12 +
>  drivers/gpu/drm/bridge/Makefile|1 +
>  drivers/gpu/drm/bridge/parade-ps8640.c | 1077 
> 
>  3 files changed, 1090 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/parade-ps8640.c
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index b590e67..c59d043 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -50,6 +50,18 @@ config DRM_PARADE_PS8622
> ---help---
>   Parade eDP-LVDS bridge chip driver.
>
> +config DRM_PARADE_PS8640
> +   tristate "Parade PS8640 MIPI DSI to eDP Converter"
> +   depends on DRM
> +   depends on OF
> +   select DRM_KMS_HELPER
> +   select DRM_MIPI_DSI
> +   select DRM_PANEL
> +   ---help---
> + Choose this option if you have PS8640 for display
> + The PS8640 is a high-performance and low-power
> + MIPI DSI to eDP converter
> +
>  config DRM_SII902X
> tristate "Silicon Image sii902x RGB/HDMI bridge"
> depends on OF
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index efdb07e..3360537 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -5,6 +5,7 @@ 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_PARADE_PS8640) += parade-ps8640.o
>  obj-$(CONFIG_DRM_SII902X) += sii902x.o
>  obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
>  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
> diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c 
> b/drivers/gpu/drm/bridge/parade-ps8640.c
> new file mode 100644
> index 000..7d67431
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/parade-ps8640.c
> @@ -0,0 +1,1077 @@
> +/*
> + * Copyright (c) 2016 MediaTek Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define PAGE1_VSTART   0x6b
> +#define PAGE2_SPI_CFG3 0x82
> +#define I2C_TO_SPI_RESET   0x20
> +#define PAGE2_ROMADD_BYTE1 0x8e
> +#define PAGE2_ROMADD_BYTE2 0x8f
> +#define PAGE2_SWSPI_WDATA  0x90
> +#define PAGE2_SWSPI_RDATA  0x91
> +#define PAGE2_SWSPI_LEN0x92
> +#define PAGE2_SWSPI_CTL0x93
> +#define TRIGGER_NO_READBACK0x05
> +#define TRIGGER_READBACK   0x01
> +#define PAGE2_SPI_STATUS   0x9e
> +#define SPI_READY  0x0c
> 

[Intel-gfx] [PATCH 04/10] dim: autodetect remotes, first part for dim_setup

2016-10-18 Thread Ville Syrjälä
On Tue, Oct 18, 2016 at 04:27:05PM +0300, Jani Nikula wrote:
> On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> > The goals here are multiple:
> > - simpler configuration through autodetection
> > - allows seamless upgrading to git worktree for the aux checkouts
> > - eventually I want to split up drm-misc into a separate remote ...
> >
> > And yes this is just a start.
> >
> > v2: Print errors to stderr, otherwise they can't be seen when directly
> > assigning the result of get_remote_name to a variable.
> >
> > Signed-off-by: Daniel Vetter 
> > ---
> >  dim | 112 
> > +++-
> >  1 file changed, 58 insertions(+), 54 deletions(-)
> >
> > diff --git a/dim b/dim
> > index 2601bb7dbbad..90eb553c6575 100755
> > --- a/dim
> > +++ b/dim
> > @@ -192,6 +192,24 @@ if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
> >  dim_uptodate
> >  fi
> >  
> > +function get_remote_name
> > +{
> > +   local remote_url=$1
> > +
> > +   local remote=`git remote -v | grep $remote_url | \
> > +   head -n1 | sed -e 's/^\(.*\)\t.*/\1/'`
> 
> 'cut -f 1' seems cleaner than the sed.

Or just replace the lot with awk?

> 
> > +
> > +   if [[ $remote == "" ]] ; then
> 
> I'd prefer
> 
>   if [[ -z "$remote" ]]; then
> 
> > +   echoerr No git remote for $remote_url found in `pwd`.
> > +   echoerr Please set it up using
> > +   echoerr $ git remote add '' $remote_url
> > +   echoerr with a name of your choice.
> 
> I'm fond of wrapping the strings in double quotes. Gives me nicer
> highlighting in the editor. ;)
> 
> Otherwise seems nice.
> 
> BR,
> Jani.
> 
> > +   exit 1
> > +   fi
> > +
> > +   echo $remote
> > +}
> > +
> >  # get message id from file
> >  # $1 = file
> >  message_get_id ()
> > @@ -1044,8 +1062,36 @@ function dim_update_branches
> > update_rerere_cache
> >  }
> >  
> > +function setup_aux_checkout # name remote
> > +{
> > +   local name=$1
> > +   local remote_url=$2
> > +   local dir=$3
> > +   local remote
> > +
> > +   echo "Setting up $dir ..."
> > +
> > +   if [ ! -d $dir ]; then
> > +   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> > $remote_url $dir
> > +   cd $dir
> > +   git config remote.origin.url $remote_url
> > +   echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
> > .git/objects/info/alternates
> > +   git repack -a -d -l
> > +   remote=origin
> > +   else
> > +   cd $dir
> > +   remote=`get_remote_name $drm_intel_ssh`
> > +   fi
> > +   if ! git branch | grep $name > /dev/null ; then
> > +   git checkout -t $remote/$name
> > +   fi
> > +   cd ..
> > +}
> > +
> >  function dim_setup
> >  {
> > +   local remote
> > +
> > if [ ! -d $DIM_PREFIX ]; then
> > echo "please set up your repository directory with:"
> > echo "mkdir -p $DIM_PREFIX"
> > @@ -1062,76 +1108,34 @@ function dim_setup
> > exit 1
> > fi
> > cd $DIM_DRM_INTEL
> > -   if ! git remote -v | grep "^origin[[:space:]]" | grep 
> > $linux_upstream_git > /dev/null; then
> > -   echo "please set up remote origin for $linux_upstream_git"
> > -   exit 1
> > -   fi
> > -   if ! git remote -v | grep "^$DIM_DRM_INTEL_REMOTE[[:space:]]" | grep 
> > $drm_intel_ssh > /dev/null; then
> > -   echo "please set up remote $DIM_DRM_INTEL_REMOTE for 
> > $drm_intel_ssh with:"
> > -   echo "git remote add $DIM_DRM_INTEL_REMOTE $drm_intel_ssh"
> > -   echo "or update your configuration."
> > -   exit 1
> > -   fi
> > -   if ! git remote -v | grep "^$DIM_DRM_UPSTREAM_REMOTE[[:space:]]" | grep 
> > $drm_upstream_git > /dev/null; then
> > -   echo "please set up remote $DIM_DRM_UPSTREAM_REMOTE for 
> > $drm_upstream_git with:"
> > -   echo "git remote add $DIM_DRM_UPSTREAM_REMOTE 
> > $drm_upstream_git"
> > -   echo "or update your configuration."
> > -   exit 1
> > -   fi
> > -   cd ..
> >  
> > -   echo "Setting up maintainer-tools ..."
> > -   if [ ! -d maintainer-tools ]; then
> > -   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> > $drm_intel_ssh maintainer-tools
> > -   fi
> > -   cd maintainer-tools
> > -   git config remote.origin.url $drm_intel_ssh
> > -   echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
> > .git/objects/info/alternates
> > -   git repack -a -d -l
> > -   if ! git branch | grep maintainer-tools > /dev/null ; then
> > -   git checkout -t origin/maintainer-tools
> > -   fi
> > -   cd ..
> > +   # check remote configuration
> > +   remote=`get_remote_name $linux_upstream_git`
> > +   remote=`get_remote_name $drm_intel_ssh`
> > +   remote=`get_remote_name $drm_upstream_git`
> >  
> > -   echo "Setting up drm-intel-rerere ..."
> > -   if [ ! -d drm-intel-rerere ]; then
> > -   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> > $drm_intel_ssh drm-intel-rerere
> > -   

[PATCH] i915: don't call drm_atomic_state_put on invalid pointer

2016-10-18 Thread Eric Engestrom
On Tuesday, 2016-10-18 17:16:23 +0200, Arnd Bergmann wrote:
> The introduction of reference counting on the state structures caused
> sanitize_watermarks() in i915 to break in the error handling case,
> as pointed out by gcc -Wmaybe-uninitialized
> 
> drivers/gpu/drm/i915/intel_display.c: In function ‘intel_modeset_init’:
> include/drm/drm_atomic.h:224:2: error: ‘state’ may be used uninitialized 
> in this function [-Werror=maybe-uninitialized]
> 
> This changes the function back to only drop the reference count
> when it was successfully allocated first.
> 
> Fixes: 0853695c3ba4 ("drm: Add reference counting to drm_atomic_state")
> Cc: Chris Wilson 
> Cc: Daniel Vetter 
> Signed-off-by: Arnd Bergmann 

Reviewed-by: Eric Engestrom 

> ---
>  drivers/gpu/drm/i915/intel_display.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 6d168685bbda..6a26da143aa6 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -16314,7 +16314,7 @@ static void sanitize_watermarks(struct drm_device 
> *dev)
>* BIOS-programmed watermarks untouched and hope for the best.
>*/
>   WARN(true, "Could not determine valid watermarks for inherited 
> state\n");
> - goto fail;
> + goto put_state;
>   }
>  
>   /* Write calculated watermark values back */
> @@ -16325,8 +16325,9 @@ static void sanitize_watermarks(struct drm_device 
> *dev)
>   dev_priv->display.optimize_watermarks(cs);
>   }
>  
> -fail:
> +put_state:
>   drm_atomic_state_put(state);
> +fail:
>   drm_modeset_drop_locks();
>   drm_modeset_acquire_fini();
>  }
> -- 
> 2.9.0


[Intel-gfx] [PATCH 04/10] dim: autodetect remotes, first part for dim_setup

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> The goals here are multiple:
> - simpler configuration through autodetection
> - allows seamless upgrading to git worktree for the aux checkouts
> - eventually I want to split up drm-misc into a separate remote ...
>
> And yes this is just a start.
>
> v2: Print errors to stderr, otherwise they can't be seen when directly
> assigning the result of get_remote_name to a variable.
>
> Signed-off-by: Daniel Vetter 
> ---
>  dim | 112 
> +++-
>  1 file changed, 58 insertions(+), 54 deletions(-)
>
> diff --git a/dim b/dim
> index 2601bb7dbbad..90eb553c6575 100755
> --- a/dim
> +++ b/dim
> @@ -192,6 +192,24 @@ if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
>  dim_uptodate
>  fi
>  
> +function get_remote_name
> +{
> + local remote_url=$1
> +
> + local remote=`git remote -v | grep $remote_url | \
> + head -n1 | sed -e 's/^\(.*\)\t.*/\1/'`

'cut -f 1' seems cleaner than the sed.

> +
> + if [[ $remote == "" ]] ; then

I'd prefer

if [[ -z "$remote" ]]; then

> + echoerr No git remote for $remote_url found in `pwd`.
> + echoerr Please set it up using
> + echoerr $ git remote add '' $remote_url
> + echoerr with a name of your choice.

I'm fond of wrapping the strings in double quotes. Gives me nicer
highlighting in the editor. ;)

Otherwise seems nice.

BR,
Jani.

> + exit 1
> + fi
> +
> + echo $remote
> +}
> +
>  # get message id from file
>  # $1 = file
>  message_get_id ()
> @@ -1044,8 +1062,36 @@ function dim_update_branches
>   update_rerere_cache
>  }
>  
> +function setup_aux_checkout # name remote
> +{
> + local name=$1
> + local remote_url=$2
> + local dir=$3
> + local remote
> +
> + echo "Setting up $dir ..."
> +
> + if [ ! -d $dir ]; then
> + git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> $remote_url $dir
> + cd $dir
> + git config remote.origin.url $remote_url
> + echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
> .git/objects/info/alternates
> + git repack -a -d -l
> + remote=origin
> + else
> + cd $dir
> + remote=`get_remote_name $drm_intel_ssh`
> + fi
> + if ! git branch | grep $name > /dev/null ; then
> + git checkout -t $remote/$name
> + fi
> + cd ..
> +}
> +
>  function dim_setup
>  {
> + local remote
> +
>   if [ ! -d $DIM_PREFIX ]; then
>   echo "please set up your repository directory with:"
>   echo "mkdir -p $DIM_PREFIX"
> @@ -1062,76 +1108,34 @@ function dim_setup
>   exit 1
>   fi
>   cd $DIM_DRM_INTEL
> - if ! git remote -v | grep "^origin[[:space:]]" | grep 
> $linux_upstream_git > /dev/null; then
> - echo "please set up remote origin for $linux_upstream_git"
> - exit 1
> - fi
> - if ! git remote -v | grep "^$DIM_DRM_INTEL_REMOTE[[:space:]]" | grep 
> $drm_intel_ssh > /dev/null; then
> - echo "please set up remote $DIM_DRM_INTEL_REMOTE for 
> $drm_intel_ssh with:"
> - echo "git remote add $DIM_DRM_INTEL_REMOTE $drm_intel_ssh"
> - echo "or update your configuration."
> - exit 1
> - fi
> - if ! git remote -v | grep "^$DIM_DRM_UPSTREAM_REMOTE[[:space:]]" | grep 
> $drm_upstream_git > /dev/null; then
> - echo "please set up remote $DIM_DRM_UPSTREAM_REMOTE for 
> $drm_upstream_git with:"
> - echo "git remote add $DIM_DRM_UPSTREAM_REMOTE 
> $drm_upstream_git"
> - echo "or update your configuration."
> - exit 1
> - fi
> - cd ..
>  
> - echo "Setting up maintainer-tools ..."
> - if [ ! -d maintainer-tools ]; then
> - git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> $drm_intel_ssh maintainer-tools
> - fi
> - cd maintainer-tools
> - git config remote.origin.url $drm_intel_ssh
> - echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
> .git/objects/info/alternates
> - git repack -a -d -l
> - if ! git branch | grep maintainer-tools > /dev/null ; then
> - git checkout -t origin/maintainer-tools
> - fi
> - cd ..
> + # check remote configuration
> + remote=`get_remote_name $linux_upstream_git`
> + remote=`get_remote_name $drm_intel_ssh`
> + remote=`get_remote_name $drm_upstream_git`
>  
> - echo "Setting up drm-intel-rerere ..."
> - if [ ! -d drm-intel-rerere ]; then
> - git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
> $drm_intel_ssh drm-intel-rerere
> - fi
> - cd drm-intel-rerere
> - git config remote.origin.url $drm_intel_ssh
> - echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
> .git/objects/info/alternates
> - git repack -a -d -l
> - if ! git branch | grep rerere-cache > 

[PATCH v2] drm/mediatek: fix a typo

2016-10-18 Thread Bibby Hsieh
If we want to set the hardware OD to relay mode,
we have to set OD_CFG register rather than
OD_RELAYMODE; otherwise, the system will access
the wrong address.

Fixes: 7216436420414144646f5d8343d061355fd23483 ("drm/mediatek: set mt8173 
dithering function")
Cc: stable at vger.kernel.org # v4.9+
Signed-off-by: Bibby Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index df33b3c..aa5f20f 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -123,7 +123,7 @@ static void mtk_od_config(struct mtk_ddp_comp *comp, 
unsigned int w,
  unsigned int bpc)
 {
writel(w << 16 | h, comp->regs + DISP_OD_SIZE);
-   writel(OD_RELAYMODE, comp->regs + OD_RELAYMODE);
+   writel(OD_RELAYMODE, comp->regs + OD_CFG);
mtk_dither_set(comp, bpc, DISP_OD_CFG);
 }

-- 
1.7.9.5



[PATCH 02/10] dim: Autocheck for up-to-dateness

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> Exits script to annoy people roughly every 100th time ...

Annoyingly random, but we can improve this later.

LGTM.

> Also switch to the magic @{upstream} reference, in case the remote is
> not called origin (which is pretty normal in case of using git
> worktree).
>
> Signed-off-by: Daniel Vetter 
> ---
>  dim | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/dim b/dim
> index 57ad4fcf9767..192d6ee10838 100755
> --- a/dim
> +++ b/dim
> @@ -176,13 +176,17 @@ function dim_uptodate
>   exit 1
>   fi
>  
> - if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show 
> origin/maintainer-tools:dim |\
> + if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show 
> @{upstream}:dim |\
>   diff "$using" - >& /dev/null; then
>   echo "$dim: not running upstream version of the script." >&2
>   exit 1
>   fi
>  }
>  
> +if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
> +dim_uptodate
> +fi
> +
>  # get message id from file
>  # $1 = file
>  message_get_id ()

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH v5 13/13] drm: Don't export the drm_fb_get_bpp_depth() function

2016-10-18 Thread Eric Engestrom
On Tuesday, 2016-10-18 01:41:21 +0300, Laurent Pinchart wrote:
> The function is only used by the drm_helper_mode_fill_fb_struct() core
> function to fill the drm_framebuffer bpp and depth fields, used by
> drivers that haven't been converted to use pixel formats directly yet.
> It should not be used by new drivers, so inline it in its only caller.
> 
> Signed-off-by: Laurent Pinchart 
> Reviewed-by: Tomi Valkeinen 

Reviewed-by: Eric Engestrom 

> ---
>  drivers/gpu/drm/drm_fourcc.c | 31 ---
>  drivers/gpu/drm/drm_modeset_helper.c | 17 +++--
>  include/drm/drm_fourcc.h |  1 -
>  3 files changed, 15 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index 523ed916a1c0..cbb8b77c363c 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -203,37 +203,6 @@ const struct drm_format_info *drm_format_info(u32 format)
>  EXPORT_SYMBOL(drm_format_info);
>  
>  /**
> - * drm_fb_get_bpp_depth - get the bpp/depth values for format
> - * @format: pixel format (DRM_FORMAT_*)
> - * @depth: storage for the depth value
> - * @bpp: storage for the bpp value
> - *
> - * This only supports RGB formats here for compat with code that doesn't use
> - * pixel formats directly yet.
> - */
> -void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
> -   int *bpp)
> -{
> - const struct drm_format_info *info;
> -
> - info = drm_format_info(format);
> - if (!info || !info->depth) {
> - char *format_name = drm_get_format_name(format);
> -
> - DRM_DEBUG_KMS("unsupported pixel format %s\n", format_name);
> - kfree(format_name);
> -
> - *depth = 0;
> - *bpp = 0;
> - return;
> - }
> -
> - *depth = info->depth;
> - *bpp = info->cpp[0] * 8;
> -}
> -EXPORT_SYMBOL(drm_fb_get_bpp_depth);
> -
> -/**
>   * drm_format_num_planes - get the number of planes for format
>   * @format: pixel format (DRM_FORMAT_*)
>   *
> diff --git a/drivers/gpu/drm/drm_modeset_helper.c 
> b/drivers/gpu/drm/drm_modeset_helper.c
> index 1d45738f8f98..2544dfe7354c 100644
> --- a/drivers/gpu/drm/drm_modeset_helper.c
> +++ b/drivers/gpu/drm/drm_modeset_helper.c
> @@ -70,8 +70,23 @@ EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head);
>  void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
>   const struct drm_mode_fb_cmd2 *mode_cmd)
>  {
> + const struct drm_format_info *info;
>   int i;
>  
> + info = drm_format_info(mode_cmd->pixel_format);
> + if (!info || !info->depth) {
> + char *format_name = drm_get_format_name(mode_cmd->pixel_format);
> +
> + DRM_DEBUG_KMS("non-RGB pixel format %s\n", format_name);
> + kfree(format_name);
> +
> + fb->depth = 0;
> + fb->bits_per_pixel = 0;
> + } else {
> + fb->depth = info->depth;
> + fb->bits_per_pixel = info->cpp[0] * 8;
> + }
> +
>   fb->width = mode_cmd->width;
>   fb->height = mode_cmd->height;
>   for (i = 0; i < 4; i++) {
> @@ -79,8 +94,6 @@ void drm_helper_mode_fill_fb_struct(struct drm_framebuffer 
> *fb,
>   fb->offsets[i] = mode_cmd->offsets[i];
>   fb->modifier[i] = mode_cmd->modifier[i];
>   }
> - drm_fb_get_bpp_depth(mode_cmd->pixel_format, >depth,
> - >bits_per_pixel);
>   fb->pixel_format = mode_cmd->pixel_format;
>   fb->flags = mode_cmd->flags;
>  }
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index f73f97afd1e2..dc0aafab9ffd 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -48,7 +48,6 @@ struct drm_format_info {
>  const struct drm_format_info *__drm_format_info(u32 format);
>  const struct drm_format_info *drm_format_info(u32 format);
>  uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
> -void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp);
>  int drm_format_num_planes(uint32_t format);
>  int drm_format_plane_cpp(uint32_t format, int plane);
>  int drm_format_horz_chroma_subsampling(uint32_t format);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 04/13] drm: WARN when calling drm_format_info() for an unsupported format

2016-10-18 Thread Eric Engestrom
On Tuesday, 2016-10-18 01:41:12 +0300, Laurent Pinchart wrote:
> The format helpers have historically treated unsupported formats as part
> of the default case, returning values that are likely wrong. We can't
> change this behaviour now without risking breaking drivers in difficult
> to detect ways, but we can WARN on unsupported formats to catch faulty
> callers.
> 
> The only exception is the framebuffer_check() function that calls
> drm_format_info() to validate the format passed from userspace. This is
> a valid use case that shouldn't generate a warning.
> 
> Signed-off-by: Laurent Pinchart 
> Reviewed-by: Tomi Valkeinen 

Reviewed-by: Eric Engestrom 

> ---
>  drivers/gpu/drm/drm_fourcc.c  | 32 
>  drivers/gpu/drm/drm_framebuffer.c |  2 +-
>  include/drm/drm_fourcc.h  |  1 +
>  3 files changed, 26 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index 23d4b82ec17c..523ed916a1c0 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -102,15 +102,11 @@ char *drm_get_format_name(uint32_t format)
>  }
>  EXPORT_SYMBOL(drm_get_format_name);
>  
> -/**
> - * drm_format_info - query information for a given format
> - * @format: pixel format (DRM_FORMAT_*)
> - *
> - * Returns:
> - * The instance of struct drm_format_info that describes the pixel format, or
> - * NULL if the format is unsupported.
> +/*
> + * Internal function to query information for a given format. See
> + * drm_format_info() for the public API.
>   */
> -const struct drm_format_info *drm_format_info(u32 format)
> +const struct drm_format_info *__drm_format_info(u32 format)
>  {
>   static const struct drm_format_info formats[] = {
>   { .format = DRM_FORMAT_C8,  .depth = 8,  
> .num_planes = 1, .cpp = { 1, 0, 0 }, .hsub = 1, .vsub = 1 },
> @@ -184,6 +180,26 @@ const struct drm_format_info *drm_format_info(u32 format)
>  
>   return NULL;
>  }
> +
> +/**
> + * drm_format_info - query information for a given format
> + * @format: pixel format (DRM_FORMAT_*)
> + *
> + * The caller should only pass a supported pixel format to this function.
> + * Unsupported pixel formats will generate a warning in the kernel log.
> + *
> + * Returns:
> + * The instance of struct drm_format_info that describes the pixel format, or
> + * NULL if the format is unsupported.
> + */
> +const struct drm_format_info *drm_format_info(u32 format)
> +{
> + const struct drm_format_info *info;
> +
> + info = __drm_format_info(format);
> + WARN_ON(!info);
> + return info;
> +}
>  EXPORT_SYMBOL(drm_format_info);
>  
>  /**
> diff --git a/drivers/gpu/drm/drm_framebuffer.c 
> b/drivers/gpu/drm/drm_framebuffer.c
> index 386977df72ce..49fd7db758e0 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -131,7 +131,7 @@ static int framebuffer_check(const struct 
> drm_mode_fb_cmd2 *r)
>   const struct drm_format_info *info;
>   int i;
>  
> - info = drm_format_info(r->pixel_format & ~DRM_FORMAT_BIG_ENDIAN);
> + info = __drm_format_info(r->pixel_format & ~DRM_FORMAT_BIG_ENDIAN);
>   if (!info) {
>   char *format_name = drm_get_format_name(r->pixel_format);
>   DRM_DEBUG_KMS("bad framebuffer format %s\n", format_name);
> diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
> index 135fef050ee6..f73f97afd1e2 100644
> --- a/include/drm/drm_fourcc.h
> +++ b/include/drm/drm_fourcc.h
> @@ -45,6 +45,7 @@ struct drm_format_info {
>   u8 vsub;
>  };
>  
> +const struct drm_format_info *__drm_format_info(u32 format);
>  const struct drm_format_info *drm_format_info(u32 format);
>  uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
>  void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, int *bpp);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Intel-gfx] [PATCH 01/10] dim: Extract TODO

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> Just maybe a bit more visibility, the scripts are growing.
>
> Signed-off-by: Daniel Vetter 

LGTM

> ---
>  TODO | 27 +++
>  dim  | 17 -
>  qf   | 11 ---
>  3 files changed, 27 insertions(+), 28 deletions(-)
>  create mode 100644 TODO
>
> diff --git a/TODO b/TODO
> new file mode 100644
> index ..ac0f27763dfa
> --- /dev/null
> +++ b/TODO
> @@ -0,0 +1,27 @@
> +dim:
> +- extract the integration tree logic and make it generally useful, maybe for 
> a
> +  drm-integration tree ...
> +- Improve nightly-forget to forget a specific merge instead of just the first
> +  dinq/dif merge.
> +- add option to check-patch to check stdin
> +- integrate ninja-check? Or too much checkers considered harmful?
> +  
> https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2014-May/000554.html
> +- add patchwork Link: also after manually resolving conflicts in drm
> +  apply-resolved
> +- pull in dim extract-tags tool from Ville
> +- allow dim rebuild-nightly to pull branches from local trees in dry-run 
> mode.
> +  This is useful to confirm a backmerge is indeed correct, by comparing the
> +  resulting -nightly with the old one. Current the branch must be pushed out
> +  first for rebuild-nightly to pick it up, which means the merge can't be
> +  fixed any more.
> +
> +qf:
> +- get better at preventing and cleaning up a mess when switching branches
> +  while there's still applied quilt patches around ...
> +- combine quilt annotate and git blame into one tool
> +- use the index a bit more to e.g. stage all applied quilt patches, then use
> +  the output of git diff to refresh a quilt patch
> +- use git commit-tree and git write-tree in the setup code instead of the
> +  current high-level hacks
> +- track/restore the topmost patch maybe?
> +- synchronize quilt notes in qf push and qf fetch
> diff --git a/dim b/dim
> index 5fb3a0fee7ff..57ad4fcf9767 100755
> --- a/dim
> +++ b/dim
> @@ -27,23 +27,6 @@
>  
>  # drm-intel-next maintainer script
>  
> -# TODO
> -# - extract the integration tree logic and make it generally useful, maybe 
> for a
> -#   drm-integration tree ...
> -# - Improve nightly-forget to forget a specific merge instead of just the 
> first
> -#   dinq/dif merge.
> -# - add option to check-patch to check stdin
> -# - integrate ninja-check? Or too much checkers considered harmful?
> -#   
> https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2014-May/000554.html
> -# - add patchwork Link: also after manually resolving conflicts in drm
> -#   apply-resolved
> -# - pull in dim extract-tags tool from Ville
> -# - allow dim rebuild-nightly to pull branches from local trees in dry-run 
> mode.
> -#   This is useful to confirm a backmerge is indeed correct, by comparing the
> -#   resulting -nightly with the old one. Current the branch must be pushed 
> out
> -#   first for rebuild-nightly to pick it up, which means the merge can't be
> -#   fixed any more.
> -
>  # fail on any goof-up
>  set -e
>  
> diff --git a/qf b/qf
> index 4e9cb03f31fe..31b9f3bae0a2 100755
> --- a/qf
> +++ b/qf
> @@ -26,17 +26,6 @@
>  
>  # quilt git flow script
>  
> -# TODO
> -# - get better at preventing and cleaning up a mess when switching branches
> -# while there's still applied quilt patches around ...
> -# - combine quilt annotate and git blame into one tool
> -# - use the index a bit more to e.g. stage all applied quilt patches, then 
> use
> -# the output of git diff to refresh a quilt patch
> -# - use git commit-tree and git write-tree in the setup code instead of the
> -# current high-level hacks
> -# - track/restore the topmost patch maybe?
> -# - synchronize quilt notes in qf push and qf fetch
> -
>  # config
>  QUILT_PREFIX=quilt/

-- 
Jani Nikula, Intel Open Source Technology Center


4.8-rc1: it is now common that machine needs re-run of xrandr after resume

2016-10-18 Thread Pavel Machek
Hi!

On Wed 2016-09-14 14:14:35, Jani Nikula wrote:
> On Wed, 14 Sep 2016, Jani Nikula  wrote:
> > On Wed, 14 Sep 2016, Pavel Machek  wrote:
> >> For the "sometimes need xrandr after resume": I don't think I can
> >> bisect that. It only happens sometimes :-(. But there's something
> >> helpful in the logs:
> >
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] [drm:drm_edid_block_valid] *ERROR* EDID checksum is
> >> invalid, remainder is 130
> >> [ 1856.218863] Raw EDID:
> >> [ 1856.218863] 00 ff ff ff ff ff ff 00 ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> >> [ 1856.218863] i915 :00:02.0: HDMI-A-1: EDID block 0 invalid.
> >
> > Pavel, Martin, do you always see this when the display fails to resume?
> > Is it HDMI/DVI for both of you?
> 
> Please try this patch, backported from our next.

Sorry, spam filter hidden your emails.

I believe I still see the issue on v4.9-rc1. ... does it still make
sense to retry the patch?

What I also is re-aranged windows. So I get resume, I get both
monitors, but I also see that X windows lost connection with the big
monitor (and re-arranged my windows for me).

Oh and I guess I should mention:

1) Yes, I only see the issue on the DVI output. VGA seems to work.

2) I do have power switch on the monitors, so it is possible that
during resume, monitors have no AC power. (Not merely turned off by
the soft switch. No AC power.)

Thanks,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20161018/b5f0bbda/attachment.sig>


[PATCH 3/3] amdgpu: reserve VRAM ranges in PAT memtype tables.

2016-10-18 Thread Dave Airlie
From: Dave Airlie 

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 887483b..3142d70 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -,6 +,8 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
DRM_ERROR("Failed initializing VRAM heap.\n");
return r;
}
+
+   ttm_io_reserve_memtype_wc(adev->mc.aper_base, adev->mc.aper_base + 
adev->mc.aper_size);
/* Change the size here instead of the init above so only lpfn is 
affected */
amdgpu_ttm_set_active_vram_size(adev, adev->mc.visible_vram_size);

@@ -1203,6 +1205,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
ttm_bo_clean_mm(>mman.bdev, AMDGPU_PL_GWS);
ttm_bo_clean_mm(>mman.bdev, AMDGPU_PL_OA);
ttm_bo_device_release(>mman.bdev);
+   ttm_io_free_memtype(adev->mc.aper_base, adev->mc.aper_base + 
adev->mc.aper_size);
amdgpu_gart_fini(adev);
amdgpu_ttm_global_fini(adev);
adev->mman.initialized = false;
-- 
2.5.5



[PATCH 2/3] drm/ttm: add API to reserve/free WC memory.

2016-10-18 Thread Dave Airlie
From: Dave Airlie 

These will be used by drivers to reserve/free WC memory in the
PAT tracking tables, for VRAM BARs.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/ttm/ttm_bo_util.c | 24 
 include/drm/ttm/ttm_bo_driver.h   |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
b/drivers/gpu/drm/ttm/ttm_bo_util.c
index bf6e216..192c003 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -39,6 +39,13 @@
 #include 
 #include 

+#ifdef CONFIG_X86
+#include 
+#else
+#define io_reserve_memtype(start, end, pcm) (0)
+#define io_free_memtype(start, end)
+#endif
+
 void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
 {
ttm_bo_mem_put(bo, >mem);
@@ -796,3 +803,20 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
return 0;
 }
 EXPORT_SYMBOL(ttm_bo_pipeline_move);
+
+int ttm_io_reserve_memtype_wc(resource_size_t start, resource_size_t end)
+{
+   enum page_cache_mode pcm = _PAGE_CACHE_MODE_WC;
+   int ret;
+   ret = io_reserve_memtype(start, end, );
+   if (ret)
+   return ret;
+   return 0;
+}
+EXPORT_SYMBOL(ttm_io_reserve_memtype_wc);
+
+void ttm_io_free_memtype(resource_size_t start, resource_size_t end)
+{
+   io_free_memtype(start, end);
+}
+EXPORT_SYMBOL(ttm_io_free_memtype);
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 4f0a921..6b2d24e 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -1054,6 +1054,8 @@ int ttm_bo_pipeline_move(struct ttm_buffer_object *bo,
  */
 extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);

+int ttm_io_reserve_memtype_wc(resource_size_t start, resource_size_t end);
+void ttm_io_free_memtype(resource_size_t start, resource_size_t end);
 extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;

 #if IS_ENABLED(CONFIG_AGP)
-- 
2.5.5



[PATCH 1/3] x86/pat: export io memory reserve/free api.

2016-10-18 Thread Dave Airlie
From: Dave Airlie 

These functions are needed for gpu/ttm drivers to reserve the
VRAM area as write combined. In a lot of places we don't ioremap
but still need to insert pfn from it into a VMA using vm_insert_mixed,
but a recent change in mixed insertion means we need to reserve
VRAM as WC upfront, so we need these APIs exported.

Signed-off-by: Dave Airlie 
---
 arch/x86/mm/pat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 170cc4f..5ce2fbb 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -719,6 +719,7 @@ out_free:
 out_err:
return ret;
 }
+EXPORT_SYMBOL(io_reserve_memtype);

 /**
  * io_free_memtype - Release a memory type mapping for a region of memory
@@ -729,6 +730,7 @@ void io_free_memtype(resource_size_t start, resource_size_t 
end)
 {
free_memtype(start, end);
 }
+EXPORT_SYMBOL(io_free_memtype);

 pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
unsigned long size, pgprot_t vma_prot)
-- 
2.5.5



[rfc] fix for regression in pat memory tracking in 4.9-rc1

2016-10-18 Thread Dave Airlie
Okay I spent some time looking into it, and this is the result.

We have to manually insert the VRAM BAR into the pat memory tracking
table as WC. The only other way things get inserted are via ioremap,
which we never do for the whole VRAM BAR. We could in theory map
the VRAM BAR using the iomap stuff that i915 uses, but we don't
and this seems easier for now.

We have to fix up at least nouveau and radeon I think as well.

Dave.



[PATCH v2 07/10] drm/i915/gen9: Make skl_pipe_wm_get_hw_state() reusable

2016-10-18 Thread Paulo Zanoni
Em Sex, 2016-10-14 às 17:31 -0400, Lyude escreveu:
> There's not much of a reason this should have the locations to read
> out
> the hardware state hardcoded, so allow the caller to specify the
> location and add this function to intel_drv.h. As well, we're going
> to
> need this function to be reusable for the next patch.
> 
> Changes since v1:
> - Fix accidental behavior change in the code that Paulo pointed out

Reviewed-by: Paulo Zanoni 

I just submitted v4 of patch 5 solving the conflicts I created. With
that + this review, we can merge this series. If you give me an ack on
patch 5 I can just go and merge these, so we can move to Maarten's
series and then later to Mahesh's series.

> 
> Signed-off-by: Lyude 
> Cc: Maarten Lankhorst 
> Cc: Ville Syrjälä 
> Cc: Matt Roper  Cc: Paulo Zanoni 
> ---
>  drivers/gpu/drm/i915/intel_drv.h |  2 ++
>  drivers/gpu/drm/i915/intel_pm.c  | 28 ++--
>  2 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h
> b/drivers/gpu/drm/i915/intel_drv.h
> index a85ce2c..7036310 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1756,6 +1756,8 @@ void ilk_wm_get_hw_state(struct drm_device
> *dev);
>  void skl_wm_get_hw_state(struct drm_device *dev);
>  void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv,
>    struct skl_ddb_allocation *ddb /* out */);
> +void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc,
> +       struct skl_pipe_wm *out);
>  bool intel_can_enable_sagv(struct drm_atomic_state *state);
>  int intel_enable_sagv(struct drm_i915_private *dev_priv);
>  int intel_disable_sagv(struct drm_i915_private *dev_priv);
> diff --git a/drivers/gpu/drm/i915/intel_pm.c
> b/drivers/gpu/drm/i915/intel_pm.c
> index 2fe851e..6eaeb87 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4288,15 +4288,13 @@ static inline void
> skl_wm_level_from_reg_val(uint32_t val,
>  PLANE_WM_LINES_MASK;
>  }
>  
> -static void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc)
> +void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc,
> +       struct skl_pipe_wm *out)
>  {
>  struct drm_device *dev = crtc->dev;
>  struct drm_i915_private *dev_priv = to_i915(dev);
> - struct skl_wm_values *hw = _priv->wm.skl_hw;
>  struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> - struct intel_crtc_state *cstate = to_intel_crtc_state(crtc-
> >state);
>  struct intel_plane *intel_plane;
> - struct skl_pipe_wm *active = >wm.skl.optimal;
>  struct skl_plane_wm *wm;
>  enum pipe pipe = intel_crtc->pipe;
>  int level, id, max_level;
> @@ -4306,7 +4304,7 @@ static void skl_pipe_wm_get_hw_state(struct
> drm_crtc *crtc)
>  
>  for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
>  id = skl_wm_plane_id(intel_plane);
> - wm = >wm.skl.optimal.planes[id];
> + wm = >planes[id];
>  
>  for (level = 0; level <= max_level; level++) {
>  if (id != PLANE_CURSOR)
> @@ -4328,20 +4326,30 @@ static void skl_pipe_wm_get_hw_state(struct
> drm_crtc *crtc)
>  if (!intel_crtc->active)
>  return;
>  
> - hw->dirty_pipes |= drm_crtc_mask(crtc);
> - active->linetime = I915_READ(PIPE_WM_LINETIME(pipe));
> - intel_crtc->wm.active.skl = *active;
> + out->linetime = I915_READ(PIPE_WM_LINETIME(pipe));
>  }
>  
>  void skl_wm_get_hw_state(struct drm_device *dev)
>  {
>  struct drm_i915_private *dev_priv = to_i915(dev);
> + struct skl_wm_values *hw = _priv->wm.skl_hw;
>  struct skl_ddb_allocation *ddb = _priv->wm.skl_hw.ddb;
>  struct drm_crtc *crtc;
> + struct intel_crtc *intel_crtc;
> + struct intel_crtc_state *cstate;
>  
>  skl_ddb_get_hw_state(dev_priv, ddb);
> - list_for_each_entry(crtc, >mode_config.crtc_list, head)
> - skl_pipe_wm_get_hw_state(crtc);
> + list_for_each_entry(crtc, >mode_config.crtc_list, head)
> {
> + intel_crtc = to_intel_crtc(crtc);
> + cstate = to_intel_crtc_state(crtc->state);
> +
> + skl_pipe_wm_get_hw_state(crtc, 
> >wm.skl.optimal);
> +
> + if (intel_crtc->active) {
> + hw->dirty_pipes |= drm_crtc_mask(crtc);
> + intel_crtc->wm.active.skl = cstate-
> >wm.skl.optimal;
> + }
> + }
>  
>  if (dev_priv->active_crtcs) {
>  /* Fully recompute DDB on first atomic commit */


[PATCH] drm/rockchip: Don't use atomic constructs for psr

2016-10-18 Thread Sean Paul
Instead of using timer and spinlocks, use delayed_work and
mutexes for rockchip psr. This allows us to make blocking
calls when enabling/disabling psr (which is sort of important
given we're talking over dpcd to the display).

Cc: zain wang 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 14 +++--
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 68 +++--
 4 files changed, 37 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index e5471e7..8877ba2 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -72,7 +72,7 @@ struct rockchip_dp_device {
struct reset_control *rst;

struct work_struct   psr_work;
-   spinlock_t   psr_lock;
+   struct mutex psr_lock;
unsigned int psr_state;

const struct rockchip_dp_chip_data *data;
@@ -83,21 +83,20 @@ struct rockchip_dp_device {
 static void analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled)
 {
struct rockchip_dp_device *dp = to_dp(encoder);
-   unsigned long flags;

if (!analogix_dp_psr_supported(dp->dev))
return;

dev_dbg(dp->dev, "%s PSR...\n", enabled ? "Entry" : "Exit");

-   spin_lock_irqsave(>psr_lock, flags);
+   mutex_lock(>psr_lock);
if (enabled)
dp->psr_state = EDP_VSC_PSR_STATE_ACTIVE;
else
dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;

schedule_work(>psr_work);
-   spin_unlock_irqrestore(>psr_lock, flags);
+   mutex_unlock(>psr_lock);
 }

 static void analogix_dp_psr_work(struct work_struct *work)
@@ -108,7 +107,6 @@ static void analogix_dp_psr_work(struct work_struct *work)
int psr_state = dp->psr_state;
int vact_end;
int ret;
-   unsigned long flags;

if (!crtc)
return;
@@ -122,12 +120,12 @@ static void analogix_dp_psr_work(struct work_struct *work)
return;
}

-   spin_lock_irqsave(>psr_lock, flags);
+   mutex_lock(>psr_lock);
if (psr_state == EDP_VSC_PSR_STATE_ACTIVE)
analogix_dp_enable_psr(dp->dev);
else
analogix_dp_disable_psr(dp->dev);
-   spin_unlock_irqrestore(>psr_lock, flags);
+   mutex_unlock(>psr_lock);
 }

 static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
@@ -401,7 +399,7 @@ 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;

-   spin_lock_init(>psr_lock);
+   mutex_init(>psr_lock);
dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
INIT_WORK(>psr_work, analogix_dp_psr_work);

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 8c8cbe8..5afd5a1 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -157,7 +157,7 @@ static int rockchip_drm_bind(struct device *dev)
drm_dev->dev_private = private;

INIT_LIST_HEAD(>psr_list);
-   spin_lock_init(>psr_list_lock);
+   mutex_init(>psr_list_lock);

drm_mode_config_init(drm_dev);

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index fb6226c..095e178 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -62,7 +62,7 @@ struct rockchip_drm_private {
struct drm_atomic_state *state;

struct list_head psr_list;
-   spinlock_t psr_list_lock;
+   struct mutex psr_list_lock;
 };

 int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
index 4c379e9..eb49f38 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
@@ -18,7 +18,7 @@
 #include "rockchip_drm_drv.h"
 #include "rockchip_drm_psr.h"

-#define PSR_FLUSH_TIMEOUT  msecs_to_jiffies(100)
+#define PSR_FLUSH_TIMEOUT_MS   100

 enum psr_state {
PSR_FLUSH,
@@ -30,11 +30,11 @@ struct psr_drv {
struct list_headlist;
struct drm_encoder  *encoder;

-   spinlock_t  lock;
+   struct mutexlock;
boolactive;
enum psr_state  state;

-   struct timer_list   flush_timer;
+   struct delayed_work flush_work;

void (*set)(struct drm_encoder *encoder, bool enable);
 };
@@ -43,9 +43,8 @@ static struct psr_drv *find_psr_by_crtc(struct drm_crtc *crtc)
 {
struct rockchip_drm_private 

[PATCH] drm/bridge: adv7511: Remove unused code blocks

2016-10-18 Thread Laurent Pinchart
Hi Jitendra,

Thank you for the patch.

On Tuesday 18 Oct 2016 15:39:58 Jitendra Sharma wrote:
> Remove unused id_table entries
> Currently this driver supports only device tree based configuration.
> So, no need in keeping the id_table entries
> 
> Remove redundant condition check
> Remove not necessary if-else block for checking DT entry because else
> part will never be picked as in absence of device node, probe will
> fail in initial stage only.
> 
> Signed-off-by: Jitendra Sharma 
> ---
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 +
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 8ed3906..44eea5c
> 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const
> struct i2c_device_id *id) adv7511->powered = false;
>   adv7511->status = connector_status_disconnected;
> 
> - if (dev->of_node)
> - adv7511->type = (enum 
adv7511_type)of_device_get_match_data(dev);
> - else
> - adv7511->type = id->driver_data;
> + adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);
> 
>   memset(_config, 0, sizeof(link_config));
> 
> @@ -1065,17 +1062,6 @@ static int adv7511_remove(struct i2c_client *i2c)
>   return 0;
>  }
> 
> -static const struct i2c_device_id adv7511_i2c_ids[] = {
> - { "adv7511", ADV7511 },
> - { "adv7511w", ADV7511 },
> - { "adv7513", ADV7511 },
> -#ifdef CONFIG_DRM_I2C_ADV7533
> - { "adv7533", ADV7533 },
> -#endif
> - { }
> -};
> -MODULE_DEVICE_TABLE(i2c, adv7511_i2c_ids);
> -
>  static const struct of_device_id adv7511_of_ids[] = {
>   { .compatible = "adi,adv7511", .data = (void *)ADV7511 },
>   { .compatible = "adi,adv7511w", .data = (void *)ADV7511 },
> @@ -1096,7 +1082,6 @@ static int adv7511_remove(struct i2c_client *i2c)
>   .name = "adv7511",
>   .of_match_table = adv7511_of_ids,
>   },
> - .id_table = adv7511_i2c_ids,

Have you tested this ? With your patch applied the OF-instantiated adv7611w is 
never probed on my system.

>   .probe = adv7511_probe,
>   .remove = adv7511_remove,
>  };

-- 
Regards,

Laurent Pinchart



[PATCH 03/10] dim: echoerr helper for printing to stderr

2016-10-18 Thread Jani Nikula
On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> Signed-off-by: Daniel Vetter 
> ---
>  dim | 19 ---
>  1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/dim b/dim
> index 192d6ee10838..2601bb7dbbad 100755
> --- a/dim
> +++ b/dim
> @@ -102,12 +102,17 @@ DRY=
>  FORCE=
>  HELP=
>  
> +function echoerr
> +{
> + echo "$@" >&2
> +}

I guess you could move the "$dim: " prefix here, to ensure all places
will have that. Can be a follow-up.

BR,
Jani.

> +
>  function warn_or_fail
>  {
>   if [[ $FORCE ]] ; then
> - echo WARNING: $1, but continuing
> + echoerr WARNING: $1, but continuing
>   else
> - echo ERROR: $1, aborting
> + echoerr ERROR: $1, aborting
>   exit 1
>   fi
>  }
> @@ -128,7 +133,7 @@ while getopts hdfi opt; do
>   HELP=1
>   ;;
>   *)
> - echo "See '$dim help' for more information." >&2
> + echoerr "See '$dim help' for more information."
>   exit
>   esac
>  done
> @@ -167,18 +172,18 @@ function dim_uptodate
>   local using="${BASH_SOURCE[0]}"
>  
>   if [[ ! -e "$using" ]]; then
> - echo "$dim: could not figure out the version being used 
> ($using)." >&2
> + echoerr "$dim: could not figure out the version being used 
> ($using)."
>   exit 1
>   fi
>  
>   if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; then
> - echo "$dim: could not find the upstream repo for $dim." >&2
> + echoerr "$dim: could not find the upstream repo for $dim."
>   exit 1
>   fi
>  
>   if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show 
> @{upstream}:dim |\
>   diff "$using" - >& /dev/null; then
> - echo "$dim: not running upstream version of the script." >&2
> + echoerr "$dim: not running upstream version of the script."
>   exit 1
>   fi
>  }
> @@ -1280,6 +1285,6 @@ subcmd_func=dim_${subcmd//-/_}
>  if declare -f $subcmd_func >/dev/null; then
>   $subcmd_func "$@"
>  else
> - echo "$dim: '$subcommand' is not a dim command." >&2
> + echoerr "$dim: '$subcommand' is not a dim command."
>   dim_usage
>  fi

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH v5 00/13] Centralize format information

2016-10-18 Thread Archit Taneja
Hi,

On 10/18/2016 04:11 AM, Laurent Pinchart wrote:
> Hello,
>
> Various pieces of information about DRM formats (number of planes, color
> depth, chroma subsampling, ...) are scattered across different helper
> functions in the DRM core. Callers of those functions often need to access
> more than a single parameter of the format, leading to inefficiencies due to
> multiple lookups.
>
> This patch series addresses this issue by centralizing all format information
> in a single data structure (01/13). It reimplements the existing format helper
> functions based on that structure (02/13) and converts the DRM core code to
> use the new structure (03/13). The DRM core now WARNs when a driver tries to
> query information about an unsupported format (04/13).
>
> The second part of the patch series removes the drm_fb_get_bpp_depth() legacy
> function that shouldn't be used directly by drivers. It modifies all its users
> to use the appropriate API instead (05/13 to 12/13) and finally merges the
> function into its only caller in the DRM core (13/13).
>
> The new API is also useful for drivers as shown by the "[PATCH v2 00/20] OMAP
> DRM fixes and improvements" patch series previously posted.
>
> All patches have been acked, the series is ready to be merged for v4.10.

Queued all patches to drm-misc.

Thanks,
Archit

>
> Changes since v4:
>
> - Rebased on top of latest drm/master branch
> - Collected acks
> - Fixed depth value of DRM_FORMAT_[AXRGB]{4} formats to match current code
> - Added support for DRM_FORMAT_BGR565, DRM_FORMAT_XBGR and
>   DRM_FORMAT_BGR888 to tilcdc
> - Documented the depth field as legacy
>
> Changes since v3:
>
> - Rebased on top of latest drm/master branch
> - Collected acks
> - Dropped "drm: Move format-related helpers to drm_fourcc.c" and
>   "drm/msm: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()" that
>   have been merged already
> - Added new "drm/arm: mali-dp: Replace drm_fb_get_bpp_depth() with
>   drm_format_plane_cpp()" patch
> - Coding style fixes and variable renames
>
> Changes since v2:
>
> - Remove bpp field from drm_format_info structure
> - Replace all users of drm_fb_get_bpp_depth() with the appropriate API
> - Merge drm_fb_get_bpp_depth() into its only caller
>
> Changes since v1:
>
> - Move format-related helpers to drm_fourcc.c
> - Use named initializers for the formats array
> - WARN when calling drm_format_info() for an unsupported format
> - Don't drop the drm_format_plane_width() and drm_format_plane_height()
>   helpers
>
> Laurent Pinchart (13):
>   drm: Centralize format information
>   drm: Implement the drm_format_*() helpers as drm_format_info()
> wrappers
>   drm: Use drm_format_info() in DRM core code
>   drm: WARN when calling drm_format_info() for an unsupported format
>   drm: hdlcd: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp()
>   drm: tilcdc: Replace drm_fb_get_bpp_depth() with
> drm_format_plane_cpp()
>   drm: cirrus: Replace drm_fb_get_bpp_depth() with
> drm_format_plane_cpp()
>   drm: gma500: Replace drm_fb_get_bpp_depth() with drm_format_info()
>   drm: amdgpu: Replace drm_fb_get_bpp_depth() with
> drm_format_plane_cpp()
>   drm: radeon: Replace drm_fb_get_bpp_depth() with
> drm_format_plane_cpp()
>   drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info()
>   drm/arm: mali-dp: Replace drm_fb_get_bpp_depth() with
> drm_format_plane_cpp()
>   drm: Don't export the drm_fb_get_bpp_depth() function
>
>  Documentation/gpu/drm-kms.rst   |   3 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c  |  14 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c |   3 +-
>  drivers/gpu/drm/arm/hdlcd_crtc.c|   5 +-
>  drivers/gpu/drm/arm/malidp_hw.c |   7 +-
>  drivers/gpu/drm/cirrus/cirrus_fbdev.c   |   6 +-
>  drivers/gpu/drm/cirrus/cirrus_main.c|   4 +-
>  drivers/gpu/drm/drm_fb_cma_helper.c |  23 +--
>  drivers/gpu/drm/drm_fourcc.c| 281 
> ++--
>  drivers/gpu/drm/drm_framebuffer.c   | 102 ++--
>  drivers/gpu/drm/drm_modeset_helper.c|  17 +-
>  drivers/gpu/drm/gma500/framebuffer.c|  20 +--
>  drivers/gpu/drm/radeon/radeon_fb.c  |  20 +--
>  drivers/gpu/drm/radeon/radeon_gem.c |   3 +-
>  drivers/gpu/drm/tilcdc/tilcdc_crtc.c|  18 +-
>  drivers/gpu/drm/tilcdc/tilcdc_plane.c   |   7 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c |  12 +-
>  include/drm/drm_fourcc.h|  23 ++-
>  18 files changed, 244 insertions(+), 324 deletions(-)
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver

2016-10-18 Thread Xinliang Liu
On 14 October 2016 at 22:33, Benjamin Gaignard
 wrote:
> Just by curiosity, why using "old" TTM instead of GEM ? any particular 
> reasons ?

>From the linux kernel DRM mm doc[1] it says:
"GEM has simpler initialization and execution requirements than
 25 TTM, but has no video RAM management capabilities and is thus
limited to
 26 UMA devices."

So, I think we can't use GEM to managing video RAM.
But in fact, in this driver fb buffer is also created as an GEM object
though it use TTM to manage video RAM.
So GEM ,like its name, say mostly use for execution management ???

[1] Documentation/gpu/drm-mm.rst

-xinliang

>
> 2016-10-14 16:44 GMT+02:00 Rongrong Zou :
>> Hi Benjamin,
>>
>> Thanks for reviewing!
>>
>> Benjamin Gaignard 於 2016/10/14 16:29 寫道:
>>>
>>> [snip]
>>>
 --- /dev/null
 +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
 @@ -0,0 +1,15 @@
 +config DRM_HISI_HIBMC
 +   tristate "DRM Support for Hisilicon Hibmc"
 +   depends on DRM && PCI
 +   select DRM_KMS_HELPER
 +   select DRM_KMS_FB_HELPER
 +   select DRM_GEM_CMA_HELPER
 +   select DRM_KMS_CMA_HELPER
>>>
>>>
>>> since you use TTM I don't think that selecting DRM_GEM_CMA_HELPER and
>>> DRM_KMS_CMA_HELPER
>>> help you lot here.
>>> You could add configuration flags step by step in following patches
>>> that will make you needs more clear (that also true for #include)
>>
>>
>> will delete them, thanks.
>>
>>
>>>
 +   select FB_SYS_FILLRECT
 +   select FB_SYS_COPYAREA
 +   select FB_SYS_IMAGEBLIT
 +   select DRM_TTM
 +
 +   help
 + Choose this option if you have a Hisilicon Hibmc soc chipset.
 + If M is selected the module will be called hibmc-drm.
 diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile
 b/drivers/gpu/drm/hisilicon/hibmc/Makefile
 new file mode 100644
 index 000..97cf4a0
 --- /dev/null
 +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
 @@ -0,0 +1,5 @@
 +ccflags-y := -Iinclude/drm
 +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o
 +
 +obj-$(CONFIG_DRM_HISI_HIBMC)   +=hibmc-drm.o
 +#obj-y += hibmc-drm.o
 diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
 b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
 new file mode 100644
 index 000..52c9353
 --- /dev/null
 +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
 @@ -0,0 +1,288 @@
 +/* Hisilicon Hibmc SoC drm driver
 + *
 + * Based on the bochs drm driver.
 + *
 + * Copyright (c) 2016 Huawei Limited.
 + *
 + * Author:
 + * Rongrong Zou 
>>>
>>>
>>> ".com" is missing in you email address (same typo in all other files)
>>
>>
>> will fix it in next version, thanks. :)
>>
>>>
 + * Rongrong Zou 
 + * Jianhua Li 
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + */
 +
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
 +#include 
>>>
>>>
>>> cma_helpers look useless since you use TTM, no ?
>>
>>
>> I add TTM just in this version, and forgot to clean these
>> cma relevant code, will fix in next version. Thanks.
>>
>>>
 +#include 
 +
 +#include "hibmc_drm_drv.h"
 +#include "hibmc_drm_regs.h"
 +#include "hibmc_drm_power.h"
 +
>>
>>
>> Regards,
>> Rongrong
>
>
>
> --
> Benjamin Gaignard
>
> Graphic Study Group
>
> Linaro.org │ Open source software for ARM SoCs
>
> Follow Linaro: Facebook | Twitter | Blog


[Bug 98307] "st/glsl_to_tgsi: explicitly track all input and output declaration" broke flightgear colors on rs780

2016-10-18 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=98307

--- Comment #3 from Marc Dietrich  ---
wild is great! Patch fixed the issue in Flightier, Heaven, and Valley. Thanks!

-- 
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/20161018/47da630c/attachment.html>


[PATCH v5 00/13] Centralize format information

2016-10-18 Thread Laurent Pinchart
On Tuesday 18 Oct 2016 15:45:14 Ville Syrjälä wrote:
> On Tue, Oct 18, 2016 at 03:33:29PM +0300, Laurent Pinchart wrote:
> > On Tuesday 18 Oct 2016 14:43:18 Ville Syrjälä wrote:
> >> On Tue, Oct 18, 2016 at 01:41:08AM +0300, Laurent Pinchart wrote:
> >>> Hello,
> >>> 
> >>> Various pieces of information about DRM formats (number of planes,
> >>> color depth, chroma subsampling, ...) are scattered across different
> >>> helper functions in the DRM core. Callers of those functions often
> >>> need to access more than a single parameter of the format, leading to
> >>> inefficiencies due to multiple lookups.
> >>> 
> >>> This patch series addresses this issue by centralizing all format
> >>> information in a single data structure (01/13). It reimplements the
> >>> existing format helper functions based on that structure (02/13) and
> >>> converts the DRM core code to use the new structure (03/13). The DRM
> >>> core now WARNs when a driver tries to query information about an
> >>> unsupported format (04/13).
> >>> 
> >>> The second part of the patch series removes the drm_fb_get_bpp_depth()
> >>> legacy function that shouldn't be used directly by drivers. It
> >>> modifies all its users to use the appropriate API instead (05/13 to
> >>> 12/13) and finally merges the function into its only caller in the DRM
> >>> core (13/13).
> >>> 
> >>> The new API is also useful for drivers as shown by the "[PATCH v2
> >>> 00/20] OMAP DRM fixes and improvements" patch series previously
> >>> posted.
> >>> 
> >>> All patches have been acked, the series is ready to be merged for
> >>> v4.10.
> >> 
> >> BTW and idea I had recently is that we could store the pointer to the
> >> format info into drm_framebuffer, and then a lot of the
> >> drm_format_...() calls could just vanish, or if the information we
> >> need isn't directly stored in the info structure we'd just need a small
> >> function that takes the entire drm_framebuffer or just the format info
> >> struct and computes what we need. Would avoid having to sprinkle
> >> drm_format_info() calls into the drivers.
> > 
> > That's a good idea. I didn't want to add that to my patch series in order
> > to avoid merge delays, but patches are certainly welcome :-)
> 
> Sure. I'll preserve the idea for a rainy day, unless someone else beats
> me to it that is.

I suppose I should expect lots of similar patch series during the Finnish 
winter then ;-)

-- 
Regards,

Laurent Pinchart



[PATCH v5 00/13] Centralize format information

2016-10-18 Thread Ville Syrjälä
On Tue, Oct 18, 2016 at 03:33:29PM +0300, Laurent Pinchart wrote:
> Hi Ville,
> 
> On Tuesday 18 Oct 2016 14:43:18 Ville Syrjälä wrote:
> > On Tue, Oct 18, 2016 at 01:41:08AM +0300, Laurent Pinchart wrote:
> > > Hello,
> > > 
> > > Various pieces of information about DRM formats (number of planes, color
> > > depth, chroma subsampling, ...) are scattered across different helper
> > > functions in the DRM core. Callers of those functions often need to access
> > > more than a single parameter of the format, leading to inefficiencies due
> > > to multiple lookups.
> > > 
> > > This patch series addresses this issue by centralizing all format
> > > information in a single data structure (01/13). It reimplements the
> > > existing format helper functions based on that structure (02/13) and
> > > converts the DRM core code to use the new structure (03/13). The DRM core
> > > now WARNs when a driver tries to query information about an unsupported
> > > format (04/13).
> > > 
> > > The second part of the patch series removes the drm_fb_get_bpp_depth()
> > > legacy function that shouldn't be used directly by drivers. It modifies
> > > all its users to use the appropriate API instead (05/13 to 12/13) and
> > > finally merges the function into its only caller in the DRM core (13/13).
> > > 
> > > The new API is also useful for drivers as shown by the "[PATCH v2 00/20]
> > > OMAP DRM fixes and improvements" patch series previously posted.
> > > 
> > > All patches have been acked, the series is ready to be merged for v4.10.
> > 
> > BTW and idea I had recently is that we could store the pointer to the
> > format info into drm_framebuffer, and then a lot of the
> > drm_format_...() calls could just vanish, or if the information we
> > need isn't directly stored in the info structure we'd just need a small
> > function that takes the entire drm_framebuffer or just the format info
> > struct and computes what we need. Would avoid having to sprinkle
> > drm_format_info() calls into the drivers.
> 
> That's a good idea. I didn't want to add that to my patch series in order to 
> avoid merge delays, but patches are certainly welcome :-)

Sure. I'll preserve the idea for a rainy day, unless someone else beats
me to it that is.

-- 
Ville Syrjälä
Intel OTC


[PATCH v6] drm: Helper for lspcon in drm_dp_dual_mode

2016-10-18 Thread Jani Nikula
On Mon, 17 Oct 2016, Shashank Sharma  wrote:
> Readme: {
>   This patch-series got approved in drm-intel mailing list already.
>   Sending this one patch to dri-devel too, as this patch touches the
>   drm layer dp_dual_mode_helper implementation. Plese provide an ack
>   so that we can merge this in intel-gfx tree.
>   The full patch series and review history at:
>   https://patchwork.freedesktop.org/patch/115769/
> }
>
> This patch adds lspcon support in dp_dual_mode helper.
> lspcon is essentially a dp->hdmi dongle with dual personality.
>
> LS mode: It works as a passive dongle, by level shifting DP++
> signals to HDMI signals, in LS mode.
> PCON mode: It works as a protocol converter active dongle
> in pcon mode, by converting DP++ outputs to HDMI 2.0 outputs.
>
> This patch adds support for lspcon detection and mode set
> switch operations, as a dp dual mode dongle.
>
> v2: Addressed review comments from Ville
> - add adaptor id for lspcon devices (0x08), use it to identify lspcon
> - change function names
>   old: drm_lspcon_get_current_mode/drm_lspcon_change_mode
>   new: drm_lspcon_get_mode/drm_lspcon_set_mode
> - change drm_lspcon_get_mode type to int, to match
>   drm_dp_dual_mode_get_tmds_output
> - change 'err' to 'ret' to match the rest of the functions
> - remove pointless typecasting during call to dual_mode_read
> - fix the but while setting value of data, while writing lspcon mode
> - fix indentation
> - change mdelay(10) -> msleep(10)
> - return ETIMEDOUT instead of EFAULT, when lspcon mode change times out
> - Add an empty line to separate std regs macros and lspcon regs macros
>   Indent bit definition
>
> v3: Addressed review comments from Rodrigo
> - change macro name from DP_DUAL_MODE_TYPE_LSPCON to
>   DP_DUAL_MODE_TYPE_HAS_DPCD for better readability
> - change macro name from DP_DUAL_MODE_LSPCON_MODE_PCON to
>   DP_DUAL_MODE_LSPCON_MODE_PCON for better readability
> - add comment for MCA specific offsets like 0x40 and 0x41
> - remove DP_DUAL_MODE_REV_TYPE2 check while checking lspcon adapter id
>
> v4: Addressed review comments from Ville
> - Fixed indentation at few places
> - s/current_mode/mode
> - s/reqd_mode/mode
> - remove unnecessary void* cast
> - remove drm_edid.h from includes
> - Add a comment for _HAS_DPCD
> - Fix enum description, for lspcon_mode.
>
> v5: Rebase
> v6: Rebase
>
> Signed-off-by: Shashank Sharma 
> Reviewed-by: Rodrigo Vivi 

Pushed to drm-intel-next-queued with Dave's IRC ack to merge via Intel
trees.

BR,
Jani.


> ---
>  drivers/gpu/drm/drm_dp_dual_mode_helper.c | 103 
> ++
>  include/drm/drm_dp_dual_mode_helper.h |  26 
>  2 files changed, 129 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c 
> b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> index a7b2a75..a7aeb1e 100644
> --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> @@ -148,6 +148,14 @@ static bool is_type2_adaptor(uint8_t adaptor_id)
> DP_DUAL_MODE_REV_TYPE2);
>  }
>  
> +bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
> + const uint8_t adaptor_id)
> +{
> + return is_hdmi_adaptor(hdmi_id) &&
> + (adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 |
> +  DP_DUAL_MODE_TYPE_HAS_DPCD));
> +}
> +
>  /**
>   * drm_dp_dual_mode_detect - Identify the DP dual mode adaptor
>   * @adapter: I2C adapter for the DDC bus
> @@ -203,6 +211,8 @@ enum drm_dp_dual_mode_type drm_dp_dual_mode_detect(struct 
> i2c_adapter *adapter)
>   ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_ADAPTOR_ID,
>   _id, sizeof(adaptor_id));
>   if (ret == 0) {
> + if (is_lspcon_adaptor(hdmi_id, adaptor_id))
> + return DRM_DP_DUAL_MODE_LSPCON;
>   if (is_type2_adaptor(adaptor_id)) {
>   if (is_hdmi_adaptor(hdmi_id))
>   return DRM_DP_DUAL_MODE_TYPE2_HDMI;
> @@ -364,3 +374,96 @@ const char *drm_dp_get_dual_mode_type_name(enum 
> drm_dp_dual_mode_type type)
>   }
>  }
>  EXPORT_SYMBOL(drm_dp_get_dual_mode_type_name);
> +
> +/**
> + * drm_lspcon_get_mode: Get LSPCON's current mode of operation by
> + * by reading offset (0x80, 0x41)
> + * @i2c_adapter: I2C-over-aux adapter
> + * @current_mode: out vaiable, current lspcon mode of operation
> + *
> + * Returns:
> + * 0 on success, sets the current_mode value to appropriate mode
> + * -error on failure
> + */
> +int drm_lspcon_get_mode(struct i2c_adapter *adapter,
> + enum drm_lspcon_mode *mode)
> +{
> + u8 data;
> + int ret = 0;
> +
> + if (!mode) {
> + DRM_ERROR("NULL input\n");
> + return -EINVAL;
> + }
> +
> + /* Read Status: i2c over aux */
> + ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
> + , sizeof(data));
> + if 

[PATCH] drm/bridge: adv7511: Remove unused code blocks

2016-10-18 Thread Jitendra Sharma
Remove unused id_table entries
Currently this driver supports only device tree based configuration.
So, no need in keeping the id_table entries

Remove redundant condition check
Remove not necessary if-else block for checking DT entry because else
part will never be picked as in absence of device node, probe will
fail in initial stage only.

Signed-off-by: Jitendra Sharma 
---
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c 
b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 8ed3906..44eea5c 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -942,10 +942,7 @@ static int adv7511_probe(struct i2c_client *i2c, const 
struct i2c_device_id *id)
adv7511->powered = false;
adv7511->status = connector_status_disconnected;

-   if (dev->of_node)
-   adv7511->type = (enum 
adv7511_type)of_device_get_match_data(dev);
-   else
-   adv7511->type = id->driver_data;
+   adv7511->type = (enum adv7511_type)of_device_get_match_data(dev);

memset(_config, 0, sizeof(link_config));

@@ -1065,17 +1062,6 @@ static int adv7511_remove(struct i2c_client *i2c)
return 0;
 }

-static const struct i2c_device_id adv7511_i2c_ids[] = {
-   { "adv7511", ADV7511 },
-   { "adv7511w", ADV7511 },
-   { "adv7513", ADV7511 },
-#ifdef CONFIG_DRM_I2C_ADV7533
-   { "adv7533", ADV7533 },
-#endif
-   { }
-};
-MODULE_DEVICE_TABLE(i2c, adv7511_i2c_ids);
-
 static const struct of_device_id adv7511_of_ids[] = {
{ .compatible = "adi,adv7511", .data = (void *)ADV7511 },
{ .compatible = "adi,adv7511w", .data = (void *)ADV7511 },
@@ -1096,7 +1082,6 @@ static int adv7511_remove(struct i2c_client *i2c)
.name = "adv7511",
.of_match_table = adv7511_of_ids,
},
-   .id_table = adv7511_i2c_ids,
.probe = adv7511_probe,
.remove = adv7511_remove,
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[Bug 98307] "st/glsl_to_tgsi: explicitly track all input and output declaration" broke flightgear colors on rs780

2016-10-18 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=98307

--- Comment #2 from Nicolai Hähnle  ---
Created attachment 127378
  --> https://bugs.freedesktop.org/attachment.cgi?id=127378=edit
wild guess

I cannot reproduce this on either llvmpipe or Redwood, and I don't have a
pre-Evergreen card anymore.

My best guess is that the driver gets confused because the order of input and
output declarations is changed. Does the attached patch help?

If that doesn't help, could you please attach logs with R600_DEBUG=vs,ps both
before and after the bad commit?

-- 
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/20161018/963fc230/attachment.html>


[PATCH v5 00/13] Centralize format information

2016-10-18 Thread Laurent Pinchart
Hi Ville,

On Tuesday 18 Oct 2016 14:43:18 Ville Syrjälä wrote:
> On Tue, Oct 18, 2016 at 01:41:08AM +0300, Laurent Pinchart wrote:
> > Hello,
> > 
> > Various pieces of information about DRM formats (number of planes, color
> > depth, chroma subsampling, ...) are scattered across different helper
> > functions in the DRM core. Callers of those functions often need to access
> > more than a single parameter of the format, leading to inefficiencies due
> > to multiple lookups.
> > 
> > This patch series addresses this issue by centralizing all format
> > information in a single data structure (01/13). It reimplements the
> > existing format helper functions based on that structure (02/13) and
> > converts the DRM core code to use the new structure (03/13). The DRM core
> > now WARNs when a driver tries to query information about an unsupported
> > format (04/13).
> > 
> > The second part of the patch series removes the drm_fb_get_bpp_depth()
> > legacy function that shouldn't be used directly by drivers. It modifies
> > all its users to use the appropriate API instead (05/13 to 12/13) and
> > finally merges the function into its only caller in the DRM core (13/13).
> > 
> > The new API is also useful for drivers as shown by the "[PATCH v2 00/20]
> > OMAP DRM fixes and improvements" patch series previously posted.
> > 
> > All patches have been acked, the series is ready to be merged for v4.10.
> 
> BTW and idea I had recently is that we could store the pointer to the
> format info into drm_framebuffer, and then a lot of the
> drm_format_...() calls could just vanish, or if the information we
> need isn't directly stored in the info structure we'd just need a small
> function that takes the entire drm_framebuffer or just the format info
> struct and computes what we need. Would avoid having to sprinkle
> drm_format_info() calls into the drivers.

That's a good idea. I didn't want to add that to my patch series in order to 
avoid merge delays, but patches are certainly welcome :-)

-- 
Regards,

Laurent Pinchart



[PATCH v2] virtio-gpu: fix vblank events

2016-10-18 Thread Gustavo Padovan
From: Gerd Hoffmann 

virtio-gpu sends vblank events in virtio_gpu_crtc_atomic_flush, and
because of that it must be called for disabled planes too.  Ask
drm_atomic_helper_commit_planes to do that.

v2: update to use new drm_atomic_helper_commit_planes() API.

Signed-off-by: Gerd Hoffmann 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
b/drivers/gpu/drm/virtio/virtgpu_display.c
index 6848651..64facc8 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -340,8 +340,7 @@ static void vgdev_atomic_commit_tail(struct 
drm_atomic_state *state)

drm_atomic_helper_commit_modeset_disables(dev, state);
drm_atomic_helper_commit_modeset_enables(dev, state);
-   drm_atomic_helper_commit_planes(dev, state,
-   DRM_PLANE_COMMIT_ACTIVE_ONLY);
+   drm_atomic_helper_commit_planes(dev, state, 0);

drm_atomic_helper_commit_hw_done(state);

-- 
2.5.5



[PATCH v2] virtio-gpu: fix vblank events

2016-10-18 Thread Gustavo Padovan
2016-10-18 Gustavo Padovan :

> From: Gustavo Padovan 

Author info is wrong. It should be Gerd, I'll send another patch.

> 
> virtio-gpu sends vblank events in virtio_gpu_crtc_atomic_flush, and
> because of that it must be called for disabled planes too.  Ask
> drm_atomic_helper_commit_planes to do that.
> 
> v2: update to use new drm_atomic_helper_commit_planes() API.
> 
> Signed-off-by: Gerd Hoffmann 
> Signed-off-by: Gustavo Padovan 
> ---
>  drivers/gpu/drm/virtio/virtgpu_display.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
> b/drivers/gpu/drm/virtio/virtgpu_display.c
> index 6848651..64facc8 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_display.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_display.c
> @@ -340,8 +340,7 @@ static void vgdev_atomic_commit_tail(struct 
> drm_atomic_state *state)
>  
>   drm_atomic_helper_commit_modeset_disables(dev, state);
>   drm_atomic_helper_commit_modeset_enables(dev, state);
> - drm_atomic_helper_commit_planes(dev, state,
> - DRM_PLANE_COMMIT_ACTIVE_ONLY);
> + drm_atomic_helper_commit_planes(dev, state, 0);
>  
>   drm_atomic_helper_commit_hw_done(state);
>  
> -- 
> 2.5.5
> 


[PATCH 02/10] dim: Autocheck for up-to-dateness

2016-10-18 Thread Daniel Vetter
On Tue, Oct 18, 2016 at 04:15:01PM +0300, Jani Nikula wrote:
> On Tue, 18 Oct 2016, Daniel Vetter  wrote:
> > Exits script to annoy people roughly every 100th time ...
> 
> Annoyingly random, but we can improve this later.

I had it non-random, then realized it makes improving dim impossible ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 04/10] mm: replace get_user_pages_locked() write/force parameters with gup_flags

2016-10-18 Thread Lorenzo Stoakes
On Tue, Oct 18, 2016 at 02:54:25PM +0200, Jan Kara wrote:
> > @@ -1282,7 +1282,7 @@ long get_user_pages(unsigned long start, unsigned 
> > long nr_pages,
> > int write, int force, struct page **pages,
> > struct vm_area_struct **vmas);
> >  long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
> > -   int write, int force, struct page **pages, int *locked);
> > +   unsigned int gup_flags, struct page **pages, int *locked);
>
> Hum, the prototype is inconsistent with e.g. __get_user_pages_unlocked()
> where gup_flags come after **pages argument. Actually it makes more sense
> to have it before **pages so that input arguments come first and output
> arguments second but I don't care that much. But it definitely should be
> consistent...

It was difficult to decide quite how to arrange parameters as there was
inconsitency with regards to parameter ordering already - for example
__get_user_pages() places its flags argument before pages whereas, as you note,
__get_user_pages_unlocked() puts them afterwards.

I ended up compromising by trying to match the existing ordering of the function
as much as I could by replacing write, force pairs with gup_flags in the same
location (with the exception of get_user_pages_unlocked() which I felt should
match __get_user_pages_unlocked() in signature) or if there was already a
gup_flags parameter as in the case of __get_user_pages_unlocked() I simply
removed the write, force pair and left the flags as the last parameter.

I am happy to rearrange parameters as needed, however I am not sure if it'd be
worthwhile for me to do so (I am keen to try to avoid adding too much noise here
:)

If we were to rearrange parameters for consistency I'd suggest adjusting
__get_user_pages_unlocked() to put gup_flags before pages and do the same with
get_user_pages_unlocked(), let me know what you think.


[PATCH 04/10] mm: replace get_user_pages_locked() write/force parameters with gup_flags

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:14, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from get_user_pages_locked()
> and replaces them with a gup_flags parameter to make the use of FOLL_FORCE
> explicit in callers as use of this flag can result in surprising behaviour 
> (and
> hence bugs) within the mm subsystem.
> 
> Signed-off-by: Lorenzo Stoakes 
> ---
>  include/linux/mm.h |  2 +-
>  mm/frame_vector.c  |  8 +++-
>  mm/gup.c   | 12 +++-
>  mm/nommu.c |  5 -
>  4 files changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 6adc4bc..27ab538 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1282,7 +1282,7 @@ long get_user_pages(unsigned long start, unsigned long 
> nr_pages,
>   int write, int force, struct page **pages,
>   struct vm_area_struct **vmas);
>  long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
> - int write, int force, struct page **pages, int *locked);
> + unsigned int gup_flags, struct page **pages, int *locked);

Hum, the prototype is inconsistent with e.g. __get_user_pages_unlocked()
where gup_flags come after **pages argument. Actually it makes more sense
to have it before **pages so that input arguments come first and output
arguments second but I don't care that much. But it definitely should be
consistent...

Honza
-- 
Jan Kara 
SUSE Labs, CR


[PATCH 03/10] mm: replace get_user_pages_unlocked() write/force parameters with gup_flags

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:13, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from 
> get_user_pages_unlocked()
> and replaces them with a gup_flags parameter to make the use of FOLL_FORCE
> explicit in callers as use of this flag can result in surprising behaviour 
> (and
> hence bugs) within the mm subsystem.
> 
> Signed-off-by: Lorenzo Stoakes 

Looks good. You can add:

Reviewed-by: Jan Kara 

Honza
-- 
Jan Kara 
SUSE Labs, CR


[PATCH 02/10] mm: remove write/force parameters from __get_user_pages_unlocked()

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:12, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from
> __get_user_pages_unlocked() to make the use of FOLL_FORCE explicit in callers 
> as
> use of this flag can result in surprising behaviour (and hence bugs) within 
> the
> mm subsystem.
> 
> Signed-off-by: Lorenzo Stoakes 

The patch looks good. You can add:

Reviewed-by: Jan Kara 

Honza
-- 
Jan Kara 
SUSE Labs, CR


[PATCH v5 00/13] Centralize format information

2016-10-18 Thread Ville Syrjälä
On Tue, Oct 18, 2016 at 01:41:08AM +0300, Laurent Pinchart wrote:
> Hello,
> 
> Various pieces of information about DRM formats (number of planes, color
> depth, chroma subsampling, ...) are scattered across different helper
> functions in the DRM core. Callers of those functions often need to access
> more than a single parameter of the format, leading to inefficiencies due to
> multiple lookups.
> 
> This patch series addresses this issue by centralizing all format information
> in a single data structure (01/13). It reimplements the existing format helper
> functions based on that structure (02/13) and converts the DRM core code to
> use the new structure (03/13). The DRM core now WARNs when a driver tries to
> query information about an unsupported format (04/13).
> 
> The second part of the patch series removes the drm_fb_get_bpp_depth() legacy
> function that shouldn't be used directly by drivers. It modifies all its users
> to use the appropriate API instead (05/13 to 12/13) and finally merges the
> function into its only caller in the DRM core (13/13).
> 
> The new API is also useful for drivers as shown by the "[PATCH v2 00/20] OMAP
> DRM fixes and improvements" patch series previously posted.
> 
> All patches have been acked, the series is ready to be merged for v4.10.

BTW and idea I had recently is that we could store the pointer to the
format info into drm_framebuffer, and then a lot of the
drm_format_...() calls could just vanish, or if the information we
need isn't directly stored in the info structure we'd just need a small
function that takes the entire drm_framebuffer or just the format info
struct and computes what we need. Would avoid having to sprinkle
drm_format_info() calls into the drivers.

-- 
Ville Syrjälä
Intel OTC


[PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()

2016-10-18 Thread Jan Kara
On Thu 13-10-16 01:20:11, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from 
> __get_user_pages_locked()
> to make the use of FOLL_FORCE explicit in callers as use of this flag can 
> result
> in surprising behaviour (and hence bugs) within the mm subsystem.
> 
> Signed-off-by: Lorenzo Stoakes 

Looks good. You can add:

Reviewed-by: Jan Kara 

Honza
-- 
Jan Kara 
SUSE Labs, CR


[PATCH] drm: fix sparse warnings on undeclared symbols in crc debugfs

2016-10-18 Thread Jani Nikula
Fixes sparse warnings:

drivers/gpu/drm/drm_debugfs_crc.c:118:30: warning: symbol
'drm_crtc_crc_control_fops' was not declared. Should it be static?

drivers/gpu/drm/drm_debugfs_crc.c:264:30: warning: symbol
'drm_crtc_crc_data_fops' was not declared. Should it be static?

drivers/gpu/drm/drm_debugfs_crc.c:281:5: warning: symbol
'drm_debugfs_crtc_crc_add' was not declared. Should it be static?

Fixes: 9edbf1fa600a ("drm: Add API for capturing frame CRCs")
Cc: Benjamin Gaignard 
Cc: Daniel Vetter 
Cc: Emil Velikov 
Cc: Tomeu Vizoso 
Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/drm_debugfs_crc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs_crc.c 
b/drivers/gpu/drm/drm_debugfs_crc.c
index 4129405d17c0..00e771fb7df2 100644
--- a/drivers/gpu/drm/drm_debugfs_crc.c
+++ b/drivers/gpu/drm/drm_debugfs_crc.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include "drm_internal.h"

 /**
  * DOC: CRC ABI
@@ -115,7 +116,7 @@ static ssize_t crc_control_write(struct file *file, const 
char __user *ubuf,
return len;
 }

-const struct file_operations drm_crtc_crc_control_fops = {
+static const struct file_operations drm_crtc_crc_control_fops = {
.owner = THIS_MODULE,
.open = crc_control_open,
.read = seq_read,
@@ -261,7 +262,7 @@ static ssize_t crtc_crc_read(struct file *filep, char 
__user *user_buf,
return LINE_LEN(crc->values_cnt);
 }

-const struct file_operations drm_crtc_crc_data_fops = {
+static const struct file_operations drm_crtc_crc_data_fops = {
.owner = THIS_MODULE,
.open = crtc_crc_open,
.read = crtc_crc_read,
-- 
2.1.4



[PATCH 6/6] drm: bridge/analogix: enable vop standby when entry PSR

2016-10-18 Thread Zain Wang
From: zain wang 

make VOP standby when entry PSR to save some power.

Signed-off-by: zain wang 
---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 29 ++---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h |  1 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 19 
 3 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 1c2d756..e0f3ed3 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -113,6 +113,13 @@ static void analogix_dp_psr_work(struct work_struct *work)
if (!crtc)
return;

+   spin_lock_irqsave(>psr_lock, flags);
+   psr_state = dp->psr_state;
+   spin_unlock_irqrestore(>psr_lock, flags);
+
+   if (psr_state != EDP_VSC_PSR_STATE_ACTIVE)
+   rockchip_drm_vop_set_standby(crtc, false);
+
vact_end = crtc->mode.vtotal - crtc->mode.vsync_start + 
crtc->mode.vdisplay;

ret = rockchip_drm_wait_line_flag(dp->encoder.crtc, vact_end,
@@ -122,14 +129,20 @@ static void analogix_dp_psr_work(struct work_struct *work)
return;
}

-   spin_lock_irqsave(>psr_lock, flags);
-   psr_state = dp->psr_state;
-   spin_unlock_irqrestore(>psr_lock, flags);
-
-   if (psr_state == EDP_VSC_PSR_STATE_ACTIVE)
-   analogix_dp_enable_psr(dp->dev);
-   else
-   analogix_dp_disable_psr(dp->dev);
+   if (psr_state == EDP_VSC_PSR_STATE_ACTIVE) {
+   ret = analogix_dp_enable_psr(dp->dev);
+   if (ret) {
+   dev_err(dp->dev, "failed to enable psr\n");
+   return;
+   }
+   rockchip_drm_vop_set_standby(crtc, true);
+   } else {
+   ret = analogix_dp_disable_psr(dp->dev);
+   if (ret) {
+   dev_err(dp->dev, "failed to disable psr\n");
+   return;
+   }
+   }
 }

 static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
index fb6226c..7149c69 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
@@ -74,5 +74,6 @@ 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);
+void rockchip_drm_vop_set_standby(struct drm_crtc *crtc, bool enabled);

 #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 1740a0b..13eabda 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1478,6 +1478,25 @@ int rockchip_drm_wait_line_flag(struct drm_crtc *crtc, 
unsigned int line_num,
 }
 EXPORT_SYMBOL(rockchip_drm_wait_line_flag);

+void rockchip_drm_vop_set_standby(struct drm_crtc *crtc, bool enabled)
+{
+   struct vop *vop = to_vop(crtc);
+
+   if (!crtc || !vop->is_enabled)
+   return;
+
+   spin_lock(>reg_lock);
+
+   if (enabled)
+   VOP_CTRL_SET(vop, standby, 1);
+   else
+   VOP_CTRL_SET(vop, standby, 0);
+
+   spin_unlock(>reg_lock);
+
+}
+EXPORT_SYMBOL(rockchip_drm_vop_set_standby);
+
 static int vop_bind(struct device *dev, struct device *master, void *data)
 {
struct platform_device *pdev = to_platform_device(dev);
-- 
1.9.1




[PATCH v3 5/6] drm: bridge/analogix: add fast link train for eDP

2016-10-18 Thread Zain Wang
From: zain wang 

we would meet a short black screen when exit PSR with the full link
training, In this case, we should use fast link train instead of full
link training.

Signed-off-by: zain wang 
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 89 +-
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  1 +
 2 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 561b644..0516621 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -35,6 +36,8 @@

 #define to_dp(nm)  container_of(nm, struct analogix_dp_device, nm)

+static const int FAST_LINK_VERIFICATION = false;
+
 struct bridge_init {
struct i2c_client *client;
struct device_node *node;
@@ -244,6 +247,7 @@ static int analogix_dp_link_start(struct analogix_dp_device 
*dp)
usleep_range(90, 120);
}

+
/* Set training pattern 1 */
analogix_dp_set_training_pattern(dp, TRAINING_PTN1);

@@ -481,7 +485,7 @@ static int analogix_dp_process_equalizer_training(struct 
analogix_dp_device *dp)
 {
int lane, lane_count, retval;
u32 reg;
-   u8 link_align, link_status[2], adjust_request[2];
+   u8 link_align, link_status[2], adjust_request[2], spread;

usleep_range(400, 401);

@@ -524,6 +528,12 @@ static int analogix_dp_process_equalizer_training(struct 
analogix_dp_device *dp)
dev_dbg(dp->dev, "final lane count = %.2x\n",
dp->link_train.lane_count);

+   drm_dp_dpcd_readb(>aux, DP_MAX_DOWNSPREAD, );
+   dp->fast_train_support = (spread &
+   DP_NO_AUX_HANDSHAKE_LINK_TRAINING) ? true : false;
+   dev_dbg(dp->dev, "fast link training %s\n",
+   dp->fast_train_support ? "supported" : "unsupported");
+
/* set enhanced mode if available */
analogix_dp_set_enhanced_mode(dp);
dp->link_train.lt_state = FINISHED;
@@ -655,6 +665,75 @@ static int analogix_dp_sw_link_training(struct 
analogix_dp_device *dp)
return retval;
 }

+static int analogix_dp_full_link_train(struct analogix_dp_device *dp,
+   u32 count, u32 bwtype)
+{
+   analogix_dp_init_training(dp, count, bwtype);
+   return analogix_dp_sw_link_training(dp);
+}
+
+static int analogix_dp_fast_link_train(struct analogix_dp_device *dp)
+{
+   int lane;
+   int retval;
+   u8 link_align, link_status[2];
+   enum pll_status status;
+
+   analogix_dp_reset_macro(dp);
+
+   analogix_dp_set_link_bandwidth(dp, dp->link_train.link_rate);
+   analogix_dp_set_lane_count(dp, dp->link_train.lane_count);
+
+   for (lane = 0; lane < dp->link_train.lane_count; lane++) {
+   analogix_dp_set_lane_link_training(dp,
+   dp->link_train.training_lane[lane], lane);
+   }
+
+   retval = readx_poll_timeout(analogix_dp_get_pll_lock_status, dp, status,
+   status != PLL_UNLOCKED,
+   120, 120 * DP_TIMEOUT_LOOP_COUNT);
+
+   if (retval)
+   return retval;
+
+   /* source Set training pattern 1 */
+   analogix_dp_set_training_pattern(dp, TRAINING_PTN1);
+   usleep_range(500, 600);
+
+   analogix_dp_set_training_pattern(dp, TRAINING_PTN2);
+   usleep_range(500, 600);
+
+   /* TODO: enhanced_mode?*/
+   analogix_dp_set_training_pattern(dp, DP_NONE);
+
+   if (FAST_LINK_VERIFICATION) {
+   retval = drm_dp_dpcd_readb(>aux,
+  DP_LANE_ALIGN_STATUS_UPDATED,
+  _align);
+   if (retval < 0)
+   return retval;
+
+   retval = drm_dp_dpcd_read(>aux, DP_LANE0_1_STATUS,
+ link_status, 2);
+   if (retval < 0)
+   return retval;
+
+   if (analogix_dp_clock_recovery_ok(link_status,
+ dp->link_train.lane_count)) {
+   analogix_dp_reduce_link_rate(dp);
+   return -EIO;
+   }
+
+   if (analogix_dp_channel_eq_ok(link_status, link_align,
+ dp->link_train.lane_count)) {
+   analogix_dp_reduce_link_rate(dp);
+   return -EIO;
+   }
+   }
+
+   return 0;
+}
+
 static int analogix_dp_set_link_train(struct analogix_dp_device *dp,
  u32 count, u32 bwtype)
 {
@@ -662,11 +741,13 @@ static int 

[PATCH v3 4/6] drm: bridge/analogix: switch Main-link and eDP PHY when enable/disable psr

2016-10-18 Thread Zain Wang
From: zain wang 

turn off Main-link and power down eDP PHY when enable psr,
turn on Main-link and power up eDP PHY when disable psr.

Signed-off-by: zain wang 
---

Changes in v3:
- detecting PSR state at enable/disable_psr() avoid to make link training
  when sink in not PSR State.

Changes in v2:
- misc changes

 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 123 +
 1 file changed, 76 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index c4f139a..c662e5d 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -98,50 +98,6 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device 
*dp)
return 0;
 }

-int analogix_dp_enable_psr(struct device *dev)
-{
-   struct analogix_dp_device *dp = dev_get_drvdata(dev);
-   struct edp_vsc_psr psr_vsc;
-
-   if (!dp->psr_support)
-   return -EINVAL;
-
-   /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
-   memset(_vsc, 0, sizeof(psr_vsc));
-   psr_vsc.sdp_header.HB0 = 0;
-   psr_vsc.sdp_header.HB1 = 0x7;
-   psr_vsc.sdp_header.HB2 = 0x2;
-   psr_vsc.sdp_header.HB3 = 0x8;
-
-   psr_vsc.DB0 = 0;
-   psr_vsc.DB1 = EDP_VSC_PSR_STATE_ACTIVE | EDP_VSC_PSR_CRC_VALUES_VALID;
-
-   return analogix_dp_send_psr_spd(dp, _vsc);
-}
-EXPORT_SYMBOL_GPL(analogix_dp_enable_psr);
-
-int analogix_dp_disable_psr(struct device *dev)
-{
-   struct analogix_dp_device *dp = dev_get_drvdata(dev);
-   struct edp_vsc_psr psr_vsc;
-
-   if (!dp->psr_support)
-   return -EINVAL;
-
-   /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
-   memset(_vsc, 0, sizeof(psr_vsc));
-   psr_vsc.sdp_header.HB0 = 0;
-   psr_vsc.sdp_header.HB1 = 0x7;
-   psr_vsc.sdp_header.HB2 = 0x2;
-   psr_vsc.sdp_header.HB3 = 0x8;
-
-   psr_vsc.DB0 = 0;
-   psr_vsc.DB1 = 0;
-
-   return analogix_dp_send_psr_spd(dp, _vsc);
-}
-EXPORT_SYMBOL_GPL(analogix_dp_disable_psr);
-
 static bool analogix_dp_detect_sink_psr(struct analogix_dp_device *dp)
 {
unsigned char psr_version;
@@ -162,12 +118,11 @@ static void analogix_dp_enable_sink_psr(struct 
analogix_dp_device *dp)
drm_dp_dpcd_writeb(>aux, DP_PSR_EN_CFG, psr_en);

/* Main-Link transmitter remains active during PSR active states */
-   psr_en = DP_PSR_MAIN_LINK_ACTIVE | DP_PSR_CRC_VERIFICATION;
+   psr_en = DP_PSR_CRC_VERIFICATION;
drm_dp_dpcd_writeb(>aux, DP_PSR_EN_CFG, psr_en);

/* Enable psr function */
-   psr_en = DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE |
-DP_PSR_CRC_VERIFICATION;
+   psr_en = DP_PSR_ENABLE | DP_PSR_CRC_VERIFICATION;
drm_dp_dpcd_writeb(>aux, DP_PSR_EN_CFG, psr_en);

analogix_dp_enable_psr_crc(dp);
@@ -870,6 +825,80 @@ static void analogix_dp_commit(struct analogix_dp_device 
*dp)
analogix_dp_enable_sink_psr(dp);
 }

+int analogix_dp_enable_psr(struct device *dev)
+{
+   struct analogix_dp_device *dp = dev_get_drvdata(dev);
+   struct edp_vsc_psr psr_vsc;
+   int retval;
+   u8 sink;
+
+   if (!dp->psr_support)
+   return -EINVAL;
+
+   drm_dp_dpcd_readb(>aux, DP_PSR_STATUS, );
+   if (sink == DP_PSR_SINK_ACTIVE_RFB)
+   return 0;
+
+   /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
+   memset(_vsc, 0, sizeof(psr_vsc));
+   psr_vsc.sdp_header.HB0 = 0;
+   psr_vsc.sdp_header.HB1 = 0x7;
+   psr_vsc.sdp_header.HB2 = 0x2;
+   psr_vsc.sdp_header.HB3 = 0x8;
+
+   psr_vsc.DB0 = 0;
+   psr_vsc.DB1 = EDP_VSC_PSR_STATE_ACTIVE | EDP_VSC_PSR_CRC_VALUES_VALID;
+
+   retval = analogix_dp_send_psr_spd(dp, _vsc);
+
+   if (!retval) {
+   /* Power down the eDP PHY */
+   analogix_dp_set_analog_power_down(dp, POWER_ALL, true);
+   }
+
+   return retval;
+}
+EXPORT_SYMBOL_GPL(analogix_dp_enable_psr);
+
+int analogix_dp_disable_psr(struct device *dev)
+{
+   struct analogix_dp_device *dp = dev_get_drvdata(dev);
+   struct edp_vsc_psr psr_vsc;
+   int ret;
+   u8 sink;
+
+   if (!dp->psr_support)
+   return -EINVAL;
+
+   /* Power up the eDP PHY */
+   analogix_dp_set_analog_power_down(dp, POWER_ALL, false);
+
+   drm_dp_dpcd_readb(>aux, DP_PSR_STATUS, );
+   if (sink == DP_PSR_SINK_INACTIVE)
+   return 0;
+
+   ret = drm_dp_dpcd_writeb(>aux, DP_SET_POWER, DP_SET_POWER_D0);
+   if (ret < 0) {
+   dev_err(dp->dev, "Failed to set DP Power0\n");
+   }
+
+   analogix_dp_set_link_train(dp, dp->video_info.max_lane_count,
+  dp->video_info.max_link_rate);
+
+   /* Prepare VSC packet as per EDP 1.4 spec, Table 6.9 */
+   memset(_vsc, 0, sizeof(psr_vsc));
+   

[PATCH 1/2] drm: make is_lspcon_adaptor static

2016-10-18 Thread Jani Nikula
Fixes sparse warning:

drivers/gpu/drm/drm_dp_dual_mode_helper.c:151:6: warning: symbol
'is_lspcon_adaptor' was not declared. Should it be static?

Fixes: 056996b95686 ("drm: Helper for lspcon in drm_dp_dual_mode")
Cc: Rodrigo Vivi 
Cc: Shashank Sharma 
Cc: 
Signed-off-by: Jani Nikula 

---

n.b. 056996b95686 ("drm: Helper for lspcon in drm_dp_dual_mode") has
been merged via drm-intel tree
---
 drivers/gpu/drm/drm_dp_dual_mode_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c 
b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
index a7aeb1ec852c..2624e266abbd 100644
--- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c
+++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
@@ -148,8 +148,8 @@ static bool is_type2_adaptor(uint8_t adaptor_id)
  DP_DUAL_MODE_REV_TYPE2);
 }

-bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
-   const uint8_t adaptor_id)
+static bool is_lspcon_adaptor(const char hdmi_id[DP_DUAL_MODE_HDMI_ID_LEN],
+ const uint8_t adaptor_id)
 {
return is_hdmi_adaptor(hdmi_id) &&
(adaptor_id == (DP_DUAL_MODE_TYPE_TYPE2 |
-- 
2.1.4



[PATCH v3 3/6] drm/bridge: analogix_dp: detect Sink PSR state after configuring the PSR

2016-10-18 Thread Zain Wang
From: Yakir Yang 

Make sure the request PSR state takes effect in analogix_dp_send_psr_spd()
function, or print the sink PSR error state if we failed to apply the
requested PSR setting.

Signed-off-by: zain wang 
Signed-off-by: Yakir Yang 
---

Changes in v3: None
Changes in v2: None

 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |  6 ++
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |  6 --
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  | 25 --
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c|  6 --
 4 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index bcae4dd..7faad93 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -124,8 +124,7 @@ int analogix_dp_enable_psr(struct device *dev)
psr_vsc.DB0 = 0;
psr_vsc.DB1 = EDP_VSC_PSR_STATE_ACTIVE | EDP_VSC_PSR_CRC_VALUES_VALID;

-   analogix_dp_send_psr_spd(dp, _vsc);
-   return 0;
+   return analogix_dp_send_psr_spd(dp, _vsc);
 }
 EXPORT_SYMBOL_GPL(analogix_dp_enable_psr);

@@ -147,8 +146,7 @@ int analogix_dp_disable_psr(struct device *dev)
psr_vsc.DB0 = 0;
psr_vsc.DB1 = 0;

-   analogix_dp_send_psr_spd(dp, _vsc);
-   return 0;
+   return analogix_dp_send_psr_spd(dp, _vsc);
 }
 EXPORT_SYMBOL_GPL(analogix_dp_disable_psr);

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
index 5c6a288..cdc0535 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
@@ -20,6 +20,8 @@
 #define MAX_CR_LOOP 5
 #define MAX_EQ_LOOP 5

+#define DP_TIMEOUT_PSR_LOOP_MS msecs_to_jiffies(300)
+
 /* DP_MAX_LANE_COUNT */
 #define DPCD_ENHANCED_FRAME_CAP(x) (((x) >> 7) & 0x1)
 #define DPCD_MAX_LANE_COUNT(x) ((x) & 0x1f)
@@ -247,8 +249,8 @@ 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,
- struct edp_vsc_psr *vsc);
+int analogix_dp_send_psr_spd(struct analogix_dp_device *dp,
+struct edp_vsc_psr *vsc);
 ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
 struct drm_dp_aux_msg *msg);

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index cd37ac0..9e1177c 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
@@ -992,10 +992,12 @@ void analogix_dp_enable_psr_crc(struct analogix_dp_device 
*dp)
writel(PSR_VID_CRC_ENABLE, dp->reg_base + ANALOGIX_DP_CRC_CON);
 }

-void analogix_dp_send_psr_spd(struct analogix_dp_device *dp,
- struct edp_vsc_psr *vsc)
+int analogix_dp_send_psr_spd(struct analogix_dp_device *dp,
+struct edp_vsc_psr *vsc)
 {
+   unsigned long timeout;
unsigned int val;
+   u8 sink;

/* don't send info frame */
val = readl(dp->reg_base + ANALOGIX_DP_PKT_SEND_CTL);
@@ -1036,6 +1038,25 @@ void analogix_dp_send_psr_spd(struct analogix_dp_device 
*dp,
val = readl(dp->reg_base + ANALOGIX_DP_PKT_SEND_CTL);
val |= IF_EN;
writel(val, dp->reg_base + ANALOGIX_DP_PKT_SEND_CTL);
+
+   timeout = jiffies + DP_TIMEOUT_PSR_LOOP_MS;
+   while (time_before(jiffies, timeout)) {
+   val = drm_dp_dpcd_readb(>aux, DP_PSR_STATUS, );
+   if (val != 1) {
+   dev_err(dp->dev, "PSR_STATUS read failed ret=%d", val);
+   return -EBUSY;
+   }
+
+   if ((vsc->DB1 && sink == DP_PSR_SINK_ACTIVE_RFB) ||
+   (!vsc->DB1 && sink == DP_PSR_SINK_INACTIVE))
+   return 0;
+
+   usleep_range(1000, 1500);
+   }
+
+   dev_warn(dp->dev, "Failed to apply PSR, sink state was [%x]", sink);
+
+   return -ETIMEDOUT;
 }

 ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index e5471e7..1c2d756 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -105,7 +105,7 @@ static void analogix_dp_psr_work(struct work_struct *work)
struct rockchip_dp_device *dp =
container_of(work, typeof(*dp), psr_work);
struct drm_crtc *crtc = dp->encoder.crtc;
-   

[PATCH v4 3/9] drm/hisilicon/hibmc: Add support for frame buffer

2016-10-18 Thread Daniel Vetter
On Tue, Oct 18, 2016 at 07:19:05PM +0800, Rongrong Zou wrote:
> Hi Daniel,
> 
> Thanks for your review!
> 
> 在 2016/10/18 15:49, Daniel Vetter 写道:
> > On Tue, Oct 18, 2016 at 12:01:18PM +0800, Rongrong Zou wrote:
> > > Add support for fbdev and framebuffer.
> > > 
> > > Signed-off-by: Rongrong Zou 
> > > ---
> > >   drivers/gpu/drm/hisilicon/hibmc/Makefile  |   2 +-
> > >   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   |  25 +++
> > >   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h   |  25 +++
> > >   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 257 
> > > ++
> > >   drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c   |  67 ++
> > >   5 files changed, 375 insertions(+), 1 deletion(-)
> > >   create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
> > > 
> > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile 
> > > b/drivers/gpu/drm/hisilicon/hibmc/Makefile
> > > index d5c40b8..810a37e 100644
> > > --- a/drivers/gpu/drm/hisilicon/hibmc/Makefile
> > > +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile
> > > @@ -1,5 +1,5 @@
> > >   ccflags-y := -Iinclude/drm
> > > -hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o hibmc_ttm.o
> > > +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_fbdev.o hibmc_drm_power.o 
> > > hibmc_ttm.o
> > > 
> > >   obj-$(CONFIG_DRM_HISI_HIBMC)+=hibmc-drm.o
> > >   #obj-y  += hibmc-drm.o
> > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
> > > b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > index e118f3b..8ddb763 100644
> > > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > @@ -66,11 +66,31 @@ static void hibmc_disable_vblank(struct drm_device 
> > > *dev, unsigned int pipe)
> > > 
> > >   static int hibmc_pm_suspend(struct device *dev)
> > >   {
> > > + struct pci_dev *pdev = to_pci_dev(dev);
> > > + struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > + struct hibmc_drm_device *hidev = drm_dev->dev_private;
> > > +
> > > + if (hidev->fbdev.initialized) {
> > 
> > What do you need these checks for? This looks a bit fishy tbh ...
> 
> It is delivered from the bochs driver, and I will fix if there are
> any problems, Thanks.

Yeah, existing drivers aren't up to latest best practices. Not sure why
that was added to bochs really ...

> 
> > 
> > > + console_lock();
> > > + drm_fb_helper_set_suspend(>fbdev.helper, 1);
> > > + console_unlock();
> > 
> > drm_fb_helper_set_suspend_unlocked is the new fancy one. Please use that
> > one instead. Also, that has the check you might need already included,
> > which means you can nuke this entire function here and just call it
> > directly.
> 
> So it should be wrote as:
> static int hibmc_pm_suspend(struct device *dev)
> {
>   ...
>   drm_kms_helper_poll_disable(drm_dev);
>   drm_fb_helper_set_suspend_unlocked(>fbdev.helper, 1);
>   ...
> }
> 
> static int hibmc_pm_resume(struct device *dev)
> {
>   ...
>   drm_helper_resume_force_mode(drm_dev);
>   drm_fb_helper_set_suspend_unlocked(>fbdev.helper, 0);
>   drm_kms_helper_poll_enable(drm_dev);
>   ...
> }, is it ?

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


[Bug 178281] wine-staging apps freezes the machine with RX460

2016-10-18 Thread bugzilla-dae...@bugzilla.kernel.org
https://bugzilla.kernel.org/show_bug.cgi?id=178281

Alex Deucher  changed:

   What|Removed |Added

 CC||alexdeucher at gmail.com

--- Comment #1 from Alex Deucher  ---
This is more likely a mesa issue than a kernel issue.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


[PATCH v3 2/6] drm/bridge: remove dp init from analogix_dp_bind

2016-10-18 Thread Zain Wang
From: zain wang 

phy_power_on() and analogix_dp_init_dp would be called in bridge_eanble,
so remove them from analogix_dp_bind to be clear.

Signed-off-by: zain wang 
---

Changes in v3:
- remove changes before
- remove phy_power_on() and analogix_dp_init_dp from analogix_dp_bind().

Changes in v2: None

 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 001b075..bcae4dd 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1389,10 +1389,6 @@ int analogix_dp_bind(struct device *dev, struct 
drm_device *drm_dev,

pm_runtime_enable(dev);

-   phy_power_on(dp->phy);
-
-   analogix_dp_init_dp(dp);
-
ret = devm_request_threaded_irq(>dev, dp->irq,
analogix_dp_hardirq,
analogix_dp_irq_thread,
-- 
1.9.1




[PATCH v3 1/6] drm/bridge: analogix_dp: set psr activate/deactivate when enable/disable bridge

2016-10-18 Thread Zain Wang
From: zain wang 

There's a race between when bridge_disable and when vop_crtc_disable are called.
If the flush timer triggers a new psr work between these, we will operate eDP
without power shutdowned by bridge_disable.
In this case, moving activate/deactivate to enable/disable bridge to avoid it.

Signed-off-by: zain wang 
---

Changes in v3:
- remove changes before.
- move psr activat/deactivate to enable/disable bridge.

Changes in v2:
- add spin_lock to protect dpms_mode


 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c |  4 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 30 -
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h |  4 ++--
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c |  4 
 4 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c 
b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 8548e82..e5471e7 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -159,7 +159,7 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data 
*plat_data)
return ret;
}

-   return 0;
+   return rockchip_drm_psr_activate(>encoder);
 }

 static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)
@@ -168,7 +168,7 @@ static int rockchip_dp_powerdown(struct 
analogix_dp_plat_data *plat_data)

clk_disable_unprepare(dp->pclk);

-   return 0;
+   return rockchip_drm_psr_deactivate(>encoder);
 }

 static int rockchip_dp_get_modes(struct analogix_dp_plat_data *plat_data,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
index a553e18..4c379e9 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
@@ -57,6 +57,24 @@ out:
return psr;
 }

+static struct psr_drv *find_psr_by_encoder(struct drm_encoder *encoder)
+{
+   struct rockchip_drm_private *drm_drv = encoder->dev->dev_private;
+   struct psr_drv *psr;
+   unsigned long flags;
+
+   spin_lock_irqsave(_drv->psr_list_lock, flags);
+   list_for_each_entry(psr, _drv->psr_list, list) {
+   if (psr->encoder == encoder)
+   goto out;
+   }
+   psr = ERR_PTR(-ENODEV);
+
+out:
+   spin_unlock_irqrestore(_drv->psr_list_lock, flags);
+   return psr;
+}
+
 static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state)
 {
/*
@@ -115,14 +133,14 @@ static void psr_flush_handler(unsigned long data)

 /**
  * rockchip_drm_psr_activate - activate PSR on the given pipe
- * @crtc: CRTC to obtain the PSR encoder
+ * @encoder: encoder to obtain the PSR encoder
  *
  * Returns:
  * Zero on success, negative errno on failure.
  */
-int rockchip_drm_psr_activate(struct drm_crtc *crtc)
+int rockchip_drm_psr_activate(struct drm_encoder *encoder)
 {
-   struct psr_drv *psr = find_psr_by_crtc(crtc);
+   struct psr_drv *psr = find_psr_by_encoder(encoder);
unsigned long flags;

if (IS_ERR(psr))
@@ -138,14 +156,14 @@ EXPORT_SYMBOL(rockchip_drm_psr_activate);

 /**
  * rockchip_drm_psr_deactivate - deactivate PSR on the given pipe
- * @crtc: CRTC to obtain the PSR encoder
+ * @encoder: encoder to obtain the PSR encoder
  *
  * Returns:
  * Zero on success, negative errno on failure.
  */
-int rockchip_drm_psr_deactivate(struct drm_crtc *crtc)
+int rockchip_drm_psr_deactivate(struct drm_encoder *encoder)
 {
-   struct psr_drv *psr = find_psr_by_crtc(crtc);
+   struct psr_drv *psr = find_psr_by_encoder(encoder);
unsigned long flags;

if (IS_ERR(psr))
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.h 
b/drivers/gpu/drm/rockchip/rockchip_drm_psr.h
index b420cf1..b1ea015 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.h
@@ -18,8 +18,8 @@
 void rockchip_drm_psr_flush_all(struct drm_device *dev);
 int rockchip_drm_psr_flush(struct drm_crtc *crtc);

-int rockchip_drm_psr_activate(struct drm_crtc *crtc);
-int rockchip_drm_psr_deactivate(struct drm_crtc *crtc);
+int rockchip_drm_psr_activate(struct drm_encoder *encoder);
+int rockchip_drm_psr_deactivate(struct drm_encoder *encoder);

 int rockchip_drm_psr_register(struct drm_encoder *encoder,
void (*psr_set)(struct drm_encoder *, bool enable));
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index c7eba30..1740a0b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -566,8 +566,6 @@ static void vop_crtc_disable(struct drm_crtc *crtc)

WARN_ON(vop->event);

-   rockchip_drm_psr_deactivate(>crtc);
-
/*
 * We need to make sure that all windows are disabled before we
 * disable that crtc. Otherwise we might try to scan from a destroyed

[PATCH v3 0/6] Misc changes to Rockchip PSR drivers

2016-10-18 Thread Zain Wang
This serise of patches works for saving power on eDP PHY and VOP during PSR.

BR,
- Zain

Changes in v3:
- add new patch to support fast link training.
- add new patch to make VOP standby when entry PSR.
- Misc changes.

Changes in v2:
- add spin_lock to protect dpms_mode
- misc changes.

Yakir Yang (1):
  drm/bridge: analogix_dp: detect Sink PSR state after configuring the
PSR

zain wang (5):
  drm/bridge: analogix_dp: set psr activate/deactivate when
enable/disable bridge
  drm/bridge: remove dp init from analogix_dp_bind
  drm: bridge/analogix: switch Main-link and eDP PHY when enable/disable
psr
  drm: bridge/analogix: add fast link train for eDP
  drm: bridge/analogix: enable vop standby when entry PSR

 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 218 +++--
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.h |   7 +-
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c  |  25 ++-
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c|  33 +++-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h|   1 +
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c|  30 ++-
 drivers/gpu/drm/rockchip/rockchip_drm_psr.h|   4 +-
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c|  23 ++-
 8 files changed, 259 insertions(+), 82 deletions(-)

-- 
1.9.1




[PATCH 10/10] dim: s/drm-nightly/drm-tip

2016-10-18 Thread Daniel Vetter
tip = testing and integration pile

Also rename drm-intel-rerere directory to drm-rerere.

Signed-off-by: Daniel Vetter 
---
 dim| 48 
 dim.rst| 16 +++-
 dimrc.sample   |  2 +-
 drm-intel-flow.dot | 18 +-
 drm-intel.rst  | 20 +++-
 5 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/dim b/dim
index de01f0addeaf..fd3800e8c078 100755
--- a/dim
+++ b/dim
@@ -78,7 +78,7 @@ dim=$(basename $0)
 today=`date +%Y-%m-%d`

 drm_intel_ssh=ssh://git.freedesktop.org/git/drm-intel
-drm_nightly_ssh=ssh://git.freedesktop.org/git/drm-nightly
+drm_tip_ssh=ssh://git.freedesktop.org/git/drm-tip
 drm_intel_git=git://anongit.freedesktop.org/drm-intel
 drm_upstream_git=git://people.freedesktop.org/~airlied/linux
 
linux_upstream_git=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
@@ -151,7 +151,7 @@ fi
 #

 if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a "$subcommand" != 
"usage" ]; then
-   for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL 
$DIM_PREFIX/drm-intel-rerere $DIM_PREFIX/drm-intel-nightly; do
+   for d in $DIM_PREFIX $DIM_PREFIX/$DIM_DRM_INTEL $DIM_PREFIX/drm-rerere 
$DIM_PREFIX/drm-tip; do
if [ ! -d $d ]; then
echo "$d is missing, please check your configuration 
and/or run dim setup"
exit 1
@@ -162,7 +162,7 @@ if [ "$subcommand" != "setup" -a "$subcommand" != "help" -a 
"$subcommand" != "us
# Internal configuration that depends on a sane setup.
#

-   dim_branches=`(source $DIM_PREFIX/drm-intel-rerere/nightly.conf ; echo 
$nightly_branches) | \
+   dim_branches=`(source $DIM_PREFIX/drm-rerere/nightly.conf ; echo 
$nightly_branches) | \
xargs -n 1 echo | grep '^origin' | sed -e 's/^origin\///'`
 fi

@@ -244,7 +244,7 @@ function map_nightly_remote

 function update_linux_next
 {
-   cd $DIM_PREFIX/drm-intel-nightly
+   cd $DIM_PREFIX/drm-tip

local nightly_origin=`map_nightly_remote origin`

@@ -283,8 +283,8 @@ function check_conflicts

 function rr_cache_dir
 {
-   if [ -d $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ ] ; then
-   echo $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/
+   if [ -d $DIM_PREFIX/drm-tip/.git/rr-cache/ ] ; then
+   echo $DIM_PREFIX/drm-tip/.git/rr-cache/
else
echo $DIM_PREFIX/$DIM_DRM_INTEL/.git/rr-cache/
fi
@@ -292,7 +292,7 @@ function rr_cache_dir

 function update_rerere_cache
 {
-   cd $DIM_PREFIX/drm-intel-rerere/
+   cd $DIM_PREFIX/drm-rerere/
git pull
cp rr-cache/* `rr_cache-dir` -r
cd -
@@ -300,12 +300,12 @@ function update_rerere_cache

 function dim_rebuild_nightly
 {
-   local integration_branch=drm-intel-nightly
+   local integration_branch=drm-tip
local specfile=`mktemp`
local time="`date --utc +%Yy-%mm-%dd-%Hh-%Mm-%Ss` UTC"
local first=1

-   local rerere=$DIM_PREFIX/drm-intel-rerere
+   local rerere=$DIM_PREFIX/drm-rerere

cd $rerere
if [[ `git status --porcelain | grep -v "^[ ?][ ?]" | wc -l` -gt 0 ]]; 
then
@@ -512,7 +512,7 @@ function dim_apply_next_fixes

 function dim_cherry_pick
 {
-   local nightly_remote=`get_remote_name $drm_nightly_ssh`
+   local nightly_remote=`get_remote_name $drm_tip_ssh`

if [[ "x$1" = "x" ]]; then
echo "usage: $dim $subcommand commit-ish"
@@ -524,7 +524,7 @@ function dim_cherry_pick
# need latest -nightly
git fetch $nightly_remote
echo Possible fixup patches for your cherry-pick:
-   git log --grep=$sha_short --pretty=oneline 
$sha..$nightly_remote/drm-intel-nightly
+   git log --grep=$sha_short --pretty=oneline $sha..$nightly_remote/drm-tip
$DRY git cherry-pick -s -x -e $1
 }

@@ -649,7 +649,7 @@ function dim_create_branch

$DRY git branch $branch $start
git push $DRY_RUN $DIM_DRM_INTEL_REMOTE +$branch --set-upstream
-   cd $DIM_PREFIX/drm-intel-rerere
+   cd $DIM_PREFIX/drm-rerere
$DRY echo "nightly_branches=\"\$nightly_branches origin/$branch\"" \
 >> nightly.conf
$DRY git add nightly.conf
@@ -674,10 +674,10 @@ function dim_remove_branch
rm -R $DIM_PREFIX/$branch
fi

-   cd $DIM_PREFIX/drm-intel-nightly
+   cd $DIM_PREFIX/drm-tip
git push $DRY_RUN origin --delete $branch
$DRY git fetch origin --prune
-   cd $DIM_PREFIX/drm-intel-rerere
+   cd $DIM_PREFIX/drm-rerere
full_branch="origin/$branch"
$DRY sed -e "/${full_branch//\//\\\/}/d" -i nightly.conf
$DRY git add nightly.conf
@@ -893,17 +893,17 @@ function dim_for_each_workdirs

 function dim_update_next
 {
-   local nightly_remote=`get_remote_name $drm_nightly_ssh`
+   local nightly_remote=`get_remote_name $drm_tip_ssh`

assert_branch 

[PATCH 09/10] dim: Split out drm-nightly.git

2016-10-18 Thread Daniel Vetter
This is a prep step to eventually split out the drm-misc branches all
into their own repo. To get there we first need to split out the
integration tree mangling.

Since dim doesn't auto-update and since the transition is a good
reason to switch over to worktrees and it's tricky it's not scripted.
The following needs to be done when dim rebuild-nightly fails:

- Make sure you have the latest dim version.

- Good to also check you have a recent-ish git. Latest dim supports
  git worktree to save on disk space needed for .git metadata. It's
  much more robust than the git alternates storage trick we've used
  thus far. Note that git worktree is still optional (but that's not a
  recommended setup).

- Delete $DIM_PREFIX/{drm-intel-rerere,drm-intel-nightly,maintainer-tools}
  It's not strictly needed to kill the maintainer-tools checkout too,
  but might as well switch it over to git worktree too.

- Make sure you don't have any branches left over for drm-intel-rerere
  and drm-intel-nightly anywhere (since they need to switch their
  remotes).

- run dim setup and enjoy the new awesomeness.

If it breaks, I'm guilty ;-)

Signed-off-by: Daniel Vetter 
---
 dim | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/dim b/dim
index 20a3143a5c1e..de01f0addeaf 100755
--- a/dim
+++ b/dim
@@ -78,6 +78,7 @@ dim=$(basename $0)
 today=`date +%Y-%m-%d`

 drm_intel_ssh=ssh://git.freedesktop.org/git/drm-intel
+drm_nightly_ssh=ssh://git.freedesktop.org/git/drm-nightly
 drm_intel_git=git://anongit.freedesktop.org/drm-intel
 drm_upstream_git=git://people.freedesktop.org/~airlied/linux
 
linux_upstream_git=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
@@ -511,6 +512,8 @@ function dim_apply_next_fixes

 function dim_cherry_pick
 {
+   local nightly_remote=`get_remote_name $drm_nightly_ssh`
+
if [[ "x$1" = "x" ]]; then
echo "usage: $dim $subcommand commit-ish"
exit 1
@@ -519,9 +522,9 @@ function dim_cherry_pick
sha_short=${sha:0:8}

# need latest -nightly
-   git fetch $DIM_DRM_INTEL_REMOTE
+   git fetch $nightly_remote
echo Possible fixup patches for your cherry-pick:
-   git log --grep=$sha_short --pretty=oneline 
$sha..$DIM_DRM_INTEL_REMOTE/drm-intel-nightly
+   git log --grep=$sha_short --pretty=oneline 
$sha..$nightly_remote/drm-intel-nightly
$DRY git cherry-pick -s -x -e $1
 }

@@ -890,15 +893,17 @@ function dim_for_each_workdirs

 function dim_update_next
 {
+   local nightly_remote=`get_remote_name $drm_nightly_ssh`
+
assert_branch drm-intel-next-queued

git pull --ff-only

-   if ! git branch --merged $DIM_DRM_INTEL_REMOTE/drm-intel-nightly | grep 
drm-intel-fixes &> /dev/null ; then
+   if ! git branch --merged $nightly_remote/drm-intel-nightly | grep 
drm-intel-fixes &> /dev/null ; then
echo "drm-intel-fixes not merged into -nigthly, please update!"
exit 2
fi
-   if ! git branch --merged $DIM_DRM_INTEL_REMOTE/drm-intel-nightly | grep 
drm-intel-next-queued &> /dev/null ; then
+   if ! git branch --merged $nightly_remote/drm-intel-nightly | grep 
drm-intel-next-queued &> /dev/null ; then
echo "drm-intel-next-queued not merged into -nigthly, please 
update!"
exit 2
fi
@@ -920,6 +925,8 @@ function dim_update_next

 function dim_update_next_continue
 {
+   local nightly_remote=`get_remote_name $drm_nightly_ssh`
+
assert_branch drm-intel-next-queued

git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE 
drm-intel-next-queued:drm-intel-next
@@ -928,7 +935,7 @@ function dim_update_next_continue
git push $DRY_RUN -f $DIM_DRM_INTEL_REMOTE $tag

echo "Updating -testing to latest -nightly"
-   git push $DRY_RUN $DIM_DRM_INTEL_REMOTE 
+$DIM_DRM_INTEL_REMOTE/drm-intel-nightly:drm-intel-testing
+   git push $DRY_RUN $DIM_DRM_INTEL_REMOTE 
+$nightly_remote/drm-intel-nightly:drm-intel-testing
$DRY git tag -f drm-intel-testing-$today 
$DIM_DRM_INTEL_REMOTE/drm-intel-testing
$DRY git push -f $DIM_DRM_INTEL_REMOTE drm-intel-testing-$today

@@ -1134,15 +1141,16 @@ function dim_setup
# check remote configuration
remote=`get_remote_name $linux_upstream_git`
remote=`get_remote_name $drm_intel_ssh`
+   remote=`get_remote_name $drm_nightly_ssh`
remote=`get_remote_name $drm_upstream_git`

cd ..

setup_aux_checkout maintainer-tools $drm_intel_ssh maintainer-tools

-   setup_aux_checkout rerere-cache $drm_intel_ssh drm-intel-rerere
+   setup_aux_checkout rerere-cache $drm_nightly_ssh drm-intel-rerere

-   setup_aux_checkout drm-intel-nightly $drm_intel_ssh drm-intel-nightly
+   setup_aux_checkout drm-intel-nightly $drm_nightly_ssh drm-intel-nightly
cd drm-intel-nightly
if git remote | grep drm-upstream > /dev/null ; then
git config 

[PATCH 08/10] dim: remove integration-tree remotes

2016-10-18 Thread Daniel Vetter
With the remotes stored in nightly.conf and git worktrees we can avoid
hard-coding them in even more places.

Signed-off-by: Daniel Vetter 
---
 dim | 12 
 1 file changed, 12 deletions(-)

diff --git a/dim b/dim
index f9b28d5fd241..20a3143a5c1e 100755
--- a/dim
+++ b/dim
@@ -80,8 +80,6 @@ today=`date +%Y-%m-%d`
 drm_intel_ssh=ssh://git.freedesktop.org/git/drm-intel
 drm_intel_git=git://anongit.freedesktop.org/drm-intel
 drm_upstream_git=git://people.freedesktop.org/~airlied/linux
-sound_upstream_git=git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
-driver_core_upstream_git=git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
 
linux_upstream_git=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

 # email aliases
@@ -1151,16 +1149,6 @@ function dim_setup
else
remote=`get_remote_name $drm_upstream_git`
fi
-   if git remote | grep sound-upstream > /dev/null ; then
-   git config remote.sound-upstream.url $sound_upstream_git
-   else
-   remote=`get_remote_name $sound_upstream_git`
-   fi
-   if git remote | grep driver-core-upstream > /dev/null ; then
-   git config remote.driver-core-upstream.url 
$driver_core_upstream_git
-   else
-   remote=`get_remote_name $driver_core_upstream_git`
-   fi

echo "dim setup successfully completed!"
 }
-- 
2.9.3



[PATCH 07/10] dim: autodetect branches in rebuild-nightly

2016-10-18 Thread Daniel Vetter
Needs new url-mapping information in nightly.conf to work properly.

Signed-off-by: Daniel Vetter 
---
 dim | 48 
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/dim b/dim
index 48d5e7b6477a..f9b28d5fd241 100755
--- a/dim
+++ b/dim
@@ -235,20 +235,30 @@ function dim_commit_add_tag
done
 }

+function map_nightly_remote
+{
+   local nightly_remote=$1
+   local remote_url=`eval echo 
"\\\$nightly_remote_url_${nightly_remote/-/_}"`
+
+   get_remote_name $remote_url
+}
+
 function update_linux_next
 {
cd $DIM_PREFIX/drm-intel-nightly

+   local nightly_origin=`map_nightly_remote origin`
+
# always update drm-intel-fixes
echo -n "Pushing drm-intel-fixes to for-linux-next-fixes... "
-   git push $DRY_RUN origin +origin/drm-intel-fixes:for-linux-next-fixes 
>& /dev/null
+   git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-fixes:for-linux-next-fixes >& /dev/null
echo "Done."

-   if git merge-base --is-ancestor origin/drm-intel-next-fixes 
origin/drm-intel-fixes ; then
+   if git merge-base --is-ancestor $nightly_origin/drm-intel-next-fixes 
$nightly_origin/drm-intel-fixes ; then
# -fixes has caught up to dinf, i.e. we're out of the merge
# window. Push the next queue.
echo -n "Out of merge window. Pushing drm-intel-next-queued to 
for-linux-next... "
-   git push $DRY_RUN origin 
+origin/drm-intel-next-queued:for-linux-next >& /dev/null
+   git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-next-queued:for-linux-next >& /dev/null
echo "Done."
else
# dinf is ahead of -fixes, i.e. drm-next has already closed for
@@ -256,7 +266,7 @@ function update_linux_next
# for the current -next cycle. Push dinf

echo -n "Pushing drm-intel-next-fixes to for-linux-next... "
-   git push $DRY_RUN origin 
+origin/drm-intel-next-fixes:for-linux-next >& /dev/null
+   git push $DRY_RUN $nightly_origin 
+$nightly_origin/drm-intel-next-fixes:for-linux-next >& /dev/null
echo "Done."
fi
 }
@@ -272,11 +282,20 @@ function check_conflicts
true
 }

+function rr_cache_dir
+{
+   if [ -d $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ ] ; then
+   echo $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/
+   else
+   echo $DIM_PREFIX/$DIM_DRM_INTEL/.git/rr-cache/
+   fi
+}
+
 function update_rerere_cache
 {
cd $DIM_PREFIX/drm-intel-rerere/
git pull
-   cp rr-cache/* $DIM_PREFIX/drm-intel-nightly/.git/rr-cache/ -r
+   cp rr-cache/* `rr_cache-dir` -r
cd -
 }

@@ -307,9 +326,10 @@ function dim_rebuild_nightly
fi

for remote in $(echo $nightly_branches | tr " " "\n" | sed 's|/.*$||g' 
| sort -u); do
-   echo -n "Fetching $remote... "
+   local nightly_remote=`map_nightly_remote $remote`
+   echo -n "Fetching $remote (as $nightly_remote) ... "
# git fetch returns 128 if there's nothing to be fetched
-   git fetch $remote >& /dev/null || true
+   git fetch $nightly_remote >& /dev/null || true
echo "Done."
done

@@ -329,12 +349,14 @@ function dim_rebuild_nightly
if [[ -n $sha1 ]] ; then
echo -n "Using override sha1: $sha1... "
else
-   sha1=$branch
+   local remote=${branch%%/*}
+   local nightly_remote=`map_nightly_remote $remote`
+   sha1=`echo $branch | sed -e s/^$remote/$nightly_remote/`
fi

if [ $first == 1 ] ; then
+   git reset --hard $sha1 &> /dev/null
echo "Reset. Done."
-   git reset --hard $sha1 >& /dev/null
first=0
elif git merge --rerere-autoupdate --ff-only $sha1 >& /dev/null 
; then
# nothing to do if just fast-forward
@@ -370,14 +392,16 @@ function dim_rebuild_nightly
git commit --quiet -m "$integration_branch: $time integration manifest"
echo "Done."

+   local nightly_origin=`map_nightly_remote origin`
+
echo -n "Pushing $integration_branch... "
-   git push $DRY_RUN origin +HEAD >& /dev/null && echo "Done."
+   git push $DRY_RUN $nightly_origin +HEAD >& /dev/null && echo "Done."

echo -n "Updating rerere cache... "
cd $rerere
if git branch | grep rerere-cache | grep '\*' >& /dev/null ; then
git pull >& /dev/null
-   cp $DIM_PREFIX/$integration_branch/.git/rr-cache/* rr-cache -r
+   cp `rr_cache_dir` rr-cache -r
git add *.patch >& /dev/null || true
git add rr-cache/* > /dev/null

[PATCH 06/10] dim: Nuke nightly-forget

2016-10-18 Thread Daniel Vetter
With our proliferation of branches it's become long useless. Nowadays
my MO is to revert the offending commit in the rerere-cache branch
explicitly, remove drm-intel-nightly/.git/rr-cache and then re-run
rebuild-nightly. That works much better, hence nuke this helper.

Signed-off-by: Daniel Vetter 
---
 TODO | 2 --
 dim  | 9 -
 2 files changed, 11 deletions(-)

diff --git a/TODO b/TODO
index ac0f27763dfa..c1c6e20eb0e3 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,6 @@
 dim:
 - extract the integration tree logic and make it generally useful, maybe for a
   drm-integration tree ...
-- Improve nightly-forget to forget a specific merge instead of just the first
-  dinq/dif merge.
 - add option to check-patch to check stdin
 - integrate ninja-check? Or too much checkers considered harmful?
   
https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2014-May/000554.html
diff --git a/dim b/dim
index 80baf24e4ad7..48d5e7b6477a 100755
--- a/dim
+++ b/dim
@@ -395,15 +395,6 @@ function dim_rebuild_nightly
update_linux_next
 }

-function dim_nightly_forget
-{
-   cd $DIM_PREFIX/drm-intel-nightly
-   git fetch origin >& /dev/null
-   git reset --hard origin/drm-intel-next-queued >& /dev/null
-   git merge origin/drm-intel-fixes
-   git rerere forget
-}
-
 # push branch $1, rebuild nightly. the rest of the arguments are passed to git
 # push.
 function dim_push_branch
-- 
2.9.3



[PATCH 05/10] dim: support git worktree for aux checkouts

2016-10-18 Thread Daniel Vetter
If available by default. This saves quite a pile of disk-space that
imo making it the default is justified.

Note that this will break the rebuild-nightly script for now,
follow-up patches will fix that.

Signed-off-by: Daniel Vetter 
---
 dim | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/dim b/dim
index 90eb553c6575..80baf24e4ad7 100755
--- a/dim
+++ b/dim
@@ -1072,15 +1072,24 @@ function setup_aux_checkout # name remote
echo "Setting up $dir ..."

if [ ! -d $dir ]; then
-   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
$remote_url $dir
-   cd $dir
-   git config remote.origin.url $remote_url
-   echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
.git/objects/info/alternates
-   git repack -a -d -l
-   remote=origin
+   if git help worktree &> /dev/null ; then
+   cd $DIM_PREFIX/$DIM_DRM_INTEL
+   remote=`get_remote_name $remote_url`
+   if ! git branch | grep $name > /dev/null ; then
+   git branch --track $name $remote/$name
+   fi
+   git worktree add ../$dir $name
+   else
+   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
$remote_url $dir
+   cd $dir
+   git config remote.origin.url $remote_url
+   echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
.git/objects/info/alternates
+   git repack -a -d -l
+   remote=origin
+   fi
else
cd $dir
-   remote=`get_remote_name $drm_intel_ssh`
+   remote=`get_remote_name $remote_url`
fi
if ! git branch | grep $name > /dev/null ; then
git checkout -t $remote/$name
-- 
2.9.3



[PATCH 04/10] dim: autodetect remotes, first part for dim_setup

2016-10-18 Thread Daniel Vetter
The goals here are multiple:
- simpler configuration through autodetection
- allows seamless upgrading to git worktree for the aux checkouts
- eventually I want to split up drm-misc into a separate remote ...

And yes this is just a start.

v2: Print errors to stderr, otherwise they can't be seen when directly
assigning the result of get_remote_name to a variable.

Signed-off-by: Daniel Vetter 
---
 dim | 112 +++-
 1 file changed, 58 insertions(+), 54 deletions(-)

diff --git a/dim b/dim
index 2601bb7dbbad..90eb553c6575 100755
--- a/dim
+++ b/dim
@@ -192,6 +192,24 @@ if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
 dim_uptodate
 fi

+function get_remote_name
+{
+   local remote_url=$1
+
+   local remote=`git remote -v | grep $remote_url | \
+   head -n1 | sed -e 's/^\(.*\)\t.*/\1/'`
+
+   if [[ $remote == "" ]] ; then
+   echoerr No git remote for $remote_url found in `pwd`.
+   echoerr Please set it up using
+   echoerr $ git remote add '' $remote_url
+   echoerr with a name of your choice.
+   exit 1
+   fi
+
+   echo $remote
+}
+
 # get message id from file
 # $1 = file
 message_get_id ()
@@ -1044,8 +1062,36 @@ function dim_update_branches
update_rerere_cache
 }

+function setup_aux_checkout # name remote
+{
+   local name=$1
+   local remote_url=$2
+   local dir=$3
+   local remote
+
+   echo "Setting up $dir ..."
+
+   if [ ! -d $dir ]; then
+   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
$remote_url $dir
+   cd $dir
+   git config remote.origin.url $remote_url
+   echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
.git/objects/info/alternates
+   git repack -a -d -l
+   remote=origin
+   else
+   cd $dir
+   remote=`get_remote_name $drm_intel_ssh`
+   fi
+   if ! git branch | grep $name > /dev/null ; then
+   git checkout -t $remote/$name
+   fi
+   cd ..
+}
+
 function dim_setup
 {
+   local remote
+
if [ ! -d $DIM_PREFIX ]; then
echo "please set up your repository directory with:"
echo "mkdir -p $DIM_PREFIX"
@@ -1062,76 +1108,34 @@ function dim_setup
exit 1
fi
cd $DIM_DRM_INTEL
-   if ! git remote -v | grep "^origin[[:space:]]" | grep 
$linux_upstream_git > /dev/null; then
-   echo "please set up remote origin for $linux_upstream_git"
-   exit 1
-   fi
-   if ! git remote -v | grep "^$DIM_DRM_INTEL_REMOTE[[:space:]]" | grep 
$drm_intel_ssh > /dev/null; then
-   echo "please set up remote $DIM_DRM_INTEL_REMOTE for 
$drm_intel_ssh with:"
-   echo "git remote add $DIM_DRM_INTEL_REMOTE $drm_intel_ssh"
-   echo "or update your configuration."
-   exit 1
-   fi
-   if ! git remote -v | grep "^$DIM_DRM_UPSTREAM_REMOTE[[:space:]]" | grep 
$drm_upstream_git > /dev/null; then
-   echo "please set up remote $DIM_DRM_UPSTREAM_REMOTE for 
$drm_upstream_git with:"
-   echo "git remote add $DIM_DRM_UPSTREAM_REMOTE 
$drm_upstream_git"
-   echo "or update your configuration."
-   exit 1
-   fi
-   cd ..

-   echo "Setting up maintainer-tools ..."
-   if [ ! -d maintainer-tools ]; then
-   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
$drm_intel_ssh maintainer-tools
-   fi
-   cd maintainer-tools
-   git config remote.origin.url $drm_intel_ssh
-   echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
.git/objects/info/alternates
-   git repack -a -d -l
-   if ! git branch | grep maintainer-tools > /dev/null ; then
-   git checkout -t origin/maintainer-tools
-   fi
-   cd ..
+   # check remote configuration
+   remote=`get_remote_name $linux_upstream_git`
+   remote=`get_remote_name $drm_intel_ssh`
+   remote=`get_remote_name $drm_upstream_git`

-   echo "Setting up drm-intel-rerere ..."
-   if [ ! -d drm-intel-rerere ]; then
-   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
$drm_intel_ssh drm-intel-rerere
-   fi
-   cd drm-intel-rerere
-   git config remote.origin.url $drm_intel_ssh
-   echo "$DIM_PREFIX/$DIM_DRM_INTEL/.git/objects" > 
.git/objects/info/alternates
-   git repack -a -d -l
-   if ! git branch | grep rerere-cache > /dev/null ; then
-   git checkout -t origin/rerere-cache
-   fi
cd ..

-   echo "Setting up drm-intel-nightly ..."
-   if [ ! -d drm-intel-nightly ]; then
-   git clone --reference=$DIM_PREFIX/$DIM_DRM_INTEL/.git 
$drm_intel_ssh drm-intel-nightly
-   fi
+   setup_aux_checkout maintainer-tools $drm_intel_ssh maintainer-tools
+
+   

[PATCH 03/10] dim: echoerr helper for printing to stderr

2016-10-18 Thread Daniel Vetter
Signed-off-by: Daniel Vetter 
---
 dim | 19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/dim b/dim
index 192d6ee10838..2601bb7dbbad 100755
--- a/dim
+++ b/dim
@@ -102,12 +102,17 @@ DRY=
 FORCE=
 HELP=

+function echoerr
+{
+   echo "$@" >&2
+}
+
 function warn_or_fail
 {
if [[ $FORCE ]] ; then
-   echo WARNING: $1, but continuing
+   echoerr WARNING: $1, but continuing
else
-   echo ERROR: $1, aborting
+   echoerr ERROR: $1, aborting
exit 1
fi
 }
@@ -128,7 +133,7 @@ while getopts hdfi opt; do
HELP=1
;;
*)
-   echo "See '$dim help' for more information." >&2
+   echoerr "See '$dim help' for more information."
exit
esac
 done
@@ -167,18 +172,18 @@ function dim_uptodate
local using="${BASH_SOURCE[0]}"

if [[ ! -e "$using" ]]; then
-   echo "$dim: could not figure out the version being used 
($using)." >&2
+   echoerr "$dim: could not figure out the version being used 
($using)."
exit 1
fi

if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; then
-   echo "$dim: could not find the upstream repo for $dim." >&2
+   echoerr "$dim: could not find the upstream repo for $dim."
exit 1
fi

if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show 
@{upstream}:dim |\
diff "$using" - >& /dev/null; then
-   echo "$dim: not running upstream version of the script." >&2
+   echoerr "$dim: not running upstream version of the script."
exit 1
fi
 }
@@ -1280,6 +1285,6 @@ subcmd_func=dim_${subcmd//-/_}
 if declare -f $subcmd_func >/dev/null; then
$subcmd_func "$@"
 else
-   echo "$dim: '$subcommand' is not a dim command." >&2
+   echoerr "$dim: '$subcommand' is not a dim command."
dim_usage
 fi
-- 
2.9.3



[PATCH 02/10] dim: Autocheck for up-to-dateness

2016-10-18 Thread Daniel Vetter
Exits script to annoy people roughly every 100th time ...

Also switch to the magic @{upstream} reference, in case the remote is
not called origin (which is pretty normal in case of using git
worktree).

Signed-off-by: Daniel Vetter 
---
 dim | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dim b/dim
index 57ad4fcf9767..192d6ee10838 100755
--- a/dim
+++ b/dim
@@ -176,13 +176,17 @@ function dim_uptodate
exit 1
fi

-   if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show 
origin/maintainer-tools:dim |\
+   if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show 
@{upstream}:dim |\
diff "$using" - >& /dev/null; then
echo "$dim: not running upstream version of the script." >&2
exit 1
fi
 }

+if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
+dim_uptodate
+fi
+
 # get message id from file
 # $1 = file
 message_get_id ()
-- 
2.9.3



[PATCH 01/10] dim: Extract TODO

2016-10-18 Thread Daniel Vetter
Just maybe a bit more visibility, the scripts are growing.

Signed-off-by: Daniel Vetter 
---
 TODO | 27 +++
 dim  | 17 -
 qf   | 11 ---
 3 files changed, 27 insertions(+), 28 deletions(-)
 create mode 100644 TODO

diff --git a/TODO b/TODO
new file mode 100644
index ..ac0f27763dfa
--- /dev/null
+++ b/TODO
@@ -0,0 +1,27 @@
+dim:
+- extract the integration tree logic and make it generally useful, maybe for a
+  drm-integration tree ...
+- Improve nightly-forget to forget a specific merge instead of just the first
+  dinq/dif merge.
+- add option to check-patch to check stdin
+- integrate ninja-check? Or too much checkers considered harmful?
+  
https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2014-May/000554.html
+- add patchwork Link: also after manually resolving conflicts in drm
+  apply-resolved
+- pull in dim extract-tags tool from Ville
+- allow dim rebuild-nightly to pull branches from local trees in dry-run mode.
+  This is useful to confirm a backmerge is indeed correct, by comparing the
+  resulting -nightly with the old one. Current the branch must be pushed out
+  first for rebuild-nightly to pick it up, which means the merge can't be
+  fixed any more.
+
+qf:
+- get better at preventing and cleaning up a mess when switching branches
+  while there's still applied quilt patches around ...
+- combine quilt annotate and git blame into one tool
+- use the index a bit more to e.g. stage all applied quilt patches, then use
+  the output of git diff to refresh a quilt patch
+- use git commit-tree and git write-tree in the setup code instead of the
+  current high-level hacks
+- track/restore the topmost patch maybe?
+- synchronize quilt notes in qf push and qf fetch
diff --git a/dim b/dim
index 5fb3a0fee7ff..57ad4fcf9767 100755
--- a/dim
+++ b/dim
@@ -27,23 +27,6 @@

 # drm-intel-next maintainer script

-# TODO
-# - extract the integration tree logic and make it generally useful, maybe for 
a
-#   drm-integration tree ...
-# - Improve nightly-forget to forget a specific merge instead of just the first
-#   dinq/dif merge.
-# - add option to check-patch to check stdin
-# - integrate ninja-check? Or too much checkers considered harmful?
-#   
https://lists.linuxfoundation.org/pipermail/ksummit-discuss/2014-May/000554.html
-# - add patchwork Link: also after manually resolving conflicts in drm
-#   apply-resolved
-# - pull in dim extract-tags tool from Ville
-# - allow dim rebuild-nightly to pull branches from local trees in dry-run 
mode.
-#   This is useful to confirm a backmerge is indeed correct, by comparing the
-#   resulting -nightly with the old one. Current the branch must be pushed out
-#   first for rebuild-nightly to pick it up, which means the merge can't be
-#   fixed any more.
-
 # fail on any goof-up
 set -e

diff --git a/qf b/qf
index 4e9cb03f31fe..31b9f3bae0a2 100755
--- a/qf
+++ b/qf
@@ -26,17 +26,6 @@

 # quilt git flow script

-# TODO
-# - get better at preventing and cleaning up a mess when switching branches
-# while there's still applied quilt patches around ...
-# - combine quilt annotate and git blame into one tool
-# - use the index a bit more to e.g. stage all applied quilt patches, then use
-# the output of git diff to refresh a quilt patch
-# - use git commit-tree and git write-tree in the setup code instead of the
-# current high-level hacks
-# - track/restore the topmost patch maybe?
-# - synchronize quilt notes in qf push and qf fetch
-
 # config
 QUILT_PREFIX=quilt/

-- 
2.9.3



[PATCH] gpu: Remove depends on RESET_CONTROLLER when not a provider

2016-10-18 Thread Stephen Boyd
These GPU drivers only depend on the RESET_CONTROLLER config
option to fix build issues that existed when there weren't stub
reset APIs for reset controller consumers. Given that these
drivers aren't providing any reset controllers themselves, they
don't actually depend on the API to build (just to function) so
they don't need to depend on it. Remove the dependency to fix
recursive build errors like the following:

drivers/usb/Kconfig:39:error: recursive dependency detected!
drivers/usb/Kconfig:39: symbol USB is selected by MOUSE_APPLETOUCH
drivers/input/mouse/Kconfig:187:symbol MOUSE_APPLETOUCH depends on INPUT
drivers/input/Kconfig:8:symbol INPUT is selected by VT
drivers/tty/Kconfig:12: symbol VT is selected by FB_STI
drivers/video/fbdev/Kconfig:674:symbol FB_STI depends on FB
drivers/video/fbdev/Kconfig:5:  symbol FB is selected by DRM_KMS_FB_HELPER
drivers/gpu/drm/Kconfig:42: symbol DRM_KMS_FB_HELPER is selected by 
DRM_KMS_CMA_HELPER
drivers/gpu/drm/Kconfig:98: symbol DRM_KMS_CMA_HELPER is selected by DRM_IMX
drivers/gpu/drm/imx/Kconfig:1:  symbol DRM_IMX depends on IMX_IPUV3_CORE
drivers/gpu/ipu-v3/Kconfig:1:   symbol IMX_IPUV3_CORE depends on 
RESET_CONTROLLER
drivers/reset/Kconfig:4:symbol RESET_CONTROLLER is selected by 
USB_CHIPIDEA
drivers/usb/chipidea/Kconfig:1: symbol USB_CHIPIDEA depends on USB_EHCI_HCD
drivers/usb/host/Kconfig:84:symbol USB_EHCI_HCD depends on USB

Cc: Arnd Bergmann 
Cc: 
Cc: Heiko Stuebner 
Cc: Mark Yao 
Acked-by: Philipp Zabel 
Signed-off-by: Stephen Boyd 
---

This has come out of some USB chipidea patches I've been working on. Please see
http://lkml.kernel.org/r/20160907213519.27340-1-stephen.boyd at linaro.org for
more details.

I'm resending with the ack from Philipp picked up.

 drivers/gpu/drm/rockchip/Kconfig | 1 -
 drivers/gpu/drm/tegra/Kconfig| 1 -
 drivers/gpu/ipu-v3/Kconfig   | 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 3c58669a06ce..6f7f9c59f05b 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -1,7 +1,6 @@
 config DRM_ROCKCHIP
tristate "DRM Support for Rockchip"
depends on DRM && ROCKCHIP_IOMMU
-   depends on RESET_CONTROLLER
select DRM_GEM_CMA_HELPER
select DRM_KMS_HELPER
select DRM_PANEL
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
index 63ebb154b9b5..bbf5a4b7e0b6 100644
--- a/drivers/gpu/drm/tegra/Kconfig
+++ b/drivers/gpu/drm/tegra/Kconfig
@@ -3,7 +3,6 @@ config DRM_TEGRA
depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
depends on COMMON_CLK
depends on DRM
-   depends on RESET_CONTROLLER
select DRM_KMS_HELPER
select DRM_MIPI_DSI
select DRM_PANEL
diff --git a/drivers/gpu/ipu-v3/Kconfig b/drivers/gpu/ipu-v3/Kconfig
index aefdff95356d..08766c6e7856 100644
--- a/drivers/gpu/ipu-v3/Kconfig
+++ b/drivers/gpu/ipu-v3/Kconfig
@@ -1,7 +1,6 @@
 config IMX_IPUV3_CORE
tristate "IPUv3 core support"
depends on SOC_IMX5 || SOC_IMX6Q || ARCH_MULTIPLATFORM
-   depends on RESET_CONTROLLER
select GENERIC_IRQ_CHIP
help
  Choose this if you have a i.MX5/6 system and want to use the Image
-- 
2.10.0.297.gf6727b0



mm: fix cache mode tracking in vm_insert_mixed() breaks AMDGPU [was: Re: Latest testing with drm-next-4.9-wip and latest LLVM/mesa stack - Regression in PowerPlay/DPM on CIK?]

2016-10-18 Thread Dave Airlie
On 18 October 2016 at 08:01, Dave Airlie  wrote:
> On 18 October 2016 at 07:25, Dan Williams  wrote:
>> On Sun, Oct 16, 2016 at 1:53 PM, Dave Airlie  wrote:
>>> On 17 October 2016 at 04:41, Marek Olšák  wrote:
 On Fri, Oct 14, 2016 at 3:33 AM, Michel Dänzer  
 wrote:
>
> [ Adding Dan Williams and dri-devel ]
>
> On 14/10/16 03:28 AM, Shawn Starr wrote:
>> Hello AMD folks,
>>
>> I have discovered a problem in Linus master that affects AMDGPU, nobody 
>> would
>> notice this in drm-next-4.9-wip since its not in this repo.
>
> [...]
>
>> 87744ab3832b83ba71b931f86f9cfdb000d07da5 is the first bad commit
>> commit 87744ab3832b83ba71b931f86f9cfdb000d07da5
>> Author: Dan Williams 
>> Date:   Fri Oct 7 17:00:18 2016 -0700
>>
>> mm: fix cache mode tracking in vm_insert_mixed()
>>
>> vm_insert_mixed() unlike vm_insert_pfn_prot() and 
>> vmf_insert_pfn_pmd(),
>> fails to check the pgprot_t it uses for the mapping against the one
>> recorded in the memtype tracking tree.  Add the missing call to
>> track_pfn_insert() to preclude cases where incompatible aliased 
>> mappings
>> are established for a given physical address range.
>>
>> Link: http://lkml.kernel.org/r/
>> 147328717909.35069.14256589123570653697.stgit at dwillia2-
>> desk3.amr.corp.intel.com
>> Signed-off-by: Dan Williams 
>> Cc: David Airlie 
>> Cc: Matthew Wilcox 
>> Cc: Ross Zwisler 
>> Signed-off-by: Andrew Morton 
>> Signed-off-by: Linus Torvalds 
>>
>> :04 04 7517c0019fe49c1830b5a1d81f1dc099c5aab98a
>> fd497a604a2af5995db2b8ed1e9c640bede6adf3 M  mm
>>
>>
>> Removal of this patch stops graphics stalls.
>
> Thanks for bisecting this Shawn.
>
>
>> A friend of mine mentions,
>>
>> "looks like a graphics thingy you depend on is requesting a mapping with 
>> a
>> not-allowed cache mode, and now you are (rightfully) getting errors?"
>
> It would be nice to get some more specific pointers what amdgpu (or
> maybe ttm, since that calls vm_insert_mixed in ttm_bo_vm_fault) might be
> doing wrong.
>>>
>>>/*
>>>  * We'd like to use VM_PFNMAP on shared mappings, where
>>>  * (vma->vm_flags & VM_SHARED) != 0, for performance reasons,
>>>  * but for some reason VM_PFNMAP + x86 PAT + write-combine is very
>>>  * bad for performance. Until that has been sorted out, use
>>>  * VM_MIXEDMAP on all mappings. See freedesktop.org bug #75719
>>>  */
>>> vma->vm_flags |= VM_MIXEDMAP;
>>>
>>> We have that comment in the ttm code, which to me implies that mixed is
>>> doing the right thing now, but that is slow, as the interface we
>>> should be using.
>>>
>>
>> Aren't there only 2 possibilities for this regression?
>>
>> 1/ a memtype entry was never made so track_pfn_insert() returns an
>> uncached mapping
>>
>> 2/ a conflicting memtype entry exists and undefined behavior due to
>> mixed mapping types is avoided with the change.
>
> 3/ The CPU usage through this path goes up, and slows things down,
> though I suspect you it's more an uncached mapping showing up
> when we don't expect it.

It's looking line number 1, there is no mapping, now we get uncached
where we used to get write through.

difference in page prot 7f7bbc0e, pfn 200e71e4,
8037, 802f

0x2f is the vma pg prot which has PWT set in it, 0x37 is the returned
pgprot which lacks that bit.

not sure where to go from here, suggestions?
Dave.


[Bug 98307] "st/glsl_to_tgsi: explicitly track all input and output declaration" broke flightgear colors on rs780

2016-10-18 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=98307

--- Comment #1 from Marc Dietrich  ---
uHeaven and Valley also broken

-- 
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/20161018/010c72e8/attachment.html>


[PATCH] drm: fix sparse warnings on undeclared symbols in crc debugfs

2016-10-18 Thread Chris Wilson
On Tue, Oct 18, 2016 at 02:28:35PM +0300, Jani Nikula wrote:
> Fixes sparse warnings:
> 
> drivers/gpu/drm/drm_debugfs_crc.c:118:30: warning: symbol
> 'drm_crtc_crc_control_fops' was not declared. Should it be static?
> 
> drivers/gpu/drm/drm_debugfs_crc.c:264:30: warning: symbol
> 'drm_crtc_crc_data_fops' was not declared. Should it be static?
> 
> drivers/gpu/drm/drm_debugfs_crc.c:281:5: warning: symbol
> 'drm_debugfs_crtc_crc_add' was not declared. Should it be static?
> 
> Fixes: 9edbf1fa600a ("drm: Add API for capturing frame CRCs")
> Cc: Benjamin Gaignard 
> Cc: Daniel Vetter 
> Cc: Emil Velikov 
> Cc: Tomeu Vizoso 
> Signed-off-by: Jani Nikula 
Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[PATCH v2] virtio-gpu: fix vblank events

2016-10-18 Thread Gustavo Padovan
From: Gerd Hoffmann 

virtio-gpu sends vblank events in virtio_gpu_crtc_atomic_flush, and
because of that it must be called for disabled planes too.  Ask
drm_atomic_helper_commit_planes to do that.

v2: update to use new drm_atomic_helper_commit_planes() API.

Signed-off-by: Gerd Hoffmann 
Signed-off-by: Gustavo Padovan 
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
b/drivers/gpu/drm/virtio/virtgpu_display.c
index 6848651..64facc8 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -340,8 +340,7 @@ static void vgdev_atomic_commit_tail(struct 
drm_atomic_state *state)

drm_atomic_helper_commit_modeset_disables(dev, state);
drm_atomic_helper_commit_modeset_enables(dev, state);
-   drm_atomic_helper_commit_planes(dev, state,
-   DRM_PLANE_COMMIT_ACTIVE_ONLY);
+   drm_atomic_helper_commit_planes(dev, state, 0);

drm_atomic_helper_commit_hw_done(state);

-- 
2.5.5



  1   2   >