Message ID | 1499343648-29695-3-git-send-email-peda@axentia.se (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jul 06, 2017 at 02:20:36PM +0200, Peter Rosin wrote: > Do not waste cycles looking up the property id when we have the > actual property already. > > Signed-off-by: Peter Rosin <peda@axentia.se> With the names adjusted per my comments on patch 1 this lgtm. Btw good practice is to cc original authors of the code, a combo of git blame and scripts/get_maintainers.pl helps with that. -Daniel > --- > drivers/gpu/drm/drm_atomic_helper.c | 23 ++++++++--------------- > 1 file changed, 8 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index 667ec97..5a4a344 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -3769,11 +3769,11 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, > struct drm_modeset_acquire_ctx *ctx) > { > struct drm_device *dev = crtc->dev; > - struct drm_mode_config *config = &dev->mode_config; > struct drm_atomic_state *state; > struct drm_crtc_state *crtc_state; > struct drm_property_blob *blob = NULL; > struct drm_color_lut *blob_data; > + bool replaced = false; > int i, ret = 0; > > state = drm_atomic_state_alloc(crtc->dev); > @@ -3805,20 +3805,13 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, > } > > /* Reset DEGAMMA_LUT and CTM properties. */ > - ret = drm_atomic_crtc_set_property(crtc, crtc_state, > - config->degamma_lut_property, 0); > - if (ret) > - goto fail; > - > - ret = drm_atomic_crtc_set_property(crtc, crtc_state, > - config->ctm_property, 0); > - if (ret) > - goto fail; > - > - ret = drm_atomic_crtc_set_property(crtc, crtc_state, > - config->gamma_lut_property, blob->base.id); > - if (ret) > - goto fail; > + drm_atomic_replace_property_blob(&crtc_state->degamma_lut, > + NULL, &replaced); > + drm_atomic_replace_property_blob(&crtc_state->ctm, > + NULL, &replaced); > + drm_atomic_replace_property_blob(&crtc_state->gamma_lut, > + blob, &replaced); > + crtc_state->color_mgmt_changed |= replaced; > > ret = drm_atomic_commit(state); > > -- > 2.1.4 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel
On 2017-07-11 10:02, Daniel Vetter wrote: > On Thu, Jul 06, 2017 at 02:20:36PM +0200, Peter Rosin wrote: >> Do not waste cycles looking up the property id when we have the >> actual property already. >> >> Signed-off-by: Peter Rosin <peda@axentia.se> > > With the names adjusted per my comments on patch 1 this lgtm. Btw good > practice is to cc original authors of the code, a combo of git blame and > scripts/get_maintainers.pl helps with that. Yes, agreed, my defense is that with a series that touches lots of files, the Cc list can get ridiculously long. When I have such a series, most of the files touched are generally for some mechanical and mostly uninteresting cleanup. And this change falls in that category, it's simply not that interesting. Anyway, I maybe trimmed the Cc list too harshly, and will Cc Lionel for the next iteration. Cheers, peda > -Daniel > >> --- >> drivers/gpu/drm/drm_atomic_helper.c | 23 ++++++++--------------- >> 1 file changed, 8 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c >> index 667ec97..5a4a344 100644 >> --- a/drivers/gpu/drm/drm_atomic_helper.c >> +++ b/drivers/gpu/drm/drm_atomic_helper.c >> @@ -3769,11 +3769,11 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, >> struct drm_modeset_acquire_ctx *ctx) >> { >> struct drm_device *dev = crtc->dev; >> - struct drm_mode_config *config = &dev->mode_config; >> struct drm_atomic_state *state; >> struct drm_crtc_state *crtc_state; >> struct drm_property_blob *blob = NULL; >> struct drm_color_lut *blob_data; >> + bool replaced = false; >> int i, ret = 0; >> >> state = drm_atomic_state_alloc(crtc->dev); >> @@ -3805,20 +3805,13 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, >> } >> >> /* Reset DEGAMMA_LUT and CTM properties. */ >> - ret = drm_atomic_crtc_set_property(crtc, crtc_state, >> - config->degamma_lut_property, 0); >> - if (ret) >> - goto fail; >> - >> - ret = drm_atomic_crtc_set_property(crtc, crtc_state, >> - config->ctm_property, 0); >> - if (ret) >> - goto fail; >> - >> - ret = drm_atomic_crtc_set_property(crtc, crtc_state, >> - config->gamma_lut_property, blob->base.id); >> - if (ret) >> - goto fail; >> + drm_atomic_replace_property_blob(&crtc_state->degamma_lut, >> + NULL, &replaced); >> + drm_atomic_replace_property_blob(&crtc_state->ctm, >> + NULL, &replaced); >> + drm_atomic_replace_property_blob(&crtc_state->gamma_lut, >> + blob, &replaced); >> + crtc_state->color_mgmt_changed |= replaced; >> >> ret = drm_atomic_commit(state); >> >> -- >> 2.1.4 >> >> _______________________________________________ >> 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_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 667ec97..5a4a344 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3769,11 +3769,11 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, struct drm_modeset_acquire_ctx *ctx) { struct drm_device *dev = crtc->dev; - struct drm_mode_config *config = &dev->mode_config; struct drm_atomic_state *state; struct drm_crtc_state *crtc_state; struct drm_property_blob *blob = NULL; struct drm_color_lut *blob_data; + bool replaced = false; int i, ret = 0; state = drm_atomic_state_alloc(crtc->dev); @@ -3805,20 +3805,13 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, } /* Reset DEGAMMA_LUT and CTM properties. */ - ret = drm_atomic_crtc_set_property(crtc, crtc_state, - config->degamma_lut_property, 0); - if (ret) - goto fail; - - ret = drm_atomic_crtc_set_property(crtc, crtc_state, - config->ctm_property, 0); - if (ret) - goto fail; - - ret = drm_atomic_crtc_set_property(crtc, crtc_state, - config->gamma_lut_property, blob->base.id); - if (ret) - goto fail; + drm_atomic_replace_property_blob(&crtc_state->degamma_lut, + NULL, &replaced); + drm_atomic_replace_property_blob(&crtc_state->ctm, + NULL, &replaced); + drm_atomic_replace_property_blob(&crtc_state->gamma_lut, + blob, &replaced); + crtc_state->color_mgmt_changed |= replaced; ret = drm_atomic_commit(state);
Do not waste cycles looking up the property id when we have the actual property already. Signed-off-by: Peter Rosin <peda@axentia.se> --- drivers/gpu/drm/drm_atomic_helper.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-)