[PATCH 3/4] drm/vkms: Add atomic_helper_check_plane_state
Daniel Vetter
daniel at ffwll.ch
Tue Jul 10 08:07:58 UTC 2018
On Mon, Jul 09, 2018 at 06:47:34PM +0300, Haneen Mohammed wrote:
> Call atomic_helper_check_plane_state to clip plane coordinates.
>
> Signed-off-by: Haneen Mohammed <hamohammed.sa at gmail.com>
> ---
> drivers/gpu/drm/vkms/vkms_plane.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
> index f464eb0e05dd..bf37aebac0fb 100644
> --- a/drivers/gpu/drm/vkms/vkms_plane.c
> +++ b/drivers/gpu/drm/vkms/vkms_plane.c
> @@ -7,9 +7,10 @@
> */
>
> #include "vkms_drv.h"
> -#include <drm/drm_plane_helper.h>
> +#include <drm/drm_atomic.h>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_gem_framebuffer_helper.h>
> +#include <drm/drm_plane_helper.h>
>
> static const struct drm_plane_funcs vkms_plane_funcs = {
> .update_plane = drm_atomic_helper_update_plane,
> @@ -23,7 +24,20 @@ static const struct drm_plane_funcs vkms_plane_funcs = {
> static int vkms_plane_atomic_check(struct drm_plane *plane,
> struct drm_plane_state *state)
> {
> - return 0;
> + struct drm_crtc_state *crtc_state;
> +
> + 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);
> +
> + return drm_atomic_helper_check_plane_state(state, crtc_state,
> + DRM_PLANE_HELPER_NO_SCALING,
> + DRM_PLANE_HELPER_NO_SCALING,
> + false, true);
So one additional thing we need to check here is plane_state->visible
(which is computed by the check_plane_state) function. For now we can't
handle a disabled primary plane (we'd need to change our crc function to
compute the crc of an all-black screen), hence need to reject this:
ret = drm_atomic_helper_check_plane_state(state, crtc_state,
DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING,
false, true);
if (ret != 0)
return ret;
/* for now primary plane must be visible and full screen */
if (!plane_state->visible)
return -EINVAL;
return 0;
otherwise lgtm.
-Daniel
> }
>
> static void vkms_primary_plane_update(struct drm_plane *plane,
> --
> 2.17.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list