All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	Kumar@freedesktop.org, kiran.s.kumar@intel.com,
	ML dri-devel <dri-devel@lists.freedesktop.org>,
	Kausal Malladi <kausalmalladi@gmail.com>
Subject: Re: [PATCH 3/5] drm: introduce pipe color correction properties
Date: Sat, 27 Feb 2016 00:35:23 +0000	[thread overview]
Message-ID: <CACvgo50XOMi=jtHB=NNfmugE8Vg5Jf7tGpmt_0kQJek8A1JOdQ@mail.gmail.com> (raw)
In-Reply-To: <56D072BF.9090600@intel.com>

On 26 February 2016 at 15:43, Lionel Landwerlin
<lionel.g.landwerlin@intel.com> wrote:
> On 26/02/16 00:36, Emil Velikov wrote:
>>
>> Hi Lionel,
>>
>> A bunch of suggestions - feel free to take or ignore them :-)
>>
>> On 25 February 2016 at 10:58, Lionel Landwerlin
>> <lionel.g.landwerlin@intel.com> wrote:

> I'm not sure it matters as the drm_crtc_state you're set properties on will
> be discarded if there is an error.
> The current drm_crtc_state that has been applied onto the hardware should be
> untouched.
>
That's the thing - the current drm_crts_state (mode_blob) is being
discarded, as opposed to the newly setup one. Although I could have
misunderstood something.


>
> This is because we accept more than one size of degamma/gamma LUT (legacy ->
> 256 elements, new LUT -> (de)gamma_lut_size elements).
> It's up for the driver the check the size and raise an error in its
> atomic_check() vfunc.
>
Ahh yes the legacy vs atomic difference.


>
> Moving the if (blob == NULL) right after the blob allocation to make it
> simpler.
>
> What about completeness? Is there something inherently wrong here?
The suggestion to reorder things is mostly to keep the setup/teardown
order in reverse order - create_blob, create_state and drop_state,
drop_blob. As you've noticed, I'm kind of a sucker for those :-) There
are no inter-dependencies that would require it here so it's not
required.

>>
>>
>>> +       state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
>>> +retry:
>>> +       crtc_state = drm_atomic_get_crtc_state(state, crtc);
>>> +       if (IS_ERR(crtc_state)) {
>>> +               ret = PTR_ERR(crtc_state);
>>> +               goto fail;
>>> +       }
>>> +
>>> +       /* Reset DEGAMMA_LUT and CTM properties. */
>>> +       ret = drm_atomic_crtc_set_property(crtc, crtc_state,
>>> +                       config->degamma_lut_property, 0);
>>> +       if (ret)
>>> +               goto fail;
>>
>> Add new blank line please.
>
>
> Sure.
>>
>>
>>> +       ret = drm_atomic_crtc_set_property(crtc, crtc_state,
>>> +                       config->ctm_property, 0);
>>> +       if (ret)
>>> +               goto fail;
>>> +
>>> +       /* Set GAMMA_LUT with legacy values. */
>>> +       if (blob == NULL) {
>>> +               ret = -ENOMEM;
>>> +               goto fail;
>>> +       }
>>> +
>>> +       blob_data = (struct drm_color_lut *) blob->data;
>>> +       for (i = 0; i < size; i++) {
>>> +               blob_data[i].red = red[i];
>>> +               blob_data[i].green = green[i];
>>> +               blob_data[i].blue = blue[i];
>>> +       }
>>> +
>>
>> Move this loop after create_blob()
>
> Thanks, indeed no need to refill it in case of retry.
>
>>
>>> +       ret = drm_atomic_crtc_set_property(crtc, crtc_state,
>>> +                       config->gamma_lut_property, blob->base.id);
>>> +       if (ret)
>>> +               goto fail;
>>> +
>>> +       ret = drm_atomic_commit(state);
>>> +       if (ret != 0)
>>
>> Please check in a consistent way. Currently we have ret != 0 vs ret
>> and foo == NULL vs !foo.
>
>
> Sure.
>
>>
>>> +               goto fail;
>>> +
>>> +       drm_property_unreference_blob(blob);
>>> +
>>> +       /* Driver takes ownership of state on successful commit. */
>>
>> Move the comment before unreference_blob(), so that it's closer to
>> atomic_commit() ?
>
>
> Sure.
>>
>>
>>> --- a/drivers/gpu/drm/drm_crtc.c
>>> +++ b/drivers/gpu/drm/drm_crtc.c
>>> @@ -1554,6 +1554,41 @@ static int
>>> drm_mode_create_standard_properties(struct drm_device *dev)
>>>                  return -ENOMEM;
>>>          dev->mode_config.prop_mode_id = prop;
>>>
>>> +       prop = drm_property_create(dev,
>>> +                       DRM_MODE_PROP_BLOB,
>>> +                       "DEGAMMA_LUT", 0);
>>
>> Just wondering -  don't we want this and the remaining properties to
>> be atomic only ? I doubt we have userspace that [will be updated to]
>> handle these, yet lacks atomic.
>
> This was pointed out by Matt already. Here is Daniel Stone's response :
> https://lists.freedesktop.org/archives/intel-gfx/2016-January/086120.html
>
> I think it's fine to have these properties not atomic because it's not
> really something you update very often (maybe just when starting your UI).
> That's actually how we would like to use them in ChromiumOS as a first step,
> until eventually ChromiumOS switches to atomic.
>
It wasn't a question of "can it be used" but more of "would it make
sense to not switch to atomics once we're here". As is, userspace will
need to have two slightly different code paths. Put the question "how
to deal with if compositor crashes and (re)applying gamma/etc.
multiple times" by Daniel Vettel, on top of it all and things get
extra messy. In both usespace in kernel.

