From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>,
Maling list - DRI developers <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 1/9] drm/fb-helper: Eliminate the .best_encoder() usage
Date: Thu, 5 Jul 2018 16:59:39 +0300 [thread overview]
Message-ID: <20180705135939.GA5565@intel.com> (raw)
In-Reply-To: <CADnq5_NnO82a55TMk0fA-5mbahJMRJRY6JZZg3_BO+gJYujSjw@mail.gmail.com>
On Thu, Jun 28, 2018 at 11:27:07AM -0400, Alex Deucher wrote:
> On Thu, Jun 28, 2018 at 9:13 AM, Ville Syrjala
> <ville.syrjala@linux.intel.com> wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Instead of using the .best_encoder() hook to figure out whether a given
> > connector+crtc combo will work, let's instead do what userspace does and
> > just iterate over all the encoders for the connector, and then check
> > each crtc against each encoder's possible_crtcs bitmask.
> >
> > v2: Avoid oopsing on NULL encoders (Daniel)
> > s/connector_crtc_ok/connector_has_possible_crtc/
> >
> > Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Reviewed-by: Alex Deucher <alexander.deucher@amd.com> #v1
> > Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Series is:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Thanks for the review. Series pushed to drm-misc-next.
>
> > ---
> > drivers/gpu/drm/drm_fb_helper.c | 41 ++++++++++++++++++++++++-----------------
> > 1 file changed, 24 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index cab14f253384..b37f06317d51 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -2323,6 +2323,27 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper,
> > return true;
> > }
> >
> > +static bool connector_has_possible_crtc(struct drm_connector *connector,
> > + struct drm_crtc *crtc)
> > +{
> > + int i;
> > +
> > + for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
> > + struct drm_encoder *encoder;
> > +
> > + if (connector->encoder_ids[i] == 0)
> > + break;
> > +
> > + encoder = drm_encoder_find(connector->dev, NULL,
> > + connector->encoder_ids[i]);
> > +
> > + if (encoder->possible_crtcs & drm_crtc_mask(crtc))
> > + return true;
> > + }
> > +
> > + return false;
> > +}
> > +
> > static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
> > struct drm_fb_helper_crtc **best_crtcs,
> > struct drm_display_mode **modes,
> > @@ -2331,7 +2352,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
> > int c, o;
> > struct drm_connector *connector;
> > const struct drm_connector_helper_funcs *connector_funcs;
> > - struct drm_encoder *encoder;
> > int my_score, best_score, score;
> > struct drm_fb_helper_crtc **crtcs, *crtc;
> > struct drm_fb_helper_connector *fb_helper_conn;
> > @@ -2362,20 +2382,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
> >
> > connector_funcs = connector->helper_private;
> >
> > - /*
> > - * If the DRM device implements atomic hooks and ->best_encoder() is
> > - * NULL we fallback to the default drm_atomic_helper_best_encoder()
> > - * helper.
> > - */
> > - if (drm_drv_uses_atomic_modeset(fb_helper->dev) &&
> > - !connector_funcs->best_encoder)
> > - encoder = drm_atomic_helper_best_encoder(connector);
> > - else
> > - encoder = connector_funcs->best_encoder(connector);
> > -
> > - if (!encoder)
> > - goto out;
> > -
> > /*
> > * select a crtc for this connector and then attempt to configure
> > * remaining connectors
> > @@ -2383,7 +2389,8 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
> > for (c = 0; c < fb_helper->crtc_count; c++) {
> > crtc = &fb_helper->crtc_info[c];
> >
> > - if ((encoder->possible_crtcs & (1 << c)) == 0)
> > + if (!connector_has_possible_crtc(connector,
> > + crtc->mode_set.crtc))
> > continue;
> >
> > for (o = 0; o < n; o++)
> > @@ -2410,7 +2417,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
> > sizeof(struct drm_fb_helper_crtc *));
> > }
> > }
> > -out:
> > +
> > kfree(crtcs);
> > return best_score;
> > }
> > --
> > 2.16.4
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-07-05 13:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-28 13:13 [PATCH v2 0/9] drm: Third attempt at fixing the fb-helper .best_encoder() mess Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 1/9] drm/fb-helper: Eliminate the .best_encoder() usage Ville Syrjala
2018-06-28 15:27 ` Alex Deucher
2018-07-05 13:59 ` Ville Syrjälä [this message]
2018-06-28 13:13 ` [PATCH v2 2/9] drm/i915: Nuke intel_mst_best_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 3/9] drm: Add drm_connector_for_each_possible_encoder() Ville Syrjala
2018-06-28 16:56 ` Daniel Vetter
2018-06-28 17:24 ` Ville Syrjälä
2018-06-28 13:13 ` [PATCH v2 4/9] drm/amdgpu: Use drm_connector_for_each_possible_encoder() Ville Syrjala
[not found] ` <20180628131315.14156-1-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-28 13:13 ` [PATCH v2 5/9] drm/nouveau: " Ville Syrjala
2018-06-30 19:12 ` Dan Carpenter
2018-07-02 13:04 ` Ville Syrjälä
2018-07-02 14:05 ` Ville Syrjälä
[not found] ` <20180628131315.14156-6-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-02 15:29 ` [PATCH v3 " Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 6/9] drm/radeon: " Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 8/9] drm/msm: Use drm_connector_has_possible_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 7/9] drm: Add drm_connector_has_possible_encoder() Ville Syrjala
2018-06-28 13:13 ` [PATCH v2 9/9] drm/tilcdc: Use drm_connector_has_possible_encoder() Ville Syrjala
2018-06-28 13:45 ` Jyri Sarha
2018-06-28 17:52 ` Ville Syrjälä
2018-06-28 13:32 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Third attempt at fixing the fb-helper .best_encoder() mess Patchwork
2018-06-28 13:47 ` [PATCH v2 0/9] " Ville Syrjälä
2018-06-28 13:50 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-06-28 15:35 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-02 15:47 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Third attempt at fixing the fb-helper .best_encoder() mess (rev2) Patchwork
2018-07-02 16:06 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-02 18:28 ` ✓ Fi.CI.IGT: " Patchwork
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=20180705135939.GA5565@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=alexdeucher@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dhinakaran.pandiyan@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/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.