Skip to contentSkip to conversation

Miscellaneous mode set and page flip fixes

PATCH In review Laurent Pinchart 5 participants 10 messages May 31, 2012 – Mar 28, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Miscellaneous mode set and page flip fixes

Hi everybody,

Here are two small fixes that disallow format changes in page flip operations, and perform a full mode set instead of a mode set base in the CRTC helper set config handler if the pixel format changed.

Laurent Pinchart (2):
drm: Don't allow page flip to change pixel format
drm: Perform a full mode set when the pixel format changed

 drivers/gpu/drm/drm_crtc.c        |    8 ++++++++
 drivers/gpu/drm/drm_crtc_helper.c |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart
#1 lore raw

PATCH 1/2 drm: Don't allow page flip to change pixel format

A page flip is not a mode set, changing the frame buffer pixel format doesn't make sense and isn't handled by most drivers anyway. Disallow it.

---
 drivers/gpu/drm/drm_crtc.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +8 -0
index 92cea9d..0d15b56 100644
@@ -3530,6 +3530,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
+	if (crtc->fb->pixel_format != fb->pixel_format ||
+	    crtc->fb->bits_per_pixel != crtc->fb->bits_per_pixel ||
+	    crtc->fb->depth != fb->depth) {
+		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
 	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
 		ret = -ENOMEM;
 		spin_lock_irqsave(&dev->event_lock, flags);
Signature · 1 line
1.7.3.4
#2 lore raw

RE: [PATCH 1/2] drm: Don't allow page flip to change pixel format

Does this by extension mean that stride changes should also not be allowed while page flipping? Thanks,
Satyeshwar

-----Original Message-----
From: dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org [mailto:dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org] On Behalf Of Laurent Pinchart
Sent: Thursday, May 31, 2012 9:26 AM
To: [email protected]
Subject: [PATCH 1/2] drm: Don't allow page flip to change pixel format

A page flip is not a mode set, changing the frame buffer pixel format doesn't make sense and isn't handled by most drivers anyway. Disallow it.

---
 drivers/gpu/drm/drm_crtc.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +8 -0
@@ -3530,6 +3530,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
 		goto out;
 	}
 
+	if (crtc->fb->pixel_format != fb->pixel_format ||
+	    crtc->fb->bits_per_pixel != crtc->fb->bits_per_pixel ||
+	    crtc->fb->depth != fb->depth) {
+		DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+		ret = -EINVAL;
+		goto out;
+	}
+
 	if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
 		ret = -ENOMEM;
 		spin_lock_irqsave(&dev->event_lock, flags);

--
1.7.3.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH 1/2] drm: Don't allow page flip to change pixel format

Quoted 1 line · Satyeshwar

Does this by extension mean that stride changes should also not be allowed while page flipping?

Everything beyond a crtc base address change should require a full modeset.

Alex

Quoted 45 lines

Thanks,
Satyeshwar

-----Original Message-----
From: dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org [mailto:dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org] On Behalf Of Laurent Pinchart
Sent: Thursday, May 31, 2012 9:26 AM
To: [email protected]
Subject: [PATCH 1/2] drm: Don't allow page flip to change pixel format

A page flip is not a mode set, changing the frame buffer pixel format doesn't make sense and isn't handled by most drivers anyway. Disallow it.

---
 drivers/gpu/drm/drm_crtc.c |    8 ++++++++

 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +8 -1
@@ -3530,6 +3530,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
                goto out;
        }
 
+       if (crtc->fb->pixel_format != fb->pixel_format ||
+           crtc->fb->bits_per_pixel != crtc->fb->bits_per_pixel ||
+           crtc->fb->depth != fb->depth) {
+               DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
        if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
                ret = -ENOMEM;
                spin_lock_irqsave(&dev->event_lock, flags);
--

1.7.3.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH 1/2] drm: Don't allow page flip to change pixel format

Quoted 5 lines · Alex Deucher
Quoted 1 line · Satyeshwar

Does this by extension mean that stride changes should also not be allowed while page flipping?

Everything beyond a crtc base address change should require a full modeset.

That's a rather silly limitation on decent hardware, but perhaps it makes sense with the current API. My recent patch for i915 just rejected pixel format, pitch and offset changes on the driver side. The hardware can actually handle such things, except currently the driver uses pipelined flips instead of direct register banging, which imposes these limitations.

For the atomic mode setting API I don't plan to special case page flips in generic code at all. I'll leave it up to the driver to decide what operations it can perform atomically and/or asynchronously.

Quoted 20 lines
Quoted 20 lines

-----Original Message-----
From: dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org [mailto:dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org] On Behalf Of Laurent Pinchart
Sent: Thursday, May 31, 2012 9:26 AM
To: [email protected]
Subject: [PATCH 1/2] drm: Don't allow page flip to change pixel format

A page flip is not a mode set, changing the frame buffer pixel format doesn't make sense and isn't handled by most drivers anyway. Disallow it.

---
 drivers/gpu/drm/drm_crtc.c |    8 ++++++++

 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +0 -0
@@ -3530,6 +3530,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
                goto out;
        }
 
Quoted 3 lines

