diff mbox

[6/7] drm/vmwgfx: Stop using plane->fb in atomic_enable()

Message ID 20180405195035.24722-6-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä April 5, 2018, 7:50 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Instead of looking at the (soon to be deprecated) plane->fb we'll
examing plane->state->fb instead. We can do this because
vmw_du_crtc_atomic_check() prevents us from enabling a crtc
without the primary plane also being enabled.

Due to that same reason, I'm actually not sure what the checks here are
for NULL fb. If we can't enable the crtc without an enabled plane
we should always have an fb. But I'll leave that for someone else
to figure out.

Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Deepak Singh Rawat April 6, 2018, 6:56 p.m. UTC | #1
> 

> From: Ville Syrjälä <ville.syrjala@linux.intel.com>

> 

> Instead of looking at the (soon to be deprecated) plane->fb we'll

> examing plane->state->fb instead. We can do this because

> vmw_du_crtc_atomic_check() prevents us from enabling a crtc

> without the primary plane also being enabled.

> 

> Due to that same reason, I'm actually not sure what the checks here are

> for NULL fb. If we can't enable the crtc without an enabled plane

> we should always have an fb. But I'll leave that for someone else

> to figure out.


Hi Ville,

AFAIK the NULL check is set or clear the implicit framebuffer property
which is specific to vmwgfx and for current hardware version is disabled.
I have this future TODO work item to get rid of implicit placement property
or at least make it read only.

I still don’t have complete understanding of atomic state but this patch looks
good to me.

Reviewed-by: Deepak Rawat <drawat@vmware.com>


> 

> Cc: Thomas Hellstrom <thellstrom@vmware.com>

> Cc: Sinclair Yeh <syeh@vmware.com>

> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>

> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---

>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 3 ++-

>  1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

> b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

> index 90445bc590cb..152e96cb1c01 100644

> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c

> @@ -414,6 +414,7 @@ static void vmw_stdu_crtc_helper_prepare(struct

> drm_crtc *crtc)

>  static void vmw_stdu_crtc_atomic_enable(struct drm_crtc *crtc,

>  					struct drm_crtc_state *old_state)

>  {

> +	struct drm_plane_state *plane_state = crtc->primary->state;

>  	struct vmw_private *dev_priv;

>  	struct vmw_screen_target_display_unit *stdu;

>  	struct vmw_framebuffer *vfb;

> @@ -422,7 +423,7 @@ static void vmw_stdu_crtc_atomic_enable(struct

> drm_crtc *crtc,

> 

>  	stdu     = vmw_crtc_to_stdu(crtc);

>  	dev_priv = vmw_priv(crtc->dev);

> -	fb       = crtc->primary->fb;

> +	fb       = plane_state->fb;

> 

>  	vfb = (fb) ? vmw_framebuffer_to_vfb(fb) : NULL;

> 

> --

> 2.16.1

>
diff mbox

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
index 90445bc590cb..152e96cb1c01 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
@@ -414,6 +414,7 @@  static void vmw_stdu_crtc_helper_prepare(struct drm_crtc *crtc)
 static void vmw_stdu_crtc_atomic_enable(struct drm_crtc *crtc,
 					struct drm_crtc_state *old_state)
 {
+	struct drm_plane_state *plane_state = crtc->primary->state;
 	struct vmw_private *dev_priv;
 	struct vmw_screen_target_display_unit *stdu;
 	struct vmw_framebuffer *vfb;
@@ -422,7 +423,7 @@  static void vmw_stdu_crtc_atomic_enable(struct drm_crtc *crtc,
 
 	stdu     = vmw_crtc_to_stdu(crtc);
 	dev_priv = vmw_priv(crtc->dev);
-	fb       = crtc->primary->fb;
+	fb       = plane_state->fb;
 
 	vfb = (fb) ? vmw_framebuffer_to_vfb(fb) : NULL;