On Fri, 2009-06-26 at 09:24 +1000, Dave Airlie wrote:
> From: Dave Airlie <[email protected]>
> 
> Userspace sends us a special relocation type to sync video/exa
> to vlines to avoid tearing, this deals with the relocation
> in the kernel, it picks the correct crtc and avoids issues
> where crtcs are disabled.
> 
> Signed-off-by: Dave Airlie <[email protected]>
> ---
>  drivers/gpu/drm/radeon/r100.c     |   89 
> +++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/radeon/r300.c     |   13 +++++-
>  drivers/gpu/drm/radeon/r500_reg.h |    2 +
>  drivers/gpu/drm/radeon/rv515.c    |   23 +++++++--
>  4 files changed, 121 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index c550932..bbc4cb5 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -753,6 +753,86 @@ int r100_cs_packet_parse(struct radeon_cs_parser *p,
>  }
>  
>  /**
> + * r100_cs_packet_next_vline() - parse userspace VLINE packet
> + * @parser:          parser structure holding parsing context.
> + *
> + * Userspace sends a special sequence for VLINE waits.
> + * PACKET0 - VLINE_START_END + value
> + * PACKET0 - WAIT_UNTIL +_value
> + * RELOC (P3) - crtc_id in reloc.
> + *
> + * This function parses this and relocates the VLINE START END
> + * and WAIT UNTIL packets to the correct crtc.
> + * It also detects a switched off crtc and nulls out the
> + * wait in that case.
> + */
> +int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)
> +{
> +     struct radeon_cs_chunk *ib_chunk;
> +     struct drm_mode_object *obj;
> +     struct ttm_crtc *crtc;
> +     struct radeon_crtc *radeon_crtc;
> +     struct radeon_cs_packet p3reloc, waitreloc;
> +     int crtc_id;
> +     int r;
> +     uint32_t header, h_idx, reg;
> +
> +     /* jump over the wait until */
> +     r = r100_cs_packet_parse(p, &waitreloc, p->idx);
> +     if (r)
> +             return r;
> +
> +     /* jump over the NOP */
> +     r = r100_cs_packet_parse(p, &p3reloc, p->idx);
> +     if (r)
> +             return r;
> +     h_idx = p->idx - 2;
> +     p->idx += waitreloc.count;
> +     p->idx += p3reloc.count;

Don't trust userspace for waitreloc, check that this is actualy
a packet0 with one reg write to waituntil, we might also want
to check which waituntil flag are set. Need to look again at
this beloved reg.


Cheers,
Jerome


------------------------------------------------------------------------------
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to