From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 5/8] drm/i915: Add the display switch logic for vgpu in i915 driver Date: Fri, 19 Sep 2014 18:09:37 +0200 Message-ID: <20140919160937.GP15734@phenom.ffwll.local> References: <1411152428-7226-1-git-send-email-jike.song@intel.com> <1411152428-7226-6-git-send-email-jike.song@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-we0-f175.google.com (mail-we0-f175.google.com [74.125.82.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B8706E6AD for ; Fri, 19 Sep 2014 09:09:10 -0700 (PDT) Received: by mail-we0-f175.google.com with SMTP id x48so4095wes.6 for ; Fri, 19 Sep 2014 09:09:10 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1411152428-7226-6-git-send-email-jike.song@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Jike Song Cc: daniel.vetter@intel.com, intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Sat, Sep 20, 2014 at 02:47:05AM +0800, Jike Song wrote: > From: Yu Zhang > > Display switch logic is added to notify the vgt mediator that > current vgpu have a valid surface to show. It does so by writing > the display_ready field in PV INFO page, and then will be handled > in vgt mediator. This is useful to avoid trickiness when the VM's > framebuffer is being accessed in the middle of VM modesetting, > e.g. compositing the framebuffer in the host side > > Signed-off-by: Yu Zhang > Signed-off-by: Jike Song > Signed-off-by: Zhiyuan Lv > --- > drivers/gpu/drm/i915/i915_dma.c | 8 ++++++++ > drivers/gpu/drm/i915/i915_reg.h | 7 +++++++ > drivers/gpu/drm/i915/intel_display.c | 10 ++++++++++ > 3 files changed, 25 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c > index bb4ad52..d9462e1 100644 > --- a/drivers/gpu/drm/i915/i915_dma.c > +++ b/drivers/gpu/drm/i915/i915_dma.c > @@ -1790,6 +1790,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) > } else { > /* Start out suspended in ums mode. */ > dev_priv->ums.mm_suspended = 1; > + if (intel_vgpu_active(dev)) { > + /* > + * Notify a valid surface after modesetting, > + * when running inside a VM. > + */ > + I915_WRITE(vgt_info_off(display_ready), > + VGT_DRV_DISPLAY_READY); > + } > } > > i915_setup_sysfs(dev); > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > index a70f12e..38d606c 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -6673,5 +6673,12 @@ enum punit_power_well { > #define vgt_info_off(x) \ > (VGT_PVINFO_PAGE + (long)&((struct vgt_if *) NULL)->x) > > +/* > + * The information set by the guest gfx driver, through the display_ready field > + */ > +enum vgt_display_status { > + VGT_DRV_DISPLAY_NOT_READY = 0, > + VGT_DRV_DISPLAY_READY, /* ready for display switch */ > +}; > > #endif /* _I915_REG_H_ */ > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index b78f00a..3af9259 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -11642,6 +11642,16 @@ static int intel_crtc_set_config(struct drm_mode_set *set) > intel_modeset_check_state(set->crtc->dev); > } > > + if (intel_vgpu_active(dev)) { > + /* > + * Notify a valid surface after modesetting, > + * when running inside a VM. > + */ > + struct drm_i915_private *dev_priv = dev->dev_private; > + > + I915_WRITE(vgt_info_off(display_ready), VGT_DRV_DISPLAY_READY); > + } Since very shortly we now have the frontbuffer tracking support code. Should we move it there? See intel_frontbuffer_flush&flip. -Daniel > + > if (ret) { > DRM_DEBUG_KMS("failed to set mode on [CRTC:%d], err = %d\n", > set->crtc->base.id, ret); > -- > 1.9.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch