Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5000695img; Tue, 26 Mar 2019 23:22:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzO3jL32Lm62neUfQmBRenUB9IFTW3lZPyrGJIyHrjMImZvJHhcxiDfuS7ogfk8jlAQzchC X-Received: by 2002:a63:c24d:: with SMTP id l13mr33608767pgg.166.1553667769048; Tue, 26 Mar 2019 23:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667769; cv=none; d=google.com; s=arc-20160816; b=tt5cP9w9teJpS3xhT/7ggmD3XIGjkiI6+mXDthBYFVPQRFq4ytHL+fD9s8qrGDvx10 bj3/kGUh5ww8S5LbstrJm2xuL/lSoJa54YlWBUNliAduqScwjtW9mrjwhfA1VxaB5eD8 vUaAGMm3j6SJj0q2UhuZHI1c7Y0P5KcAjMU0M5H0uvjYcMDm3Y3yG9YrNmJaET1FQtks D1v/jA4jhmMAsJ6gRHWhYN4DGI8jsCPkXrJlm5nQDgn1iVmXGz+X1nXyzjC7v+dnQGZM T0/Z7ELYRlOG+sGDttbbZa5Dot7MwGhus0r1KE542u36sMwzPy9WpZ87tndVYjyigsxr JWjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ndo5dTXBwIlQ+sNm7rxorEwgJN3yCxKjt2Bk3YKIpu8=; b=koNp0rhopm0CYHKsQ8hwGaPTyKyVmYj9uXSlYcPt4CPtyTT2z0cvrJr8qX/sz/8CmI oYPcrG79EfEh4/1pJ81TfGAOMkVQ4mgw3zw76jzz8Rt5cKEua8T/qS3fuoPGt66GQk5e Wg3bA4hFaKVlffvxbQPJKJDuh97KCd/qOPKmANB4feGzxMCtsXvp/k7wYiJ1I0pG7wAx /RmIhljtalQpulv3cPWKseTVdmJOVBdPBxaDG/6qW7HWcj+AZYURk1cVe1kGcsyEHcI5 Pv2rOZT01n8rSiz2ymJtxPRi7rNgCCl1ao/jh9iXNfl2XYet+Yjh38FAuGlHFDdW6liG mHSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si17248412pfc.255.2019.03.26.23.22.33; Tue, 26 Mar 2019 23:22:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387595AbfC0GUG (ORCPT + 99 others); Wed, 27 Mar 2019 02:20:06 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:41926 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387533AbfC0GUF (ORCPT ); Wed, 27 Mar 2019 02:20:05 -0400 X-UUID: 577ff5a69c95468dbce105f7c722e4db-20190327 X-UUID: 577ff5a69c95468dbce105f7c722e4db-20190327 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1677528516; Wed, 27 Mar 2019 14:20:00 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:58 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 14:19:57 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 25/25] drm/mediatek: enable allow_fb_modifiers for mediatek drm Date: Wed, 27 Mar 2019 14:19:21 +0800 Message-ID: <1553667561-25447-26-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 27711A85286F0D45C002436FCDA291C53240DBF1F9262A87BED8CB81F25CAE3A2000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Niu enable allow_fb_modifiers for mediatek drm Signed-off-by: Yongqiang Niu --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++ drivers/gpu/drm/mediatek/mtk_drm_plane.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 942789d..a45c7b4 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -277,6 +277,8 @@ static int mtk_drm_kms_init(struct drm_device *drm) drm->mode_config.max_height = 4096; drm->mode_config.funcs = &mtk_drm_mode_config_funcs; + drm->mode_config.allow_fb_modifiers = true; + ret = component_bind_all(drm->dev, drm); if (ret) goto err_config_cleanup; diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index f7e6aa1..106939b 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c @@ -77,6 +77,13 @@ static void mtk_drm_plane_destroy_state(struct drm_plane *plane, kfree(to_mtk_plane_state(state)); } +static bool mtk_plane_format_mod_supported(struct drm_plane *plane, + uint32_t format, + uint64_t modifier) +{ + return (modifier == DRM_FORMAT_MOD_LINEAR); +} + static const struct drm_plane_funcs mtk_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, @@ -84,6 +91,7 @@ static void mtk_drm_plane_destroy_state(struct drm_plane *plane, .reset = mtk_plane_reset, .atomic_duplicate_state = mtk_plane_duplicate_state, .atomic_destroy_state = mtk_drm_plane_destroy_state, + .format_mod_supported = mtk_plane_format_mod_supported, }; static int mtk_plane_atomic_check(struct drm_plane *plane, @@ -163,10 +171,15 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned long possible_crtcs, enum drm_plane_type type) { int err; + static const uint64_t modifiers[] = { + DRM_FORMAT_MOD_LINEAR, + DRM_FORMAT_MOD_INVALID + }; err = drm_universal_plane_init(dev, plane, possible_crtcs, &mtk_plane_funcs, formats, - ARRAY_SIZE(formats), NULL, type, NULL); + ARRAY_SIZE(formats), modifiers, + type, NULL); if (err) { DRM_ERROR("failed to initialize plane\n"); return err; -- 1.8.1.1.dirty