On Tue, Jul 31, 2018 at 4:48 AM, Michel Dänzer <michel at daenzer.net> wrote: > On 2018-07-30 08:12 PM, Alex Deucher wrote: >> On Fri, Jul 27, 2018 at 12:04 PM, Michel Dänzer <michel at daenzer.net> wrote: >>> From: Michel Dänzer <michel.daenzer at amd.com> >>> >>> We were only storing the FB provided by the client, but on CRTCs with >>> TearFree enabled, we use a separate FB. This could cause >>> drmmode_flip_handler to fail to clear drmmode_crtc->flip_pending, which >>> could result in a hang when waiting for the pending flip to complete. We >>> were trying to avoid that by always clearing drmmode_crtc->flip_pending >>> when TearFree is enabled, but that wasn't reliable, because >>> drmmode_crtc->tear_free can already be FALSE at this point when >>> disabling TearFree. >>> >>> Now that we're keeping track of each CRTC's flip FB separately, >>> drmmode_flip_handler can reliably clear flip_pending, and we no longer >>> need the TearFree hack. >>> >>> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> >>> >>> [...] >>> >>> @@ -82,6 +81,7 @@ typedef struct { >>> xf86CrtcPtr fe_crtc; >>> amdgpu_drm_handler_proc handler; >>> amdgpu_drm_abort_proc abort; >>> + struct drmmode_fb *fb[0]; >> >> Don't some compilers have problems with zero sized arrays? > > Are you thinking of > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5b7d245009e734588e553092f5c0b0bd788b3a55 > ? Per https://bugs.freedesktop.org/show_bug.cgi?id=66932#c24 , the > problem there was variable sized arrays being declared as [1], which > obviously can't work. > > Declaring a [0] array at the end of a struct is a GCC extension, see > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html#Zero-Length . clang > seems to handle this fine as well. > > An alternative would be using the C99 syntax "[];" instead, but I think > the above is fine in this case. Yup, that was the issue I was thinking of. No other concerns. Alex > > >> Other than that looks good to me: >> Reviewed-by: Alex Deucher <alexander.deucher at amd.com> > > Thanks! > > > -- > Earthling Michel Dänzer | http://www.amd.com > Libre software enthusiast | Mesa and X developer