drm: fsl-dcu: Fix no fb check bug
Subsystems (3)
PATCH RESEND 1/3 drm: fsl-dcu: Fix no fb check bug
From: Jianwei Wang <[email protected]>
For state->fb may be NULL in fsl_dcu_drm_plane_atomic_check function, if so, return -EINVAL. No need check in fsl_dcu_drm_plane_atomic_update anymore.
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +3 -3
@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane *plane, {struct drm_framebuffer *fb = state->fb; +if (!fb) +return -EINVAL ; +switch (fb->pixel_format) {case DRM_FORMAT_RGB565 :case DRM_FORMAT_RGB888 :
@@ -85,9 +88,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane *plane,unsigned int alpha, bpp;int index, ret; -if (!fb) -return ; - index =fsl_dcu_drm_plane_index (plane);if (index <0 )return ;
Signature · 6 lines
2.1.0.27.g96db324 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
-----邮件原件-----
发件人: Dongsheng Wang [mailto:[email protected]]
发送时间: Tuesday, December 01, 2015 4:16 PM
收件人: [email protected]
抄送: [email protected]; [email protected]; Jianwei Wang <[email protected]>; Yi Meng-B56799 <[email protected]>; Wang Dongsheng-B40534 <[email protected]> 主题: [RESEND 1/3] drm: fsl-dcu: Fix no fb check bug
From: Jianwei Wang <[email protected]>
For state->fb may be NULL in fsl_dcu_drm_plane_atomic_check function, if so, return -EINVAL. No need check in fsl_dcu_drm_plane_atomic_update anymore.
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +3 -3
@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane *plane, {struct drm_framebuffer *fb = state->fb; +if (!fb) +return -EINVAL ; +switch (fb->pixel_format) {case DRM_FORMAT_RGB565 :case DRM_FORMAT_RGB888 :
@@ -85,9 +88,6 @@ static void fsl_dcu_drm_plane_atomic_update(struct drm_plane *plane,unsigned int alpha, bpp;int index, ret; -if (!fb) -return ; - index =fsl_dcu_drm_plane_index (plane);if (index <0 )return ;
--
2.1.0.27.g96db324
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Stefan Agner
maintainerHi Meng,
The only situation I could observe that is when fsl,panel was not valid...
However, I think with my patch "drm/fsl-dcu: Fix no fb check bug", this situation can be avoided completely:
https://lkml.org/lkml/2015/11/18/950
With that patch applied, and a non-existing panel assigned, the DRM driver already fails at probe time gracefully:
[ 0.488291] [drm] Initialized drm 1.1.0 20060810 [ 0.501576] fsl-dcu 40058000.dcu: failed to initialize mode setting
So I think that a state->fb check for NULL is not necessary at all...
Can you test my patch to see if it fixes the issue for you too?
--
Stefan
Quoted 47 lines · Meng Yi
Tested-by Meng Yi <[email protected]>-----邮件原件-----
发件人: Dongsheng Wang [mailto:[email protected]] 发送时间: Tuesday, December 01, 2015 4:16 PM
收件人: [email protected]
抄送: [email protected]; [email protected]; Jianwei Wang <[email protected]>; Yi Meng-B56799 <[email protected]>; Wang Dongsheng-B40534 <[email protected]>
主题: [RESEND 1/3] drm: fsl-dcu: Fix no fb check bugFrom: Jianwei Wang <[email protected]>
For
state->fbmay be NULL infsl_dcu_drm_plane_atomic_checkfunction, if so, return-EINVAL. No need check infsl_dcu_drm_plane_atomic_updateanymore.Signed-off-by Jianwei Wang <[email protected]>Signed-off-by Yi Meng <[email protected]>Signed-off-by Wang Dongsheng <[email protected]>Tested-by Stefan Agner <[email protected]>drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +3
-3@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane *plane, {struct drm_framebuffer *fb = state->fb; +if (!fb) +return -EINVAL ; +switch (fb->pixel_format) {case DRM_FORMAT_RGB565 :case DRM_FORMAT_RGB888 :@@ -85,9 +88,6 @@ static void fsl_dcu_drm_plane_atomic_update(structdrm_plane *plane, unsigned int alpha, bpp;int index, ret; -if (!fb) -return ; - index =fsl_dcu_drm_plane_index (plane);if (index <0 )
Quoted 3 lines
return;
--
2.1.0.27.g96db324
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Stefan,
Quoted 5 lines · Stefan Agner
However, I think with my patch "drm/fsl-dcu: Fix no fb check bug", this situation can be avoided completely:
https://lkml.org/lkml/2015/11/18/950
Quoted 9 lines
With that patch applied, and a non-existing panel assigned, the DRM driver already fails at probe time gracefully:
[ 0.488291] [drm] Initialized drm 1.1.0 20060810 [ 0.501576] fsl-dcu 40058000.dcu: failed to initialize mode settingSo I think that a
state->fbcheck for NULL is not necessary at all...Can you test my patch to see if it fixes the issue for you too?
This is still required; state->fb being NULL means the plane is being disabled.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi, Stefan
I have tested your patch, It seems good to me.
But I think state->fb check is still necessary, because fb is related to crtc , and panel is related to connector,. When fsl,panel is not valid, it indicate that connector is not available, but fb check is still needed. But I am not so sure, and what do you think?
--
Meng Yi
-----Original Message-----
From: Stefan Agner [mailto:[email protected]]
Sent: Sunday, December 27, 2015 11:54 AM
To: Meng Yi <[email protected]>
Cc: Dongsheng Wang <[email protected]>; [email protected]; [email protected]; Jianwei Wang <[email protected]>; Yi Meng-B56799 <[email protected]>
Subject: Re: 答复: [RESEND 1/3] drm: fsl-dcu: Fix no fb check bug
Hi Meng,
The only situation I could observe that is when fsl,panel was not valid...
However, I think with my patch "drm/fsl-dcu: Fix no fb check bug", this situation can be avoided completely:
https://lkml.org/lkml/2015/11/18/950
With that patch applied, and a non-existing panel assigned, the DRM driver already fails at probe time gracefully:
[ 0.488291] [drm] Initialized drm 1.1.0 20060810 [ 0.501576] fsl-dcu 40058000.dcu: failed to initialize mode setting
So I think that a state->fb check for NULL is not necessary at all...
Can you test my patch to see if it fixes the issue for you too?
--
Stefan
Quoted 47 lines · Meng Yi
Tested-by Meng Yi <[email protected]>-----邮件原件-----
发件人: Dongsheng Wang [mailto:[email protected]] 发送时间: Tuesday, December 01, 2015 4:16 PM
收件人: [email protected]
抄送: [email protected]; [email protected]; Jianwei Wang <[email protected]>; Yi Meng-B56799 <[email protected]>; Wang Dongsheng-B40534 <[email protected]>
主题: [RESEND 1/3] drm: fsl-dcu: Fix no fb check bugFrom: Jianwei Wang <[email protected]>
For
state->fbmay be NULL infsl_dcu_drm_plane_atomic_checkfunction, if so, return-EINVAL. No need check infsl_dcu_drm_plane_atomic_updateanymore.Signed-off-by Jianwei Wang <[email protected]>Signed-off-by Yi Meng <[email protected]>Signed-off-by Wang Dongsheng <[email protected]>Tested-by Stefan Agner <[email protected]>drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +3
-3@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane *plane, {struct drm_framebuffer *fb = state->fb; +if (!fb) +return -EINVAL ; +switch (fb->pixel_format) {case DRM_FORMAT_RGB565 :case DRM_FORMAT_RGB888 :@@ -85,9 +88,6 @@ static void fsl_dcu_drm_plane_atomic_update(structdrm_plane *plane, unsigned int alpha, bpp;int index, ret; -if (!fb) -return ; - index =fsl_dcu_drm_plane_index (plane);if (index <0 )
Quoted 3 lines
return;
--
2.1.0.27.g96db324
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 2 lines · Meng Yi
I have tested your patch, It seems good to me.
But I thinkstate->fbcheck is still necessary, because fb is related to crtc , and panel is related to connector,. When fsl,panel is not valid, it indicate that connector is not available, but fb check is still needed. But I am not so sure, and what do you think?
fb is tied to planes. Planes are tied to CRTCs. CRTCs are tied to connectors. Connectors are tied to the panel. If the panel is not found, no connectors will be activated, so no CRTCs will be enabled, so no planes will be enabled.
Please let me be very clear though: setting fb == NULL is legitimate. Userspace may do this at any time. Crashing when plane->state->fb == NULL is an error in your driver and must be fixed.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Daniel Stone
Hi,
Quoted 2 lines · Meng Yi
I have tested your patch, It seems good to me.
But I thinkstate->fbcheck is still necessary, because fb is related to crtc , and panel is related to connector,. When fsl,panel is not valid, it indicate that connector is not available, but fb check is still needed. But I am not so sure, and what do you think?
Quoted 8 lines
fb is tied to planes. Planes are tied to CRTCs. CRTCs are tied to connectors. Connectors are tied to the panel. If the panel is not found, no connectors will be activated, so no CRTCs will be enabled, so no planes will be enabled.
Please let me be very clear though: setting fb == NULL is legitimate. Userspace may do this at any time. Crashing when
plane->state->fb== NULL is an error in your driver and must be fixed.
Thanks for this clarification. Ok, I agree the patch is needed despite my fix then...
--
Stefan
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi, Daniel
Thanks for your clarification, and I will fix this error.
--
Meng
-----Original Message-----
From: Daniel Stone [mailto:[email protected]]
Sent: Friday, January 01, 2016 11:10 PM
To: Meng Yi <[email protected]>
Cc: Stefan Agner <[email protected]>; [email protected]; Yi Meng-B56799 <[email protected]>
Subject: Re: 答复: [RESEND 1/3] drm: fsl-dcu: Fix no fb check bug
Hi,
Quoted 2 lines · Meng Yi
I have tested your patch, It seems good to me.
But I thinkstate->fbcheck is still necessary, because fb is related to crtc , and panel is related to connector,. When fsl,panel is not valid, it indicate that connector is not available, but fb check is still needed. But I am not so sure, and what do you think?
fb is tied to planes. Planes are tied to CRTCs. CRTCs are tied to connectors. Connectors are tied to the panel. If the panel is not found, no connectors will be activated, so no CRTCs will be enabled, so no planes will be enabled.
Please let me be very clear though: setting fb == NULL is legitimate.
Userspace may do this at any time. Crashing when plane->state->fb == NULL is an error in your driver and must be fixed.
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
Quoted 16 lines · Dongsheng Wang
From: Jianwei Wang <[email protected]>
For
state->fbmay be NULL infsl_dcu_drm_plane_atomic_checkfunction, if so, return-EINVAL. No need check infsl_dcu_drm_plane_atomic_updateanymore.Signed-off-by Jianwei Wang <[email protected]>Signed-off-by Yi Meng <[email protected]>Signed-off-by Wang Dongsheng <[email protected]>Tested-by Stefan Agner <[email protected]>drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +0
-0
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c static int fsl_dcu_drm_plane_atomic_check(struct drm_plane *plane, · line 45
Quoted 5 lines
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c +2
-0@@ -41,6 +41,9 @@ static int fsl_dcu_drm_plane_atomic_check(struct drm_plane *plane, {struct drm_framebuffer *fb = state->fb; +if (!fb) +return -EINVAL ;
This should be return 0 instead, else you can never disable a plane ...
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel