On Thu, Feb 01, 2024 at 02:22:16AM +0000, Keith Zhao wrote:
> 
> 
> 
> 
> > -----Original Message-----
> 
> > From: Maxime Ripard <mrip...@kernel.org>
> 
> > Sent: 2024年1月31日 21:24
> 
> > To: Keith Zhao <keith.z...@starfivetech.com>
> 
> > Cc: devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org;
> 
> > linux-ker...@vger.kernel.org; linux-ri...@lists.infradead.org;
> 
> > tzimmerm...@suse.de; airl...@gmail.com; krzysztof.kozlowski...@linaro.org;
> 
> > William Qiu <william....@starfivetech.com>; Xingyu Wu
> 
> > <xingyu...@starfivetech.com>; paul.walms...@sifive.com;
> 
> > a...@eecs.berkeley.edu; pal...@dabbelt.com; p.za...@pengutronix.de;
> 
> > Shengyang Chen <shengyang.c...@starfivetech.com>; Jack Zhu
> 
> > <jack....@starfivetech.com>; Changhuang Liang
> 
> > <changhuang.li...@starfivetech.com>; maarten.lankho...@linux.intel.com
> 
> > 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 <mrip...@kernel.org<mailto:mrip...@kernel.org>>
> 
> > > > 发送时间: 2023年12月6日 16:56
> 
> > > > 收件人: Keith Zhao 
> > > > <keith.z...@starfivetech.com<mailto:keith.z...@starfivetech.com>>
> 
> > > > 抄送: devicet...@vger.kernel.org<mailto:devicet...@vger.kernel.org>; 
> > > > dri-devel@lists.freedesktop.org<mailto:dri-devel@lists.freedesktop.org>;
> 
> > > > linux-ker...@vger.kernel.org<mailto:linux-ker...@vger.kernel.org>; 
> > > > linux-ri...@lists.infradead.org<mailto:linux-ri...@lists.infradead.org>;
> 
> > > > tzimmerm...@suse.de<mailto:tzimmerm...@suse.de>; 
> > > > airl...@gmail.com<mailto:airl...@gmail.com>;
> 
> > > > krzysztof.kozlowski...@linaro.org<mailto:krzysztof.kozlowski...@linaro.org>;
> 
> > > > William Qiu 
> > > > <william....@starfivetech.com<mailto:william....@starfivetech.com>>; 
> > > > Xingyu Wu
> 
> > > > <xingyu...@starfivetech.com<mailto:xingyu...@starfivetech.com>>; 
> > > > paul.walms...@sifive.com<mailto:paul.walms...@sifive.com>;
> 
> > > > a...@eecs.berkeley.edu<mailto:a...@eecs.berkeley.edu>; 
> > > > pal...@dabbelt.com<mailto:pal...@dabbelt.com>; 
> > > > p.za...@pengutronix.de<mailto:p.za...@pengutronix.de>;
> 
> > > > Shengyang Chen 
> > > > <shengyang.c...@starfivetech.com<mailto:shengyang.c...@starfivetech.com>>;
> > > >  Jack Zhu
> 
> > > > <jack....@starfivetech.com<mailto:jack....@starfivetech.com>>; 
> > > > Changhuang Liang
> 
> > > > <changhuang.li...@starfivetech.com<mailto:changhuang.li...@starfivetech.com>>;
> 
> > > > maarten.lankho...@linux.intel.com<mailto:maarten.lankho...@linux.intel.com>;
> 
> > > > suijingf...@loongson.cn<mailto:suijingf...@loongson.cn>
> 
> > > > 主题: 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

Reply via email to