drm: Use atomic state for FB in legacy ioctls
Subsystems (2)
PATCH 1/1 drm: Use atomic state for FB in legacy ioctls
If atomic state is available, use this to read the current plane in GetCrtc/GetPlane, rather than the legacy points.
--- drivers/gpu/drm/drm_crtc.c | 5 ++++- drivers/gpu/drm/drm_plane.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_crtc.c +4 -1
@@ -357,7 +357,10 @@ int drm_mode_getcrtc(struct drm_device *dev,drm_modeset_lock_crtc (crtc, crtc->primary); crtc_resp->gamma_size = crtc->gamma_size; -if (crtc->primary->fb) + +if (crtc->primary->state && crtc->primary->state->fb) + crtc_resp->fb_id = crtc->primary->state->fb->base.id; +else if (!crtc->primary->state && crtc->primary->fb) crtc_resp->fb_id = crtc->primary->fb->base.id;else crtc_resp->fb_id =0 ;
drivers/gpu/drm/drm_plane.c +6 -2
@@ -392,12 +392,16 @@ int drm_mode_getplane(struct drm_device *dev, void *data,return -ENOENT ;drm_modeset_lock (&plane->mutex,NULL ); -if (plane->crtc) +if (plane->state && plane->state->crtc) + plane_resp->crtc_id = plane->state->crtc->base.id; +else if (!plane->state && plane->crtc) plane_resp->crtc_id = plane->crtc->base.id;else plane_resp->crtc_id =0 ; -if (plane->fb) +if (plane->state && plane->state->fb) + plane_resp->fb_id = plane->state->fb->base.id; +else if (!plane->state && plane->fb) plane_resp->fb_id = plane->fb->base.id;else plane_resp->fb_id =0 ;
Signature · 6 lines
2.10.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Daniel Stone
If atomic state is available, use this to read the current plane in GetCrtc/GetPlane, rather than the legacy points.
Signed-off-by Daniel Stone <[email protected]>Cc Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_crtc.c | 5 ++++- drivers/gpu/drm/drm_plane.c | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_crtc.c +0
-0
drivers/gpu/drm/drm_crtc.c int drm_mode_getcrtc(struct drm_device *dev, · line 364
Quoted 9 lines
drivers/gpu/drm/drm_crtc.c +4
-1@@ -357,7 +357,10 @@ int drm_mode_getcrtc(struct drm_device *dev,drm_modeset_lock_crtc (crtc, crtc->primary); crtc_resp->gamma_size = crtc->gamma_size; -if (crtc->primary->fb) + +if (crtc->primary->state && crtc->primary->state->fb) + crtc_resp->fb_id = crtc->primary->state->fb->base.id; +else if (!crtc->primary->state && crtc->primary->fb) crtc_resp->fb_id = crtc->primary->fb->base.id;
I think what we do elsewhere is totally ignore the legacy junk if the ->state pointer exists.
Quoted 32 lines
drivers/gpu/drm/drm_crtc.c +0
-0else crtc_resp->fb_id =0 ;drivers/gpu/drm/drm_plane.c +6
-2@@ -392,12 +392,16 @@ int drm_mode_getplane(struct drm_device *dev, void *data,return -ENOENT ;drm_modeset_lock (&plane->mutex,NULL ); -if (plane->crtc) +if (plane->state && plane->state->crtc) + plane_resp->crtc_id = plane->state->crtc->base.id; +else if (!plane->state && plane->crtc) plane_resp->crtc_id = plane->crtc->base.id;else plane_resp->crtc_id =0 ; -if (plane->fb) +if (plane->state && plane->state->fb) + plane_resp->fb_id = plane->state->fb->base.id; +else if (!plane->state && plane->fb) plane_resp->fb_id = plane->fb->base.id;else plane_resp->fb_id =0 ;Signature · 6 lines
2.10.2 _______________________________________________ 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
Hi,
Quoted 5 lines · Ville Syrjälä
Quoted 4 lines · Daniel Stone
(quoted diff) +0
-0@@ -357,7 +357,10 @@ int drm_mode_getcrtc(struct drm_device *dev,
Quoted 11 lines
drivers/gpu/drm/drm_crtc.c int drm_mode_getcrtc(struct drm_device *dev, · line 364
Quoted 8 lines
drivers/gpu/drm/drm_crtc.c +4
-1drm_modeset_lock_crtc (crtc, crtc->primary); crtc_resp->gamma_size = crtc->gamma_size; -if (crtc->primary->fb) + +if (crtc->primary->state && crtc->primary->state->fb) + crtc_resp->fb_id = crtc->primary->state->fb->base.id; +else if (!crtc->primary->state && crtc->primary->fb) crtc_resp->fb_id = crtc->primary->fb->base.id;I think what we do elsewhere is totally ignore the legacy junk if the ->state pointer exists.
Indeed, hence the negative state check on the second branch; having nested if statements instead seemed unnecessarily unwieldy, but the effect is the same.
[Obligatory mobile formatting apology.]
Cheers,
Daniel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Ville Syrjälä
Reviewed-byQuoted 19 lines · Daniel Stone
Hi,
Quoted 5 lines · Ville Syrjälä
Quoted 4 lines · Daniel Stone
(quoted diff) +0
-0@@ -357,7 +357,10 @@ int drm_mode_getcrtc(struct drm_device *dev,Quoted 11 lines
drivers/gpu/drm/drm_crtc.c int drm_mode_getcrtc(struct drm_device *dev, · line 364
Quoted 8 lines
drivers/gpu/drm/drm_crtc.c +4
-1drm_modeset_lock_crtc (crtc, crtc->primary); crtc_resp->gamma_size = crtc->gamma_size; -if (crtc->primary->fb) + +if (crtc->primary->state && crtc->primary->state->fb) + crtc_resp->fb_id = crtc->primary->state->fb->base.id; +else if (!crtc->primary->state && crtc->primary->fb) crtc_resp->fb_id = crtc->primary->fb->base.id;I think what we do elsewhere is totally ignore the legacy junk if the ->state pointer exists.
Quoted 1 line
Indeed, hence the negative state check on the second branch; having nested if statements instead seemed unnecessarily unwieldy, but the effect is the same.
My bad. You hid it well though ;)
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedQuoted 20 lines · Ville Syrjälä
Quoted 19 lines · Daniel Stone
Hi,
Quoted 16 lines · Ville Syrjälä
drivers/gpu/drm/drm_crtc.c int drm_mode_getcrtc(struct drm_device *dev, · line 364
Quoted 12 lines · Daniel Stone
drivers/gpu/drm/drm_crtc.c +4
-1@@ -357,7 +357,10 @@ int drm_mode_getcrtc(struct drm_device *dev,drm_modeset_lock_crtc (crtc, crtc->primary); crtc_resp->gamma_size = crtc->gamma_size; -if (crtc->primary->fb) + +if (crtc->primary->state && crtc->primary->state->fb) + crtc_resp->fb_id = crtc->primary->state->fb->base.id; +else if (!crtc->primary->state && crtc->primary->fb) crtc_resp->fb_id = crtc->primary->fb->base.id;I think what we do elsewhere is totally ignore the legacy junk if the ->state pointer exists.
Quoted 5 lines
Quoted 1 line
Indeed, hence the negative state check on the second branch; having nested if statements instead seemed unnecessarily unwieldy, but the effect is the same.
My bad. You hid it well though ;)
Reviewed-by Ville Syrjälä <[email protected]>
Applied to drm-misc, thanks.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel