diff options
-rw-r--r-- | src/intel_dri.c | 13 | ||||
-rw-r--r-- | src/intel_driver.c | 10 | ||||
-rw-r--r-- | src/intel_options.c | 2 | ||||
-rw-r--r-- | src/sna/sna_dri.c | 15 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 8 |
5 files changed, 42 insertions, 6 deletions
diff --git a/src/intel_dri.c b/src/intel_dri.c index 867a4653..17d9d502 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -1515,6 +1515,17 @@ out_complete: static int dri2_server_generation; #endif +static const char *dri_driver_name(intel_screen_private *intel) +{ + const char *s = xf86GetOptValString(intel->Options, OPTION_DRI); + Bool dummy; + + if (s == NULL || xf86getBoolValue(&dummy, s)) + return INTEL_INFO(intel)->gen < 40 ? "i915" : "i965"; + + return s; +} + Bool I830DRI2ScreenInit(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); @@ -1564,7 +1575,7 @@ Bool I830DRI2ScreenInit(ScreenPtr screen) intel->deviceName = drmGetDeviceNameFromFd(intel->drmSubFD); memset(&info, '\0', sizeof(info)); info.fd = intel->drmSubFD; - info.driverName = INTEL_INFO(intel)->gen < 40 ? "i915" : "i965"; + info.driverName = dri_driver_name(intel); info.deviceName = intel->deviceName; #if DRI2INFOREC_VERSION == 1 diff --git a/src/intel_driver.c b/src/intel_driver.c index 3029b228..254aafab 100644 --- a/src/intel_driver.c +++ b/src/intel_driver.c @@ -221,11 +221,19 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn) return TRUE; } +static Bool intel_option_cast_string_to_bool(intel_screen_private *intel, + int id, Bool val) +{ + xf86getBoolValue(&val, xf86GetOptValString(intel->Options, id)); + return val; +} + static void intel_check_dri_option(ScrnInfoPtr scrn) { intel_screen_private *intel = intel_get_screen_private(scrn); + intel->directRenderingType = DRI_NONE; - if (!xf86ReturnOptValBool(intel->Options, OPTION_DRI, TRUE)) + if (!intel_option_cast_string_to_bool(intel, OPTION_DRI, TRUE)) intel->directRenderingType = DRI_DISABLED; if (scrn->depth != 16 && scrn->depth != 24 && scrn->depth != 30) { diff --git a/src/intel_options.c b/src/intel_options.c index dcab9e72..443e84d7 100644 --- a/src/intel_options.c +++ b/src/intel_options.c @@ -8,7 +8,7 @@ const OptionInfoRec intel_options[] = { {OPTION_ACCEL_DISABLE, "NoAccel", OPTV_BOOLEAN, {0}, 0}, {OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, 0}, {OPTION_BACKLIGHT, "Backlight", OPTV_STRING, {0}, 0}, - {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, 1}, + {OPTION_DRI, "DRI", OPTV_STRING, {0}, 0}, {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, 0}, {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, 0}, {OPTION_TILING_2D, "Tiling", OPTV_BOOLEAN, {0}, 1}, diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index 83c79c13..23d9572a 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -41,6 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sna.h" #include "sna_reg.h" +#include "intel_options.h" #include <xf86drm.h> #include <i915_drm.h> @@ -2317,6 +2318,17 @@ out_complete: } #endif +static const char *dri_driver_name(struct sna *sna) +{ + const char *s = xf86GetOptValString(sna->Options, OPTION_DRI); + Bool dummy; + + if (s == NULL || xf86getBoolValue(&dummy, s)) + return (sna->kgem.gen && sna->kgem.gen < 40) ? "i915" : "i965"; + + return s; +} + bool sna_dri_open(struct sna *sna, ScreenPtr screen) { DRI2InfoRec info; @@ -2344,8 +2356,7 @@ bool sna_dri_open(struct sna *sna, ScreenPtr screen) sna->deviceName = drmGetDeviceNameFromFd(sna->kgem.fd); memset(&info, '\0', sizeof(info)); info.fd = sna->kgem.fd; - info.driverName = - (sna->kgem.gen && sna->kgem.gen < 40) ? "i915" : "i965"; + info.driverName = dri_driver_name(sna); info.deviceName = sna->deviceName; DBG(("%s: loading dri driver '%s' [gen=%d] for device '%s'\n", diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 055c71c2..f214b90f 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -363,6 +363,12 @@ static void sna_setup_capabilities(ScrnInfoPtr scrn, int fd) #endif } +static Bool sna_option_cast_to_bool(struct sna *sna, int id, Bool val) +{ + xf86getBoolValue(&val, xf86GetOptValString(sna->Options, id)); + return val; +} + /** * This is called before ScreenInit to do any require probing of screen * configuration. @@ -543,7 +549,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) xf86SetDpi(scrn, 0, 0); sna->dri_available = false; - if (xf86ReturnOptValBool(sna->Options, OPTION_DRI, TRUE)) + if (sna_option_cast_to_bool(sna, OPTION_DRI, TRUE)) sna->dri_available = !!xf86LoadSubModule(scrn, "dri2"); return TRUE; |