On 28/07/2023 20:02, Jessica Zhang wrote:
Add pixel source to the atomic plane state dump

Signed-off-by: Jessica Zhang <quic_jessz...@quicinc.com>
---
  drivers/gpu/drm/drm_atomic.c        |  1 +
  drivers/gpu/drm/drm_crtc_internal.h |  2 ++
  drivers/gpu/drm/drm_plane.c         | 12 ++++++++++++
  3 files changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index b4c6ffc438da..c38014abc590 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -713,6 +713,7 @@ static void drm_atomic_plane_print_state(struct drm_printer 
*p,
drm_printf(p, "plane[%u]: %s\n", plane->base.id, plane->name);
        drm_printf(p, "\tcrtc=%s\n", state->crtc ? state->crtc->name : 
"(null)");
+       drm_printf(p, "\tpixel-source=%s\n", 
drm_plane_get_pixel_source_name(state->pixel_source));
        drm_printf(p, "\tfb=%u\n", state->fb ? state->fb->base.id : 0);
        if (state->fb)
                drm_framebuffer_print_info(p, 2, state->fb);
diff --git a/drivers/gpu/drm/drm_crtc_internal.h 
b/drivers/gpu/drm/drm_crtc_internal.h
index 501a10edd0e1..75b59ec9f1be 100644
--- a/drivers/gpu/drm/drm_crtc_internal.h
+++ b/drivers/gpu/drm/drm_crtc_internal.h
@@ -38,6 +38,7 @@ enum drm_color_encoding;
  enum drm_color_range;
  enum drm_connector_force;
  enum drm_mode_status;
+enum drm_plane_pixel_source;
struct drm_atomic_state;
  struct drm_bridge;
@@ -267,6 +268,7 @@ int drm_plane_check_pixel_format(struct drm_plane *plane,
                                 u32 format, u64 modifier);
  struct drm_mode_rect *
  __drm_plane_get_damage_clips(const struct drm_plane_state *state);
+const char *drm_plane_get_pixel_source_name(enum drm_plane_pixel_source 
pixel_source);
/* drm_bridge.c */
  void drm_bridge_detach(struct drm_bridge *bridge);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index f342cf15412b..4188b3491625 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1487,6 +1487,18 @@ __drm_plane_get_damage_clips(const struct 
drm_plane_state *state)
                                        state->fb_damage_clips->data : NULL);
  }
+const char *drm_plane_get_pixel_source_name(enum drm_plane_pixel_source pixel_source)
+{
+       switch(pixel_source) {
+       case DRM_PLANE_PIXEL_SOURCE_NONE:
+               return "NONE";
+       case DRM_PLANE_PIXEL_SOURCE_FB:
+               return "fb";
+       default:
+               return "";
+       }
+}

Please use DRM_ENUM_NAME_FN instead.

+
  /**
   * drm_plane_get_damage_clips - Returns damage clips.
   * @state: Plane state.


--
With best wishes
Dmitry

Reply via email to