Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2928821rwb; Mon, 15 Aug 2022 14:14:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR4fbRilmgbjyuBTTDU9GUSDcKtk6g9K5b2uljlPDE6wldOwJ676BzpFOVdyERPLBMag+dym X-Received: by 2002:aa7:96d5:0:b0:52e:e2a:9c79 with SMTP id h21-20020aa796d5000000b0052e0e2a9c79mr18167483pfq.55.1660598067747; Mon, 15 Aug 2022 14:14:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598067; cv=none; d=google.com; s=arc-20160816; b=ozoH80DEgQNfPrFroAXXzgzMa0Z5itlrHRhelr3DlJNMbKiMp2LQp/4jY+Zx+3GLXP 2W7PE3TcrLY1ZZBhE3bdH3A24X9GfEVj6Cfh9g3/gABin8qgqAuoOY3MdCkfCdQaS5hq XaviLn/IeZofSIy0FHKC4e61XF6CxZwCvbSTPueCaxNHEFrNFUcHQB+AI5zWgBuQYE8G 2uybqmMODablHIQH2pEZ5I8AMGnWxy3FR2suXSquG2ZfDfY0+s4XgiHGXQ+nKRw7X14R fkjWOo4WnV1+HomzD4Dsea/9UBPw+BLKf7Ha5DEW0GfqKll9GawD1QT6FThl7GhIVZ3C zWiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v9kceYq0kHYoy8/+dFFTtlPInRyBO4q7+aiDDxeDLmk=; b=DitmdNIXdINGYY3agO8+/wDRbB42rdzncDTQwz2rPtwMLpz55H/VWb1KFzOyyaYWip hUk6Yqx/pntCes9IdEqu4CgqvbP8RoTnGIC157ryxCBQ+KLHW2RVf0iREreVs8nz2XQy 72XZTLdo4qVPRv6u2HiLuz6F32KLk87I3sPXtK3PF7gV4HnK6Mu7yPOiXkCfgjq97+x1 KCVH0TWQhoyrqtyCQvOJP/Til+si39+DG2gGVLu6jPDTOrgxS5+C+kMWjKIbxAeXrasI ABuGUmehKqmQyHoiLqTWepMk39AVYcv7YyUwqEH9GpO2IcPbgs7zx/Y4GbNEr1jlzy4W ZuDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YKAppNgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i6-20020a635406000000b0041bd09a9c1dsi11581966pgb.536.2022.08.15.14.14.15; Mon, 15 Aug 2022 14:14:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YKAppNgk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241163AbiHOVEL (ORCPT + 99 others); Mon, 15 Aug 2022 17:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347471AbiHOVB7 (ORCPT ); Mon, 15 Aug 2022 17:01:59 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07AC7C993B; Mon, 15 Aug 2022 12:13:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 32EFBCE1262; Mon, 15 Aug 2022 19:13:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2603BC433B5; Mon, 15 Aug 2022 19:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590829; bh=DuodYeglwcyYUVWH7MhHNAR31lBBl3gMZdqVDqjhWOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YKAppNgkVDSngJjhKoAEvS2F10YqXYYe9QDs6nSo32ddHg779QmsNQk4b65GNOqep YlELcdvCyM38sJNCr9ICBMapQtAFRnnkBYNQWi2hgUVQT4X4XFvO5XDNY2lqYfR82C nIRN0KmPAkoZES9poNuYHw8sQGgSAy3CGj6+DTGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dom Cobley , Maxime Ripard , Sasha Levin Subject: [PATCH 5.18 0384/1095] drm/vc4: plane: Remove subpixel positioning check Date: Mon, 15 Aug 2022 19:56:23 +0200 Message-Id: <20220815180445.569159390@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dom Cobley [ Upstream commit 517db1ab1566dba3093dbdb8de4263ba4aa66416 ] There is little harm in ignoring fractional coordinates (they just get truncated). Without this: modetest -M vc4 -F tiles,gradient -s 32:1920x1080-60 -P89@74:1920x1080*.1.1@XR24 is rejected. We have the same issue in Kodi when trying to use zoom options on video. Note: even if all coordinates are fully integer. e.g. src:[0,0,1920,1080] dest:[-10,-10,1940,1100] it will still get rejected as drm_atomic_helper_check_plane_state uses drm_rect_clip_scaled which transforms this to fractional src coords Fixes: 21af94cf1a4c ("drm/vc4: Add support for scaling of display planes.") Signed-off-by: Dom Cobley Link: https://lore.kernel.org/r/20220613144800.326124-5-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_plane.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 920a9eefe426..c2c33f200416 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -339,7 +339,6 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) struct vc4_plane_state *vc4_state = to_vc4_plane_state(state); struct drm_framebuffer *fb = state->fb; struct drm_gem_cma_object *bo = drm_fb_cma_get_gem_obj(fb, 0); - u32 subpixel_src_mask = (1 << 16) - 1; int num_planes = fb->format->num_planes; struct drm_crtc_state *crtc_state; u32 h_subsample = fb->format->hsub; @@ -361,18 +360,15 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) for (i = 0; i < num_planes; i++) vc4_state->offsets[i] = bo->paddr + fb->offsets[i]; - /* We don't support subpixel source positioning for scaling. */ - if ((state->src.x1 & subpixel_src_mask) || - (state->src.x2 & subpixel_src_mask) || - (state->src.y1 & subpixel_src_mask) || - (state->src.y2 & subpixel_src_mask)) { - return -EINVAL; - } - - vc4_state->src_x = state->src.x1 >> 16; - vc4_state->src_y = state->src.y1 >> 16; - vc4_state->src_w[0] = (state->src.x2 - state->src.x1) >> 16; - vc4_state->src_h[0] = (state->src.y2 - state->src.y1) >> 16; + /* + * We don't support subpixel source positioning for scaling, + * but fractional coordinates can be generated by clipping + * so just round for now + */ + vc4_state->src_x = DIV_ROUND_CLOSEST(state->src.x1, 1 << 16); + vc4_state->src_y = DIV_ROUND_CLOSEST(state->src.y1, 1 << 16); + vc4_state->src_w[0] = DIV_ROUND_CLOSEST(state->src.x2, 1 << 16) - vc4_state->src_x; + vc4_state->src_h[0] = DIV_ROUND_CLOSEST(state->src.y2, 1 << 16) - vc4_state->src_y; vc4_state->crtc_x = state->dst.x1; vc4_state->crtc_y = state->dst.y1; -- 2.35.1