All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] SimpleDRM: allow configuring physical width and height
@ 2023-01-26 18:24 ` Rayyan Ansari
  0 siblings, 0 replies; 12+ messages in thread
From: Rayyan Ansari @ 2023-01-26 18:24 UTC (permalink / raw)
  To: dri-devel
  Cc: ~postmarketos/upstreaming, asahi, janne, Rayyan Ansari,
	Daniel Vetter, David Airlie, devicetree, Hans de Goede,
	Javier Martinez Canillas, Krzysztof Kozlowski, linux-fbdev,
	linux-kernel, Rob Herring, Thomas Zimmermann

Hello,

The following patches:
- Add support for configuring the width-mm and height-mm DRM mode
  properties in the SimpleDRM driver via Device Tree
- Document these two new Device Tree properties

This is useful for allowing interfaces such as Phosh to calculate
proper scaling values and for early boot code knowing if hi-dpi
rendering is necessary.

Changes since v3:
- Use panel node

Rayyan Ansari (2):
  drm/simpledrm: Allow physical width and height configuration via panel
    node
  dt-bindings: display: simple-framebuffer: Document the panel node

 .../bindings/display/simple-framebuffer.yaml  |  9 ++++++
 drivers/gpu/drm/tiny/simpledrm.c              | 32 +++++++++++++------
 2 files changed, 32 insertions(+), 9 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4 0/2] SimpleDRM: allow configuring physical width and height
@ 2023-01-26 18:24 ` Rayyan Ansari
  0 siblings, 0 replies; 12+ messages in thread
From: Rayyan Ansari @ 2023-01-26 18:24 UTC (permalink / raw)
  To: dri-devel
  Cc: devicetree, linux-fbdev, janne, Krzysztof Kozlowski,
	Thomas Zimmermann, Rayyan Ansari, Javier Martinez Canillas,
	linux-kernel, Hans de Goede, Rob Herring,
	~postmarketos/upstreaming, asahi

Hello,

The following patches:
- Add support for configuring the width-mm and height-mm DRM mode
  properties in the SimpleDRM driver via Device Tree
- Document these two new Device Tree properties

This is useful for allowing interfaces such as Phosh to calculate
proper scaling values and for early boot code knowing if hi-dpi
rendering is necessary.

Changes since v3:
- Use panel node

Rayyan Ansari (2):
  drm/simpledrm: Allow physical width and height configuration via panel
    node
  dt-bindings: display: simple-framebuffer: Document the panel node

 .../bindings/display/simple-framebuffer.yaml  |  9 ++++++
 drivers/gpu/drm/tiny/simpledrm.c              | 32 +++++++++++++------
 2 files changed, 32 insertions(+), 9 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4 1/2] drm/simpledrm: Allow physical width and height configuration via panel node
  2023-01-26 18:24 ` Rayyan Ansari
@ 2023-01-26 18:24   ` Rayyan Ansari
  -1 siblings, 0 replies; 12+ messages in thread
From: Rayyan Ansari @ 2023-01-26 18:24 UTC (permalink / raw)
  To: dri-devel
  Cc: ~postmarketos/upstreaming, asahi, janne, Rayyan Ansari,
	Daniel Vetter, David Airlie, devicetree, Hans de Goede,
	Javier Martinez Canillas, Krzysztof Kozlowski, linux-fbdev,
	linux-kernel, Rob Herring, Thomas Zimmermann

