_drminfo_complete()
{
    local cur prev words
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case "$prev" in
    --card)
        words=$(drminfo --complete-card)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --lease)
        COMPREPLY=()
        ;;
    *)
        COMPREPLY=( $(compgen -W "--help --all --misc --caps --outputs --planes --formats --test-formats --properties --list-formats --card --lease" -- "$cur") )
        ;;
    esac
    return 0
}
complete -F _drminfo_complete drminfo

_drmtest_complete()
{
    local cur prev words
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case "$prev" in
    --image)
        COMPREPLY=( $(compgen -f -X '!*.@(jpg|jpeg|png)' -- "$cur") )
        ;;
    --card)
        words=$(drminfo --complete-card)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --output)
        words=$(drminfo --complete-output)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --format)
        words=$(drminfo --test-formats)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --sleep | --update | --mode | --lease)
        COMPREPLY=()
        ;;
    *)
        COMPREPLY=( $(compgen -W "--help --pixman --autotest --dmabuf --vgem --unbind --cursor --card --output --sleep --update --image --format --mode --lease" -- "$cur") )
        ;;
    esac
    return 0
}
complete -F _drmtest_complete drmtest

_egltest_complete()
{
    local cur prev words
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case "$prev" in
    --card)
        words=$(drminfo --complete-card)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --sleep | --lease)
        COMPREPLY=()
        ;;
    *)
        COMPREPLY=( $(compgen -W "--help --autotest --info --exts --card --sleep --lease" -- "$cur") )
        ;;
    esac
    return 0
}
complete -F _egltest_complete egltest

_fbinfo_complete()
{
    local cur prev words
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case "$prev" in
    --fbdev)
        words=$(fbinfo --complete-fbdev)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --dummy)
        COMPREPLY=()
        ;;
    *)
        COMPREPLY=( $(compgen -W "--help --fbdev" -- "$cur") )
        ;;
    esac
    return 0
}
complete -F _fbinfo_complete fbinfo

_fbtest_complete()
{
    local cur prev words
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case "$prev" in
    --image)
        COMPREPLY=( $(compgen -f -X '!*.@(jpg|jpeg|png)' -- "$cur") )
        ;;
    --fbdev)
        words=$(fbinfo --complete-fbdev)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --sleep)
        COMPREPLY=()
        ;;
    *)
        COMPREPLY=( $(compgen -W "--help --autotest --fbdev --sleep --image" -- "$cur") )
        ;;
    esac
    return 0
}
complete -F _fbtest_complete fbtest

_prime_complete()
{
    local cur prev words
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case "$prev" in
    --dummy)
        COMPREPLY=()
        ;;
    *)
        COMPREPLY=( $(compgen -W "--help --list-cards" -- "$cur") )
        ;;
    esac
    return 0
}
complete -F _prime_complete prime

_virtiotest_complete()
{
    local cur prev words
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    case "$prev" in
    --card)
        words=$(drminfo --complete-card)
        COMPREPLY=( $(compgen -W "$words" -- "$cur") )
        ;;
    --sleep)
        COMPREPLY=()
        ;;
    *)
        COMPREPLY=( $(compgen -W "--help --autotest --info --list-formats --card --sleep" -- "$cur") )
        ;;
    esac
    return 0
}
complete -F _virtiotest_complete virtiotest

