* [PATCH xf86-video-amdgpu] Add checking color management properties
@ 2018-09-10 11:14 Aaron Liu
[not found] ` <20180910111414.19592-1-aaron.liu-5C7GfCeVMHo@public.gmane.org>
2018-09-10 15:58 ` Michel Dänzer
0 siblings, 2 replies; 4+ messages in thread
From: Aaron Liu @ 2018-09-10 11:14 UTC (permalink / raw)
To: dri-devel; +Cc: Aaron Liu
Add gamma_lut/degamma_lut/ctm checking before pushing
staged color management properties on the CRTC.
If above object is NULL, return directly.
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
---
src/drmmode_display.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 68fca1b..006ae7c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1116,6 +1116,11 @@ static int drmmode_crtc_push_cm_prop(xf86CrtcPtr crtc,
switch (cm_prop_index) {
case CM_GAMMA_LUT:
+ if (!drmmode_crtc->gamma_lut) {
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
+ "gamma_lut is NULL!\n");
+ return BadRequest;
+ }
/* Calculate the expected size of value in bytes */
expected_bytes = sizeof(struct drm_color_lut) *
drmmode->gamma_lut_size;
@@ -1154,11 +1159,21 @@ static int drmmode_crtc_push_cm_prop(xf86CrtcPtr crtc,
}
break;
case CM_DEGAMMA_LUT:
+ if (!drmmode_crtc->degamma_lut) {
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
+ "degamma_lut is NULL!\n");
+ return BadRequest;
+ }
expected_bytes = sizeof(struct drm_color_lut) *
drmmode->degamma_lut_size;
blob_data = drmmode_crtc->degamma_lut;
break;
case CM_CTM:
+ if (!drmmode_crtc->ctm) {
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
+ "ctm is NULL!\n");
+ return BadRequest;
+ }
expected_bytes = sizeof(struct drm_color_ctm);
blob_data = drmmode_crtc->ctm;
break;
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH xf86-video-amdgpu] Add checking color management properties
2018-09-10 11:14 [PATCH xf86-video-amdgpu] Add checking color management properties Aaron Liu
[not found] ` <20180910111414.19592-1-aaron.liu-5C7GfCeVMHo@public.gmane.org>
@ 2018-09-10 15:58 ` Michel Dänzer
1 sibling, 0 replies; 4+ messages in thread
From: Michel Dänzer @ 2018-09-10 15:58 UTC (permalink / raw)
To: Aaron Liu; +Cc: amd-gfx
Hi Aaron,
thanks for the patch. Moving to the amd-gfx mailing list, where
xf86-video-amdgpu patches are reviewed. Comments inline below.
On 2018-09-10 1:14 p.m., Aaron Liu wrote:
> Add gamma_lut/degamma_lut/ctm checking before pushing
> staged color management properties on the CRTC.
> If above object is NULL, return directly.
>
> Signed-off-by: Aaron Liu <aaron.liu@amd.com>
> ---
> src/drmmode_display.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 68fca1b..006ae7c 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -1116,6 +1116,11 @@ static int drmmode_crtc_push_cm_prop(xf86CrtcPtr crtc,
>
> switch (cm_prop_index) {
> case CM_GAMMA_LUT:
> + if (!drmmode_crtc->gamma_lut) {
> + xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
> + "gamma_lut is NULL!\n");
> + return BadRequest;
> + }
> /* Calculate the expected size of value in bytes */
> expected_bytes = sizeof(struct drm_color_lut) *
> drmmode->gamma_lut_size;
> @@ -1154,11 +1159,21 @@ static int drmmode_crtc_push_cm_prop(xf86CrtcPtr crtc,
> }
> break;
> case CM_DEGAMMA_LUT:
> + if (!drmmode_crtc->degamma_lut) {
> + xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
> + "degamma_lut is NULL!\n");
> + return BadRequest;
> + }
> expected_bytes = sizeof(struct drm_color_lut) *
> drmmode->degamma_lut_size;
> blob_data = drmmode_crtc->degamma_lut;
> break;
> case CM_CTM:
> + if (!drmmode_crtc->ctm) {
> + xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
> + "ctm is NULL!\n");
> + return BadRequest;
> + }
> expected_bytes = sizeof(struct drm_color_ctm);
> blob_data = drmmode_crtc->ctm;
> break;
>
(How) were you able to actually trigger this condition in practice? The
only way I could imagine is via drmmode_output_set_property, in which
case I think it would be better to guard all the *cm_* related code
there with
if (drmmode_cm_enabled(drmmode_output->drmmode)) {
...
}
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH xf86-video-amdgpu] Add checking color management properties
[not found] ` <20180910111414.19592-1-aaron.liu-5C7GfCeVMHo@public.gmane.org>
@ 2018-09-10 15:58 ` Michel Dänzer
[not found] ` <fb58a920-6e5d-e042-4650-ba8155c7a953-otUistvHUpPR7s880joybQ@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2018-09-10 15:58 UTC (permalink / raw)
To: Aaron Liu; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Hi Aaron,
thanks for the patch. Moving to the amd-gfx mailing list, where
xf86-video-amdgpu patches are reviewed. Comments inline below.
On 2018-09-10 1:14 p.m., Aaron Liu wrote:
> Add gamma_lut/degamma_lut/ctm checking before pushing
> staged color management properties on the CRTC.
> If above object is NULL, return directly.
>
> Signed-off-by: Aaron Liu <aaron.liu@amd.com>
> ---
> src/drmmode_display.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 68fca1b..006ae7c 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -1116,6 +1116,11 @@ static int drmmode_crtc_push_cm_prop(xf86CrtcPtr crtc,
>
> switch (cm_prop_index) {
> case CM_GAMMA_LUT:
> + if (!drmmode_crtc->gamma_lut) {
> + xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
> + "gamma_lut is NULL!\n");
> + return BadRequest;
> + }
> /* Calculate the expected size of value in bytes */
> expected_bytes = sizeof(struct drm_color_lut) *
> drmmode->gamma_lut_size;
> @@ -1154,11 +1159,21 @@ static int drmmode_crtc_push_cm_prop(xf86CrtcPtr crtc,
> }
> break;
> case CM_DEGAMMA_LUT:
> + if (!drmmode_crtc->degamma_lut) {
> + xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
> + "degamma_lut is NULL!\n");
> + return BadRequest;
> + }
> expected_bytes = sizeof(struct drm_color_lut) *
> drmmode->degamma_lut_size;
> blob_data = drmmode_crtc->degamma_lut;
> break;
> case CM_CTM:
> + if (!drmmode_crtc->ctm) {
> + xf86DrvMsg(crtc->scrn->scrnIndex, X_WARNING,
> + "ctm is NULL!\n");
> + return BadRequest;
> + }
> expected_bytes = sizeof(struct drm_color_ctm);
> blob_data = drmmode_crtc->ctm;
> break;
>
(How) were you able to actually trigger this condition in practice? The
only way I could imagine is via drmmode_output_set_property, in which
case I think it would be better to guard all the *cm_* related code
there with
if (drmmode_cm_enabled(drmmode_output->drmmode)) {
...
}
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH xf86-video-amdgpu] Add checking color management properties
[not found] ` <fb58a920-6e5d-e042-4650-ba8155c7a953-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-09-11 9:15 ` Michel Dänzer
0 siblings, 0 replies; 4+ messages in thread
From: Michel Dänzer @ 2018-09-11 9:15 UTC (permalink / raw)
To: Aaron Liu; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On 2018-09-10 5:58 p.m., Michel Dänzer wrote:
> On 2018-09-10 1:14 p.m., Aaron Liu wrote:
>> Add gamma_lut/degamma_lut/ctm checking before pushing
>> staged color management properties on the CRTC.
>> If above object is NULL, return directly.
>
> (How) were you able to actually trigger this condition in practice?
It has become clear from AMD internal e-mails that this patch was
motivated by the same problem that was fixed by
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/commit/a923bedfd91d39977dbf95f296cf9b68439490f2
. This patch is thus no longer needed.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-09-11 9:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-10 11:14 [PATCH xf86-video-amdgpu] Add checking color management properties Aaron Liu
[not found] ` <20180910111414.19592-1-aaron.liu-5C7GfCeVMHo@public.gmane.org>
2018-09-10 15:58 ` Michel Dänzer
[not found] ` <fb58a920-6e5d-e042-4650-ba8155c7a953-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-09-11 9:15 ` Michel Dänzer
2018-09-10 15:58 ` Michel Dänzer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.