Hey Eric, I didn't see this one go into the drm-intel-next tree. I forgot to pass -n to format-patch so it's easier to overlook it, I guess, but we also need to pin the cursor bo when we set the cursor as we do for the fb bo when setting the mode. Like the pin-fb-bo patch, this one is a semantic change that we should get into the tree before we merge it for 2.6.29.
cheers, Kristian On Thu, Dec 18, 2008 at 4:14 AM, Kristian Høgsberg <k...@redhat.com> wrote: > We also didn't track the cursor bo before and would leak a reference > when the cursor image was change. > > Signed-off-by: Kristian Høgsberg <k...@redhat.com> > --- > drivers/gpu/drm/i915/intel_display.c | 29 +++++++++++++++++++++-------- > drivers/gpu/drm/i915/intel_drv.h | 1 + > 2 files changed, 22 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c > b/drivers/gpu/drm/i915/intel_display.c > index 8e5a242..ec92551 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -986,19 +986,17 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, > uint32_t base = (pipe == 0) ? CURABASE : CURBBASE; > uint32_t temp; > size_t addr; > + int ret; > > DRM_DEBUG("\n"); > > /* if we want to turn off the cursor ignore width and height */ > if (!handle) { > DRM_DEBUG("cursor off\n"); > - /* turn of the cursor */ > - temp = 0; > - temp |= CURSOR_MODE_DISABLE; > - > - I915_WRITE(control, temp); > - I915_WRITE(base, 0); > - return 0; > + temp = CURSOR_MODE_DISABLE; > + addr = 0; > + bo = NULL; > + goto finish; > } > > /* Currently we only support 64x64 cursors */ > @@ -1025,15 +1023,30 @@ static int intel_crtc_cursor_set(struct drm_crtc > *crtc, > addr = obj_priv->gtt_offset; > } > > - intel_crtc->cursor_addr = addr; > + ret = i915_gem_object_pin(bo, PAGE_SIZE); > + if (ret) { > + DRM_ERROR("failed to pin cursor bo\n"); > + drm_gem_object_unreference(bo); > + return ret; > + } > + > temp = 0; > /* set the pipe for the cursor */ > temp |= (pipe << 28); > temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; > > + finish: > I915_WRITE(control, temp); > I915_WRITE(base, addr); > > + if (intel_crtc->cursor_bo) { > + i915_gem_object_unpin(intel_crtc->cursor_bo); > + drm_gem_object_unreference(intel_crtc->cursor_bo); > + } > + > + intel_crtc->cursor_addr = addr; > + intel_crtc->cursor_bo = bo; > + > return 0; > } > > diff --git a/drivers/gpu/drm/i915/intel_drv.h > b/drivers/gpu/drm/i915/intel_drv.h > index 407edd5..94981ee 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -88,6 +88,7 @@ struct intel_crtc { > struct drm_crtc base; > int pipe; > int plane; > + struct drm_gem_object *cursor_bo; > uint32_t cursor_addr; > u8 lut_r[256], lut_g[256], lut_b[256]; > int dpms_mode; > -- > 1.6.0.5 > > ------------------------------------------------------------------------------ > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > The future of the web can't happen without you. Join us at MIX09 to help > pave the way to the Next Web now. Learn more and register at > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > -- > _______________________________________________ > Dri-devel mailing list > Dri-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dri-devel > ------------------------------------------------------------------------------ -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel