From: Oleksandr Andrushchenko Subject: Re: [PATCH 03/14] drm/bochs: atomic: add atomic_flush+atomic_enable callbacks. Date: Wed, 19 Dec 2018 17:30:20 +0200 Message-ID: References: <20181219115127.31359-1-kraxel@redhat.com> <20181219115127.31359-4-kraxel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20181219115127.31359-4-kraxel@redhat.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Gerd Hoffmann , dri-devel@lists.freedesktop.org, David Airlie Cc: David Airlie , open list , "open list:DRM DRIVER FOR BOCHS VIRTUAL GPU" List-Id: dri-devel@lists.freedesktop.org Hi, Gerd! On 12/19/18 1:51 PM, Gerd Hoffmann wrote: > Conversion to atomic modesetting, step one. > Add atomic crtc helper callbacks. > > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/bochs/bochs_kms.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c > index f7e6d1a9b3..59d469f343 100644 > --- a/drivers/gpu/drm/bochs/bochs_kms.c > +++ b/drivers/gpu/drm/bochs/bochs_kms.c > @@ -115,6 +115,29 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc, > return 0; > } > > +static void bochs_crtc_atomic_enable(struct drm_crtc *crtc, > + struct drm_crtc_state *old_crtc_state) > +{ > +} > + > +static void bochs_crtc_atomic_flush(struct drm_crtc *crtc, > + struct drm_crtc_state *old_crtc_state) > +{ > + struct drm_device *dev = crtc->dev; > + struct drm_pending_vblank_event *event; > + unsigned long irqflags; You could probably move these under the actual if where these are needed, but it's up to you > + > + if (crtc->state && crtc->state->event) { > + event = crtc->state->event; > + crtc->state->event = NULL; Not quite sure if touching the event above is allowed w/o holding the event lock > + > + spin_lock_irqsave(&dev->event_lock, irqflags); > + drm_crtc_send_vblank_event(crtc, event); > + spin_unlock_irqrestore(&dev->event_lock, irqflags); > + } > +} > + > + > /* These provide the minimum set of functions required to handle a CRTC */ > static const struct drm_crtc_funcs bochs_crtc_funcs = { > .set_config = drm_crtc_helper_set_config, > @@ -128,6 +151,8 @@ static const struct drm_crtc_helper_funcs bochs_helper_funcs = { > .mode_set_base = bochs_crtc_mode_set_base, > .prepare = bochs_crtc_prepare, > .commit = bochs_crtc_commit, > + .atomic_enable = bochs_crtc_atomic_enable, > + .atomic_flush = bochs_crtc_atomic_flush, > }; > > static const uint32_t bochs_formats[] = {