Skip to contentSkip to conversation

drm/sti: HQVDP plane improvements

PATCH In review Fabien Dessenne 2 participants 5 messages Dec 5, 2016 – Dec 7, 2016

Subsystems (3)
lore
Share & tools
lore
#1 lore raw

PATCH 1/2 drm/sti: load XP70 firmware only once

When a plane is enabled, after having been disabled, do not reload XP70 firmware again, but only register VTG again

---
 drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_hqvdp.c +6 -2
index f88130f..a547723 100644
@@ -332,6 +332,7 @@ struct sti_hqvdp_cmd {
  * @hqvdp_cmd_paddr:   physical address of hqvdp_cmd
  * @vtg:               vtg for main data path
  * @xp70_initialized:  true if xp70 is already initialized
+ * @vtg_registered:    true if registered to VTG
  */
 struct sti_hqvdp {
 	struct device *dev;
@@ -347,6 +348,7 @@ struct sti_hqvdp {
 	u32 hqvdp_cmd_paddr;
 	struct sti_vtg *vtg;
 	bool xp70_initialized;
+	bool vtg_registered;
 };
 
 #define to_sti_hqvdp(x) container_of(x, struct sti_hqvdp, plane)
@@ -771,7 +773,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
 		DRM_ERROR("XP70 could not revert to idle\n");
 
 	hqvdp->plane.status = STI_PLANE_DISABLED;
-	hqvdp->xp70_initialized = false;
+	hqvdp->vtg_registered = false;
 }
 
 /**
@@ -1064,10 +1066,11 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 		return -EINVAL;
 	}
 
-	if (!hqvdp->xp70_initialized) {
+	if (!hqvdp->xp70_initialized)
 		/* Start HQVDP XP70 coprocessor */
 		sti_hqvdp_start_xp70(hqvdp);
 
+	if (!hqvdp->vtg_registered) {
 		/* Prevent VTG shutdown */
 		if (clk_prepare_enable(hqvdp->clk_pix_main)) {
 			DRM_ERROR("Failed to prepare/enable pix main clk\n");
@@ -1081,6 +1084,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 			DRM_ERROR("Cannot register VTG notifier\n");
 			return -EINVAL;
 		}
+		hqvdp->vtg_registered = true;
 	}
 
 	DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] drm/sti: load XP70 firmware only once

2016-12-05 16:09 GMT+01:00 Fabien Dessenne <[email protected]>:

Quoted 61 lines

When a plane is enabled, after having been disabled, do not reload XP70 firmware again, but only register VTG again

---
 drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_hqvdp.c +6 -3
index f88130f..a547723 100644
@@ -332,6 +332,7 @@ struct sti_hqvdp_cmd {
  * @hqvdp_cmd_paddr:   physical address of hqvdp_cmd
  * @vtg:               vtg for main data path
  * @xp70_initialized:  true if xp70 is already initialized
+ * @vtg_registered:    true if registered to VTG
  */
 struct sti_hqvdp {
        struct device *dev;
@@ -347,6 +348,7 @@ struct sti_hqvdp {
        u32 hqvdp_cmd_paddr;
        struct sti_vtg *vtg;
        bool xp70_initialized;
+       bool vtg_registered;
 };
 
 #define to_sti_hqvdp(x) container_of(x, struct sti_hqvdp, plane)
@@ -771,7 +773,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
                DRM_ERROR("XP70 could not revert to idle\n");
 
        hqvdp->plane.status = STI_PLANE_DISABLED;
-       hqvdp->xp70_initialized = false;
+       hqvdp->vtg_registered = false;
 }
 
 /**
@@ -1064,10 +1066,11 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
                return -EINVAL;
        }
 
-       if (!hqvdp->xp70_initialized) {
+       if (!hqvdp->xp70_initialized)
                /* Start HQVDP XP70 coprocessor */
                sti_hqvdp_start_xp70(hqvdp);
 
+       if (!hqvdp->vtg_registered) {
                /* Prevent VTG shutdown */
                if (clk_prepare_enable(hqvdp->clk_pix_main)) {
                        DRM_ERROR("Failed to prepare/enable pix main clk\n");
@@ -1081,6 +1084,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
                        DRM_ERROR("Cannot register VTG notifier\n");
                        return -EINVAL;
                }
+               hqvdp->vtg_registered = true;
        }
 
        DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
--

2.7.4

Signature · 11 lines
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 2/2 drm/sti: do not post HQVDP command if no update

In reply to Fabien Dessenne

Do not process update requests with unmodified parameters.

Since the HQVDP command queue is limited to 2, we shall take care of not posting unneeded commands, which would abusively fill the command queue leading to frame update skip.
This typically happens when the driver is called with legacy (non-atomic) IOCTL : in that case atomic_update() is called multiple times with the same parameters.

---
 drivers/gpu/drm/sti/sti_hqvdp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/sti/sti_hqvdp.c +15 -0
index a547723..55cbaea 100644
@@ -1117,6 +1117,21 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
 	if (!crtc || !fb)
 		return;
 
+	if ((oldstate->fb == state->fb) &&
+	    (oldstate->crtc_x == state->crtc_x) &&
+	    (oldstate->crtc_y == state->crtc_y) &&
+	    (oldstate->crtc_w == state->crtc_w) &&
+	    (oldstate->crtc_h == state->crtc_h) &&
+	    (oldstate->src_x == state->src_x) &&
+	    (oldstate->src_y == state->src_y) &&
+	    (oldstate->src_w == state->src_w) &&
+	    (oldstate->src_h == state->src_h)) {
+		/* No change since last update, do not post cmd */
+		DRM_DEBUG_DRIVER("No change, not posting cmd\n");
+		plane->status = STI_PLANE_UPDATED;
+		return;
+	}
+
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] drm/sti: do not post HQVDP command if no update

2016-12-05 16:09 GMT+01:00 Fabien Dessenne <[email protected]>:

Quoted 43 lines

Do not process update requests with unmodified parameters.

Since the HQVDP command queue is limited to 2, we shall take care of not posting unneeded commands, which would abusively fill the command queue leading to frame update skip.
This typically happens when the driver is called with legacy (non-atomic) IOCTL : in that case atomic_update() is called multiple times with the same parameters.

---
 drivers/gpu/drm/sti/sti_hqvdp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/sti/sti_hqvdp.c +15 -1
index a547723..55cbaea 100644
@@ -1117,6 +1117,21 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
        if (!crtc || !fb)
                return;
 
+       if ((oldstate->fb == state->fb) &&
+           (oldstate->crtc_x == state->crtc_x) &&
+           (oldstate->crtc_y == state->crtc_y) &&
+           (oldstate->crtc_w == state->crtc_w) &&
+           (oldstate->crtc_h == state->crtc_h) &&
+           (oldstate->src_x == state->src_x) &&
+           (oldstate->src_y == state->src_y) &&
+           (oldstate->src_w == state->src_w) &&
+           (oldstate->src_h == state->src_h)) {
+               /* No change since last update, do not post cmd */
+               DRM_DEBUG_DRIVER("No change, not posting cmd\n");
+               plane->status = STI_PLANE_UPDATED;
+               return;
+       }
+
        mode = &crtc->mode;
        dst_x = state->crtc_x;
        dst_y = state->crtc_y;
--

2.7.4

Signature · 11 lines
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel