From patchwork Mon Jul 9 15:47:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haneen Mohammed X-Patchwork-Id: 10516243 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 40A0F6020F for ; Tue, 10 Jul 2018 06:57:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E65728C10 for ; Tue, 10 Jul 2018 06:57:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22D9028C37; Tue, 10 Jul 2018 06:57:57 +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 DC4C728C10 for ; Tue, 10 Jul 2018 06:57:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7D5236E7E1; Tue, 10 Jul 2018 06:56:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id D05356E482 for ; Mon, 9 Jul 2018 15:47:39 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id s13-v6so10357754wmc.1 for ; Mon, 09 Jul 2018 08:47:39 -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=LumyvQRi234/RfRk8OvNzV9qds6KETUcX8t6L+h+oJ0=; b=MQM/1TcW2Q8kbLtf5idq9ThIot0kuaXtvbKhKkmeWUo5YHkU611baGwA3ETs0DBzLT hRS19oYDSKmu6xX/QU7RJ+JUYn1WTawXYLB1Lq4JdA72nYNll/PPaYZLRB4g1punlZMT 1b6r7SSOdIroGrdvldrSVRj9FfazwExkflYXwp32YQRU+YEOA2LJ2/ZTGrIu19m/zEad A1dml1zgYqX9vofT3UKJFVKJ2Q7Va+Ur4Azz7t/+TjkqEV9B4LX3ly1ouZqWQpIayVv8 zmYt6FRltyIeH9ilajgL6g/odOiAXNFk61pdVggR65kieBsF0SR6PDrEMgTrxaUQIEgJ Yy5g== X-Gm-Message-State: APt69E1L/EKYkzEPK405iay5K3aQH/yhXAi5FVwTTkMC744eZN2QM42n nxoAyGk1jMIlyUZ1WceDVF8He4uI X-Google-Smtp-Source: AAOMgpcJ2SJr3NWmaD2KfQUacMc+0+m0l2YA3MfO6KNaP+3qtsif33hWsQg/zaKwBMPIziRUG3HR7A== X-Received: by 2002:a1c:dc41:: with SMTP id t62-v6mr13124381wmg.42.1531151258269; Mon, 09 Jul 2018 08:47:38 -0700 (PDT) Received: from haneen-vb ([78.191.177.254]) by smtp.gmail.com with ESMTPSA id v9-v6sm19068128wrn.97.2018.07.09.08.47.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jul 2018 08:47:37 -0700 (PDT) Date: Mon, 9 Jul 2018 18:47:34 +0300 From: Haneen Mohammed To: dri-devel@lists.freedesktop.org Subject: [PATCH 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: Tue, 10 Jul 2018 06:55:25 +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 --- 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 +#include #include #include +#include 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); } static void vkms_primary_plane_update(struct drm_plane *plane,