Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2924208rwb; Mon, 15 Aug 2022 14:09:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5EavxxkNwAwfUCgSl1NixuFb9ZH1ODsX3jJJoFEapWfMUoxao227ZaIV8VPdjSdFzylxze X-Received: by 2002:a17:906:98c9:b0:730:a23e:2785 with SMTP id zd9-20020a17090698c900b00730a23e2785mr11507812ejb.622.1660597748673; Mon, 15 Aug 2022 14:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597748; cv=none; d=google.com; s=arc-20160816; b=a2EWB5ufcbr5sU00Sw+Y2H5qwH7HZPwztFN/sHLPVQMyUlFXSFlQcSWjUNc9i53pNs 0nXg9ig/tr2EjoA1/+OLJPlqCi/wF9QuO5A7pMJT4EoEcBw5VlFO5UaCjcR33cq/BRoE B7vOzROzzwZHO4nBo3SfQ9OEjyVHbVnqveoLI0FLEcRz+Pl8LG7Ywv7+qQe6+CRb0ZpK Vrh4G1Ne5jq4vVrB5pltRrVuWi9dcElyJ2qU3mZ4NFZR8yPy87l96RkAMhE/Jb5WTUQv +qPcHlKTTiXqoj4/6I+AnKBBHdeHxdFb/ahQVEd7kEiUhMFTWXP3rYpgYNmhmMjL1DEN BDFQ== 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=lhKm71IWJoCPw2mcKvXSnnJbDx8Q2ySyFNbsuxXxh6s=; b=AcybOY+K5sZ7z+DXNxbnOkw19zJi2lYnMGfZ/coKXwryBguUq7+uZQURt1FkAYPFKK h5hQZznHWN0GlNMOqX6yCwhU/L8ViUt5WSZloH6FjgpsPJit9JFY2x7A5XG8jxo46b7k 9BLpQEqIimKZfp7+L3X4ptqOmVdwvXfFuWOwWdTHsrXuaFG8MofhHtMGKxIW4gBZMOWM QNxPxQ/nmmUTk1khEYWj4t0eKXJQIFat3AJJZxIMJ+ohh5nJ7WmNlLQ6r2Zi/insdL3K E/RaeVC26BQbkPHZWf6tIAFtP6mbEdJj2eY1Or0jxKGMnmuea9wQTay9pOuKRpfak8k8 IIHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pqQhw0Xc; 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 z6-20020a05640235c600b0043bb87a322csi9453505edc.52.2022.08.15.14.08.41; Mon, 15 Aug 2022 14:09:08 -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=pqQhw0Xc; 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 S242660AbiHOS5g (ORCPT + 99 others); Mon, 15 Aug 2022 14:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244398AbiHOSxj (ORCPT ); Mon, 15 Aug 2022 14:53:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62937B37; Mon, 15 Aug 2022 11:30:01 -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 ams.source.kernel.org (Postfix) with ESMTPS id 35DB3B81072; Mon, 15 Aug 2022 18:29:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D141C433C1; Mon, 15 Aug 2022 18:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588197; bh=Djxr4Q9PARgu7k/PygHtmesCsyE/lk+cgw4S9PN9t1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pqQhw0XcFeQN4NaL2hehM7eW5GOad3eEOxWIsD7WGrss2yz7WQxAHZ9SzhLf36oai Ncp07PURco8NGsx937EGxRKzvLa5O2Kbt8cQNFokiE8pLC8tvk4YSZ7u46JsDnq2eX 5Fi59Ri2FlhbOveyVKouogSTw/6O0x88aTZnzk/0= 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.15 294/779] drm/vc4: plane: Remove subpixel positioning check Date: Mon, 15 Aug 2022 19:58:58 +0200 Message-Id: <20220815180349.858620981@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 19161b6ab27f..e9d214d42cc7 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -332,7 +332,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; @@ -354,18 +353,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