[PATCH 07/14] DRI2: Use helper functions for DRM event queue management

Michel Dänzer michel at daenzer.net
Mon Mar 16 18:08:07 PDT 2015


On 17.03.2015 00:38, Richard Wilbur wrote:
> On Thu, Mar 12, 2015 at 12:10 AM, Michel Dänzer <michel at daenzer.net> wrote:
> [...]
>> diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
>> index a3f0776..97164b6 100644
>> --- a/src/radeon_dri2.c
>> +++ b/src/radeon_dri2.c
> [...]
>> @@ -613,36 +553,41 @@ xf86CrtcPtr radeon_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
>>         return NULL;
>>  }
>>
>> -void radeon_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
>> -                                   unsigned int tv_usec, void *event_data)
>> +static void
>> +radeon_dri2_flip_event_abort(ScrnInfoPtr scrn, void *event_data)
>> +{
>> +    free(event_data);
>> +}
>> +
>> +static void
>> +radeon_dri2_flip_event_handler(ScrnInfoPtr scrn, uint32_t frame, uint64_t usec,
>> +                              void *event_data)
>>  {
>>      DRI2FrameEventPtr flip = event_data;
>> +    unsigned tv_sec, tv_usec;
>>      DrawablePtr drawable;
>>      ScreenPtr screen;
>> -    ScrnInfoPtr scrn;
>>      int status;
>>      PixmapPtr pixmap;
>>
>>      status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient,
>>                                M_ANY, DixWriteAccess);
>> -    if (status != Success) {
>> -       free(flip);
>> -       return;
>> -    }
>> -    if (!flip->crtc) {
>> -       free(flip);
>> -       return;
>> -    }
>> -    frame += radeon_get_interpolated_vblanks(flip->crtc);
>> +    if (status != Success)
>> +       goto abort;
>>
>> -    screen = drawable->pScreen;
>> -    scrn = xf86ScreenToScrn(screen);
>> +    if (!flip->crtc)
>> +       goto abort;
>> +    frame += radeon_get_interpolated_vblanks(flip->crtc);
>>
>> +    screen = scrn->pScreen;
>>      pixmap = screen->GetScreenPixmap(screen);
>>      xf86DrvMsgVerb(scrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
>>                    "%s:%d fevent[%p] width %d pitch %d (/4 %d)\n",
>>                    __func__, __LINE__, flip, pixmap->drawable.width, pixmap->devKind, pixmap->devKind/4);
>>
>> +    tv_sec = usec / 10000000;
>> +    tv_usec = usec % 10000000;
> 
> Looks like an extra '0' crept into these calculations.  Here we are
> dividing by 10^7 while everywhere else in this patch we use 10^6.

Indeed, thanks for the catch! Fixed in v3.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-driver-ati mailing list