drm: expose subpixel order name routine v2
Subsystems (3)
PATCH 1/2 drm: expose subpixel order name routine v2
Just like we have for connector type etc.
v2: drop static array (Chris)
--- drivers/gpu/drm/drm_crtc.c | 16 ++++++++++++++++ include/drm/drm_crtc.h | 1 + 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_crtc.c +16 -0
@@ -215,6 +215,16 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = { DRM_MODE_ENCODER_DSI, "DSI" }, }; +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = +{ + { SubPixelUnknown,"Unknown" }, + { SubPixelHorizontalRGB,"Horizontal RGB" }, + { SubPixelHorizontalBGR,"Horizontal BGR" }, + { SubPixelVerticalRGB,"Vertical RGB" }, + { SubPixelVerticalBGR,"Vertical BGR" }, + { SubPixelNone,"None" }, +}; +void drm_connector_ida_init (void ) {int i;
@@ -264,6 +274,12 @@ const char *drm_get_connector_status_name(enum drm_connector_status status) }EXPORT_SYMBOL (drm_get_connector_status_name); +const char *drm_get_subpixel_order_name (enum subpixel_order order) +{ +return drm_subpixel_enum_list[order].name; +} +EXPORT_SYMBOL (drm_get_subpixel_order_name); +static char printable_char (int c) {return isascii (c) &&isprint (c) ? c :'?' ;
include/drm/drm_crtc.h +1 -0
@@ -991,6 +991,7 @@ extern void drm_encoder_cleanup(struct drm_encoder *encoder);extern const char *drm_get_connector_name (const struct drm_connector *connector);extern const char *drm_get_connector_status_name (enum drm_connector_status status); +extern const char *drm_get_subpixel_order_name (enum subpixel_order order);extern const char *drm_get_dpms_name (int val);extern const char *drm_get_dvi_i_subconnector_name (int val);extern const char *drm_get_dvi_i_select_name (int val);
Signature · 1 line
1.7.9.5
PATCH 2/2 drm/i915: add a display info file to debugfs v2
Can be expanded up on to include all sorts of things (HDMI infoframe data, more DP status, etc). Should be useful for bug reports to get a baseline on the display config and info.
v2: use seq_putc (Rodrigo)
describe mode field names (Rodrigo)
--- drivers/gpu/drm/i915/i915_debugfs.c | 159 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 4 + 2 files changed, 163 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +159 -0
@@ -2074,6 +2074,164 @@ static int i915_power_domain_info(struct seq_file *m, void *unused)return 0 ; } +static void intel_seq_print_mode (struct seq_file *m,int tabs, +struct drm_display_mode *mode) +{ +int i; + +for (i =0 ; i < tabs; i++) +seq_putc (m,'\t' ); + +seq_printf (m,"id %d:\"%s\" freq %d clock %d hdisp %d hss %d hse %d htot %d vdisp %d vss %d vse %d vtot %d type 0x%x flags 0x%x\n" , + mode->base.id, mode->name, + mode->vrefresh, mode->clock, + mode->hdisplay, mode->hsync_start, + mode->hsync_end, mode->htotal, + mode->vdisplay, mode->vsync_start, + mode->vsync_end, mode->vtotal, + mode->type, mode->flags); +} + +static void intel_encoder_info (struct seq_file *m, +struct intel_crtc *intel_crtc, +struct intel_encoder *intel_encoder) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct drm_crtc *crtc = &intel_crtc->base; +struct intel_connector *intel_connector; +struct drm_encoder *encoder; + + encoder = &intel_encoder->base; +seq_printf (m,"\tencoder %d: type: %s, connectors:\n" , + encoder->base.id,drm_get_encoder_name (encoder)); +for_each_connector_on_encoder (dev, encoder, intel_connector) { +struct drm_connector *connector = &intel_connector->base; +seq_printf (m,"\t\tconnector %d: type: %s, status: %s" , + connector->base.id, +drm_get_connector_name (connector), +drm_get_connector_status_name (connector->status)); +if (connector->status == connector_status_connected) { +struct drm_display_mode *mode = &crtc->mode; +seq_printf (m,", mode:\n" ); +intel_seq_print_mode (m,2 , mode); + }else { +seq_putc (m,'\n' ); + } + } +} + +static void intel_crtc_info (struct seq_file *m,struct intel_crtc *intel_crtc) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct drm_crtc *crtc = &intel_crtc->base; +struct intel_encoder *intel_encoder; + +seq_printf (m,"\tfb: %d, pos: %dx%d, size: %dx%d\n" , + crtc->fb->base.id, crtc->x, crtc->y, + crtc->fb->width, crtc->fb->height); +for_each_encoder_on_crtc (dev, crtc, intel_encoder) +intel_encoder_info (m, intel_crtc, intel_encoder); +} + +static void intel_panel_info (struct seq_file *m,struct intel_panel *panel) +{ +struct drm_display_mode *mode = panel->fixed_mode; + +seq_printf (m,"\tfixed mode:\n" ); +intel_seq_print_mode (m,2 , mode); +} + +static void intel_dp_info (struct seq_file *m, +struct intel_connector *intel_connector) +{ +struct intel_encoder *intel_encoder = intel_connector->encoder; +struct intel_dp *intel_dp =enc_to_intel_dp (&intel_encoder->base); + +seq_printf (m,"\tDPCD rev: %x\n" , intel_dp->dpcd[DP_DPCD_REV ]); +seq_printf (m,"\taudio support: %s\n" , intel_dp->has_audio ?"yes" : +"no" ); +if (intel_encoder->type ==INTEL_OUTPUT_EDP ) +intel_panel_info (m, &intel_connector->panel); +} + +static void intel_hdmi_info (struct seq_file *m, +struct intel_connector *intel_connector) +{ +struct intel_encoder *intel_encoder = intel_connector->encoder; +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&intel_encoder->base); + +seq_printf (m,"\taudio support: %s\n" , intel_hdmi->has_audio ?"yes" : +"no" ); +} + +static void intel_lvds_info (struct seq_file *m, +struct intel_connector *intel_connector) +{ +intel_panel_info (m, &intel_connector->panel); +} + +static void intel_connector_info (struct seq_file *m, +struct drm_connector *connector) +{ +struct intel_connector *intel_connector =to_intel_connector (connector); +struct intel_encoder *intel_encoder = intel_connector->encoder; + +seq_printf (m,"connector %d: type %s, status: %s\n" , + connector->base.id,drm_get_connector_name (connector), +drm_get_connector_status_name (connector->status)); +if (connector->status == connector_status_connected) { +seq_printf (m,"\tname: %s\n" , connector->display_info.name); +seq_printf (m,"\tphysical dimensions: %dx%dmm\n" , + connector->display_info.width_mm, + connector->display_info.height_mm); +seq_printf (m,"\tsubpixel order: %s\n" , +drm_get_subpixel_order_name (connector->display_info.subpixel_order)); +seq_printf (m,"\tCEA rev: %d\n" , + connector->display_info.cea_rev); + } +if (intel_encoder->type ==INTEL_OUTPUT_DISPLAYPORT || + intel_encoder->type ==INTEL_OUTPUT_EDP ) +intel_dp_info (m, intel_connector); +else if (intel_encoder->type ==INTEL_OUTPUT_HDMI ) +intel_hdmi_info (m, intel_connector); +else if (intel_encoder->type ==INTEL_OUTPUT_LVDS ) +intel_lvds_info (m, intel_connector); + +} + +static int i915_display_info (struct seq_file *m,void *unused) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct drm_crtc *crtc; +struct drm_connector *connector; + +drm_modeset_lock_all (dev); +seq_printf (m,"CRTC info\n" ); +seq_printf (m,"---------\n" ); +list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +seq_printf (m,"CRTC %d: pipe: %c, active: %s\n" , + crtc->base.id,pipe_name (intel_crtc->pipe), + intel_crtc->active ?"yes" :"no" ); +if (intel_crtc->active) +intel_crtc_info (m, intel_crtc); + } + +seq_printf (m,"\n" ); +seq_printf (m,"Connector info\n" ); +seq_printf (m,"--------------\n" ); +list_for_each_entry (connector, &dev->mode_config.connector_list, head) { +intel_connector_info (m, connector); + } +drm_modeset_unlock_all (dev); + +return 0 ; +} +struct pipe_crc_info {const char *name;struct drm_device *dev;
@@ -3486,6 +3644,7 @@ static const struct drm_info_list i915_debugfs_list[] = { {"i915_energy_uJ", i915_energy_uJ, 0}, {"i915_pc8_status", i915_pc8_status, 0}, {"i915_power_domain_info", i915_power_domain_info, 0}, + {"i915_display_info", i915_display_info, 0}, };#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -164,6 +164,10 @@ enum hpd_pin {list_for_each_entry ((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ if ((intel_encoder)->base.crtc == (__crtc)) +#define for_each_connector_on_encoder (dev, __encoder, intel_connector) \ + list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \ + if ((intel_connector)->base.encoder == (__encoder)) +struct drm_i915_private ;enum intel_dpll_id {
Signature · 1 line
1.7.9.5
Quoted 5 lines · Jesse Barnes
Just like we have for connector type etc.
v2: drop static array (Chris)
Signed-off-by Jesse Barnes <[email protected]>
Cc: dri-devel is missing. Also a tiny kerneldoc would be nice (I have patches somewhere to kerneldocify all the other functions in this file). -Daniel
Quoted 58 lines
--- drivers/gpu/drm/drm_crtc.c | 16 ++++++++++++++++ include/drm/drm_crtc.h | 1 + 2 files changed, 17 insertions(+)drivers/gpu/drm/drm_crtc.c +16
-0@@ -215,6 +215,16 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = { DRM_MODE_ENCODER_DSI, "DSI" }, }; +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = +{ + { SubPixelUnknown,"Unknown" }, + { SubPixelHorizontalRGB,"Horizontal RGB" }, + { SubPixelHorizontalBGR,"Horizontal BGR" }, + { SubPixelVerticalRGB,"Vertical RGB" }, + { SubPixelVerticalBGR,"Vertical BGR" }, + { SubPixelNone,"None" }, +}; +void drm_connector_ida_init (void ) {int i;@@ -264,6 +274,12 @@ const char *drm_get_connector_status_name(enum drm_connector_status status) }EXPORT_SYMBOL (drm_get_connector_status_name); +const char *drm_get_subpixel_order_name (enum subpixel_order order) +{ +return drm_subpixel_enum_list[order].name; +} +EXPORT_SYMBOL (drm_get_subpixel_order_name); +static char printable_char (int c) {return isascii (c) &&isprint (c) ? c :'?' ;include/drm/drm_crtc.h +1
-0@@ -991,6 +991,7 @@ extern void drm_encoder_cleanup(struct drm_encoder *encoder);extern const char *drm_get_connector_name (const struct drm_connector *connector);extern const char *drm_get_connector_status_name (enum drm_connector_status status); +extern const char *drm_get_subpixel_order_name (enum subpixel_order order);extern const char *drm_get_dpms_name (int val);extern const char *drm_get_dvi_i_subconnector_name (int val);extern const char *drm_get_dvi_i_select_name (int val);Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/1 drm: expose subpixel order name routine v3
Just like we have for connector type etc.
v2: drop static array (Chris)
v3: add kdoc (Daniel)
--- drivers/gpu/drm/drm_crtc.c | 23 +++++++++++++++++++++++ include/drm/drm_crtc.h | 1 + 2 files changed, 24 insertions(+)
drivers/gpu/drm/drm_crtc.c +23 -0
@@ -215,6 +215,16 @@ static const struct drm_prop_enum_list drm_encoder_enum_list[] = { DRM_MODE_ENCODER_DSI, "DSI" }, }; +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = +{ + { SubPixelUnknown,"Unknown" }, + { SubPixelHorizontalRGB,"Horizontal RGB" }, + { SubPixelHorizontalBGR,"Horizontal BGR" }, + { SubPixelVerticalRGB,"Vertical RGB" }, + { SubPixelVerticalBGR,"Vertical BGR" }, + { SubPixelNone,"None" }, +}; +void drm_connector_ida_init (void ) {int i;
@@ -264,6 +274,19 @@ const char *drm_get_connector_status_name(enum drm_connector_status status) }EXPORT_SYMBOL (drm_get_connector_status_name); +/** +* drm_get_subpixel_order_name - return a string for a given subpixel enum +* @order: enum of subpixel_order +* +* Note you could abuse this and return something out of bounds, but that +* would be a caller error. No unscrubbed user data should make it here. +*/ +const char *drm_get_subpixel_order_name (enum subpixel_order order) +{ +return drm_subpixel_enum_list[order].name; +} +EXPORT_SYMBOL (drm_get_subpixel_order_name); +static char printable_char (int c) {return isascii (c) &&isprint (c) ? c :'?' ;
include/drm/drm_crtc.h +1 -0
@@ -991,6 +991,7 @@ extern void drm_encoder_cleanup(struct drm_encoder *encoder);extern const char *drm_get_connector_name (const struct drm_connector *connector);extern const char *drm_get_connector_status_name (enum drm_connector_status status); +extern const char *drm_get_subpixel_order_name (enum subpixel_order order);extern const char *drm_get_dpms_name (int val);extern const char *drm_get_dvi_i_subconnector_name (int val);extern const char *drm_get_dvi_i_select_name (int val);
Signature · 1 line
1.7.9.5
Re: [PATCH] drm: expose subpixel order name routine v3
Quoted 6 lines · Jesse Barnes
Just like we have for connector type etc.
v2: drop static array (Chris)
v3: add kdoc (Daniel)Signed-off-by Jesse Barnes <[email protected]>
Merged this and the i915 debugfs patch to dinq with Dave's ack. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch