[PATCH 2/5] drm: use page-flip for sprites, in case no vblank event

Rob Clark rob.clark at linaro.org
Mon Mar 12 08:04:17 PDT 2012


On Mon, Mar 12, 2012 at 4:11 AM, David Herrmann
<dh.herrmann at googlemail.com> wrote:
> Hi Rob
>
> On Mon, Mar 12, 2012 at 1:48 AM, Rob Clark <rob.clark at linaro.org> wrote:
>> From: Rob Clark <rob at ti.com>
>>
>> If the output does not support vblank events (possibly the case with
>> USB or DSI command mode displays which do not have a traditional
>> vsync), use instead the page_flip handler to know when the display
>> is finished scanning out a sprite.
>> ---
>>  src/compositor-drm.c |   17 +++++++++++++++--
>>  1 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
>> index 67fa500..500ec15 100644
>> --- a/src/compositor-drm.c
>> +++ b/src/compositor-drm.c
>> @@ -117,6 +117,12 @@ struct drm_sprite {
>>        uint32_t dest_x, dest_y;
>>        uint32_t dest_w, dest_h;
>>
>> +       /*
>> +        * for displays that don't have a vblank (dsi command-mode displays,
>> +        * usb displays, etc), it can be simulated from the page-flip event
>> +        */
>> +       int simulate_vblank;
>> +
>>        uint32_t formats[];
>>  };
>>
>> @@ -286,8 +292,7 @@ drm_output_repaint(struct weston_output *output_base,
>>                vbl.request.signal = (unsigned long)s;
>>                ret = drmWaitVBlank(compositor->drm.fd, &vbl);
>>                if (ret) {
>> -                       fprintf(stderr, "vblank event request failed: %d: %s\n",
>> -                               ret, strerror(errno));
>> +                       s->simulate_vblank = 1;
>>                }
>
> Doesn't it make sense to add an:
> if (!s->simulate_vblank)
> around this drmWaitVBlank call? Otherwise we try it at every repaint
> and it will fail everytime.

yeah, probably.. I guess I need to just make sure we set
s->simulate_vblank back to false if the connector changes..

BR,
-R


> Regards
> David
>
>>        }
>>
>> @@ -327,6 +332,7 @@ page_flip_handler(int fd, unsigned int frame,
>>        struct drm_output *output = (struct drm_output *) data;
>>        struct drm_compositor *c =
>>                (struct drm_compositor *) output->base.compositor;
>> +       struct drm_sprite *s;
>>        uint32_t msecs;
>>
>>        if (output->scanout_buffer) {
>> @@ -349,6 +355,13 @@ page_flip_handler(int fd, unsigned int frame,
>>
>>        msecs = sec * 1000 + usec / 1000;
>>        weston_output_finish_frame(&output->base, msecs);
>> +
>> +       wl_list_for_each(s, &c->sprite_list, link) {
>> +               if (s->simulate_vblank) {
>> +                       vblank_handler(fd, frame, sec, usec, s);
>> +                       s->simulate_vblank = 0;
>> +               }
>> +       }
>>  }
>>
>>  static int
>> --
>> 1.7.5.4
>>
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list