From patchwork Thu Dec 21 11:10:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Spintzyk X-Patchwork-Id: 10127481 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 A4B2A60390 for ; Thu, 21 Dec 2017 11:17:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FD4C29B38 for ; Thu, 21 Dec 2017 11:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82F3A29BCF; Thu, 21 Dec 2017 11:17:27 +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, UNPARSEABLE_RELAY 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 549F529B38 for ; Thu, 21 Dec 2017 11:17:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 58FD489C25; Thu, 21 Dec 2017 11:17:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from eu-smtp-delivery-167.mimecast.com (eu-smtp-delivery-167.mimecast.com [146.101.78.167]) by gabe.freedesktop.org (Postfix) with ESMTPS id BB0016E60A for ; Thu, 21 Dec 2017 11:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=displaylink.com; s=mimecast20151025; t=1513855042; h=from:subject:date:message-id:to:cc:content-type:content-transfer-encoding:in-reply-to:references; bh=qUaZ8xa7RnJZvQs0XEQx2TECaaSxzQqtSKkLzFp6Jx8=; b=wVrQyplW0u8CMjavoHpZSv4en4n11V1uZUsnTjQokm9y+WwmYshij/qVrf/2gaWuzOcZCiTpyMUrr0Gd2qOkbJHH32nMQzS0xK6Kqbf3UL0CIhmBxMYs2/d1c51HOZ6GmKbKM6oSA0Qw4Qq3u22emF9RMR01PJGWmpKCTAU3/o0= Received: from s1.displaylink.com (s1.displaylink.com [209.62.42.10]) (Using TLS) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-19-t_Yt-iM2PZeCN0qQRyGsMQ-1; Thu, 21 Dec 2017 11:11:09 +0000 Received: from treeuser (helo=ceres.pl.displaylink.com) by s1.displaylink.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.85) (envelope-from ) id 1eRykk-00011p-6h; Thu, 21 Dec 2017 05:11:06 -0600 Received: from cbs.pl.displaylink.com ([192.168.48.208]) by ceres.pl.displaylink.com with esmtp (Exim 4.63) (envelope-from ) id 1eRyki-0004DH-My; Thu, 21 Dec 2017 12:11:04 +0100 Received: from cbs.pl.displaylink.com (localhost [127.0.0.1]) by cbs.pl.displaylink.com (8.15.2/8.15.2/Debian-3) with ESMTP id vBLBB4xd043749; Thu, 21 Dec 2017 12:11:04 +0100 Received: (from lspintzyk@localhost) by cbs.pl.displaylink.com (8.15.2/8.15.2/Submit) id vBLBB4B9043748; Thu, 21 Dec 2017 12:11:04 +0100 From: Lukasz Spintzyk To: dri-devel@lists.freedesktop.org, daniel.vetter@intel.com, gustavo@padovan.org, seanpaul@chromium.org, airlied@linux.ie Subject: [PATCH 1/1] drm: Add dirty_rects atomic blob property for drm_plane Date: Thu, 21 Dec 2017 12:10:08 +0100 Message-Id: <20171221111008.38764-2-lukasz.spintzyk@displaylink.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171221111008.38764-1-lukasz.spintzyk@displaylink.com> References: <20171221111008.38764-1-lukasz.spintzyk@displaylink.com> X-Legal-UK: DisplayLink (UK) Limited. Registered in England No. 04811048. Mount Pleasant House, Mount Pleasant, Cambridge, CB3 0RN, United Kingdom. X-Legal-US: DisplayLink Corp. A US incorporated company. 480 S. California Avenue Ste 304, Palo Alto, CA 94306, USA. X-MC-Unique: t_Yt-iM2PZeCN0qQRyGsMQ-1 Cc: Lukasz Spintzyk 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-Virus-Scanned: ClamAV using ClamSMTP Change-Id: I63dce004f8d3c5dc6a7c71070f1fab0707286ea5 Signed-off-by: Lukasz Spintzyk --- 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; };