Remove reliance on hard-coded DRI name
This provides for using the existing DDX with future DRI drivers which may break from the traditional names - but only with the help of the user/packager. This scheme needs to be replaced with a robust mechanism for driver loading if AIGLX and co are to be kept. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
cefce9c815
commit
b7d2fcf47a
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue