@@ -67,6 +67,7 @@ static const struct drm_prop_enum_list drm_colorop_type_enum_list[] = {
6767 { DRM_COLOROP_1D_LUT , "1D LUT" },
6868 { DRM_COLOROP_CTM_3X4 , "3x4 Matrix" },
6969 { DRM_COLOROP_MULTIPLIER , "Multiplier" },
70+ { DRM_COLOROP_3D_LUT , "3D LUT" },
7071};
7172
7273static const char * const colorop_curve_1d_type_names [] = {
@@ -82,6 +83,11 @@ static const struct drm_prop_enum_list drm_colorop_lut1d_interpolation_list[] =
8283 { DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR , "Linear" },
8384};
8485
86+
87+ static const struct drm_prop_enum_list drm_colorop_lut3d_interpolation_list [] = {
88+ { DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL , "Tetrahedral" },
89+ };
90+
8591/* Init Helpers */
8692
8793static int drm_plane_colorop_init (struct drm_device * dev , struct drm_colorop * colorop ,
@@ -381,6 +387,51 @@ int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colo
381387}
382388EXPORT_SYMBOL (drm_plane_colorop_mult_init );
383389
390+ int drm_plane_colorop_3dlut_init (struct drm_device * dev , struct drm_colorop * colorop ,
391+ struct drm_plane * plane ,
392+ uint32_t lut_size ,
393+ enum drm_colorop_lut3d_interpolation_type interpolation ,
394+ uint32_t flags )
395+ {
396+ struct drm_property * prop ;
397+ int ret ;
398+
399+ ret = drm_plane_colorop_init (dev , colorop , plane , DRM_COLOROP_3D_LUT , flags );
400+ if (ret )
401+ return ret ;
402+
403+ /* LUT size */
404+ prop = drm_property_create_range (dev , DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_ATOMIC ,
405+ "SIZE" , 0 , UINT_MAX );
406+ if (!prop )
407+ return - ENOMEM ;
408+
409+ colorop -> size_property = prop ;
410+ drm_object_attach_property (& colorop -> base , colorop -> size_property , lut_size );
411+ colorop -> size = lut_size ;
412+
413+ /* interpolation */
414+ prop = drm_property_create_enum (dev , 0 , "LUT3D_INTERPOLATION" ,
415+ drm_colorop_lut3d_interpolation_list ,
416+ ARRAY_SIZE (drm_colorop_lut3d_interpolation_list ));
417+ if (!prop )
418+ return - ENOMEM ;
419+
420+ colorop -> lut3d_interpolation_property = prop ;
421+ drm_object_attach_property (& colorop -> base , prop , interpolation );
422+ colorop -> lut3d_interpolation = interpolation ;
423+
424+ /* data */
425+ ret = drm_colorop_create_data_prop (dev , colorop );
426+ if (ret )
427+ return ret ;
428+
429+ drm_colorop_reset (colorop );
430+
431+ return 0 ;
432+ }
433+ EXPORT_SYMBOL (drm_plane_colorop_3dlut_init );
434+
384435static void __drm_atomic_helper_colorop_duplicate_state (struct drm_colorop * colorop ,
385436 struct drm_colorop_state * state )
386437{
@@ -472,7 +523,13 @@ static const char * const colorop_type_name[] = {
472523 [DRM_COLOROP_1D_LUT ] = "1D LUT" ,
473524 [DRM_COLOROP_CTM_3X4 ] = "3x4 Matrix" ,
474525 [DRM_COLOROP_MULTIPLIER ] = "Multiplier" ,
526+ [DRM_COLOROP_3D_LUT ] = "3D LUT" ,
527+ };
528+
529+ static const char * const colorop_lu3d_interpolation_name [] = {
530+ [DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL ] = "Tetrahedral" ,
475531};
532+
476533static const char * const colorop_lut1d_interpolation_name [] = {
477534 [DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR ] = "Linear" ,
478535};
@@ -508,6 +565,21 @@ const char *drm_get_colorop_lut1d_interpolation_name(enum drm_colorop_lut1d_inte
508565 return colorop_lut1d_interpolation_name [type ];
509566}
510567
568+ /**
569+ * drm_get_colorop_lut3d_interpolation_name - return a string for interpolation type
570+ * @type: interpolation type to compute name of
571+ *
572+ * In contrast to the other drm_get_*_name functions this one here returns a
573+ * const pointer and hence is threadsafe.
574+ */
575+ const char * drm_get_colorop_lut3d_interpolation_name (enum drm_colorop_lut3d_interpolation_type type )
576+ {
577+ if (WARN_ON (type >= ARRAY_SIZE (colorop_lu3d_interpolation_name )))
578+ return "unknown" ;
579+
580+ return colorop_lu3d_interpolation_name [type ];
581+ }
582+
511583/**
512584 * drm_colorop_set_next_property - sets the next pointer
513585 * @colorop: drm colorop
0 commit comments