DirectFB 1.7.4 の上で Qt 5.3 を実行しています (platformNativeInterface が実装されていないため、qdirectfbintegration への小さなパッチと共に)。
3840x2160 の解像度で表示された後、以下のコードを使用して 1920x1080 の解像度に変更します。解像度が変わり、fbset の出力を見ると確認できます。私が見ている問題は、解像度を 1920x1080 に変更した後も Qt が 3840x2160 と報告することです。
Qtが報告している解決策を強制的に再確認/更新する方法を知っている人はいますか? または、内部で何かが変更されたことを Qt に通知するために、directfb プラグインには何が欠けているのでしょうか?
ありがとう。
IDirectFB * dfb = (IDirectFB*)m_app->platformNativeInterface();
if(dfb){
std::cerr << "######## New resolution is " << width << "x" << height << std::endl;
IDirectFBDisplayLayer *layer;
DFBDisplayLayerConfig config;
std::cerr << "######## Getting primary IDirectFBDisplayLayer" << std::endl;
/* Get an interface to the primary layer. */
dfb->GetDisplayLayer(dfb, DLID_PRIMARY, &layer);
if(layer){
DFBResult dres;
std::cerr << "######## Got the primary display layer, setting admin" << std::endl;
// This level allows window stack mode switches
dres = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
if(dres != DFB_OK){
std::cerr << "######## Error: " << DirectFBErrorString(dres) << std::endl;
}
std::cerr << "######## Getting layer configuration" << std::endl;
// Get layer configuration
dres = layer->GetConfiguration(layer, &config);
if(dres != DFB_OK){
std::cerr << "######## Error: " << DirectFBErrorString(dres) << std::endl;
}
// Set the new resolution
std::cerr << "######## Setting layer resolution" << std::endl;
config.width = width;
config.height = height;
dres = layer->SetConfiguration(layer, &config);
if(dres != DFB_OK){
std::cerr << "######## Error: " << DirectFBErrorString(dres) << std::endl;
}
}
// Print out resolution from Qt
QRect res = QApplication::desktop()->screenGeometry();
std::cerr << "######## QApplication resolution is now " << res.width() << "x" << res.height() << std::endl;
コンソールからの出力は次のとおりです。
######## New resolution is 1920x1080
######## Getting primary IDirectFBDisplayLayer
######## Got the primary display layer, setting admin
######## Getting layer configuration
######## Setting layer resolution
(*) FBDev/Mode: Setting 1920x1080 ARGB
(*) FBDev/Mode: Switched to 1920x1080 (virtual 1920x2160) at 32 bit (ARGB), pitch 7680
######## QApplication resolution is now 3840x2160
root@output:~# fbset
mode "1920x1080-24"
# D: 74.250 MHz, H: 27.000 kHz, V: 24.000 Hz
geometry 1920 1080 1920 2160 32
timings 13468 148 638 36 4 44 5
accel false
rgba 8/16,8/8,8/0,8/24
endmode