Parse the width-mm and height-mm devicetree properties of the panel node,
and use this to set the DRM Display Mode instead of calculating it
based on a hardcoded DPI.

Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>
---
 drivers/gpu/drm/tiny/simpledrm.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index 162eb44dcba8..f8b18441cfcb 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -599,16 +599,12 @@ static const struct drm_mode_config_funcs simpledrm_mode_config_funcs = {
  */
 
 static struct drm_display_mode simpledrm_mode(unsigned int width,
-					      unsigned int height)
+					      unsigned int height,
+					      unsigned int width_mm,
+					      unsigned int height_mm)
 {
-	/*
-	 * Assume a monitor resolution of 96 dpi to
-	 * get a somewhat reasonable screen size.
-	 */
 	const struct drm_display_mode mode = {
-		DRM_MODE_INIT(60, width, height,
-			      DRM_MODE_RES_MM(width, 96ul),
-			      DRM_MODE_RES_MM(height, 96ul))
+		DRM_MODE_INIT(60, width, height, width_mm, height_mm)
 	};
 
 	return mode;
@@ -622,6 +618,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 	struct simpledrm_device *sdev;
 	struct drm_device *dev;
 	int width, height, stride;
+	int width_mm = 0, height_mm = 0;
+	struct device_node *panel_node;
 	const struct drm_format_info *format;
 	struct resource *res, *mem;
 	void __iomem *screen_base;
@@ -676,6 +674,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 		format = simplefb_get_format_of(dev, of_node);
 		if (IS_ERR(format))
 			return ERR_CAST(format);
+
+		panel_node = of_parse_phandle(of_node, "panel", 0);
+		if (panel_node) {
+			simplefb_read_u32_of(dev, panel_node, "width-mm", &width_mm);
+			simplefb_read_u32_of(dev, panel_node, "height-mm", &height_mm);
+			of_node_put(panel_node);
+		}
 	} else {
 		drm_err(dev, "no simplefb configuration found\n");
 		return ERR_PTR(-ENODEV);
@@ -686,7 +691,16 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 			return ERR_PTR(-EINVAL);
 	}
 
-	sdev->mode = simpledrm_mode(width, height);
+	/*
+	 * Assume a monitor resolution of 96 dpi if physical dimensions
+	 * are not specified to get a somewhat reasonable screen size.
+	 */
+	if (!width_mm)
+		width_mm = DRM_MODE_RES_MM(width, 96ul);
+	if (!height_mm)
+		height_mm = DRM_MODE_RES_MM(height, 96ul);
+
+	sdev->mode = simpledrm_mode(width, height, width_mm, height_mm);
 	sdev->format = format;
 	sdev->pitch = stride;
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 1/2] drm/simpledrm: Allow physical width and height configuration via panel node
@ 2023-01-26 18:24   ` Rayyan Ansari
  0 siblings, 0 replies; 12+ messages in thread
From: Rayyan Ansari @ 2023-01-26 18:24 UTC (permalink / raw)
  To: dri-devel
  Cc: devicetree, linux-fbdev, janne, Krzysztof Kozlowski,
	Thomas Zimmermann, Rayyan Ansari, Javier Martinez Canillas,
	linux-kernel, Hans de Goede, Rob Herring,
	~postmarketos/upstreaming, asahi

Parse the width-mm and height-mm devicetree properties of the panel node,
and use this to set the DRM Display Mode instead of calculating it
based on a hardcoded DPI.

Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>
---
 drivers/gpu/drm/tiny/simpledrm.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index 162eb44dcba8..f8b18441cfcb 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -599,16 +599,12 @@ static const struct drm_mode_config_funcs simpledrm_mode_config_funcs = {
  */
 
 static struct drm_display_mode simpledrm_mode(unsigned int width,
-					      unsigned int height)
+					      unsigned int height,
+					      unsigned int width_mm,
+					      unsigned int height_mm)
 {
-	/*
-	 * Assume a monitor resolution of 96 dpi to
-	 * get a somewhat reasonable screen size.
-	 */
 	const struct drm_display_mode mode = {
-		DRM_MODE_INIT(60, width, height,
-			      DRM_MODE_RES_MM(width, 96ul),
-			      DRM_MODE_RES_MM(height, 96ul))
+		DRM_MODE_INIT(60, width, height, width_mm, height_mm)
 	};
 
 	return mode;
@@ -622,6 +618,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 	struct simpledrm_device *sdev;
 	struct drm_device *dev;
 	int width, height, stride;
+	int width_mm = 0, height_mm = 0;
+	struct device_node *panel_node;
 	const struct drm_format_info *format;
 	struct resource *res, *mem;
 	void __iomem *screen_base;
@@ -676,6 +674,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 		format = simplefb_get_format_of(dev, of_node);
 		if (IS_ERR(format))
 			return ERR_CAST(format);
+
+		panel_node = of_parse_phandle(of_node, "panel", 0);
+		if (panel_node) {
+			simplefb_read_u32_of(dev, panel_node, "width-mm", &width_mm);
+			simplefb_read_u32_of(dev, panel_node, "height-mm", &height_mm);
+			of_node_put(panel_node);
+		}
 	} else {
 		drm_err(dev, "no simplefb configuration found\n");
 		return ERR_PTR(-ENODEV);
@@ -686,7 +691,16 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
 			return ERR_PTR(-EINVAL);
 	}
 
-	sdev->mode = simpledrm_mode(width, height);
+	/*
+	 * Assume a monitor resolution of 96 dpi if physical dimensions
+	 * are not specified to get a somewhat reasonable screen size.
+	 */
+	if (!width_mm)
+		width_mm = DRM_MODE_RES_MM(width, 96ul);
+	if (!height_mm)
+		height_mm = DRM_MODE_RES_MM(height, 96ul);
+
+	sdev->mode = simpledrm_mode(width, height, width_mm, height_mm);
 	sdev->format = format;
 	sdev->pitch = stride;
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 2/2] dt-bindings: display: simple-framebuffer: Document the panel node
  2023-01-26 18:24 ` Rayyan Ansari
@ 2023-01-26 18:24   ` Rayyan Ansari
  -1 siblings, 0 replies; 12+ messages in thread
From: Rayyan Ansari @ 2023-01-26 18:24 UTC (permalink / raw)
  To: dri-devel
  Cc: ~postmarketos/upstreaming, asahi, janne, Rayyan Ansari,
	Daniel Vetter, David Airlie, devicetree, Hans de Goede,
	Javier Martinez Canillas, Krzysztof Kozlowski, linux-fbdev,
	linux-kernel, Rob Herring, Thomas Zimmermann

Document the new panel node and what it is used for.

Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>
---
 .../devicetree/bindings/display/simple-framebuffer.yaml  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
index dd64f70b5014..4e10a100b6c8 100644
--- a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
+++ b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
@@ -26,6 +26,11 @@ description: |+
   over control to a driver for the real hardware. The bindings for the
   hw nodes must specify which node is considered the primary node.
 
+  If a panel node is given, then the driver uses this to configure the
+  physical width and height of the display. If no panel node is given,
+  then the driver uses the width and height properties of the simplefb
+  node to estimate it.
+
   It is advised to add display# aliases to help the OS determine how
   to number things. If display# aliases are used, then if the simplefb
   node contains a display property then the /aliases/display# path
@@ -110,6 +115,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/phandle
     description: Primary display hardware node
 
+  panel:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Display panel node
+
   allwinner,pipeline:
     description: Pipeline used by the framebuffer on Allwinner SoCs
     enum:
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 2/2] dt-bindings: display: simple-framebuffer: Document the panel node
@ 2023-01-26 18:24   ` Rayyan Ansari
  0 siblings, 0 replies; 12+ messages in thread
From: Rayyan Ansari @ 2023-01-26 18:24 UTC (permalink / raw)
  To: dri-devel
  Cc: devicetree, linux-fbdev, janne, Krzysztof Kozlowski,
	Thomas Zimmermann, Rayyan Ansari, Javier Martinez Canillas,
	linux-kernel, Hans de Goede, Rob Herring,
	~postmarketos/upstreaming, asahi

Document the new panel node and what it is used for.

Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>
---
 .../devicetree/bindings/display/simple-framebuffer.yaml  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
index dd64f70b5014..4e10a100b6c8 100644
--- a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
+++ b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
@@ -26,6 +26,11 @@ description: |+
   over control to a driver for the real hardware. The bindings for the
   hw nodes must specify which node is considered the primary node.
 
+  If a panel node is given, then the driver uses this to configure the
+  physical width and height of the display. If no panel node is given,
+  then the driver uses the width and height properties of the simplefb
+  node to estimate it.
+
   It is advised to add display# aliases to help the OS determine how
   to number things. If display# aliases are used, then if the simplefb
   node contains a display property then the /aliases/display# path
@@ -110,6 +115,10 @@ properties:
     $ref: /schemas/types.yaml#/definitions/phandle
     description: Primary display hardware node
 
+  panel:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Display panel node
+
   allwinner,pipeline:
     description: Pipeline used by the framebuffer on Allwinner SoCs
     enum:
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 2/2] dt-bindings: display: simple-framebuffer: Document the panel node
  2023-01-26 18:24   ` Rayyan Ansari
@ 2023-01-30 19:01     ` Rob Herring
  -1 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2023-01-30 19:01 UTC (permalink / raw)
  To: Rayyan Ansari
  Cc: ~postmarketos/upstreaming, asahi, dri-devel,
	Javier Martinez Canillas, Krzysztof Kozlowski, Daniel Vetter,
	devicetree, Rob Herring, janne, David Airlie, Hans de Goede,
	linux-kernel, linux-fbdev, Thomas Zimmermann


On Thu, 26 Jan 2023 18:24:35 +0000, Rayyan Ansari wrote:
> Document the new panel node and what it is used for.
> 
> Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>
> ---
>  .../devicetree/bindings/display/simple-framebuffer.yaml  | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 2/2] dt-bindings: display: simple-framebuffer: Document the panel node
@ 2023-01-30 19:01     ` Rob Herring
  0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2023-01-30 19:01 UTC (permalink / raw)
  To: Rayyan Ansari
  Cc: devicetree, linux-fbdev, Krzysztof Kozlowski, Thomas Zimmermann,
	janne, Javier Martinez Canillas, dri-devel, linux-kernel,
	Hans de Goede, Rob Herring, ~postmarketos/upstreaming, asahi


On Thu, 26 Jan 2023 18:24:35 +0000, Rayyan Ansari wrote:
> Document the new panel node and what it is used for.
> 
> Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>
> ---
>  .../devicetree/bindings/display/simple-framebuffer.yaml  | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/2] drm/simpledrm: Allow physical width and height configuration via panel node
  2023-01-26 18:24   ` Rayyan Ansari
@ 2023-01-31  8:57     ` Thomas Zimmermann
  -1 siblings, 0 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2023-01-31  8:57 UTC (permalink / raw)
  To: Rayyan Ansari, dri-devel
  Cc: devicetree, linux-fbdev, janne, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-kernel, Hans de Goede,
	Rob Herring, ~postmarketos/upstreaming, asahi


[-- Attachment #1.1: Type: text/plain, Size: 3206 bytes --]



Am 26.01.23 um 19:24 schrieb Rayyan Ansari:
> Parse the width-mm and height-mm devicetree properties of the panel node,
> and use this to set the DRM Display Mode instead of calculating it
> based on a hardcoded DPI.
> 
> Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/tiny/simpledrm.c | 32 +++++++++++++++++++++++---------
>   1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 162eb44dcba8..f8b18441cfcb 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -599,16 +599,12 @@ static const struct drm_mode_config_funcs simpledrm_mode_config_funcs = {
>    */
>   
>   static struct drm_display_mode simpledrm_mode(unsigned int width,
> -					      unsigned int height)
> +					      unsigned int height,
> +					      unsigned int width_mm,
> +					      unsigned int height_mm)
>   {
> -	/*
> -	 * Assume a monitor resolution of 96 dpi to
> -	 * get a somewhat reasonable screen size.
> -	 */
>   	const struct drm_display_mode mode = {
> -		DRM_MODE_INIT(60, width, height,
> -			      DRM_MODE_RES_MM(width, 96ul),
> -			      DRM_MODE_RES_MM(height, 96ul))
> +		DRM_MODE_INIT(60, width, height, width_mm, height_mm)
>   	};
>   
>   	return mode;
> @@ -622,6 +618,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>   	struct simpledrm_device *sdev;
>   	struct drm_device *dev;
>   	int width, height, stride;
> +	int width_mm = 0, height_mm = 0;
> +	struct device_node *panel_node;
>   	const struct drm_format_info *format;
>   	struct resource *res, *mem;
>   	void __iomem *screen_base;
> @@ -676,6 +674,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>   		format = simplefb_get_format_of(dev, of_node);
>   		if (IS_ERR(format))
>   			return ERR_CAST(format);
> +
> +		panel_node = of_parse_phandle(of_node, "panel", 0);
> +		if (panel_node) {
> +			simplefb_read_u32_of(dev, panel_node, "width-mm", &width_mm);
> +			simplefb_read_u32_of(dev, panel_node, "height-mm", &height_mm);
> +			of_node_put(panel_node);
> +		}
>   	} else {
>   		drm_err(dev, "no simplefb configuration found\n");
>   		return ERR_PTR(-ENODEV);
> @@ -686,7 +691,16 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>   			return ERR_PTR(-EINVAL);
>   	}
>   
> -	sdev->mode = simpledrm_mode(width, height);
> +	/*
> +	 * Assume a monitor resolution of 96 dpi if physical dimensions
> +	 * are not specified to get a somewhat reasonable screen size.
> +	 */
> +	if (!width_mm)
> +		width_mm = DRM_MODE_RES_MM(width, 96ul);
> +	if (!height_mm)
> +		height_mm = DRM_MODE_RES_MM(height, 96ul);
> +
> +	sdev->mode = simpledrm_mode(width, height, width_mm, height_mm);
>   	sdev->format = format;
>   	sdev->pitch = stride;
>   

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/2] drm/simpledrm: Allow physical width and height configuration via panel node
@ 2023-01-31  8:57     ` Thomas Zimmermann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2023-01-31  8:57 UTC (permalink / raw)
  To: Rayyan Ansari, dri-devel
  Cc: devicetree, linux-fbdev, janne, linux-kernel,
	Javier Martinez Canillas, Hans de Goede, Rob Herring,
	~postmarketos/upstreaming, Krzysztof Kozlowski, asahi


