Re: [RFC PATCH v4 10/42] drm/colorop: Add TYPE property

2024-03-12 Thread Simon Ser
On Tuesday, March 12th, 2024 at 16:02, Pekka Paalanen 
 wrote:

> This list here is the list of all values the enum could take, right?
> Should it not be just the one value it's going to have? It'll never
> change, and it can never be changed.

Listing all possible values is how other properties behave. Example:

"type" (immutable): enum {Overlay, Primary, Cursor} = Primary


Re: [RFC PATCH v4 05/42] drm/vkms: Create separate Kconfig file for VKMS

2024-03-12 Thread Melissa Wen
On 02/26, Harry Wentland wrote:
> This aligns with most other DRM drivers and will allow
> us to add new VKMS config options without polluting
> the DRM Kconfig.
> 
> v3:
>  - Change SPDX to GPL-2.0-only to match DRM KConfig
>SPDX (Simon)
> 
> Signed-off-by: Harry Wentland 
> Reviewed-by: Simon Ser 

Just to let you know this patch is already upstream. I cherry-picked it
from the last patchset version and applied to drm-misc-next:
https://cgit.freedesktop.org/drm/drm-misc/commit/drivers/gpu/drm?id=ffcc67cd79ff2e93fd0bdb837c99cbab6c59d38c

Thanks again,

Melissa

> ---
>  drivers/gpu/drm/Kconfig  | 14 +-
>  drivers/gpu/drm/vkms/Kconfig | 15 +++
>  2 files changed, 16 insertions(+), 13 deletions(-)
>  create mode 100644 drivers/gpu/drm/vkms/Kconfig
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 2520db0b776e..e3ea8793cb8a 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -289,19 +289,7 @@ config DRM_VGEM
> as used by Mesa's software renderer for enhanced performance.
> If M is selected the module will be called vgem.
>  
> -config DRM_VKMS
> - tristate "Virtual KMS (EXPERIMENTAL)"
> - depends on DRM && MMU
> - select DRM_KMS_HELPER
> - select DRM_GEM_SHMEM_HELPER
> - select CRC32
> - default n
> - help
> -   Virtual Kernel Mode-Setting (VKMS) is used for testing or for
> -   running GPU in a headless machines. Choose this option to get
> -   a VKMS.
> -
> -   If M is selected the module will be called vkms.
> +source "drivers/gpu/drm/vkms/Kconfig"
>  
>  source "drivers/gpu/drm/exynos/Kconfig"
>  
> diff --git a/drivers/gpu/drm/vkms/Kconfig b/drivers/gpu/drm/vkms/Kconfig
> new file mode 100644
> index ..b9ecdebecb0b
> --- /dev/null
> +++ b/drivers/gpu/drm/vkms/Kconfig
> @@ -0,0 +1,15 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +config DRM_VKMS
> + tristate "Virtual KMS (EXPERIMENTAL)"
> + depends on DRM && MMU
> + select DRM_KMS_HELPER
> + select DRM_GEM_SHMEM_HELPER
> + select CRC32
> + default n
> + help
> +   Virtual Kernel Mode-Setting (VKMS) is used for testing or for
> +   running GPU in a headless machines. Choose this option to get
> +   a VKMS.
> +
> +   If M is selected the module will be called vkms.
> -- 
> 2.44.0
> 


Re: [RFC PATCH v4 07/42] drm/vkms: Avoid reading beyond LUT array

2024-03-12 Thread Melissa Wen
On 02/26, Harry Wentland wrote:
> When the floor LUT index (drm_fixp2int(lut_index) is the last
> index of the array the ceil LUT index will point to an entry
> beyond the array. Make sure we guard against it and use the
> value of the floor LUT index.
> 
> v3:
>  - Drop bits from commit description that didn't contribute
>anything of value
> 
> Fixes: db1f254f2cfaf ("drm/vkms: Add support to 1D gamma LUT")
> Signed-off-by: Harry Wentland 
> Cc: Arthur Grillo 
> Reviewed-by: Melissa Wen 

Same. Already applied upstream:
https://cgit.freedesktop.org/drm/drm-misc/commit/drivers/gpu/drm?id=2fee84030d12d9fddfa874e4562d71761a129277

I guess you are working on top of asdn branch and it's okay to me.
I'm just mentioning to avoid confusion.

Melissa

> ---
>  drivers/gpu/drm/vkms/vkms_composer.c | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c 
> b/drivers/gpu/drm/vkms/vkms_composer.c
> index d178f2a400f6..b90e446d5954 100644
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> @@ -123,6 +123,8 @@ static u16 apply_lut_to_channel_value(const struct 
> vkms_color_lut *lut, u16 chan
> enum lut_channel channel)
>  {
>   s64 lut_index = get_lut_index(lut, channel_value);
> + u16 *floor_lut_value, *ceil_lut_value;
> + u16 floor_channel_value, ceil_channel_value;
>  
>   /*
>* This checks if `struct drm_color_lut` has any gap added by the 
> compiler
> @@ -130,11 +132,15 @@ static u16 apply_lut_to_channel_value(const struct 
> vkms_color_lut *lut, u16 chan
>*/
>   static_assert(sizeof(struct drm_color_lut) == sizeof(__u16) * 4);
>  
> - u16 *floor_lut_value = (__u16 *)&lut->base[drm_fixp2int(lut_index)];
> - u16 *ceil_lut_value = (__u16 *)&lut->base[drm_fixp2int_ceil(lut_index)];
> + floor_lut_value = (__u16 *)&lut->base[drm_fixp2int(lut_index)];
> + if (drm_fixp2int(lut_index) == (lut->lut_length - 1))
> + /* We're at the end of the LUT array, use same value for ceil 
> and floor */
> + ceil_lut_value = floor_lut_value;
> + else
> + ceil_lut_value = (__u16 
> *)&lut->base[drm_fixp2int_ceil(lut_index)];
>  
> - u16 floor_channel_value = floor_lut_value[channel];
> - u16 ceil_channel_value = ceil_lut_value[channel];
> + floor_channel_value = floor_lut_value[channel];
> + ceil_channel_value = ceil_lut_value[channel];
>  
>   return lerp_u16(floor_channel_value, ceil_channel_value,
>   lut_index & DRM_FIXED_DECIMAL_MASK);
> -- 
> 2.44.0
>