From patchwork Wed Dec 15 16:08:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 524282 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp500448imb; Wed, 15 Dec 2021 08:08:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLBKFGkkpOLkPjW4jxAKP5Wt/yfcvxYVwYh/OMy7SnW0X5xqQ5gKhipmPdWbNsDRI86jBb X-Received: by 2002:a17:90a:c245:: with SMTP id d5mr462806pjx.243.1639584523592; Wed, 15 Dec 2021 08:08:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639584523; cv=none; d=google.com; s=arc-20160816; b=w2eDY+r0HGW/q9eK+d68kzf5CKshnhcquoY8u19/AeVLaql/SCUX7ACz8yVgpll/xd brrIH8A0yTWpwkfU1APgxBUAdDGvhznQ61Q8FYGW/qLnq/QhMaBvvIcHpEUDdPoskYlX HO9+5FOKtQUjyTRe9VZ8IhE1dnNQmY6Q2ZWw91fZY8Qds64tGuWJnmK9VVDgtfDfvEZ9 AKQmQFyl75wTcW7PaGR89D4pjs6cmo8nAtbzcZ/A/+s9DcorhP/3OSkMfsljmLZHT8Cz zrnRWleTuFdjeXIefYImBK6m1edKMoiPSpWe7C75+LMJPoUqmFWlLsc6qBOwkW55lyB/ 71Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :delivered-to; bh=WbNOymkxPgOISMLjCM1mOH833jOukyVPwJbK13caKsE=; b=s29h2Jhe4+z/gUuv+zE/BZxA/LfMJIhdqMoSk7ugPnS9n/XqzRSrsF9O2PC16a24qK YCSFRKvnfZ0cvjh+MKV1X2LDGKZYUbj4q2GY8VQWq7m7+WTs/PvFMSIqUQb+f8xWEGY8 h2I4qI1ttTYPDfuq4t8swqbG2q6W22cQuBnQ8pZlIpPrSzCw8Lpo0tyfOoJhWqw3RIyC SlZ9akwnU53781lMK6t5r8KQgXXVzQR0F3TMtp58NOvEJdHgh+6J5lO+gHqp0hBePUXn WY0iE5StUSK/b4WKPPzp37wIuHpD0N5mGK44bBG0nsTFsRu3cTs7KXP8QPgJf0FKUs3t 9Avw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jHlH0lNj; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id g8si2167239pfh.226.2021.12.15.08.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 08:08:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jHlH0lNj; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAFA710EE31; Wed, 15 Dec 2021 16:08:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 50A7C10EE30 for ; Wed, 15 Dec 2021 16:08:41 +0000 (UTC) Received: by mail-lf1-x12b.google.com with SMTP id c32so44182165lfv.4 for ; Wed, 15 Dec 2021 08:08:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WbNOymkxPgOISMLjCM1mOH833jOukyVPwJbK13caKsE=; b=jHlH0lNjWxm39Qj1B/jg6NvGQZICh/cnC5xXQGHPQCRzORYWC3sePAAnpqSL1OfcFL 5VSnu/xrCOETk5gBf7WAAnfCieVbAw7GW4f+T5zlxvPI47PT/caJAlyKDyN4AJUXnhOg 9px708pBCTNCGqfCWrHX1D8yoKWmDJAalrzJwEwS3eNyWjLh4wcoHkE5y/DbLS9Obx4H /X8c7Hd89c1zYqvEMUhF+kzrE3MhiEXPEliez2IF/gVA/jkB27DtumhJa0Wx4Dotpasq cpGVJnjQGqZLRiW6UojF4MK6SXB185o2jclT2lbmZ9Of+Sig1thF/coXyIDC42ObuI3B 0viw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WbNOymkxPgOISMLjCM1mOH833jOukyVPwJbK13caKsE=; b=Q7ny4SjIA1E7HM00VpSMlyhIgy48h8VDEQ+XuvNxi3AUgo+cwVOyIHkamzREMfbRHy T4W+0ecYH+r+U+vOX13gLTxEbMsr6cw3+IBBzgMWjCPrYdRBb30SGHIyIUQapviCEGBj ilyVoMR27TzCrC3AUMwWRDFuNQDMIwbmIctykXKcrmn4ivzgRFGFtJNY7CjJ5zW8DFWj iCGJu92b7FwVawCHNppRDNojL7J3Rj+X7d6arMioZDk5QrVu9PTyDQoA6X2R7V3YevYy 6K8n39hibZW6Q/iW+5svftMuafVyTiN9JwfYRUc+K12kR06CFxsZAA9XRWFhHJuHqrXS /A7Q== X-Gm-Message-State: AOAM531ZmvWI43YwNWxn/vQoV8A8vwk4VzZh6h/hVEYyZDBuO3KUKwN7 nAQ5gN1g6qid7BnHuKNauwlDfA== X-Received: by 2002:a05:6512:224f:: with SMTP id i15mr10369280lfu.688.1639584519531; Wed, 15 Dec 2021 08:08:39 -0800 (PST) Received: from eriador.lan ([2001:470:dd84:abc0::8a5]) by smtp.gmail.com with ESMTPSA id l24sm522070ljg.35.2021.12.15.08.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 08:08:39 -0800 (PST) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Subject: [PATCH v2] drm/plane: add alpha and blend_mode to atomic_print_state Date: Wed, 15 Dec 2021 19:08:37 +0300 Message-Id: <20211215160837.2715448-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When dumping plane state also output plane's alpha and blending mode values to ease debugging of complex composition cases. Signed-off-by: Dmitry Baryshkov Reviewed-by: Simon Ser --- Changes since v1: - Changed alpha property format to pad with zeroes --- drivers/gpu/drm/drm_atomic.c | 3 +++ drivers/gpu/drm/drm_blend.c | 21 +++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 3 +++ 3 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index ff1416cd609a..20db99c041eb 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -709,6 +709,9 @@ static void drm_atomic_plane_print_state(struct drm_printer *p, drm_get_color_encoding_name(state->color_encoding)); drm_printf(p, "\tcolor-range=%s\n", drm_get_color_range_name(state->color_range)); + drm_printf(p, "\talpha=%04X\n", state->alpha); + drm_printf(p, "\tblend_mode=%s\n", + drm_get_pixel_blend_mode_name(state->pixel_blend_mode)); if (plane->funcs->atomic_print_state) plane->funcs->atomic_print_state(p, state); diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c index ec37cbfabb50..e3971758ec53 100644 --- a/drivers/gpu/drm/drm_blend.c +++ b/drivers/gpu/drm/drm_blend.c @@ -616,3 +616,24 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane, return 0; } EXPORT_SYMBOL(drm_plane_create_blend_mode_property); + +static const char * const pixel_blend_mode_name[] = { + [DRM_MODE_BLEND_PIXEL_NONE] = "None", + [DRM_MODE_BLEND_PREMULTI] = "Pre-multiplied", + [DRM_MODE_BLEND_COVERAGE] = "Coverage", +}; + +/** + * drm_get_pixel_blend_mode_name - return a string for color encoding + * @encoding: color encoding to compute name of + * + * In contrast to the other drm_get_*_name functions this one here returns a + * const pointer and hence is threadsafe. + */ +const char *drm_get_pixel_blend_mode_name(uint16_t blend_mode) +{ + if (WARN_ON(blend_mode >= ARRAY_SIZE(pixel_blend_mode_name))) + return "unknown"; + + return pixel_blend_mode_name[blend_mode]; +} diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index 63279e984342..0794307191cf 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -289,3 +289,6 @@ void drm_mode_fixup_1366x768(struct drm_display_mode *mode); void drm_reset_display_info(struct drm_connector *connector); u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edid); void drm_update_tile_info(struct drm_connector *connector, const struct edid *edid); + +/* drm_blend.c */ +const char *drm_get_pixel_blend_mode_name(uint16_t blend_mode);