[PATCH v6 1/7] drm/mediatek: Add interface to allocate MediaTek GEM buffer

2024-05-25 Thread Jason-JH . Lin
From: CK Hu Add an interface to allocate MediaTek GEM buffers, allow the IOCTLs to be used by render nodes. This patch also sets the RENDER driver feature. TODO: Drop this path after we change all the usages of this ioctl to DMA_HEAP_IOCTL_ALLOC in the user sapce. Signed-off-by: CK Hu Signed-o

[PATCH v6 4/7] drm/mediatek: Add secure identify flag and funcution to mtk_drm_plane

2024-05-25 Thread Jason-JH . Lin
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 Signed-off-by: Hsiao Chien Sung --- drivers/gpu/drm/mediatek/mtk_plane.c | 18 ++ drivers/gpu/drm/mediatek/mtk_plane.h |

[PATCH v6 6/7] drm/mediatek: Add secure flow support to mediatek-drm

2024-05-25 Thread Jason-JH . Lin
To add secure flow support for mediatek-drm, each crtc have to create a secure cmdq mailbox channel. Then cmdq packets with display HW configuration will be sent to secure cmdq mailbox channel and configured in the secure world. Each crtc have to use secure cmdq interface to configure some secure

[PATCH v6 5/7] drm/mediatek: Add mtk_ddp_sec_write() to config secure buffer info

2024-05-25 Thread Jason-JH . Lin
Add mtk_ddp_sec_write() to configure secure buffer information to cmdq secure packet data and send to the secure world. OVL and OVL_ADAPTOR need to use mtk_ddp_sec_write() instead of original mtk_ddp_write() because the address in plane is secure handle not the real buffer address. The secure buf

[PATCH v6 2/7] drm/mediatek/uapi: Add DRM_MTK_GEM_CREATE_RESTRICTED flag

2024-05-25 Thread Jason-JH . Lin
Add DRM_MTK_GEM_CREATE_RESTRICTED flag for the user space to tell the kernel space this dma buffer is restricted. The user space can store this flag into the private data of the dma buffer after allocating. A restricted buffer is used to store the secure video content to support secure video path

[PATCH v6 7/7] drm/mediatek: Add cmdq_insert_backup_cookie before secure pkt finalize

2024-05-25 Thread Jason-JH . Lin
Add cmdq_insert_backup_cookie to append some commands before EOC: 1. Get GCE HW thread execute count from the GCE HW register. 2. Add 1 to the execute count and then store into a shared memory. 3. Set a software event siganl as secure irq to GCE HW. Since the value of execute count + 1 is stored i

[PATCH v6 3/7] drm/mediatek: Add secure buffer control flow to mtk_drm_gem

2024-05-25 Thread Jason-JH . Lin
Add secure buffer control flow to mtk_drm_gem. When user space takes DRM_MTK_GEM_CREATE_RESTRICTED flag and size to create a mtk_drm_gem object, mtk_drm_gem will find a matched size dma buffer from secure dma-heap and bind it to mtk_drm_gem object. TODO: 1. Drop the mtk_gem_create_from_heap() aft

[PATCH v6 0/7] Add mediate-drm secure flow for SVP

2024-05-25 Thread Jason-JH . Lin
From: Jason-jh Lin Memory Definitions: secure memory - Memory allocated in the TEE (Trusted Execution Environment) which is inaccessible in the REE (Rich Execution Environment, i.e. linux kernel/userspace). secure handle - Integer value which acts as reference to 'secure memory'

[PATCH RESEND,v6 0/8] Add CMDQ secure driver for SVP

2024-05-26 Thread Jason-JH . Lin
From: Jason-jh Lin For the Secure Video Path (SVP) feature, inculding the memory stored secure video content, the registers of display HW pipeline and the HW configure operations are required to execute in the secure world. So using a CMDQ secure driver to make all display HW registers

[PATCH RESEND, v6 3/8] soc: mediatek: cmdq: Add cmdq_pkt_logic_command to support math operation

2024-05-26 Thread Jason-JH . Lin
Add cmdq_pkt_logic_command to support math operation. cmdq_pkt_logic_command can append logic command to the CMDQ packet, ask GCE to execute a arithmetic calculate instruction, such as add, subtract, multiply, AND, OR and NOT, etc. Note that all arithmetic instructions are unsigned calculations.

[PATCH RESEND, v6 5/8] mailbox: mediatek: Move reuseable definition to header for secure driver

2024-05-26 Thread Jason-JH . Lin
To support CMDQ secure driver, move some reuseable definition to header. - define: e.g. CMDQ_GCE_NUM_MAX, CMDQ_THR_BASE, CMDQ_THR_SIZE. - struct: e.g. cmdq_thread, cmdq, cmdq_task. - include: e.g. . Add "#include " for the function that takes "struct mbox_chan * chan" as a parameter. That may occu

[PATCH RESEND, v6 1/8] dt-bindings: gce: mt8195: Add CMDQ_SYNC_TOKEN_SECURE_THR_EOF event id

2024-05-26 Thread Jason-JH . Lin
There are 2 kind of GCE event signal: - The SW token means: a GCE event signal triggered by SW drivers. e.g. SW driver append a GCE command to set a GCE event after a specific GCE command. Or SW driver use CPU to write a event id to GCE register to trigger the GCE event corresponding to that event

[PATCH RESEND, v6 6/8] mailbox: mediatek: Add CMDQ secure mailbox driver

2024-05-26 Thread Jason-JH . Lin
To support secure video path feature, GCE have to read/write registgers in the secure world. GCE will enable the secure access permission to the HW who wants to access the secure content buffer. Add CMDQ secure mailbox driver to make CMDQ client user is able to sending their HW settings to the sec

[PATCH RESEND, v6 2/8] dt-bindings: mailbox: Add property for CMDQ secure driver

2024-05-26 Thread Jason-JH . Lin
1. Add mboxes property to define a GCE loopping thread as a secure IRQ handler. The CMDQ secure driver requests a mbox channel and sends a looping command to the GCE thread. The looping command will wait for a secure packet done event signal from secure world and then jump back to the first instuct

[PATCH RESEND, v6 7/8] mailbox: mediatek: Add secure CMDQ driver support for CMDQ driver

2024-05-26 Thread Jason-JH . Lin
CMDQ driver will probe a secure CMDQ driver when has_sec flag in platform data is true and its device node in dts has defined a event id of CMDQ_SYNC_TOKEN_SEC_EOF. Secure CMDQ driver support on mt8188 and mt8195 currently. So add a has_secure flag to their driver data to probe it. Signed-off-by:

[PATCH RESEND, v6 8/8] soc: mediatek: mtk-cmdq: Add secure cmdq_pkt APIs

2024-05-26 Thread Jason-JH . Lin
Open secure cmdq_pkt APIs to support executing commands in secure world. 1. Add cmdq_sec_pkt_alloc_sec_data(), cmdq_sec_pkt_free_sec_data() and cmdq_sec_pkt_set_data() to prepare the sec_data in cmdq_pkt that will be referenced in the secure world. 2. Add cmdq_sec_insert_backup_cookie() and

[PATCH RESEND, v6 4/8] mailbox: mtk-cmdq: Support GCE loop packets in interrupt handler

2024-05-26 Thread Jason-JH . Lin
1. Add a loop flag for CMDQ packet struct. CMDQ helper will use a loop flag to mark CMDQ packet as lopping command and make current command buffer jumps to the beginning when GCE executes to the end of command buffer. 2. Add a looping task handle flow in irq handler. GCE irq occurs when GCE execut

[PATCH] drm/mediatek: Fix bit depth overwritten for mtk_ovl_set bit_depth()

2024-06-24 Thread Jason-JH . Lin
Refine the value and mask define of bit depth for mtk_ovl_set bit_depth(). Use cmdq_pkt_write_mask() instead of cmdq_pkt_write() to avoid bit depth settings being overwritten. Fixes: fb36c5020c9c ("drm/mediatek: Add support for AR30 and BA30 overlays") Signed-off-by: Jason-JH.Lin --- Based on: h

[PATCH v2] mailbox: mtk-cmdq: Fix sleeping function called from invalid context

2024-05-08 Thread Jason-JH . Lin
When we run kernel with lockdebug option, we will get the BUG below: [ 106.692124] BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1164 [ 106.692190] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 3616, name: kworker/u17:3 [ 106.692226] preempt_coun

[PATCH v3 0/3] Add mediatek, gce-props.yaml for other bindings reference

2024-01-18 Thread Jason-JH . Lin
From: Jason-jh Lin The property "mediatek,gce-events" is used for GCE event ID corresponding to a hardware event signal sent by the hardware or a sofware driver. If the mailbox providers or consumers want to manipulate the value of the event ID, they need to know the specific event

[PATCH v3 2/3] dt-bindings: media: mediatek: mdp: Change mediatek, gce-events to reference

2024-01-18 Thread Jason-JH . Lin
Change mediatek,gce-events property to reference mediatek,gce-props.yaml instead of defining itself. Signed-off-by: Jason-JH.Lin --- .../bindings/media/mediatek,mdp3-rdma.yaml | 11 +++ .../devicetree/bindings/media/mediatek,mdp3-rsz.yaml | 12 .../bindings/media/m

[PATCH v3 1/3] dt-bindings: mailbox: Add mediatek,gce-props.yaml

2024-01-18 Thread Jason-JH . Lin
Add mediatek,gce-props.yaml for common GCE properties that is used for both mailbox providers and consumers. We place the common property "mediatek,gce-events" in this binding currently. The property "mediatek,gce-events" is used for GCE event ID corresponding to a hardware event signal sent by th

[PATCH v3 3/3] dt-bindings: soc: mediatek: Change mediatek, gce-events to refernece

2024-01-18 Thread Jason-JH . Lin
Change mediatek,gce-events property to reference mediatek,gce-props.yaml instead of defining itself. Signed-off-by: Jason-JH.Lin --- .../bindings/soc/mediatek/mediatek,ccorr.yaml| 12 .../bindings/soc/mediatek/mediatek,mutex.yaml| 11 +++ .../bindings/soc/med

[PATCH v4 1/3] dt-bindings: mailbox: Add mediatek,gce-props.yaml

2024-01-23 Thread Jason-JH . Lin
Add mediatek,gce-props.yaml for common GCE properties that is used for both mailbox providers and consumers. We place the common property "mediatek,gce-events" in this binding currently. The property "mediatek,gce-events" is used for GCE event ID corresponding to a hardware event signal sent by th

[PATCH v4 0/3] Add mediatek, gce-props.yaml for other bindings reference

2024-01-23 Thread Jason-JH . Lin
From: Jason-jh Lin The property "mediatek,gce-events" is used for GCE event ID corresponding to a hardware event signal sent by the hardware or a software driver. If the mailbox providers or consumers want to manipulate the value of the event ID, they need to know the specific event

[PATCH v4 2/3] dt-bindings: media: mediatek: mdp: Change mediatek, gce-events to reference

2024-01-23 Thread Jason-JH . Lin
Change mediatek,gce-events property to reference mediatek,gce-props.yaml instead of defining itself. Signed-off-by: Jason-JH.Lin Reviewed-by: Conor Dooley --- .../bindings/media/mediatek,mdp3-rdma.yaml | 11 +++ .../devicetree/bindings/media/mediatek,mdp3-rsz.yaml | 12 ---

[PATCH v4 3/3] dt-bindings: soc: mediatek: Change mediatek, gce-events to refernece

2024-01-23 Thread Jason-JH . Lin
Change mediatek,gce-events property to reference mediatek,gce-props.yaml instead of defining itself. Signed-off-by: Jason-JH.Lin Reviewed-by: Conor Dooley --- .../bindings/soc/mediatek/mediatek,ccorr.yaml| 12 .../bindings/soc/mediatek/mediatek,mutex.yaml| 11 +++---

[PATCH v3 05/11] drm/mediatek: Add mtk_ddp_sec_write to config secure buffer info

2023-12-23 Thread Jason-JH . Lin
Add mtk_ddp_sec_write to configure secure buffer information to cmdq secure packet data. Then secure cmdq driver will use these information to configure curresponding secure DRAM address to HW overlay in secure world. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |

[PATCH v3 01/11] drm/mediatek: Add interface to allocate MediaTek GEM buffer.

2023-12-23 Thread Jason-JH . Lin
From: CK Hu Add an interface to allocate MediaTek GEM buffers, allow the IOCTLs to be used by render nodes. This patch also sets the RENDER driver feature. Signed-off-by: CK Hu Signed-off-by: Nicolas Boichat Signed-off-by: Philipp Zabel Signed-off-by: Jason-JH.Lin Reviewed-by: Daniel Kurtz

[PATCH v3 10/11] drm/mediatek: Add cmdq_insert_backup_cookie before secure pkt finalize

2023-12-23 Thread Jason-JH . Lin
Add cmdq_insert_backup_cookie to append some commands before EOC: 1. Get GCE HW thread execute count from the GCE HW register. 2. Add 1 to the execute count and then store into a shared memory. 3. Set a software event siganl as secure irq to GCE HW. Since the value of execute count + 1 is stored i

[PATCH v3 07/11] drm/mediatek: Add secure layer config support for ovl

2023-12-23 Thread Jason-JH . Lin
Add secure layer config support for ovl. TODO: 1. Move DISP_REG_OVL_SECURE setting to secure world. 2. Change the parameter register address in mtk_ddp_sec_write() from "u32 addr" to "struct cmdq_client_reg *cmdq_reg". Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_drv.h

[PATCH v3 03/11] drm/mediatek: Add secure buffer control flow to mtk_drm_gem

2023-12-23 Thread Jason-JH . Lin
Add secure buffer control flow to mtk_drm_gem. When user space takes DRM_MTK_GEM_CREATE_ENCRYPTED flag and size to create a mtk_drm_gem object, mtk_drm_gem will find a matched size dma buffer from secure dma-heap and bind it to mtk_drm_gem object. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm

[PATCH v3 06/11] drm/mediatek: Add get_sec_port interface to mtk_ddp_comp

2023-12-23 Thread Jason-JH . Lin
Add get_sec_port interface to ddp_comp to get the secure port settings from ovl and ovl_adaptor. Then mediatek-drm will use secure cmdq driver to configure DRAM access permission in secure world by their secure port settings. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_drm_ddp_c

[PATCH v3 11/11] arm64: dts: mt8195: Add secure mbox settings for vdosys

2023-12-23 Thread Jason-JH . Lin
Add a secure mailbox channel to support secure video path on vdosys0 and vdosys1. Signed-off-by: Jason-JH.Lin --- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/med

[PATCH v3 02/11] drm/mediatek/uapi: Add DRM_MTK_GEM_CREATE_ENCRYPTED flag

2023-12-23 Thread Jason-JH . Lin
Add DRM_MTK_GEM_CREATE_ENCRYPTED flag to allow user to allocate a secure buffer to support secure video path feature. Signed-off-by: Jason-JH.Lin --- include/uapi/drm/mediatek_drm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/drm/mediatek_drm.h b/include/uapi/drm/mediatek_dr

[PATCH v3 09/11] drm/mediatek: Add secure flow support to mediatek-drm

2023-12-23 Thread Jason-JH . Lin
To add secure flow support for mediatek-drm, each crtc have to create a secure cmdq mailbox channel. Then cmdq packets with display HW configuration will be sent to secure cmdq mailbox channel and configured in the secure world. Each crtc have to use secure cmdq interface to configure some secure

[PATCH v3 04/11] drm/mediatek: Add secure identify flag and funcution to mtk_drm_plane

2023-12-23 Thread Jason-JH . Lin
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 --- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 19 +++ drivers/gpu/drm/mediatek/mtk_drm_plane.h | 2 ++ 2 files changed,

[PATCH v3 00/11] Add mediate-drm secure flow for SVP

2023-12-23 Thread Jason-JH . Lin
From: Jason-jh Lin Memory Definitions: secure memory - Memory allocated in the TEE (Trusted Execution Environment) which is inaccessible in the REE (Rich Execution Environment, i.e. linux kernel/userspace). secure handle - Integer value which acts as reference to 'secure memory'

[PATCH v3 08/11] drm/mediatek: Add secure layer config support for ovl_adaptor

2023-12-23 Thread Jason-JH . Lin
Add secure layer config support for ovl_adaptor and sub driver mdp_rdma. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 + drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 15 +++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 + drivers/g

[PATCH] drm/mediatek: ovl: Add fmt_support_man for MT8192 and MT8195

2024-09-14 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is an configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL

[PATCH v2] drm/mediatek: ovl: Add fmt_support_man for MT8192 and MT8195

2024-09-15 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is an configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL

[PATCH v11 0/5] Fix degradation problem of alpha blending series

2024-10-08 Thread Jason-JH . Lin
Some SoCs do not support the ignore_pixl_alpha flag, which breaks the XRGB format. Some SoCs do not support pre-multiplied pixel formats and extending configuration of OVL pre-multiplied color formats, such as MT8173. Fix the SoC degradation problem by this series. Tested-by: Chen-Yu Tsai --

[PATCH v11 2/5] drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement

2024-10-08 Thread Jason-JH . Lin
Refine the comment for ignore_pixel_alpha flag and move it to if(state->fb) statement to make it less conditional. Signed-off-by: Jason-JH.Lin Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 +- 1 file changed, 9 inse

[PATCH v11 5/5] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

2024-10-08 Thread Jason-JH . Lin
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different blending supported components. The blending supported components can use driver dat

[PATCH v11 4/5] drm/mediatek: ovl: Add blend_modes to driver data

2024-10-08 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v11 3/5] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert()

2024-10-08 Thread Jason-JH . Lin
Since we changed MACROs to be consistent with DRM input color format naming, the comment for ovl_fmt_conver() is no longer needed. Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL") Signed-off-by: Jason-JH.Lin Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c

