lkml.org 
[lkml]   [2019]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RFC v2 3/8] drm/bridge: synopsys: dw-hdmi: add bus format negociation
From
Date
On 27/08/2019 11:03, Boris Brezillon wrote:
> On Tue, 27 Aug 2019 10:14:20 +0200
> Neil Armstrong <narmstrong@baylibre.com> wrote:
>
>> Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negociate
>
> ^negotiate
>
>> the possible output and input formats for the current mode and monitor,
>> and use the negociated formats in a basic atomic_check callback.
>
> ^negotiated

Indeed, thx

>
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>
>
>>
>> +static void dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
>> + struct drm_bridge_state *bridge_state,
>> + struct drm_crtc_state *crtc_state,
>> + struct drm_connector_state *conn_state,
>> + unsigned int *num_output_fmts,
>> + u32 *output_fmts)
>> +{
>> + struct drm_connector *conn = conn_state->connector;
>> + struct drm_display_info *info = &conn->display_info;
>> + struct drm_display_mode *mode = &crtc_state->mode;
>> + bool is_hdmi2_sink = info->hdmi.scdc.supported;
>> + int i = 0;
>> +
>> + /*
>> + * If the current mode enforces 4:2:0, force the output but format
>> + * to 4:2:0 and do not add the YUV422/444/RGB formats
>> + */
>> + if (drm_mode_is_420_only(info, mode) ||
>> + (!is_hdmi2_sink && drm_mode_is_420_also(info, mode))) {
>> +
>> + /* Order bus formats from 16bit to 8bit if supported */
>> + if (info->bpc == 16 &&
>> + (info->hdmi.y420_dc_modes & DRM_EDID_YCBCR420_DC_48)) {
>> + if (output_fmts)
>> + output_fmts[i] = MEDIA_BUS_FMT_UYYVYY16_0_5X48;
>> + ++i;
>> + }
>
> You could probably add the following helper:
>
> static void dw_hdmi_bridge_add_fmt(unsigned int *num_fmts, u32 *fmts,
> u32 new_fmt)
> {
> if (fmts)
> fmts[*num_fmts] = new_fmt;
>
> (*num_fmts)++;
> }
>
> to avoid duplicating the
>
> if (fmts)
> ...
>
> i++;
>
> logic.
>

Yes, I was planning this,

Thanks,
Neil

\
 
 \ /
  Last update: 2019-08-27 12:09    [W:0.065 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site