Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da7a23db authored by Steve Cohen's avatar Steve Cohen
Browse files

drm/msm: update SDE reference counting API for 4.14 kernel



This patch updates the SDE DRM driver to use the get/put API instead
of reference/unreference/free for property blobs, gem objects,
framebuffers, and atomic states.

Change-Id: Idb41f003f7fb0cea72909a74e7624b8c364a8a8e
Signed-off-by: default avatarSteve Cohen <cohens@codeaurora.org>
parent 2d123af8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -988,7 +988,7 @@ static int msm_disable_all_modes(

	/* on successful atomic commit state ownership transfers to framework */
	if (ret != 0)
		drm_atomic_state_free(state);
		drm_atomic_state_put(state);

	return ret;
}
+5 −5
Original line number Diff line number Diff line
@@ -419,7 +419,7 @@ int msm_property_atomic_set(struct msm_property_info *info,

				/* save blob - need to clear previous ref */
				if (property_state->values[property_idx].blob)
					drm_property_unreference_blob(
					drm_property_blob_put(
						property_state->values[
						property_idx].blob);
				property_state->values[property_idx].blob =
@@ -561,7 +561,7 @@ void msm_property_duplicate_state(struct msm_property_info *info,
		/* add ref count for blobs and initialize dirty nodes */
		for (i = 0; i < info->property_count; ++i) {
			if (property_state->values[i].blob)
				drm_property_reference_blob(
				drm_property_blob_get(
						property_state->values[i].blob);
			INIT_LIST_HEAD(&property_state->values[i].dirty_node);
		}
@@ -580,7 +580,7 @@ void msm_property_destroy_state(struct msm_property_info *info, void *state,
		/* remove ref count for blobs */
		for (i = 0; i < info->property_count; ++i)
			if (property_state->values[i].blob) {
				drm_property_unreference_blob(
				drm_property_blob_put(
						property_state->values[i].blob);
				property_state->values[i].blob = NULL;
			}
@@ -646,13 +646,13 @@ int msm_property_set_blob(struct msm_property_info *info,
		if (rc) {
			DRM_ERROR("failed to set blob to property\n");
			if (blob)
				drm_property_unreference_blob(blob);
				drm_property_blob_put(blob);
			goto exit;
		}

		/* update local reference */
		if (*blob_reference)
			drm_property_unreference_blob(*blob_reference);
			drm_property_blob_put(*blob_reference);
		*blob_reference = blob;
	}

+6 −6
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ static int sde_cp_disable_crtc_blob_property(struct sde_cp_node *prop_node)

	if (!blob)
		return 0;
	drm_property_unreference_blob(blob);
	drm_property_blob_put(blob);
	prop_node->blob_ptr = NULL;
	return 0;
}
@@ -237,7 +237,7 @@ static void sde_cp_destroy_local_blob(struct sde_cp_node *prop_node)
{
	if (!(prop_node->prop_flags & DRM_MODE_PROP_BLOB) &&
		prop_node->blob_ptr)
		drm_property_unreference_blob(prop_node->blob_ptr);
		drm_property_blob_put(prop_node->blob_ptr);
}

static int sde_cp_handle_range_property(struct sde_cp_node *prop_node,
@@ -302,12 +302,12 @@ static int sde_cp_enable_crtc_blob_property(struct drm_crtc *crtc,
	if (blob->length != prop_node->prop_blob_sz) {
		DRM_ERROR("invalid blob len %zd exp %d feature %d\n",
		    blob->length, prop_node->prop_blob_sz, prop_node->feature);
		drm_property_unreference_blob(blob);
		drm_property_blob_put(blob);
		return -EINVAL;
	}
	/* Release refernce to existing payload of the property */
	if (prop_node->blob_ptr)
		drm_property_unreference_blob(prop_node->blob_ptr);
		drm_property_blob_put(prop_node->blob_ptr);

	prop_node->blob_ptr = blob;
	return 0;
@@ -1131,7 +1131,7 @@ void sde_cp_crtc_destroy_properties(struct drm_crtc *crtc)
				 feature_list) {
		if (prop_node->prop_flags & DRM_MODE_PROP_BLOB
		    && prop_node->blob_ptr)
			drm_property_unreference_blob(prop_node->blob_ptr);
			drm_property_blob_put(prop_node->blob_ptr);

		list_del_init(&prop_node->active_list);
		list_del_init(&prop_node->dirty_list);
@@ -1141,7 +1141,7 @@ void sde_cp_crtc_destroy_properties(struct drm_crtc *crtc)
	}

	if (sde_crtc->hist_blob)
		drm_property_unreference_blob(sde_crtc->hist_blob);
		drm_property_blob_put(sde_crtc->hist_blob);

	mutex_destroy(&sde_crtc->crtc_cp_lock);
	INIT_LIST_HEAD(&sde_crtc->active_list);
+10 −10
Original line number Diff line number Diff line
@@ -614,13 +614,13 @@ static void sde_connector_destroy(struct drm_connector *connector)
		c_conn->ops.put_modes(connector, c_conn->display);

	if (c_conn->blob_caps)
		drm_property_unreference_blob(c_conn->blob_caps);
		drm_property_blob_put(c_conn->blob_caps);
	if (c_conn->blob_hdr)
		drm_property_unreference_blob(c_conn->blob_hdr);
		drm_property_blob_put(c_conn->blob_hdr);
	if (c_conn->blob_dither)
		drm_property_unreference_blob(c_conn->blob_dither);
		drm_property_blob_put(c_conn->blob_dither);
	if (c_conn->blob_mode_info)
		drm_property_unreference_blob(c_conn->blob_mode_info);
		drm_property_blob_put(c_conn->blob_mode_info);
	msm_property_destroy(&c_conn->property_info);

	if (c_conn->bl_device)
@@ -645,7 +645,7 @@ static void _sde_connector_destroy_fb(struct sde_connector *c_conn,
		return;
	}

	drm_framebuffer_unreference(c_state->out_fb);
	drm_framebuffer_put(c_state->out_fb);
	c_state->out_fb = NULL;

	if (c_conn)
@@ -756,7 +756,7 @@ sde_connector_atomic_duplicate_state(struct drm_connector *connector)

	/* additional handling for drm framebuffer objects */
	if (c_state->out_fb)
		drm_framebuffer_reference(c_state->out_fb);
		drm_framebuffer_get(c_state->out_fb);

	return &c_state->base;
}
@@ -1905,13 +1905,13 @@ struct drm_connector *sde_connector_init(struct drm_device *dev,

error_destroy_property:
	if (c_conn->blob_caps)
		drm_property_unreference_blob(c_conn->blob_caps);
		drm_property_blob_put(c_conn->blob_caps);
	if (c_conn->blob_hdr)
		drm_property_unreference_blob(c_conn->blob_hdr);
		drm_property_blob_put(c_conn->blob_hdr);
	if (c_conn->blob_dither)
		drm_property_unreference_blob(c_conn->blob_dither);
		drm_property_blob_put(c_conn->blob_dither);
	if (c_conn->blob_mode_info)
		drm_property_unreference_blob(c_conn->blob_mode_info);
		drm_property_blob_put(c_conn->blob_mode_info);

	msm_property_destroy(&c_conn->property_info);
error_cleanup_fence:
+1 −1
Original line number Diff line number Diff line
@@ -620,7 +620,7 @@ static void sde_crtc_destroy(struct drm_crtc *crtc)
		return;

	if (sde_crtc->blob_info)
		drm_property_unreference_blob(sde_crtc->blob_info);
		drm_property_blob_put(sde_crtc->blob_info);
	msm_property_destroy(&sde_crtc->property_info);
	sde_cp_crtc_destroy_properties(crtc);

Loading