From patchwork Mon Jul 13 00:21:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hunter X-Patchwork-Id: 6773531 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5E2A7C05AC for ; Mon, 13 Jul 2015 00:21:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 415CE206A7 for ; Mon, 13 Jul 2015 00:21:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 14A5A20497 for ; Mon, 13 Jul 2015 00:21:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C2D36E077; Sun, 12 Jul 2015 17:21:49 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pku.edu.cn (mx24.pku.edu.cn [162.105.129.187]) by gabe.freedesktop.org (Postfix) with ESMTP id 1477B6E077 for ; Sun, 12 Jul 2015 17:21:46 -0700 (PDT) Received: from debian.localdomain (unknown [59.108.92.109]) by mailfront04 (Coremail) with SMTP id 9IFpogB3YtmXBKNVvXYiAA--.46982S2; Mon, 13 Jul 2015 08:21:43 +0800 (CST) From: John Hunter To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: add a drm_atomic_helper_plane_check_update Date: Mon, 13 Jul 2015 08:21:32 +0800 Message-Id: <1436746892-2614-1-git-send-email-zhjwpku@gmail.com> X-Mailer: git-send-email 1.7.10.4 X-CM-TRANSID: 9IFpogB3YtmXBKNVvXYiAA--.46982S2 X-Coremail-Antispam: 1UD129KBjvJXoWxArWUGrW8CFW7Wr1UXr4ruFg_yoW5Cw15pF ZrCF95Kw4Yqan7W3srGan2vw43Ga1fCa42gr97Grn0vF1UK3yfZ3ZYqry7ua17JrZrGw1f Jr12yr98ur1jkFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUk0b7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4 A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IE w4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMc vjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY02Avz4vE14v_twCF04k20xvY 0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I 0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij64vIr41lIxAI cVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcV CF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280 aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxUyrHjUUUUU X-CM-SenderInfo: p2km411nx6wzxdlohudrp/ Cc: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Zhao Junwang Cc: Daniel Vetter Signed-off-by: Zhao Junwang --- drivers/gpu/drm/drm_atomic_helper.c | 55 +++++++++++++++++++++++++++++++++++ include/drm/drm_atomic_helper.h | 7 +++++ 2 files changed, 62 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 536ae4d..3d94ff8 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1336,6 +1336,61 @@ void drm_atomic_helper_swap_state(struct drm_device *dev, EXPORT_SYMBOL(drm_atomic_helper_swap_state); /** + * drm_atomic_helper_plane_check_update + * @plane: plane object to update + * @state: drm plane state + * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point + * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point + * @can_position: is it legal to position the plane such that it + * doesn't cover the entire crtc? This will generally + * only be false for primary planes. + * @can_update_disabled: can the plane be updated while the crtc + * is disabled? + * + * Provide a default plane check update handler + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_helper_plane_check_update(struct drm_plane *plane, + struct drm_plane_state *state, + int min_scale, + int max_scale, + bool can_position, + bool can_update_disabled, + bool *visible) +{ + struct drm_crtc *crtc = state->crtc; + struct drm_framebuffer *fb = state->fb; + + if (!fb) + return 0; + + struct drm_rect src = { + .x1 = state->src_x, + .y1 = state->src_y, + .x2 = state->src_x + state->src_w, + .y2 = state->src_y + state->src_h, + }; + struct drm_rect dest = { + .x1 = state->crtc_x, + .y1 = state->crtc_y, + .x2 = state->crtc_x + state->crtc_w, + .y2 = state->crtc_y + state->crtc_h, + }; + const struct drm_rect clip = { + .x2 = crtc->mode.hdisplay, + .y2 = crtc->mode.vdisplay, + }; + + return drm_plane_helper_check_update(plane, crtc, fb, + &src, &dest, &clip, + min_scale, max_scale, + can_position, can_update_disabled, visible); +} +EXPORT_SYMBOL(drm_atomic_helper_plane_check_update); + +/** * drm_atomic_helper_update_plane - Helper for primary plane update using atomic * @plane: plane object to update * @crtc: owning CRTC of owning plane diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index cc1fee8..5305a01 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -64,6 +64,13 @@ void drm_atomic_helper_swap_state(struct drm_device *dev, struct drm_atomic_state *state); /* implementations for legacy interfaces */ +int drm_atomic_helper_plane_check_update(struct drm_plane *plane, + struct drm_plane_state *state, + int min_scale, + int max_scale, + bool can_position, + bool can_update_disabled, + bool *visible); int drm_atomic_helper_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb,