Skip to contentSkip to conversation

modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

PATCH In review Rohit Visavalia 4 participants 9 messages Feb 26, 2020 – Mar 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +1 -1
index b907ab3..379b9ea 100644
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev, unsigned crtc_id, unsigned fourcc)
 
        add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
        add_property_optional(dev, crtc_id, "CTM", 0);
-       if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+       if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
                uint16_t r[256], g[256], b[256];
 
                for (i = 0; i < 256; i++) {

--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 32 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>; Rohit Visavalia <[email protected]>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c index renamed from tests/modetest/modetest.c +0 -0

b907ab3..379b9ea 100644

tests/modetest/modetest.c +1 -1
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev, unsigned
 crtc_id, unsigned fourcc)
 
 	add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
 	add_property_optional(dev, crtc_id, "CTM", 0);
-	if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+	if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
 		uint16_t r[256], g[256], b[256];
 
Quoted 3 lines

for (i = 0; i < 256; i++) {
--
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#2 lore raw

Hi Rohit,

This makes sense to me as gamma was implemented as optional property.

@[email protected], @[email protected], @Ville Syrjälä, Could you please ack and help merge this patch if it also look good to you ?

Regards,
Devarsh

Quoted 50 lines

-----Original Message-----
From: Rohit Visavalia
Sent: 27 February 2020 00:40
To: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>
Subject: RE: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 32 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>; Rohit Visavalia <[email protected]>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +1 -1
index b907ab3..379b9ea 100644
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev,
 unsigned crtc_id, unsigned fourcc)
 
 	add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
 	add_property_optional(dev, crtc_id, "CTM", 0);
-	if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+	if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
 		uint16_t r[256], g[256], b[256];
 
Quoted 3 lines
Quoted 3 lines

for (i = 0; i < 256; i++) {
--
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Pretty sure the current code is right. If the GAMMA_LUT property can't be set, it tries to set gamma the old-fashioned way.

Quoted 61 lines · Devarsh Thakkar

Hi Rohit,

This makes sense to me as gamma was implemented as optional property.

@[email protected], @[email protected], @Ville Syrjälä, Could you please ack and help merge this patch if it also look good to you ?

Regards,
Devarsh

Quoted 50 lines

-----Original Message-----
From: Rohit Visavalia
Sent: 27 February 2020 00:40
To: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>
Subject: RE: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 32 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>; Rohit Visavalia <[email protected]>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +1 -1
index b907ab3..379b9ea 100644
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev,
 unsigned crtc_id, unsigned fourcc)
 
    add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
    add_property_optional(dev, crtc_id, "CTM", 0);
-   if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+   if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
            uint16_t r[256], g[256], b[256];
 
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
            for (i = 0; i < 256; i++) {

--
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Hi Ilia Mirkin,

Thanks for the review.

By old-fashioned way you mean to say using drmModeCrtcSetGamma()? If yes then, it shows error as "failed to set gamma: Function no implemented" if any platform specific drm has no gamma property implemented.

Current code shows error while running modetest for Xilinx drm as it doesn't supports gamma property and ideally it should not show error as gamma is optional property, so it doesn't serve the purpose of optional property.

Please correct me if I am missing anything.

Thanks
Rohit

Quoted 20 lines

-----Original Message-----
From: Ilia Mirkin [mailto:[email protected]]
Sent: Tuesday, March 3, 2020 7:08 PM
To: Devarsh Thakkar <[email protected]>
Cc: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; Ville Syrjälä <[email protected]>; Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

EXTERNAL EMAIL

Pretty sure the current code is right. If the GAMMA_LUT property can't be set, it tries to set gamma the old-fashioned way.

Quoted 1 line · Devarsh Thakkar
Quoted 67 lines
Quoted 6 lines

Hi Rohit,

This makes sense to me as gamma was implemented as optional property.

@[email protected], @[email protected], @Ville Syrjälä,

Could you please ack and help merge this patch if it also look good to you ?

Quoted 60 lines

Regards,
Devarsh

Quoted 55 lines

-----Original Message-----
From: Rohit Visavalia
Sent: 27 February 2020 00:40
To: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>
Subject: RE: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 36 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>; Rohit Visavalia <[email protected]>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +2 -2
index b907ab3..379b9ea 100644
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev,
 unsigned crtc_id, unsigned fourcc)
 
    add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
    add_property_optional(dev, crtc_id, "CTM", 0);
