From patchwork Tue Jul 24 16:30:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haneen Mohammed X-Patchwork-Id: 10543585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EDDFF112E for ; Wed, 25 Jul 2018 07:06:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC3C628C3A for ; Wed, 25 Jul 2018 07:06:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D098929441; Wed, 25 Jul 2018 07:06:46 +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 916E528C3A for ; Wed, 25 Jul 2018 07:06:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CDD06E668; Wed, 25 Jul 2018 07:05:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by gabe.freedesktop.org (Postfix) with ESMTPS id A796F6E5E7 for ; Tue, 24 Jul 2018 16:30:25 +0000 (UTC) Received: by mail-pg1-x52a.google.com with SMTP id y4-v6so3259190pgp.9 for ; Tue, 24 Jul 2018 09:30:25 -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=PhfY0R6YCbYZVOaoR2mC4RgUq9UtSlx+mAryHf9duUw=; b=fGuIU9aGCE1MYdN/9UHIO2kzcO+jySOiHbKaTrL6Z9roR0bnrzH/gDfmTHzbrkui3w kuXzr0o0Fp2JwYok51MSKCHQSnwOTVXejKN+RZshy5h75yKd+HrEJeCNp9bFQiCrN6Cd 06JCKBxok/KBma7GlDwdHG3lob/Rv1bo6631cGQpVfEmipvJ4hJH+Q6Jgq/dUAMImfL8 j0WM2q7c+0SaLJiumCIvQ+RLprZpzCBjF2xMWgBdy/xphjeafsDGuPs8W/k3NKC5NHd/ sk1V0Z+iz7/DU9S6sOqwVmpa9pbmF6o2cn5Dl64yPJlTmjml1f2SaF/tHixiV9nlYObX 4Z9A== X-Gm-Message-State: AOUpUlHVfldQbnUHlShXP//8SnqRSTavxk+Pf50do2UvDLaus6LVPwd7 FQg5L6xe6Cx6cFem7r1mgtxMi5L+ X-Google-Smtp-Source: AAOMgpdDA0y8XcjV7dunPqDeQbDIBbqZTXE6dz9R6L1XDw7sMksLqyIQSlbF0dtxXWWj3X4soTpb/w== X-Received: by 2002:a63:214f:: with SMTP id s15-v6mr16808521pgm.267.1532449824982; Tue, 24 Jul 2018 09:30:24 -0700 (PDT) Received: from haneenDRM ([64.77.242.50]) by smtp.gmail.com with ESMTPSA id b20-v6sm21091731pfc.178.2018.07.24.09.30.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jul 2018 09:30:24 -0700 (PDT) Date: Tue, 24 Jul 2018 19:30:22 +0300 From: Haneen Mohammed To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 3/4] 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: Wed, 25 Jul 2018 07:05:01 +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 5611e7cf5fc9..8191940844e5 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -8,6 +8,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, };