summaryrefslogtreecommitdiff
path: root/linux-core/xgi_drv.c
AgeCommit message (Expand)Author
2007-07-09Merge xgi_mem_req and xgi_mem_alloc into a single type.Ian Romanick
2007-07-05Remove XGI_IOCTL_CPUID and associated cruft.Ian Romanick
2007-06-29Eliminate structure typedefsIan Romanick
2007-06-29Fix return type of xgi_find_pcie_block.Ian Romanick
2007-06-26Clean up warnings about unused variables and functions.Ian Romanick
2007-06-26dos2unix and LindentIan Romanick
2007-06-26Initial XP10 code drop from XGI.Ian Romanick
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
#!/bin/sh

#
# Test all combinations of horizontal flip, vertical flip and rotation on WPF.0
# with image partitioning by inserting a UDS in the pipeline.
#

. ./vsp-lib.sh

features="rpf.0 uds wpf.0 wpf.0[control:'Vertical+Flip']"
optional_features="wpf.0[control:'Horizontal+Flip'] wpf.0[control:'Rotate']"

directions="horizontal vertical rotate"
dir_horizontal_control="Horizontal+Flip"
dir_horizontal_label="hflip"
dir_horizontal_values="0 1"
dir_vertical_control="Vertical+Flip"
dir_vertical_label="vflip"
dir_vertical_values="0 1"
dir_rotate_control="Rotate"
dir_rotate_label="rotate"
dir_rotate_values="0 90"

format="RGB24"

get_var() {
	echo $(eval echo \$dir_$1_$2)
}

set_var() {
	eval dir_$1_$2=$3
}

get_array_value() {
	local index=$2

	echo $1 | cut -d ' ' -f $((index+1))
}

get_array_length() {
	echo $#
}

dir_next_value() {
	# Get the direction name corresponding to the index
	local direction=$(get_array_value "$supported_directions" $1)

	# Get the current value index and increase it
	local value=$(get_var $direction index)
	value=$((value+1))

	# If the index exceeds the possible values array length, reset it to 0.
	if [ $value -ge $(get_array_length $(get_var $direction values)) ] ; then
		value=0
	fi

	# Update the current value index for the direction
	set_var $direction index $value

	# Return whether we have exceeded the maximum
	[ $value != 0 ]
}

dir_set_flipping_control() {
	local direction=$1

	local index=$(get_var $direction index)
	local control=$(get_var $direction control)
	local values=$(get_var $direction values)
	local value=$(get_array_value "$values" $index)

	vsp1_set_control wpf.0 "$control" $value
}

test_flipping() {
	local label=$1
	local insize=$2
	local outsize=$3

	test_start "$label $insize -> $outsize"

	pipe_configure rpf-uds
	format_configure rpf-uds $format $insize $format $outsize

	vsp_runner rpf.0 &
	vsp_runner wpf.0

	local result=$(compare_frames $label)

	test_complete $result
}

test_main() {
	local direction

	for direction in $directions ; do
		$(vsp1_has_feature "wpf.0[control:'$(get_var $direction control)']") && {
			set_var $direction index 0
			supported_directions="$supported_directions $direction"
		}
	done

	local dir_max=$(get_array_length $supported_directions)
	local dir_current=0

	while true ; do
		# Update all controls
		local label=
		for direction in $supported_directions ; do
			local index=$(get_var $direction index)
			local values=$(get_var $direction values)
			local value=$(get_array_value "$values" $index)
			label="$label $(get_var $direction label)=$value"
			dir_set_flipping_control $direction
		done

		test_flipping "$label" 640x480 640x480
		test_flipping "$label" 640x480 1024x768
		test_flipping "$label" 1024x768 640x480

		while [ $dir_current -lt $dir_max ] ; do
			dir_next_value $dir_current && break
			dir_current=$((dir_current+1))
		done

		if [ $dir_current -ge $dir_max ] ; then
			break
		fi

		dir_current=0
	done
}

test_init $0 "$features" "$optional_features"
test_run