-   if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+   if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id))
+ {
            uint16_t r[256], g[256], b[256];
 
            for (i = 0; i < 256; i++) {
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Hm. I'm not sure offhand how to check if drmModeCrtcSetGamma is supported. I guess you could check if gamma size > 0 or something?

Quoted 98 lines · On Thu, Mar 12, 2020, 02:39 Rohit Visavalia <[email protected]> wrote:

Hi Ilia Mirkin,

Thanks for the review.

By old-fashioned way you mean to say using drmModeCrtcSetGamma()? If yes then, it shows error as "failed to set gamma: Function no implemented" if any platform specific drm has no gamma property implemented.

Current code shows error while running modetest for Xilinx drm as it doesn't supports gamma property and ideally it should not show error as gamma is optional property, so it doesn't serve the purpose of optional property.

Please correct me if I am missing anything.

Thanks
Rohit

Quoted 5 lines

-----Original Message-----
From: Ilia Mirkin [mailto:[email protected]]
Sent: Tuesday, March 3, 2020 7:08 PM
To: Devarsh Thakkar <[email protected]>
Cc: Rohit Visavalia <[email protected]>;

[email protected];

Quoted 1 line

[email protected]; Ville Syrjälä <[email protected]>;

Hyun

Quoted 9 lines

Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

EXTERNAL EMAIL

Pretty sure the current code is right. If the GAMMA_LUT property can't

be set,

Quoted 5 lines

it tries to set gamma the old-fashioned way.

Quoted 1 line · Devarsh Thakkar
Quoted 7 lines
Quoted 6 lines

Hi Rohit,

This makes sense to me as gamma was implemented as optional property.

@[email protected], @[email protected], @Ville Syrjälä,

Could you please ack and help merge this patch if it also look good to

you ?

Quoted 49 lines
Quoted 49 lines

Regards,
Devarsh

Quoted 45 lines

-----Original Message-----
From: Rohit Visavalia
Sent: 27 February 2020 00:40
To: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>
Subject: RE: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 26 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>; Rohit Visavalia <[email protected]>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +0 -0
index b907ab3..379b9ea 100644
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev,
 unsigned crtc_id, unsigned fourcc)
 
Quoted 13 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

tests/modetest/modetest.c static void set_gamma(struct device *dev, unsigned crtc_id, unsigned fourcc)

Quoted 3 lines
tests/modetest/modetest.c +0 -1
    add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
    add_property_optional(dev, crtc_id, "CTM", 0);
-   if (!add_property_optional(dev, crtc_id, "GAMMA_LUT",

blob_id)) {

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
tests/modetest/modetest.c +2 -1
+   if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id))
+ {
            uint16_t r[256], g[256], b[256];
 
            for (i = 0; i < 256; i++) {
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Hi Ilia Mirkin,

But it should not go for setting gamma(drmModeCrtcSetGamma) as user has not asked to do so in just simple mode set command(modetest -M <module> -s 42:3840x2160@RG16).

What is the requirement for setting gamma drmModeCrtcSetGamma() if user has not asked ?

Thanks
Rohit

From: Ilia Mirkin [mailto:[email protected]]
Sent: Thursday, March 12, 2020 3:49 PM
To: Rohit Visavalia <[email protected]>
Cc: Devarsh Thakkar <[email protected]>; dri-devel <[email protected]>; [email protected]; Ville Syrjälä <[email protected]>; Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Hm. I'm not sure offhand how to check if drmModeCrtcSetGamma is supported. I guess you could check if gamma size > 0 or something?

On Thu, Mar 12, 2020, 02:39 Rohit Visavalia <[email protected]<mailto:[email protected]>> wrote:
Hi Ilia Mirkin,

Thanks for the review.

By old-fashioned way you mean to say using drmModeCrtcSetGamma()? If yes then, it shows error as "failed to set gamma: Function no implemented" if any platform specific drm has no gamma property implemented.

Current code shows error while running modetest for Xilinx drm as it doesn't supports gamma property and ideally it should not show error as gamma is optional property, so it doesn't serve the purpose of optional property.

Please correct me if I am missing anything.

Thanks
Rohit

Quoted 20 lines

-----Original Message-----
From: Ilia Mirkin [mailto:[email protected]<mailto:[email protected]>]
Sent: Tuesday, March 3, 2020 7:08 PM
To: Devarsh Thakkar <[email protected]<mailto:[email protected]>>
Cc: Rohit Visavalia <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; Ville Syrjälä <[email protected]<mailto:[email protected]>>; Hyun Kwon <[email protected]<mailto:[email protected]>>; Ranganathan Sk <[email protected]<mailto:[email protected]>>; Dhaval
Rajeshbhai Shah <[email protected]<mailto:[email protected]>>; Varunkumar Allagadapa <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if
add_property_optional returns true

EXTERNAL EMAIL

Pretty sure the current code is right. If the GAMMA_LUT property can't be set, it tries to set gamma the old-fashioned way.

Quoted 1 line · On Tue, Mar 3, 2020 at 8:12 AM Devarsh Thakkar…
Quoted 67 lines
Quoted 6 lines

Hi Rohit,

This makes sense to me as gamma was implemented as optional property.

@[email protected]<mailto:[email protected]>, @[email protected]<mailto:[email protected]>, @Ville Syrjälä,

Could you please ack and help merge this patch if it also look good to you ?

Quoted 60 lines

Regards,
Devarsh

Quoted 55 lines

-----Original Message-----
From: Rohit Visavalia
Sent: 27 February 2020 00:40
To: Rohit Visavalia <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Cc: Hyun Kwon <[email protected]<mailto:[email protected]>>; Ranganathan Sk <[email protected]<mailto:[email protected]>>; Dhaval Rajeshbhai Shah <[email protected]<mailto:[email protected]>>; Varunkumar Allagadapa <[email protected]<mailto:[email protected]>>; Devarsh Thakkar <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH libdrm] modetest: call drmModeCrtcSetGamma()
only if add_property_optional returns true

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 36 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]<mailto:[email protected]>]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]<mailto:[email protected]>
Cc: Hyun Kwon <[email protected]<mailto:[email protected]>>; Ranganathan Sk <[email protected]<mailto:[email protected]>>; Dhaval Rajeshbhai Shah <[email protected]<mailto:[email protected]>>; Varunkumar Allagadapa <[email protected]<mailto:[email protected]>>; Devarsh Thakkar <[email protected]<mailto:[email protected]>>; Rohit Visavalia <[email protected]<mailto:[email protected]>>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only
if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +2 -2
index b907ab3..379b9ea 100644
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev,
 unsigned crtc_id, unsigned fourcc)
 
    add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
    add_property_optional(dev, crtc_id, "CTM", 0);
-   if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+   if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id))
+ {
            uint16_t r[256], g[256], b[256];
 
            for (i = 0; i < 256; i++) {
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

It's to restore the gamma ramp to be the default linear one. Let's say that the driver doesn't have the GAMMA_LUT property support, and then you want to modeset with C8 (indexed) format. That means that modeset has to set the LUT to make the indexed lookups work (which it does, it all works, you celebrate). Then you want to run modeset with e.g. XR24, and the colors are all black! The LUT is persistent across modesets, so it has to reset the ramp to linear.

You could condition calling set_gamma on crtc->gamma_size > 0, I think -- it didn't occur to me that there would be drivers that didn't support a LUT.

Quoted 40 lines · Rohit Visavalia

Hi Ilia Mirkin,

But it should not go for setting gamma(drmModeCrtcSetGamma) as user has not asked to do so in just simple mode set command(modetest -M <module> -s 42:3840x2160@RG16).

What is the requirement for setting gamma drmModeCrtcSetGamma() if user has not asked ?

Thanks
Rohit

From: Ilia Mirkin [mailto:[email protected]]
Sent: Thursday, March 12, 2020 3:49 PM
To: Rohit Visavalia <[email protected]>
Cc: Devarsh Thakkar <[email protected]>; dri-devel <[email protected]>; [email protected]; Ville Syrjälä <[email protected]>; Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Hm. I'm not sure offhand how to check if drmModeCrtcSetGamma is supported. I guess you could check if gamma size > 0 or something?

On Thu, Mar 12, 2020, 02:39 Rohit Visavalia <[email protected]> wrote:

Hi Ilia Mirkin,

Thanks for the review.

Quoted 96 lines

By old-fashioned way you mean to say using drmModeCrtcSetGamma()? If yes then, it shows error as "failed to set gamma: Function no implemented" if any platform specific drm has no gamma property implemented.

Current code shows error while running modetest for Xilinx drm as it doesn't supports gamma property and ideally it should not show error as gamma is optional property, so it doesn't serve the purpose of optional property.

Please correct me if I am missing anything.

Thanks
Rohit

Quoted 87 lines

-----Original Message-----
From: Ilia Mirkin [mailto:[email protected]]
Sent: Tuesday, March 3, 2020 7:08 PM
To: Devarsh Thakkar <[email protected]>
Cc: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; Ville Syrjälä <[email protected]>; Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

EXTERNAL EMAIL

Pretty sure the current code is right. If the GAMMA_LUT property can't be set, it tries to set gamma the old-fashioned way.

Quoted 7 lines · Devarsh Thakkar

Hi Rohit,

This makes sense to me as gamma was implemented as optional property.

@[email protected], @[email protected], @Ville Syrjälä,

Could you please ack and help merge this patch if it also look good to you ?

Quoted 60 lines

Regards,
Devarsh

Quoted 55 lines

-----Original Message-----
From: Rohit Visavalia
Sent: 27 February 2020 00:40
To: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>
Subject: RE: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 36 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>; Rohit Visavalia <[email protected]>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/modetest/modetest.c +2 -2
index b907ab3..379b9ea 100644
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device *dev,
 unsigned crtc_id, unsigned fourcc)
 
    add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
    add_property_optional(dev, crtc_id, "CTM", 0);
-   if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+   if (add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id))
+ {
            uint16_t r[256], g[256], b[256];
 
            for (i = 0; i < 256; i++) {
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Hi Ilia Mirkin,

Thanks for the comments.

I have sent new patch for review, can you please check ?

Thanks,
Rohit

Quoted 111 lines

-----Original Message-----
From: Ilia Mirkin [mailto:[email protected]]
Sent: Friday, March 13, 2020 8:17 PM
To: Rohit Visavalia <[email protected]>
Cc: Devarsh Thakkar <[email protected]>; dri-devel <dri- [email protected]>; [email protected]; Ville Syrjälä <[email protected]>; Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

It's to restore the gamma ramp to be the default linear one. Let's say that the driver doesn't have the GAMMA_LUT property support, and then you want to modeset with C8 (indexed) format. That means that modeset has to set the LUT to make the indexed lookups work (which it does, it all works, you celebrate). Then you want to run modeset with e.g.
XR24, and the colors are all black! The LUT is persistent across modesets, so it has to reset the ramp to linear.

You could condition calling set_gamma on crtc->gamma_size > 0, I think -- it didn't occur to me that there would be drivers that didn't support a LUT.

Quoted 6 lines · Rohit Visavalia

Hi Ilia Mirkin,

But it should not go for setting gamma(drmModeCrtcSetGamma) as user has

not asked to do so in just simple mode set command(modetest -M <module> - s 42:3840x2160@RG16).

Quoted 4 lines

What is the requirement for setting gamma drmModeCrtcSetGamma() if user

has not asked ?

Quoted 21 lines

Thanks
Rohit

From: Ilia Mirkin [mailto:[email protected]]
Sent: Thursday, March 12, 2020 3:49 PM
To: Rohit Visavalia <[email protected]>
Cc: Devarsh Thakkar <[email protected]>; dri-devel <[email protected]>; [email protected]; Ville Syrjälä <[email protected]>; Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

Quoted 1 line

CAUTION: This message has originated from an External Source. Please use

proper judgment and caution when opening attachments, clicking links, or responding to this email.

Quoted 4 lines

Hm. I'm not sure offhand how to check if drmModeCrtcSetGamma is

supported. I guess you could check if gamma size > 0 or something?

Quoted 10 lines · On Thu, Mar 12, 2020, 02:39 Rohit Visavalia <[email protected]> wrote:

Hi Ilia Mirkin,

Thanks for the review.

By old-fashioned way you mean to say using drmModeCrtcSetGamma()? If

yes then, it shows error as "failed to set gamma: Function no implemented" if any platform specific drm has no gamma property implemented.

Quoted 2 lines

Current code shows error while running modetest for Xilinx drm as it doesn't

supports gamma property and ideally it should not show error as gamma is optional property, so it doesn't serve the purpose of optional property.

Quoted 24 lines

Please correct me if I am missing anything.

Thanks
Rohit

Quoted 18 lines

-----Original Message-----
From: Ilia Mirkin [mailto:[email protected]]
Sent: Tuesday, March 3, 2020 7:08 PM
To: Devarsh Thakkar <[email protected]>
Cc: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; Ville Syrjälä <[email protected]>; Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>
Subject: Re: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

EXTERNAL EMAIL

Pretty sure the current code is right. If the GAMMA_LUT property can't be set, it tries to set gamma the old-fashioned way.

Quoted 73 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines · Devarsh Thakkar

Hi Rohit,

This makes sense to me as gamma was implemented as optional

property.

Quoted 66 lines
Quoted 66 lines
Quoted 4 lines

@[email protected], @[email protected], @Ville Syrjälä,

Could you please ack and help merge this patch if it also look good to you ?

Quoted 61 lines

Regards,
Devarsh

Quoted 56 lines

-----Original Message-----
From: Rohit Visavalia
Sent: 27 February 2020 00:40
To: Rohit Visavalia <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>
Subject: RE: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

Gentle reminder.

+ Ilia Mirkin, +Emil Velikov.

Thanks & Regards,
Rohit

Quoted 36 lines

-----Original Message-----
From: Rohit Visavalia [mailto:[email protected]]
Sent: Tuesday, February 25, 2020 3:08 PM
To: [email protected]
Cc: Hyun Kwon <[email protected]>; Ranganathan Sk <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>; Varunkumar Allagadapa <[email protected]>; Devarsh Thakkar <[email protected]>; Rohit Visavalia <[email protected]>
Subject: [PATCH libdrm] modetest: call drmModeCrtcSetGamma() only if add_property_optional returns true

gamma is a optional property then also it prints error message, so set gamma only if add_property_optional() returns true.

---
 tests/modetest/modetest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/tests/modetest/modetest.c index b907ab3..379b9ea 100644

tests/modetest/modetest.c +2 -2
@@ -1138,7 +1138,7 @@ static void set_gamma(struct device
 *dev, unsigned crtc_id, unsigned fourcc)
 
    add_property_optional(dev, crtc_id, "DEGAMMA_LUT", 0);
    add_property_optional(dev, crtc_id, "CTM", 0);
-   if (!add_property_optional(dev, crtc_id, "GAMMA_LUT", blob_id)) {
+   if (add_property_optional(dev, crtc_id, "GAMMA_LUT",
+ blob_id)) {
            uint16_t r[256], g[256], b[256];
 
            for (i = 0; i < 256; i++) {
--

2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel