From: Jesse Barnes Subject: Re: [PATCH 6/6] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v12 Date: Wed, 12 Feb 2014 15:11:48 -0800 Message-ID: <20140212151148.54e9a24b@jbarnes-desktop> References: <1392236789-2740-1-git-send-email-jbarnes@virtuousgeek.org> <1392236789-2740-6-git-send-email-jbarnes@virtuousgeek.org> <20140212230715.GG14909@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from qproxy1.mail.unifiedlayer.com (qproxy1-pub.mail.unifiedlayer.com [173.254.64.10]) by gabe.freedesktop.org (Postfix) with SMTP id 3998AFB095 for ; Wed, 12 Feb 2014 15:11:49 -0800 (PST) In-Reply-To: <20140212230715.GG14909@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Wed, 12 Feb 2014 23:07:15 +0000 Chris Wilson wrote: > 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. So if they happen to be the same size we'll prefer the one at 0? I guess we can tweak this all sorts of ways... but we'll generally probably only have a single buffer from the BIOS, so I'm not sure it'll make much difference in practice. > > + > > + 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? I think there are two cases: 1) pipe A re-uses plane A's fb - no changes needed, should match nicely 2) pipe B switches to plane A's fb - we'll end up doing a set_base and switching the stride bits and depth over to the plane A fb params, so it should work right? -- Jesse Barnes, Intel Open Source Technology Center