[Intel-gfx] [PATCH 6/6] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v12

Chris Wilson chris at chris-wilson.co.uk
Thu Feb 13 00:07:15 CET 2014


On Wed, Feb 12, 2014 at 12:26:29PM -0800, Jesse Barnes wrote:
> +	/* Find the largest fb */
> +	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
> +		intel_crtc = to_intel_crtc(crtc);
> +
> +		if (!intel_crtc->active || !intel_crtc->plane_config.fb) {
> +			DRM_DEBUG_KMS("pipe %c not active or no fb, skipping\n",
> +				      pipe_name(intel_crtc->pipe));
> +			continue;
> +		}
> +
> +		if (intel_crtc->plane_config.size > max_size) {
> +			DRM_DEBUG_KMS("found possible fb from plane %c\n",
> +				      pipe_name(intel_crtc->pipe));
> +			plane_config = &intel_crtc->plane_config;
> +			fb = plane_config->fb;
> +			max_size = plane_config->size;
> +		}
> +	}

I had another idea... Can you select the fb with offset 0 first and see
if that fits every pipe? That way we reduce the potential fragmentation
from the permanently pinned in-aperture object.

> +
> +	if (!fb) {
> +		DRM_DEBUG_KMS("no active fbs found, not using BIOS config\n");
> +		goto out;
> +	}
> +
> +	/* Now make sure all the pipes will fit into it */
> +	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
> +		unsigned int cur_size;
> +
> +		intel_crtc = to_intel_crtc(crtc);
> +
> +		if (!intel_crtc->active) {
> +			DRM_DEBUG_KMS("pipe %c not active, skipping\n",
> +				      pipe_name(intel_crtc->pipe));
> +			continue;
> +		}
> +
> +		DRM_DEBUG_KMS("checking plane %c for BIOS fb\n",
> +			      pipe_name(intel_crtc->pipe));
> +
> +		/*
> +		 * See if the plane fb we found above will fit on this
> +		 * pipe.  Note we need to use the selected fb's bpp rather
> +		 * than the current pipe's, since they could be different.
> +		 */
> +		cur_size = intel_crtc->config.adjusted_mode.crtc_hdisplay *
> +			intel_crtc->config.adjusted_mode.crtc_vdisplay;
> +		DRM_DEBUG_KMS("pipe %c area: %d\n", pipe_name(intel_crtc->pipe),
> +			      cur_size);
> +		cur_size *= fb->base.bits_per_pixel / 8;
> +		DRM_DEBUG_KMS("total size %d (bpp %d)\n", cur_size,
> +			      fb->base.bits_per_pixel / 8);

But the display hardware will be using the stride from the fb, so the
end of the last row will still be vdisplay*fb->stride, right? Unless the
fb pitch itself is recomputed to match?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list