Commit ce22e89e authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-fixes-2023-08-24' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes



A samsung-dsim initialization fix, a devfreq fix for panfrost, a DP DSC
define fix, a recursive lock fix for dma-buf, a shader validation fix
and a reference counting fix for vmwgfx

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maxime Ripard <mripard@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/amy26vu5xbeeikswpx7nt6rddwfocdidshrtt2qovipihx5poj@y45p3dtzrloc
parents 706a7415 f9e96bf1
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -191,6 +191,7 @@ static const struct dma_fence_ops timeline_fence_ops = {
 */
static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
{
	LIST_HEAD(signalled);
	struct sync_pt *pt, *next;

	trace_sync_timeline(obj);
@@ -203,21 +204,20 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc)
		if (!timeline_fence_signaled(&pt->base))
			break;

		list_del_init(&pt->link);
		dma_fence_get(&pt->base);

		list_move_tail(&pt->link, &signalled);
		rb_erase(&pt->node, &obj->pt_tree);

		/*
		 * A signal callback may release the last reference to this
		 * fence, causing it to be freed. That operation has to be
		 * last to avoid a use after free inside this loop, and must
		 * be after we remove the fence from the timeline in order to
		 * prevent deadlocking on timeline->lock inside
		 * timeline_fence_release().
		 */
		dma_fence_signal_locked(&pt->base);
	}

	spin_unlock_irq(&obj->lock);

	list_for_each_entry_safe(pt, next, &signalled, link) {
		list_del_init(&pt->link);
		dma_fence_put(&pt->base);
	}
}

/**
+17 −10
Original line number Diff line number Diff line
@@ -1386,6 +1386,18 @@ static void samsung_dsim_disable_irq(struct samsung_dsim *dsi)
	disable_irq(dsi->irq);
}

static void samsung_dsim_set_stop_state(struct samsung_dsim *dsi, bool enable)
{
	u32 reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG);

	if (enable)
		reg |= DSIM_FORCE_STOP_STATE;
	else
		reg &= ~DSIM_FORCE_STOP_STATE;

	samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg);
}

static int samsung_dsim_init(struct samsung_dsim *dsi)
{
	const struct samsung_dsim_driver_data *driver_data = dsi->driver_data;
@@ -1445,15 +1457,12 @@ static void samsung_dsim_atomic_enable(struct drm_bridge *bridge,
				       struct drm_bridge_state *old_bridge_state)
{
	struct samsung_dsim *dsi = bridge_to_dsi(bridge);
	u32 reg;

	if (samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type)) {
		samsung_dsim_set_display_mode(dsi);
		samsung_dsim_set_display_enable(dsi, true);
	} else {
		reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG);
		reg &= ~DSIM_FORCE_STOP_STATE;
		samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg);
		samsung_dsim_set_stop_state(dsi, false);
	}

	dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE;
@@ -1463,16 +1472,12 @@ static void samsung_dsim_atomic_disable(struct drm_bridge *bridge,
					struct drm_bridge_state *old_bridge_state)
{
	struct samsung_dsim *dsi = bridge_to_dsi(bridge);
	u32 reg;

	if (!(dsi->state & DSIM_STATE_ENABLED))
		return;

	if (!samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type)) {
		reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG);
		reg |= DSIM_FORCE_STOP_STATE;
		samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg);
	}
	if (!samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type))
		samsung_dsim_set_stop_state(dsi, true);

	dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE;
}
@@ -1775,6 +1780,8 @@ static ssize_t samsung_dsim_host_transfer(struct mipi_dsi_host *host,
	if (ret)
		return ret;

	samsung_dsim_set_stop_state(dsi, false);

	ret = mipi_dsi_create_packet(&xfer.packet, msg);
	if (ret < 0)
		return ret;
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ static int panfrost_read_speedbin(struct device *dev)
		 * keep going without it; any other error means that we are
		 * supposed to read the bin value, but we failed doing so.
		 */
		if (ret != -ENOENT) {
		if (ret != -ENOENT && ret != -EOPNOTSUPP) {
			DRM_DEV_ERROR(dev, "Cannot read speed-bin (%d).", ret);
			return ret;
		}
+2 −4
Original line number Diff line number Diff line
@@ -497,10 +497,9 @@ static int vmw_user_bo_synccpu_release(struct drm_file *filp,
		if (!(flags & drm_vmw_synccpu_allow_cs)) {
			atomic_dec(&vmw_bo->cpu_writers);
		}
		ttm_bo_put(&vmw_bo->tbo);
		vmw_user_bo_unref(vmw_bo);
	}

	drm_gem_object_put(&vmw_bo->tbo.base);
	return ret;
}

@@ -540,8 +539,7 @@ int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data,
			return ret;

		ret = vmw_user_bo_synccpu_grab(vbo, arg->flags);
		vmw_bo_unreference(&vbo);
		drm_gem_object_put(&vbo->tbo.base);
		vmw_user_bo_unref(vbo);
		if (unlikely(ret != 0)) {
			if (ret == -ERESTARTSYS || ret == -EBUSY)
				return -EBUSY;
+8 −0
Original line number Diff line number Diff line
@@ -195,6 +195,14 @@ static inline struct vmw_bo *vmw_bo_reference(struct vmw_bo *buf)
	return buf;
}

static inline void vmw_user_bo_unref(struct vmw_bo *vbo)
{
	if (vbo) {
		ttm_bo_put(&vbo->tbo);
		drm_gem_object_put(&vbo->tbo.base);
	}
}

static inline struct vmw_bo *to_vmw_bo(struct drm_gem_object *gobj)
{
	return container_of((gobj), struct vmw_bo, tbo.base);
Loading