[-- Attachment #1.1: Type: text/plain, Size: 3206 bytes --]



Am 26.01.23 um 19:24 schrieb Rayyan Ansari:
> Parse the width-mm and height-mm devicetree properties of the panel node,
> and use this to set the DRM Display Mode instead of calculating it
> based on a hardcoded DPI.
> 
> Signed-off-by: Rayyan Ansari <rayyan@ansari.sh>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/tiny/simpledrm.c | 32 +++++++++++++++++++++++---------
>   1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
> index 162eb44dcba8..f8b18441cfcb 100644
> --- a/drivers/gpu/drm/tiny/simpledrm.c
> +++ b/drivers/gpu/drm/tiny/simpledrm.c
> @@ -599,16 +599,12 @@ static const struct drm_mode_config_funcs simpledrm_mode_config_funcs = {
>    */
>   
>   static struct drm_display_mode simpledrm_mode(unsigned int width,
> -					      unsigned int height)
> +					      unsigned int height,
> +					      unsigned int width_mm,
> +					      unsigned int height_mm)
>   {
> -	/*
> -	 * Assume a monitor resolution of 96 dpi to
> -	 * get a somewhat reasonable screen size.
> -	 */
>   	const struct drm_display_mode mode = {
> -		DRM_MODE_INIT(60, width, height,
> -			      DRM_MODE_RES_MM(width, 96ul),
> -			      DRM_MODE_RES_MM(height, 96ul))
> +		DRM_MODE_INIT(60, width, height, width_mm, height_mm)
>   	};
>   
>   	return mode;
> @@ -622,6 +618,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>   	struct simpledrm_device *sdev;
>   	struct drm_device *dev;
>   	int width, height, stride;
> +	int width_mm = 0, height_mm = 0;
> +	struct device_node *panel_node;
>   	const struct drm_format_info *format;
>   	struct resource *res, *mem;
>   	void __iomem *screen_base;
> @@ -676,6 +674,13 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>   		format = simplefb_get_format_of(dev, of_node);
>   		if (IS_ERR(format))
>   			return ERR_CAST(format);
> +
> +		panel_node = of_parse_phandle(of_node, "panel", 0);
> +		if (panel_node) {
> +			simplefb_read_u32_of(dev, panel_node, "width-mm", &width_mm);
> +			simplefb_read_u32_of(dev, panel_node, "height-mm", &height_mm);
> +			of_node_put(panel_node);
> +		}
>   	} else {
>   		drm_err(dev, "no simplefb configuration found\n");
>   		return ERR_PTR(-ENODEV);
> @@ -686,7 +691,16 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
>   			return ERR_PTR(-EINVAL);
>   	}
>   
> -	sdev->mode = simpledrm_mode(width, height);
> +	/*
> +	 * Assume a monitor resolution of 96 dpi if physical dimensions
> +	 * are not specified to get a somewhat reasonable screen size.
> +	 */
> +	if (!width_mm)
> +		width_mm = DRM_MODE_RES_MM(width, 96ul);
> +	if (!height_mm)
> +		height_mm = DRM_MODE_RES_MM(height, 96ul);
> +
> +	sdev->mode = simpledrm_mode(width, height, width_mm, height_mm);
>   	sdev->format = format;
>   	sdev->pitch = stride;
>   

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/2] SimpleDRM: allow configuring physical width and height
  2023-01-26 18:24 ` Rayyan Ansari
@ 2023-01-31  9:42   ` Thomas Zimmermann
  -1 siblings, 0 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2023-01-31  9:42 UTC (permalink / raw)
  To: Rayyan Ansari, dri-devel
  Cc: ~postmarketos/upstreaming, asahi, janne, Daniel Vetter,
	David Airlie, devicetree, Hans de Goede,
	Javier Martinez Canillas, Krzysztof Kozlowski, linux-fbdev,
	linux-kernel, Rob Herring


