Commit b3c6c8bf authored by Daniel Vetter's avatar Daniel Vetter

drm: document drm_display_info

We seem to have a bit a mess in how to describe the bus formats, with
a multitude of competing ways. Might be best to consolidate it all and
use MEDIA_BUS_FMT_ also for the hdmi color formats and high color
modes.

Also move all the display_info related functions into drm_connector.c
(there's only one) to group it all together. I did decided against
also moving the edid related display info functions, they seem to fit
better in drm_edid.c. Instead sprinkle a few cross references around.
While at that reduce the kerneldoc for static functions, there's not
point in documenting internals with that much detail really.

v2: Fix typo and move misplaced hunk (Sean).

Cc: Sean Paul <seanpaul@chromium.org>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1471034937-651-19-git-send-email-daniel.vetter@ffwll.ch
parent 46444537
...@@ -506,6 +506,40 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] = { ...@@ -506,6 +506,40 @@ static const struct drm_prop_enum_list drm_dpms_enum_list[] = {
}; };
DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list) DRM_ENUM_NAME_FN(drm_get_dpms_name, drm_dpms_enum_list)
/**
* drm_display_info_set_bus_formats - set the supported bus formats
* @info: display info to store bus formats in
* @formats: array containing the supported bus formats
* @num_formats: the number of entries in the fmts array
*
* Store the supported bus formats in display info structure.
* See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h for
* a full list of available formats.
*/
int drm_display_info_set_bus_formats(struct drm_display_info *info,
const u32 *formats,
unsigned int num_formats)
{
u32 *fmts = NULL;
if (!formats && num_formats)
return -EINVAL;
if (formats && num_formats) {
fmts = kmemdup(formats, sizeof(*formats) * num_formats,
GFP_KERNEL);
if (!fmts)
return -ENOMEM;
}
kfree(info->bus_formats);
info->bus_formats = fmts;
info->num_bus_formats = num_formats;
return 0;
}
EXPORT_SYMBOL(drm_display_info_set_bus_formats);
/* Optional connector properties. */ /* Optional connector properties. */
static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = { static const struct drm_prop_enum_list drm_scaling_mode_enum_list[] = {
{ DRM_MODE_SCALE_NONE, "None" }, { DRM_MODE_SCALE_NONE, "None" },
......
...@@ -419,40 +419,6 @@ void drm_crtc_cleanup(struct drm_crtc *crtc) ...@@ -419,40 +419,6 @@ void drm_crtc_cleanup(struct drm_crtc *crtc)
} }
EXPORT_SYMBOL(drm_crtc_cleanup); EXPORT_SYMBOL(drm_crtc_cleanup);
/**
* drm_display_info_set_bus_formats - set the supported bus formats
* @info: display info to store bus formats in
* @formats: array containing the supported bus formats
* @num_formats: the number of entries in the fmts array
*
* Store the supported bus formats in display info structure.
* See MEDIA_BUS_FMT_* definitions in include/uapi/linux/media-bus-format.h for
* a full list of available formats.
*/
int drm_display_info_set_bus_formats(struct drm_display_info *info,
const u32 *formats,
unsigned int num_formats)
{
u32 *fmts = NULL;
if (!formats && num_formats)
return -EINVAL;
if (formats && num_formats) {
fmts = kmemdup(formats, sizeof(*formats) * num_formats,
GFP_KERNEL);
if (!fmts)
return -ENOMEM;
}
kfree(info->bus_formats);
info->bus_formats = fmts;
info->num_bus_formats = num_formats;
return 0;
}
EXPORT_SYMBOL(drm_display_info_set_bus_formats);
static int drm_encoder_register_all(struct drm_device *dev) static int drm_encoder_register_all(struct drm_device *dev)
{ {
struct drm_encoder *encoder; struct drm_encoder *encoder;
......
...@@ -3721,14 +3721,7 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) ...@@ -3721,14 +3721,7 @@ bool drm_rgb_quant_range_selectable(struct edid *edid)
} }
EXPORT_SYMBOL(drm_rgb_quant_range_selectable); EXPORT_SYMBOL(drm_rgb_quant_range_selectable);
/** /*
* drm_assign_hdmi_deep_color_info - detect whether monitor supports
* hdmi deep color modes and update drm_display_info if so.
* @edid: monitor EDID information
* @info: Updated with maximum supported deep color bpc and color format
* if deep color supported.
* @connector: DRM connector, used only for debug output
*
* Parse the CEA extension according to CEA-861-B. * Parse the CEA extension according to CEA-861-B.
* Return true if HDMI deep color supported, false if not or unknown. * Return true if HDMI deep color supported, false if not or unknown.
*/ */
...@@ -3822,16 +3815,6 @@ static bool drm_assign_hdmi_deep_color_info(struct edid *edid, ...@@ -3822,16 +3815,6 @@ static bool drm_assign_hdmi_deep_color_info(struct edid *edid,
return false; return false;
} }
/**
* drm_add_display_info - pull display info out if present
* @edid: EDID data
* @info: display info (attached to connector)
* @connector: connector whose edid is used to build display info
*
* Grab any available display info and stuff it into the drm_display_info
* structure that's part of the connector. Useful for tracking bpp and
* color spaces.
*/
static void drm_add_display_info(struct edid *edid, static void drm_add_display_info(struct edid *edid,
struct drm_display_info *info, struct drm_display_info *info,
struct drm_connector *connector) struct drm_connector *connector)
...@@ -4052,7 +4035,9 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, ...@@ -4052,7 +4035,9 @@ static int add_displayid_detailed_modes(struct drm_connector *connector,
* @connector: connector we're probing * @connector: connector we're probing
* @edid: EDID data * @edid: EDID data
* *
* Add the specified modes to the connector's mode list. * Add the specified modes to the connector's mode list. Also fills out the
* &drm_display_info structure in @connector with any information which can be
* derived from the edid.
* *
* Return: The number of modes added or 0 if we couldn't find any. * Return: The number of modes added or 0 if we couldn't find any.
*/ */
......
...@@ -84,28 +84,69 @@ enum subpixel_order { ...@@ -84,28 +84,69 @@ enum subpixel_order {
SubPixelNone, SubPixelNone,
}; };
/* /**
* Describes a given display (e.g. CRT or flat panel) and its limitations. * struct drm_display_info - runtime data about the connected sink
*
* Describes a given display (e.g. CRT or flat panel) and its limitations. For
* fixed display sinks like built-in panels there's not much difference between
* this and struct &drm_connector. But for sinks with a real cable this
* structure is meant to describe all the things at the other end of the cable.
*
* For sinks which provide an EDID this can be filled out by calling
* drm_add_edid_modes().
*/ */
struct drm_display_info { struct drm_display_info {
/**
* @name: Name of the display.
*/
char name[DRM_DISPLAY_INFO_LEN]; char name[DRM_DISPLAY_INFO_LEN];
/* Physical size */ /**
* @width_mm: Physical width in mm.
*/
unsigned int width_mm; unsigned int width_mm;
/**
* @height_mm: Physical height in mm.
*/
unsigned int height_mm; unsigned int height_mm;
/**
* @pixel_clock: Maximum pixel clock supported by the sink, in units of
* 100Hz. This mismatches the clok in &drm_display_mode (which is in
* kHZ), because that's what the EDID uses as base unit.
*/
unsigned int pixel_clock; unsigned int pixel_clock;
/**
* @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.
*/
unsigned int bpc; unsigned int bpc;
/**
* @subpixel_order: Subpixel order of LCD panels.
*/
enum subpixel_order subpixel_order; enum subpixel_order subpixel_order;
#define DRM_COLOR_FORMAT_RGB444 (1<<0) #define DRM_COLOR_FORMAT_RGB444 (1<<0)
#define DRM_COLOR_FORMAT_YCRCB444 (1<<1) #define DRM_COLOR_FORMAT_YCRCB444 (1<<1)
#define DRM_COLOR_FORMAT_YCRCB422 (1<<2) #define DRM_COLOR_FORMAT_YCRCB422 (1<<2)
/**
* @color_formats: HDMI Color formats, selects between RGB and YCrCb
* modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones
* as used to describe the pixel format in framebuffers, and also don't
* match the formats in @bus_formats which are shared with v4l.
*/
u32 color_formats; u32 color_formats;
/**
* @bus_formats: Pixel data format on the wire, somewhat redundant with
* @color_formats. Array of size @num_bus_formats encoded using
* MEDIA_BUS_FMT\_ defines shared with v4l and media drivers.
*/
const u32 *bus_formats; const u32 *bus_formats;
/**
* @num_bus_formats: Size of @bus_formats array.
*/
unsigned int num_bus_formats; unsigned int num_bus_formats;
#define DRM_BUS_FLAG_DE_LOW (1<<0) #define DRM_BUS_FLAG_DE_LOW (1<<0)
...@@ -115,14 +156,28 @@ struct drm_display_info { ...@@ -115,14 +156,28 @@ struct drm_display_info {
/* drive data on neg. edge */ /* drive data on neg. edge */
#define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3) #define DRM_BUS_FLAG_PIXDATA_NEGEDGE (1<<3)
/**
* @bus_flags: Additional information (like pixel signal polarity) for
* the pixel data on the bus, using DRM_BUS_FLAGS\_ defines.
*/
u32 bus_flags; u32 bus_flags;
/* Mask of supported hdmi deep color modes */ /**
* @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even
* more stuff redundant with @bus_formats.
*/
u8 edid_hdmi_dc_modes; u8 edid_hdmi_dc_modes;
/**
* @cea_rev: CEA revision of the HDMI sink.
*/
u8 cea_rev; u8 cea_rev;
}; };
int drm_display_info_set_bus_formats(struct drm_display_info *info,
const u32 *formats,
unsigned int num_formats);
/** /**
* struct drm_connector_state - mutable connector state * struct drm_connector_state - mutable connector state
* @connector: backpointer to the connector * @connector: backpointer to the connector
......
...@@ -2208,10 +2208,6 @@ extern void drm_mode_config_init(struct drm_device *dev); ...@@ -2208,10 +2208,6 @@ extern void drm_mode_config_init(struct drm_device *dev);
extern void drm_mode_config_reset(struct drm_device *dev); extern void drm_mode_config_reset(struct drm_device *dev);
extern void drm_mode_config_cleanup(struct drm_device *dev); extern void drm_mode_config_cleanup(struct drm_device *dev);
extern int drm_display_info_set_bus_formats(struct drm_display_info *info,
const u32 *formats,
unsigned int num_formats);
static inline bool drm_property_type_is(struct drm_property *property, static inline bool drm_property_type_is(struct drm_property *property,
uint32_t type) uint32_t type)
{ {
......
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