drm: get fbdev size from cmdline mode if it exists
Subsystems (2)
PATCH v2 1/1 drm: get fbdev size from cmdline mode if it exists
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.
---
Patch v2:
add a break in the connector for loop when a first cmdline mode is found
drivers/gpu/drm/drm_fb_helper.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +29 -5
@@ -1526,6 +1526,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;
@@ -1570,11 +1571,34 @@ 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) +break ; + } + +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
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>
btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
But if you never probe the right mode, this here sounds like a good idea too.
-Daniel
Quoted 66 lines
---
Patch v2:
add a break in the connector for loop when a first cmdline mode is founddrivers/gpu/drm/drm_fb_helper.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_fb_helper.c +29
-5@@ -1526,6 +1526,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;@@ -1570,11 +1571,34 @@ 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) +break ; + } + +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
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
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
Quoted 3 lines
But if you never probe the right mode, this here sounds like a good idea too.
-Daniel
The early creation of fbdev is useful for userland system. If fbdev creation is delayed until first connector is connected, userland systems startup could fails (like Android that check fbdev availability at startup).
Today if no connector is connected, a default 1024x768 fbdev is created but it does not necessarily match the targeted CRTC size. When the connector is connected, fbdev is not reconfigured with the targeted CRTC size and it is anyway too late for the userland to take into account new fbdev size.
Reading the cmdline is an easy way to solve this.
Regards,
Vincent
Quoted 58 lines
Quoted 58 lines
---
Patch v2:
add a break in the connector for loop when a first cmdline mode is founddrivers/gpu/drm/drm_fb_helper.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_fb_helper.c +29
-5@@ -1526,6 +1526,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;@@ -1570,11 +1571,34 @@ 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) +break ; + } + +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; }
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/drm_fb_helper.c +0
-1/* push down into drivers */ --2.7.4
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Vincent,
Quoted 24 lines · On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
Quoted 2 lines
But if you never probe the right mode, this here sounds like a good idea too.
The early creation of fbdev is useful for userland system. If fbdev creation is delayed until first connector is connected, userland systems startup could fails (like Android that check fbdev availability at startup).
Quoted 5 lines
Today if no connector is connected, a default 1024x768 fbdev is created but it does not necessarily match the targeted CRTC size. When the connector is connected, fbdev is not reconfigured with the targeted CRTC size and it is anyway too late for the userland to take into account new fbdev size. Reading the cmdline is an easy way to solve this.
Isn't it another case of working around userspace issue in the kernel ? Shouldn't the offending userspace code be fixed ? And while at it, moved from fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years ago to use DRM/KMS in the Android init process. I'm sure it doesn't apply cleanly anymore, but I can share it if you're interested.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 33 lines · Laurent Pinchart
Hi Vincent,
Quoted 24 lines · On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
Quoted 2 lines
But if you never probe the right mode, this here sounds like a good idea too.
The early creation of fbdev is useful for userland system. If fbdev creation is delayed until first connector is connected, userland systems startup could fails (like Android that check fbdev availability at startup).
Quoted 5 lines
Today if no connector is connected, a default 1024x768 fbdev is created but it does not necessarily match the targeted CRTC size. When the connector is connected, fbdev is not reconfigured with the targeted CRTC size and it is anyway too late for the userland to take into account new fbdev size. Reading the cmdline is an easy way to solve this.
Quoted 5 lines
Isn't it another case of working around userspace issue in the kernel ? Shouldn't the offending userspace code be fixed ? And while at it, moved from fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years ago to use DRM/KMS in the Android init process. I'm sure it doesn't apply cleanly anymore, but I can share it if you're interested.
So android still doesn't boot without fbdev? I thought that's been fixed
...
-Daniel
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
Quoted 34 lines · Daniel Vetter
Quoted 33 lines · Laurent Pinchart
Hi Vincent,
Quoted 29 lines · On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
Quoted 2 lines
But if you never probe the right mode, this here sounds like a good idea too.
The early creation of fbdev is useful for userland system. If fbdev creation is delayed until first connector is connected, userland systems startup could fails (like Android that check fbdev availability at startup).
Today if no connector is connected, a default 1024x768 fbdev is created but it does not necessarily match the targeted CRTC size. When the connector is connected, fbdev is not reconfigured with the targeted CRTC size and it is anyway too late for the userland to take into account new fbdev size. Reading the cmdline is an easy way to solve this.
Quoted 5 lines
Quoted 5 lines
Isn't it another case of working around userspace issue in the kernel ? Shouldn't the offending userspace code be fixed ? And while at it, moved from fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years ago to use DRM/KMS in the Android init process. I'm sure it doesn't apply cleanly anymore, but I can share it if you're interested.
Android is one example and it still give the possibility to start with fbdev.
I'm not trying to fixe userspace issue (there is so many userspaces :)). The default case to set fbdev to 1024x768 already exist in the drm fb helpers. I just add a way to be flexible.
Vincent
Quoted 5 lines
So android still doesn't boot without fbdev? I thought that's been fixed
...
-Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Vincent,
Quoted 40 lines · On Wednesday 11 Jan 2017 09:03:07 Vincent ABRIOU wrote:
Quoted 33 lines · Daniel Vetter
Quoted 32 lines · Laurent Pinchart
Quoted 30 lines · On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
Quoted 2 lines
But if you never probe the right mode, this here sounds like a good idea too.
The early creation of fbdev is useful for userland system. If fbdev creation is delayed until first connector is connected, userland systems startup could fails (like Android that check fbdev availability at startup).
Today if no connector is connected, a default 1024x768 fbdev is created but it does not necessarily match the targeted CRTC size. When the connector is connected, fbdev is not reconfigured with the targeted CRTC size and it is anyway too late for the userland to take into account new fbdev size. Reading the cmdline is an easy way to solve this.
Quoted 5 lines
Quoted 5 lines
Isn't it another case of working around userspace issue in the kernel ? Shouldn't the offending userspace code be fixed ? And while at it, moved from fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years ago to use DRM/KMS in the Android init process. I'm sure it doesn't apply cleanly anymore, but I can share it if you're interested.
Quoted 4 lines
Android is one example and it still give the possibility to start with fbdev. I'm not trying to fixe userspace issue (there is so many userspaces :)). The default case to set fbdev to 1024x768 already exist in the drm fb helpers. I just add a way to be flexible.
Sure, I understand that. My point is that, instead of making life easy for userspace that hasn't switched to DRM/KMS yet, wouldn't it be time to push them a bit more ?
Quoted 1 line
Quoted 1 line
So android still doesn't boot without fbdev? I thought that's been fixed
I haven't checked the latest version to be honest.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 43 lines · Laurent Pinchart
Hi Vincent,
Quoted 40 lines · On Wednesday 11 Jan 2017 09:03:07 Vincent ABRIOU wrote:
Quoted 38 lines · Daniel Vetter
Quoted 37 lines · Laurent Pinchart
Quoted 25 lines · On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
Quoted 2 lines
But if you never probe the right mode, this here sounds like a good idea too.
The early creation of fbdev is useful for userland system. If fbdev creation is delayed until first connector is connected, userland systems startup could fails (like Android that check fbdev availability at startup).
Quoted 5 lines
Today if no connector is connected, a default 1024x768 fbdev is created but it does not necessarily match the targeted CRTC size. When the connector is connected, fbdev is not reconfigured with the targeted CRTC size and it is anyway too late for the userland to take into account new fbdev size. Reading the cmdline is an easy way to solve this.
Isn't it another case of working around userspace issue in the kernel ? Shouldn't the offending userspace code be fixed ? And while at it, moved from fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years ago to use DRM/KMS in the Android init process. I'm sure it doesn't apply cleanly anymore, but I can share it if you're interested.
Quoted 8 lines
Quoted 4 lines
Android is one example and it still give the possibility to start with fbdev. I'm not trying to fixe userspace issue (there is so many userspaces :)). The default case to set fbdev to 1024x768 already exist in the drm fb helpers. I just add a way to be flexible.
Sure, I understand that. My point is that, instead of making life easy for userspace that hasn't switched to DRM/KMS yet, wouldn't it be time to push them a bit more ?
Yeah, if the issue is just that by default android expects fbdev and gets confused if it's not there, then I don't think that patch makes much sense. If we need it because hw is horrible and this is the only way to make fbcon work reasonably well, I'm all fine with that. Either way, other people piping up with "I want this too" would help a lot. Even better when they do a full review :-)
-Daniel
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
Quoted 43 lines · Laurent Pinchart
Hi Vincent,
Quoted 40 lines · On Wednesday 11 Jan 2017 09:03:07 Vincent ABRIOU wrote:
Quoted 38 lines · Daniel Vetter
Quoted 37 lines · Laurent Pinchart
Quoted 25 lines · On Tuesday 10 Jan 2017 13:33:29 Vincent ABRIOU wrote:
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Vincent Abriou
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.
Cc Tomi Valkeinen <[email protected]>Signed-off-by Vincent Abriou <[email protected]>btw on all this there's also the possible solution to delay setup of the fbdev until the first connector switches to connected, and then only allocting the fb and doing the setup. Tegra has that, and Thierry did some patches to move that logic into the fb helpers. But there's some locking issues that need to be fixed first, hence why those patches haven't landed yet.
Quoted 2 lines
But if you never probe the right mode, this here sounds like a good idea too.
The early creation of fbdev is useful for userland system. If fbdev creation is delayed until first connector is connected, userland systems startup could fails (like Android that check fbdev availability at startup).
Quoted 5 lines
Today if no connector is connected, a default 1024x768 fbdev is created but it does not necessarily match the targeted CRTC size. When the connector is connected, fbdev is not reconfigured with the targeted CRTC size and it is anyway too late for the userland to take into account new fbdev size. Reading the cmdline is an easy way to solve this.
Isn't it another case of working around userspace issue in the kernel ? Shouldn't the offending userspace code be fixed ? And while at it, moved from fbdev to DRM/KMS ? :-) I wrote a proof-of-concept patch a few years ago to use DRM/KMS in the Android init process. I'm sure it doesn't apply cleanly anymore, but I can share it if you're interested.
Quoted 11 lines
Quoted 4 lines
Android is one example and it still give the possibility to start with fbdev. I'm not trying to fixe userspace issue (there is so many userspaces :)). The default case to set fbdev to 1024x768 already exist in the drm fb helpers. I just add a way to be flexible.
Sure, I understand that. My point is that, instead of making life easy for userspace that hasn't switched to DRM/KMS yet, wouldn't it be time to push them a bit more ?
Quoted 1 line
Quoted 1 line
So android still doesn't boot without fbdev? I thought that's been fixed
Android support fbdev and drm/kms.
Quoted 2 lines
I haven't checked the latest version to be honest.
The last Android version still support fbdev.
Vincent
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel