From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
To: Brian Starkey <brian.starkey@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>,
Haneen Mohammed <hamohammed.sa@gmail.com>,
Simon Ser <contact@emersion.fr>,
dri-devel <dri-devel@lists.freedesktop.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] drm/vkms: Use index instead of 0 in possible crtc
Date: Mon, 17 Jun 2019 23:19:44 -0300 [thread overview]
Message-ID: <20190618021944.7ilhgaswme2a6amt@smtp.gmail.com> (raw)
In-Reply-To: <20190607150420.GI21222@phenom.ffwll.local>
On 06/07, Daniel Vetter wrote:
> On Fri, Jun 07, 2019 at 11:37:55AM -0300, Rodrigo Siqueira wrote:
> > On Fri, Jun 7, 2019 at 4:40 AM Daniel Vetter <daniel@ffwll.ch> wrote:
> > >
> > > On Thu, Jun 06, 2019 at 07:40:38PM -0300, Rodrigo Siqueira wrote:
> > > > When vkms calls drm_universal_plane_init(), it sets 0 for the
> > > > possible_crtcs parameter which works well for a single encoder and
> > > > connector; however, this approach is not flexible and does not fit well
> > > > for vkms. This commit adds an index parameter for vkms_plane_init()
> > > > which makes code flexible and enables vkms to support other DRM features.
> > > >
> > > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > >
> > > I think a core patch to WARN_ON if this is NULL would be good. Since
> > > that's indeed a bit broken ... We'd need to check all callers to make sure
> > > there's not other such bugs anywhere ofc.
> > > -Daniel
> >
> > Do you mean add WARN_ON in `drm_universal_plane_init()` if
> > `possible_crtcs` is equal to zero?
>
> Yeah, and same for endcoders I guess too. Altough with encoders I think
> there's a ton of broken drivers.
I made the patch, but when I started to write the commit message, I just
realized that I did not understand why possible_crtcs should not be
equal zero. Why can we not use zero?
> -Daniel
>
> >
> > > > ---
> > > > drivers/gpu/drm/vkms/vkms_drv.c | 2 +-
> > > > drivers/gpu/drm/vkms/vkms_drv.h | 4 ++--
> > > > drivers/gpu/drm/vkms/vkms_output.c | 6 +++---
> > > > drivers/gpu/drm/vkms/vkms_plane.c | 4 ++--
> > > > 4 files changed, 8 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> > > > index 738dd6206d85..92296bd8f623 100644
> > > > --- a/drivers/gpu/drm/vkms/vkms_drv.c
> > > > +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> > > > @@ -92,7 +92,7 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
> > > > dev->mode_config.max_height = YRES_MAX;
> > > > dev->mode_config.preferred_depth = 24;
> > > >
> > > > - return vkms_output_init(vkmsdev);
> > > > + return vkms_output_init(vkmsdev, 0);
> > > > }
> > > >
> > > > static int __init vkms_init(void)
> > > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> > > > index 81f1cfbeb936..e81073dea154 100644
> > > > --- a/drivers/gpu/drm/vkms/vkms_drv.h
> > > > +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> > > > @@ -113,10 +113,10 @@ bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
> > > > int *max_error, ktime_t *vblank_time,
> > > > bool in_vblank_irq);
> > > >
> > > > -int vkms_output_init(struct vkms_device *vkmsdev);
> > > > +int vkms_output_init(struct vkms_device *vkmsdev, int index);
> > > >
> > > > struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> > > > - enum drm_plane_type type);
> > > > + enum drm_plane_type type, int index);
> > > >
> > > > /* Gem stuff */
> > > > struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
> > > > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> > > > index 3b162b25312e..1442b447c707 100644
> > > > --- a/drivers/gpu/drm/vkms/vkms_output.c
> > > > +++ b/drivers/gpu/drm/vkms/vkms_output.c
> > > > @@ -36,7 +36,7 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = {
> > > > .get_modes = vkms_conn_get_modes,
> > > > };
> > > >
> > > > -int vkms_output_init(struct vkms_device *vkmsdev)
> > > > +int vkms_output_init(struct vkms_device *vkmsdev, int index)
> > > > {
> > > > struct vkms_output *output = &vkmsdev->output;
> > > > struct drm_device *dev = &vkmsdev->drm;
> > > > @@ -46,12 +46,12 @@ int vkms_output_init(struct vkms_device *vkmsdev)
> > > > struct drm_plane *primary, *cursor = NULL;
> > > > int ret;
> > > >
> > > > - primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY);
> > > > + primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
> > > > if (IS_ERR(primary))
> > > > return PTR_ERR(primary);
> > > >
> > > > if (enable_cursor) {
> > > > - cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR);
> > > > + cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index);
> > > > if (IS_ERR(cursor)) {
> > > > ret = PTR_ERR(cursor);
> > > > goto err_cursor;
> > > > diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> > > > index 0e67d2d42f0c..20ffc52f9194 100644
> > > > --- a/drivers/gpu/drm/vkms/vkms_plane.c
> > > > +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> > > > @@ -168,7 +168,7 @@ static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
> > > > };
> > > >
> > > > struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> > > > - enum drm_plane_type type)
> > > > + enum drm_plane_type type, int index)
> > > > {
> > > > struct drm_device *dev = &vkmsdev->drm;
> > > > const struct drm_plane_helper_funcs *funcs;
> > > > @@ -190,7 +190,7 @@ struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
> > > > funcs = &vkms_primary_helper_funcs;
> > > > }
> > > >
> > > > - ret = drm_universal_plane_init(dev, plane, 0,
> > > > + ret = drm_universal_plane_init(dev, plane, 1 << index,
> > > > &vkms_plane_funcs,
> > > > formats, nformats,
> > > > NULL, type, NULL);
> > > > --
> > > > 2.21.0
> > >
> > >
> > >
> > > --
> > > Daniel Vetter
> > > Software Engineer, Intel Corporation
> > > http://blog.ffwll.ch
> >
> >
> >
> > --
> >
> > Rodrigo Siqueira
> > https://siqueira.tech
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Rodrigo Siqueira
https://siqueira.tech
next prev parent reply other threads:[~2019-06-18 2:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 22:40 [PATCH 0/2] drm/vkms: Introduces writeback support Rodrigo Siqueira
2019-06-06 22:40 ` [PATCH 1/2] drm/vkms: Use index instead of 0 in possible crtc Rodrigo Siqueira
2019-06-07 7:39 ` Daniel Vetter
2019-06-07 14:37 ` Rodrigo Siqueira
2019-06-07 15:04 ` Daniel Vetter
2019-06-18 2:19 ` Rodrigo Siqueira [this message]
2019-06-18 5:18 ` Simon Ser
2019-06-18 21:51 ` Rodrigo Siqueira
2019-06-06 22:41 ` [PATCH 2/2] drm/vkms: Add support for writeback Rodrigo Siqueira
2019-06-07 7:48 ` Daniel Vetter
2019-06-07 7:53 ` Daniel Vetter
2019-06-07 14:58 ` Rodrigo Siqueira
2019-06-10 15:39 ` Liviu Dudau
2019-06-12 13:58 ` Rodrigo Siqueira
2019-06-07 14:17 ` Brian Starkey
2019-06-07 14:51 ` Daniel Vetter
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=20190618021944.7ilhgaswme2a6amt@smtp.gmail.com \
--to=rodrigosiqueiramelo@gmail.com \
--cc=brian.starkey@arm.com \
--cc=contact@emersion.fr \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).