[PATCH 1/2] drm: provide a helper for the encoder possible_crtcs mask

David Herrmann dh.herrmann at gmail.com
Mon Jan 13 05:57:37 PST 2014


Hi

On Mon, Jan 13, 2014 at 2:55 PM, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> On Mon, Jan 13, 2014 at 02:50:46PM +0100, David Herrmann wrote:
>> Hi Russel
>>
>> On Mon, Jan 13, 2014 at 1:47 PM, Russell King - ARM Linux
>> <linux at arm.linux.org.uk> wrote:
>> > On Mon, Jan 13, 2014 at 12:58:54PM +0100, David Herrmann wrote:
>> >> Does that -1 ever make sense? We don't support mode-object-hotplugging
>> >> so all "drm_crtc" objects are known at initialization time. I'd rather
>> >> put a BUG() here than a silent -1. This also makes drm_crtc_mask()
>> >> redundant.
>> >
>> > I disagree with that last statement.  drm_crtc_mask() is still useful
>> > for converting to the mask, rather than having that open coded all
>> > over the place.  It probably makes more sense for drm_crtc_mask() to
>> > become a helper in a header file though.
>>
>> Thierry renamed your helper to drm_crtc_index() and added
>> drm_crtc_mask(). If we remove the -1, drm_crtc_mask() is redundant as
>> it just calls drm_crtc_index(). So I cannot follow what you mean by
>> "open coded all over the place". I guess you were talking about
>> drm_crtc_index()?
>
> +uint32_t drm_crtc_mask(struct drm_crtc *crtc)
> +{
> +       int i = drm_crtc_index(crtc);
> +
> +       return i < 0 ? 0 : 1 << i;
> +}
> +EXPORT_SYMBOL(drm_crtc_mask);
>
> When drm_crtc_index() no longer returns negative numbers, this becomes:
>
> +uint32_t drm_crtc_mask(struct drm_crtc *crtc)
> +{
> +       return 1 << drm_crtc_index(crtc);
> +}
> +EXPORT_SYMBOL(drm_crtc_mask);
>
> Notice the conversion from an index returned by drm_crtc_index() to a
> bitmask.

Oops, missed that, sorry for the noise.


More information about the dri-devel mailing list