[-- Attachment #1.1: Type: text/plain, Size: 1175 bytes --]

Hi,

thanks a lot. I've added your patches to drm-misc-next. They should be 
in Linux v6.4.

Best regards
Thomas

Am 26.01.23 um 19:24 schrieb Rayyan Ansari:
> Hello,
> 
> The following patches:
> - Add support for configuring the width-mm and height-mm DRM mode
>    properties in the SimpleDRM driver via Device Tree
> - Document these two new Device Tree properties
> 
> This is useful for allowing interfaces such as Phosh to calculate
> proper scaling values and for early boot code knowing if hi-dpi
> rendering is necessary.
> 
> Changes since v3:
> - Use panel node
> 
> Rayyan Ansari (2):
>    drm/simpledrm: Allow physical width and height configuration via panel
>      node
>    dt-bindings: display: simple-framebuffer: Document the panel node
> 
>   .../bindings/display/simple-framebuffer.yaml  |  9 ++++++
>   drivers/gpu/drm/tiny/simpledrm.c              | 32 +++++++++++++------
>   2 files changed, 32 insertions(+), 9 deletions(-)
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 0/2] SimpleDRM: allow configuring physical width and height
@ 2023-01-31  9:42   ` Thomas Zimmermann
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Zimmermann @ 2023-01-31  9:42 UTC (permalink / raw)
  To: Rayyan Ansari, dri-devel
  Cc: devicetree, linux-fbdev, janne, Krzysztof Kozlowski,
	Javier Martinez Canillas, linux-kernel, Hans de Goede,
	Rob Herring, ~postmarketos/upstreaming, asahi


[-- Attachment #1.1: Type: text/plain, Size: 1175 bytes --]

Hi,

thanks a lot. I've added your patches to drm-misc-next. They should be 
in Linux v6.4.

Best regards
Thomas

Am 26.01.23 um 19:24 schrieb Rayyan Ansari:
> Hello,
> 
> The following patches:
> - Add support for configuring the width-mm and height-mm DRM mode
>    properties in the SimpleDRM driver via Device Tree
> - Document these two new Device Tree properties
> 
> This is useful for allowing interfaces such as Phosh to calculate
> proper scaling values and for early boot code knowing if hi-dpi
> rendering is necessary.
> 
> Changes since v3:
> - Use panel node
> 
> Rayyan Ansari (2):
>    drm/simpledrm: Allow physical width and height configuration via panel
>      node
>    dt-bindings: display: simple-framebuffer: Document the panel node
> 
>   .../bindings/display/simple-framebuffer.yaml  |  9 ++++++
>   drivers/gpu/drm/tiny/simpledrm.c              | 32 +++++++++++++------
>   2 files changed, 32 insertions(+), 9 deletions(-)
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-01-31  9:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 18:24 [PATCH v4 0/2] SimpleDRM: allow configuring physical width and height Rayyan Ansari
2023-01-26 18:24 ` Rayyan Ansari
2023-01-26 18:24 ` [PATCH v4 1/2] drm/simpledrm: Allow physical width and height configuration via panel node Rayyan Ansari
2023-01-26 18:24   ` Rayyan Ansari
2023-01-31  8:57   ` Thomas Zimmermann
2023-01-31  8:57     ` Thomas Zimmermann
2023-01-26 18:24 ` [PATCH v4 2/2] dt-bindings: display: simple-framebuffer: Document the " Rayyan Ansari
2023-01-26 18:24   ` Rayyan Ansari
2023-01-30 19:01   ` Rob Herring
2023-01-30 19:01     ` Rob Herring
2023-01-31  9:42 ` [PATCH v4 0/2] SimpleDRM: allow configuring physical width and height Thomas Zimmermann
2023-01-31  9:42   ` Thomas Zimmermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.