From patchwork Wed Dec 15 09:56:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 524243 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp178520imb; Wed, 15 Dec 2021 01:56:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZ3lNXmDTP6yAHT10i6m/w8VyLTTkUMzZBbXhbt+pIRoZKStdt1kR5rfEYFRYn5cRp1v8m X-Received: by 2002:a17:90b:4b8d:: with SMTP id lr13mr10724396pjb.239.1639562204387; Wed, 15 Dec 2021 01:56:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639562204; cv=none; d=google.com; s=arc-20160816; b=JT/sSfL449T96cqUePorjtHkbC1K1xaeI1jgBgQhWLLec4oZ8XRirvE/0PpV877gkU DX489MMAUcMuQbUXApXz40SMlo1mPjnOQ9ax+Z9hCEKskprISHv2p1QHYvDWx3Xt0fBq UmhQ405p2YUPwy7PJKX8zZ5DNPwIL37xKfi/JiYw/Vo36N/9y8Q/AV12YlAdojRMqnyv 61UEv4bXDjfQr6wcARGAE+HSAisNyU2pV1X0TkzT/b74erx7NN7Sr3u6dI9aURyyCzUQ l/UMriXVrb12TkQ5pFWgD9/7xgirAypIRbyVNkFogm/YelPJZj67U21vqblOKCWHfdqS Y21g== 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=p/SKAYMrs/GzMLA7d2JR/TcXPA0mR6BvhD9+t/8AH8Q=; b=fyjT96zEaDdw5wSyTluADh05Git9cSNlR4F0+IROZBHQ7SSqIqS57mvDP6LNCfOgei nCSrfBRmeqBbTwxsw21DAsG9mrER6lFkpFR0WLrE98FFP2GQYRL04kqNdoKLuTqSA+e6 yOV7dWPlv3PkDLkR0xaNldCOAbbh+7F9MjBkF4kKdkKW8UttOp+g2Aw0Sf/98kVN2+z2 03d4XTjKG4kCKVDxZ124CSBnZPALPRgKWG4HOh+xCw9cMhq33jS5Cy2zsHTfsqaXc/T1 n3FMJHq5IYZDCXVqIvv+6EF3YSCOf0sz6aJIjVDKWmKhcNT/WdSRlOV1vcZPD3ewno1E WMuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=itc9kjxl; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id j2si1355738pgl.698.2021.12.15.01.56.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 01:56:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=itc9kjxl; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 87DBB10E1F5; Wed, 15 Dec 2021 09:56:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id 336A210E1F5 for ; Wed, 15 Dec 2021 09:56:40 +0000 (UTC) Received: by mail-lj1-x232.google.com with SMTP id 207so32430841ljf.10 for ; Wed, 15 Dec 2021 01:56:40 -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=p/SKAYMrs/GzMLA7d2JR/TcXPA0mR6BvhD9+t/8AH8Q=; b=itc9kjxlMhXQBPC8jrx+gv6j8zRYhwg2VuUiLV+Bh3vupyXh/O008OW493tQET3jDX lj0kUSadknD5LkmknTU/rzElj13rvPstPnaOUK8U5FJdurdlyq4c32SxhxkuoxPANLhn tzvU5Gqc06jrqOlltJSAjHToVRt0fB7iwVHgK0yaoUveO30kbcL/265rmut737K1h0v3 3Ljk9KPQhVOmTMafnSkuZ3LR/SQ6/DD2U/xC5xFYC2BuU7M476J3JrDMUnCy6PWkHXdd 5nqusR+mSaIGEyE+x+8r3y1ypsEpPyYei99WfRjiCdCHGRpLVMKg1vZ21vWpiS3iS+bu sRDg== 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=p/SKAYMrs/GzMLA7d2JR/TcXPA0mR6BvhD9+t/8AH8Q=; b=vPfLbGE9aXDQfxvQJFD21yLrr1KlSkOm6TpiaJjvYAqZ6y5d2/6+Lh5guDaK1B24id 3n57VSaResuiyZTpOV8RkkmfxK04r+gPJWaD1l2pJXIJ8d06myyBgU3LIREMKT12Km+e P/n78xAhMzk1r//krD2KutBEJ+uSRQheYC9VUlRvOvUmrKbOzXSTsWTvw1bXvvL2GnhB psFzIkIEBu0gWRLsp78nRjQjpS4FNzsfQeD5H0yv7w70G39XtNC21iuysYRkwJ0adCDF UHrJQkoeqpI3VC6JEvwE/hum97okcvayucaxHPsApc3ZC6ZXxXcHk2UJ9fhgJm8K8ly/ rByA== X-Gm-Message-State: AOAM533mRda5y6az5flfzx5cRYeJMHiVLieDBIHfX6LfVuy2hso0pv1T YLMR1B6orm7NlZQ5DOpSI9Z2ZA== X-Received: by 2002:a2e:9510:: with SMTP id f16mr9592237ljh.409.1639562198497; Wed, 15 Dec 2021 01:56:38 -0800 (PST) Received: from eriador.lan ([2001:470:dd84:abc0::8a5]) by smtp.gmail.com with ESMTPSA id j20sm242085lfu.84.2021.12.15.01.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 01:56:38 -0800 (PST) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Subject: [PATCH] drm/plane: add alpha and blend_mode to atomic_print_state Date: Wed, 15 Dec 2021 12:56:36 +0300 Message-Id: <20211215095636.2330563-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 --- 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..e2e715b5aaa8 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=%x\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);