drm/sti: forbid plane on several mixer
Subsystems (3)
PATCH 1/1 drm/sti: forbid plane on several mixer
When a plane is going to be enabled we re-evaluate the possible crtcs for the associated drm plane. Only the crtc on which the plane should be displayed is considered possible until the plane is disabled. Indeed STI hardware does not allow to dynamically change
the plane's crtc/mixer assignment when the plane is in use (gdp is running).
--- drivers/gpu/drm/sti/sti_gdp.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_plane.h | 2 ++ 2 files changed, 17 insertions(+)
drivers/gpu/drm/sti/sti_gdp.c +15 -0
@@ -71,6 +71,9 @@ static struct gdp_format_to_str {#define GDP_NODE_NB_BANK 2#define GDP_NODE_PER_FIELD 2 +#define MAIN_CRTC_MASK BIT(0) +#define AUX_CRTC_MASK BIT(1) +struct sti_gdp_node {u32 gam_gdp_ctl;u32 gam_gdp_agc;
@@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, } } +/* re-evaluate the possible crtcs */ +if (mixer->id ==STI_MIXER_MAIN ) + drm_plane->possible_crtcs =MAIN_CRTC_MASK ; +else + drm_plane->possible_crtcs =AUX_CRTC_MASK ; +DRM_DEBUG_KMS ("CRTC:%d (%s) drm plane:%d (%s)\n" , crtc->base.id,sti_mixer_to_str (mixer), drm_plane->base.id,sti_plane_to_str (plane));
@@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane, {struct sti_plane *plane =to_sti_plane (drm_plane); +/* restore possible crtcs value with the initial value */ + drm_plane->possible_crtcs = plane->init_possible_crtcs; +if (!drm_plane->crtc) {DRM_DEBUG_DRIVER ("drm plane:%d not enabled\n" , drm_plane->base.id);
@@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,sti_gdp_init (gdp); +/* store the initial value of possible crtcs */ + gdp->plane.init_possible_crtcs = possible_crtcs; + res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, possible_crtcs, &sti_gdp_plane_helpers_funcs,
drivers/gpu/drm/sti/sti_plane.h +2 -0
@@ -66,12 +66,14 @@ struct sti_fps_info {* @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane +* @init_possile_crtcs: store the initial possible crtc value * @fps_info: frame per second info */ struct sti_plane {struct drm_plane drm_plane;enum sti_plane_desc desc;enum sti_plane_status status; +u32 init_possible_crtcs;struct sti_fps_info fps_info; };
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
2016-09-14 13:40 GMT+02:00 Vincent Abriou <[email protected]>:
Quoted 82 lines
When a plane is going to be enabled we re-evaluate the possible crtcs for the associated drm plane. Only the crtc on which the plane should be displayed is considered possible until the plane is disabled. Indeed STI hardware does not allow to dynamically change
the plane's crtc/mixer assignment when the plane is in use (gdp is running).Signed-off-by Vincent Abriou <[email protected]>--- drivers/gpu/drm/sti/sti_gdp.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_plane.h | 2 ++ 2 files changed, 17 insertions(+)drivers/gpu/drm/sti/sti_gdp.c +15
-0@@ -71,6 +71,9 @@ static struct gdp_format_to_str {#define GDP_NODE_NB_BANK 2#define GDP_NODE_PER_FIELD 2 +#define MAIN_CRTC_MASK BIT(0) +#define AUX_CRTC_MASK BIT(1) +struct sti_gdp_node {u32 gam_gdp_ctl;u32 gam_gdp_agc;@@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, } } +/* re-evaluate the possible crtcs */ +if (mixer->id ==STI_MIXER_MAIN ) + drm_plane->possible_crtcs =MAIN_CRTC_MASK ; +else + drm_plane->possible_crtcs =AUX_CRTC_MASK ; +DRM_DEBUG_KMS ("CRTC:%d (%s) drm plane:%d (%s)\n" , crtc->base.id,sti_mixer_to_str (mixer), drm_plane->base.id,sti_plane_to_str (plane));@@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane, {struct sti_plane *plane =to_sti_plane (drm_plane); +/* restore possible crtcs value with the initial value */ + drm_plane->possible_crtcs = plane->init_possible_crtcs; +if (!drm_plane->crtc) {DRM_DEBUG_DRIVER ("drm plane:%d not enabled\n" , drm_plane->base.id);@@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,sti_gdp_init (gdp); +/* store the initial value of possible crtcs */ + gdp->plane.init_possible_crtcs = possible_crtcs; + res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, possible_crtcs, &sti_gdp_plane_helpers_funcs,drivers/gpu/drm/sti/sti_plane.h +2
-1@@ -66,12 +66,14 @@ struct sti_fps_info {* @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane +* @init_possile_crtcs: store the initial possible crtc value * @fps_info: frame per second info */ struct sti_plane {struct drm_plane drm_plane;enum sti_plane_desc desc;enum sti_plane_status status; +u32 init_possible_crtcs;struct sti_fps_info fps_info; }; --1.9.1
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
Quoted 28 lines · Vincent Abriou
When a plane is going to be enabled we re-evaluate the possible crtcs for the associated drm plane. Only the crtc on which the plane should be displayed is considered possible until the plane is disabled. Indeed STI hardware does not allow to dynamically change
the plane's crtc/mixer assignment when the plane is in use (gdp is running).Signed-off-by Vincent Abriou <[email protected]>--- drivers/gpu/drm/sti/sti_gdp.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_plane.h | 2 ++ 2 files changed, 17 insertions(+)drivers/gpu/drm/sti/sti_gdp.c +3
-0@@ -71,6 +71,9 @@ static struct gdp_format_to_str {#define GDP_NODE_NB_BANK 2#define GDP_NODE_PER_FIELD 2 +#define MAIN_CRTC_MASK BIT(0) +#define AUX_CRTC_MASK BIT(1) +struct sti_gdp_node {u32 gam_gdp_ctl;u32 gam_gdp_agc;
drivers/gpu/drm/sti/sti_gdp.c static int sti_gdp_atomic_check(struct drm_plane *drm_plane, · line 700
Quoted 8 lines
drivers/gpu/drm/sti/sti_gdp.c +5
-0@@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, } } +/* re-evaluate the possible crtcs */ +if (mixer->id ==STI_MIXER_MAIN ) + drm_plane->possible_crtcs =MAIN_CRTC_MASK ; +else + drm_plane->possible_crtcs =AUX_CRTC_MASK ;
This stuff isn't meant to be changed dynamically. There's no event for telling userspace to re-examine this sort of information.
Quoted 50 lines
drivers/gpu/drm/sti/sti_gdp.c +7
-0+DRM_DEBUG_KMS ("CRTC:%d (%s) drm plane:%d (%s)\n" , crtc->base.id,sti_mixer_to_str (mixer), drm_plane->base.id,sti_plane_to_str (plane));@@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane, {struct sti_plane *plane =to_sti_plane (drm_plane); +/* restore possible crtcs value with the initial value */ + drm_plane->possible_crtcs = plane->init_possible_crtcs; +if (!drm_plane->crtc) {DRM_DEBUG_DRIVER ("drm plane:%d not enabled\n" , drm_plane->base.id);@@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,sti_gdp_init (gdp); +/* store the initial value of possible crtcs */ + gdp->plane.init_possible_crtcs = possible_crtcs; + res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, possible_crtcs, &sti_gdp_plane_helpers_funcs,drivers/gpu/drm/sti/sti_plane.h +2
-0@@ -66,12 +66,14 @@ struct sti_fps_info {* @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane +* @init_possile_crtcs: store the initial possible crtc value * @fps_info: frame per second info */ struct sti_plane {struct drm_plane drm_plane;enum sti_plane_desc desc;enum sti_plane_status status; +u32 init_possible_crtcs;struct sti_fps_info fps_info; };Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Vincent Abriou
When a plane is going to be enabled we re-evaluate the possible crtcs for the associated drm plane. Only the crtc on which the plane should be displayed is considered possible until the plane is disabled. Indeed STI hardware does not allow to dynamically change
the plane's crtc/mixer assignment when the plane is in use (gdp is running).Signed-off-by Vincent Abriou <[email protected]>--- drivers/gpu/drm/sti/sti_gdp.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_plane.h | 2 ++ 2 files changed, 17 insertions(+)drivers/gpu/drm/sti/sti_gdp.c +3
-0@@ -71,6 +71,9 @@ static struct gdp_format_to_str {#define GDP_NODE_NB_BANK 2#define GDP_NODE_PER_FIELD 2 +#define MAIN_CRTC_MASK BIT(0) +#define AUX_CRTC_MASK BIT(1) +struct sti_gdp_node {u32 gam_gdp_ctl;u32 gam_gdp_agc;@@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, } }
Quoted 8 lines
drivers/gpu/drm/sti/sti_gdp.c static int sti_gdp_atomic_check(struct drm_plane *drm_plane, · line 700
Quoted 5 lines
drivers/gpu/drm/sti/sti_gdp.c +5
-0+/* re-evaluate the possible crtcs */ +if (mixer->id ==STI_MIXER_MAIN ) + drm_plane->possible_crtcs =MAIN_CRTC_MASK ; +else + drm_plane->possible_crtcs =AUX_CRTC_MASK ;This stuff isn't meant to be changed dynamically. There's no event for telling userspace to re-examine this sort of information.
Yes sure. But by doing this, I let the userspace the ability to fix plan assignment by it self by re-evaluating the possible CRTC. Before new plane assignment.
The kernel driver is then flexible enough to avoid Kernel crash.
BR
Vincent
Quoted 44 lines
Quoted 44 lines
drivers/gpu/drm/sti/sti_gdp.c +7
-0+DRM_DEBUG_KMS ("CRTC:%d (%s) drm plane:%d (%s)\n" , crtc->base.id,sti_mixer_to_str (mixer), drm_plane->base.id,sti_plane_to_str (plane));@@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane, {struct sti_plane *plane =to_sti_plane (drm_plane); +/* restore possible crtcs value with the initial value */ + drm_plane->possible_crtcs = plane->init_possible_crtcs; +if (!drm_plane->crtc) {DRM_DEBUG_DRIVER ("drm plane:%d not enabled\n" , drm_plane->base.id);@@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,sti_gdp_init (gdp); +/* store the initial value of possible crtcs */ + gdp->plane.init_possible_crtcs = possible_crtcs; + res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, possible_crtcs, &sti_gdp_plane_helpers_funcs,drivers/gpu/drm/sti/sti_plane.h +2
-0@@ -66,12 +66,14 @@ struct sti_fps_info {* @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane +* @init_possile_crtcs: store the initial possible crtc value * @fps_info: frame per second info */ struct sti_plane {struct drm_plane drm_plane;enum sti_plane_desc desc;enum sti_plane_status status; +u32 init_possible_crtcs;struct sti_fps_info fps_info; };
Quoted 8 lines
Quoted 7 lines
--
1.9.1_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 44 lines · Vincent ABRIOU
Quoted 32 lines · Ville Syrjälä
Quoted 31 lines · Vincent Abriou
When a plane is going to be enabled we re-evaluate the possible crtcs for the associated drm plane. Only the crtc on which the plane should be displayed is considered possible until the plane is disabled. Indeed STI hardware does not allow to dynamically change
the plane's crtc/mixer assignment when the plane is in use (gdp is running).Signed-off-by Vincent Abriou <[email protected]>--- drivers/gpu/drm/sti/sti_gdp.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_plane.h | 2 ++ 2 files changed, 17 insertions(+)drivers/gpu/drm/sti/sti_gdp.c +3
-0@@ -71,6 +71,9 @@ static struct gdp_format_to_str {#define GDP_NODE_NB_BANK 2#define GDP_NODE_PER_FIELD 2 +#define MAIN_CRTC_MASK BIT(0) +#define AUX_CRTC_MASK BIT(1) +struct sti_gdp_node {u32 gam_gdp_ctl;u32 gam_gdp_agc;@@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, } }Quoted 8 lines
drivers/gpu/drm/sti/sti_gdp.c static int sti_gdp_atomic_check(struct drm_plane *drm_plane, · line 700
Quoted 5 lines
drivers/gpu/drm/sti/sti_gdp.c +5
-0+/* re-evaluate the possible crtcs */ +if (mixer->id ==STI_MIXER_MAIN ) + drm_plane->possible_crtcs =MAIN_CRTC_MASK ; +else + drm_plane->possible_crtcs =AUX_CRTC_MASK ;This stuff isn't meant to be changed dynamically. There's no event for telling userspace to re-examine this sort of information.
Quoted 3 lines
Yes sure. But by doing this, I let the userspace the ability to fix plan assignment by it self by re-evaluating the possible CRTC. Before new plane assignment.
Only if it would re-fetch all planes/crtcs/etc. resources between every operation. Doing that would suck big time. And with atomic that's not even a theoretical option since everything would be configured with a single ioctl.
Quoted 1 line
The kernel driver is then flexible enough to avoid Kernel crash.
If the kernel crashes due to an an unsupported plane configuration, then the kernel has to be fixed.
Quoted 56 lines
BR
VincentQuoted 52 lines
Quoted 51 lines
drivers/gpu/drm/sti/sti_gdp.c +7
-0+DRM_DEBUG_KMS ("CRTC:%d (%s) drm plane:%d (%s)\n" , crtc->base.id,sti_mixer_to_str (mixer), drm_plane->base.id,sti_plane_to_str (plane));@@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane, {struct sti_plane *plane =to_sti_plane (drm_plane); +/* restore possible crtcs value with the initial value */ + drm_plane->possible_crtcs = plane->init_possible_crtcs; +if (!drm_plane->crtc) {DRM_DEBUG_DRIVER ("drm plane:%d not enabled\n" , drm_plane->base.id);@@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,sti_gdp_init (gdp); +/* store the initial value of possible crtcs */ + gdp->plane.init_possible_crtcs = possible_crtcs; + res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, possible_crtcs, &sti_gdp_plane_helpers_funcs,drivers/gpu/drm/sti/sti_plane.h +2
-1@@ -66,12 +66,14 @@ struct sti_fps_info {* @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane +* @init_possile_crtcs: store the initial possible crtc value * @fps_info: frame per second info */ struct sti_plane {struct drm_plane drm_plane;enum sti_plane_desc desc;enum sti_plane_status status; +u32 init_possible_crtcs;struct sti_fps_info fps_info; }; --1.9.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 45 lines · Ville Syrjälä
Quoted 44 lines · Vincent ABRIOU
Quoted 40 lines · Ville Syrjälä
Quoted 28 lines · Vincent Abriou
When a plane is going to be enabled we re-evaluate the possible crtcs for the associated drm plane. Only the crtc on which the plane should be displayed is considered possible until the plane is disabled. Indeed STI hardware does not allow to dynamically change
the plane's crtc/mixer assignment when the plane is in use (gdp is running).Signed-off-by Vincent Abriou <[email protected]>--- drivers/gpu/drm/sti/sti_gdp.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_plane.h | 2 ++ 2 files changed, 17 insertions(+)drivers/gpu/drm/sti/sti_gdp.c +3
-0@@ -71,6 +71,9 @@ static struct gdp_format_to_str {#define GDP_NODE_NB_BANK 2#define GDP_NODE_PER_FIELD 2 +#define MAIN_CRTC_MASK BIT(0) +#define AUX_CRTC_MASK BIT(1) +struct sti_gdp_node {u32 gam_gdp_ctl;u32 gam_gdp_agc;drivers/gpu/drm/sti/sti_gdp.c static int sti_gdp_atomic_check(struct drm_plane *drm_plane, · line 700
Quoted 8 lines
drivers/gpu/drm/sti/sti_gdp.c +5
-0@@ -690,6 +693,12 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, } } +/* re-evaluate the possible crtcs */ +if (mixer->id ==STI_MIXER_MAIN ) + drm_plane->possible_crtcs =MAIN_CRTC_MASK ; +else + drm_plane->possible_crtcs =AUX_CRTC_MASK ;This stuff isn't meant to be changed dynamically. There's no event for telling userspace to re-examine this sort of information.
Quoted 9 lines
Quoted 3 lines
Yes sure. But by doing this, I let the userspace the ability to fix plan assignment by it self by re-evaluating the possible CRTC. Before new plane assignment.
Only if it would re-fetch all planes/crtcs/etc. resources between every operation. Doing that would suck big time. And with atomic that's not even a theoretical option since everything would be configured with a single ioctl.
I test with weston-1.11.0 and the behavior changed. It is now forbidden to set a plane on 2 differents CRTC. I will not going further on this patch.
BR
Vincent
Quoted 62 lines
Quoted 1 line
The kernel driver is then flexible enough to avoid Kernel crash.
If the kernel crashes due to an an unsupported plane configuration, then the kernel has to be fixed.
Quoted 56 lines
BR
VincentQuoted 52 lines
Quoted 51 lines
drivers/gpu/drm/sti/sti_gdp.c +7
-0+DRM_DEBUG_KMS ("CRTC:%d (%s) drm plane:%d (%s)\n" , crtc->base.id,sti_mixer_to_str (mixer), drm_plane->base.id,sti_plane_to_str (plane));@@ -846,6 +855,9 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane, {struct sti_plane *plane =to_sti_plane (drm_plane); +/* restore possible crtcs value with the initial value */ + drm_plane->possible_crtcs = plane->init_possible_crtcs; +if (!drm_plane->crtc) {DRM_DEBUG_DRIVER ("drm plane:%d not enabled\n" , drm_plane->base.id);@@ -917,6 +929,9 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,sti_gdp_init (gdp); +/* store the initial value of possible crtcs */ + gdp->plane.init_possible_crtcs = possible_crtcs; + res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, possible_crtcs, &sti_gdp_plane_helpers_funcs,drivers/gpu/drm/sti/sti_plane.h +2
-1@@ -66,12 +66,14 @@ struct sti_fps_info {* @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane +* @init_possile_crtcs: store the initial possible crtc value * @fps_info: frame per second info */ struct sti_plane {struct drm_plane drm_plane;enum sti_plane_desc desc;enum sti_plane_status status; +u32 init_possible_crtcs;struct sti_fps_info fps_info; }; --1.9.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel