* [PATCH v2] drm/virtio: add plane check
@ 2019-08-22 9:46 Gerd Hoffmann
2019-08-26 22:34 ` Chia-I Wu
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2019-08-22 9:46 UTC (permalink / raw)
To: dri-devel
Cc: Gerd Hoffmann, David Airlie, Daniel Vetter,
open list:VIRTIO GPU DRIVER, open list
Use drm_atomic_helper_check_plane_state()
to sanity check the plane state.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_plane.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index a492ac3f4a7e..fe5efb2de90d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -84,7 +84,22 @@ static const struct drm_plane_funcs virtio_gpu_plane_funcs = {
static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
{
- return 0;
+ bool is_cursor = plane->type == DRM_PLANE_TYPE_CURSOR;
+ struct drm_crtc_state *crtc_state;
+ int ret;
+
+ if (!state->fb || !state->crtc)
+ return 0;
+
+ crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
+ if (IS_ERR(crtc_state))
+ return PTR_ERR(crtc_state);
+
+ ret = drm_atomic_helper_check_plane_state(state, crtc_state,
+ DRM_PLANE_HELPER_NO_SCALING,
+ DRM_PLANE_HELPER_NO_SCALING,
+ is_cursor, true);
+ return ret;
}
static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
--
2.18.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/virtio: add plane check
2019-08-22 9:46 [PATCH v2] drm/virtio: add plane check Gerd Hoffmann
@ 2019-08-26 22:34 ` Chia-I Wu
2019-08-27 5:21 ` Gerd Hoffmann
0 siblings, 1 reply; 4+ messages in thread
From: Chia-I Wu @ 2019-08-26 22:34 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: ML dri-devel, David Airlie, open list, open list:VIRTIO GPU DRIVER
On Thu, Aug 22, 2019 at 2:47 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> Use drm_atomic_helper_check_plane_state()
> to sanity check the plane state.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_plane.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> index a492ac3f4a7e..fe5efb2de90d 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -84,7 +84,22 @@ static const struct drm_plane_funcs virtio_gpu_plane_funcs = {
> static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
> struct drm_plane_state *state)
> {
> - return 0;
> + bool is_cursor = plane->type == DRM_PLANE_TYPE_CURSOR;
> + struct drm_crtc_state *crtc_state;
> + int ret;
> +
> + if (!state->fb || !state->crtc)
> + return 0;
> +
> + crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
> + if (IS_ERR(crtc_state))
> + return PTR_ERR(crtc_state);
Is drm_atomic_get_new_crtc_state better here?
> +
> + ret = drm_atomic_helper_check_plane_state(state, crtc_state,
> + DRM_PLANE_HELPER_NO_SCALING,
> + DRM_PLANE_HELPER_NO_SCALING,
> + is_cursor, true);
> + return ret;
> }
>
> static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
> --
> 2.18.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/virtio: add plane check
2019-08-26 22:34 ` Chia-I Wu
@ 2019-08-27 5:21 ` Gerd Hoffmann
2019-08-27 16:42 ` Chia-I Wu
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2019-08-27 5:21 UTC (permalink / raw)
To: Chia-I Wu
Cc: ML dri-devel, David Airlie, open list, open list:VIRTIO GPU DRIVER
On Mon, Aug 26, 2019 at 03:34:56PM -0700, Chia-I Wu wrote:
> On Thu, Aug 22, 2019 at 2:47 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> > Use drm_atomic_helper_check_plane_state()
> > to sanity check the plane state.
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> > drivers/gpu/drm/virtio/virtgpu_plane.c | 17 ++++++++++++++++-
> > 1 file changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> > index a492ac3f4a7e..fe5efb2de90d 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> > @@ -84,7 +84,22 @@ static const struct drm_plane_funcs virtio_gpu_plane_funcs = {
> > static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
> > struct drm_plane_state *state)
> > {
> > - return 0;
> > + bool is_cursor = plane->type == DRM_PLANE_TYPE_CURSOR;
> > + struct drm_crtc_state *crtc_state;
> > + int ret;
> > +
> > + if (!state->fb || !state->crtc)
> > + return 0;
> > +
> > + crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
> > + if (IS_ERR(crtc_state))
> > + return PTR_ERR(crtc_state);
> Is drm_atomic_get_new_crtc_state better here?
We don't have to worry about old/new state here. The drm_plane_state we
get passed is the state we should check in this callback (and I think
this always is the new state).
cheers,
Gerd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] drm/virtio: add plane check
2019-08-27 5:21 ` Gerd Hoffmann
@ 2019-08-27 16:42 ` Chia-I Wu
0 siblings, 0 replies; 4+ messages in thread
From: Chia-I Wu @ 2019-08-27 16:42 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: ML dri-devel, David Airlie, open list, open list:VIRTIO GPU DRIVER
On Mon, Aug 26, 2019 at 10:21 PM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Mon, Aug 26, 2019 at 03:34:56PM -0700, Chia-I Wu wrote:
> > On Thu, Aug 22, 2019 at 2:47 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
> > >
> > > Use drm_atomic_helper_check_plane_state()
> > > to sanity check the plane state.
> > >
> > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > ---
> > > drivers/gpu/drm/virtio/virtgpu_plane.c | 17 ++++++++++++++++-
> > > 1 file changed, 16 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> > > index a492ac3f4a7e..fe5efb2de90d 100644
> > > --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> > > +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> > > @@ -84,7 +84,22 @@ static const struct drm_plane_funcs virtio_gpu_plane_funcs = {
> > > static int virtio_gpu_plane_atomic_check(struct drm_plane *plane,
> > > struct drm_plane_state *state)
> > > {
> > > - return 0;
> > > + bool is_cursor = plane->type == DRM_PLANE_TYPE_CURSOR;
> > > + struct drm_crtc_state *crtc_state;
> > > + int ret;
> > > +
> > > + if (!state->fb || !state->crtc)
> > > + return 0;
> > > +
> > > + crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
> > > + if (IS_ERR(crtc_state))
> > > + return PTR_ERR(crtc_state);
> > Is drm_atomic_get_new_crtc_state better here?
>
> We don't have to worry about old/new state here. The drm_plane_state we
> get passed is the state we should check in this callback (and I think
> this always is the new state).
Acked-by: Chia-I Wu <olvaffe@gmail.com> (because I am not familiar
with the atomic code to give an r-b)
>
> cheers,
> Gerd
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-08-27 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22 9:46 [PATCH v2] drm/virtio: add plane check Gerd Hoffmann
2019-08-26 22:34 ` Chia-I Wu
2019-08-27 5:21 ` Gerd Hoffmann
2019-08-27 16:42 ` Chia-I Wu
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).