From patchwork Sat Jul 14 12:21:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haneen Mohammed X-Patchwork-Id: 10525047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 60C0560245 for ; Sun, 15 Jul 2018 14:58:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51D45284A7 for ; Sun, 15 Jul 2018 14:58:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 466E02890F; Sun, 15 Jul 2018 14:58:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09C27284A7 for ; Sun, 15 Jul 2018 14:58:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 099B96E3C6; Sun, 15 Jul 2018 14:57:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 956D16E2DD for ; Sat, 14 Jul 2018 12:21:18 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id e7-v6so7934006wrs.9 for ; Sat, 14 Jul 2018 05:21:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=l11drG/k8Wp9lipKadXZUhuXQar4h7bUzsltKLTjfNU=; b=t1fNdXvML9SZZ60AudSG9/NxRVxLDKKpB0oVdEVuJBTyITYHkIEOC6IpCzZTGcfYzb BHYLTh0xnVWWxXBzpLa8M4YriEM2CWapmLIZmtoXMJ8jlDaG3aseRazQ53jn68+Diwo6 WxnoovCRbzpxhTIMhwzWEomcnuJaM2BWsb1z9EMEBdCyWKRIJI+cECJk7gX9zkPmS/1r nfdLC8mwQHjDDuyuoZ6pDms++nUg5sb2OOo6dt0Kdf/CdcKqhecczJdeFmnWc9aXAUZQ 7DRXb6EWw4Qupu6LA2n6RdaN4v3vHTEQdd3Wl4zjTKPLypK0woWBYH/SvhPKTFk0ncGW RMVg== X-Gm-Message-State: AOUpUlHcGb+gODGWbtvotI3eKa7tG06HbhIpE8rDgbmVrffNiE4QxMvL JSmoOps6MAHzA9iawka1TgpCuaDI X-Google-Smtp-Source: AAOMgpfiMhQyUYVwqRCyyfF+p7keCLYlWVzLR8VgJihW39KHdct/6kUgS5gDeNLE45o6aenL3L2SnA== X-Received: by 2002:adf:a634:: with SMTP id k49-v6mr7795210wrc.181.1531570876987; Sat, 14 Jul 2018 05:21:16 -0700 (PDT) Received: from haneenDRM ([188.48.174.13]) by smtp.gmail.com with ESMTPSA id g63-v6sm6810228wmf.3.2018.07.14.05.21.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 14 Jul 2018 05:21:16 -0700 (PDT) Date: Sat, 14 Jul 2018 15:21:13 +0300 From: Haneen Mohammed To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 3/5] drm/vkms: Add atomic_helper_check_plane_state Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Mailman-Approved-At: Sun, 15 Jul 2018 14:57:27 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hamohammed.sa@gmail.com, rodrigosiqueiramelo@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Call atomic_helper_check_plane_state to clip plane coordinates. Signed-off-by: Haneen Mohammed Reviewed-by: Sean Paul --- Changes in v2: - check for plane_state->visible since we can't handle a disabled primary plane yet. drivers/gpu/drm/vkms/vkms_plane.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c index 877483984897..aaf7c35faed6 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -7,6 +7,7 @@ */ #include "vkms_drv.h" +#include #include #include #include @@ -25,6 +26,33 @@ static void vkms_primary_plane_update(struct drm_plane *plane, { } +static int vkms_plane_atomic_check(struct drm_plane *plane, + struct drm_plane_state *state) +{ + 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, + false, true); + if (ret != 0) + return ret; + + /* for now primary plane must be visible and full screen */ + if (!state->visible) + return -EINVAL; + + return 0; +} + static int vkms_prepare_fb(struct drm_plane *plane, struct drm_plane_state *state) { @@ -58,6 +86,7 @@ static void vkms_cleanup_fb(struct drm_plane *plane, static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = { .atomic_update = vkms_primary_plane_update, + .atomic_check = vkms_plane_atomic_check, .prepare_fb = vkms_prepare_fb, .cleanup_fb = vkms_cleanup_fb, };