[Intel-gfx] [PATCH 3/8] drm/i915: Unclutter the get_plane() functions

Damien Lespiau damien.lespiau at intel.com
Thu Oct 30 18:41:05 CET 2014


On Thu, Oct 30, 2014 at 05:31:57PM +0000, Tvrtko Ursulin wrote:
> 
> On 10/29/2014 05:22 PM, Damien Lespiau wrote:
> >crtc->base.primary->fb was used everywhere. Use fb to temporarily point
> >there and don't forget to assign fb to its final destination at the end.
> >
> >v2: Rebase on top of misc changes (mask of DSPSURF, PAGE_ALIGN)
> >
> >Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
> >---
> >  drivers/gpu/drm/i915/intel_display.c | 61 ++++++++++++++++--------------------
> >  1 file changed, 27 insertions(+), 34 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> >index 2a84e47..6c042eb 100644
> >--- a/drivers/gpu/drm/i915/intel_display.c
> >+++ b/drivers/gpu/drm/i915/intel_display.c
> >@@ -6459,9 +6459,10 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc,
> >  	int pipe = crtc->pipe, plane = crtc->plane;
> >  	int fourcc, pixel_format;
> >  	int aligned_height;
> >+	struct drm_framebuffer *fb;
> >
> >-	crtc->base.primary->fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
> >-	if (!crtc->base.primary->fb) {
> >+	fb = kzalloc(sizeof(struct intel_framebuffer), GFP_KERNEL);
> >+	if (!fb) {
> >  		DRM_DEBUG_KMS("failed to alloc fb\n");
> >  		return;
> 
> Is it of any consequence that after the change
> crtc->base.primary->fb will preserve it's content, while previously
> it would be NULLed on allocation failure? Probably not, just
> asking...

The get_plane_config() vfunc is only from intel_modeset_init() (to try
and inherit the BIOS fb) and so at the point, the crtc structure has
just been initialized and the initial get_pipe_config() doesn't touch
this fb field. crtc->base.primary->fb has not other choice than being
NULL at this point then I believe. So shouldn't matter.

-- 
Damien



More information about the Intel-gfx mailing list