My line of thought is - if there is a high demand for
non-atomic(legacy) degamma/etc. one can easily add it. On the other
hand, once it lands one cannot remove the code from the kernel, ever.

It's up-to you guys really. Just thought I mentioned it.

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-02-27  0:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 10:58 [PATCH 0/5] Pipe level color management V8 Lionel Landwerlin
2016-02-25 10:58 ` [PATCH 1/5] drm/i915: Extract out gamma table and CSC to their own file Lionel Landwerlin
2016-02-25 10:58 ` [PATCH 2/5] drm/i915: Do not read GAMMA_MODE register Lionel Landwerlin
2016-02-25 23:27   ` Matt Roper
2016-02-25 10:58 ` [PATCH 3/5] drm: introduce pipe color correction properties Lionel Landwerlin
2016-02-26  0:36   ` Emil Velikov
2016-02-26  1:04     ` Matt Roper
2016-02-26 15:43     ` Lionel Landwerlin
2016-02-27  0:35       ` Emil Velikov [this message]
2016-02-25 10:58 ` [PATCH 4/5] drm/i915: Implement color management on bdw/skl/bxt/kbl Lionel Landwerlin
2016-02-25 10:58 ` [PATCH 5/5] drm/i915: Implement color management on chv Lionel Landwerlin
2016-02-25 11:35 ` ✗ Fi.CI.BAT: failure for Pipe level color management (rev8) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2016-02-26 17:04 [PATCH 0/5] Pipe level color management V10 Lionel Landwerlin
2016-02-26 17:05 ` [PATCH 3/5] drm: introduce pipe color correction properties Lionel Landwerlin
2016-03-22  9:59   ` Jani Nikula
2016-02-25 15:33 [PATCH 0/5] Pipe level color management V9 Lionel Landwerlin
2016-02-25 15:33 ` [PATCH 3/5] drm: introduce pipe color correction properties Lionel Landwerlin
2016-02-23 14:39 [PATCH 0/5] Pipe level color management V7 Lionel Landwerlin
2016-02-23 14:39 ` [PATCH 3/5] drm: introduce pipe color correction properties Lionel Landwerlin
2016-02-22 14:18 [PATCH 0/5] Pipe level color management V6 Lionel Landwerlin
2016-02-22 14:18 ` [PATCH 3/5] drm: introduce pipe color correction properties Lionel Landwerlin
2016-02-19 15:39 [PATCH 0/5] Pipe level color management V5 Lionel Landwerlin
2016-02-19 15:39 ` [PATCH 3/5] drm: introduce pipe color correction properties Lionel Landwerlin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACvgo50XOMi=jtHB=NNfmugE8Vg5Jf7tGpmt_0kQJek8A1JOdQ@mail.gmail.com' \
    --to=emil.l.velikov@gmail.com \
    --cc=Kumar@freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kausalmalladi@gmail.com \
    --cc=kiran.s.kumar@intel.com \
    --cc=lionel.g.landwerlin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.