Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1584554rdb; Thu, 7 Dec 2023 03:32:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZTTVTCid0HOWJKXyPI2xmb/rtbCKLKJdhGWTSMZq9HJypbHbS8eONZMpdgLlvYlmb3eZD X-Received: by 2002:a17:902:bcc5:b0:1cf:e19e:2505 with SMTP id o5-20020a170902bcc500b001cfe19e2505mr1777642pls.61.1701948722799; Thu, 07 Dec 2023 03:32:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701948722; cv=none; d=google.com; s=arc-20160816; b=Xp713k3AOyiBe+glTx6wmrmmM4g234Fi+DO3VR1xJK8fN9mdUKy63yiVIx/0Z3YrtS Zf7SA3v8hKz63SET/i2gdQzrWiJE7l4KylMrGcQcm6at6vNx8zNAJJ91futyeVrEhJ9q sjG+8O9SylECaZs8ClXKyTAJkp41TIEntwAXEM/5rAiztQH4rMEbpfAyDah3PC9uqtN5 mK/Jhw1MAazXkbEg3Ra527ODw943laHekZCw8dKxg1KIGpWHlLnN/bc9Q0TuOycoweTX FuBgdZVaIxBSjde5QCiuGUKhPYDi80dqkmxmANJidAlvDsAep8+T6MgN7JqpVX1sSavJ kSuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=dChq9vZrd4EUDhu3XlEWOOmVnt7a3ihdS8U7PDjHjq4=; fh=DwkReeMZ7h1Wss0MCnr0mq4X4QZyd0+YJb6gV2h9bvk=; b=skC9fY30x0Yz1NG+CHRziLDf92LIu4+/QgEF/xaRgM7rjQkuZzmC21vpfIA6QA0ox6 6KPPoa/BcF/ctPoYTbiDSzuKSfl6dApunT7hELL9m9vBElb7uR5KJKg6IDIw1xACpdnG dnHfB6bqiqJ4Y8f/82+w2d9WRae6Ny9JGPB980LaCjpBp/ZDhiTKns5r8ElPUg81QSzf 12ruG/OLySKWpsCD0GcyBdPknMnfMSzhjTFz+8oiEO32h3VNkZw9hxjyjNTr8EXz1FzG 7Dlx82thsITgyRCAZ5HUR3pa2eLxfyQKBCTKaGPXeOQklvUbQP1R2sG5e9EOZGsbrwun fdmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id ji13-20020a170903324d00b001cffca2854dsi965822plb.309.2023.12.07.03.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:32:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 9D90980C1C2F; Thu, 7 Dec 2023 03:31:59 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232418AbjLGLbm convert rfc822-to-8bit (ORCPT + 99 others); Thu, 7 Dec 2023 06:31:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbjLGLbl (ORCPT ); Thu, 7 Dec 2023 06:31:41 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 666DDA3; Thu, 7 Dec 2023 03:31:46 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 9F85524E317; Thu, 7 Dec 2023 19:31:44 +0800 (CST) Received: from EXMBX061.cuchost.com (172.16.6.61) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 7 Dec 2023 19:31:44 +0800 Received: from [192.168.60.132] (180.164.60.184) by EXMBX061.cuchost.com (172.16.6.61) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 7 Dec 2023 19:31:46 +0800 Message-ID: <580e13ab-a73e-4ce7-999a-8a8685faf2dd@starfivetech.com> Date: Thu, 7 Dec 2023 19:31:43 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [v3 4/6] drm/vs: Add KMS crtc&plane Content-Language: en-US To: Icenowy Zheng , "devicetree@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "linux-riscv@lists.infradead.org" CC: "aou@eecs.berkeley.edu" , "suijingfeng@loongson.cn" , "tzimmermann@suse.de" , "paul.walmsley@sifive.com" , "mripard@kernel.org" , Xingyu Wu , Jack Zhu , "palmer@dabbelt.com" , "krzysztof.kozlowski+dt@linaro.org" , William Qiu , Shengyang Chen , Changhuang Liang References: <20231204123315.28456-1-keith.zhao@starfivetech.com> <20231204123315.28456-5-keith.zhao@starfivetech.com> <7acd5af8fd4c5bf6ee0614f72cf6cb6751c89dc3.camel@icenowy.me> From: Keith Zhao In-Reply-To: <7acd5af8fd4c5bf6ee0614f72cf6cb6751c89dc3.camel@icenowy.me> Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [180.164.60.184] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX061.cuchost.com (172.16.6.61) X-YovoleRuleAgent: yovoleflag Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 07 Dec 2023 03:32:00 -0800 (PST) On 2023/12/7 16:41, Icenowy Zheng wrote: > 在 2023-12-04星期一的 20:33 +0800,Keith Zhao写道: > *snip* > >> +static void update_cursor_plane(struct vs_dc *dc, struct vs_plane >> *plane, >> +                               struct drm_plane *drm_plane, >> +                               struct drm_atomic_state *drm_state) >> +{ >> +       struct drm_plane_state *state = >> drm_atomic_get_new_plane_state(drm_state, >> +                                                                     >>   drm_plane); >> +       struct vs_plane_state *plane_state = >> to_vs_plane_state(state); >> +       struct drm_framebuffer *drm_fb = state->fb; >> +       struct dc_hw_cursor cursor; >> + >> +       cursor.address = plane_state->dma_addr[0]; >> +       cursor.x = state->crtc_x; >> +       cursor.y = state->crtc_y; > > From my experiments on poking with registers on T-Head TH1520 (also > uses DC8200 display controller and a similar driver), the DC8200 > hardware have a different definition of cursor position X and Y with > the CRTC plane state. > > For CRTC plane state, hot_x and hot_y are only provided as reference, > and the cursor should be displayed with its (0,0) drawn to (crtc_x, > crtc_y) ([XY]_crtc are values specified in CRTC state, the right part > of the assignments here), when the cursor is moved to (0,0) but the hot > point is not (0,0), it could be negative. > > However, for DC8200 registers definition, cursor XY position could not > be negative -- the cursor will disappear then; because in its > definition, the cursor XY position should be where the cursor is > pointing to, instead of its (0,0). DC8200 will draw (0,0) of the cursor > to (x - hot_x, y - hot_y). So to met the expectation of the KMS plane > settings, the DC8200 position should be set to (crtc_x + hot_x, crtc_y > + hot_y) instead. Thus these two lines of code should be: > > ``` > cursor.x = state->crtc_x + drm_fb->hot_x; > cursor.y = state->crtc_y + drm_fb->hot_y; > ``` > > >> +       cursor.hot_x = drm_fb->hot_x; >> +       cursor.hot_y = drm_fb->hot_y; >> +       cursor.display_id = to_vs_display_id(dc, state->crtc); >> +       update_cursor_size(state, &cursor); >> +       cursor.enable = true; >> + >> +       dc_hw_update_cursor(&dc->hw, cursor.display_id, &cursor); >> +} > *snip hello Icenowy: you are deep understanding on dc8200. by the way of practice I tested this change on the debian desktop, is there a way to compare the cursor behavior change? Thanks