Message ID | 1506412979-22028-6-git-send-email-uma.shankar@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hey, Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]: > Define a helper function to set legacy gamma table > size for planes. > > Signed-off-by: Uma Shankar <uma.shankar@intel.com> > --- > drivers/gpu/drm/drm_color_mgmt.c | 41 > ++++++++++++++++++++++++++++++++++++++ > include/drm/drm_color_mgmt.h | 3 +++ > include/drm/drm_plane.h | 4 ++++ > 3 files changed, 48 insertions(+) Is this needed? I'm not aware of legacy tables for planes. Kind regards, Maarten
>-----Original Message----- >From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of >Lankhorst, Maarten >Sent: Tuesday, September 26, 2017 3:36 PM >To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedesktop.org; >dri-devel@lists.freedesktop.org >Cc: Syrjala, Ville <ville.syrjala@intel.com> >Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size > >Hey, > >Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]: >> Define a helper function to set legacy gamma table size for planes. >> >> Signed-off-by: Uma Shankar <uma.shankar@intel.com> >> --- >> drivers/gpu/drm/drm_color_mgmt.c | 41 >> ++++++++++++++++++++++++++++++++++++++ >> include/drm/drm_color_mgmt.h | 3 +++ >> include/drm/drm_plane.h | 4 ++++ >> 3 files changed, 48 insertions(+) > >Is this needed? I'm not aware of legacy tables for planes. I was not getting very concrete info on this. So kept it as per pipe gamma implementation. I will try to get some more info and drop this in case it's not required. Regards, Uma Shankar >Kind regards, >Maarten >_______________________________________________ >dri-devel mailing list >dri-devel@lists.freedesktop.org >https://lists.freedesktop.org/mailman/listinfo/dri-devel
Shankar, Uma schreef op di 26-09-2017 om 15:41 [+0530]: > > -----Original Message----- > > From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On > > Behalf Of > > Lankhorst, Maarten > > Sent: Tuesday, September 26, 2017 3:36 PM > > To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedeskt > > op.org; > > dri-devel@lists.freedesktop.org > > Cc: Syrjala, Ville <ville.syrjala@intel.com> > > Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma > > table size > > > > Hey, > > > > Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]: > > > Define a helper function to set legacy gamma table size for > > > planes. > > > > > > Signed-off-by: Uma Shankar <uma.shankar@intel.com> > > > --- > > > drivers/gpu/drm/drm_color_mgmt.c | 41 > > > ++++++++++++++++++++++++++++++++++++++ > > > include/drm/drm_color_mgmt.h | 3 +++ > > > include/drm/drm_plane.h | 4 ++++ > > > 3 files changed, 48 insertions(+) > > > > Is this needed? I'm not aware of legacy tables for planes. > > I was not getting very concrete info on this. So kept it as per pipe > gamma implementation. > I will try to get some more info and drop this in case it's not > required. > It's not, legacy gamma would only be used in drm_mode_gamma_get_ioctl, which if you look at it only works for a crtc. :) ~Maarten
>-----Original Message----- >From: Lankhorst, Maarten >Sent: Tuesday, September 26, 2017 3:45 PM >To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedesktop.org; >dri-devel@lists.freedesktop.org >Cc: Syrjala, Ville <ville.syrjala@intel.com> >Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size > >Shankar, Uma schreef op di 26-09-2017 om 15:41 [+0530]: >> > -----Original Message----- >> > From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On >> > Behalf Of Lankhorst, Maarten >> > Sent: Tuesday, September 26, 2017 3:36 PM >> > To: Shankar, Uma <uma.shankar@intel.com>; intel-gfx@lists.freedeskt >> > op.org; dri-devel@lists.freedesktop.org >> > Cc: Syrjala, Ville <ville.syrjala@intel.com> >> > Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma >> > table size >> > >> > Hey, >> > >> > Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]: >> > > Define a helper function to set legacy gamma table size for >> > > planes. >> > > >> > > Signed-off-by: Uma Shankar <uma.shankar@intel.com> >> > > --- >> > > drivers/gpu/drm/drm_color_mgmt.c | 41 >> > > ++++++++++++++++++++++++++++++++++++++ >> > > include/drm/drm_color_mgmt.h | 3 +++ >> > > include/drm/drm_plane.h | 4 ++++ >> > > 3 files changed, 48 insertions(+) >> > >> > Is this needed? I'm not aware of legacy tables for planes. >> >> I was not getting very concrete info on this. So kept it as per pipe >> gamma implementation. >> I will try to get some more info and drop this in case it's not >> required. >> > >It's not, legacy gamma would only be used in drm_mode_gamma_get_ioctl, >which if you look at it only works for a crtc. :) > Yeah I thought that it was just added for crtc, and implementation for plane was not done. Was not sure if it can also be extended for plane. Will drop this change. Thanks for clarifying. Regards, Uma Shankar >~Maarten
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index fe09827..8aef6b5 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -204,6 +204,47 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, EXPORT_SYMBOL(drm_mode_crtc_set_gamma_size); /** + * drm_mode_plane_set_gamma_size - set the gamma table size + * @plane: Plane to set the gamma table size for + * @gamma_size: size of the gamma table + * + * Drivers which support gamma tables should set this to the supported gamma + * table size when initializing the Plane. Currently the drm core only supports + * a fixed gamma table size. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_mode_plane_set_gamma_size(struct drm_plane *plane, + int gamma_size) +{ + uint16_t *r_base, *g_base, *b_base; + int i; + + plane->gamma_size = gamma_size; + + plane->gamma_store = kcalloc(gamma_size, sizeof(uint16_t) * 3, + GFP_KERNEL); + if (!plane->gamma_store) { + plane->gamma_size = 0; + return -ENOMEM; + } + + r_base = plane->gamma_store; + g_base = r_base + gamma_size; + b_base = g_base + gamma_size; + for (i = 0; i < gamma_size; i++) { + r_base[i] = i << 8; + g_base[i] = i << 8; + b_base[i] = i << 8; + } + + + return 0; +} +EXPORT_SYMBOL(drm_mode_plane_set_gamma_size); + +/** * drm_mode_gamma_set_ioctl - set the gamma table * @dev: DRM device * @data: ioctl data diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index 155a9ba..2f59c82 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h @@ -42,4 +42,7 @@ void drm_plane_enable_color_mgmt(struct drm_plane *plane, bool plane_has_ctm, uint plane_gamma_lut_size); +int drm_mode_plane_set_gamma_size(struct drm_plane *plane, + int plane_gamma_size); + #endif diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 172d0c1..7dc8e53 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -575,6 +575,10 @@ struct drm_plane { struct drm_property *zpos_property; struct drm_property *rotation_property; + + /* Legacy FB Plane gamma size for reporting to userspace */ + uint32_t gamma_size; + uint16_t *gamma_store; }; #define obj_to_plane(x) container_of(x, struct drm_plane, base)
Define a helper function to set legacy gamma table size for planes. Signed-off-by: Uma Shankar <uma.shankar@intel.com> --- drivers/gpu/drm/drm_color_mgmt.c | 41 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ include/drm/drm_plane.h | 4 ++++ 3 files changed, 48 insertions(+)