On Thu, Feb 01, 2024 at 02:22:16AM +0000, Keith Zhao wrote: > > > > > > -----Original Message----- > > > From: Maxime Ripard <mripard@xxxxxxxxxx> > > > Sent: 2024年1月31日 21:24 > > > To: Keith Zhao <keith.zhao@xxxxxxxxxxxxxxxx> > > > Cc: devicetree@xxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx; > > > linux-kernel@xxxxxxxxxxxxxxx; linux-riscv@xxxxxxxxxxxxxxxxxxx; > > > tzimmermann@xxxxxxx; airlied@xxxxxxxxx; krzysztof.kozlowski+dt@xxxxxxxxxx; > > > William Qiu <william.qiu@xxxxxxxxxxxxxxxx>; Xingyu Wu > > > <xingyu.wu@xxxxxxxxxxxxxxxx>; paul.walmsley@xxxxxxxxxx; > > > aou@xxxxxxxxxxxxxxxxx; palmer@xxxxxxxxxxx; p.zabel@xxxxxxxxxxxxxx; > > > Shengyang Chen <shengyang.chen@xxxxxxxxxxxxxxxx>; Jack Zhu > > > <jack.zhu@xxxxxxxxxxxxxxxx>; Changhuang Liang > > > <changhuang.liang@xxxxxxxxxxxxxxxx>; maarten.lankhorst@xxxxxxxxxxxxxxx > > > Subject: Re: [v3 4/6] drm/vs: Add KMS crtc&plane > > > > > > On Wed, Jan 31, 2024 at 09:33:06AM +0000, Keith Zhao wrote: > > > > > > > > > > > > > -----邮件原件----- > > > > > 发件人: Maxime Ripard <mripard@xxxxxxxxxx<mailto:mripard@xxxxxxxxxx>> > > > > > 发送时间: 2023年12月6日 16:56 > > > > > 收件人: Keith Zhao <keith.zhao@xxxxxxxxxxxxxxxx<mailto:keith.zhao@xxxxxxxxxxxxxxxx>> > > > > > 抄送: devicetree@xxxxxxxxxxxxxxx<mailto:devicetree@xxxxxxxxxxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx<mailto:dri-devel@xxxxxxxxxxxxxxxxxxxxx>; > > > > > linux-kernel@xxxxxxxxxxxxxxx<mailto:linux-kernel@xxxxxxxxxxxxxxx>; linux-riscv@xxxxxxxxxxxxxxxxxxx<mailto:linux-riscv@xxxxxxxxxxxxxxxxxxx>; > > > > > tzimmermann@xxxxxxx<mailto:tzimmermann@xxxxxxx>; airlied@xxxxxxxxx<mailto:airlied@xxxxxxxxx>; > > > > > krzysztof.kozlowski+dt@xxxxxxxxxx<mailto:krzysztof.kozlowski+dt@xxxxxxxxxx>; > > > > > William Qiu <william.qiu@xxxxxxxxxxxxxxxx<mailto:william.qiu@xxxxxxxxxxxxxxxx>>; Xingyu Wu > > > > > <xingyu.wu@xxxxxxxxxxxxxxxx<mailto:xingyu.wu@xxxxxxxxxxxxxxxx>>; paul.walmsley@xxxxxxxxxx<mailto:paul.walmsley@xxxxxxxxxx>; > > > > > aou@xxxxxxxxxxxxxxxxx<mailto:aou@xxxxxxxxxxxxxxxxx>; palmer@xxxxxxxxxxx<mailto:palmer@xxxxxxxxxxx>; p.zabel@xxxxxxxxxxxxxx<mailto:p.zabel@xxxxxxxxxxxxxx>; > > > > > Shengyang Chen <shengyang.chen@xxxxxxxxxxxxxxxx<mailto:shengyang.chen@xxxxxxxxxxxxxxxx>>; Jack Zhu > > > > > <jack.zhu@xxxxxxxxxxxxxxxx<mailto:jack.zhu@xxxxxxxxxxxxxxxx>>; Changhuang Liang > > > > > <changhuang.liang@xxxxxxxxxxxxxxxx<mailto:changhuang.liang@xxxxxxxxxxxxxxxx>>; > > > > > maarten.lankhorst@xxxxxxxxxxxxxxx<mailto:maarten.lankhorst@xxxxxxxxxxxxxxx>; > > > > > suijingfeng@xxxxxxxxxxx<mailto:suijingfeng@xxxxxxxxxxx> > > > > > 主题: Re: [v3 4/6] drm/vs: Add KMS crtc&plane > > > > > > > > > > On Mon, Dec 04, 2023 at 08:33:13PM +0800, Keith Zhao wrote: > > > > > > +static const struct vs_plane_info dc_hw_planes_rev0[PLANE_NUM] = { > > > > > > + { > > > > > > + .name = "Primary", > > > > > > + .id = PRIMARY_PLANE_0, > > > > > > + .type = DRM_PLANE_TYPE_PRIMARY, > > > > > > + .num_formats = ARRAY_SIZE(primary_overlay_format0), > > > > > > + .formats = primary_overlay_format0, > > > > > > + .num_modifiers = ARRAY_SIZE(format_modifier0), > > > > > > + .modifiers = format_modifier0, > > > > > > + .min_width = 0, > > > > > > + .min_height = 0, > > > > > > + .max_width = 4096, > > > > > > + .max_height = 4096, > > > > > > + .rotation = DRM_MODE_ROTATE_0 | > > > > > > + DRM_MODE_ROTATE_90 | > > > > > > + DRM_MODE_ROTATE_180 | > > > > > > + DRM_MODE_ROTATE_270 | > > > > > > + DRM_MODE_REFLECT_X | > > > > > > + DRM_MODE_REFLECT_Y, > > > > > > + .blend_mode = BIT(DRM_MODE_BLEND_PIXEL_NONE) | > > > > > > + BIT(DRM_MODE_BLEND_PREMULTI) | > > > > > > + BIT(DRM_MODE_BLEND_COVERAGE), > > > > > > + .color_encoding = BIT(DRM_COLOR_YCBCR_BT709) | > > > > > > + BIT(DRM_COLOR_YCBCR_BT2020), > > > > > > + .degamma_size = DEGAMMA_SIZE, > > > > > > + .min_scale = FRAC_16_16(1, 3), > > > > > > + .max_scale = FRAC_16_16(10, 1), > > > > > > + .zpos = 0, > > > > > > + .watermark = true, > > > > > > + .color_mgmt = true, > > > > > > + .roi = true, > > > > > > + }, > > > > > > + { > > > > > > + .name = "Overlay", > > > > > > + .id = OVERLAY_PLANE_0, > > > > > > + .type = DRM_PLANE_TYPE_OVERLAY, > > > > > > + .num_formats = ARRAY_SIZE(primary_overlay_format0), > > > > > > + .formats = primary_overlay_format0, > > > > > > + .num_modifiers = ARRAY_SIZE(format_modifier0), > > > > > > + .modifiers = format_modifier0, > > > > > > + .min_width = 0, > > > > > > + .min_height = 0, > > > > > > + .max_width = 4096, > > > > > > + .max_height = 4096, > > > > > > + .rotation = DRM_MODE_ROTATE_0 | > > > > > > + DRM_MODE_ROTATE_90 | > > > > > > + DRM_MODE_ROTATE_180 | > > > > > > + DRM_MODE_ROTATE_270 | > > > > > > + DRM_MODE_REFLECT_X | > > > > > > + DRM_MODE_REFLECT_Y, > > > > > > + .blend_mode = BIT(DRM_MODE_BLEND_PIXEL_NONE) | > > > > > > + BIT(DRM_MODE_BLEND_PREMULTI) | > > > > > > + BIT(DRM_MODE_BLEND_COVERAGE), > > > > > > + .color_encoding = BIT(DRM_COLOR_YCBCR_BT709) | > > > > > > + BIT(DRM_COLOR_YCBCR_BT2020), > > > > > > + .degamma_size = DEGAMMA_SIZE, > > > > > > + .min_scale = FRAC_16_16(1, 3), > > > > > > + .max_scale = FRAC_16_16(10, 1), > > > > > > + .zpos = 1, > > > > > > + .watermark = true, > > > > > > + .color_mgmt = true, > > > > > > + .roi = true, > > > > > > + }, > > > > > > + { > > > > > > + .name = "Overlay_1", > > > > > > + .id = OVERLAY_PLANE_1, > > > > > > + .type = DRM_PLANE_TYPE_OVERLAY, > > > > > > + .num_formats = ARRAY_SIZE(primary_overlay_format0), > > > > > > + .formats = primary_overlay_format0, > > > > > > + .num_modifiers = > > > ARRAY_SIZE(secondary_format_modifiers), > > > > > > + .modifiers = secondary_format_modifiers, > > > > > > + .min_width = 0, > > > > > > + .min_height = 0, > > > > > > + .max_width = 4096, > > > > > > + .max_height = 4096, > > > > > > + .rotation = 0, > > > > > > + .blend_mode = BIT(DRM_MODE_BLEND_PIXEL_NONE) | > > > > > > + BIT(DRM_MODE_BLEND_PREMULTI) | > > > > > > + BIT(DRM_MODE_BLEND_COVERAGE), > > > > > > + .color_encoding = BIT(DRM_COLOR_YCBCR_BT709) | > > > > > > + BIT(DRM_COLOR_YCBCR_BT2020), > > > > > > + .degamma_size = DEGAMMA_SIZE, > > > > > > + .min_scale = DRM_PLANE_NO_SCALING, > > > > > > + .max_scale = DRM_PLANE_NO_SCALING, > > > > > > + .zpos = 2, > > > > > > + .watermark = true, > > > > > > + .color_mgmt = true, > > > > > > + .roi = true, > > > > > > + }, > > > > > > + { > > > > > > + .name = "Primary_1", > > > > > > + .id = PRIMARY_PLANE_1, > > > > > > + .type = DRM_PLANE_TYPE_PRIMARY, > > > > > > + .num_formats = ARRAY_SIZE(primary_overlay_format0), > > > > > > + .formats = primary_overlay_format0, > > > > > > + .num_modifiers = ARRAY_SIZE(format_modifier0), > > > > > > + .modifiers = format_modifier0, > > > > > > + .min_width = 0, > > > > > > + .min_height = 0, > > > > > > + .max_width = 4096, > > > > > > + .max_height = 4096, > > > > > > + .rotation = DRM_MODE_ROTATE_0 | > > > > > > + DRM_MODE_ROTATE_90 | > > > > > > + DRM_MODE_ROTATE_180 | > > > > > > + DRM_MODE_ROTATE_270 | > > > > > > + DRM_MODE_REFLECT_X | > > > > > > + DRM_MODE_REFLECT_Y, > > > > > > + .blend_mode = BIT(DRM_MODE_BLEND_PIXEL_NONE) | > > > > > > + BIT(DRM_MODE_BLEND_PREMULTI) | > > > > > > + BIT(DRM_MODE_BLEND_COVERAGE), > > > > > > + .color_encoding = BIT(DRM_COLOR_YCBCR_BT709) | > > > > > > + BIT(DRM_COLOR_YCBCR_BT2020), > > > > > > + .degamma_size = DEGAMMA_SIZE, > > > > > > + .min_scale = FRAC_16_16(1, 3), > > > > > > + .max_scale = FRAC_16_16(10, 1), > > > > > > + .zpos = 3, > > > > > > + .watermark = true, > > > > > > + .color_mgmt = true, > > > > > > + .roi = true, > > > > > > + }, > > > > > > + { > > > > > > + .name = "Overlay_2", > > > > > > + .id = OVERLAY_PLANE_2, > > > > > > + .type = DRM_PLANE_TYPE_OVERLAY, > > > > > > + .num_formats = ARRAY_SIZE(primary_overlay_format0), > > > > > > + .formats = primary_overlay_format0, > > > > > > + .num_modifiers = ARRAY_SIZE(format_modifier0), > > > > > > + .modifiers = format_modifier0, > > > > > > + .min_width = 0, > > > > > > + .min_height = 0, > > > > > > + .max_width = 4096, > > > > > > + .max_height = 4096, > > > > > > + .rotation = DRM_MODE_ROTATE_0 | > > > > > > + DRM_MODE_ROTATE_90 | > > > > > > + DRM_MODE_ROTATE_180 | > > > > > > + DRM_MODE_ROTATE_270 | > > > > > > + DRM_MODE_REFLECT_X | > > > > > > + DRM_MODE_REFLECT_Y, > > > > > > + .blend_mode = BIT(DRM_MODE_BLEND_PIXEL_NONE) | > > > > > > + BIT(DRM_MODE_BLEND_PREMULTI) | > > > > > > + BIT(DRM_MODE_BLEND_COVERAGE), > > > > > > + .color_encoding = BIT(DRM_COLOR_YCBCR_BT709) | > > > > > > + BIT(DRM_COLOR_YCBCR_BT2020), > > > > > > + .degamma_size = DEGAMMA_SIZE, > > > > > > + .min_scale = FRAC_16_16(1, 3), > > > > > > + .max_scale = FRAC_16_16(10, 1), > > > > > > + .zpos = 4, > > > > > > + .watermark = true, > > > > > > + .color_mgmt = true, > > > > > > + .roi = true, > > > > > > + }, > > > > > > + { > > > > > > + .name = "Overlay_3", > > > > > > + .id = OVERLAY_PLANE_3, > > > > > > + .type = DRM_PLANE_TYPE_OVERLAY, > > > > > > + .num_formats = ARRAY_SIZE(primary_overlay_format0), > > > > > > + .formats = primary_overlay_format0, > > > > > > + .num_modifiers = > > > ARRAY_SIZE(secondary_format_modifiers), > > > > > > + .modifiers = secondary_format_modifiers, > > > > > > + .min_width = 0, > > > > > > + .min_height = 0, > > > > > > + .max_width = 4096, > > > > > > + .max_height = 4096, > > > > > > + .rotation = 0, > > > > > > + .blend_mode = BIT(DRM_MODE_BLEND_PIXEL_NONE) | > > > > > > + BIT(DRM_MODE_BLEND_PREMULTI) | > > > > > > + BIT(DRM_MODE_BLEND_COVERAGE), > > > > > > + .color_encoding = BIT(DRM_COLOR_YCBCR_BT709) | > > > > > > + BIT(DRM_COLOR_YCBCR_BT2020), > > > > > > + .degamma_size = DEGAMMA_SIZE, > > > > > > + .min_scale = DRM_PLANE_NO_SCALING, > > > > > > + .max_scale = DRM_PLANE_NO_SCALING, > > > > > > + .zpos = 5, > > > > > > + .watermark = true, > > > > > > + .color_mgmt = true, > > > > > > + .roi = true, > > > > > > + }, > > > > > > + { > > > > > > + .name = "Cursor", > > > > > > + .id = CURSOR_PLANE_0, > > > > > > + .type = DRM_PLANE_TYPE_CURSOR, > > > > > > + .num_formats = ARRAY_SIZE(cursor_formats), > > > > > > + .formats = cursor_formats, > > > > > > + .num_modifiers = 0, > > > > > > + .modifiers = NULL, > > > > > > + .min_width = 32, > > > > > > + .min_height = 32, > > > > > > + .max_width = 64, > > > > > > + .max_height = 64, > > > > > > + .rotation = 0, > > > > > > + .degamma_size = 0, > > > > > > + .min_scale = DRM_PLANE_NO_SCALING, > > > > > > + .max_scale = DRM_PLANE_NO_SCALING, > > > > > > + .zpos = 255, > > > > > > + .watermark = false, > > > > > > + .color_mgmt = false, > > > > > > + .roi = false, > > > > > > + }, > > > > > > + { > > > > > > + .name = "Cursor_1", > > > > > > + .id = CURSOR_PLANE_1, > > > > > > + .type = DRM_PLANE_TYPE_CURSOR, > > > > > > + .num_formats = ARRAY_SIZE(cursor_formats), > > > > > > + .formats = cursor_formats, > > > > > > + .num_modifiers = 0, > > > > > > + .modifiers = NULL, > > > > > > + .min_width = 32, > > > > > > + .min_height = 32, > > > > > > + .max_width = 64, > > > > > > + .max_height = 64, > > > > > > + .rotation = 0, > > > > > > + .degamma_size = 0, > > > > > > + .min_scale = DRM_PLANE_NO_SCALING, > > > > > > + .max_scale = DRM_PLANE_NO_SCALING, > > > > > > + .zpos = 255, > > > > > > + .watermark = false, > > > > > > + .color_mgmt = false, > > > > > > + .roi = false, > > > > > > + }, > > > > > > +}; > > > > > > + > > > > > > +static const struct vs_dc_info dc8200_info = { > > > > > > + .name = "DC8200", > > > > > > + .panel_num = 2, > > > > > > + .plane_num = 8, > > > > > > + .planes = dc_hw_planes_rev0, > > > > > > + .layer_num = 6, > > > > > > + .max_bpc = 10, > > > > > > + .color_formats = DRM_COLOR_FORMAT_RGB444 | > > > > > > + DRM_COLOR_FORMAT_YCBCR444 | > > > > > > + DRM_COLOR_FORMAT_YCBCR422 | > > > > > > + DRM_COLOR_FORMAT_YCBCR420, > > > > > > + .gamma_size = GAMMA_EX_SIZE, > > > > > > + .gamma_bits = 12, > > > > > > + .pitch_alignment = 128, > > > > > > + .pipe_sync = false, > > > > > > + .background = true, > > > > > > + .panel_sync = true, > > > > > > + .cap_dec = true, > > > > > > +}; > > > > > > > > > > I really think that entire thing is to workaround a suboptimal device tree > > > binding. > > > > > You should have two CRTCs in the device tree, you'll probe twice, > > > > > and you won't get to do that whole dance. > > > > > > > > > > > > I tried to modify it according to this idea Found it too difficult In > > > > terms of hardware, the two crtc designs are too close to separate, and > > > > they are even designed into the same reg with different bits > > > > representing crtc0 and crtc1. It seems not easy to described the 2 > > > > ctrc hardware by 2 device nodes > > > > > > What are these bits doing? > > > > [cid:image001.png@01DA54F5.ECEA9C10] > > For example: > > like this , bit0 and bit1 match ctrc0 and crtc1 , it is used to start crtc > > A similar situation exists for other register definitions. > > > > Another case is that ctrc0 and crtc1 have the same function and their offset is continuous, > > instead of crtc0 being a continuous area, crtc1 being a continuous area > > reg: > > crtc0 X > > crtc1 X+4 > > crtc0 X+8 > > crtc1 X+12 > > if to make it two separate devices, the device node dts reg attribute would be complex Yeah, ok, that makes sense then. In which case, if we're going to have one big device in the DT with all the planes and CRTCs, why do we need the display-subsystem device? Just make your driver probe on the dc8200 device. Maxime
Attachment:
signature.asc
Description: PGP signature