[Gelistirici] Disabling hardware acceleration in Adobe Flash Player
Ozan Çağlayan
ozan at pardus.org.tr
25 Eki 2008 Cmt 17:10:37 EEST
Here is the postInstall method that I wrote for disabling hardware
acceleration of Adobe Flash Player if the display adapter is an nVidia one.
As you know, the new flashplugin crashes with nvidia-drivers-new in
fullscreen mode. This script disables hardware acceleration which causes
this issue by modifying a binary configuration file found in
$HOME/.macromedia if it founds that file (during an update session) or
creates a new binary configuration file in that path(during a new
installation session) and recursively changes the ownership to the
correct user UID and GID.
I've made the detection based on vendorID found in
/var/lib/zorg/config.xml. Let's review this script a little..
http://cekirdek.pardus.org.tr/~ozan/dist/package.py
--
flashplugin'in, nvidia-drivers-new ile tam ekranda çökme derdine çözüm
olabilecek bir postInstall betiği yazdım. flashplugin'in donanım
hızlandırma özelliği bu sorunu getiriyor ve bunu kapatmanın tek yolu
$HOME/.macromedia altındaki bir ikili dosyayı düzenlemek. Betik eğer
vendorID nvidia ise, ve bu dosyayı bulursa güzelce düzenliyor eğer
bulamazsa o dosyaya kadar giden dizin hiyerarşisini yaratıp,
hızlandırmanın kapalı olduğu bir config dosyası yazıyor ve dosya yeni
oluşturulduğundan haklarını da $HOME kullanıcısının UID ve GID'ine
ayarlıyor.
Paket yüklendiği esnada nvidia sürücüsü kullanılmıyorsa ve betik
sürücüye göre karar alırsa, ileride bu sürücüye geçildiğinde betik
etkisiz kalmış olacağından daha genel bir şekilde vendorID üzerinden
gittim. Fikirlerinizi bekliyorum.
Denemek isteyenler şu adrestekini kullanabilir:
http://cekirdek.pardus.org.tr/~ozan/dist/package.py
--
package.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import piksemel
import pwd
settings_file =
".macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/settings.sol"
safe_config =
'\x00\xbf\x00\x00\x01;TCSO\x00\x04\x00\x00\x00\x00\x00\x08settings\x00\x00\x00\x00\x00\x04ga
in\x00 at I\x00\x00\x00\x00\x00\x00\x00\x00\x0fechosuppression\x01\x00\x00\x00\x11defaultmicrophone
\x02\x00\x00\x00\x00\rdefaultcamera\x02\x00\x00\x00\x00\rdefaultklimit\x00 at Y\x00\x00\x00
\x00\x00\x00\x00\x00\rdefaultalways\x01\x00\x00\x00\x11windowlessDisable\x01\x00\x00\x00
\x10crossdomainAllow\x01\x00\x00\x00\x11crossdomainAlways\x01\x00\x00\x00\x1asecureCrossDomainCacheSize
\x00\xbf\xf0\x00\x00\x00\x00\x00\x00\x00\x00\x18allowThirdPartyLSOAccess\x01\x01\x00\x00\x0ctrustedPaths
\x03\x00\x00\t\x00\x00\x0esafefullscreen\x01\x01\x00'
def enable_safefullscreen(path):
f = open(path, "rb+")
data = f.read()
v_offset = data.index('safefullscreen') + len('safefullscreen') + 1
bytes = [c for c in data]
bytes[v_offset] = '\x01'
f.seek(0)
f.write("".join(bytes))
f.close()
def postInstall(fromVersion, fromRelease, toVersion, toRelease):
# If VGA is nvidia, flash player 10 crashes when switched to full
screen.
zorg_config = '/var/lib/zorg/config.xml'
if os.path.exists(zorg_config):
card = piksemel.parse(zorg_config).getTag('Card')
vendor = card.getTagData('VendorId')
driver = card.getTag('ActiveConfig').getTagData('Driver')
if vendor == "10de":
# 10de: nVidia Corporation
users = {}
for dir in [d for d in os.listdir('/home') if
os.path.isdir('/home/%s' % d)]:
try:
# Store the users having a passwd entry
users[dir] = pwd.getpwnam(dir)
except KeyError:
pass
for u in users.keys():
# Modify the existing configuration file or create a new
one if it doesn't exist
file_path = '/home/%s/%s' % (u, settings_file)
try:
if os.path.exists(file_path):
enable_safefullscreen(file_path)
else:
# Create the directory
os.makedirs(os.path.dirname(file_path))
# Create it and chown it correctly
open(file_path, 'wb').write(safe_config)
os.system("/bin/chown -R %d:%d
/home/%s/.macromedia" % (users[u][2], users[u][3], u))
except:
pass
--
Ozan Çağlayan
<ozan_at_pardus.org.tr>
Gelistirici mesaj listesiyle ilgili
daha fazla bilgi