Removed CheckVirtualization class since it is not used anymore.
Change-Id: Id83a1faf3a21267672b302a92e498565d942074f
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
import java.util.ArrayList;
import java.util.List;
+import org.tizen.emulator.manager.job.CheckGPU;
import org.tizen.emulator.manager.job.CheckVT;
import org.tizen.emulator.manager.resources.FilePathResources;
import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
import org.tizen.emulator.manager.vms.RAM_SIZE;
import org.tizen.emulator.manager.vms.RESOLUTION;
CheckVT.isVTSupported() ? "yes" : "no", false, true));
commandList.add(new Command("g", Actions.OP_GLACCELERATION,
Actions.DESC_GLACCELERATION,
- CheckVirtualization.getInstance().isSupportGPU() ? "yes" : "no", false, true));
+ CheckGPU.isGPUSupported() ? "yes" : "no", false, true));
/*
commandList.add(new Command("t", Actions.OP_MAXTOUCH,
"Set count of multi touch point.(1 ~ 3)", Integer.toString(property.maxTouchCount), false, true));
CheckVT.isVTSupported() ? "yes" : "no", false, true));
commandList.add(new Command("g", Actions.OP_GLACCELERATION,
Actions.DESC_GLACCELERATION,
- CheckVirtualization.getInstance().isSupportGPU() ? "yes" : "no", false, true));
+ CheckGPU.isGPUSupported() ? "yes" : "no", false, true));
/*
commandList.add(new Command("t", Actions.OP_MAXTOUCH,
"Set count of multi touch point.(1 or 2)", Integer.toString(property.maxTouchCount), false, true));
import java.util.ArrayList;
import java.util.List;
+import org.tizen.emulator.manager.job.CheckGPU;
import org.tizen.emulator.manager.job.CheckVT;
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.platform.ProfileList;
import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
import org.tizen.emulator.manager.vms.Creator;
import org.tizen.emulator.manager.vms.RAM_SIZE;
import org.tizen.emulator.manager.vms.RESOLUTION;
System.out.println("So this value set false.");
return false;
}
- if (!CheckVirtualization.getInstance().isSupportGPU()) {
+ if (!CheckGPU.isGPUSupported()) {
throw new ConsoleException("This computer does not support GPU.");
} else {
return true;
package org.tizen.emulator.manager.job;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.resources.FilePathResources;
+import org.tizen.emulator.manager.vms.helper.HelperClass;
+import org.tizen.emulator.manager.vms.helper.ProcessResult;
public class CheckGPU implements Job {
+ private static final String GPU_CHECKER;
+
+ private static boolean isGPUSupported = false;
+ private static boolean isGallium = false;
+
+ static {
+ GPU_CHECKER = EmulatorManager.isWin() ? "check-gl.exe" : "check-gl";
+ }
+
+ public static boolean isGPUSupported() {
+ return isGPUSupported;
+ }
+
+ public static boolean isGallium() {
+ return isGallium;
+ }
+
@Override
public void work() {
- CheckVirtualization.getInstance().check();
+ List<String> cmd = new ArrayList<String>();
+ cmd.add(FilePathResources.getEmulatorToolPath() + File.separator + GPU_CHECKER);
+ ProcessResult result = HelperClass.runProcess(cmd,
+ new File(FilePathResources.getEmulatorToolPath()));
+
+ switch (result.getExitValue()) {
+ case 0:
+ isGPUSupported = true;
+ break;
+ case 2:
+ isGPUSupported = true;
+ isGallium = true;
+ break;
+ default:
+ break;
+ }
+
+ EMLogger.getLogger().log(Level.INFO, "Support GPU: " + Boolean.toString(isGPUSupported));
+ EMLogger.getLogger().log(Level.INFO, "Gallium: " + Boolean.toString(isGallium));
}
}
private static final String HAX_CHECKER;
private static final String ENABLE_HAX = "-enable-hax";
private static final String ENABLE_KVM = "-enable-kvm";
+ // for linux
+ private static final String KVM_DEV_NODE = "/dev/kvm";
private static boolean isVTSupported = false;
private static boolean isNonUG = false; // for HAXM, non-UG CPU
break;
}
} else if (EmulatorManager.isLinux()) {
- if(new File("/dev/kvm").canRead()) {
+ if(new File(KVM_DEV_NODE).canRead()) {
isVTSupported = true;
}
}
EMLogger.getLogger().log(Level.INFO, "Support HW virtualization: "
+ Boolean.toString(isVTSupported));
+ EMLogger.getLogger().log(Level.INFO, "non-UG: "
+ + Boolean.toString(isNonUG));
}
}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.tool;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-
-import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePathResources;
-
-public class CheckVirtualization {
- private static CheckVirtualization instance = new CheckVirtualization();
- private static boolean isGPUSupport = true;
- private static String GPU_enable_command = null;
- private static String GPU_disable_command = null;
-
- private static boolean isCheck = false;
- private static boolean isGallium = false; // for ubuntu OS
-
- private CheckVirtualization() {
- // singleton class
- }
-
- public static CheckVirtualization getInstance() {
- return instance;
- }
-
- public boolean isSupportGPU() {
- return isGPUSupport;
- }
-
- public boolean isGallium() {
- return isGallium;
- }
-
- public void check() {
- if (!isCheck) {
- checkGPU();
- isCheck = true;
- }
- }
-
- private void checkGPU() {
- GPUCheckWork work = new GPUCheckWork();
- work.setDaemon(true);
- work.start();
-
- try {
- work.join();
- } catch (InterruptedException e) {
- EMLogger.getLogger().log(Level.WARNING, "Exception" + e.getMessage());
- }
- }
-
- public String getGPU_enable_command() {
- return GPU_enable_command;
- }
-
- public String getGPU_disable_command() {
- return GPU_disable_command;
- }
-
- private static class GPUCheckWork extends Thread {
- @Override
- public void run() {
- GPU_enable_command = "-enable-gl";
-
- int exitValue = 1;
-
- List<String> cmd = new ArrayList<String>();
- cmd.add(FilePathResources.getEmulatorToolPath() + File.separator +
- (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-gl.exe" : "check-gl"));
- ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePathResources.getEmulatorToolPath()));
-
- try {
- Process process = pb.start();
- ProcessOutputReader.startRead(process, "check-gl");
- process.waitFor();
- exitValue = process.exitValue();
- EMLogger.getLogger().log(Level.CONFIG, "'check-gl's exit value : " + exitValue);
- } catch (IOException e) {
- EMLogger.getLogger().log(Level.WARNING, "IOException" + e.getMessage());
- } catch (InterruptedException e) {
- EMLogger.getLogger().log(Level.WARNING, "InterruptedException" + e.getMessage());
- } catch (Exception e) {
- EMLogger.getLogger().log(Level.WARNING, "Exception" + e.getMessage());
- }
-
- if( exitValue == 0) {
- isGPUSupport = true;
-
- } else if (exitValue == 2) {
- isGPUSupport = true;
- isGallium = true;
-
- } else {
- GPU_enable_command = "";
- isGPUSupport = false;
- }
- EMLogger.getLogger().log(Level.INFO, "Support GPU: "
- + (isGPUSupport ? "true" : "false"));
- }
- }
-}
-
-class ProcessOutputReader extends Thread {
-
- private final BufferedReader reader;
- private final String processName;
- private final List<String> msgList = new ArrayList<String>();
-
- public ProcessOutputReader(BufferedReader reader, String processName) {
- this.reader = reader;
- this.processName = processName;
- this.setDaemon(true);
- }
-
- // Read output/error stream of process to prevent blocking due to full of buffer.
- public static void startRead(Process process, String processName) {
- BufferedReader out = new BufferedReader(new InputStreamReader(process.getInputStream()));
- new ProcessOutputReader(out, processName).start();
-
- BufferedReader err = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- new ProcessOutputReader(err, processName).start();
- }
-
- @Override
- public void run(){
- String msg;
- try {
- while ((msg = reader.readLine()) != null) {
- msgList.add(msg);
- }
- } catch (IOException e) {
- EMLogger.getLogger().warning(e.getMessage());
- } finally {
- try {
- reader.close();
- } catch (IOException e) {
- EMLogger.getLogger().warning(e.getMessage());
- }
- }
-
- if (!msgList.isEmpty()) {
- EMLogger.getLogger().info(processName + "'s stdout/stderr");
- for (String s : msgList) {
- EMLogger.getLogger().info(s);
- }
- msgList.clear();
- }
- }
-
-}
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.job.CheckGPU;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
import org.tizen.emulator.manager.ui.detail.item.ItemState;
import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
import org.tizen.emulator.manager.ui.detail.item.template.OnOffSubViewItem;
public class GPUSupportSubViewItem extends OnOffSubViewItem {
- private boolean isArm = false;
+ private final boolean isArm = false;
private static String GPUToolTipText = "If you enable the GPU option,"
+ StringResources.NEW_LINE
+ "the rendering performance of video player or camera may degrade.";
@Override
public boolean settingDetailItem(VMPropertyValue value) {
- if (!CheckVirtualization.getInstance().isSupportGPU()) {
+ if (!CheckGPU.isGPUSupported()) {
valueLabel.setText(StringResources.DISABLED);
valueLabel.setToolTipText(GPUDisableToolTipText);
} else {
public boolean settingModifyItem(VMPropertyValue value) {
oldValue = newValue = value.isGLAcceleration;
- if (!CheckVirtualization.getInstance().isSupportGPU() || isArm) {
+ if (!CheckGPU.isGPUSupported() || isArm) {
onOffButton.setEnabled(false);
buttonLabel.setText(StringResources.DISABLED);
buttonLabel.setToolTipText(GPUDisableToolTipText);
public ItemState checkValue() {
itemState.setNormal();
- if (CheckVirtualization.getInstance().isGallium()
- && EmulatorManager.isLinux() && getValue() == true) {
+ if (CheckGPU.isGallium() && getValue() == true) {
itemState.setWarning(GALLIUM_WARNING_MSG);
}
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
import org.tizen.emulator.manager.vms.xml.DisplayType.Resolution;
import org.tizen.emulator.manager.vms.xml.ExtendedOptionType;
import org.tizen.emulator.manager.vms.xml.OptionType;
}
isHWVirtualization = property.getConfiguration().getUsability().isHwVirtualization();
- isGLAcceleration = property.getConfiguration().getUsability().isHwGLAcceleration()
- && CheckVirtualization.getInstance().isSupportGPU();
+ isGLAcceleration = property.getConfiguration().getUsability().isHwGLAcceleration();
TouchType touchType = property.getConfiguration().getDevice().getTouch();
if (touchType != null) {
package org.tizen.emulator.manager.vms.option;
import org.eclipse.swt.SWT;
-import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.job.CheckGPU;
import org.tizen.emulator.manager.job.CheckVT;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
import org.tizen.emulator.manager.ui.dialog.MessageDialog;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.helper.VMLauncherException;
}
// Set GPU option
- if (property.getConfiguration().getUsability().isHwGLAcceleration()
- && CheckVirtualization.getInstance().isSupportGPU()) {
- // config.addQemuOption("-vigs-backend", "gl");
- // config.addQemuOption("-enable-yagl");
- // config.addQemuOption("-yagl-backend", "vigs");
+ if (property.getConfiguration().getUsability().isHwGLAcceleration()) {
config.addQemuOption("-device", "vigs,backend=gl");
config.addQemuOption("-device", "yagl");
@Override
public void checkArgument(VMProperty property) throws VMLauncherException {
// Check graphic driver (only in linux)
- if (EmulatorManager.isLinux()
- && CheckVirtualization.getInstance().isGallium()
+ if (CheckGPU.isGallium()
&& property.getPropertyValue().isGLAcceleration) {
// show [ok/cancel] message.
MessageDialog dialog = new MessageDialog();