[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231223182932.27683-5-jason-jh.lin@mediatek.com>
Date: Sun, 24 Dec 2023 02:29:25 +0800
From: Jason-JH.Lin <jason-jh.lin@...iatek.com>
To: Rob Herring <robh+dt@...nel.org>, Krzysztof Kozlowski
<krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Chun-Kuang Hu
<chunkuang.hu@...nel.org>
CC: <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-mediatek@...ts.infradead.org>,
<dri-devel@...ts.freedesktop.org>, <linux-media@...r.kernel.org>,
<linaro-mm-sig@...ts.linaro.org>, Jason-ch Chen <jason-ch.chen@...iatek.com>,
Johnson Wang <johnson.wang@...iatek.com>, "Jason-JH . Lin"
<jason-jh.lin@...iatek.com>, Singo Chang <singo.chang@...iatek.com>, "Nancy
Lin" <nancy.lin@...iatek.com>, Shawn Sung <shawn.sung@...iatek.com>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>, Jeffrey Kardatzke
<jkardatzke@...gle.com>
Subject: [PATCH v3 04/11] drm/mediatek: Add secure identify flag and funcution to mtk_drm_plane
Add is_sec flag to identify current mtk_drm_plane is secure.
Add mtk_plane_is_sec_fb() to check current drm_framebuffer is secure.
Signed-off-by: Jason-JH.Lin <jason-jh.lin@...iatek.com>
---
drivers/gpu/drm/mediatek/mtk_drm_plane.c | 19 +++++++++++++++++++
drivers/gpu/drm/mediatek/mtk_drm_plane.h | 2 ++
2 files changed, 21 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
index ddc9355b06d5..d4d515627ca4 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -210,6 +210,7 @@ static void mtk_plane_update_new_state(struct drm_plane_state *new_state,
mtk_plane_state->pending.height = drm_rect_height(&new_state->dst);
mtk_plane_state->pending.rotation = new_state->rotation;
mtk_plane_state->pending.color_encoding = new_state->color_encoding;
+ mtk_plane_state->pending.is_secure = mtk_plane_fb_is_secure(fb);
}
static void mtk_plane_atomic_async_update(struct drm_plane *plane,
@@ -348,3 +349,21 @@ int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
return 0;
}
+
+bool mtk_plane_fb_is_secure(struct drm_framebuffer *fb)
+{
+ struct drm_gem_object *gem = NULL;
+ struct mtk_drm_gem_obj *mtk_gem = NULL;
+
+ if (!fb)
+ return false;
+
+ gem = fb->obj[0];
+ if (!gem)
+ return false;
+
+ mtk_gem = to_mtk_gem_obj(gem);
+
+ return mtk_gem->secure;
+}
+
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.h b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
index 99aff7da0831..5a330797b5db 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.h
@@ -33,6 +33,7 @@ struct mtk_plane_pending_state {
bool async_dirty;
bool async_config;
enum drm_color_encoding color_encoding;
+ bool is_secure;
};
struct mtk_plane_state {
@@ -46,6 +47,7 @@ to_mtk_plane_state(struct drm_plane_state *state)
return container_of(state, struct mtk_plane_state, base);
}
+bool mtk_plane_fb_is_secure(struct drm_framebuffer *fb);
int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
unsigned long possible_crtcs, enum drm_plane_type type,
unsigned int supported_rotations, const u32 *formats,
--
2.18.0
Powered by blists - more mailing lists