Commit ae217850 authored by Fabien Dessenne's avatar Fabien Dessenne Committed by Vincent Abriou

drm/sti: use different notifier_block for each pipe

Each pipe shall have its own notifier block to manage the vblank event.
This fixes issues where a client registered on given pipe is later
abusively notified of events on the other pipe.
Signed-off-by: default avatarFabien Dessenne <fabien.dessenne@st.com>
Acked-by: default avatarVincent Abriou <vincent.abriou@st.com>
parent 5552aad3
...@@ -201,6 +201,7 @@ static int sti_compositor_probe(struct platform_device *pdev) ...@@ -201,6 +201,7 @@ static int sti_compositor_probe(struct platform_device *pdev)
struct device_node *vtg_np; struct device_node *vtg_np;
struct sti_compositor *compo; struct sti_compositor *compo;
struct resource *res; struct resource *res;
unsigned int i;
compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL); compo = devm_kzalloc(dev, sizeof(*compo), GFP_KERNEL);
if (!compo) { if (!compo) {
...@@ -208,7 +209,8 @@ static int sti_compositor_probe(struct platform_device *pdev) ...@@ -208,7 +209,8 @@ static int sti_compositor_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
compo->dev = dev; compo->dev = dev;
compo->vtg_vblank_nb.notifier_call = sti_crtc_vblank_cb; for (i = 0; i < STI_MAX_MIXER; i++)
compo->vtg_vblank_nb[i].notifier_call = sti_crtc_vblank_cb;
/* populate data structure depending on compatibility */ /* populate data structure depending on compatibility */
BUG_ON(!of_match_node(compositor_of_match, np)->data); BUG_ON(!of_match_node(compositor_of_match, np)->data);
......
...@@ -62,7 +62,7 @@ struct sti_compositor_data { ...@@ -62,7 +62,7 @@ struct sti_compositor_data {
* @vid: array of vids * @vid: array of vids
* @vtg_main: vtg for main data path * @vtg_main: vtg for main data path
* @vtg_aux: vtg for auxillary data path * @vtg_aux: vtg for auxillary data path
* @vtg_vblank_nb: callback for VTG VSYNC notification * @vtg_vblank_nb: array of callbacks for VTG VSYNC notification
*/ */
struct sti_compositor { struct sti_compositor {
struct device *dev; struct device *dev;
...@@ -78,7 +78,7 @@ struct sti_compositor { ...@@ -78,7 +78,7 @@ struct sti_compositor {
struct sti_vid *vid[STI_MAX_VID]; struct sti_vid *vid[STI_MAX_VID];
struct sti_vtg *vtg_main; struct sti_vtg *vtg_main;
struct sti_vtg *vtg_aux; struct sti_vtg *vtg_aux;
struct notifier_block vtg_vblank_nb; struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
}; };
int sti_compositor_debufs_init(struct sti_compositor *compo, int sti_compositor_debufs_init(struct sti_compositor *compo,
......
...@@ -244,8 +244,7 @@ static int sti_crtc_set_property(struct drm_crtc *crtc, ...@@ -244,8 +244,7 @@ static int sti_crtc_set_property(struct drm_crtc *crtc,
int sti_crtc_vblank_cb(struct notifier_block *nb, int sti_crtc_vblank_cb(struct notifier_block *nb,
unsigned long event, void *data) unsigned long event, void *data)
{ {
struct sti_compositor *compo = struct sti_compositor *compo;
container_of(nb, struct sti_compositor, vtg_vblank_nb);
struct drm_crtc *crtc = data; struct drm_crtc *crtc = data;
struct sti_mixer *mixer; struct sti_mixer *mixer;
unsigned long flags; unsigned long flags;
...@@ -254,6 +253,7 @@ int sti_crtc_vblank_cb(struct notifier_block *nb, ...@@ -254,6 +253,7 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
priv = crtc->dev->dev_private; priv = crtc->dev->dev_private;
pipe = drm_crtc_index(crtc); pipe = drm_crtc_index(crtc);
compo = container_of(nb, struct sti_compositor, vtg_vblank_nb[pipe]);
mixer = compo->mixer[pipe]; mixer = compo->mixer[pipe];
if ((event != VTG_TOP_FIELD_EVENT) && if ((event != VTG_TOP_FIELD_EVENT) &&
...@@ -295,7 +295,7 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe) ...@@ -295,7 +295,7 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
{ {
struct sti_private *dev_priv = dev->dev_private; struct sti_private *dev_priv = dev->dev_private;
struct sti_compositor *compo = dev_priv->compo; struct sti_compositor *compo = dev_priv->compo;
struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb; struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc; struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
DRM_DEBUG_DRIVER("\n"); DRM_DEBUG_DRIVER("\n");
...@@ -314,7 +314,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe) ...@@ -314,7 +314,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
{ {
struct sti_private *priv = drm_dev->dev_private; struct sti_private *priv = drm_dev->dev_private;
struct sti_compositor *compo = priv->compo; struct sti_compositor *compo = priv->compo;
struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb; struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb[pipe];
struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc; struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc;
DRM_DEBUG_DRIVER("\n"); DRM_DEBUG_DRIVER("\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment