<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">On Thu, May 24, 2018, 9:26 PM Haneen Mohammed <<a href="mailto:hamohammed.sa@gmail.com">hamohammed.sa@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch add checks for atomic_[duplicate/destroy]_state of<br>
drm_[connector/crtc/plane]_funcs for atomic drivers in the relevant<br>
drm_*_init functions since these callback are mandatory for atomic drivers.<br>
<br>
Update the kerneldoc comments for those callbacks.<br>
<br>
Signed-off-by: Haneen Mohammed <<a href="mailto:hamohammed.sa@gmail.com" target="_blank" rel="noreferrer">hamohammed.sa@gmail.com</a>><br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Reviewed-by: Sean Paul <<a href="mailto:seanpaul@chromium.org">seanpaul@chromium.org</a>></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
drivers/gpu/drm/drm_connector.c | 4 ++++<br>
drivers/gpu/drm/drm_crtc.c | 4 ++++<br>
drivers/gpu/drm/drm_plane.c | 4 ++++<br>
include/drm/drm_connector.h | 4 ++++<br>
include/drm/drm_crtc.h | 4 ++++<br>
include/drm/drm_plane.h | 4 ++++<br>
6 files changed, 24 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c<br>
index b3cde897cd80..ab291f4f339a 100644<br>
--- a/drivers/gpu/drm/drm_connector.c<br>
+++ b/drivers/gpu/drm/drm_connector.c<br>
@@ -195,6 +195,10 @@ int drm_connector_init(struct drm_device *dev,<br>
struct ida *connector_ida =<br>
&drm_connector_enum_list[connector_type].ida;<br>
<br>
+ WARN_ON(drm_drv_uses_atomic_modeset(dev) &&<br>
+ (!funcs->atomic_destroy_state ||<br>
+ !funcs->atomic_duplicate_state));<br>
+<br>
ret = __drm_mode_object_add(dev, &connector->base,<br>
DRM_MODE_OBJECT_CONNECTOR,<br>
false, drm_connector_free);<br>
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c<br>
index 03583887cfec..d1933c5f2524 100644<br>
--- a/drivers/gpu/drm/drm_crtc.c<br>
+++ b/drivers/gpu/drm/drm_crtc.c<br>
@@ -286,6 +286,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,<br>
if (WARN_ON(config->num_crtc >= 32))<br>
return -EINVAL;<br>
<br>
+ WARN_ON(drm_drv_uses_atomic_modeset(dev) &&<br>
+ (!funcs->atomic_destroy_state ||<br>
+ !funcs->atomic_duplicate_state));<br>
+<br>
crtc->dev = dev;<br>
crtc->funcs = funcs;<br>
<br>
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c<br>
index 6d2a6e428a3e..e0efb06eec31 100644<br>
--- a/drivers/gpu/drm/drm_plane.c<br>
+++ b/drivers/gpu/drm/drm_plane.c<br>
@@ -177,6 +177,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,<br>
if (WARN_ON(config->num_total_plane >= 32))<br>
return -EINVAL;<br>
<br>
+ WARN_ON(drm_drv_uses_atomic_modeset(dev) &&<br>
+ (!funcs->atomic_destroy_state ||<br>
+ !funcs->atomic_duplicate_state));<br>
+<br>
ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE);<br>
if (ret)<br>
return ret;<br>
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h<br>
index 675cc3f8cf85..65b6c86ecd50 100644<br>
--- a/include/drm/drm_connector.h<br>
+++ b/include/drm/drm_connector.h<br>
@@ -608,6 +608,8 @@ struct drm_connector_funcs {<br>
* cleaned up by calling the @atomic_destroy_state hook in this<br>
* structure.<br>
*<br>
+ * This callback is mandatory for atomic drivers.<br>
+ *<br>
* Atomic drivers which don't subclass &struct drm_connector_state should use<br>
* drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the<br>
* state structure to extend it with driver-private state should use<br>
@@ -634,6 +636,8 @@ struct drm_connector_funcs {<br>
*<br>
* Destroy a state duplicated with @atomic_duplicate_state and release<br>
* or unreference all resources it references<br>
+ *<br>
+ * This callback is mandatory for atomic drivers.<br>
*/<br>
void (*atomic_destroy_state)(struct drm_connector *connector,<br>
struct drm_connector_state *state);<br>
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h<br>
index a2d81d2907a9..26511d6775d7 100644<br>
--- a/include/drm/drm_crtc.h<br>
+++ b/include/drm/drm_crtc.h<br>
@@ -503,6 +503,8 @@ struct drm_crtc_funcs {<br>
* cleaned up by calling the @atomic_destroy_state hook in this<br>
* structure.<br>
*<br>
+ * This callback is mandatory for atomic drivers.<br>
+ *<br>
* Atomic drivers which don't subclass &struct drm_crtc_state should use<br>
* drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass the<br>
* state structure to extend it with driver-private state should use<br>
@@ -529,6 +531,8 @@ struct drm_crtc_funcs {<br>
*<br>
* Destroy a state duplicated with @atomic_duplicate_state and release<br>
* or unreference all resources it references<br>
+ *<br>
+ * This callback is mandatory for atomic drivers.<br>
*/<br>
void (*atomic_destroy_state)(struct drm_crtc *crtc,<br>
struct drm_crtc_state *state);<br>
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h<br>
index f7bf4a48b1c3..d6d68b466649 100644<br>
--- a/include/drm/drm_plane.h<br>
+++ b/include/drm/drm_plane.h<br>
@@ -277,6 +277,8 @@ struct drm_plane_funcs {<br>
* cleaned up by calling the @atomic_destroy_state hook in this<br>
* structure.<br>
*<br>
+ * This callback is mandatory for atomic drivers.<br>
+ *<br>
* Atomic drivers which don't subclass &struct drm_plane_state should use<br>
* drm_atomic_helper_plane_duplicate_state(). Drivers that subclass the<br>
* state structure to extend it with driver-private state should use<br>
@@ -303,6 +305,8 @@ struct drm_plane_funcs {<br>
*<br>
* Destroy a state duplicated with @atomic_duplicate_state and release<br>
* or unreference all resources it references<br>
+ *<br>
+ * This callback is mandatory for atomic drivers.<br>
*/<br>
void (*atomic_destroy_state)(struct drm_plane *plane,<br>
struct drm_plane_state *state);<br>
-- <br>
2.17.0<br>
<br>
</blockquote></div></div></div>