RE: [PATCH] dma-buf/reservation: shouldn't kfree staged when slot available

2018-03-04 Thread Liu, Monk
Hi Christian

You are right on that part of obj-staged is set to NULL in add_fence, 
So my following question will be why we kfree(obj->staged) in reserve_shared() 
if staged is always NULL in that point ?

Thanks 
/Monk

-Original Message-
From: Christian König [mailto:ckoenig.leichtzumer...@gmail.com] 
Sent: 2018年2月28日 16:27
To: Liu, Monk ; dri-devel@lists.freedesktop.org; 
linux-ker...@vger.kernel.org
Subject: Re: [PATCH] dma-buf/reservation: shouldn't kfree staged when slot 
available

Am 28.02.2018 um 07:44 schrieb Monk Liu:
> under below scenario the obj->fence would refer to a wild pointer:
>
> 1,call reservation_object_reserved_shared
> 2,call reservation_object_add_shared_fence
> 3,call reservation_object_reserved_shared
> 4,call reservation_object_add_shared_fence
>
> in step 1, staged is allocated,
>
> in step 2, code path will go reservation_object_add_shared_replace()
> and obj->fence would be assigned as staged (through RCU_INIT_POINTER)
>
> in step 3, obj->staged will be freed(by simple kfree), which make 
> obj->fence point to a wild pointer...


Well that explanation is still nonsense. See
reservation_object_add_shared_fence:
>     obj->staged = NULL;

Among the first things reservation_object_add_shared_fence() does is it 
sets obj->staged to NULL.

So step 3 will not free anything and we never have a wild pointer.

Regards,
Christian.

>
> in step 4, code path will go reservation_object_add_shared_inplace()
> and inside it the @fobj (which equals to @obj->staged, set by above steps)
> is already a wild pointer
>
> should remov the kfree on staged in reservation_object_reserve_shared()
>
> Change-Id: If7c01f1b4be3d3d8a81efa90216841f79ab1fc1c
> Signed-off-by: Monk Liu 
> ---
>   drivers/dma-buf/reservation.c | 7 ++-
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 375de41..b473ccc 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -74,12 +74,9 @@ int reservation_object_reserve_shared(struct 
> reservation_object *obj)
>   old = reservation_object_get_list(obj);
>   
>   if (old && old->shared_max) {
> - if (old->shared_count < old->shared_max) {
> - /* perform an in-place update */
> - kfree(obj->staged);
> - obj->staged = NULL;
> + if (old->shared_count < old->shared_max)
>   return 0;
> - } else
> + else
>   max = old->shared_max * 2;
>   } else
>   max = 4;

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


[PATCH] drm/bridge/synopsys: dw-hdmi: Fix memleak in __dw_hdmi_remove

2018-03-04 Thread Jeffy Chen
The platform_device_register_full() will allocate dma_mask for
hdmi->audio, so we should free before platform_device_unregister().

Reported by kmemleak:
unreferenced object 0xffc0ef70ff00 (size 128):
  comm "kworker/4:1", pid 123, jiffies 4294670080 (age 189.604s)
  hex dump (first 32 bytes):
ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[<21946f44>] kmemleak_alloc+0x58/0x8c
[<9c43890d>] kmem_cache_alloc_memcg_trace+0x18c/0x25c
[<0e17cd06>] platform_device_register_full+0x64/0x108
[<418a0882>] __dw_hdmi_probe+0xb9c/0xcc0
[] dw_hdmi_bind+0x30/0x88
[<9af347f6>] dw_hdmi_rockchip_bind+0x260/0x2e8

Signed-off-by: Jeffy Chen 
---

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index f9802399cc0d..d9afdc59d4f4 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2567,8 +2567,10 @@ __dw_hdmi_probe(struct platform_device *pdev,
 
 static void __dw_hdmi_remove(struct dw_hdmi *hdmi)
 {
-   if (hdmi->audio && !IS_ERR(hdmi->audio))
+   if (hdmi->audio && !IS_ERR(hdmi->audio)) {
+   kfree(hdmi->audio->dev.dma_mask);
platform_device_unregister(hdmi->audio);
+   }
if (!IS_ERR(hdmi->cec))
platform_device_unregister(hdmi->cec);
 
-- 
2.11.0


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


Re: [PATCH] drm/sun4i: move rgb mode_valid from connector to encoder

2018-03-04 Thread Maxime Ripard


On Sun, Mar 04, 2018 at 11:37:50AM +0100, Giulio Benetti wrote:
> mode_valid function must be connected to encoder, not connector.
> Otherwise it doesn't get called by drm.

That's not true, or rather, that's a big oversimplification. It
doesn't get called by DRM if you have a bridge instead of a panel
attached to the encoder.

> Move mode_valid function pointer to encoder helper functions,
> changing its prototype according to encoder helper function pointer.
> 
> Signed-off-by: Giulio Benetti 
> ---
>  drivers/gpu/drm/sun4i/sun4i_rgb.c | 102 
> +++---
>  1 file changed, 51 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
> b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index b8da5a5..6539dcc 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -52,11 +52,59 @@ static int sun4i_rgb_get_modes(struct drm_connector 
> *connector)
>   return drm_panel_get_modes(tcon->panel);
>  }
>  
> -static int sun4i_rgb_mode_valid(struct drm_connector *connector,
> - struct drm_display_mode *mode)
> +static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
> + .get_modes  = sun4i_rgb_get_modes,
> +};
> +
> +static void
> +sun4i_rgb_connector_destroy(struct drm_connector *connector)
>  {
>   struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
>   struct sun4i_tcon *tcon = rgb->tcon;
> +
> + drm_panel_detach(tcon->panel);
> + drm_connector_cleanup(connector);
> +}
> +
> +static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
> + .fill_modes = drm_helper_probe_single_connector_modes,
> + .destroy= sun4i_rgb_connector_destroy,
> + .reset  = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
> +};
> +
> +static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> + struct sun4i_tcon *tcon = rgb->tcon;
> +
> + DRM_DEBUG_DRIVER("Enabling RGB output\n");
> +
> + if (!IS_ERR(tcon->panel)) {
> + drm_panel_prepare(tcon->panel);
> + drm_panel_enable(tcon->panel);
> + }
> +}
> +
> +static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> + struct sun4i_tcon *tcon = rgb->tcon;
> +
> + DRM_DEBUG_DRIVER("Disabling RGB output\n");
> +
> + if (!IS_ERR(tcon->panel)) {
> + drm_panel_disable(tcon->panel);
> + drm_panel_unprepare(tcon->panel);
> + }
> +}
> +
> +static enum drm_mode_status sun4i_rgb_encoder_mode_valid(struct drm_encoder 
> *crtc,
> +  const struct 
> drm_display_mode *mode)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(crtc);
> + struct sun4i_tcon *tcon = rgb->tcon;
>   u32 hsync = mode->hsync_end - mode->hsync_start;
>   u32 vsync = mode->vsync_end - mode->vsync_start;
>   unsigned long rate = mode->clock * 1000;
> @@ -106,58 +154,10 @@ static int sun4i_rgb_mode_valid(struct drm_connector 
> *connector,
>   return MODE_OK;
>  }
>  
> -static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
> - .get_modes  = sun4i_rgb_get_modes,
> - .mode_valid = sun4i_rgb_mode_valid,
> -};
> -
> -static void
> -sun4i_rgb_connector_destroy(struct drm_connector *connector)
> -{
> - struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - drm_panel_detach(tcon->panel);
> - drm_connector_cleanup(connector);
> -}
> -
> -static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
> - .fill_modes = drm_helper_probe_single_connector_modes,
> - .destroy= sun4i_rgb_connector_destroy,
> - .reset  = drm_atomic_helper_connector_reset,
> - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> - .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
> -};
> -
> -static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
> -{
> - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - DRM_DEBUG_DRIVER("Enabling RGB output\n");
> -
> - if (!IS_ERR(tcon->panel)) {
> - drm_panel_prepare(tcon->panel);
> - drm_panel_enable(tcon->panel);
> - }
> -}
> -
> -static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
> -{
> - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - DRM_DEBUG_DRIVER("Disabling RGB output\n");
> -
> - if 

Re: nouveau 30bpp / deep color status

2018-03-04 Thread Mario Kleiner

On 02/05/2018 12:50 AM, Ilia Mirkin wrote:

In case anyone's curious about 30bpp framebuffer support, here's the
current status:

Kernel:

Ben and I have switched the code to using a 256-based LUT for Kepler+,
and I've also written a patch to cause the addfb ioctl to use the
proper format. You can pick this up at:

https://github.com/skeggsb/linux/commits/linux-4.16 (note the branch!)
https://patchwork.freedesktop.org/patch/202322/

With these two, you should be able to use "X -depth 30" again on any
G80+ GPU to bring up a screen (as you could in kernel 4.9 and
earlier). However this still has some deficiencies, some of which I've
addressed:

xf86-video-nouveau:

DRI3 was broken, and Xv was broken. Patches available at:

https://github.com/imirkin/xf86-video-nouveau/commits/master

mesa:

The NVIDIA hardware (pre-Kepler) can only do XBGR scanout. Further the
nouveau KMS doesn't add XRGB scanout for Kepler+ (although it could).
Mesa was only enabled for XRGB, so I've piped XBGR through all the
same places:

https://github.com/imirkin/mesa/commits/30bpp



Wrt. mesa, those patches are now in master and i think we have a bit of 
a problem under X11+GLX:


https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/state_trackers/dri/dri_screen.c#n108

dri_fill_in_modes() defines MESA_FORMAT_R10G10B10A2_UNORM, 
MESA_FORMAT_R10G10B10X2_UNORM at the top inbetween the BGRX/A formats 
ignoring the instructions that

"/* The 32-bit RGBA format must not precede the 32-bit BGRA format.
  * Likewise for RGBX and BGRX.  Otherwise, the GLX client and the GLX
  * server may disagree on which format the GLXFBConfig represents,
  * resulting in swapped color channels."

RGBA/X formats should only be exposed
if (dri_loader_get_cap(screen, DRI_LOADER_CAP_RGBA_ORDERING))

and that is only the case for the Android loader.

The GLX code doesn't use the red/green/blueChannelMasks for proper 
matching of formats, and the server doesn't even transmit those masks to 
the client in the case of GLX. So whatever 10 bit format comes first 
will win when building the assignment to GLXFBConfigs.


I looked at the code and how it behaves. In practice Intel gfx works 
because it's a classic DRI driver with its own method of building the 
DRIconfig's, and it only exposes the BGR101010 formats, so no danger of 
mixups. AMD's gallium drivers expose both BGR and RGB ordered 10 bit 
formats, but due to the ordering, the matching ends up only assigning 
the desired BGR formats that are good for AMD hw, discarding the RGB 
formats. nouveau works because it only exposes the desired RGB format 
for the hw. But with other gallium drivers for some SoC's or future 
gallium drivers it is not so clear if the right thing will happen. E.g., 
freedreno seems to support both BGR and RGB 10 bit formats as 
PIPE_BIND_DISPLAY_TARGET afaics, so i don't know if by luck the right 
thing would happen?


Afaics EGL does the right thing wrt. channelmask matching of EGLConfigs 
to DRIconfigs, so we could probably implement dri_loader_get_cap(screen, 
DRI_LOADER_CAP_RGBA_ORDERING) == TRUE for the EGL loaders.


But for GLX it is not so easy or quick. I looked if i could make the 
servers GLX send proper channelmask attributes and Mesa parsing them, 
but there aren't any GLX tags defined for channel masks, and all other 
tags come from official GLX extension headers. I'm not sure what the 
proper procedure for defining new tags is? Do we have to define a new 
GLX extension for that and get it in the Khronos registry and then back 
into the server/mesa code-base?


The current patches in mesa for XBGR also lack enablement pieces for 
EGL, Wayland and X11 compositing, but that's a different problem.


-mario



libdrm:

For testing, I added a modetest gradient pattern split horizontally.
Top half is 10bpc, bottom half is 8bpc. This is useful for seeing
whether you're really getting 10bpc, or if things are getting
truncated along the way. Definitely hacky, but ... wasn't intending on
upstreaming it anyways:

https://github.com/imirkin/drm/commit/9b8776f58448b5745675c3a7f5eb2735e3989441

-

Results with the patches (tested on a GK208B and a "deep color" TV over HDMI):
  - modetest with a 10bpc gradient shows up smoother than an 8bpc
gradient. However it's still dithered to 8bpc, not "real" 10bpc.
  - things generally work in X -- dri2 and dri3, xv, and obviously
regular X rendering / acceleration
  - lots of X software can't handle 30bpp modes (mplayer hates it for
xv and x11 rendering, aterm bails on shading the root pixmap, probably
others)

I'm also told that with DP, it should actually send the higher-bpc
data over the wire. With HDMI, we're still stuck at 24bpp for now
(although the hardware can do 36bpp as well). This is why my gradient
result above was still dithered.

Things to do - mostly nouveau specific, but probably some general
infra needed too:
  - Figure out how to properly expose the 1024-sized LUT
  - Add fp16 scanout
  - 

[Bug 102646] [dc] Screen flickering under amdgpu-experimental [buggy auto power profile]

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102646

--- Comment #24 from Ruben Harutyunyan  ---
Created attachment 137789
  --> https://bugs.freedesktop.org/attachment.cgi?id=137789=edit
dmesg log (maximum verbosity) RX580

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


[Bug 102646] [dc] Screen flickering under amdgpu-experimental [buggy auto power profile]

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102646

--- Comment #23 from Ruben Harutyunyan  ---
Hello!

I am having a similar (same?) issue on my RX580 (Asus STRIX TOC).
Seems to be an issue with MCLK switching.


Here is a video of it happening on the desktop:
https://www.youtube.com/edit?o=U_id=z28fFqNdjAY
(there is also screen flickering that's not seen on camera, but it doesn't
happen too often in contrary to the horizontal lines)

OBS is unable to campture the glitches though:
https://www.youtube.com/edit?o=U_id=iMEnprhBKFQ

Notes: 
1) Most of the time glitches happen when something new gets rendered. 
2) Google Chrome/Chromium always glitch (to a lesser extent when only the start
page is open and nothing changes on the screen, opening Facebook guarantees
glitches).
3) Playing video in VLC doesn't cause any glitches (x264 encoded MKV).
4) It's really easy to reproduce by setting the power profile to low (which
fixes the issue) and then switching to high while looking at the screen. The
glitch will occur for a split second. Switching from high to low also causes
the issue.

Workarounds so far:
1) Recompiling the kernel with "smu7_vblank_too_short" forced to output true
(aka disabling MCLK switching) fixes the problem but locks the MCLK at 2Ghz and
causes coil whine and higher temps.
2) Setting the power profile to anything but "auto".
3) Disabling DC.

It's also worth noting that in my case "low" power profile works fine, but R9
390x users seem to need "high" power profile to fix it (from the
"smu7_vblank_too_short" thread:
https://bugs.freedesktop.org/show_bug.cgi?id=96868#c32).

I can test any patches/programs/cases if you need it.

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


Re: [PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach

2018-03-04 Thread JeffyChen

Hi Laurent,

sorry, you're right, this patch should not be needed.

the connector should be cleanup by 
drm_mode_config_cleanup->drm_connector_put.


i did that in analogix_dp is to avoid a use-after-free issue not 
kmemleak, because the connector was allocated/freed in analogix_dp's 
bind/unbind.


but i found a kmemleak issue(dma_mask not freed) in dw-hdmi when testing 
that, will send patch soon.


On 03/03/2018 08:20 AM, JeffyChen wrote:

Hi Laurent,

On 03/03/2018 05:49 AM, Laurent Pinchart wrote:

Hi Enric,

Thank you for the patch.

On Friday, 2 March 2018 19:57:57 EET Enric Balletbo i Serra wrote:

From: Jeffy Chen 

We inited connector in attach(), so need a detach() to cleanup.


Do we ? The dw-hdmi driver already sets drm_connector_cleanup() as the
connector .destroy() handler, and the .destroy() operation is called
by the
DRM core. None of the other bridge drivers call drm_connector_cleanup()
directly.


hmmm, checking the code, there are also lots of drivers do the
cleanup(drm_connector_cleanup or funcs->destroy):
drm# grep -r "connector.*funcs->destroy" .
./rockchip/inno_hdmi.c: hdmi->connector.funcs->destroy(>connector);
./rockchip/cdn-dp-core.c:   connector->funcs->destroy(connector);
./bridge/analogix/analogix_dp_core.c:
dp->connector.funcs->destroy(>connector);
./msm/hdmi/hdmi.c: hdmi->connector->funcs->destroy(hdmi->connector);
./msm/dsi/dsi.c: msm_dsi->connector->funcs->destroy(msm_dsi->connector);
./msm/edp/edp.c: edp->connector->funcs->destroy(edp->connector);
./zte/zx_hdmi.c:hdmi->connector.funcs->destroy(>connector);
./drm_connector.c:  connector->funcs->destroy(connector);
./drm_connector.c:  connector->funcs->destroy(connector);
./nouveau/dispnv04/disp.c: connector->funcs->destroy(connector);
./nouveau/nv50_display.c: mstc->connector.funcs->destroy(>connector);
./nouveau/nv50_display.c: connector->funcs->destroy(connector);



when i debug analogix_dp bind/unbind, i found that we need to cleanup
the connector(reported by kmemleak). so i added it to
./bridge/analogix/analogix_dp_core.c...after that i saw dw-hdmi missing
that too(by checking the code), so make this patch.

but i didn't really tested it on devices using dw-hdmi, so i'm not very
sure the dw-hdmi(maybe also other bridges) is the same with analogix_dp.

i can try to find a chromebook veyron to check it next week :)

but even there's a leak, i'm still not very sure about:
should the caller of drm_connector_init cleanup it
or the caller of drm_bridge_attach should do it(for example
analogix_dp_bind/analogix_dp_unbind)
or should the DRM core take care of that?




Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
Signed-off-by: Enric Balletbo i Serra 
---



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


[Bug 105339] Deadlock inside glClientWaitSync

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105339

--- Comment #4 from Matias N. Goldberg  ---
By the way, if I change the waits to the following:

while( waitRet != GL_ALREADY_SIGNALED && waitRet != GL_CONDITION_SATISFIED )
{
waitDuration = 1 second;
waitRet = glClientWaitSync( fenceName, waitFlags, waitDuration );
assert( waitRet != GL_WAIT_FAILED );
}

Then it still deadlocks. glClientWaitSync returns, but the fence never
completes, leaving the while() loop as an infinite loop.

Once it starts deadlock, if I step inside si_fence_finish I can see that
rfence->tc_token is 0, which either means that it was always 0, or it has been
already zeroed.

I do not know how to continue debugging this race condition as I am not
familiar with the code.

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


[Bug 105339] Deadlock inside glClientWaitSync

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105339

--- Comment #3 from Matias N. Goldberg  ---
I've uploaded a binary with the repro.
Unfortunately it wasn't easy to repro the problem on a simpler one-liner test
case.

Just download the binary and run Sample_PlanarReflections-2.2.0
Let me know if you have issues executing the file (e.g. a hardcoded path
slipped through, missing library)

Just move around the scene (WASD + mouse). It should hang within the first
minute. It often hangs in the first 10 seconds, but it can take up to 2
minutes, at least on my machine.

As for the code, it hangs inside GL3PlusRenderSystem::_endFrame in
RenderSystems/GL3Plus/src/OgreGL3PlusRenderSystem.cpp which purposedly runs a
lot of fences to trigger the deadlock.
I included the source code so the symbols work for you

If anyone wants to build it from source code, let me know and I will assist.
I'm using Ogre 2.2's f7302ccfa4a9fde3f0e47835924f37db1b3b06b8 build, but
OgreGL3PlusRenderSystem.cpp has been modified to trigger the bug more easily.

Please note that only this sample so far appears to trigger the race condition.

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


[Bug 105339] Deadlock inside glClientWaitSync

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105339

--- Comment #2 from Matias N. Goldberg  ---
Created attachment 137784
  --> https://bugs.freedesktop.org/attachment.cgi?id=137784=edit
Relevant Source Code

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


[Bug 105339] Deadlock inside glClientWaitSync

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105339

--- Comment #1 from Matias N. Goldberg  ---
Created attachment 137783
  --> https://bugs.freedesktop.org/attachment.cgi?id=137783=edit
Binary test built with Debug & full symbols

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


[Bug 105339] Deadlock inside glClientWaitSync

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105339

Bug ID: 105339
   Summary: Deadlock inside glClientWaitSync
   Product: Mesa
   Version: git
  Hardware: Other
OS: Linux (All)
Status: NEW
  Severity: blocker
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: dark_syl...@yahoo.com.ar
QA Contact: dri-devel@lists.freedesktop.org

Calling glClientWaitSync under specific conditions will run into an
unrecoverable deadlock.

The only known workaround is to issue a glFlush before glClientWaitSync.

I originally discovered this problem in the Dolphin Emulator, see ticket
https://bugs.dolphin-emu.org/issues/10904
However I am now reporting it because I was able to reproduce this bug
independently.

Reported affected systems so far:
Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz
16GB RAM (1 stick)
GPU: Radeon RX 560 Series (POLARIS11 / DRM 3.19.0 / 4.14.11, LLVM 6.0.0)
Mesa 18.1.0-devel (git-183ce5e629)
Xubuntu 17.10
Kernel 4.14.11

i3 4150 @ 3.50ghz
DDR3 12GB RAM
AMD R7 260X 2GB VRAM
Ubuntu 17.10
Kernel 4.15.4
Mesa 18.1.0-devel


I will try to upload a simple repro if I can in the next few hours.
I stumble on this issue because our Ogre 2.2 sample "Sample_PlanarReflections"
is affected by it.

My git version is stuck at 847d0a393d7f0f967f39302900d5330f32b804c8 due to an
unrelated regression reported at
https://bugs.freedesktop.org/show_bug.cgi?id=105218

However I know the bug is still present as of
1f5618e81c00199d3349b1ade797382635b2af85 (which is not latest)

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


[Bug 101900] No HDMI HBR audio on Polaris (no TrueHD, no Atmos, no Neo:X, no HD Master audio) and static noise in sound when LPCM on amdgpu Xorg driver

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101900

--- Comment #31 from Andrew Nelson  ---
I have been running into the same issue. The problem seems to be that AMDGPU is
reporting that it supports 7 speakers instead of 8 in the EID. HBR formats work
with 5.1 encoded audio, but not 7.1. For some reason, the driver is configured
to subtract 1 from the channel count before passing it into the EID. I have
removed this and confirmed that 7.1 HBR audio works. Patch below:

diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
index 8bfb4577b4d5..5dcc685a1379 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_audio.c
@@ -557,7 +557,7 @@ void dce_aud_az_configure(

/* fill audio format data */
set_reg_field_value(value,
-   audio_mode->channel_count - 1,
+   audio_mode->channel_count,
   
AZALIA_F0_CODEC_PIN_CONTROL_AUDIO_DESCRIPTOR0,
MAX_CHANNELS);

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


[Bug 105262] [R600] [BISECTED] ttf fonts are invisible in many programs

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105262

--- Comment #13 from Pavel Vinogradov  ---
Confirmed, the patch works. Thank you all for quick solution.

(In reply to LoneVVolf from comment #12)
> Patch applied to trunk rev 411aa8c322f6703b20d32c7c263fd7ea8639cf3f cleanly
> and appears to solve all problems.
> 
> Pavel, can you or other sourcemage users with r600 cards also test ?

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


[Bug 99353] Kaveri 7400K shows random colored noise instead of GUI in X or Wayland

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99353

--- Comment #51 from Alex Deucher  ---
(In reply to Bong Cosca from comment #48)
> Created attachment 137740 [details] [review]
> kaveri.patch
> 
> Alex, the patch you suggested overrides the cu_per_sh and backends_per_se
> for ALL Kaveri cards/APUs.

Yes, that is intended.  The previous code was incorrect.

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


[Bug 99353] Kaveri 7400K shows random colored noise instead of GUI in X or Wayland

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99353

--- Comment #52 from Alex Deucher  ---
(In reply to Bong Cosca from comment #50)
> Will we see this patch/commit on the stable kernel too?

Yes, I will CC stable.

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


Re: [PATCH v2 0/2] Chunk splitting of spi transfers

2018-03-04 Thread Noralf Trønnes


Den 02.03.2018 12.11, skrev Meghana Madhyastha:

On Sun, Feb 25, 2018 at 02:19:10PM +0100, Lukas Wunner wrote:

[cc += linux-rpi-ker...@lists.infradead.org]

On Sat, Feb 24, 2018 at 06:15:59PM +, Meghana Madhyastha wrote:

I've added bcm2835_spi_transfer_one_message in spi-bcm2835. This calls
spi_split_transfers_maxsize to split large chunks for spi dma transfers.
I then removed chunk splitting in the tinydrm spi helper (as now the core
is handling the chunk splitting). However, although the SPI HW should be
able to accomodate up to 65535 bytes for dma transfers, the splitting of
chunks to 65535 bytes results in a dma transfer time out error. However,
when the chunks are split to < 64 bytes it seems to work fine.

Hm, that is really odd, how did you test this exactly, what did you
use as SPI slave?  It contradicts our own experience, we're using
Micrel KSZ8851 Ethernet chips as SPI slave on spi0 of a BCM2837
and can send/receive messages via DMA to the tune of several hundred
bytes without any issues.  In fact, for messages < 96 bytes, DMA is
not used at all, so you've probably been using interrupt mode,
see the BCM2835_SPI_DMA_MIN_LENGTH macro in spi-bcm2835.c.

Hi Lukas,

I think you are right. I checked it and its not using the DMA mode which
is why its working with 64 bytes.
Noralf, that leaves us back to the
initial time out problem. I've tried doing the message splitting in
spi_sync as well as spi_pump_messages. Martin had explained that DMA
will wait for
the SPI HW to set the send_more_data line, but the SPI-HW itself will
stop triggering it when SPI_LEN is 0 causing DMA to wait forever. I
thought if we split it before itself, the SPI_LEN will not go to zero
thus preventing this problem, however it didn't work and started
hanging. So I'm a little uncertain as to how to proceed and debug what
exactly has caused the time out due to the asynchronous methods.


I did a quick test and at least this is working:

int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
             struct spi_transfer *header, u8 bpw, const void *buf,
             size_t len)
{
    struct spi_transfer tr = {
        .bits_per_word = bpw,
        .speed_hz = speed_hz,
        .tx_buf = buf,
        .len = len,
    };
    struct spi_message m;
    size_t maxsize;
    int ret;

    maxsize = tinydrm_spi_max_transfer_size(spi, 0);

    if (drm_debug & DRM_UT_DRIVER)
        pr_debug("[drm:%s] bpw=%u, maxsize=%zu, transfers:\n",
             __func__, bpw, maxsize);

    spi_message_init();
    m.spi = spi;
    if (header)
        spi_message_add_tail(header, );
    spi_message_add_tail(, );

    ret = spi_split_transfers_maxsize(spi->controller, , maxsize, 
GFP_KERNEL);

    if (ret)
        return ret;

    tinydrm_dbg_spi_message(spi, );

    return spi_sync(spi, );
}
EXPORT_SYMBOL(tinydrm_spi_transfer);


Log:
[   39.015644] [drm:mipi_dbi_fb_dirty [mipi_dbi]] Flushing [FB:36] x1=0, 
x2=320, y1=0, y2=240


[   39.018079] [drm:mipi_dbi_typec3_command [mipi_dbi]] cmd=2a, par=00 
00 01 3f

[   39.018129] [drm:tinydrm_spi_transfer] bpw=8, maxsize=65532, transfers:
[   39.018152] tr(0): speed=10MHz, bpw=8, len=1, tx_buf=[2a]
[   39.018231] [drm:tinydrm_spi_transfer] bpw=8, maxsize=65532, transfers:
[   39.018248] tr(0): speed=10MHz, bpw=8, len=4, tx_buf=[00 00 01 3f]

[   39.018330] [drm:mipi_dbi_typec3_command [mipi_dbi]] cmd=2b, par=00 
00 00 ef

[   39.018347] [drm:tinydrm_spi_transfer] bpw=8, maxsize=65532, transfers:
[   39.018362] tr(0): speed=10MHz, bpw=8, len=1, tx_buf=[2b]
[   39.018396] [drm:tinydrm_spi_transfer] bpw=8, maxsize=65532, transfers:
[   39.018428] tr(0): speed=10MHz, bpw=8, len=4, tx_buf=[00 00 00 ef]

[   39.018487] [drm:mipi_dbi_typec3_command [mipi_dbi]] cmd=2c, len=153600
[   39.018502] [drm:tinydrm_spi_transfer] bpw=8, maxsize=65532, transfers:
[   39.018517] tr(0): speed=10MHz, bpw=8, len=1, tx_buf=[2c]
[   39.018565] [drm:tinydrm_spi_transfer] bpw=8, maxsize=65532, transfers:
[   39.018594] tr(0): speed=48MHz, bpw=8, len=65532, tx_buf=[c6 18 
c6 18 c6 18 c6 18 c6 18 c6 18 c6 18 c6 18 ...]
[   39.018608] tr(1): speed=48MHz, bpw=8, len=65532, tx_buf=[06 18 
06 18 06 18 06 18 06 18 06 18 06 18 06 18 ...]
[   39.018621] tr(2): speed=48MHz, bpw=8, len=22536, tx_buf=[10 82 
10 82 10 82 10 82 10 82 10 82 18 e3 18 e3 ...]



Noralf.


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


[Bug 105262] [R600] [BISECTED] ttf fonts are invisible in many programs

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105262

--- Comment #12 from LoneVVolf  ---
Patch applied to trunk rev 411aa8c322f6703b20d32c7c263fd7ea8639cf3f cleanly and
appears to solve all problems.

Pavel, can you or other sourcemage users with r600 cards also test ?

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


[PATCH v9 3/5] drm/rockchip: inno_hdmi: reorder clk_disable_unprepare call in unbind

2018-03-04 Thread Enric Balletbo i Serra
From: Jeffy Chen 

In bind the clk_prepare_enable of the HDMI pclk is called before adding the
i2c_adapter. So it should be the other way around in unbind, first remove
the i2c_adapter and then call the clk_disable_unprepare.

Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
Signed-off-by: Enric Balletbo i Serra 
---

Changes in v9:
- Added new patch to reorder clk_disable_unprepare call in inno_hdmi
  unbind()

 drivers/gpu/drm/rockchip/inno_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c 
b/drivers/gpu/drm/rockchip/inno_hdmi.c
index a5c661930250..88d0774c97bd 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -906,8 +906,8 @@ static void inno_hdmi_unbind(struct device *dev, struct 
device *master,
hdmi->connector.funcs->destroy(>connector);
hdmi->encoder.funcs->destroy(>encoder);
 
-   clk_disable_unprepare(hdmi->pclk);
i2c_put_adapter(hdmi->ddc);
+   clk_disable_unprepare(hdmi->pclk);
 }
 
 static const struct component_ops inno_hdmi_ops = {
-- 
2.16.1

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


[PATCH v9 4/5] drm/rockchip: dw_hdmi: Move HDMI vpll clock enable to bind()

2018-03-04 Thread Enric Balletbo i Serra
From: Jeffy Chen 

The HDMI vpll clock should be enabled when bind() is called. So move the
clk_prepare_enable of that clock to bind() function and add the missing
clk_disable_unprepare() required in error handling path and unbind().

Fixes: 12b9f204e804 ("drm: bridge/dw_hdmi: add rockchip rk3288 support")
Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
Signed-off-by: Enric Balletbo i Serra 
---

Changes in v9:
- dw_hdmi: Rewrite the commit message to reflect the change.

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 3574b0ae2ad1..11309a2a4e43 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -165,7 +165,6 @@ static const struct dw_hdmi_phy_config 
rockchip_phy_config[] = {
 static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
 {
struct device_node *np = hdmi->dev->of_node;
-   int ret;
 
hdmi->regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
if (IS_ERR(hdmi->regmap)) {
@@ -193,13 +192,6 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi 
*hdmi)
return PTR_ERR(hdmi->grf_clk);
}
 
-   ret = clk_prepare_enable(hdmi->vpll_clk);
-   if (ret) {
-   DRM_DEV_ERROR(hdmi->dev,
- "Failed to enable HDMI vpll: %d\n", ret);
-   return ret;
-   }
-
return 0;
 }
 
@@ -374,6 +366,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, 
struct device *master,
return ret;
}
 
+   ret = clk_prepare_enable(hdmi->vpll_clk);
+   if (ret) {
+   DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n",
+ ret);
+   return ret;
+   }
+
drm_encoder_helper_add(encoder, _hdmi_rockchip_encoder_helper_funcs);
drm_encoder_init(drm, encoder, _hdmi_rockchip_encoder_funcs,
 DRM_MODE_ENCODER_TMDS, NULL);
@@ -389,6 +388,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct 
device *master,
if (IS_ERR(hdmi->hdmi)) {
ret = PTR_ERR(hdmi->hdmi);
drm_encoder_cleanup(encoder);
+   clk_disable_unprepare(hdmi->vpll_clk);
}
 
return ret;
@@ -400,6 +400,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, 
struct device *master,
struct rockchip_hdmi *hdmi = dev_get_drvdata(dev);
 
dw_hdmi_unbind(hdmi->hdmi);
+   clk_disable_unprepare(hdmi->vpll_clk);
 }
 
 static const struct component_ops dw_hdmi_rockchip_ops = {
-- 
2.16.1

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


[PATCH v9 0/5] rockchip: kevin: Enable edp display

2018-03-04 Thread Enric Balletbo i Serra
Hi,

Actually the name of this patch series is not really true as the edp
display is working, but to not confuse I decided to maintain it. Now this
patchset is more a group of cleanups, the patchset has been originally
posted by Jeffy Chen and the 2 first commits from a previous version (v6)
are already merged in mainline. In v8, four patches more landed. And
this version are the remaining patches.

Regards,
 Enric

Changes in v9:
- The following patches from v8 has been applied:
  - [PATCH v8 1/8] drm/bridge: analogix: Do not use device's drvdata
  - [PATCH v8 2/8] drm/bridge: analogix_dp: Fix connector and encoder
cleanup
  - [PATCH v8 3/8] drm/rockchip: analogix_dp: Add a sanity check for
rockchip_drm_psr_register()
- The following patches from v8 has been superseeded.
  - [PATCH v8 7/8] drm/bridge/synopsys: dw-hdmi: Do not use device's
drvdata
- Superseeded by 
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=eea034af90c64802fd747a9dc534c26a7ebe7754
- Moved clk_disable_unprepare reordering in unbin to separate patch.
- Added new patch to reorder clk_disable_unprepare call in inno_hdmi
  unbind()
- dw_hdmi: Rewrite the commit message to reflect the change.

Jeffy Chen (5):
  drm/rockchip: dw-mipi-dsi: Fix connector and encoder cleanup.
  drm/rockchip: inno_hdmi: Fix error handling path.
  drm/rockchip: inno_hdmi: reorder clk_disable_unprepare call in unbind
  drm/rockchip: dw_hdmi: Move HDMI vpll clock enable to bind()
  drm/bridge/synopsys: dw-hdmi: Add missing bridge detach

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c   |  8 
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c  |  8 ++--
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 17 +
 drivers/gpu/drm/rockchip/inno_hdmi.c| 22 +-
 4 files changed, 40 insertions(+), 15 deletions(-)

-- 
2.16.1

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


[PATCH v9 1/5] drm/rockchip: dw-mipi-dsi: Fix connector and encoder cleanup.

2018-03-04 Thread Enric Balletbo i Serra
From: Jeffy Chen 

In bind()'s error handling path call destroy functions instead of
cleanup functions for encoder and connector and reorder to match how is
called in bind().

In unbind() call the connector and encoder destroy functions.

Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
Signed-off-by: Enric Balletbo i Serra 
---

Changes in v9:
- Removed the pm_runtime_disable call as is not really needed.

 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 591953cbdd18..d53d5a09547f 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -1302,8 +1302,8 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
 err_mipi_dsi_host:
mipi_dsi_host_unregister(>dsi_host);
 err_cleanup:
-   drm_encoder_cleanup(>encoder);
-   drm_connector_cleanup(>connector);
+   dsi->connector.funcs->destroy(>connector);
+   dsi->encoder.funcs->destroy(>encoder);
 err_pllref:
clk_disable_unprepare(dsi->pllref_clk);
return ret;
@@ -1316,6 +1316,10 @@ static void dw_mipi_dsi_unbind(struct device *dev, 
struct device *master,
 
mipi_dsi_host_unregister(>dsi_host);
pm_runtime_disable(dev);
+
+   dsi->connector.funcs->destroy(>connector);
+   dsi->encoder.funcs->destroy(>encoder);
+
clk_disable_unprepare(dsi->pllref_clk);
 }
 
-- 
2.16.1

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


[PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach

2018-03-04 Thread Enric Balletbo i Serra
From: Jeffy Chen 

We inited connector in attach(), so need a detach() to cleanup.

Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
Signed-off-by: Enric Balletbo i Serra 
---

Changes in v9: None

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index f9802399cc0d..5626922f95f9 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -1985,6 +1985,13 @@ static int dw_hdmi_bridge_attach(struct drm_bridge 
*bridge)
return 0;
 }
 
+static void dw_hdmi_bridge_detach(struct drm_bridge *bridge)
+{
+   struct dw_hdmi *hdmi = bridge->driver_private;
+
+   drm_connector_cleanup(>connector);
+}
+
 static enum drm_mode_status
 dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge,
  const struct drm_display_mode *mode)
@@ -2041,6 +2048,7 @@ static void dw_hdmi_bridge_enable(struct drm_bridge 
*bridge)
 
 static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.attach = dw_hdmi_bridge_attach,
+   .detach = dw_hdmi_bridge_detach,
.enable = dw_hdmi_bridge_enable,
.disable = dw_hdmi_bridge_disable,
.mode_set = dw_hdmi_bridge_mode_set,
-- 
2.16.1

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


[PATCH v9 2/5] drm/rockchip: inno_hdmi: Fix error handling path.

2018-03-04 Thread Enric Balletbo i Serra
From: Jeffy Chen 

Add missing error handling in bind().

Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
[moved clk_disable_unprepare reordering in unbind to separate patch]
Signed-off-by: Enric Balletbo i Serra 
---

Changes in v9:
- Moved clk_disable_unprepare reordering in unbin to separate patch.

 drivers/gpu/drm/rockchip/inno_hdmi.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c 
b/drivers/gpu/drm/rockchip/inno_hdmi.c
index f6ad48766d49..a5c661930250 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -849,8 +849,10 @@ static int inno_hdmi_bind(struct device *dev, struct 
device *master,
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0)
-   return irq;
+   if (irq < 0) {
+   ret = irq;
+   goto err_disable_clk;
+   }
 
inno_hdmi_reset(hdmi);
 
@@ -858,7 +860,7 @@ static int inno_hdmi_bind(struct device *dev, struct device 
*master,
if (IS_ERR(hdmi->ddc)) {
ret = PTR_ERR(hdmi->ddc);
hdmi->ddc = NULL;
-   return ret;
+   goto err_disable_clk;
}
 
/*
@@ -872,7 +874,7 @@ static int inno_hdmi_bind(struct device *dev, struct device 
*master,
 
ret = inno_hdmi_register(drm, hdmi);
if (ret)
-   return ret;
+   goto err_put_adapter;
 
dev_set_drvdata(dev, hdmi);
 
@@ -882,7 +884,17 @@ static int inno_hdmi_bind(struct device *dev, struct 
device *master,
ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
inno_hdmi_irq, IRQF_SHARED,
dev_name(dev), hdmi);
+   if (ret < 0)
+   goto err_cleanup_hdmi;
 
+   return 0;
+err_cleanup_hdmi:
+   hdmi->connector.funcs->destroy(>connector);
+   hdmi->encoder.funcs->destroy(>encoder);
+err_put_adapter:
+   i2c_put_adapter(hdmi->ddc);
+err_disable_clk:
+   clk_disable_unprepare(hdmi->pclk);
return ret;
 }
 
-- 
2.16.1

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


[Bug 105308] X log ballooning in size with "drmmode_wait_vblank failed for scanout update" and "get vblank counter failed"

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105308

--- Comment #11 from Bob Ham  ---
Created attachment 13
  --> https://bugs.freedesktop.org/attachment.cgi?id=13=edit
First 1000 lines of /var/log/Xorg.0.log (2018-03-04)

Here is an updated version of the Xorg.0.log.  The "flip queue failed in
amdgpu_scanout_flip" error is present again.

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


[Bug 105308] X log ballooning in size with "drmmode_wait_vblank failed for scanout update" and "get vblank counter failed"

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105308

Bob Ham  changed:

   What|Removed |Added

 Attachment #137719|0   |1
is obsolete||

--- Comment #10 from Bob Ham  ---
Created attachment 137776
  --> https://bugs.freedesktop.org/attachment.cgi?id=137776=edit
Output of xrandr --verbose

Output of xrandr --verbose while the error is really occurring

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


[Bug 105308] X log ballooning in size with "drmmode_wait_vblank failed for scanout update" and "get vblank counter failed"

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105308

Bob Ham  changed:

   What|Removed |Added

 Attachment #137723|0   |1
is obsolete||

--- Comment #8 from Bob Ham  ---
Created attachment 137774
  --> https://bugs.freedesktop.org/attachment.cgi?id=137774=edit
Kernel output while setting /sys/module/drm/parameters/debug to 255 with
monitor off

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


[Bug 105308] X log ballooning in size with "drmmode_wait_vblank failed for scanout update" and "get vblank counter failed"

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105308

--- Comment #9 from Bob Ham  ---
Created attachment 137775
  --> https://bugs.freedesktop.org/attachment.cgi?id=137775=edit
Kernel output while setting /sys/module/drm/parameters/debug to 255 with
monitor off while playing video

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


[Bug 105308] X log ballooning in size with "drmmode_wait_vblank failed for scanout update" and "get vblank counter failed"

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105308

--- Comment #7 from Bob Ham  ---
(In reply to Michel Dänzer from comment #6)
> Please make sure the problem is actually occurring when you capture the
> dmesg debugging output.

I've discovered that the problem occurs when the monitor is switched off.  With
just the monitor off, the "get vblank counter failed: Invalid argument" error
appears.  With the monitor off while playing a video, both the aforementioned
error and "drmmode_wait_vblank failed for scanout update: Invalid argument"
appears.  I'll attach two kernel logs as instructed, one for each condition.

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


[Bug 102553] Venus PRO R9 M265X amdgpu: Kernel OOPS si_dpm_set_power_state unable to handle kernel NULL pointer dereference

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102553

--- Comment #5 from mercuriete  ---
The width lanes calculation on radeon is a different bug of amdgpu null
dereference.

But at least that patch silence that warning.

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


[Bug 105244] NULL dereference during startup of Cape Verde with AMDGPU and GPU passthrough

2018-03-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105244

--- Comment #5 from mercuriete  ---
Sorry for the noise:

I have a null dereference in a Cape Verde but not in bootup

my bug is https://bugs.freedesktop.org/show_bug.cgi?id=102553

Can somebody check that bug

It blocks me to switch from radeon to amdgpu.

Thank you very much.

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


Re: [PATCH] drm/sun4i: move rgb mode_valid from connector to encoder

2018-03-04 Thread Giulio Benetti

Hello everybody,

I wanted to move function sun4i_rgb_encoder_mode_valid from connector 
section to encoder section.
This is why it changes so many things, I don't know if it is the right 
way to do this.

Let me know.

Thanks

--
Giulio Benetti
CTO

MICRONOVA SRL
Sede: Via A. Niedda 3 - 35010 Vigonza (PD)
Tel. 049/8931563 - Fax 049/8931346
Cod.Fiscale - P.IVA 02663420285
Capitale Sociale € 26.000 i.v.
Iscritta al Reg. Imprese di Padova N. 02663420285
Numero R.E.A. 258642

Il 04/03/2018 11:37, Giulio Benetti ha scritto:

mode_valid function must be connected to encoder, not connector.
Otherwise it doesn't get called by drm.

Move mode_valid function pointer to encoder helper functions,
changing its prototype according to encoder helper function pointer.

Signed-off-by: Giulio Benetti 
---
  drivers/gpu/drm/sun4i/sun4i_rgb.c | 102 +++---
  1 file changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index b8da5a5..6539dcc 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -52,11 +52,59 @@ static int sun4i_rgb_get_modes(struct drm_connector 
*connector)
return drm_panel_get_modes(tcon->panel);
  }
  
-static int sun4i_rgb_mode_valid(struct drm_connector *connector,

-   struct drm_display_mode *mode)
+static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
+   .get_modes  = sun4i_rgb_get_modes,
+};
+
+static void
+sun4i_rgb_connector_destroy(struct drm_connector *connector)
  {
struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
struct sun4i_tcon *tcon = rgb->tcon;
+
+   drm_panel_detach(tcon->panel);
+   drm_connector_cleanup(connector);
+}
+
+static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .destroy= sun4i_rgb_connector_destroy,
+   .reset  = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
+};
+
+static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
+{
+   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
+   struct sun4i_tcon *tcon = rgb->tcon;
+
+   DRM_DEBUG_DRIVER("Enabling RGB output\n");
+
+   if (!IS_ERR(tcon->panel)) {
+   drm_panel_prepare(tcon->panel);
+   drm_panel_enable(tcon->panel);
+   }
+}
+
+static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
+{
+   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
+   struct sun4i_tcon *tcon = rgb->tcon;
+
+   DRM_DEBUG_DRIVER("Disabling RGB output\n");
+
+   if (!IS_ERR(tcon->panel)) {
+   drm_panel_disable(tcon->panel);
+   drm_panel_unprepare(tcon->panel);
+   }
+}
+
+static enum drm_mode_status sun4i_rgb_encoder_mode_valid(struct drm_encoder 
*crtc,
+const struct 
drm_display_mode *mode)
+{
+   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(crtc);
+   struct sun4i_tcon *tcon = rgb->tcon;
u32 hsync = mode->hsync_end - mode->hsync_start;
u32 vsync = mode->vsync_end - mode->vsync_start;
unsigned long rate = mode->clock * 1000;
@@ -106,58 +154,10 @@ static int sun4i_rgb_mode_valid(struct drm_connector 
*connector,
return MODE_OK;
  }
  
-static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {

-   .get_modes  = sun4i_rgb_get_modes,
-   .mode_valid = sun4i_rgb_mode_valid,
-};
-
-static void
-sun4i_rgb_connector_destroy(struct drm_connector *connector)
-{
-   struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
-   struct sun4i_tcon *tcon = rgb->tcon;
-
-   drm_panel_detach(tcon->panel);
-   drm_connector_cleanup(connector);
-}
-
-static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
-   .fill_modes = drm_helper_probe_single_connector_modes,
-   .destroy= sun4i_rgb_connector_destroy,
-   .reset  = drm_atomic_helper_connector_reset,
-   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-   .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
-};
-
-static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
-{
-   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
-   struct sun4i_tcon *tcon = rgb->tcon;
-
-   DRM_DEBUG_DRIVER("Enabling RGB output\n");
-
-   if (!IS_ERR(tcon->panel)) {
-   drm_panel_prepare(tcon->panel);
-   drm_panel_enable(tcon->panel);
-   }
-}
-
-static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
-{
-   struct sun4i_rgb *rgb = 

[PATCH] drm/sun4i: move rgb mode_valid from connector to encoder

2018-03-04 Thread Giulio Benetti
mode_valid function must be connected to encoder, not connector.
Otherwise it doesn't get called by drm.

Move mode_valid function pointer to encoder helper functions,
changing its prototype according to encoder helper function pointer.

Signed-off-by: Giulio Benetti 
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c | 102 +++---
 1 file changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index b8da5a5..6539dcc 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -52,11 +52,59 @@ static int sun4i_rgb_get_modes(struct drm_connector 
*connector)
return drm_panel_get_modes(tcon->panel);
 }
 
-static int sun4i_rgb_mode_valid(struct drm_connector *connector,
-   struct drm_display_mode *mode)
+static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
+   .get_modes  = sun4i_rgb_get_modes,
+};
+
+static void
+sun4i_rgb_connector_destroy(struct drm_connector *connector)
 {
struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
struct sun4i_tcon *tcon = rgb->tcon;
+
+   drm_panel_detach(tcon->panel);
+   drm_connector_cleanup(connector);
+}
+
+static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .destroy= sun4i_rgb_connector_destroy,
+   .reset  = drm_atomic_helper_connector_reset,
+   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+   .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
+};
+
+static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
+{
+   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
+   struct sun4i_tcon *tcon = rgb->tcon;
+
+   DRM_DEBUG_DRIVER("Enabling RGB output\n");
+
+   if (!IS_ERR(tcon->panel)) {
+   drm_panel_prepare(tcon->panel);
+   drm_panel_enable(tcon->panel);
+   }
+}
+
+static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
+{
+   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
+   struct sun4i_tcon *tcon = rgb->tcon;
+
+   DRM_DEBUG_DRIVER("Disabling RGB output\n");
+
+   if (!IS_ERR(tcon->panel)) {
+   drm_panel_disable(tcon->panel);
+   drm_panel_unprepare(tcon->panel);
+   }
+}
+
+static enum drm_mode_status sun4i_rgb_encoder_mode_valid(struct drm_encoder 
*crtc,
+const struct 
drm_display_mode *mode)
+{
+   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(crtc);
+   struct sun4i_tcon *tcon = rgb->tcon;
u32 hsync = mode->hsync_end - mode->hsync_start;
u32 vsync = mode->vsync_end - mode->vsync_start;
unsigned long rate = mode->clock * 1000;
@@ -106,58 +154,10 @@ static int sun4i_rgb_mode_valid(struct drm_connector 
*connector,
return MODE_OK;
 }
 
-static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
-   .get_modes  = sun4i_rgb_get_modes,
-   .mode_valid = sun4i_rgb_mode_valid,
-};
-
-static void
-sun4i_rgb_connector_destroy(struct drm_connector *connector)
-{
-   struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
-   struct sun4i_tcon *tcon = rgb->tcon;
-
-   drm_panel_detach(tcon->panel);
-   drm_connector_cleanup(connector);
-}
-
-static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
-   .fill_modes = drm_helper_probe_single_connector_modes,
-   .destroy= sun4i_rgb_connector_destroy,
-   .reset  = drm_atomic_helper_connector_reset,
-   .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-   .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
-};
-
-static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
-{
-   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
-   struct sun4i_tcon *tcon = rgb->tcon;
-
-   DRM_DEBUG_DRIVER("Enabling RGB output\n");
-
-   if (!IS_ERR(tcon->panel)) {
-   drm_panel_prepare(tcon->panel);
-   drm_panel_enable(tcon->panel);
-   }
-}
-
-static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
-{
-   struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
-   struct sun4i_tcon *tcon = rgb->tcon;
-
-   DRM_DEBUG_DRIVER("Disabling RGB output\n");
-
-   if (!IS_ERR(tcon->panel)) {
-   drm_panel_disable(tcon->panel);
-   drm_panel_unprepare(tcon->panel);
-   }
-}
-
 static struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
.disable= sun4i_rgb_encoder_disable,
.enable = sun4i_rgb_encoder_enable,
+   .mode_valid = sun4i_rgb_encoder_mode_valid,
 };
 
 static void 

Re: [PATCH] drm/dp: only accept valid DP_TRAINING_AUX_RD_INTERVAL values

2018-03-04 Thread Jani Nikula
On Fri, 02 Mar 2018, Rodrigo Vivi  wrote:
> On Fri, Mar 02, 2018 at 02:25:58PM -0800, matthew.s.atw...@intel.com wrote:
>> From: Matt Atwood 
>> 
>> For panels that do not follow Display Port specifications mask off invalid
>> values for DP_TRAINING_AUX_RD_INTERVAL. Specification lists acceptable
>> values 0-4 all other values are reserved and bit 7 of DPCD 0xe
>> describes another feature. Currently the code uses all of DPCD 0xe and
>> can cause max wait for 1024 ms instead of 16 ms as specified table 2-158.
>> This address is read for both clock recovery and channel equalization.
>> 
>> Signed-off-by: Matt Atwood 
>> ---
>>  drivers/gpu/drm/drm_dp_helper.c | 4 ++--
>>  include/drm/drm_dp_helper.h | 1 +
>>  2 files changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/drm_dp_helper.c 
>> b/drivers/gpu/drm/drm_dp_helper.c
>> index adf79be..a7e9b75 100644
>> --- a/drivers/gpu/drm/drm_dp_helper.c
>> +++ b/drivers/gpu/drm/drm_dp_helper.c
>> @@ -122,7 +122,7 @@ void drm_dp_link_train_clock_recovery_delay(const u8 
>> dpcd[DP_RECEIVER_CAP_SIZE])
>>  if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] == 0)
>>  udelay(100);
>>  else
>> -mdelay(dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4);
>> +mdelay((dpcd[DP_TRAINING_AUX_RD_INTERVAL] & 
>> DP_TRAINING_AUX_RD_MASK) * 4);
>>  }
>>  EXPORT_SYMBOL(drm_dp_link_train_clock_recovery_delay);
>>  
>> @@ -130,7 +130,7 @@ void drm_dp_link_train_channel_eq_delay(const u8 
>> dpcd[DP_RECEIVER_CAP_SIZE]) {
>>  if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] == 0)
>>  udelay(400);
>>  else
>> -mdelay(dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4);
>> +mdelay((dpcd[DP_TRAINING_AUX_RD_INTERVAL] & 
>> DP_TRAINING_AUX_RD_MASK) * 4);
>>  }
>>  EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay);
>>  
>> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
>> index da58a42..77ba003 100644
>> --- a/include/drm/drm_dp_helper.h
>> +++ b/include/drm/drm_dp_helper.h
>> @@ -118,6 +118,7 @@
>>  # define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher 
>> */
>>  
>>  #define DP_TRAINING_AUX_RD_INTERVAL 0x00e   /* XXX 1.2? */
>> +# define DP_TRAINING_AUX_RD_MASK0x7 /* 1.4 */
>
> I confirmed it is already part of 1.2 and 1.3
> So probably a good idea to already to s/XXX 1.2?/1.2/
> but this is optional and up to you.
>
> With s/1.4/1.2 feel free to add:
>
> Reviewed-by: Rodrigo Vivi 

Please send v2 Cc: intel-gfx so we get i915 CI on this. It doesn't
automatically happen on dri-devel yet.

BR,
Jani.

>
> (well... in a hope that no other bad panel uses 5,6 or 7,
> that are also reserved values. But I believe these cases shouldn't
> be as bad as this one you faced here anyways)
>
>>  
>>  #define DP_ADAPTER_CAP  0x00f   /* 1.2 */
>>  # define DP_FORCE_LOAD_SENSE_CAP(1 << 0)
>> -- 
>> 2.7.4
>> 
>> ___
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Technology Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/dp: only accept valid DP_TRAINING_AUX_RD_INTERVAL values

2018-03-04 Thread Jani Nikula
On Fri, 02 Mar 2018, matthew.s.atw...@intel.com wrote:
> From: Matt Atwood 
>
> For panels that do not follow Display Port specifications mask off invalid
> values for DP_TRAINING_AUX_RD_INTERVAL. Specification lists acceptable
> values 0-4 all other values are reserved and bit 7 of DPCD 0xe
> describes another feature. Currently the code uses all of DPCD 0xe and
> can cause max wait for 1024 ms instead of 16 ms as specified table 2-158.
> This address is read for both clock recovery and channel equalization.
>
> Signed-off-by: Matt Atwood 

Cc: sta...@vger.kernel.org

> ---
>  drivers/gpu/drm/drm_dp_helper.c | 4 ++--
>  include/drm/drm_dp_helper.h | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index adf79be..a7e9b75 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -122,7 +122,7 @@ void drm_dp_link_train_clock_recovery_delay(const u8 
> dpcd[DP_RECEIVER_CAP_SIZE])
>   if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] == 0)
>   udelay(100);
>   else
> - mdelay(dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4);
> + mdelay((dpcd[DP_TRAINING_AUX_RD_INTERVAL] & 
> DP_TRAINING_AUX_RD_MASK) * 4);
>  }
>  EXPORT_SYMBOL(drm_dp_link_train_clock_recovery_delay);
>  
> @@ -130,7 +130,7 @@ void drm_dp_link_train_channel_eq_delay(const u8 
> dpcd[DP_RECEIVER_CAP_SIZE]) {
>   if (dpcd[DP_TRAINING_AUX_RD_INTERVAL] == 0)
>   udelay(400);
>   else
> - mdelay(dpcd[DP_TRAINING_AUX_RD_INTERVAL] * 4);
> + mdelay((dpcd[DP_TRAINING_AUX_RD_INTERVAL] & 
> DP_TRAINING_AUX_RD_MASK) * 4);
>  }
>  EXPORT_SYMBOL(drm_dp_link_train_channel_eq_delay);
>  
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index da58a42..77ba003 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -118,6 +118,7 @@
>  # define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher 
> */
>  
>  #define DP_TRAINING_AUX_RD_INTERVAL 0x00e   /* XXX 1.2? */
> +# define DP_TRAINING_AUX_RD_MASK0x7 /* 1.4 */
>  
>  #define DP_ADAPTER_CAP   0x00f   /* 1.2 */
>  # define DP_FORCE_LOAD_SENSE_CAP (1 << 0)

-- 
Jani Nikula, Intel Open Source Technology Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel