Re: mode issue about no EDID and first mode when weston start

2012-07-31 Thread Kristian Høgsberg
On Tue, Jul 31, 2012 at 01:46:17AM +, Wang, Quanxian wrote:

 Ok, if we don't use builtin mode in weston. That is fine. In this
 case, I supposed to provide some useful error output to user instead
 of core dump weston.

Yep, we should handle that better now.

 Another case is if we don't get active mode from current connector,
 and at the same time EDID mode information from KMS is available. In
 this case, I use the first mode we get from KMS as the default mode
 for connector. If not, we will still core dump weston.

The EDID information should have a preferred mode.  I guess we can add
a final fallback to pick the first mode if there is no preferred or
current mode.  Also, there's a patch on the list now from Scott that
lets you add a modeline in the weston.ini config file.

Kristian

  -Original Message-
  From: Kristian Høgsberg [mailto:hoegsb...@gmail.com]
  Sent: Tuesday, July 31, 2012 5:15 AM
  To: Wang, Quanxian
  Cc: wayland-devel@lists.freedesktop.org
  Subject: Re: mode issue about no EDID and first mode when weston start
  
  On Thu, Jul 26, 2012 at 07:54:45PM +, Wang, Quanxian wrote:
   Hi, All
  
   Help review.
  
   Background
  
   1) Some platforms has no EDID mode information. Therefore when KMS
   initializes the driver, there will be no mode provided for user. At
   that time, have to use the fixed mode defined by the
   user.(builtin-800x480)
  
  What you want to do in this case is to either compile an EDID blob into the
  kernel or specify one through the firmware mechanism.  See
  Documentation/EDID/HOWTO.txt in the kernel and use
  
video=HDMI-A-1:e drm_kms_helper.edid_firmware=HDMI-A-1:edid
  
  on the kernel command line.  This example assumes you're trying to bring up
  the HDMI-A-1 connector with an edid blob in /lib/firmware/edid.  That will
  bring up KMS early on and weston will be able to reuse the mode set from the
  custom EDID blob.  We will also add a feature to specify a modeline in
  weston.ini, so you'll be able to use that instead.  Something like:
  
  [output]
  name=HDMI-A-1
  modeline=29.50  800 824 896 992  480 483 493 500 -hsync +vsync
  
  I don't want to build in a mode in weston.  KMS should give us a valid mode 
  in
  all cases and if it doesn't it's probably something like this case where 
  you have
  a custom board/driver/panel.
  
  Kristian
  
   2) In the very beginning of weston restart, there exists a case, no
   active mode is set to connector. We provide the first mode gotten from
   KMS as default mode for connector.
  
   We got weston core dump when weston start because drm will add null
   mode when cases above happen.
  
   commit 1a87302f288497ed8bbef3677286e27bb6931f72
   Author: Wang Quanxian
  quanxian.w...@intel.commailto:quanxian.w...@intel.com
   Date:   Wed Jul 25 11:21:00 2012 +0800
  
   Bug fix for mode issue when weston start
  
   Provide the default builtin(800x480) mode when platforms
   have no EDID and KMS could not provide mode information.
   In the very beginning of weston, the connector could not
   be set active mode. At that time, take the first mode in
   mode list from KMS as default mode.
  
   Signed-Off-By Quanxian Wang
   quanxian.w...@intel.commailto:quanxian.w...@intel.com
  
   diff --git a/src/compositor-drm.c b/src/compositor-drm.c index
   4dffa1d..47cd512 100644
   --- a/src/compositor-drm.c
   +++ b/src/compositor-drm.c
   @@ -143,6 +143,16 @@ struct drm_sprite {
   uint32_t formats[];
};
  
   +static drmModeModeInfo builtin_800x480 = {
   +   33750,  /* clock */
   +   800, 864, 976, 1088, 0,
   +   480, 486, 494, 517, 0,
   +   59920,
   +   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
   +   0,
   +   800x480
   +};
   +
