Gerd Hoffmann
2019-Mar-11 13:07 UTC
[PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
Hi,> > > static void bochs_crtc_atomic_flush(struct drm_crtc *crtc, > > > struct drm_crtc_state *old_crtc_state) > > > { > > > @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = { > > > static const struct drm_crtc_helper_funcs bochs_helper_funcs = { > > > .mode_set_nofb = bochs_crtc_mode_set_nofb, > > > .atomic_enable = bochs_crtc_atomic_enable, > > > + .atomic_disable = bochs_crtc_atomic_disable, > > > > Shouldn't we make the callback optional instead of adding empty dummy > > functions to drivers? > > Hi Gerd, > > I agree, and I can work in this issue. > Just one question, should we make atomic_enable optional as well?IIRC the drm code checks for the atomic_enable callback presence to figure whenever it should take the atomic or legacy code paths. So, I think that will not work. cheers, Gerd
Daniel Vetter
2019-Mar-11 13:23 UTC
[PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
On Mon, Mar 11, 2019 at 02:07:16PM +0100, Gerd Hoffmann wrote:> Hi, > > > > > static void bochs_crtc_atomic_flush(struct drm_crtc *crtc, > > > > struct drm_crtc_state *old_crtc_state) > > > > { > > > > @@ -66,6 +71,7 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = { > > > > static const struct drm_crtc_helper_funcs bochs_helper_funcs = { > > > > .mode_set_nofb = bochs_crtc_mode_set_nofb, > > > > .atomic_enable = bochs_crtc_atomic_enable, > > > > + .atomic_disable = bochs_crtc_atomic_disable, > > > > > > Shouldn't we make the callback optional instead of adding empty dummy > > > functions to drivers? > > > > Hi Gerd, > > > > I agree, and I can work in this issue. > > Just one question, should we make atomic_enable optional as well? > > IIRC the drm code checks for the atomic_enable callback presence to > figure whenever it should take the atomic or legacy code paths.It should check for drm_driver->mode_config.funcs.atomic_commit for that, see drm_drv_uses_atomic_modeset(). Anything else should be a bug. Or do you mean the fallback to the old crtc helper prepare/commit callbacks? We'd need to make all of them optional ofc, with atomic_ variants being preferred ofc. -Daniel> > So, I think that will not work. > > cheers, > Gerd >-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Gerd Hoffmann
2019-Mar-11 13:39 UTC
[PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
Hi,> > IIRC the drm code checks for the atomic_enable callback presence to > > figure whenever it should take the atomic or legacy code paths. > > It should check for drm_driver->mode_config.funcs.atomic_commit for that, > see drm_drv_uses_atomic_modeset(). Anything else should be a bug. > > Or do you mean the fallback to the old crtc helper prepare/commit > callbacks?Probably the later. There was some reason why I've left in the empty bochs_crtc_atomic_enable() callback ... cheers, Gerd
Daniel Vetter
2019-Mar-11 18:48 UTC
[PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
On Mon, Mar 11, 2019 at 02:49:58PM -0300, Rodrigo Siqueira wrote:> On 03/11, Gerd Hoffmann wrote: > > Hi, > > > > > > IIRC the drm code checks for the atomic_enable callback presence to > > > > figure whenever it should take the atomic or legacy code paths. > > > > > > It should check for drm_driver->mode_config.funcs.atomic_commit for that, > > > see drm_drv_uses_atomic_modeset(). Anything else should be a bug. > > > > > > Or do you mean the fallback to the old crtc helper prepare/commit > > > callbacks? > > > > Probably the later. There was some reason why I've left in the empty > > bochs_crtc_atomic_enable() callback ... > > Just for checking before I start to work in this patch: > The correct solution should be made atomic_enable and atomic_disable > optional, right? I should do it, and check if Bochs driver really needs > bochs_crtc_atomic_enable after my change, right?Yup. I just tried to remember why we haven't done this yet, but I think that was a patch to make crtc->helper_funcs optional. And that doesn't make sense imo, since if your crtc doesn't do anything then you don't really have an atomic driver :-) And if there's ever a legit use case for this, then that drive probably shouldn't use the atomic helpers ... But making crtc_helper_funcs->atomic_enable/disable optional sounds like a good idea. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Maybe Matching Threads
- [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
- [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
- [PATCH] drm/bochs: Fix NULL dereference on atomic_disable helper
- [PATCH 09/14] drm/bochs: remove old bochs_crtc_* functions
- [PATCH] drm/bochs: use simple display pipe