drivers/gpu/drm/drm_crtc.c int drm_mode_page_flip_ioctl(struct drm_device *dev, · line 3535

Quoted 3 lines
drivers/gpu/drm/drm_crtc.c +3 -0
+       if (crtc->fb->pixel_format != fb->pixel_format ||
+           crtc->fb->bits_per_pixel != crtc->fb->bits_per_pixel ||
+           crtc->fb->depth != fb->depth) {

The bits_per_pixel and depth comparisons are pointless. I'm thinking we should perhaps just remove them from the structure, so that drivers would be forced to actually use pixel_format.

I'm not sure if all the drivers have already been fixed to actually check the requested pixel_format or not, or can you ask for example RGBA8888 and have the hardware scan it out as ARGB8888 instead.

Signature · 2 lines
Ville Syrjälä
Intel OTC
#5 lore raw

Re: [PATCH 1/2] drm: Don't allow page flip to change pixel format

In reply to Alex Deucher

That's probably safest, however on Intel we can change the stride and tiling format for sync flips at least. But I'm ok with this patch; we generally need to recalculate bw requirements and watermarks when adjusting depth and such.

Quoted 58 lines · On Thu, 31 May 2012 15:54:03 -0400 Alex Deucher <[email protected]> wrote:
Quoted 1 line · Satyeshwar

Does this by extension mean that stride changes should also not be allowed while page flipping?

Everything beyond a crtc base address change should require a full modeset.

Alex

Quoted 37 lines

Thanks,
Satyeshwar

-----Original Message-----
From: dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org [mailto:dri-devel-bounces+satyeshwar.singh=intel.com@lists.freedesktop.org] On Behalf Of Laurent Pinchart
Sent: Thursday, May 31, 2012 9:26 AM
To: [email protected]
Subject: [PATCH 1/2] drm: Don't allow page flip to change pixel format

A page flip is not a mode set, changing the frame buffer pixel format doesn't make sense and isn't handled by most drivers anyway. Disallow it.

---
 drivers/gpu/drm/drm_crtc.c |    8 ++++++++

 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc.c +8 -1
@@ -3530,6 +3530,14 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
                goto out;
        }
 
+       if (crtc->fb->pixel_format != fb->pixel_format ||
+           crtc->fb->bits_per_pixel != crtc->fb->bits_per_pixel ||
+           crtc->fb->depth != fb->depth) {
+               DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
        if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
                ret = -ENOMEM;
                spin_lock_irqsave(&dev->event_lock, flags);
--

1.7.3.4

Quoted 8 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 2/2 drm: Perform a full mode set when the pixel format changed

In reply to Laurent Pinchart

Test whether the pixel format changes in the mode set handler, and perform a full mode set instead of a mode set base if it does.

---
 drivers/gpu/drm/drm_crtc_helper.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_crtc_helper.c +3 -0
index 3252e70..0e8cd89 100644
@@ -609,6 +609,9 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
 		} else if (set->fb->bits_per_pixel !=
 			   set->crtc->fb->bits_per_pixel) {
 			mode_changed = true;
+		} else if (set->fb->pixel_format !=
+			   set->crtc->fb->pixel_format) {
+			mode_changed = true;
 		} else
 			fb_changed = true;
 	}
Signature · 1 line
1.7.3.4
#7 lore raw
In reply to Laurent Pinchart
Quoted 5 lines · On Thursday 31 May 2012 18:26:14 Laurent Pinchart wrote:

Hi everybody,

Here are two small fixes that disallow format changes in page flip operations, and perform a full mode set instead of a mode set base in the CRTC helper set config handler if the pixel format changed.

Ping ? Can those two patches be applied ?

Quoted 7 lines

Laurent Pinchart (2):
drm: Don't allow page flip to change pixel format
drm: Perform a full mode set when the pixel format changed

 drivers/gpu/drm/drm_crtc.c        |    8 ++++++++
 drivers/gpu/drm/drm_crtc_helper.c |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw
Quoted 8 lines · On Thursday 19 July 2012 13:55:37 Laurent Pinchart wrote:
Quoted 5 lines · On Thursday 31 May 2012 18:26:14 Laurent Pinchart wrote:

Hi everybody,

Here are two small fixes that disallow format changes in page flip operations, and perform a full mode set instead of a mode set base in the CRTC helper set config handler if the pixel format changed.

Ping ? Can those two patches be applied ?

Ping again ?

Quoted 7 lines
Quoted 7 lines

Laurent Pinchart (2):
drm: Don't allow page flip to change pixel format
drm: Perform a full mode set when the pixel format changed

 drivers/gpu/drm/drm_crtc.c        |    8 ++++++++
 drivers/gpu/drm/drm_crtc_helper.c |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart
#9 lore raw
Quoted 4 lines · On Thursday 23 August 2012 12:05:27 Laurent Pinchart wrote:
Quoted 3 lines · On Thursday 19 July 2012 13:55:37 Laurent Pinchart wrote:
Quoted 2 lines · On Thursday 31 May 2012 18:26:14 Laurent Pinchart wrote:

Hi everybody,

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Here are two small fixes that disallow format changes in page flip operations, and perform a full mode set instead of a mode set base in the
CRTC helper set config handler if the pixel format changed.

Ping ? Can those two patches be applied ?

Ping again ?

And again ? :-)

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Laurent Pinchart (2):
drm: Don't allow page flip to change pixel format
drm: Perform a full mode set when the pixel format changed

 drivers/gpu/drm/drm_crtc.c        |    8 ++++++++
 drivers/gpu/drm/drm_crtc_helper.c |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart