1 |
cardoe 11/08/29 21:02:02 |
2 |
|
3 |
Added: eselect-xvmc-0.3.eselect |
4 |
Log: |
5 |
Bump version to support and fix the following: |
6 |
* Newer Intel XvMC (i915). Based on patch from Otávio Cipriani |
7 |
<otavio.n.cipriani@×××××.com> bug #378827 |
8 |
* Fix bad redirect. bug #314031 |
9 |
* Add unichrome support |
10 |
|
11 |
(Portage version: 2.1.10.11/cvs/Linux x86_64) |
12 |
|
13 |
Revision Changes Path |
14 |
1.1 app-admin/eselect-xvmc/files/eselect-xvmc-0.3.eselect |
15 |
|
16 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/eselect-xvmc/files/eselect-xvmc-0.3.eselect?rev=1.1&view=markup |
17 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/eselect-xvmc/files/eselect-xvmc-0.3.eselect?rev=1.1&content-type=text/plain |
18 |
|
19 |
Index: eselect-xvmc-0.3.eselect |
20 |
=================================================================== |
21 |
# Copyright 1999-2011 Gentoo Foundation |
22 |
# Distributed under the terms of the GNU General Public License v2 |
23 |
# $Id: eselect-xvmc-0.3.eselect,v 1.1 2011/08/29 21:02:02 cardoe Exp $ |
24 |
|
25 |
DESCRIPTION="Manage the XvMC implementation used by your system" |
26 |
MAINTAINER="cardoe@g.o" |
27 |
SVN_DATE='$Date: 2011/08/29 21:02:02 $' |
28 |
VERSION=$(svn_date_to_version "${SVN_DATE}" ) |
29 |
|
30 |
XVMCLIBS=( |
31 |
"libXvMCNVIDIA_dynamic.so.1" |
32 |
"libXvMC.so.1" |
33 |
"libviaXvMC.so.1" |
34 |
"libviaXvMCPro.so.1" |
35 |
"libchromeXvMC.so.1" |
36 |
"libchromeXvMCPro.so.1" |
37 |
"libXvMCVIA.so" |
38 |
"libXvMCVIAPro.so" |
39 |
"libI810XvMC.so.1" |
40 |
"/usr/lib/libIntelXvMC.so" |
41 |
"libAMDXvBA.so.1" ) |
42 |
XVMCPRETTY=( |
43 |
"nvidia" |
44 |
"xorg-x11" |
45 |
"via" |
46 |
"via-pro" |
47 |
"openchrome" |
48 |
"openchrome-pro" |
49 |
"unichrome" |
50 |
"unichrome-pro" |
51 |
"intel-i815" |
52 |
"intel-i915" |
53 |
"ati" ) |
54 |
|
55 |
get_implementation_indices() { |
56 |
local ret n |
57 |
for (( n = 0; n < ${#XVMCLIBS[@]}; ++n )); do |
58 |
[[ -e "${ROOT}/usr/lib/${XVMCLIBS[n]}" ]] && ret+=($n) |
59 |
done |
60 |
|
61 |
echo ${ret[@]} |
62 |
} |
63 |
|
64 |
get_current_implementation_index() { |
65 |
local n |
66 |
if [[ -f "${ROOT}/etc/X11/XvMCConfig" ]]; then |
67 |
local current=$(< "${ROOT}/etc/X11/XvMCConfig") |
68 |
for (( n = 0; n < ${#XVMCLIBS[@]}; ++n )); do |
69 |
if [[ "${XVMCLIBS[n]}" = "${current}" ]]; then |
70 |
echo "${n}" |
71 |
return |
72 |
fi |
73 |
done |
74 |
fi |
75 |
|
76 |
echo "-1" |
77 |
} |
78 |
|
79 |
set_new_implementation() { |
80 |
echo -n "Switching to ${XVMCPRETTY[$1]} XvMC implementation..." |
81 |
touch "${ROOT}/etc/X11/XvMCConfig" 2>&1 > /dev/null |
82 |
if [[ $? -eq 0 ]]; then |
83 |
echo "${XVMCLIBS[$1]}" > "${ROOT}/etc/X11/XvMCConfig" |
84 |
chmod 644 "${ROOT}/etc/X11/XvMCConfig" |
85 |
chown 0:0 "${ROOT}/etc/X11/XvMCConfig" |
86 |
echo " done" |
87 |
else |
88 |
echo " failed!" |
89 |
echo "Insufficient privileges" |
90 |
fi |
91 |
} |
92 |
|
93 |
### list action |
94 |
|
95 |
## {{{ list stuff |
96 |
describe_list() { |
97 |
echo "List Available XvMC implementations" |
98 |
} |
99 |
|
100 |
do_list() { |
101 |
local output n |
102 |
local avail=( $(get_implementation_indices) ) |
103 |
local current=$(get_current_implementation_index) |
104 |
write_list_start "Available XvMC implementations ( $(highlight '*') is current ):" |
105 |
|
106 |
if (( ${#avail[@]} )) ; then |
107 |
for n in "${avail[@]}" ; do |
108 |
output[n]="${XVMCPRETTY[n]}" |
109 |
[[ ${current} -eq ${n} ]] && \ |
110 |
output[n]+=" $(highlight '*')" |
111 |
done |
112 |
write_numbered_list "${output[@]}" |
113 |
else |
114 |
write_kv_list_entry "(none found)" "" |
115 |
fi |
116 |
|
117 |
return 0 |
118 |
} |
119 |
## }}} |
120 |
|
121 |
### show action |
122 |
|
123 |
## {{{ show stuff |
124 |
describe_show() { |
125 |
echo "Print the current XvMC implementation." |
126 |
} |
127 |
|
128 |
do_show() { |
129 |
local current=$(get_current_implementation_index) |
130 |
write_list_start "Current XvMC implementation:" |
131 |
|
132 |
if [[ ${current} -ne -1 ]]; then |
133 |
echo "${XVMCPRETTY[current]}" |
134 |
return 0 |
135 |
else |
136 |
echo "(none)" |
137 |
return 2 |
138 |
fi |
139 |
} |
140 |
## }}} |
141 |
|
142 |
### set action |
143 |
|
144 |
## {{{ set stuff |
145 |
describe_set() { |
146 |
echo "Select the XvMC implementation" |
147 |
} |
148 |
|
149 |
describe_set_parameters() { |
150 |
echo "<target>" |
151 |
} |
152 |
|
153 |
describe_set_options() { |
154 |
echo "<target> : XvMC implementation to activate" |
155 |
echo "--use-old : If an implementation is already set, use that one instead" |
156 |
} |
157 |
|
158 |
do_set() { |
159 |
local current=$(get_current_implementation_index) |
160 |
local avail=( $(get_implementation_indices) ) |
161 |
local n new action |
162 |
|
163 |
while [[ ${#@} -gt 0 ]]; do |
164 |
local opt=${1} |
165 |
shift |
166 |
case ${opt} in |
167 |
--use-old) |
168 |
if [[ ${current} -gt -1 ]]; then |
169 |
(( ${current} < ${#XVMCPRETTY[@]} )) && action="old-implementation" |
170 |
fi |
171 |
;; |
172 |
*) |
173 |
[[ -z ${action} ]] && action="set-implementation" |
174 |
|
175 |
if is_number ${opt} ; then |
176 |
new=${avail[opt - 1]} |
177 |
if [[ -z ${new} ]]; then |
178 |
die -q "Unrecognized option: ${opt}" |
179 |
fi |
180 |
elif has ${opt} ${XVMCPRETTY[@]}; then |
181 |
for (( n = 0; n < ${#XVMCPRETTY[@]}; ++n )); do |
182 |
[[ "${XVMCPRETTY[n]}" = "${opt}" ]] && new=${n} |
183 |
done |
184 |
else |
185 |
die -q "Unrecognized option: ${opt}" |
186 |
fi |
187 |
;; |
188 |
esac |
189 |
done |
190 |
|
191 |
case ${action} in |
192 |
old-implementation) |
193 |
set_new_implementation ${current} |
194 |
return $? |
195 |
;; |
196 |
set-implementation) |
197 |
if [[ -n ${new} ]]; then |
198 |
set_new_implementation ${new} |
199 |
return $? |
200 |
else |
201 |
die -q "Please specify an implementation to set" |
202 |
fi |
203 |
;; |
204 |
*) |
205 |
die -q "Invalid usage of set action." |
206 |
esac |
207 |
} |
208 |
|
209 |
# vim: ts=4 sw=4 noet fdm=marker |