From patchwork Wed Feb 7 22:44:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Deepak Singh Rawat X-Patchwork-Id: 10206259 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 77279602D8 for ; Wed, 7 Feb 2018 22:44:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FE0028639 for ; Wed, 7 Feb 2018 22:44:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5444728FE0; Wed, 7 Feb 2018 22:44:50 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 9607C28FA0 for ; Wed, 7 Feb 2018 22:44:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C471A89267; Wed, 7 Feb 2018 22:44:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0080.outbound.protection.outlook.com [104.47.40.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E36789267 for ; Wed, 7 Feb 2018 22:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dLLjVNPv9ayuzn1oPxX0E/5AealFNZZ2ALSOoNS1ODw=; b=iMtOeJXwsvjhRVZRo89pMonlxphNvyo7vAsFjWsSM/BPCzWsia/kLk1O2cleW/6jL9bZQHhHduhTHfVotDs/710zlqEOPNDVlWX5pVJDU/PQmiHjhG5eZcUEviKumcgzXaUUD1fEKsIkCkDjBxEMm8MBFiwr46Y/7DQbkwty15U= Received: from MWHPR05MB3117.namprd05.prod.outlook.com (10.173.229.7) by MWHPR05MB3183.namprd05.prod.outlook.com (10.173.229.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.3; Wed, 7 Feb 2018 22:44:45 +0000 Received: from MWHPR05MB3117.namprd05.prod.outlook.com ([10.173.229.7]) by MWHPR05MB3117.namprd05.prod.outlook.com ([10.173.229.7]) with mapi id 15.20.0485.009; Wed, 7 Feb 2018 22:44:45 +0000 From: Deepak Singh Rawat To: Lukasz Spintzyk Subject: RE: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane Thread-Topic: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane Thread-Index: AQHTek1L/s61sXzTT06hu5XHxD7O26NYgLkAgAtRToCANgJjAA== Date: Wed, 7 Feb 2018 22:44:44 +0000 Message-ID: References: <20171221111008.38764-1-lukasz.spintzyk@displaylink.com> <20171221111008.38764-2-lukasz.spintzyk@displaylink.com> <213d47ff-9cc2-5223-aad9-caa6ffbdc62a@displaylink.com> In-Reply-To: <213d47ff-9cc2-5223-aad9-caa6ffbdc62a@displaylink.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=drawat@vmware.com; x-originating-ip: [208.91.1.34] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR05MB3183; 7:jM1x/+6RNaRnL1QO4ziH5VyBfmeJ0v7Xb9+0wBnokyDOh55xLsU8UR4gpKICqxwTh9/Zrrti7/hKxyARAcP08wVphg9oPn4mW13e5d0nSYnZH5c2yGj1ZW1+1aTBITgfir6+6xoAqaGl7T7OF/mmYnG8gKH/9m82WkxSbd2O/BeKBcyLoHZtJxaMWR0xbU7HsKn8bEGLUWiYax+58LwOfF5MmGtOkVT2566QfpW4Qdx3lW5L/TDu9Mzn+FY5p+f1; 20:JOE3gNeCMdX+TxgdIngymutKty3W0tv3FhELLzXFsfB6KJD6rPfrSjOTv6pAM3ngkcBE8KOjLNpMwyNZo5ZjRLdzEfWGpELserUJXml6wpBTisK2SNXVTBahtKde5NEuaSd8LutA5itc+5QL2ONPZKgjmqx7a92RwXawBYdLaiE= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 89ee482d-4f61-41d5-2409-08d56e7c627f x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:MWHPR05MB3183; x-ms-traffictypediagnostic: MWHPR05MB3183: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(61668805478150)(217544274631240)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231101)(2400082)(944501161)(6041288)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR05MB3183; BCL:0; PCL:0; RULEID:; SRVR:MWHPR05MB3183; x-forefront-prvs: 0576145E86 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(366004)(376002)(39380400002)(39860400002)(396003)(189003)(199004)(6116002)(3846002)(76176011)(5660300001)(68736007)(26005)(5890100001)(186003)(54906003)(316002)(102836004)(6916009)(2906002)(2950100002)(59450400001)(53546011)(6506007)(93886005)(575784001)(86362001)(77096007)(14454004)(81166006)(229853002)(2900100001)(99286004)(4326008)(3660700001)(55016002)(7696005)(81156014)(106356001)(97736004)(6246003)(66066001)(478600001)(8676002)(8936002)(33656002)(7736002)(9686003)(25786009)(305945005)(561944003)(3280700002)(74316002)(105586002)(6436002)(53936002)(14143004); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR05MB3183; H:MWHPR05MB3117.namprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: mUMmMOqq3xeiFrES53XhXtMX4SDu/ZKkfF1AoYe+VEMdWxgONHabykHyjds/A5hfmW646uRr/ZtbC3hC5VDm+w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89ee482d-4f61-41d5-2409-08d56e7c627f X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Feb 2018 22:44:44.8105 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR05MB3183 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: "airlied@linux.ie" , "dri-devel@lists.freedesktop.org" , "daniel.vetter@intel.com" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi Lukasz, I hope you are doing great. I was busy with some other stuff but now will be working on page-flip damage. At this point I have high level understanding of what changes to make and before I start just wanted to confirm from you, whether you have made any progress to avoid duplicate work. Thanks, Deepak From: Lukasz Spintzyk [mailto:lukasz.spintzyk@displaylink.com] Sent: Thursday, January 4, 2018 5:53 AM To: Thomas Hellstrom ; dri-devel@lists.freedesktop.org; daniel.vetter@intel.com; gustavo@padovan.org; seanpaul@chromium.org; airlied@linux.ie; Deepak Singh Rawat Subject: Re: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane On 28/12/2017 10:03, Thomas Hellstrom wrote: Hi, Lukasz! (Sorry for top-posting). We have Deepak from our team working on the same subject. I think he's in over the holidays so I'll add him to the CC list. Great! Adding damage to the plane state is, IMO the correct way to do it. However, from your proposal it's not clear whether damage is given in the plane-, crtc- or framebuffer coordinates. The last conclusion from our email thread discussion was that they should be given in framebuffer coordinates with helpers to compute plane coordinates or crtc coordinates. The reason being that it's easier for user-space apps to send damage that way, and again, we have the full information that we can clip and scale if necessary. Most drivers probably want the damage in clipped plane- or crtc coordinates. Helpers could for example be in the form of region iterators. Personally i don't know the difference between plane rects and framebuffer rects. I don't know what would be better. I was thinking about coordinates of framebuffer that is attached to drm_plane_state. Full (multi-rect) damage regions are OK with us, although we should keep in mind that we won't be able to compute region unions in the kernel (yet?). Implying: Should we forbid overlapping rects at the interface level or should we just recommend rects not to be overlapping? The former would be pretty hard to enforce efficiently. I would be for recommendation. We can add some helper functions to combine rects and set some limits on number of rects to prevent abuse of that interface. Another thing we should think about is how to use this interface for the legacy "dirtyfb" call. Probably we need to clear the damage property on each state-update, or set a flag that "this is a dirtyfb state update". IMO we should also have as an end goal of this work to have gnome-shell on drm sending damage regions on page-flip, which means either porting gnome-shell to atomic or set up a new legacy page-flip-with-atomic ioctl. Can't we reuse dirtyfb ioctl for this purpose? It would be called before page_flip ioctl? /Thomas On 12/21/2017 12:10 PM, Lukasz Spintzyk wrote: Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk mailto:lukasz.spintzyk@displaylink.com ---   drivers/gpu/drm/drm_atomic.c      | 10 ++++++++++   drivers/gpu/drm/drm_mode_config.c |  6 ++++++   drivers/gpu/drm/drm_plane.c       |  1 +   include/drm/drm_mode_config.h     |  5 +++++   include/drm/drm_plane.h           |  3 +++   5 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index b76d49218cf1..cd3b4ed7b04c 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -759,6 +759,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,           state->rotation = val;       } else if (property == plane->zpos_property) {           state->zpos = val; +    } else if (property == config->dirty_rects_property) { +        bool replaced = false; +        int ret = drm_atomic_replace_property_blob_from_id(dev, +                    &state->dirty_blob, +                    val, +                    -1, +                    &replaced); +        return ret;       } else if (plane->funcs->atomic_set_property) {           return plane->funcs->atomic_set_property(plane, state,                   property, val); @@ -818,6 +826,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,           *val = state->rotation;       } else if (property == plane->zpos_property) {           *val = state->zpos; +    } else if (property == config->dirty_rects_property) { +        *val = (state->dirty_blob) ? state->dirty_blob->base.id : 0;       } else if (plane->funcs->atomic_get_property) {           return plane->funcs->atomic_get_property(plane, state, property, val);       } else { diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index bc5c46306b3d..d5f1021c6ece 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -293,6 +293,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)           return -ENOMEM;       dev->mode_config.prop_crtc_id = prop;   +    prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, +            "DIRTY_RECTS", 0); +    if (!prop) +        return -ENOMEM; +    dev->mode_config.dirty_rects_property = prop; +       prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC,               "ACTIVE");       if (!prop) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 37a93cdffb4a..add110f025e5 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -258,6 +258,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,           drm_object_attach_property(&plane->base, config->prop_src_y, 0);           drm_object_attach_property(&plane->base, config->prop_src_w, 0);           drm_object_attach_property(&plane->base, config->prop_src_h, 0); +        drm_object_attach_property(&plane->base, config->dirty_rects_property, 0);       }         if (config->allow_fb_modifiers) diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index e5f3b43014e1..65f64eb04c0c 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -599,6 +599,11 @@ struct drm_mode_config {        * &drm_crtc.        */       struct drm_property *prop_crtc_id; +    /** +     * @dirty_rects_property: Optional plane property to mark damaged +     * regions on the plane framebuffer. +     */ +    struct drm_property *dirty_rects_property;       /**        * @prop_active: Default atomic CRTC property to control the active        * state, which is the simplified implementation for DPMS in atomic diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 8185e3468a23..7d45b164ccce 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -131,6 +131,9 @@ struct drm_plane_state {        */       struct drm_crtc_commit *commit;   +    /* Optional blob property with damaged regions. */ +    struct drm_property_blob *dirty_blob; +       struct drm_atomic_state *state;   };