drm: Wrap the check for atomic_commit implementation
Subsystems (3)
PATCH v4 1/2 drm: Wrap the check for atomic_commit implementation
This check is useful for drivers that do not have DRIVER_ATOMIC set but have atomic modesetting internally implemented. Wrap the check into a function since this is used in many places and as a bonus, the function name helps to document what the check is for.
v2:
Change return type to bool (Ville)
Move the function drm_atomic.h (Daniel)
Fixed comment marker for documentation
v3:
Included drmP.h to dereference struct drm_device
--- drivers/gpu/drm/drm_fb_helper.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_connector.c | 5 +++-- drivers/gpu/drm/nouveau/nouveau_display.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 ++- include/drm/drm_atomic.h | 13 +++++++++++++ 5 files changed, 24 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +3 -3
@@ -405,7 +405,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)drm_warn_on_modeset_not_all_locked (dev); -if (dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (dev))return restore_fbdev_mode_atomic (fb_helper);drm_for_each_plane (plane, dev) {
@@ -1444,7 +1444,7 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,return -EBUSY ; } -if (dev->mode_config.funcs->atomic_commit) { +if (drm_drv_uses_atomic_modeset (dev)) { ret =pan_display_atomic (var, info); goto unlock; }
@@ -2060,7 +2060,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,* NULL we fallback to the default drm_atomic_helper_best_encoder() * helper. */ -if (fb_helper->dev->mode_config.funcs->atomic_commit && +if (drm_drv_uses_atomic_modeset (fb_helper->dev) && !connector_funcs->best_encoder) encoder =drm_atomic_helper_best_encoder (connector);else
drivers/gpu/drm/nouveau/nouveau_connector.c +3 -2
@@ -33,6 +33,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_edid.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include "nouveau_reg.h" #include "nouveau_drv.h"
@@ -769,7 +770,7 @@ nouveau_connector_set_property(struct drm_connector *connector,struct drm_encoder *encoder =to_drm_encoder (nv_encoder);int ret; -if (connector->dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (connector->dev))return drm_atomic_helper_connector_set_property (connector, property, value); ret = connector->funcs->atomic_set_property(&nv_connector->base,
@@ -1074,7 +1075,7 @@ nouveau_connector_helper_funcs = {static int nouveau_connector_dpms (struct drm_connector *connector,int mode) { -if (connector->dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (connector->dev))return drm_atomic_helper_connector_dpms (connector, mode);return drm_helper_connector_dpms (connector, mode); }
drivers/gpu/drm/nouveau/nouveau_display.c +3 -3
@@ -162,7 +162,7 @@ nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe,list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {if (nouveau_crtc (crtc)->index == pipe) {struct drm_display_mode *mode; -if (dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (dev)) mode = &crtc->state->adjusted_mode;else mode = &crtc->hwmode;
@@ -738,7 +738,7 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime)struct nouveau_display *disp =nouveau_display (dev);struct drm_crtc *crtc; -if (dev->mode_config.funcs->atomic_commit) { +if (drm_drv_uses_atomic_modeset (dev)) {if (!runtime) { disp->suspend =nouveau_atomic_suspend (dev);if (IS_ERR (disp->suspend)) {
@@ -784,7 +784,7 @@ nouveau_display_resume(struct drm_device *dev, bool runtime)struct drm_crtc *crtc;int ret; -if (dev->mode_config.funcs->atomic_commit) { +if (drm_drv_uses_atomic_modeset (dev)) {nouveau_display_init (dev);if (disp->suspend) {drm_atomic_helper_resume (dev, disp->suspend);
drivers/gpu/drm/nouveau/nouveau_fbcon.c +2 -1
@@ -41,6 +41,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include "nouveau_drv.h" #include "nouveau_gem.h"
@@ -524,7 +525,7 @@ nouveau_fbcon_init(struct drm_device *dev) preferred_bpp =32 ;/* disable all the possible outputs/crtcs before entering KMS mode */ -if (!dev->mode_config.funcs->atomic_commit) +if (!drm_drv_uses_atomic_modeset (dev))drm_helper_disable_unused_functions (dev); ret =drm_fb_helper_initial_config (&fbcon->helper, preferred_bpp);
include/drm/drm_atomic.h +13 -0
@@ -29,6 +29,7 @@#define DRM_ATOMIC_H_ #include <drm/drm_crtc.h> +#include <drm/drmP.h> /** * struct drm_crtc_commit - track modeset commits on a CRTC
@@ -419,5 +420,17 @@ drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state) state->connectors_changed; } +/** +* drm_drv_uses_atomic_modeset - check if the driver implements +* atomic_commit() +* @dev: DRM device +* +* This check is useful if drivers do not have DRIVER_ATOMIC set but +* have atomic modesetting internally implemented. +*/ +static inline bool drm_drv_uses_atomic_modeset (struct drm_device *dev) +{ +return dev->mode_config.funcs->atomic_commit !=NULL ; +}#endif /* DRM_ATOMIC_H_ */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 2/2 drm: Get atomic property value even if DRIVER_ATOMIC is not set
i915 does not set DRIVER_ATOMIC by default yet but uses atomic_check and atomic_commit. drm_object_property_get_value() does not read the correct value of atomic properties if DRIVER_ATOMIC is not set. Checking whether the driver uses atomic modeset is a better check instead as the property values are tracked in the state structures.
v2: Included header
--- drivers/gpu/drm/drm_mode_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_mode_object.c +2 -1
@@ -23,6 +23,7 @@#include <linux/export.h> #include <drm/drmP.h> #include <drm/drm_mode_object.h> +#include <drm/drm_atomic.h> #include "drm_crtc_internal.h"
@@ -273,7 +274,7 @@ int drm_object_property_get_value(struct drm_mode_object *obj,* their value in obj->properties->values[].. mostly to avoid * having to deal w/ EDID and similar props in atomic paths: */ -if (drm_core_check_feature (property->dev,DRIVER_ATOMIC ) && +if (drm_drv_uses_atomic_modeset (property->dev) && !(property->flags &DRM_MODE_PROP_IMMUTABLE ))return drm_atomic_get_property (obj, property, val);
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [v4,1/2] drm: Wrap the check for atomic_commit implementation
In reply to Dhinakaran Pandiyan== Series Details ==
== Series Details ==
Series: series starting with [v4,1/2] drm: Wrap the check for atomic_commit implementation
URL : https://patchwork.freedesktop.org/series/17193/
State : success
== Summary ==
Series 17193v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/17193/revisions/1/mbox/
fi-bdw-5557u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:246 pass:207 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-bxt-t5700 total:82 pass:69 dwarn:0 dfail:0 fail:0 skip:12 fi-byt-j1900 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-ivb-3520m total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-kbl-7500u total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6260u total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:246 pass:226 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:246 pass:222 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-snb-2520m total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-snb-2600 total:246 pass:214 dwarn:0 dfail:0 fail:0 skip:32
facc8fa36acbf8244b601a0eec21e6d030061a3f drm-tip: 2016y-12m-23d-16h-09m-03s UTC integration manifest 20ede2d drm: Get atomic property value even if DRIVER_ATOMIC is not set
0903b0c drm: Wrap the check for atomic_commit implementation
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3388/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Dhinakaran Pandiyan
This check is useful for drivers that do not have
DRIVER_ATOMICset but have atomic modesetting internally implemented. Wrap the check into a function since this is used in many places and as a bonus, the function name helps to document what the check is for.
Quoted 7 lines
v2:
Change return type to bool (Ville)
Move the functiondrm_atomic.h(Daniel)
Fixed comment marker for documentationv3:
IncludeddrmP.hto dereference structdrm_device
I've went with a slightly different solution. The proper one is to extract drm_dev.h (since drmP.h is horribly messy), but that's a lot more work. -Daniel
Quoted 159 lines
Suggested-by Daniel Vetter <[email protected]>Cc Daniel Vetter <[email protected]>Cc Ben Skeggs <[email protected]>Signed-off-by Dhinakaran Pandiyan <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_connector.c | 5 +++-- drivers/gpu/drm/nouveau/nouveau_display.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 ++- include/drm/drm_atomic.h | 13 +++++++++++++ 5 files changed, 24 insertions(+), 9 deletions(-)drivers/gpu/drm/drm_fb_helper.c +3
-3@@ -405,7 +405,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)drm_warn_on_modeset_not_all_locked (dev); -if (dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (dev))return restore_fbdev_mode_atomic (fb_helper);drm_for_each_plane (plane, dev) {@@ -1444,7 +1444,7 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,return -EBUSY ; } -if (dev->mode_config.funcs->atomic_commit) { +if (drm_drv_uses_atomic_modeset (dev)) { ret =pan_display_atomic (var, info); goto unlock; }@@ -2060,7 +2060,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,* NULL we fallback to the default drm_atomic_helper_best_encoder() * helper. */ -if (fb_helper->dev->mode_config.funcs->atomic_commit && +if (drm_drv_uses_atomic_modeset (fb_helper->dev) && !connector_funcs->best_encoder) encoder =drm_atomic_helper_best_encoder (connector);else drivers/gpu/drm/nouveau/nouveau_connector.c +3
-2@@ -33,6 +33,7 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_edid.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> #include "nouveau_reg.h" #include "nouveau_drv.h" @@ -769,7 +770,7 @@ nouveau_connector_set_property(struct drm_connector *connector,struct drm_encoder *encoder =to_drm_encoder (nv_encoder);int ret; -if (connector->dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (connector->dev))return drm_atomic_helper_connector_set_property (connector, property, value); ret = connector->funcs->atomic_set_property(&nv_connector->base,@@ -1074,7 +1075,7 @@ nouveau_connector_helper_funcs = {static int nouveau_connector_dpms (struct drm_connector *connector,int mode) { -if (connector->dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (connector->dev))return drm_atomic_helper_connector_dpms (connector, mode);return drm_helper_connector_dpms (connector, mode); }drivers/gpu/drm/nouveau/nouveau_display.c +3
-3@@ -162,7 +162,7 @@ nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe,list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) {if (nouveau_crtc (crtc)->index == pipe) {struct drm_display_mode *mode; -if (dev->mode_config.funcs->atomic_commit) +if (drm_drv_uses_atomic_modeset (dev)) mode = &crtc->state->adjusted_mode;else mode = &crtc->hwmode;@@ -738,7 +738,7 @@ nouveau_display_suspend(struct drm_device *dev, bool runtime)struct nouveau_display *disp =nouveau_display (dev);struct drm_crtc *crtc; -if (dev->mode_config.funcs->atomic_commit) { +if (drm_drv_uses_atomic_modeset (dev)) {if (!runtime) { disp->suspend =nouveau_atomic_suspend (dev);if (IS_ERR (disp->suspend)) {@@ -784,7 +784,7 @@ nouveau_display_resume(struct drm_device *dev, bool runtime)struct drm_crtc *crtc;int ret; -if (dev->mode_config.funcs->atomic_commit) { +if (drm_drv_uses_atomic_modeset (dev)) {nouveau_display_init (dev);if (disp->suspend) {drm_atomic_helper_resume (dev, disp->suspend);drivers/gpu/drm/nouveau/nouveau_fbcon.c +2
-1@@ -41,6 +41,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include "nouveau_drv.h" #include "nouveau_gem.h" @@ -524,7 +525,7 @@ nouveau_fbcon_init(struct drm_device *dev) preferred_bpp =32 ;/* disable all the possible outputs/crtcs before entering KMS mode */ -if (!dev->mode_config.funcs->atomic_commit) +if (!drm_drv_uses_atomic_modeset (dev))drm_helper_disable_unused_functions (dev); ret =drm_fb_helper_initial_config (&fbcon->helper, preferred_bpp);include/drm/drm_atomic.h +13
-0@@ -29,6 +29,7 @@#define DRM_ATOMIC_H_ #include <drm/drm_crtc.h> +#include <drm/drmP.h> /** * struct drm_crtc_commit - track modeset commits on a CRTC @@ -419,5 +420,17 @@ drm_atomic_crtc_needs_modeset(const struct drm_crtc_state *state) state->connectors_changed; } +/** +* drm_drv_uses_atomic_modeset - check if the driver implements +* atomic_commit() +* @dev: DRM device +* +* This check is useful if drivers do not have DRIVER_ATOMIC set but +* have atomic modesetting internally implemented. +*/ +static inline bool drm_drv_uses_atomic_modeset (struct drm_device *dev) +{ +return dev->mode_config.funcs->atomic_commit !=NULL ; +}#endif /* DRM_ATOMIC_H_ */ Signature · 1 line
2.7.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx