On Wed, 8 Nov 2023 11:36:28 -0500 Harry Wentland <harry.wentland@xxxxxxx> wrote: > Signed-off-by: Harry Wentland <harry.wentland@xxxxxxx> > --- > drivers/gpu/drm/drm_atomic_uapi.c | 18 ++++++++++---- > drivers/gpu/drm/drm_colorop.c | 39 +++++++++++++++++++++++++++++++ > include/drm/drm_colorop.h | 20 ++++++++++++++++ > 3 files changed, 72 insertions(+), 5 deletions(-) > ... > diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c > index 902b13e300fd..b1c271f90a16 100644 > --- a/drivers/gpu/drm/drm_colorop.c > +++ b/drivers/gpu/drm/drm_colorop.c > @@ -36,6 +36,11 @@ static const struct drm_prop_enum_list drm_colorop_type_enum_list[] = { > { DRM_COLOROP_1D_CURVE, "1D Curve" }, > }; > > +static const struct drm_prop_enum_list drm_colorop_curve_1d_type_enum_list[] = { > + { DRM_COLOROP_1D_CURVE_SRGB_EOTF, "sRGB EOTF" }, > + { DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF, "sRGB Inverse EOTF" }, > +}; > + > /* Init Helpers */ > > int drm_colorop_init(struct drm_device *dev, struct drm_colorop *colorop, > @@ -73,6 +78,20 @@ int drm_colorop_init(struct drm_device *dev, struct drm_colorop *colorop, > colorop->type_property, > colorop->type); > > + /* curve_1d_type */ > + /* TODO move to mode_config? */ > + prop = drm_property_create_enum(dev, DRM_MODE_PROP_ATOMIC, > + "CURVE_1D_TYPE", > + drm_colorop_curve_1d_type_enum_list, > + ARRAY_SIZE(drm_colorop_curve_1d_type_enum_list)); > + if (!prop) > + return -ENOMEM; > + > + colorop->curve_1d_type_property = prop; > + drm_object_attach_property(&colorop->base, > + colorop->curve_1d_type_property, > + 0); > + > return ret; > } > EXPORT_SYMBOL(drm_colorop_init); > @@ -177,6 +196,11 @@ static const char * const colorop_type_name[] = { > [DRM_COLOROP_1D_CURVE] = "1D Curve", > }; > > +static const char * const colorop_curve_1d_type_name[] = { > + [DRM_COLOROP_1D_CURVE_SRGB_EOTF] = "sRGB EOTF", > + [DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF] = "sRGB Inverse EOTF", > +}; Can't you use drm_colorop_curve_1d_type_enum_list to avoid duplicating the same? > + > /** > * drm_get_colorop_type_name - return a string for colorop type > * @type: colorop type to compute name of > @@ -191,3 +215,18 @@ const char *drm_get_colorop_type_name(enum drm_colorop_type type) > > return colorop_type_name[type]; > } > + > +/** > + * drm_get_colorop_curve_1d_type_name - return a string for 1D curve type > + * @range: 1d curve type to compute name of > + * > + * In contrast to the other drm_get_*_name functions this one here returns a > + * const pointer and hence is threadsafe. > + */ > +const char *drm_get_colorop_curve_1d_type_name(enum drm_colorop_curve_1d_type type) > +{ > + if (WARN_ON(type >= ARRAY_SIZE(colorop_curve_1d_type_name))) > + return "unknown"; > + > + return colorop_curve_1d_type_name[type]; > +} > diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h > index 0386440afe40..965db7ec488f 100644 > --- a/include/drm/drm_colorop.h > +++ b/include/drm/drm_colorop.h > @@ -30,6 +30,11 @@ > #include <drm/drm_mode.h> > #include <drm/drm_property.h> > > +enum drm_colorop_curve_1d_type { > + DRM_COLOROP_1D_CURVE_SRGB_EOTF, > + DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF > +}; ... Thanks, pq
Attachment:
pgp1dbL8DLzaH.pgp
Description: OpenPGP digital signature