Misc. cleanups
Subsystems (2)
Just some cleanups for unused fields in drm_crtc.h and some comment corrections. I also removed a few DRM_ERRORs from drm_crtc.c (things actually weren't as bad as I feared).
Next step is to remove a whole slew of DRM_DEBUG calls unless people are really attached to them. I find them to just get in the way when I'm debugging a display problem, so I convert the ones I care about to DRM_ERROR temporarily and add several of my own...
Thanks,
Jesse
PATCH 1/12 drm: remove unused connector_count field from drm_display_mode
Doesn't really belong here anyway.
--- include/drm/drm_crtc.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/drm/drm_crtc.h +0 -1
@@ -118,7 +118,6 @@ struct drm_display_mode {char name[DRM_DISPLAY_MODE_LEN ]; -int connector_count;enum drm_mode_status status;int type;
Signature · 1 line
1.7.4.1
PATCH 2/12 drm: remove unused save/restore functions from drm_crtc_funcs & fix comments
In reply to Jesse BarnesRemove two unused fields from this struct and cleanup/correct the comments.
--- include/drm/drm_crtc.h | 18 ++++-------------- 1 files changed, 4 insertions(+), 14 deletions(-)
include/drm/drm_crtc.h +4 -14
@@ -281,18 +281,12 @@ struct drm_pending_vblank_event;/** * drm_crtc_funcs - control CRTCs for a given device * @reset: reset CRTC after state has been invalidate (e.g. resume) -* @dpms: control display power levels -* @save: save CRTC state -* @resore: restore CRTC state -* @lock: lock the CRTC -* @unlock: unlock the CRTC -* @shadow_allocate: allocate shadow pixmap -* @shadow_create: create shadow pixmap for rotation support -* @shadow_destroy: free shadow pixmap -* @mode_fixup: fixup proposed mode -* @mode_set: set the desired mode on the CRTC +* @cursor_set: set new cursor params +* @cursor_move: move the cursor * @gamma_set: specify color ramp for CRTC * @destroy: deinit and free object. +* @set_config: apply a new configuration to this CRTC +* @page_flip: queue an asynchronous framebuffer flip * * The drm_crtc_funcs structure is the central CRTC management structure * in the DRM. Each CRTC controls one or more connectors (note that the name
@@ -304,10 +298,6 @@ struct drm_pending_vblank_event;* bus accessors. */ struct drm_crtc_funcs { -/* Save CRTC state */ -void (*save)(struct drm_crtc *crtc);/* suspend? */ -/* Restore CRTC state */ -void (*restore)(struct drm_crtc *crtc);/* resume? */ /* Reset CRTC state */ void (*reset)(struct drm_crtc *crtc);
Signature · 1 line
1.7.4.1
PATCH 3/12 drm: fix comments for drm_crtc struct
In reply to Jesse BarnesRemove stale entries and update with the latest stuff.
--- include/drm/drm_crtc.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
include/drm/drm_crtc.h +11 -0
@@ -330,10 +330,21 @@ struct drm_crtc_funcs {/** * drm_crtc - central CRTC control structure +* @dev: parent DRM device +* @head: list management +* @base: base KMS object for ID tracking etc. * @enabled: is this CRTC enabled? +* @mode: current mode timings +* @hwmode: mode timings as programmed to hw regs * @x: x position on screen * @y: y position on screen * @funcs: CRTC control functions +* @gamma_size: size of gamma ramp +* @gamma_store: gamma ramp values +* @framedur_ns: precise frame timing +* @framedur_ns: precise line timing +* @pixeldur_ns: precise pixel timing +* @helper_private: mid-layer private data * * Each CRTC may have one or more connectors associated with it. This structure * allows the CRTC to be controlled.
Signature · 1 line
1.7.4.1
PATCH 4/12 drm: remove unused save/restore fields from drm_connector & fix comments
In reply to Jesse BarnesAlso fix up the wrapping to 80 columns.
--- include/drm/drm_crtc.h | 20 +++++++------------- 1 files changed, 7 insertions(+), 13 deletions(-)
include/drm/drm_crtc.h +7 -13
@@ -386,26 +386,19 @@ struct drm_crtc {/** * drm_connector_funcs - control connectors on a given device * @dpms: set power state (see drm_crtc_funcs above) -* @save: save connector state -* @restore: restore connector state * @reset: reset connector after state has been invalidate (e.g. resume) -* @mode_valid: is this mode valid on the given connector? -* @mode_fixup: try to fixup proposed mode for this connector -* @mode_set: set this mode * @detect: is this connector active? -* @get_modes: get mode list for this connector +* @fill_modes: build a mode list for this connector * @set_property: property for this connector may need update * @destroy: make object go away * @force: notify the driver the connector is forced on * * Each CRTC may have one or more connectors attached to it. The functions -* below allow the core DRM code to control connectors, enumerate available modes, -* etc. +* below allow the core DRM code to control connectors, enumerate available +* modes, etc. */ struct drm_connector_funcs {void (*dpms)(struct drm_connector *connector,int mode); -void (*save)(struct drm_connector *connector); -void (*restore)(struct drm_connector *connector);void (*reset)(struct drm_connector *connector);/* Check to see if anything is attached to the connector.
@@ -416,9 +409,10 @@ struct drm_connector_funcs {*/ enum drm_connector_status (*detect)(struct drm_connector *connector,bool force); -int (*fill_modes)(struct drm_connector *connector,uint32_t max_width,uint32_t max_height); -int (*set_property)(struct drm_connector *connector,struct drm_property *property, -uint64_t val); +int (*fill_modes)(struct drm_connector *connector,uint32_t max_width, +uint32_t max_height); +int (*set_property)(struct drm_connector *connector, +struct drm_property *property,uint64_t val);void (*destroy)(struct drm_connector *connector);void (*force)(struct drm_connector *connector); };
Signature · 1 line
1.7.4.1
Re: [PATCH 04/12] drm: remove unused save/restore fields from drm_connector & fix comments
Quoted 42 lines · Jesse Barnes
Also fix up the wrapping to 80 columns.
Signed-off-by Jesse Barnes <[email protected]>--- include/drm/drm_crtc.h | 20 +++++++------------- 1 files changed, 7 insertions(+), 13 deletions(-)include/drm/drm_crtc.h +3
-10@@ -386,26 +386,19 @@ struct drm_crtc {/** * drm_connector_funcs - control connectors on a given device * @dpms: set power state (see drm_crtc_funcs above) -* @save: save connector state -* @restore: restore connector state * @reset: reset connector after state has been invalidate (e.g. resume) -* @mode_valid: is this mode valid on the given connector? -* @mode_fixup: try to fixup proposed mode for this connector -* @mode_set: set this mode * @detect: is this connector active? -* @get_modes: get mode list for this connector +* @fill_modes: build a mode list for this connector * @set_property: property for this connector may need update * @destroy: make object go away * @force: notify the driver the connector is forced on * * Each CRTC may have one or more connectors attached to it. The functions -* below allow the core DRM code to control connectors, enumerate available modes, -* etc. +* below allow the core DRM code to control connectors, enumerate available +* modes, etc. */ struct drm_connector_funcs {void (*dpms)(struct drm_connector *connector,int mode); -void (*save)(struct drm_connector *connector); -void (*restore)(struct drm_connector *connector);void (*reset)(struct drm_connector *connector);/* Check to see if anything is attached to the connector.
include/drm/drm_crtc.h struct drm_connector_funcs { · line 413
Quoted 8 lines
include/drm/drm_crtc.h +2
-3@@ -416,9 +409,10 @@ struct drm_connector_funcs {*/ enum drm_connector_status (*detect)(struct drm_connector *connector,bool force); -int (*fill_modes)(struct drm_connector *connector,uint32_t max_width,uint32_t max_height); -int (*set_property)(struct drm_connector *connector,struct drm_property *property, -uint64_t val); +int (*fill_modes)(struct drm_connector *connector,uint32_t max_width, +uint32_t max_height);
Attack of the random 80-column limit!
int (*fill_modes)(struct drm_connector *connector,
uint32_t max_width, uint32_t max_height);
keeps the logically more connected width&height together.
What colour do you want your bikeshed today?
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 04/12] drm: remove unused save/restore fields from drm_connector & fix comments
Quoted 54 lines · On Mon, 07 Nov 2011 20:26:59 +0000 Chris Wilson <[email protected]>…
Quoted 42 lines · Jesse Barnes
Also fix up the wrapping to 80 columns.
Signed-off-by Jesse Barnes <[email protected]>--- include/drm/drm_crtc.h | 20 +++++++------------- 1 files changed, 7 insertions(+), 13 deletions(-)include/drm/drm_crtc.h +3
-10@@ -386,26 +386,19 @@ struct drm_crtc {/** * drm_connector_funcs - control connectors on a given device * @dpms: set power state (see drm_crtc_funcs above) -* @save: save connector state -* @restore: restore connector state * @reset: reset connector after state has been invalidate (e.g. resume) -* @mode_valid: is this mode valid on the given connector? -* @mode_fixup: try to fixup proposed mode for this connector -* @mode_set: set this mode * @detect: is this connector active? -* @get_modes: get mode list for this connector +* @fill_modes: build a mode list for this connector * @set_property: property for this connector may need update * @destroy: make object go away * @force: notify the driver the connector is forced on * * Each CRTC may have one or more connectors attached to it. The functions -* below allow the core DRM code to control connectors, enumerate available modes, -* etc. +* below allow the core DRM code to control connectors, enumerate available +* modes, etc. */ struct drm_connector_funcs {void (*dpms)(struct drm_connector *connector,int mode); -void (*save)(struct drm_connector *connector); -void (*restore)(struct drm_connector *connector);void (*reset)(struct drm_connector *connector);/* Check to see if anything is attached to the connector. include/drm/drm_crtc.h struct drm_connector_funcs { · line 413
Quoted 8 lines
include/drm/drm_crtc.h +2
-3@@ -416,9 +409,10 @@ struct drm_connector_funcs {*/ enum drm_connector_status (*detect)(struct drm_connector *connector,bool force); -int (*fill_modes)(struct drm_connector *connector,uint32_t max_width,uint32_t max_height); -int (*set_property)(struct drm_connector *connector,struct drm_property *property, -uint64_t val); +int (*fill_modes)(struct drm_connector *connector,uint32_t max_width, +uint32_t max_height);Attack of the random 80-column limit!
Quoted 6 lines
int (*fill_modes)(struct
drm_connector*connector,uint32_t max_width, uint32_t max_height);keeps the logically more connected width&height together.
What colour do you want your bikeshed today?
/me burns down the bikeshed.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/12 drm: add comments for drm_encoder_funcs
In reply to Jesse BarnesJust basic verbiage.
--- include/drm/drm_crtc.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
include/drm/drm_crtc.h +7 -0
@@ -417,6 +417,13 @@ struct drm_connector_funcs {void (*force)(struct drm_connector *connector); }; +/** +* drm_encoder_funcs - encoder controls +* @reset: reset state (e.g. at init or resume time) +* @destroy: cleanup and free associated data +* +* Encoders sit between CRTCs and connectors. +*/ struct drm_encoder_funcs {void (*reset)(struct drm_encoder *encoder);void (*destroy)(struct drm_encoder *encoder);
Signature · 1 line
1.7.4.1
PATCH 6/12 drm: add drm_encoder comments
In reply to Jesse BarnesJust some basic comments about the place and function of the structure and fields.
--- include/drm/drm_crtc.h | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
include/drm/drm_crtc.h +12 -0
@@ -436,6 +436,18 @@ struct drm_encoder_funcs {/** * drm_encoder - central DRM encoder structure +* @dev: parent DRM device +* @head: list management +* @base: base KMS object +* @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h +* @possible_crtcs: bitmask of potential CRTC bindings +* @possible_clones: bitmask of potential sibling encoders for cloning +* @crtc: currently bound CRTC +* @funcs: control functions +* @helper_private: mid-layer private data +* +* CRTCs drive pixels to encoders, which convert them into signals +* appropriate for a given connector or set of connectors. */ struct drm_encoder {struct drm_device *dev;
Signature · 1 line
1.7.4.1
PATCH 7/12 drm: remove unused fields in drm_connector and document the rest
In reply to Jesse BarnesWe never used initial_x/y or the force_encoder_id, so drop those fields and proide a basic description of the others.
Really, the ELD bits belong in drm_display_info rather than directly in the connector, but that's a separate cleanup.
--- include/drm/drm_crtc.h | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 insertions(+), 7 deletions(-)
include/drm/drm_crtc.h +28 -7
@@ -483,14 +483,37 @@ enum drm_connector_force {/** * drm_connector - central DRM connector control structure -* @crtc: CRTC this connector is currently connected to, NULL if none +* @dev: parent DRM device +* @kdev: kernel device for sysfs attributes +* @attr: sysfs attributes +* @head: list management +* @base: base KMS object +* @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h +* @connector_type_id: index into connector type enum * @interlace_allowed: can this connector handle interlaced modes? * @doublescan_allowed: can this connector handle doublescan? -* @available_modes: modes available on this connector (from get_modes() + user) -* @initial_x: initial x position for this connector -* @initial_y: initial y position for this connector -* @status: connector connected? +* @modes: modes available on this connector (from fill_modes() + user) +* @status: one of the drm_connector_status enums (connected, not, or unknown) +* @probed_modes: list of modes derived directly from the display +* @display_info: information about attached display (e.g. from EDID) * @funcs: connector control functions +* @user_modes: user added mode list +* @edid_blob_ptr: DRM property containing EDID if present +* @property_ids: property tracking for this connector +* @property_values: value pointers or data for properties +* @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling +* @dpms: current dpms state +* @helper_private: mid-layer private data +* @force: a %DRM_FORCE_<foo> state for forced mode sets +* @encoder_ids: valid encoders for this connector +* @encoder: encoder driving this connector, if any +* @eld: EDID-like data, if present +* @dvi_dual: dual link DVI, if found +* @max_tmds_clock: max clock rate, if found +* @latency_present: AV delay info from ELD, if found +* @video_latency: video latency info from ELD, if found +* @audio_latency: audio latency info from ELD, if found +* @null_edid_counter: track sinks that give us all zeros for the EDID * * Each connector may be connected to one or more CRTCs, or may be clonable by * another connector if they can share a CRTC. Each connector also has a specific
@@ -511,7 +534,6 @@ struct drm_connector {bool doublescan_allowed;struct list_head modes;/* list of modes on this connector */ -int initial_x, initial_y;enum drm_connector_status status;/* these are modes added by probing with DDC or the BIOS */
@@ -535,7 +557,6 @@ struct drm_connector {/* forced on connector */ enum drm_connector_force force;uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER ]; -uint32_t force_encoder_id;struct drm_encoder *encoder;/* currently active encoder */ /* EDID bits */
Signature · 1 line
1.7.4.1
PATCH 8/12 drm: document drm_mode_set structure
In reply to Jesse BarnesThis is a core mode setting structure that deserves a little verbiage.
--- include/drm/drm_crtc.h | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
include/drm/drm_crtc.h +9 -1
@@ -570,7 +570,15 @@ struct drm_connector { };/** -* struct drm_mode_set +* drm_mode_set - new values for a CRTC config change +* @head: list management +* @fb: framebuffer to use for new config +* @crtc: CRTC whose configuration we're about to change +* @mode: mode timings to use +* @x: position of this CRTC relative to @fb +* @y: position of this CRTC relative to @fb +* @connectors: array of connectors to drive with this CRTC if possible +* @num_connectors: size of @connectors array * * Represents a single crtc the connectors that it drives with what mode * and from which framebuffer it scans out from.
Signature · 1 line
1.7.4.1
PATCH 9/12 drm: document and cleanup drm_mode_config_funcs
In reply to Jesse BarnesJust fix the wrapping mostly.
--- include/drm/drm_crtc.h | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
include/drm/drm_crtc.h +9 -2
@@ -600,10 +600,17 @@ struct drm_mode_set { };/** -* struct drm_mode_config_funcs - configure CRTCs for a given screen layout +* struct drm_mode_config_funcs - basic driver provided mode setting functions +* @fb_create: create a new framebuffer object +* @output_poll_changed: function to handle output configuration changes +* +* Some global (i.e. not per-CRTC, connector, etc) mode setting functions that +* involve drivers. */ struct drm_mode_config_funcs { -struct drm_framebuffer *(*fb_create)(struct drm_device *dev,struct drm_file *file_priv,struct drm_mode_fb_cmd *mode_cmd); +struct drm_framebuffer *(*fb_create)(struct drm_device *dev, +struct drm_file *file_priv, +struct drm_mode_fb_cmd *mode_cmd);void (*output_poll_changed)(struct drm_device *dev); };
Signature · 1 line
1.7.4.1
PATCH 10/12 drm: document the drm_mode_group structure
In reply to Jesse BarnesThis is actually a core structure with a big future ahead of it. Make it a little less mysterious.
--- include/drm/drm_crtc.h | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
include/drm/drm_crtc.h +13 -0
@@ -614,6 +614,19 @@ struct drm_mode_config_funcs {void (*output_poll_changed)(struct drm_device *dev); }; +/** +* drm_mode_group - group of mode setting resources for potential sub-grouping +* @num_crtcs: CRTC count +* @num_encoders: encoder count +* @num_connectors: connector count +* @id_list: list of KMS object IDs in this group +* +* Currently this simply tracks the global mode setting state. But in the +* future it could allow groups of objects to be set aside into independent +* control groups for use by different user level processes (e.g. two X servers +* running simultaneously on different heads, each with their own mode +* configuration and freedom of mode setting). +*/ struct drm_mode_group {uint32_t num_crtcs;uint32_t num_encoders;
Signature · 1 line
1.7.4.1
PATCH 11/12 drm: document the drm_mode_config structure
In reply to Jesse BarnesIncluding a comment about what the locks are for.
--- include/drm/drm_crtc.h | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
include/drm/drm_crtc.h +23 -0
@@ -638,7 +638,30 @@ struct drm_mode_group {/** * drm_mode_config - Mode configuration control structure +* @mutex: mutex protecting KMS related lists and structures +* @idr_mutex: mutex for KMS ID allocation and management +* @crtc_idr: main KMS ID tracking object +* @num_fb: number of fbs available +* @fb_list: list of framebuffers available +* @num_connector: number of connectors on this device +* @connector_list: list of connector objects +* @num_encoder: number of encoders on this device +* @encoder_list: list of encoder objects +* @num_crtc: number of CRTCs on this device +* @crtc_list: list of CRTC objects +* @min_width: minimum pixel width on this device +* @min_height: minimum pixel height on this device +* @max_width: maximum pixel width on this device +* @max_height: maximum pixel height on this device +* @funcs: core driver provided mode setting functions +* @fb_base: base address of the framebuffer +* @poll_enabled: track polling status for this device +* @output_poll_work: delayed work for polling in process context +* @*_property: core property tracking * +* Core mode resource tracking structure. All CRTC, encoders, and connectors +* enumerated by the driver are added here, as are global properties. Some +* global restrictions are also here, e.g. dimension restrictions. */ struct drm_mode_config {struct mutex mutex;/* protects configuration (mode lists etc.) */
Signature · 1 line
1.7.4.1
PATCH 12/12 drm: remove some potentially dangerous DRM_ERRORs
In reply to Jesse BarnesEach of these error messages can be caused by a broken or malicious userspace wanting to spam the dmesg with useless info. They're really not worthy of DRM_DEBUG statements either; those are generally only useful during bringup of new hardware or versions, and ought to be removed before going upstream anyway.
--- drivers/gpu/drm/drm_crtc.c | 19 ++++--------------- 1 files changed, 4 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_crtc.c +4 -15
@@ -1620,10 +1620,8 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -if (!req->flags) { -DRM_ERROR ("no operation set\n" ); +if (!req->flags)return -EINVAL ; - }mutex_lock (&dev->mode_config.mutex); obj =drm_mode_object_find (dev, req->crtc_id,DRM_MODE_OBJECT_CRTC );
@@ -1636,7 +1634,6 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,if (req->flags &DRM_MODE_CURSOR_BO ) {if (!crtc->funcs->cursor_set) { -DRM_ERROR ("crtc does not support cursor\n" ); ret = -ENXIO ; goto out; }
@@ -1649,7 +1646,6 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,if (crtc->funcs->cursor_move) { ret = crtc->funcs->cursor_move (crtc, req->x, req->y); }else { -DRM_ERROR ("crtc does not support cursor\n" ); ret = -EFAULT ; goto out; }
@@ -1687,14 +1683,11 @@ int drm_mode_addfb(struct drm_device *dev,if (!drm_core_check_feature (dev,DRIVER_MODESET ))return -EINVAL ; -if ((config->min_width > r->width) || (r->width > config->max_width)) { -DRM_ERROR ("mode new framebuffer width not within limits\n" ); +if ((config->min_width > r->width) || (r->width > config->max_width))return -EINVAL ; - } -if ((config->min_height > r->height) || (r->height > config->max_height)) { -DRM_ERROR ("mode new framebuffer height not within limits\n" ); + +if ((config->min_height > r->height) || (r->height > config->max_height))return -EINVAL ; - }mutex_lock (&dev->mode_config.mutex);
@@ -1751,7 +1744,6 @@ int drm_mode_rmfb(struct drm_device *dev, obj =drm_mode_object_find (dev, *id,DRM_MODE_OBJECT_FB );/* TODO check that we really get a framebuffer back. */ if (!obj) { -DRM_ERROR ("mode invalid framebuffer id\n" ); ret = -EINVAL ; goto out; }
@@ -1762,7 +1754,6 @@ int drm_mode_rmfb(struct drm_device *dev, found =1 ;if (!found) { -DRM_ERROR ("tried to remove a fb that we didn't own\n" ); ret = -EINVAL ; goto out; }
@@ -1809,7 +1800,6 @@ int drm_mode_getfb(struct drm_device *dev,mutex_lock (&dev->mode_config.mutex); obj =drm_mode_object_find (dev, r->fb_id,DRM_MODE_OBJECT_FB );if (!obj) { -DRM_ERROR ("invalid framebuffer id\n" ); ret = -EINVAL ; goto out; }
@@ -1845,7 +1835,6 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,mutex_lock (&dev->mode_config.mutex); obj =drm_mode_object_find (dev, r->fb_id,DRM_MODE_OBJECT_FB );if (!obj) { -DRM_ERROR ("invalid framebuffer id\n" ); ret = -EINVAL ; goto out_err1; }
Signature · 1 line
1.7.4.1
Alex Deucher
Reviewed-byQuoted 8 lines · Jesse Barnes
Just some cleanups for unused fields in
drm_crtc.hand some comment corrections. I also removed a fewDRM_ERRORsfromdrm_crtc.c(things actually weren't as bad as I feared).Next step is to remove a whole slew of
DRM_DEBUGcalls unless people are really attached to them. I find them to just get in the way when I'm debugging a display problem, so I convert the ones I care about toDRM_ERRORtemporarily and add several of my own...
For the series:
Quoted 9 lines
Thanks,
Jesse_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel