From patchwork Wed Nov 8 20:30:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10049195 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 43EBB6032D for ; Wed, 8 Nov 2017 20:30:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33F1C296A0 for ; Wed, 8 Nov 2017 20:30:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2674D297F6; Wed, 8 Nov 2017 20:30:19 +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 6324A296A0 for ; Wed, 8 Nov 2017 20:30:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB9B86E79F; Wed, 8 Nov 2017 20:30:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0D5486E79F for ; Wed, 8 Nov 2017 20:30:14 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id r68so17934842wmr.0 for ; Wed, 08 Nov 2017 12:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id; bh=tgazlybtcCw9Jp81d5fV/fBWBZw2ERA66ufvqk9yCf0=; b=E3ahmXIob4SDwTF5TyQlPyO9/1APgs3kSK2EfIvONrw8mGZp7aovNG2u09Yg3uDgF9 sPPVOZRWPU1rszdp6ljM1Nq13/wQzlqTVh0SkYztrHZ3znzqAt8DmRoiKm+xP6M+TSd2 ll2AVFZatSUh/PJDDmL0EvW/iij9QJnp9oSUs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tgazlybtcCw9Jp81d5fV/fBWBZw2ERA66ufvqk9yCf0=; b=FaIUpYh/tcjsk8Y3fy8UOA5RhXPh75lkBNGuwZU8h+PFPDTnHHSYr50se6qOKASdIJ CqUnHG4TWRcVzXEMkJPwhbjByE0gTXOez+KAwDzoGMgfNCZyae7Jai8eQac5tDAnbsTZ rYdpF7jWl7LsT4Ch1gkiPd1ouWgU5ZGKcosFtJFs+UKVSH0GdTjunghwzIHYySrJtJK9 8gPDNeLK9jvL8mgz4vVFvAIX1DLwJfLHQaUhseOztpRCdLygG2bfK8q7b8rK27BdthC8 uZ2oNhD+r7zUzVnJfPFYplY97xeBMxHotTVIhwGZTggkNXck7217eVueT5zIVjU5PACd rtVQ== X-Gm-Message-State: AJaThX6Ptbem61pKZilGG8jBiqnwJLFX4msEb8fGyh6x5g/q/U0hWqpb NnKwurTLohHJwxUx88b8VrKC/tqz X-Google-Smtp-Source: ABhQp+Q9KgqlB6OggTsNaCbkFoNUaRfA/Wdz9kgTf8KJuMP1YsraaWYNnOJ3kgk3W726Fnjrfu7ctQ== X-Received: by 10.80.184.10 with SMTP id j10mr2145268ede.160.1510173012884; Wed, 08 Nov 2017 12:30:12 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id w10sm4542355edj.11.2017.11.08.12.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Nov 2017 12:30:12 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH] drm: Update docs for legacy kms state Date: Wed, 8 Nov 2017 21:30:07 +0100 Message-Id: <20171108203007.12274-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.15.0 Cc: Manasi Navare , Daniel Vetter , Daniel Vetter 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 Point at the equivalent atomic state and explain that atomic drivers shouldn't really depend upon legacy state. Motivated by questions from Manasi about how this all is supposed to work. Cc: Manasi Navare Signed-off-by: Daniel Vetter Reviewed-by: Manasi Navare --- drivers/gpu/drm/drm_atomic_helper.c | 6 ++++++ include/drm/drm_connector.h | 9 +++++++-- include/drm/drm_encoder.h | 6 +++++- include/drm/drm_plane.h | 12 ++++++++++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index ea781d55f2c1..09512a64c336 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -907,6 +907,12 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) * * Drivers can use this for building their own atomic commit if they don't have * a pure helper-based modeset implementation. + * + * Since these updates are not synchronized with lockings, only code paths + * called from &drm_mode_config_helper_funcs.atomic_commit_tail can look at the + * legacy state filled out by this helper. Defacto this means this helper and + * the legacy state pointers are only really useful for transitioning an + * existing driver to the atomic world. */ void drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index b4285c40e1e4..bb6629b5c55c 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -699,7 +699,6 @@ struct drm_cmdline_mode { * @force: a DRM_FORCE_ state for forced mode sets * @override_edid: has the EDID been overwritten through debugfs for testing? * @encoder_ids: valid encoders for this connector - * @encoder: encoder driving this connector, if any * @eld: EDID-like data, if present * @latency_present: AV delay info from ELD, if found * @video_latency: video latency info from ELD, if found @@ -869,7 +868,13 @@ struct drm_connector { #define DRM_CONNECTOR_MAX_ENCODER 3 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; - struct drm_encoder *encoder; /* currently active encoder */ + /** + * @encoder: Currently bound encoder driving this connector, if any. + * Only really meaningful for non-atomic drivers. Atomic drivers should + * instead look at &drm_connector_state.best_encoder, and in case they + * need the CRTC driving this output, &drm_connector_state.crtc. + */ + struct drm_encoder *encoder; #define MAX_ELD_BYTES 128 /* EDID bits */ diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 86db0da8bdcb..67e1bccfb49d 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -88,7 +88,6 @@ struct drm_encoder_funcs { * @head: list management * @base: base KMS object * @name: human readable name, can be overwritten by the driver - * @crtc: currently bound CRTC * @bridge: bridge associated to the encoder * @funcs: control functions * @helper_private: mid-layer private data @@ -166,6 +165,11 @@ struct drm_encoder { */ uint32_t possible_clones; + /** + * @crtc: Currently bound CRTC, only really meaningful for non-atomic + * drivers. Atomic drivers should instead check + * &drm_connector_state.crtc. + */ struct drm_crtc *crtc; struct drm_bridge *bridge; const struct drm_encoder_funcs *funcs; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 069c4c8ce360..0efd38cd990b 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -474,8 +474,6 @@ enum drm_plane_type { * @format_types: array of formats supported by this plane * @format_count: number of formats supported * @format_default: driver hasn't supplied supported formats for the plane - * @crtc: currently bound CRTC - * @fb: currently bound fb * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by * drm_mode_set_config_internal() to implement correct refcounting. * @funcs: helper functions @@ -512,7 +510,17 @@ struct drm_plane { uint64_t *modifiers; unsigned int modifier_count; + /** + * @crtc: Currently bound CRTC, only really meaningful for non-atomic + * drivers. Atomic drivers should instead check &drm_plane_state.crtc. + */ struct drm_crtc *crtc; + + /** + * @fb: Currently bound framebuffer, only really meaningful for + * non-atomic drivers. Atomic drivers should instead check + * &drm_plane_state.fb. + */ struct drm_framebuffer *fb; struct drm_framebuffer *old_fb;