diff mbox series

drm/hisilicon: Set preferred mode resolution and maximum resolution

Message ID 1582080707-18825-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series drm/hisilicon: Set preferred mode resolution and maximum resolution | expand

Commit Message

tiantao (H) Feb. 19, 2020, 2:51 a.m. UTC
set the preferred mode resolution to 1024 * 768 and maximum
resolution to 1920 * 1200.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Gong junjie <gongjunjie2@huawei.com>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Xinliang Liu Feb. 25, 2020, 2:19 a.m. UTC | #1
On Wed, 19 Feb 2020 at 10:52, Tian Tao <tiantao6@hisilicon.com> wrote:

> set the preferred mode resolution to 1024 * 768 and maximum
> resolution to 1920 * 1200.
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> Signed-off-by: Gong junjie <gongjunjie2@huawei.com>
> ---
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index 6d98fdc..82fc7d3 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -11,8 +11,10 @@
>   *     Jianhua Li <lijianhua@huawei.com>
>   */
>
> +#include <drm/drm_gem_vram_helper.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_probe_helper.h>
> +#include <drm/drm_crtc_helper.h>
>  #include <drm/drm_print.h>
>
>  #include "hibmc_drm_drv.h"
> @@ -20,7 +22,13 @@
>
>  static int hibmc_connector_get_modes(struct drm_connector *connector)
>  {
> -       return drm_add_modes_noedid(connector, 800, 600);
> +       int count;
> +
> +       drm_connector_update_edid_property(connector, NULL);
> +       count = drm_add_modes_noedid(connector, 1920, 1200);
>

Hi Tao, maybe it's better like this:
count = drm_add_modes_noedid( connector ,
                                      conn->dev->mode_config.max_width,
                                      conn->dev->mode_config.max_height);


> +       drm_set_preferred_mode(connector, 1024, 768);
> +
> +       return count;
>  }
>
>  static enum drm_mode_status hibmc_connector_mode_valid(struct
> drm_connector *connector,
> --
> 2.7.4
>
>
Xinliang Liu Feb. 25, 2020, 3:01 a.m. UTC | #2
On Tue, 25 Feb 2020 at 10:19, Xinliang Liu <xinliang.liu@linaro.org> wrote:

>
>
> On Wed, 19 Feb 2020 at 10:52, Tian Tao <tiantao6@hisilicon.com> wrote:
>
>> set the preferred mode resolution to 1024 * 768 and maximum
>> resolution to 1920 * 1200.
>>
>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>> Signed-off-by: Gong junjie <gongjunjie2@huawei.com>
>> ---
>>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 10 +++++++++-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> index 6d98fdc..82fc7d3 100644
>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
>> @@ -11,8 +11,10 @@
>>   *     Jianhua Li <lijianhua@huawei.com>
>>   */
>>
>> +#include <drm/drm_gem_vram_helper.h>
>>  #include <drm/drm_atomic_helper.h>
>>  #include <drm/drm_probe_helper.h>
>> +#include <drm/drm_crtc_helper.h>
>>  #include <drm/drm_print.h>
>>
>>  #include "hibmc_drm_drv.h"
>> @@ -20,7 +22,13 @@
>>
>>  static int hibmc_connector_get_modes(struct drm_connector *connector)
>>  {
>> -       return drm_add_modes_noedid(connector, 800, 600);
>> +       int count;
>> +
>> +       drm_connector_update_edid_property(connector, NULL);
>>
>
And as there is no edid for the connector, don't think call
drm_connector_update_edid_property is required.


> +       count = drm_add_modes_noedid(connector, 1920, 1200);
>>
>
> Hi Tao, maybe it's better like this:
> count = drm_add_modes_noedid( connector ,
>                                       conn->dev->mode_config.max_width,
>                                       conn->dev->mode_config.max_height);
>
>
>> +       drm_set_preferred_mode(connector, 1024, 768);
>> +
>> +       return count;
>>  }
>>
>>  static enum drm_mode_status hibmc_connector_mode_valid(struct
>> drm_connector *connector,
>> --
>> 2.7.4
>>
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
index 6d98fdc..82fc7d3 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
@@ -11,8 +11,10 @@ 
  *	Jianhua Li <lijianhua@huawei.com>
  */
 
+#include <drm/drm_gem_vram_helper.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_crtc_helper.h>
 #include <drm/drm_print.h>
 
 #include "hibmc_drm_drv.h"
@@ -20,7 +22,13 @@ 
 
 static int hibmc_connector_get_modes(struct drm_connector *connector)
 {
-	return drm_add_modes_noedid(connector, 800, 600);
+	int count;
+
+	drm_connector_update_edid_property(connector, NULL);
+	count = drm_add_modes_noedid(connector, 1920, 1200);
+	drm_set_preferred_mode(connector, 1024, 768);
+
+	return count;
 }
 
 static enum drm_mode_status hibmc_connector_mode_valid(struct drm_connector *connector,