From patchwork Thu Jul 19 00:20:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haneen Mohammed X-Patchwork-Id: 10533727 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 F1F8E601D2 for ; Thu, 19 Jul 2018 07:07:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE94B28CDF for ; Thu, 19 Jul 2018 07:07:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2B52293B0; Thu, 19 Jul 2018 07:07:39 +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 91FF528CDF for ; Thu, 19 Jul 2018 07:07:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 13BB86ED0B; Thu, 19 Jul 2018 07:04:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 553066E319 for ; Thu, 19 Jul 2018 00:20:57 +0000 (UTC) Received: by mail-wr1-x42a.google.com with SMTP id h10-v6so6291028wre.6 for ; Wed, 18 Jul 2018 17:20:57 -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=AOx5mFvzR2BziPmWj3OaaLbngxh7aFUjx7l4gYwAVXk=; b=JNUCJeVsIQrrgBfAYV53xxUAzDrO5rs5syRvu5iYf/wIFEDCXWtXf++FPL+vxxCkol 0PwkbDuGkQM5N1E1SQXm7F6x5cxh3tvYXzdmM6NvoD8u6fWOQDJpDyMS17XO0WBnsqRN pwyufmEYz4tIS6NNRVLsE8AnhAkak5/Nu/O5Groxq/HTwe0W0OjwZOwbGcHCu0ZErJT1 brxUAMvO7qdZKYN4O9N9+xRF7cmGArhnDv0rlbwbM9YTuShFFbv9tw9uPrWXbuUmIEG2 j8WsRaIp1D3BoHjSsqyX2+oNKKXHGzHCd1lt2AsJC+q2cdfHAyzBQNbs5Za4hBiJxLMJ 9WNg== X-Gm-Message-State: AOUpUlEENt/a2Qfch8yq3Ies/i/Pjd31pupDShiuIsEit4yzimuNESG/ 2E5FzHhXUad2dCdMmCo2pmjukRQJ X-Google-Smtp-Source: AAOMgpfDdYdoED51bzXgTD6vsGVTdHQ7QSnNXxGRceTI5pidtybMuurbcNozDdjbaeY1rS+mcESB6Q== X-Received: by 2002:adf:ec41:: with SMTP id w1-v6mr5728103wrn.128.1531959655746; Wed, 18 Jul 2018 17:20:55 -0700 (PDT) Received: from haneenDRM ([188.50.2.36]) by smtp.gmail.com with ESMTPSA id q140-v6sm4936965wmb.35.2018.07.18.17.20.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Jul 2018 17:20:55 -0700 (PDT) Date: Thu, 19 Jul 2018 03:20:51 +0300 From: Haneen Mohammed To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 3/5] drm/vkms: Add atomic_helper_check_plane_state Message-ID: <01c22c6ab38fbc66e52dd33267febfefbdd018f5.1531955948.git.hamohammed.sa@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Mailman-Approved-At: Thu, 19 Jul 2018 07:03:43 +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 aa6cde34710c..5b7c5d59f103 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) { @@ -59,6 +87,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, };