static int
surface_is_primary(struct weston_compositor *ec, struct
   weston_surface *es)  { @@ -1344,13 +1354,30 @@
   create_output_for_connector(struct drm_compositor *ec,
   drmModeFreeEncoder(encoder);
   if (crtc == NULL)
   goto err_free;
   -   crtc_mode = crtc-mode;
   +
   +   /* if don't get mode from drm driver, use default 800x480 */
   +   if (crtc-mode.clock != 0)
   +   {
   +   crtc_mode = crtc-mode;
   +   } else {
   +   if (connector-count_modes == 0)
   +   crtc_mode = builtin_800x480;
   +   else
   +   crtc_mode = connector-modes[0];
   +   }
   +
   drmModeFreeCrtc(crtc);
  
   -   for (i = 0; i  connector-count_modes; i++) {
   -   ret = drm_output_add_mode(output,
  connector-modes[i]);
   +   if (connector-count_modes == 0) {
   +   ret = drm_output_add_mode(output, crtc_mode);
   if (ret)
   goto err_free;
   +   }else{
   +   for (i = 0; i  connector-count_modes; i++) {
   +   ret

RE: mode issue about no EDID and first mode when weston start

2012-07-31 Thread Wang, Quanxian
Got it.

Thanks

Quanxian Wang

 -Original Message-
 From: Kristian Høgsberg [mailto:hoegsb...@gmail.com]
 Sent: Wednesday, August 01, 2012 7:52 AM
 To: Wang, Quanxian
 Cc: wayland-devel@lists.freedesktop.org
 Subject: Re: mode issue about no EDID and first mode when weston start
 
 On Tue, Jul 31, 2012 at 01:46:17AM +, Wang, Quanxian wrote:
 
  Ok, if we don't use builtin mode in weston. That is fine. In this
  case, I supposed to provide some useful error output to user instead
  of core dump weston.
 
 Yep, we should handle that better now.
 
  Another case is if we don't get active mode from current connector,
  and at the same time EDID mode information from KMS is available. In
  this case, I use the first mode we get from KMS as the default mode
  for connector. If not, we will still core dump weston.
 
 The EDID information should have a preferred mode.  I guess we can add a
 final fallback to pick the first mode if there is no preferred or current 
 mode.
 Also, there's a patch on the list now from Scott that lets you add a modeline 
 in
 the weston.ini config file.
 
 Kristian
 
   -Original Message-
   From: Kristian Høgsberg [mailto:hoegsb...@gmail.com]
   Sent: Tuesday, July 31, 2012 5:15 AM
   To: Wang, Quanxian
   Cc: wayland-devel@lists.freedesktop.org
   Subject: Re: mode issue about no EDID and first mode when weston
   start
  
   On Thu, Jul 26, 2012 at 07:54:45PM +, Wang, Quanxian wrote:
Hi, All
   
Help review.
   
Background
   
1) Some platforms has no EDID mode information. Therefore when KMS
initializes the driver, there will be no mode provided for user.
At that time, have to use the fixed mode defined by the
user.(builtin-800x480)
  
   What you want to do in this case is to either compile an EDID blob
   into the kernel or specify one through the firmware mechanism.  See
   Documentation/EDID/HOWTO.txt in the kernel and use
  
 video=HDMI-A-1:e drm_kms_helper.edid_firmware=HDMI-A-1:edid
  
   on the kernel command line.  This example assumes you're trying to
   bring up the HDMI-A-1 connector with an edid blob in
   /lib/firmware/edid.  That will bring up KMS early on and weston will
   be able to reuse the mode set from the custom EDID blob.  We will
   also add a feature to specify a modeline in weston.ini, so you'll be able 
   to
 use that instead.  Something like:
  
   [output]
   name=HDMI-A-1
   modeline=29.50  800 824 896 992  480 483 493 500 -hsync +vsync
  
   I don't want to build in a mode in weston.  KMS should give us a
   valid mode in all cases and if it doesn't it's probably something
   like this case where you have a custom board/driver/panel.
  
   Kristian
  
2) In the very beginning of weston restart, there exists a case,
no active mode is set to connector. We provide the first mode
gotten from KMS as default mode for connector.
   
We got weston core dump when weston start because drm will add
null mode when cases above happen.
   
commit 1a87302f288497ed8bbef3677286e27bb6931f72
Author: Wang Quanxian
   quanxian.w...@intel.commailto:quanxian.w...@intel.com
Date:   Wed Jul 25 11:21:00 2012 +0800
   
Bug fix for mode issue when weston start
   
Provide the default builtin(800x480) mode when platforms
have no EDID and KMS could not provide mode information.
In the very beginning of weston, the connector could not
be set active mode. At that time, take the first mode in
mode list from KMS as default mode.
   
Signed-Off-By Quanxian Wang
quanxian.w...@intel.commailto:quanxian.w...@intel.com
   
diff --git a/src/compositor-drm.c b/src/compositor-drm.c index
4dffa1d..47cd512 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -143,6 +143,16 @@ struct drm_sprite {
uint32_t formats[];
 };
   
+static drmModeModeInfo builtin_800x480 = {
+   33750,  /* clock */
+   800, 864, 976, 1088, 0,
+   480, 486, 494, 517, 0,
+   59920,
+   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
+   0,
+   800x480
+};
+
 static int
 surface_is_primary(struct weston_compositor *ec, struct
weston_surface *es)  { @@ -1344,13 +1354,30 @@
create_output_for_connector(struct drm_compositor *ec,
drmModeFreeEncoder(encoder);
if (crtc == NULL)
goto err_free;
-   crtc_mode = crtc-mode;
+
+   /* if don't get mode from drm driver, use default 800x480 */
+   if (crtc-mode.clock != 0)
+   {
+   crtc_mode = crtc-mode;
+   } else {
+   if (connector-count_modes == 0)
+   crtc_mode = builtin_800x480;
+   else
+   crtc_mode = connector-modes[0];
+   }
+
drmModeFreeCrtc(crtc);
   
-   for (i = 0; i

Re: mode issue about no EDID and first mode when weston start

2012-07-30 Thread Kristian Høgsberg
On Thu, Jul 26, 2012 at 07:54:45PM +, Wang, Quanxian wrote:
 Hi, All
 
 Help review.
 
 Background

 1) Some platforms has no EDID mode information. Therefore when KMS
 initializes the driver, there will be no mode provided for user. At
 that time, have to use the fixed mode defined by the
 user.(builtin-800x480)

What you want to do in this case is to either compile an EDID blob
into the kernel or specify one through the firmware mechanism.  See
Documentation/EDID/HOWTO.txt in the kernel and use

  video=HDMI-A-1:e drm_kms_helper.edid_firmware=HDMI-A-1:edid

on the kernel command line.  This example assumes you're trying to
bring up the HDMI-A-1 connector with an edid blob in
/lib/firmware/edid.  That will bring up KMS early on and weston will
be able to reuse the mode set from the custom EDID blob.  We will also
add a feature to specify a modeline in weston.ini, so you'll be able
to use that instead.  Something like:

[output]
name=HDMI-A-1
modeline=29.50  800 824 896 992  480 483 493 500 -hsync +vsync
  
I don't want to build in a mode in weston.  KMS should give us a valid
mode in all cases and if it doesn't it's probably something like this
case where you have a custom board/driver/panel.

Kristian

 2) In the very beginning of weston restart, there exists a case, no
 active mode is set to connector. We provide the first mode gotten
 from KMS as default mode for connector.

 We got weston core dump when weston start because drm will add null
 mode when cases above happen.

 commit 1a87302f288497ed8bbef3677286e27bb6931f72
 Author: Wang Quanxian 
 quanxian.w...@intel.commailto:quanxian.w...@intel.com
 Date:   Wed Jul 25 11:21:00 2012 +0800
 
 Bug fix for mode issue when weston start
 
 Provide the default builtin(800x480) mode when platforms
 have no EDID and KMS could not provide mode information.
 In the very beginning of weston, the connector could not
 be set active mode. At that time, take the first mode in
 mode list from KMS as default mode.
 
 Signed-Off-By Quanxian Wang 
 quanxian.w...@intel.commailto:quanxian.w...@intel.com
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 4dffa1d..47cd512 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -143,6 +143,16 @@ struct drm_sprite {
 uint32_t formats[];
  };
 
 +static drmModeModeInfo builtin_800x480 = {
 +   33750,  /* clock */
 +   800, 864, 976, 1088, 0,
 +   480, 486, 494, 517, 0,
 +   59920,
 +   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
 +   0,
 +   800x480
 +};
 +
  static int
  surface_is_primary(struct weston_compositor *ec, struct weston_surface *es)
  {
 @@ -1344,13 +1354,30 @@ create_output_for_connector(struct drm_compositor *ec,
 drmModeFreeEncoder(encoder);
 if (crtc == NULL)
 goto err_free;
 -   crtc_mode = crtc-mode;
 +
 +   /* if don't get mode from drm driver, use default 800x480 */
 +   if (crtc-mode.clock != 0)
 +   {
 +   crtc_mode = crtc-mode;
 +   } else {
 +   if (connector-count_modes == 0)
 +   crtc_mode = builtin_800x480;
 +   else
 +   crtc_mode = connector-modes[0];
 +   }
 +
 drmModeFreeCrtc(crtc);
 
 -   for (i = 0; i  connector-count_modes; i++) {
 -   ret = drm_output_add_mode(output, connector-modes[i]);
 +   if (connector-count_modes == 0) {
 +   ret = drm_output_add_mode(output, crtc_mode);
 if (ret)
 goto err_free;
 +   }else{
 +   for (i = 0; i  connector-count_modes; i++) {
 +   ret = drm_output_add_mode(output, 
 connector-modes[i]);
 +   if (ret)
 +   goto err_free;
 +   }
 }
 
 preferred = NULL;
 
 
 Thanks
 
 Quanxian Wang
 
 


 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


RE: mode issue about no EDID and first mode when weston start

2012-07-30 Thread Wang, Quanxian
Ok, if we don't use builtin mode in weston. That is fine. In this case, I 
supposed to provide some useful error output to user instead of core dump 
weston.

Another case is if we don't get active mode from current connector, and at the 
same time EDID mode information from KMS is available. In this case, I use the 
first mode we get from KMS as the default mode for connector. If not, we will 
still core dump weston.

 -Original Message-
 From: Kristian Høgsberg [mailto:hoegsb...@gmail.com]
 Sent: Tuesday, July 31, 2012 5:15 AM
 To: Wang, Quanxian
 Cc: wayland-devel@lists.freedesktop.org
 Subject: Re: mode issue about no EDID and first mode when weston start
 
 On Thu, Jul 26, 2012 at 07:54:45PM +, Wang, Quanxian wrote:
  Hi, All
 
  Help review.
 
  Background
 
  1) Some platforms has no EDID mode information. Therefore when KMS
  initializes the driver, there will be no mode provided for user. At
  that time, have to use the fixed mode defined by the
  user.(builtin-800x480)
 
 What you want to do in this case is to either compile an EDID blob into the
 kernel or specify one through the firmware mechanism.  See
 Documentation/EDID/HOWTO.txt in the kernel and use
 
   video=HDMI-A-1:e drm_kms_helper.edid_firmware=HDMI-A-1:edid
 
 on the kernel command line.  This example assumes you're trying to bring up
 the HDMI-A-1 connector with an edid blob in /lib/firmware/edid.  That will
 bring up KMS early on and weston will be able to reuse the mode set from the
 custom EDID blob.  We will also add a feature to specify a modeline in
 weston.ini, so you'll be able to use that instead.  Something like:
 
 [output]
 name=HDMI-A-1
 modeline=29.50  800 824 896 992  480 483 493 500 -hsync +vsync
 
 I don't want to build in a mode in weston.  KMS should give us a valid mode in
 all cases and if it doesn't it's probably something like this case where you 
 have
 a custom board/driver/panel.
 
 Kristian
 
  2) In the very beginning of weston restart, there exists a case, no
  active mode is set to connector. We provide the first mode gotten from
  KMS as default mode for connector.
 
  We got weston core dump when weston start because drm will add null
  mode when cases above happen.
 
  commit 1a87302f288497ed8bbef3677286e27bb6931f72
  Author: Wang Quanxian
 quanxian.w...@intel.commailto:quanxian.w...@intel.com
  Date:   Wed Jul 25 11:21:00 2012 +0800
 
  Bug fix for mode issue when weston start
 
  Provide the default builtin(800x480) mode when platforms
  have no EDID and KMS could not provide mode information.
  In the very beginning of weston, the connector could not
  be set active mode. At that time, take the first mode in
  mode list from KMS as default mode.
 
  Signed-Off-By Quanxian Wang
  quanxian.w...@intel.commailto:quanxian.w...@intel.com
 
  diff --git a/src/compositor-drm.c b/src/compositor-drm.c index
  4dffa1d..47cd512 100644
  --- a/src/compositor-drm.c
  +++ b/src/compositor-drm.c
  @@ -143,6 +143,16 @@ struct drm_sprite {
  uint32_t formats[];
   };
 
  +static drmModeModeInfo builtin_800x480 = {
  +   33750,  /* clock */
  +   800, 864, 976, 1088, 0,
  +   480, 486, 494, 517, 0,
  +   59920,
  +   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
  +   0,
  +   800x480
  +};
  +
   static int
   surface_is_primary(struct weston_compositor *ec, struct
  weston_surface *es)  { @@ -1344,13 +1354,30 @@
  create_output_for_connector(struct drm_compositor *ec,
  drmModeFreeEncoder(encoder);
  if (crtc == NULL)
  goto err_free;
  -   crtc_mode = crtc-mode;
  +
  +   /* if don't get mode from drm driver, use default 800x480 */
  +   if (crtc-mode.clock != 0)
  +   {
  +   crtc_mode = crtc-mode;
  +   } else {
  +   if (connector-count_modes == 0)
  +   crtc_mode = builtin_800x480;
  +   else
  +   crtc_mode = connector-modes[0];
  +   }
  +
  drmModeFreeCrtc(crtc);
 
  -   for (i = 0; i  connector-count_modes; i++) {
  -   ret = drm_output_add_mode(output,
 connector-modes[i]);
  +   if (connector-count_modes == 0) {
  +   ret = drm_output_add_mode(output, crtc_mode);
  if (ret)
  goto err_free;
  +   }else{
  +   for (i = 0; i  connector-count_modes; i++) {
  +   ret = drm_output_add_mode(output,
 connector-modes[i]);
  +   if (ret)
  +   goto err_free;
  +   }
  }
 
  preferred = NULL;
 
 
  Thanks
 
  Quanxian Wang
 
 
 
 
  ___
  wayland-devel mailing list
  wayland-devel@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/wayland-devel

___
wayland-devel mailing list
wayland-devel