get fbdev size from cmdline if no connector found
Subsystems (3)
cover get fbdev size from cmdline if no connector found
In case no connector is found while creating the fbdev, gives the possibility to specify the default fbdev size by firstly checking if the command line is defining a preferred mode. Else go into fallback and set 1024x768 fbdev size as it was already done.
It is usefull in case you forgot to plug your connector cable but you want your fbdev to have the size you have defined in the command line. Then when you plug your connector cable, the fbdev will match your display size.
In case no command line is specified, the 1024x768 fbdev resolution is keept as default fbdev resolution.
Vincent Abriou (2):
drm: remove useless parameters from drm_pick_cmdline_mode function
drm: get fbdev size from cmdline mode if it exists.
drivers/gpu/drm/drm_fb_helper.c | 39 +++++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- include/drm/drm_fb_helper.h | 3 +-- 3 files changed, 32 insertions(+), 12 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/2 drm: remove useless parameters from drm_pick_cmdline_mode function
drm_pick_cmdline_mode width and height parameters are useless. Just remove them.
--- drivers/gpu/drm/drm_fb_helper.c | 7 +++---- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- include/drm/drm_fb_helper.h | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +3 -4
@@ -1748,8 +1748,7 @@ static bool drm_has_cmdline_mode(struct drm_fb_helper_connector *fb_connector)return fb_connector->connector->cmdline_mode.specified; } -struct drm_display_mode *drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn, -int width,int height) +struct drm_display_mode *drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn) {struct drm_cmdline_mode *cmdline_mode;struct drm_display_mode *mode;
@@ -1867,7 +1866,7 @@ static bool drm_target_cloned(struct drm_fb_helper *fb_helper,if (!enabled[i])continue ; fb_helper_conn = fb_helper->connector_info[i]; - modes[i] =drm_pick_cmdline_mode (fb_helper_conn, width, height); + modes[i] =drm_pick_cmdline_mode (fb_helper_conn);if (!modes[i]) { can_clone = false;break ;
@@ -1989,7 +1988,7 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper, fb_helper_conn->connector->base.id);/* got for command line mode first */ - modes[i] =drm_pick_cmdline_mode (fb_helper_conn, width, height); + modes[i] =drm_pick_cmdline_mode (fb_helper_conn);if (!modes[i]) {DRM_DEBUG_KMS ("looking for preferred mode on connector %d %d\n" , fb_helper_conn->connector->base.id, fb_helper_conn->connector->tile_group ? fb_helper_conn->connector->tile_group->id :0 );
drivers/gpu/drm/i915/intel_fbdev.c +1 -1
@@ -447,7 +447,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, connector->name);/* go for command line mode first */ - modes[i] =drm_pick_cmdline_mode (fb_conn, width, height); + modes[i] =drm_pick_cmdline_mode (fb_conn);/* try for preferred next */ if (!modes[i]) {
include/drm/drm_fb_helper.h +1 -2
@@ -295,8 +295,7 @@ struct drm_display_mode * drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, int width, int height);struct drm_display_mode * -drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn, -int width,int height); +drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn);int drm_fb_helper_add_one_connector (struct drm_fb_helper *fb_helper,struct drm_connector *connector); int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedRe: [PATCH 1/2] drm: remove useless parameters from drm_pick_cmdline_mode function
Quoted 6 lines · Vincent Abriou
drm_pick_cmdline_modewidth and height parameters are useless. Just remove them.Cc Daniel Vetter <[email protected]>Cc Jani Nikula <[email protected]>Signed-off-by Vincent Abriou <[email protected]>
Applied, thanks a lot. I'll wait for someone else to review patch 2 before merging it.
-Daniel
Quoted 72 lines
--- drivers/gpu/drm/drm_fb_helper.c | 7 +++---- drivers/gpu/drm/i915/intel_fbdev.c | 2 +- include/drm/drm_fb_helper.h | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-)drivers/gpu/drm/drm_fb_helper.c +3
-4@@ -1748,8 +1748,7 @@ static bool drm_has_cmdline_mode(struct drm_fb_helper_connector *fb_connector)return fb_connector->connector->cmdline_mode.specified; } -struct drm_display_mode *drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn, -int width,int height) +struct drm_display_mode *drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn) {struct drm_cmdline_mode *cmdline_mode;struct drm_display_mode *mode;@@ -1867,7 +1866,7 @@ static bool drm_target_cloned(struct drm_fb_helper *fb_helper,if (!enabled[i])continue ; fb_helper_conn = fb_helper->connector_info[i]; - modes[i] =drm_pick_cmdline_mode (fb_helper_conn, width, height); + modes[i] =drm_pick_cmdline_mode (fb_helper_conn);if (!modes[i]) { can_clone = false;break ;@@ -1989,7 +1988,7 @@ static bool drm_target_preferred(struct drm_fb_helper *fb_helper, fb_helper_conn->connector->base.id);/* got for command line mode first */ - modes[i] =drm_pick_cmdline_mode (fb_helper_conn, width, height); + modes[i] =drm_pick_cmdline_mode (fb_helper_conn);if (!modes[i]) {DRM_DEBUG_KMS ("looking for preferred mode on connector %d %d\n" , fb_helper_conn->connector->base.id, fb_helper_conn->connector->tile_group ? fb_helper_conn->connector->tile_group->id :0 );drivers/gpu/drm/i915/intel_fbdev.c +1
-1@@ -447,7 +447,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, connector->name);/* go for command line mode first */ - modes[i] =drm_pick_cmdline_mode (fb_conn, width, height); + modes[i] =drm_pick_cmdline_mode (fb_conn);/* try for preferred next */ if (!modes[i]) {include/drm/drm_fb_helper.h +1
-2@@ -295,8 +295,7 @@ struct drm_display_mode * drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector, int width, int height);struct drm_display_mode * -drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn, -int width,int height); +drm_pick_cmdline_mode (struct drm_fb_helper_connector *fb_helper_conn);int drm_fb_helper_add_one_connector (struct drm_fb_helper *fb_helper,struct drm_connector *connector); int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 drm: get fbdev size from cmdline if no connector found
In reply to Vincent AbriouIn case no connector is found while creating the fbdev, gives the possibility to specify the default fbdev size by firstly checking if the command line is defining a preferred mode. Else go into fallback and set 1024x768 fbdev size as it was already done.
--- drivers/gpu/drm/drm_fb_helper.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +27 -5
@@ -1522,6 +1522,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, } crtc_count =0 ; +for (i =0 ; i < fb_helper->crtc_count; i++) {struct drm_display_mode *desired_mode;struct drm_mode_set *mode_set;
@@ -1566,11 +1567,32 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, }if (crtc_count ==0 || sizes.fb_width ==-1 || sizes.fb_height ==-1 ) { -/* hmm everyone went away - assume VGA cable just fell out -and will come back later. */ -DRM_INFO ("Cannot find any crtc or sizes - going 1024x768\n" ); - sizes.fb_width = sizes.surface_width =1024 ; - sizes.fb_height = sizes.surface_height =768 ; +struct drm_display_mode *mode =NULL ; +/* hmm everyone went away - assume cable just fell out and will +* come back later. +* Get fb size from command line mode (if existing) else fb size +* is set to 1024x768 +*/ +for (i =0 ; i < fb_helper->connector_count; i++) { +struct drm_fb_helper_connector *fb_helper_conn; + + fb_helper_conn = fb_helper->connector_info[i]; + mode =drm_pick_cmdline_mode (fb_helper_conn); + } + +if (mode) { + sizes.fb_width = mode->hdisplay; + sizes.fb_height = mode->vdisplay; +DRM_INFO ("Cannot find any crtc or sizes - use cmdline %dx%d\n" , + sizes.fb_width, sizes.fb_height); + }else { + sizes.fb_width =1024 ; + sizes.fb_height =768 ; +DRM_INFO ("Cannot find any crtc or sizes - going 1024x768\n" ); + } + + sizes.surface_width = sizes.fb_width; + sizes.surface_height = sizes.fb_height; }/* push down into drivers */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel