Message ID | 20180215053300.70482-4-dcastagna@chromium.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Feb 15, 2018 at 12:32:53AM -0500, Daniele Castagna wrote: > From: "uma.shankar at intel.com (Uma Shankar)" <uma.shankar@intel.com> > > Add a blob property for plane CSC usage. > > (am from https://patchwork.kernel.org/patch/9971339/) > > Change-Id: I688ce7c95c20d307cb0aa35c5eba5ce2e1e88314 > Signed-off-by: Uma Shankar <uma.shankar at intel.com> > --- > drivers/gpu/drm/drm_atomic.c | 10 ++++++++++ > drivers/gpu/drm/drm_atomic_helper.c | 3 +++ > drivers/gpu/drm/drm_mode_config.c | 6 ++++++ > include/drm/drm_mode_config.h | 6 ++++++ > include/drm/drm_plane.h | 8 ++++++++ > 5 files changed, 33 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index 4a06ff2fd1a5e..d4b8c6cc84128 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -770,6 +770,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, > val, -1, &replaced); > state->color_mgmt_changed |= replaced; > return ret; > + } else if (property == config->plane_ctm_property) { > + ret = drm_atomic_replace_property_blob_from_id(dev, > + &state->ctm, > + val, > + sizeof(struct drm_color_ctm), > + &replaced); > + state->color_mgmt_changed |= replaced; > + return ret; > } else { > return -EINVAL; > } > @@ -831,6 +839,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, > } else if (property == config->plane_degamma_lut_property) { > *val = (state->degamma_lut) ? > state->degamma_lut->base.id : 0; > + } else if (property == config->plane_ctm_property) { > + *val = (state->ctm) ? state->ctm->base.id : 0; > } else { > return -EINVAL; > } > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index d3eaf4d397681..17e137a529a0e 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -3493,6 +3493,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, > > if (state->degamma_lut) > drm_property_reference_blob(state->degamma_lut); > + if (state->ctm) > + drm_property_reference_blob(state->ctm); > state->color_mgmt_changed = false; > } > EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state); > @@ -3540,6 +3542,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) > drm_crtc_commit_put(state->commit); > > drm_property_unreference_blob(state->degamma_lut); > + drm_property_unreference_blob(state->ctm); > } > EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); > > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c > index 7d8e74715b565..c8763977413e7 100644 > --- a/drivers/gpu/drm/drm_mode_config.c > +++ b/drivers/gpu/drm/drm_mode_config.c > @@ -361,6 +361,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) > if (!prop) > return -ENOMEM; > dev->mode_config.plane_degamma_lut_size_property = prop; > + prop = drm_property_create(dev, > + DRM_MODE_PROP_BLOB, > + "PLANE_CTM", 0); > + if (!prop) > + return -ENOMEM; > + dev->mode_config.plane_ctm_property = prop; > > return 0; > } > diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h > index dcec93d062b4d..ad7235ced531b 100644 > --- a/include/drm/drm_mode_config.h > +++ b/include/drm/drm_mode_config.h > @@ -734,6 +734,12 @@ struct drm_mode_config { > * size of the degamma LUT as supported by the driver (read-only). > */ > struct drm_property *plane_degamma_lut_size_property; > + /** > + * @plane_ctm_property: Optional CRTC property to set the > + * matrix used to convert colors after the lookup in the > + * degamma LUT. > + */ > + struct drm_property *plane_ctm_property; Same comments re: puttting the property in drm_plane and adding a helper to create it. Sean > /** > * @ctm_property: Optional CRTC property to set the > * matrix used to convert colors after the lookup in the > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h > index 2f8f5db77a406..21aecc9c91a09 100644 > --- a/include/drm/drm_plane.h > +++ b/include/drm/drm_plane.h > @@ -139,6 +139,14 @@ struct drm_plane_state { > */ > struct drm_property_blob *degamma_lut; > > + /** > + * @ctm: > + * > + * Color transformation matrix. See drm_plane_enable_color_mgmt(). The > + * blob (if not NULL) is a &struct drm_color_ctm. > + */ > + struct drm_property_blob *ctm; > + > struct drm_atomic_state *state; > > bool color_mgmt_changed : 1; > -- > 2.16.1.291.g4437f3f132-goog > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>-----Original Message----- >From: dri-devel [mailto:dri-devel-bounces@lists.freedesktop.org] On Behalf Of >Sean Paul >Sent: Tuesday, February 27, 2018 8:53 PM >To: Daniele Castagna <dcastagna@chromium.org> >Cc: dri-devel@lists.freedesktop.org >Subject: Re: [PATCH 03/10] drm: Add Plane CTM property > >On Thu, Feb 15, 2018 at 12:32:53AM -0500, Daniele Castagna wrote: >> From: "uma.shankar at intel.com (Uma Shankar)" <uma.shankar@intel.com> >> >> Add a blob property for plane CSC usage. >> >> (am from https://patchwork.kernel.org/patch/9971339/) >> >> Change-Id: I688ce7c95c20d307cb0aa35c5eba5ce2e1e88314 >> Signed-off-by: Uma Shankar <uma.shankar at intel.com> >> --- >> drivers/gpu/drm/drm_atomic.c | 10 ++++++++++ >> drivers/gpu/drm/drm_atomic_helper.c | 3 +++ >> drivers/gpu/drm/drm_mode_config.c | 6 ++++++ >> include/drm/drm_mode_config.h | 6 ++++++ >> include/drm/drm_plane.h | 8 ++++++++ >> 5 files changed, 33 insertions(+) >> >> diff --git a/drivers/gpu/drm/drm_atomic.c >> b/drivers/gpu/drm/drm_atomic.c index 4a06ff2fd1a5e..d4b8c6cc84128 >> 100644 >> --- a/drivers/gpu/drm/drm_atomic.c >> +++ b/drivers/gpu/drm/drm_atomic.c >> @@ -770,6 +770,14 @@ static int drm_atomic_plane_set_property(struct >drm_plane *plane, >> val, -1, &replaced); >> state->color_mgmt_changed |= replaced; >> return ret; >> + } else if (property == config->plane_ctm_property) { >> + ret = drm_atomic_replace_property_blob_from_id(dev, >> + &state->ctm, >> + val, >> + sizeof(struct drm_color_ctm), >> + &replaced); >> + state->color_mgmt_changed |= replaced; >> + return ret; >> } else { >> return -EINVAL; >> } >> @@ -831,6 +839,8 @@ drm_atomic_plane_get_property(struct drm_plane >*plane, >> } else if (property == config->plane_degamma_lut_property) { >> *val = (state->degamma_lut) ? >> state->degamma_lut->base.id : 0; >> + } else if (property == config->plane_ctm_property) { >> + *val = (state->ctm) ? state->ctm->base.id : 0; >> } else { >> return -EINVAL; >> } >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c >> b/drivers/gpu/drm/drm_atomic_helper.c >> index d3eaf4d397681..17e137a529a0e 100644 >> --- a/drivers/gpu/drm/drm_atomic_helper.c >> +++ b/drivers/gpu/drm/drm_atomic_helper.c >> @@ -3493,6 +3493,8 @@ void >> __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, >> >> if (state->degamma_lut) >> drm_property_reference_blob(state->degamma_lut); >> + if (state->ctm) >> + drm_property_reference_blob(state->ctm); >> state->color_mgmt_changed = false; >> } >> EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state); >> @@ -3540,6 +3542,7 @@ void >__drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) >> drm_crtc_commit_put(state->commit); >> >> drm_property_unreference_blob(state->degamma_lut); >> + drm_property_unreference_blob(state->ctm); >> } >> EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); >> >> diff --git a/drivers/gpu/drm/drm_mode_config.c >> b/drivers/gpu/drm/drm_mode_config.c >> index 7d8e74715b565..c8763977413e7 100644 >> --- a/drivers/gpu/drm/drm_mode_config.c >> +++ b/drivers/gpu/drm/drm_mode_config.c >> @@ -361,6 +361,12 @@ static int >drm_mode_create_standard_properties(struct drm_device *dev) >> if (!prop) >> return -ENOMEM; >> dev->mode_config.plane_degamma_lut_size_property = prop; >> + prop = drm_property_create(dev, >> + DRM_MODE_PROP_BLOB, >> + "PLANE_CTM", 0); >> + if (!prop) >> + return -ENOMEM; >> + dev->mode_config.plane_ctm_property = prop; >> >> return 0; >> } >> diff --git a/include/drm/drm_mode_config.h >> b/include/drm/drm_mode_config.h index dcec93d062b4d..ad7235ced531b >> 100644 >> --- a/include/drm/drm_mode_config.h >> +++ b/include/drm/drm_mode_config.h >> @@ -734,6 +734,12 @@ struct drm_mode_config { >> * size of the degamma LUT as supported by the driver (read-only). >> */ >> struct drm_property *plane_degamma_lut_size_property; >> + /** >> + * @plane_ctm_property: Optional CRTC property to set the >> + * matrix used to convert colors after the lookup in the >> + * degamma LUT. >> + */ >> + struct drm_property *plane_ctm_property; > >Same comments re: puttting the property in drm_plane and adding a helper to >create it. > Sure, will update this. Regards, Uma Shankar >Sean > >> /** >> * @ctm_property: Optional CRTC property to set the >> * matrix used to convert colors after the lookup in the diff --git >> a/include/drm/drm_plane.h b/include/drm/drm_plane.h index >> 2f8f5db77a406..21aecc9c91a09 100644 >> --- a/include/drm/drm_plane.h >> +++ b/include/drm/drm_plane.h >> @@ -139,6 +139,14 @@ struct drm_plane_state { >> */ >> struct drm_property_blob *degamma_lut; >> >> + /** >> + * @ctm: >> + * >> + * Color transformation matrix. See drm_plane_enable_color_mgmt(). >The >> + * blob (if not NULL) is a &struct drm_color_ctm. >> + */ >> + struct drm_property_blob *ctm; >> + >> struct drm_atomic_state *state; >> >> bool color_mgmt_changed : 1; >> -- >> 2.16.1.291.g4437f3f132-goog >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel > >-- >Sean Paul, Software Engineer, Google / Chromium OS >_______________________________________________ >dri-devel mailing list >dri-devel@lists.freedesktop.org >https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 4a06ff2fd1a5e..d4b8c6cc84128 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -770,6 +770,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, val, -1, &replaced); state->color_mgmt_changed |= replaced; return ret; + } else if (property == config->plane_ctm_property) { + ret = drm_atomic_replace_property_blob_from_id(dev, + &state->ctm, + val, + sizeof(struct drm_color_ctm), + &replaced); + state->color_mgmt_changed |= replaced; + return ret; } else { return -EINVAL; } @@ -831,6 +839,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, } else if (property == config->plane_degamma_lut_property) { *val = (state->degamma_lut) ? state->degamma_lut->base.id : 0; + } else if (property == config->plane_ctm_property) { + *val = (state->ctm) ? state->ctm->base.id : 0; } else { return -EINVAL; } diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index d3eaf4d397681..17e137a529a0e 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3493,6 +3493,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, if (state->degamma_lut) drm_property_reference_blob(state->degamma_lut); + if (state->ctm) + drm_property_reference_blob(state->ctm); state->color_mgmt_changed = false; } EXPORT_SYMBOL(__drm_atomic_helper_plane_duplicate_state); @@ -3540,6 +3542,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) drm_crtc_commit_put(state->commit); drm_property_unreference_blob(state->degamma_lut); + drm_property_unreference_blob(state->ctm); } EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index 7d8e74715b565..c8763977413e7 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -361,6 +361,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) if (!prop) return -ENOMEM; dev->mode_config.plane_degamma_lut_size_property = prop; + prop = drm_property_create(dev, + DRM_MODE_PROP_BLOB, + "PLANE_CTM", 0); + if (!prop) + return -ENOMEM; + dev->mode_config.plane_ctm_property = prop; return 0; } diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index dcec93d062b4d..ad7235ced531b 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -734,6 +734,12 @@ struct drm_mode_config { * size of the degamma LUT as supported by the driver (read-only). */ struct drm_property *plane_degamma_lut_size_property; + /** + * @plane_ctm_property: Optional CRTC property to set the + * matrix used to convert colors after the lookup in the + * degamma LUT. + */ + struct drm_property *plane_ctm_property; /** * @ctm_property: Optional CRTC property to set the * matrix used to convert colors after the lookup in the diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 2f8f5db77a406..21aecc9c91a09 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -139,6 +139,14 @@ struct drm_plane_state { */ struct drm_property_blob *degamma_lut; + /** + * @ctm: + * + * Color transformation matrix. See drm_plane_enable_color_mgmt(). The + * blob (if not NULL) is a &struct drm_color_ctm. + */ + struct drm_property_blob *ctm; + struct drm_atomic_state *state; bool color_mgmt_changed : 1;