[PATCH v11 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs

2024-10-08 Thread Jason-JH . Lin
OVL_CON_AEN is for alpha blending enable. For the SoC that is supported the blend_modes, OVL_CON_AEN will always enabled to use constant alpha and then use the ignore_pixel_alpha bit to do the alpha blending for XRGB format. Note that ignore pixel alpha bit is not supported if the SoC is not su

[PATCH v9 5/5] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

2024-10-07 Thread Jason-JH . Lin
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different blending supported components. The blending supported components can use driver dat

[PATCH v9 0/5] Fix degradation problem of alpha blending series

2024-10-07 Thread Jason-JH . Lin
Some SoCs do not support the ignore_pixl_alpha flag, which breaks the XRGB format. Some SoCs do not support pre-multiplied pixel formats and extending configuration of OVL pre-multiplied color formats, such as MT8173. Fix the SoC degradation problem by this sreies. --- Change in v9: 1. Add th

[PATCH v9 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs

2024-10-07 Thread Jason-JH . Lin
If the constant alpha always enable, the SoCs that is not supported the ignore pixel alpha bit will still use constant alpha. That will break the original constant alpha setting of XRGB foramt for blend_modes unsupported SoCs, such as MT8173. Note that ignore pixel alpha bit is suppored if the SoC

[PATCH v9 2/5] drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement

2024-10-07 Thread Jason-JH . Lin
Refine the comment for ignore_pixel_alpha flag and move it to if (state->fb) statement to make it less conditional. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/media

[PATCH v9 3/5] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert()

2024-10-07 Thread Jason-JH . Lin
Since we changed MACROs to be consistent with DRM input color format naming, the comment for ovl_fmt_conver() is no longer needed. Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL") Signed-off-by: Jason-JH.Lin Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c

[PATCH v9 4/5] drm/mediatek: ovl: Add blend_modes to driver data

2024-10-07 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v10 0/5] Fix degradation problem of alpha blending series

2024-10-07 Thread Jason-JH . Lin
Some SoCs do not support the ignore_pixl_alpha flag, which breaks the XRGB format. Some SoCs do not support pre-multiplied pixel formats and extending configuration of OVL pre-multiplied color formats, such as MT8173. Fix the SoC degradation problem by this sreies. --- Change in v10: 1. Fix

[PATCH v10 5/5] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

2024-10-07 Thread Jason-JH . Lin
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different blending supported components. The blending supported components can use driver dat

[PATCH v10 4/5] drm/mediatek: ovl: Add blend_modes to driver data

2024-10-07 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v10 1/5] drm/mediatek: ovl: Fix XRGB format breakage for blend_modes unsupported SoCs

2024-10-07 Thread Jason-JH . Lin
OVL_CON_AEN is for alpha blending enable. For the SoC that is supported the blend_modes, OVL_CON_AEN will always enabled to use constant alpha and then use the ignore_pixel_alpha bit to do the alpha blending for XRGB format. Note that ignore pixel alpha bit is not supported if the SoC is not su

[PATCH v10 3/5] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert()

2024-10-07 Thread Jason-JH . Lin
Since we changed MACROs to be consistent with DRM input color format naming, the comment for ovl_fmt_conver() is no longer needed. Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL") Signed-off-by: Jason-JH.Lin Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c

[PATCH v10 2/5] drm/mediatek: ovl: Refine ignore_pixel_alpha comment and placement

2024-10-07 Thread Jason-JH . Lin
Refine the comment for ignore_pixel_alpha flag and move it to if(state->fb) statement to make it less conditional. Signed-off-by: Jason-JH.Lin Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 18 +- 1 file changed, 9 inse

[PATCH] drm/mediatek: Fix XRGB format breakage for blend_modes unsupported SoCs

2024-10-05 Thread Jason-JH . Lin
If the constant alpha always set, the SoCs that is not supported the ignore alpha bit will still use constant alpha. That will break the original constant alpha setting of XRGB foramt for blend_modes unsupported SoCs, such as MT8173. Make the constatnt alpha only set when setting has_alpha or supp

[PATCH v6 2/2] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

2024-09-26 Thread Jason-JH . Lin
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different blending supported components. The blending supported components can use driver dat

[PATCH v6 0/2] Fix degradation problem of alpha blending series

2024-09-26 Thread Jason-JH . Lin
Some SoCs not support pre-multiplied pixel formats and extending configuration of OVL pre-multiplied color formats, such as MT8173. Fix the SoC degradation problem by this sreies. --- Chnage in v6: 1. Use blend_modes instead of function pointer in OVL 2. Use ethdr instead of mdp_rdma to get blen

[PATCH v6 1/2] drm/mediatek: ovl: Add blend_modes to driver data

2024-09-26 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v7 3/3] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

2024-09-26 Thread Jason-JH . Lin
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different blending supported components. The blending supported components can use driver dat

[PATCH v7 0/3] Fix degradation problem of alpha blending series

2024-09-26 Thread Jason-JH . Lin
Some SoCs not support pre-multiplied pixel formats and extending configuration of OVL pre-multiplied color formats, such as MT8173. Fix the SoC degradation problem by this sreies. --- Change in v7: 1. Add the remove color format comment patch for OVL 2. Fix warning: 'const' type qualifier on ret

[PATCH v7 2/3] drm/mediatek: ovl: Add blend_modes to driver data

2024-09-26 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v7 1/3] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert()

2024-09-26 Thread Jason-JH . Lin
Since we changed MACROs to be consistent with DRM input color format naming, the comment for ovl_fmt_conver() is no longer needed. Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL") Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 5 - 1 file ch

[PATCH v4] drm/mediatek: ovl: Add fmt_convert function pointer to driver data

2024-09-23 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v5 2/2] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

2024-09-25 Thread Jason-JH . Lin
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different OVL components. The OVL component can use driver data to set the blend mode capabil

[PATCH v5 1/2] drm/mediatek: ovl: Add fmt_convert function pointer to driver data

2024-09-25 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v5 0/2] Fix degradation problem of alpha blending series

2024-09-25 Thread Jason-JH . Lin
From: Jason-jh Lin Some SoCs not support pre-multiplied pixel formats and extending configuration of OVL pre-multiplied color formats, such as MT8173. Fix the SoC degradation problem by this sreies. --- Change in v5: Add fix patch for mtk_plane Change in v4: Add lost cases of

[PATCH v8 2/3] drm/mediatek: ovl: Add blend_modes to driver data

2024-09-28 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v8 3/3] drm/mediatek: Add blend_modes to mtk_plane_init() for different SoCs

2024-09-28 Thread Jason-JH . Lin
Since some SoCs support premultiplied pixel formats but some do not, the blend_modes parameter is added to mtk_plane_init(), which is obtained from the mtk_ddp_comp_get_blend_modes function implemented in different blending supported components. The blending supported components can use driver dat

[PATCH v8 0/3] Fix degradation problem of alpha blending series

2024-09-28 Thread Jason-JH . Lin
From: Jason-jh Lin Some SoCs not support pre-multiplied pixel formats and extending configuration of OVL pre-multiplied color formats, such as MT8173. Fix the SoC degradation problem by this sreies. --- Change in v8: Remove blend_modes for not supported pre-multiplied SoCs to fix the return

[PATCH v8 1/3] drm/mediatek: ovl: Remove the color format comment for ovl_fmt_convert()

2024-09-28 Thread Jason-JH . Lin
Since we changed MACROs to be consistent with DRM input color format naming, the comment for ovl_fmt_conver() is no longer needed. Fixes: 9f428b95ac89 ("drm/mediatek: Add new color format MACROs in OVL") Signed-off-by: Jason-JH.Lin Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_disp_ovl.c

[PATCH v2] drm/mediatek: Move mtk_crtc_finish_page_flip() to ddp_cmdq_cb()

2024-11-19 Thread Jason-JH . Lin
mtk_crtc_finish_page_flip() is used to notify userspace that a page flip has been completed, allowing userspace to free the frame buffer of the last frame and commit the next frame. In MediaTek's hardware design for configuring display hardware by using GCE, `DRM_EVENT_FLIP_COMPLETE` should be not

[PATCH] drm/mediatek: Add support for 180-degree rotation in the display driver

2024-11-17 Thread Jason-JH . Lin
mediatek-drm driver reported the capability of 180-degree rotation by adding `DRM_MODE_ROTATE_180` to the plane property, as flip-x combined with flip-y equals a 180-degree rotation. However, we did not handle the rotation property in the driver and lead to rotation issues. Fixes: 74608d8feefd ("d

[PATCH] drm/mediatek: Add no pending_planes flag checking for mtk_crtc_finish_page_flip()

2024-11-17 Thread Jason-JH . Lin
mtk_crtc_finish_page_flip() is used to notify the page flip that has been completed to the userspace, so userspace can free the frame buffer of the last frame and commit the next frame. However, mtk_crtc_finish_page_flip() cannot guarantee the GCE has configured all the display hardware settings o

[PATCH 4/8] soc: mediatek: mtk-cmdq: Add unsupported subsys ID programing flow

2024-11-20 Thread Jason-JH . Lin
When GCE executes instructions, the corresponding hardware register can be found through the subsys ID. For unsupported subsys ID hardware, the physical address need to be used to generate GCE instructions. Add the pa_base interface to the instruction programming flow for these unsupported subsys

[PATCH 5/8] soc: mediatek: mtk-cmdq: Add mminfra_offset compatibility for DRAM address

2024-11-20 Thread Jason-JH . Lin
Since GCE has been moved to mminfra in MT8196, all transactions from mminfra to DRAM will have their addresses adjusted by subtracting a mminfra offset. This information should be handled inside the CMDQ driver, allowing CMDQ users to call CMDQ APIs as usual. Therefore, CMDQ driver needs to use th

[PATCH 2/8] dt-bindings: mailbox: mediatek: Add MT8196 support for gce-mailbox

2024-11-20 Thread Jason-JH . Lin
Add compatible name and iommus property for MT8196. Signed-off-by: Jason-JH.Lin --- .../devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml b/Documentation/devicetr

[PATCH 0/8] Add GCE support for MT8196

2024-11-20 Thread Jason-JH . Lin
This patch series adds support for the MediaTek MT8196 SoC in the CMDQ driver and related subsystems. The changes include adding compatible names and properties, updating driver data to accommodate hardware changes, and modifying the CMDQ API to support non-subsys ID hardware. Jason-JH.Lin (8):

[PATCH 1/8] dt-bindings: mailbox: mediatek: Add GCE header file for MT8196

2024-11-20 Thread Jason-JH . Lin
Add the Global Command Engine (GCE) header file to define the GCE thread priority, GCE subsys ID, GCE events, and various constants for MT8196. Signed-off-by: Jason-JH.Lin --- .../dt-bindings/mailbox/mediatek,mt8196-gce.h | 1449 + 1 file changed, 1449 insertions(+) create mode

[PATCH 3/8] mailbox: mtk-cmdq: Add driver data to support for MT8196

2024-11-20 Thread Jason-JH . Lin
MT8196 has 4 hardware changes compared with the previous SoC, which correspond to the 4 new driver data: 1. mminfra_offset: For GCE data plane control Since GCE has been moved into mminfra, GCE needs to append the mminfra offset to the DRAM address when accessing the DRAM. 2. gce_vm: For GC

[PATCH 6/8] soc: mediatek: Add pa_base due to CMDQ API change

2024-11-20 Thread Jason-JH . Lin
To support non-subsys ID hardware on new SoCs, the CMDQ API has been changed to include the pa_base parameter. This change accommodates the new interface requirements. Signed-off-by: Jason-JH.Lin --- drivers/soc/mediatek/mtk-mmsys.c | 1 + drivers/soc/mediatek/mtk-mutex.c | 2 +- 2 files changed

[PATCH 7/8] drm/mediatek: Add pa_base due to CMDQ API change

2024-11-20 Thread Jason-JH . Lin
To support non-subsys ID hardware on new SoCs, the CMDQ API has been changed to include the pa_base parameter. This change accommodates the new interface requirements. Signed-off-by: Jason-JH.Lin --- drivers/gpu/drm/mediatek/mtk_ddp_comp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions

[PATCH 8/8] media: mediatek: mdp3: Add pa_base due to CMDQ API change

2024-11-20 Thread Jason-JH . Lin
To support non-subsys ID hardware on new SoCs, the CMDQ API has been changed to include the pa_base parameter. This change accommodates the new interface requirements. Signed-off-by: Jason-JH.Lin --- drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 4 ++-- drivers/media/platform/mediatek/m

[PATCH v3] drm/mediatek: ovl: Add fmt_convert function pointer to driver data

2024-09-17 Thread Jason-JH . Lin
OVL_CON_CLRFMT_MAN is a configuration for extending color format settings of DISP_REG_OVL_CON(n). It will change some of the original color format settings. Take the settings of (3 << 12) for example. - If OVL_CON_CLRFMT_MAN = 0 means OVL_CON_CLRFMT_RGBA. - If OVL_CON_CLRFMT_MAN = 1 means OVL_

[PATCH v2 1/8] dt-bindings: mailbox: mediatek: Add GCE header file for MT8196

2024-12-10 Thread Jason-JH . Lin
Add the Global Command Engine (GCE) header file to define the GCE thread priority, GCE subsys ID and GCE events for MT8196. Signed-off-by: Jason-JH.Lin --- .../dt-bindings/mailbox/mediatek,mt8196-gce.h | 1439 + 1 file changed, 1439 insertions(+) create mode 100644 include/dt-bi

[PATCH v2 5/8] soc: mediatek: mtk-cmdq: Add mminfra_offset compatibility for DRAM address

2024-12-10 Thread Jason-JH . Lin
Since GCE has been moved to mminfra in MT8196, all transactions from mminfra to DRAM will have their addresses adjusted by subtracting a mminfra offset. This information should be handled inside the CMDQ driver, allowing CMDQ users to call CMDQ APIs as usual. Therefore, CMDQ driver needs to use th

[PATCH v2 3/8] mailbox: mtk-cmdq: Add driver data to support for MT8196

2024-12-10 Thread Jason-JH . Lin
MT8196 has 4 hardware changes compared with the previous SoC, which correspond to the 4 new driver data: 1. mminfra_offset: For GCE data plane control Since GCE has been moved into mminfra, GCE needs to append the mminfra offset to the DRAM address when accessing the DRAM. 2. gce_vm: For GC

[PATCH v2 7/8] drm/mediatek: Add programming flow for unsupported subsys ID hardware

2024-12-10 Thread Jason-JH . Lin
To support hardware without subsys IDs on new SoCs, add a programming flow that checks whether the subsys ID is valid. If the subsys ID is invalid, the flow will call 2 alternative CMDQ APIs: cmdq_pkt_assign() and cmdq_pkt_write_s_value() to achieve the same functionality. Signed-off-by: Jason-JH.

[PATCH v4] drm/mediatek: Move mtk_crtc_finish_page_flip() to ddp_cmdq_cb()

2024-12-10 Thread Jason-JH . Lin
mtk_crtc_finish_page_flip() is used to notify userspace that a page flip has been completed, allowing userspace to free the frame buffer of the last frame and commit the next frame. In MediaTek's hardware design for configuring display hardware by using GCE, `DRM_EVENT_FLIP_COMPLETE` should be not

[PATCH v2 6/8] soc: mediatek: Add programming flow for unsupported subsys ID hardware

2024-12-10 Thread Jason-JH . Lin
To support hardware without subsys IDs on new SoCs, add a programming flow that checks whether the subsys ID is valid. If the subsys ID is invalid, the flow will call 2 alternative CMDQ APIs: cmdq_pkt_assign() and cmdq_pkt_write_s_value() to achieve the same functionality. Signed-off-by: Jason-JH.

[PATCH v2 8/8] media: mediatek: mdp3: Add programming flow for unsupported subsys ID hardware

2024-12-10 Thread Jason-JH . Lin
To support hardware without subsys IDs on new SoCs, add a programming flow that checks whether the subsys ID is valid. If the subsys ID is invalid, the flow will call 2 alternative CMDQ APIs: cmdq_pkt_assign() and cmdq_pkt_write_s_mask_value() to achieve the same functionality. Signed-off-by: Jaso

[PATCH v2 4/8] soc: mediatek: mtk-cmdq: Add pa_base parsing for unsupported subsys ID hardware

2024-12-10 Thread Jason-JH . Lin
When GCE executes instructions, the corresponding hardware register can be found through the subsys ID. For hardware that does not support subsys IDs, the physical address needs to be used to generate GCE instructions. This commit adds a pa_base parsing flow to the cmdq_client_reg structure for th

[PATCH v2 0/8] Add GCE support for MT8196

2024-12-10 Thread Jason-JH . Lin
From: Jason-jh Lin This patch series adds support for the MediaTek MT8196 SoC in the CMDQ driver and related subsystems. The changes include adding compatible names and properties, updating driver data to accommodate hardware changes, and modifying the usage of CMDQ API to support non-subsys ID

[PATCH v2 2/8] dt-bindings: mailbox: mediatek: Add MT8196 support for gce-mailbox

2024-12-10 Thread Jason-JH . Lin
Add compatible name and iommus property for MT8196. Signed-off-by: Jason-JH.Lin --- .../devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/mailbox/mediatek,gce-mailbox.yaml b/Documentation/devicetr

[PATCH v3] drm/mediatek: Move mtk_crtc_finish_page_flip() to ddp_cmdq_cb()

2024-12-09 Thread Jason-JH . Lin
mtk_crtc_finish_page_flip() is used to notify userspace that a page flip has been completed, allowing userspace to free the frame buffer of the last frame and commit the next frame. In MediaTek's hardware design for configuring display hardware by using GCE, `DRM_EVENT_FLIP_COMPLETE` should be not

[PATCH 0/2] Update MT8188 OVL compatible from MT8183 to MT8195

2024-12-12 Thread Jason-JH . Lin
This patch series updates the compatible strings for the MediaTek OVL in the MT8188 dts and the corresponding dt-binding. The changes ensure that the MT8188 OVL device is correctly identified and managed by the appropriate drivers. The first patch is resending the reviewed and acked patch from: -

<    1   2   3   4   5   6   >