示例#1
0
def _make_intel_device_section(config, bus_ids, xorg_extra):

    logger = get_logger()

    if config["intel"][
            "driver"] == "intel" and not checks.is_xorg_intel_module_available(
            ):
        logger.warning(
            "The Xorg module intel is not available. Defaulting to modesetting."
        )
        driver = "modesetting"
    else:
        driver = config["intel"]["driver"]

    dri = int(config["intel"]["dri"])

    text = "Section \"Device\"\n" \
           "\tIdentifier \"intel\"\n"
    text += "\tDriver \"%s\"\n" % driver
    text += "\tBusID \"%s\"\n" % bus_ids["intel"]
    if config["intel"]["accel"] != "":
        text += "\tOption \"AccelMethod\" \"%s\"\n" % config["intel"]["accel"]
    if config["intel"]["tearfree"] != "":
        tearfree_enabled_str = {
            "yes": "true",
            "no": "false"
        }[config["intel"]["tearfree"]]
        text += "\tOption \"TearFree\" \"%s\"\n" % tearfree_enabled_str
    text += "\tOption \"DRI\" \"%d\"\n" % dri
    if "intel" in xorg_extra.keys():
        for line in xorg_extra["intel"]:
            text += ("\t" + line + "\n")
    text += "EndSection\n\n"

    return text
示例#2
0
def _check_intel_xorg_module(config, switch_mode):

    if switch_mode == "intel" and config["intel"]["driver"] == "intel" and not checks.is_xorg_intel_module_available():
        print("WARNING : The Xorg driver \"intel\" is selected in the configuration file but this driver is not installed."
              " optimus-manager will default to the \"modesetting\" driver instead. You can install the \"intel\" driver from"
              " the package \"xf86-video-intel.\"\n"
              "Continue ? (y/N)")

        confirmation = _ask_confirmation()

        if not confirmation:
            sys.exit(0)