[PATCH] drm/cirrus: rewrite and modernize driver.

Gerd Hoffmann kraxel at redhat.com
Wed Apr 3 08:53:41 UTC 2019


> > +struct cirrus_device {
> > +       struct drm_device              *dev;
> 
> Why not embed drm_device? It's the latest rage :-)

Sure, can do that.

> > +void cirrus_pipe_update(struct drm_simple_display_pipe *pipe,
> > +                       struct drm_plane_state *old_state)
> > +{
> > +       struct drm_plane_state *state = pipe->plane.state;
> > +       struct drm_crtc *crtc = &pipe->crtc;
> > +       struct drm_rect rect;
> > +
> > +       if (drm_atomic_helper_damage_merged(old_state, state, &rect))
> > +               cirrus_fb_blit_rect(pipe->plane.state->fb, &rect);
> > +
> > +       if (crtc->state->event) {
> > +               spin_lock_irq(&crtc->dev->event_lock);
> > +               drm_crtc_send_vblank_event(crtc, crtc->state->event);
> > +               spin_unlock_irq(&crtc->dev->event_lock);
> > +               crtc->state->event = NULL;
> > +       }
> > +}

> > +static int cirrus_fb_dirty(struct drm_framebuffer *fb,
> > +                          struct drm_file *file_priv,
> > +                          unsigned int flags, unsigned int color,
> > +                          struct drm_clip_rect *clips,
> > +                          unsigned int num_clips)
> > +{
> > +       struct cirrus_device *cirrus = fb->dev->dev_private;
> > +
> > +       if (cirrus->pipe.plane.state->fb != fb)
> > +               return 0;
> > +
> > +       if (num_clips)
> > +               cirrus_fb_blit_clips(fb, clips, num_clips);
> > +       else
> > +               cirrus_fb_blit_fullscreen(fb);
> > +       return 0;
> > +}
> 
> Why not use the dirty helpers and implement dirty rect support in your
> main plane update function?

Dirty rect support is already there, see above.

So I can just remove cirrus_fb_dirty() and hook up
drm_atomic_helper_dirtyfb() instead.  Easy ;)

cheers,
  Gerd



More information about the dri-devel mailing list