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

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



Short summary of fixes pull:

 * atomic-helper: Relax checks for unregistered connectors
 * dma-buf: Work around race condition when retrieving fence timestamp
 * gem: Avoid OOB access in BO memory range
 * panel:
   * boe-tv101wun-ml6: Fix flickering
 * simpledrm: Fix error output
 * vwmgfx:
   * Fix size calculation in texture-state code
   * Ref GEM BOs in surfaces

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

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20231012111638.GA25037@linux-uq9g
parents 94f6f055 c1165df2
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -76,16 +76,11 @@ struct dma_fence *__dma_fence_unwrap_merge(unsigned int num_fences,
		dma_fence_unwrap_for_each(tmp, &iter[i], fences[i]) {
			if (!dma_fence_is_signaled(tmp)) {
				++count;
			} else if (test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT,
					    &tmp->flags)) {
				if (ktime_after(tmp->timestamp, timestamp))
					timestamp = tmp->timestamp;
			} else {
				/*
				 * Use the current time if the fence is
				 * currently signaling.
				 */
				timestamp = ktime_get();
				ktime_t t = dma_fence_timestamp(tmp);

				if (ktime_after(t, timestamp))
					timestamp = t;
			}
		}
	}
+3 −6
Original line number Diff line number Diff line
@@ -268,12 +268,9 @@ static int sync_fill_fence_info(struct dma_fence *fence,
		sizeof(info->driver_name));

	info->status = dma_fence_get_status(fence);
	while (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
	       !test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags))
		cpu_relax();
	info->timestamp_ns =
		test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags) ?
		ktime_to_ns(fence->timestamp) :
		dma_fence_is_signaled(fence) ?
			ktime_to_ns(dma_fence_timestamp(fence)) :
			ktime_set(0, 0);

	return info->status;
+13 −4
Original line number Diff line number Diff line
@@ -290,7 +290,8 @@ static int
update_connector_routing(struct drm_atomic_state *state,
			 struct drm_connector *connector,
			 struct drm_connector_state *old_connector_state,
			 struct drm_connector_state *new_connector_state)
			 struct drm_connector_state *new_connector_state,
			 bool added_by_user)
{
	const struct drm_connector_helper_funcs *funcs;
	struct drm_encoder *new_encoder;
@@ -339,9 +340,13 @@ update_connector_routing(struct drm_atomic_state *state,
	 * there's a chance the connector may have been destroyed during the
	 * process, but it's better to ignore that then cause
	 * drm_atomic_helper_resume() to fail.
	 *
	 * Last, we want to ignore connector registration when the connector
	 * was not pulled in the atomic state by user-space (ie, was pulled
	 * in by the driver, e.g. when updating a DP-MST stream).
	 */
	if (!state->duplicated && drm_connector_is_unregistered(connector) &&
	    crtc_state->active) {
	    added_by_user && crtc_state->active) {
		drm_dbg_atomic(connector->dev,
			       "[CONNECTOR:%d:%s] is not registered\n",
			       connector->base.id, connector->name);
@@ -620,7 +625,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
	struct drm_connector *connector;
	struct drm_connector_state *old_connector_state, *new_connector_state;
	int i, ret;
	unsigned int connectors_mask = 0;
	unsigned int connectors_mask = 0, user_connectors_mask = 0;

	for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i)
		user_connectors_mask |= BIT(i);

	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
		bool has_connectors =
@@ -685,7 +693,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
		 */
		ret = update_connector_routing(state, connector,
					       old_connector_state,
					       new_connector_state);
					       new_connector_state,
					       BIT(i) & user_connectors_mask);
		if (ret)
			return ret;
		if (old_connector_state->crtc) {
+4 −2
Original line number Diff line number Diff line
@@ -540,7 +540,7 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)
	struct page **pages;
	struct folio *folio;
	struct folio_batch fbatch;
	int i, j, npages;
	long i, j, npages;

	if (WARN_ON(!obj->filp))
		return ERR_PTR(-EINVAL);
@@ -564,11 +564,13 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)

	i = 0;
	while (i < npages) {
		long nr;
		folio = shmem_read_folio_gfp(mapping, i,
				mapping_gfp_mask(mapping));
		if (IS_ERR(folio))
			goto fail;
		for (j = 0; j < folio_nr_pages(folio); j++, i++)
		nr = min(npages - i, folio_nr_pages(folio));
		for (j = 0; j < nr; j++, i++)
			pages[i] = folio_file_page(folio, i);

		/* Make sure shmem keeps __GFP_DMA32 allocated pages in the
+1 −3
Original line number Diff line number Diff line
@@ -1342,9 +1342,7 @@ static const struct panel_init_cmd starry_himax83102_j02_init_cmd[] = {
	_INIT_DCS_CMD(0xB1, 0x01, 0xBF, 0x11),
	_INIT_DCS_CMD(0xCB, 0x86),
	_INIT_DCS_CMD(0xD2, 0x3C, 0xFA),
	_INIT_DCS_CMD(0xE9, 0xC5),
	_INIT_DCS_CMD(0xD3, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0C, 0x01),
	_INIT_DCS_CMD(0xE9, 0x3F),
	_INIT_DCS_CMD(0xD3, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0C, 0x01),
	_INIT_DCS_CMD(0xE7, 0x02, 0x00, 0x28, 0x01, 0x7E, 0x0F, 0x7E, 0x10, 0xA0, 0x00, 0x00, 0x20, 0x40, 0x50, 0x40),
	_INIT_DCS_CMD(0xBD, 0x02),
	_INIT_DCS_CMD(0xD8, 0xFF, 0xFF, 0xBF, 0xFE, 0xAA, 0xA0, 0xFF, 0xFF, 0xBF, 0xFE, 0xAA, 0xA0),
Loading