drm/vkms: add support for gamma_set interface
PATCH 1/1 drm/vkms: add support for gamma_set interface
Currently vkms module doesn't support gamma function for userspace. so igt subtests in kms_plane(pixel-format-pipe-A-plan) failed for calling drmModeCrtcSetGamma(). This patch set gamma_set interface in vkms_crtc_funcs for support gamma function. With initializing crtc, added calls for setting gamma size. it pass the test after this patch.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/vkms/vkms_crtc.c +8 -0
@@ -160,6 +160,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { .get_crc_sources = vkms_get_crc_sources, .set_crc_source = vkms_set_crc_source, .verify_crc_source = vkms_verify_crc_source, + .gamma_set = drm_atomic_helper_legacy_gamma_set, }; static int vkms_crtc_atomic_check(struct drm_crtc *crtc,
@@ -275,6 +276,13 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,return ret; } + ret =drm_mode_crtc_set_gamma_size (crtc,256 ); +if (ret) { +DRM_ERROR ("Failed to set gamma size\n" ); +return ret; + } +drm_crtc_enable_color_mgmt (crtc,0 , false,256 ); +drm_crtc_helper_add (crtc, &vkms_crtc_helper_funcs);spin_lock_init (&vkms_out->lock);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Sidong Yang
Currently vkms module doesn't support gamma function for userspace. so igt subtests in
kms_plane(pixel-format-pipe-A-plan)failed for callingdrmModeCrtcSetGamma().
It doesn't seem like this IGT test's goal is to exercise support for gamma LUTs. Does the test just tries to reset the gamma LUT to linear? If so, I think the IGT test should be fixed to ignore "I don't support gamma" errors.
Quoted 18 lines
This patch set
gamma_setinterface invkms_crtc_funcsfor
support gamma function. With initializing crtc, added calls for setting gamma size. it pass the test after this patch.Cc Daniel Vetter<[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Haneen Mohammed <[email protected]>Signed-off-by Sidong Yang <[email protected]>--- drivers/gpu/drm/vkms/vkms_crtc.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/gpu/drm/vkms/vkms_crtc.c +0
-0
drivers/gpu/drm/vkms/vkms_crtc.c static const struct drm_crtc_funcs vkms_crtc_funcs = { · line 163
Quoted 4 lines
drivers/gpu/drm/vkms/vkms_crtc.c +1
-0@@ -160,6 +160,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { .get_crc_sources = vkms_get_crc_sources, .set_crc_source = vkms_set_crc_source, .verify_crc_source = vkms_verify_crc_source, + .gamma_set = drm_atomic_helper_legacy_gamma_set,
Why does VKMS need to use a legacy helper?
It seems like this patch just advertises support for gamma LUTs, but ignores any value set by user-space. If VKMS advertises support for gamma LUTs, it needs to take the LUT into account when blending planes.
Quoted 18 lines
drivers/gpu/drm/vkms/vkms_crtc.c +7
-1}; static int vkms_crtc_atomic_check(struct drm_crtc *crtc,@@ -275,6 +276,13 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,return ret; } + ret =drm_mode_crtc_set_gamma_size (crtc,256 ); +if (ret) { +DRM_ERROR ("Failed to set gamma size\n" ); +return ret; + } +drm_crtc_enable_color_mgmt (crtc,0 , false,256 ); +drm_crtc_helper_add (crtc, &vkms_crtc_helper_funcs);spin_lock_init (&vkms_out->lock); --
Quoted 1 line
2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · Simon Ser
Quoted 3 lines · Sidong Yang
Currently vkms module doesn't support gamma function for userspace. so igt subtests in
kms_plane(pixel-format-pipe-A-plan)failed for callingdrmModeCrtcSetGamma().
Hi, Simon.
Thanks for review.
Quoted 4 lines
It doesn't seem like this IGT test's goal is to exercise support for gamma LUTs. Does the test just tries to reset the gamma LUT to linear? If so, I think the IGT test should be fixed to ignore "I don't support gamma" errors.
It seems like that IGT test pixel-format is to make gamma lut like below.
for (i = 0; i < lut_size; i++)
lut[i] = (i * 0xffff / (lut_size - 1)) & mask;
And set this table to drm driver. and test begins. It's the test about pixel format. I think you're right. It's not about gamma lut.
Quoted 14 lines
Quoted 14 lines
This patch set
gamma_setinterface invkms_crtc_funcsfor
support gamma function. With initializing crtc, added calls for setting gamma size. it pass the test after this patch.Cc Daniel Vetter<[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Haneen Mohammed <[email protected]>Signed-off-by Sidong Yang <[email protected]>--- drivers/gpu/drm/vkms/vkms_crtc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Quoted 11 lines
drivers/gpu/drm/vkms/vkms_crtc.c static const struct drm_crtc_funcs vkms_crtc_funcs = { · line 163
Quoted 9 lines
drivers/gpu/drm/vkms/vkms_crtc.c +1
-0@@ -160,6 +160,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { .get_crc_sources = vkms_get_crc_sources, .set_crc_source = vkms_set_crc_source, .verify_crc_source = vkms_verify_crc_source, + .gamma_set = drm_atomic_helper_legacy_gamma_set,Why does VKMS need to use a legacy helper?
drm_crtc_enable_color_mgmt() enables properties about gamma/degamma lut. And legacy helper just saves lut data from userspace to drm property blob. It seems that it's convenient way to implement .gamma_set.
Quoted 3 lines
It seems like this patch just advertises support for gamma LUTs, but ignores any value set by user-space. If VKMS advertises support for gamma LUTs, it needs to take the LUT into account when blending planes.
Yes, This patch doesn't use gamma lut passed by user. lut should be used for calculating pixel value. For vkms, Maybe lut will be used in making crc value? If so, I'll try to write next patch for it.
Thanks,
-Sidong
Quoted 17 lines
Quoted 17 lines
drivers/gpu/drm/vkms/vkms_crtc.c +7
-0}; static int vkms_crtc_atomic_check(struct drm_crtc *crtc,@@ -275,6 +276,13 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,return ret; } + ret =drm_mode_crtc_set_gamma_size (crtc,256 ); +if (ret) { +DRM_ERROR ("Failed to set gamma size\n" ); +return ret; + } +drm_crtc_enable_color_mgmt (crtc,0 , false,256 ); +drm_crtc_helper_add (crtc, &vkms_crtc_helper_funcs);
Quoted 4 lines
Quoted 3 lines
drivers/gpu/drm/vkms/vkms_crtc.c +0
-1spin_lock_init (&vkms_out->lock); --2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Sidong Yang
Quoted 6 lines · Simon Ser
Quoted 3 lines · Sidong Yang
Currently vkms module doesn't support gamma function for userspace. so igt subtests in
kms_plane(pixel-format-pipe-A-plan)failed for callingdrmModeCrtcSetGamma().Hi, Simon.
Thanks for review.Quoted 4 lines
It doesn't seem like this IGT test's goal is to exercise support for gamma LUTs. Does the test just tries to reset the gamma LUT to linear? If so, I think the IGT test should be fixed to ignore "I don't support gamma" errors.
Quoted 7 lines
It seems like that IGT test pixel-format is to make gamma lut like below.
for (i = 0; i <
lut_size; i++)lut[i] = (i * 0xffff / (lut_size - 1)) & mask;And set this table to drm driver. and test begins. It's the test about pixel format. I think you're right. It's not about gamma lut.
The point of the gamma LUT stuff in the pixel format test is to throw away a bunch of the lsbs so that the test passes when the result is "close enough" to the 8bpc RGB reference image. Without it we would never get a crc match when testing non-8bpc or YCbCr formats.
Quoted 66 lines
Quoted 14 lines
Quoted 14 lines
This patch set
gamma_setinterface invkms_crtc_funcsfor
support gamma function. With initializing crtc, added calls for setting gamma size. it pass the test after this patch.Cc Daniel Vetter<[email protected]>Cc Rodrigo Siqueira <[email protected]>Cc Haneen Mohammed <[email protected]>Signed-off-by Sidong Yang <[email protected]>--- drivers/gpu/drm/vkms/vkms_crtc.c | 8 ++++++++ 1 file changed, 8 insertions(+)Quoted 11 lines
drivers/gpu/drm/vkms/vkms_crtc.c static const struct drm_crtc_funcs vkms_crtc_funcs = { · line 163
Quoted 9 lines
drivers/gpu/drm/vkms/vkms_crtc.c +1
-0@@ -160,6 +160,7 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { .get_crc_sources = vkms_get_crc_sources, .set_crc_source = vkms_set_crc_source, .verify_crc_source = vkms_verify_crc_source, + .gamma_set = drm_atomic_helper_legacy_gamma_set,Why does VKMS need to use a legacy helper?
drm_crtc_enable_color_mgmt()enables properties about gamma/degamma lut. And legacy helper just saves lut data from userspace to drm property blob. It seems that it's convenient way to implement .gamma_set.Quoted 3 lines
It seems like this patch just advertises support for gamma LUTs, but ignores any value set by user-space. If VKMS advertises support for gamma LUTs, it needs to take the LUT into account when blending planes.
Yes, This patch doesn't use gamma lut passed by user. lut should be used for calculating pixel value. For vkms, Maybe lut will be used in making crc value? If so, I'll try to write next patch for it.
Thanks,
-SidongQuoted 17 lines
Quoted 17 lines
drivers/gpu/drm/vkms/vkms_crtc.c +7
-0}; static int vkms_crtc_atomic_check(struct drm_crtc *crtc,@@ -275,6 +276,13 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,return ret; } + ret =drm_mode_crtc_set_gamma_size (crtc,256 ); +if (ret) { +DRM_ERROR ("Failed to set gamma size\n" ); +return ret; + } +drm_crtc_enable_color_mgmt (crtc,0 , false,256 ); +drm_crtc_helper_add (crtc, &vkms_crtc_helper_funcs);Quoted 4 lines
Quoted 3 lines
drivers/gpu/drm/vkms/vkms_crtc.c +0
-1spin_lock_init (&vkms_out->lock); --2.17.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines
Quoted 4 lines
It doesn't seem like this IGT test's goal is to exercise support for gamma LUTs. Does the test just tries to reset the gamma LUT to linear? If so, I think the IGT test should be fixed to ignore "I don't support gamma" errors.
It seems like that IGT test pixel-format is to make gamma lut like below. for (i = 0; i <
lut_size; i++)
lut[i] = (i *0xffff/ (lut_size- 1)) & mask;
And set this table to drm driver. and test begins. It's the test about pixel format. I think you're right. It's not about gamma lut.
Quoted 4 lines
The point of the gamma LUT stuff in the pixel format test is to throw away a bunch of the lsbs so that the test passes when the result is "close enough" to the 8bpc RGB reference image. Without it we would never get a crc match when testing non-8bpc or YCbCr formats.
OK, that makes sense. Would it be sensible to:
- Don't set gamma if the pixel format being tested is 8bpc
- Make the test skip if the pixel format is >8bpc and gamma isn't supported
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 13 lines · Simon Ser
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines
Quoted 4 lines
It doesn't seem like this IGT test's goal is to exercise support for gamma LUTs. Does the test just tries to reset the gamma LUT to linear? If so, I think the IGT test should be fixed to ignore "I don't support gamma" errors.
It seems like that IGT test pixel-format is to make gamma lut like below. for (i = 0; i <
lut_size; i++)
lut[i] = (i *0xffff/ (lut_size- 1)) & mask;
And set this table to drm driver. and test begins. It's the test about pixel format. I think you're right. It's not about gamma lut.
Quoted 8 lines
Quoted 4 lines
The point of the gamma LUT stuff in the pixel format test is to throw away a bunch of the lsbs so that the test passes when the result is "close enough" to the 8bpc RGB reference image. Without it we would never get a crc match when testing non-8bpc or YCbCr formats.
OK, that makes sense. Would it be sensible to:
- Don't set gamma if the pixel format being tested is 8bpc
Hm not sure what 8bpc format you mean here, because we have C8 (needs gamma table or doesn't work) and the 8b greyscale one with the R8 one. If you ask for legacy 8bpc you get C8.
Quoted 2 lines
- Make the test skip if the pixel format is >8bpc and gamma isn't supported
Yeah the test should skip if gamma isn't there.
-Daniel
Quoted 5 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 20 lines · Daniel Vetter
Quoted 18 lines · Simon Ser
Quoted 15 lines · On Monday, August 31, 2020 3:48 PM, Ville Syrjälä…
Quoted 10 lines
Quoted 4 lines
It doesn't seem like this IGT test's goal is to exercise support for gamma LUTs. Does the test just tries to reset the gamma LUT to linear? If so, I think the IGT test should be fixed to ignore "I don't support gamma" errors.
It seems like that IGT test pixel-format is to make gamma lut like below. for (i = 0; i <
lut_size; i++)
lut[i] = (i *0xffff/ (lut_size- 1)) & mask;
And set this table to drm driver. and test begins. It's the test about pixel format. I think you're right. It's not about gamma lut.The point of the gamma LUT stuff in the pixel format test is to throw away a bunch of the lsbs so that the test passes when the result is "close enough" to the 8bpc RGB reference image. Without it we would never get a crc match when testing non-8bpc or YCbCr formats.
Quoted 7 lines
Quoted 3 lines
OK, that makes sense. Would it be sensible to:
- Don't set gamma if the pixel format being tested is 8bpc
Hm not sure what 8bpc format you mean here, because we have C8 (needs gamma table or doesn't work) and the 8b greyscale one with the R8 one. If you ask for legacy 8bpc you get C8.
Why do we need a gamma LUT for C8 and R8? There shouldn't be any precision loss, right?
Quoted 11 lines
Quoted 3 lines
- Make the test skip if the pixel format is >8bpc and gamma isn't
supportedYeah the test should skip if gamma isn't there.
-DanielQuoted 3 lines
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 5 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 24 lines · Simon Ser
Quoted 22 lines · Daniel Vetter
Quoted 20 lines · Simon Ser
Quoted 11 lines · On Monday, August 31, 2020 3:48 PM, Ville Syrjälä…
Quoted 10 lines
Quoted 4 lines
It doesn't seem like this IGT test's goal is to exercise support for gamma LUTs. Does the test just tries to reset the gamma LUT to linear? If so, I think the IGT test should be fixed to ignore "I don't support gamma" errors.
It seems like that IGT test pixel-format is to make gamma lut like below. for (i = 0; i <
lut_size; i++)
lut[i] = (i *0xffff/ (lut_size- 1)) & mask;
And set this table to drm driver. and test begins. It's the test about pixel format. I think you're right. It's not about gamma lut.Quoted 4 lines
The point of the gamma LUT stuff in the pixel format test is to throw away a bunch of the lsbs so that the test passes when the result is "close enough" to the 8bpc RGB reference image. Without it we would never get a crc match when testing non-8bpc or YCbCr formats.
OK, that makes sense. Would it be sensible to:
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
- Don't set gamma if the pixel format being tested is 8bpc
Hm not sure what 8bpc format you mean here, because we have C8 (needs gamma table or doesn't work) and the 8b greyscale one with the R8 one. If you ask for legacy 8bpc you get C8.
Why do we need a gamma LUT for C8 and R8? There shouldn't be any precision loss, right?
C8 always needs a LUT. Somewhat annoying legacy uapi thing that the crtc's gamma LUT is also the LUT for C8 scanout, but at least it does match how eg. Intel hw works. I think ideally there should a separate per-plane LUT for this (with i915 then having to check that the same LUT is used for all C8 planes on the crtc).
As for why we might need the LUT even for 8bpc formats. The test does the following:
capture a reference CRC using XRGB8888 for_each_format
capture CRC using the format
compare CRC to the reference CRC
So all formats need to use the LUT to preserve the same number of msbs and throw away the unwanted lsbs.
I guess we could add a special case for the "plane only supports 8bpc formats" situation and omit the LUT in that case...
Quoted 18 lines
Quoted 17 lines
Quoted 4 lines
- Make the test skip if the pixel format is >8bpc and gamma isn't
supportedYeah the test should skip if gamma isn't there.
-DanielQuoted 3 lines
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel