drm/ast: Add BMC virtual connector
Subsystems (3)
Jocelyn Falempe
reviewerPATCH v3 1/2 drm/ast: Add BMC virtual connector
Most aspeed devices have a BMC, which allows to remotely see the screen. Also in the common use case, those servers don't have a display connected. So add a Virtual connector, to reflect that even if no display is connected, the framebuffer can still be seen remotely.
This prepares the work to implement a detect_ctx() for the Display port connector.
--- drivers/gpu/drm/ast/ast_drv.h | 4 ++ drivers/gpu/drm/ast/ast_mode.c | 67 ++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+)
drivers/gpu/drm/ast/ast_drv.h +4 -0
@@ -214,6 +214,10 @@ struct ast_device {struct drm_encoder encoder;struct drm_connector connector; } astdp; +struct { +struct drm_encoder encoder; +struct drm_connector connector; + } bmc; } output;bool support_wide_screen;
drivers/gpu/drm/ast/ast_mode.c +67 -0
79 lines not on this page · raw message
base-commit: b32d5a51f3c21843011d68a58e6ac0b897bce9f2
Signature · 1 line
2.41.0
Jocelyn Falempe
reviewerPATCH v3 2/2 drm/ast: report connection status on Display Port.
Aspeed always report the display port as "connected", because it doesn't set a .detect callback.
Fix this by providing the proper detect callback for astdp and dp501.
This also fixes the following regression:
Since commit fae7d186403e ("drm/probe-helper: Default to 640x480 if no EDID on DP")
The default resolution is now 640x480 when no monitor is connected. But Aspeed graphics is mostly used in servers, where no monitor is attached. This also affects the remote BMC resolution to 640x480, which is inconvenient, and breaks the anaconda installer.
v2: Add .detect callback to the dp/dp501 connector (Jani Nikula)
v3: Use .detect_ctx callback, and refactors (Thomas Zimmermann)
Add a BMC virtual connector
--- drivers/gpu/drm/ast/ast_dp.c | 11 ++++++++++ drivers/gpu/drm/ast/ast_dp501.c | 37 ++++++++++++++++++++++----------- drivers/gpu/drm/ast/ast_drv.h | 2 ++ drivers/gpu/drm/ast/ast_mode.c | 27 ++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 12 deletions(-)
drivers/gpu/drm/ast/ast_dp.c +11 -0
@@ -7,6 +7,17 @@#include <drm/drm_print.h> #include "ast_drv.h" +bool ast_astdp_is_connected (struct ast_device *ast) +{ +if (!ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xD1 ,ASTDP_MCU_FW_EXECUTING )) +return false; +if (!ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xDC ,ASTDP_LINK_SUCCESS )) +return false; +if (!ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xDF ,ASTDP_HPD )) +return false; +return true; +} +int ast_astdp_read_edid (struct drm_device *dev,u8 *ediddata) {struct ast_device *ast =to_ast_device (dev);
drivers/gpu/drm/ast/ast_dp501.c +25 -12
@@ -272,11 +272,9 @@ static bool ast_launch_m68k(struct drm_device *dev)return true; } -bool ast_dp501_read_edid (struct drm_device *dev,u8 *ediddata) +bool ast_dp501_is_connected (struct ast_device *ast) { -struct ast_device *ast =to_ast_device (dev); -u32 i, boot_address, offset, data; -u32 *pEDIDidx; +u32 boot_address, offset, data;if (ast->config_mode == ast_use_p2a) { boot_address =get_fw_base (ast);
@@ -292,14 +290,6 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) data =ast_mindwm (ast, boot_address + offset);if (!(data &AST_DP501_PNP_CONNECTED ))return false; - -/* Read EDID */ - offset =AST_DP501_EDID_DATA ; -for (i =0 ; i <128 ; i +=4 ) { - data =ast_mindwm (ast, boot_address + offset + i); - pEDIDidx = (u32 *)(ediddata + i); - *pEDIDidx = data; - } }else {if (!ast->dp501_fw_buf)return false;
@@ -319,7 +309,30 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) data =readl (ast->dp501_fw_buf + offset);if (!(data &AST_DP501_PNP_CONNECTED ))return false; + } +return true; +} + +bool ast_dp501_read_edid (struct drm_device *dev,u8 *ediddata) +{ +struct ast_device *ast =to_ast_device (dev); +u32 i, boot_address, offset, data; +u32 *pEDIDidx; + +if (!ast_dp501_is_connected (ast)) +return false; + +if (ast->config_mode == ast_use_p2a) { + boot_address =get_fw_base (ast); +/* Read EDID */ + offset =AST_DP501_EDID_DATA ; +for (i =0 ; i <128 ; i +=4 ) { + data =ast_mindwm (ast, boot_address + offset + i); + pEDIDidx = (u32 *)(ediddata + i); + *pEDIDidx = data; + } + }else {/* Read EDID */ offset =AST_DP501_EDID_DATA ;for (i =0 ; i <128 ; i +=4 ) {
drivers/gpu/drm/ast/ast_drv.h +2 -0
@@ -514,6 +514,7 @@ void ast_patch_ahb_2500(struct ast_device *ast);/* ast dp501 */ void ast_set_dp501_video_output (struct drm_device *dev,u8 mode);bool ast_backup_fw (struct drm_device *dev,u8 *addr,u32 size); +bool ast_dp501_is_connected (struct ast_device *ast);bool ast_dp501_read_edid (struct drm_device *dev,u8 *ediddata);u8 ast_get_dp501_max_clk (struct drm_device *dev);void ast_init_3rdtx (struct drm_device *dev);
@@ -522,6 +523,7 @@ void ast_init_3rdtx(struct drm_device *dev);struct ast_i2c_chan *ast_i2c_create (struct drm_device *dev);/* aspeed DP */ +bool ast_astdp_is_connected (struct ast_device *ast);int ast_astdp_read_edid (struct drm_device *dev,u8 *ediddata);void ast_dp_launch (struct drm_device *dev);void ast_dp_power_on_off (struct drm_device *dev,bool no);
drivers/gpu/drm/ast/ast_mode.c +27 -0
@@ -1582,8 +1582,22 @@ static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)return 0 ; } +static int ast_dp501_connector_helper_detect_ctx ( +struct drm_connector *connector, +struct drm_modeset_acquire_ctx *ctx, +bool force) +{ +struct ast_device *ast =to_ast_device (connector->dev); + +if (ast_dp501_is_connected (ast)) +return connector_status_connected; +return connector_status_disconnected; +} + +static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs = { .get_modes = ast_dp501_connector_helper_get_modes, + .detect_ctx = ast_dp501_connector_helper_detect_ctx, };static const struct drm_connector_funcs ast_dp501_connector_funcs = {
@@ -1680,8 +1694,21 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)return 0 ; } +static int ast_astdp_connector_helper_detect_ctx ( +struct drm_connector *connector, +struct drm_modeset_acquire_ctx *ctx, +bool force) +{ +struct ast_device *ast =to_ast_device (connector->dev); + +if (ast_astdp_is_connected (ast)) +return connector_status_connected; +return connector_status_disconnected; +} +static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = { .get_modes = ast_astdp_connector_helper_get_modes, + .detect_ctx = ast_astdp_connector_helper_detect_ctx, };static const struct drm_connector_funcs ast_astdp_connector_funcs = {
Signature · 1 line
2.41.0
Re: [PATCH v3 2/2] drm/ast: report connection status on Display Port.
Hi
Am 12.07.23 um 10:35 schrieb Jocelyn Falempe:
Quoted 12 lines
Aspeed always report the display port as "connected", because it doesn't set a .detect callback.
Fix this by providing the proper detect callback for astdp and dp501.This also fixes the following regression:
Since commitfae7d186403e("drm/probe-helper: Default to 640x480 if no EDID on DP")
The default resolution is now 640x480 when no monitor is connected. But Aspeed graphics is mostly used in servers, where no monitor is attached. This also affects the remote BMC resolution to 640x480, which is inconvenient, and breaks the anaconda installer.
Quoted 6 lines
v2: Add .detect callback to the dp/dp501 connector (Jani Nikula)
v3: Use .detect_ctx callback, and refactors (Thomas Zimmermann)
Add a BMC virtual connectorFixes fae7d186403e ("drm/probe-helper: Default to 640x480 if no EDID on DP")Signed-off-by Jocelyn Falempe <[email protected]>
with a minor comment below.
Quoted 118 lines
--- drivers/gpu/drm/ast/ast_dp.c | 11 ++++++++++ drivers/gpu/drm/ast/ast_dp501.c | 37 ++++++++++++++++++++++----------- drivers/gpu/drm/ast/ast_drv.h | 2 ++ drivers/gpu/drm/ast/ast_mode.c | 27 ++++++++++++++++++++++++ 4 files changed, 65 insertions(+), 12 deletions(-)drivers/gpu/drm/ast/ast_dp.c +11
-0@@ -7,6 +7,17 @@#include <drm/drm_print.h> #include "ast_drv.h" +bool ast_astdp_is_connected (struct ast_device *ast) +{ +if (!ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xD1 ,ASTDP_MCU_FW_EXECUTING )) +return false; +if (!ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xDC ,ASTDP_LINK_SUCCESS )) +return false; +if (!ast_get_index_reg_mask (ast,AST_IO_CRTC_PORT ,0xDF ,ASTDP_HPD )) +return false; +return true; +} +int ast_astdp_read_edid (struct drm_device *dev,u8 *ediddata) {struct ast_device *ast =to_ast_device (dev);drivers/gpu/drm/ast/ast_dp501.c +25
-12@@ -272,11 +272,9 @@ static bool ast_launch_m68k(struct drm_device *dev)return true; } -bool ast_dp501_read_edid (struct drm_device *dev,u8 *ediddata) +bool ast_dp501_is_connected (struct ast_device *ast) { -struct ast_device *ast =to_ast_device (dev); -u32 i, boot_address, offset, data; -u32 *pEDIDidx; +u32 boot_address, offset, data;if (ast->config_mode == ast_use_p2a) { boot_address =get_fw_base (ast);@@ -292,14 +290,6 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) data =ast_mindwm (ast, boot_address + offset);if (!(data &AST_DP501_PNP_CONNECTED ))return false; - -/* Read EDID */ - offset =AST_DP501_EDID_DATA ; -for (i =0 ; i <128 ; i +=4 ) { - data =ast_mindwm (ast, boot_address + offset + i); - pEDIDidx = (u32 *)(ediddata + i); - *pEDIDidx = data; - } }else {if (!ast->dp501_fw_buf)return false;@@ -319,7 +309,30 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) data =readl (ast->dp501_fw_buf + offset);if (!(data &AST_DP501_PNP_CONNECTED ))return false; + } +return true; +} + +bool ast_dp501_read_edid (struct drm_device *dev,u8 *ediddata) +{ +struct ast_device *ast =to_ast_device (dev); +u32 i, boot_address, offset, data; +u32 *pEDIDidx; + +if (!ast_dp501_is_connected (ast)) +return false; + +if (ast->config_mode == ast_use_p2a) { + boot_address =get_fw_base (ast); +/* Read EDID */ + offset =AST_DP501_EDID_DATA ; +for (i =0 ; i <128 ; i +=4 ) { + data =ast_mindwm (ast, boot_address + offset + i); + pEDIDidx = (u32 *)(ediddata + i); + *pEDIDidx = data; + } + }else {/* Read EDID */ offset =AST_DP501_EDID_DATA ;for (i =0 ; i <128 ; i +=4 ) {drivers/gpu/drm/ast/ast_drv.h +2
-0@@ -514,6 +514,7 @@ void ast_patch_ahb_2500(struct ast_device *ast);/* ast dp501 */ void ast_set_dp501_video_output (struct drm_device *dev,u8 mode);bool ast_backup_fw (struct drm_device *dev,u8 *addr,u32 size); +bool ast_dp501_is_connected (struct ast_device *ast);bool ast_dp501_read_edid (struct drm_device *dev,u8 *ediddata);u8 ast_get_dp501_max_clk (struct drm_device *dev);void ast_init_3rdtx (struct drm_device *dev);@@ -522,6 +523,7 @@ void ast_init_3rdtx(struct drm_device *dev);struct ast_i2c_chan *ast_i2c_create (struct drm_device *dev);/* aspeed DP */ +bool ast_astdp_is_connected (struct ast_device *ast);int ast_astdp_read_edid (struct drm_device *dev,u8 *ediddata);void ast_dp_launch (struct drm_device *dev);void ast_dp_power_on_off (struct drm_device *dev,bool no);drivers/gpu/drm/ast/ast_mode.c +0
-0
drivers/gpu/drm/ast/ast_mode.c static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector) · line 1588
Quoted 7 lines
drivers/gpu/drm/ast/ast_mode.c +4
-0@@ -1582,8 +1582,22 @@ static int ast_dp501_connector_helper_get_modes(struct drm_connector *connector)return 0 ; } +static int ast_dp501_connector_helper_detect_ctx ( +struct drm_connector *connector, +struct drm_modeset_acquire_ctx *ctx, +bool force)
If this fits within the 100-char limit prt line, it would be preferable to move the first argument to first line.
Quoted 16 lines
drivers/gpu/drm/ast/ast_mode.c +10
-0+{ +struct ast_device *ast =to_ast_device (connector->dev); + +if (ast_dp501_is_connected (ast)) +return connector_status_connected; +return connector_status_disconnected; +} + +static const struct drm_connector_helper_funcs ast_dp501_connector_helper_funcs = { .get_modes = ast_dp501_connector_helper_get_modes, + .detect_ctx = ast_dp501_connector_helper_detect_ctx, };static const struct drm_connector_funcs ast_dp501_connector_funcs = {
drivers/gpu/drm/ast/ast_mode.c static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector) · line 1700
Quoted 7 lines
drivers/gpu/drm/ast/ast_mode.c +4
-0@@ -1680,8 +1694,21 @@ static int ast_astdp_connector_helper_get_modes(struct drm_connector *connector)return 0 ; } +static int ast_astdp_connector_helper_detect_ctx ( +struct drm_connector *connector, +struct drm_modeset_acquire_ctx *ctx, +bool force)
Same here.
Best regards
Thomas
Quoted 14 lines
drivers/gpu/drm/ast/ast_mode.c +9
-0+{ +struct ast_device *ast =to_ast_device (connector->dev); + +if (ast_astdp_is_connected (ast)) +return connector_status_connected; +return connector_status_disconnected; +} +static const struct drm_connector_helper_funcs ast_astdp_connector_helper_funcs = { .get_modes = ast_astdp_connector_helper_get_modes, + .detect_ctx = ast_astdp_connector_helper_detect_ctx, };static const struct drm_connector_funcs ast_astdp_connector_funcs = {
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Thomas Zimmermann
maintainerHi,
thanks for this patch.
Am 12.07.23 um 10:35 schrieb Jocelyn Falempe:
Quoted 34 lines
Most aspeed devices have a BMC, which allows to remotely see the screen. Also in the common use case, those servers don't have a display connected. So add a Virtual connector, to reflect that even if no display is connected, the framebuffer can still be seen remotely.
This prepares the work to implement adetect_ctx()for the Display port connector.Fixes fae7d186403e ("drm/probe-helper: Default to 640x480 if no EDID on DP")Signed-off-by Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/ast/ast_drv.h | 4 ++ drivers/gpu/drm/ast/ast_mode.c | 67 ++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+)drivers/gpu/drm/ast/ast_drv.h +4
-0@@ -214,6 +214,10 @@ struct ast_device {struct drm_encoder encoder;struct drm_connector connector; } astdp; +struct { +struct drm_encoder encoder; +struct drm_connector connector; + } bmc; } output;bool support_wide_screen;drivers/gpu/drm/ast/ast_mode.c +0
-0
drivers/gpu/drm/ast/ast_mode.c static int ast_astdp_output_init(struct ast_device *ast) · line 1744
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +7
-0@@ -1735,6 +1735,70 @@ static int ast_astdp_output_init(struct ast_device *ast)return 0 ; } +/* +* BMC virtual Connector +*/ + +static int ast_bmc_connector_helper_get_modes (struct drm_connector *connector) +{ +return drm_add_modes_noedid (connector,1024 ,768 );
That's probably too small. The CRTC lists resolutions up to 1920x1200. Returning 1024x768 could easily filter out those higher-res modes.
The BMC can probably just use whatever the CRTC offers. So rather call drm_add_modes_noedid() with 4096x4096. At 32 bpp, this covers the max memory of 64 MiB. The CRTC will filter out unsupported modes.
Quoted 19 lines
drivers/gpu/drm/ast/ast_mode.c +19
-0+} + +static const struct drm_connector_helper_funcs ast_bmc_connector_helper_funcs = { + .get_modes = ast_bmc_connector_helper_get_modes, +}; + +static const struct drm_connector_funcs ast_bmc_connector_funcs = { + .reset = drm_atomic_helper_connector_reset, + .fill_modes = drm_helper_probe_single_connector_modes, + .destroy = drm_connector_cleanup, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, +}; + +static int ast_bmc_connector_init (struct drm_device *dev, +struct drm_connector *connector) +{ +int ret; +
drivers/gpu/drm/ast/ast_mode.c static int ast_astdp_output_init(struct ast_device *ast) · line 1773
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +10
-0+ ret =drm_connector_init (dev, connector, &ast_bmc_connector_funcs, +DRM_MODE_CONNECTOR_VIRTUAL ); +if (ret) +return ret; + +drm_connector_helper_add (connector, &ast_bmc_connector_helper_funcs); + + connector->interlace_allowed =0 ; + connector->doublescan_allowed =0 ; + connector->polled =0 ;
It's zero-allocated memory. Please don't clear these fields manually. (I know that ast doesn't get this right.)
drivers/gpu/drm/ast/ast_mode.c static int ast_astdp_output_init(struct ast_device *ast) · line 1786
Quoted 13 lines
drivers/gpu/drm/ast/ast_mode.c +13
-0+ +return 0 ; +} + +static int ast_bmc_output_init (struct ast_device *ast) +{ +struct drm_device *dev = &ast->base; +struct drm_crtc *crtc = &ast->crtc; +struct drm_encoder *encoder = &ast->output.bmc.encoder; +struct drm_connector *connector = &ast->output.bmc.connector; +int ret; + + ret =drm_simple_encoder_init (dev, encoder,DRM_MODE_ENCODER_VIRTUAL );
Adding the simple_encoder helper was a mistake. Please open-code its functionality in ast. (Also something that ast currently does not.)
drivers/gpu/drm/ast/ast_mode.c static int ast_astdp_output_init(struct ast_device *ast) · line 1791
Quoted 5 lines
drivers/gpu/drm/ast/ast_mode.c +5
-0+if (ret) +return ret; + encoder->possible_crtcs =drm_crtc_mask (crtc); + + ret =ast_bmc_connector_init (dev, connector);
Maybe just inline this call. It's simple enough.
Best regards
Thomas
Quoted 25 lines
drivers/gpu/drm/ast/ast_mode.c +13
-0+if (ret) +return ret; + + ret =drm_connector_attach_encoder (connector, encoder); +if (ret) +return ret; + +return 0 ; +} +/* * Mode config */ @@ -1842,6 +1906,9 @@ int ast_mode_config_init(struct ast_device *ast)if (ret)return ret; } + ret =ast_bmc_output_init (ast); +if (ret) +return ret;drm_mode_config_reset (dev);base-commit:
b32d5a51f3c21843011d68a58e6ac0b897bce9f2
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Jocelyn Falempe
reviewerQuoted 52 lines · Thomas Zimmermann
Hi,
thanks for this patch.
Am 12.07.23 um 10:35 schrieb Jocelyn Falempe:
Quoted 34 lines
Most aspeed devices have a BMC, which allows to remotely see the screen. Also in the common use case, those servers don't have a display connected. So add a Virtual connector, to reflect that even if no display is connected, the framebuffer can still be seen remotely.
This prepares the work to implement adetect_ctx()for the Display port connector.Fixes fae7d186403e ("drm/probe-helper: Default to 640x480 if no EDID on DP")Signed-off-by Jocelyn Falempe <[email protected]>---
drivers/gpu/drm/ast/ast_drv.h | 4 ++drivers/gpu/drm/ast/ast_mode.c| 67 ++++++++++++++++++++++++++++++++++2 files changed, 71 insertions(+)drivers/gpu/drm/ast/ast_drv.h +4
-0@@ -214,6 +214,10 @@ struct ast_device { struct drm_encoder encoder; struct drm_connector connector; } astdp; + struct { + struct drm_encoder encoder; + struct drm_connector connector; + } bmc; } output; bool support_wide_screen;drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -1735,6 +1735,70 @@ static int ast_astdp_output_init(struct ast_device *ast)drivers/gpu/drm/ast/ast_mode.c static int ast_astdp_output_init(struct · line 1745
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +7
-0return 0; } +/* +* BMC virtual Connector +*/ + +static int ast_bmc_connector_helper_get_modes (struct drm_connector *connector) +{ + return drm_add_modes_noedid(connector, 1024, 768);That's probably too small. The CRTC lists resolutions up to 1920x1200. Returning 1024x768 could easily filter out those higher-res modes.
Quoted 1 line
The BMC can probably just use whatever the CRTC offers. So rather call
drm_add_modes_noedid()with 4096x4096. At 32 bpp, this covers the max memory of 64 MiB. The CRTC will filter out unsupported modes.
Thanks for pointing this, I didn't realize it will prevent higher resolutions. With this change, the bmc resolution becomes 1920x1200 (with "disabled vga" and no DP connected), which is much nicer.
With vga, it stays at 1024x768. So maybe adding a .detect_ctx() for vga too would be worth it. But that's for another series.
Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/ast/ast_mode.c +24
-0+} + +static const struct drm_connector_helper_funcs ast_bmc_connector_helper_funcs = { + .get_modes = ast_bmc_connector_helper_get_modes, +}; + +static const struct drm_connector_funcs ast_bmc_connector_funcs = { + .reset = drm_atomic_helper_connector_reset, + .fill_modes = drm_helper_probe_single_connector_modes, + .destroy = drm_connector_cleanup, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, +}; + +static int ast_bmc_connector_init (struct drm_device *dev, + struct drm_connector *connector) +{ + int ret; + + ret = drm_connector_init(dev, connector, &ast_bmc_connector_funcs, + DRM_MODE_CONNECTOR_VIRTUAL); + if (ret) + return ret; +
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +1
-0+ drm_connector_helper_add(connector,
&ast_bmc_connector_helper_funcs);
+
+connector->interlace_allowed= 0;
+connector->doublescan_allowed= 0;
+connector->polled= 0;It's zero-allocated memory. Please don't clear these fields manually. (I know that ast doesn't get this right.)
Done
Quoted 17 lines
Quoted 14 lines
drivers/gpu/drm/ast/ast_mode.c +13
-0+ + return 0; +} + +static int ast_bmc_output_init (struct ast_device *ast) +{ + struct drm_device *dev = &ast->base; + struct drm_crtc *crtc = &ast->crtc; + struct drm_encoder *encoder = &ast->output.bmc.encoder; + struct drm_connector *connector = &ast->output.bmc.connector; + int ret; + + ret = drm_simple_encoder_init(dev, encoder,Quoted 1 line
DRM_MODE_ENCODER_VIRTUAL);Adding the
simple_encoderhelper was a mistake. Please open-code its functionality in ast. (Also something that ast currently does not.)
ok, it's simple enough to call drm_encoder_init() directly.
Quoted 8 lines
Quoted 6 lines
+ if (ret)
+ return ret;
+encoder->possible_crtcs=drm_crtc_mask(crtc); +
+ ret =ast_bmc_connector_init(dev, connector);Maybe just inline this call. It's simple enough.
Done
Quoted 3 lines
Best regards
Thomas
Thanks for the review, I will push a v4 shortly.
Signature · 1 line
Jocelyn
Quoted 25 lines
Quoted 24 lines
+ if (ret)
+ return ret;drivers/gpu/drm/ast/ast_mode.c +8
-0+ + ret = drm_connector_attach_encoder(connector, encoder); + if (ret) + return ret; + + return 0; +} +/*
* Mode config
*/drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -1842,6 +1906,9 @@ int ast_mode_config_init(struct ast_device *ast) if (ret) return ret; } + ret = ast_bmc_output_init(ast); + if (ret) + return ret; drm_mode_config_reset(dev);base-commit:
b32d5a51f3c21843011d68a58e6ac0b897bce9f2