diff --git a/src/Makefile.am b/src/Makefile.am index d057e435..a7043d1d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -43,6 +43,7 @@ NULL:=# intel_drv_la_SOURCES = \ intel_list.h \ intel_options.h \ + intel_options.c \ intel_module.c \ compat-api.h \ $(NULL) diff --git a/src/intel_driver.c b/src/intel_driver.c index 60f43bb8..fadc0a68 100644 --- a/src/intel_driver.c +++ b/src/intel_driver.c @@ -220,11 +220,9 @@ static Bool I830GetEarlyOptions(ScrnInfoPtr scrn) intel_screen_private *intel = intel_get_screen_private(scrn); /* Process the options */ - xf86CollectOptions(scrn, NULL); - if (!(intel->Options = malloc(sizeof(intel_options)))) + intel->Options = intel_options_get(scrn); + if (!intel->Options) return FALSE; - memcpy(intel->Options, intel_options, sizeof(intel_options)); - xf86ProcessOptions(scrn->scrnIndex, scrn->options, intel->Options); intel->fallback_debug = xf86ReturnOptValBool(intel->Options, OPTION_FALLBACKDEBUG, diff --git a/src/intel_options.c b/src/intel_options.c new file mode 100644 index 00000000..80572bed --- /dev/null +++ b/src/intel_options.c @@ -0,0 +1,47 @@ +#include "intel_options.h" + +const OptionInfoRec intel_options[] = { + {OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, 0}, + {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, 1}, + {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, 0}, + {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, 0}, + {OPTION_TILING_2D, "Tiling", OPTV_BOOLEAN, {0}, 1}, + {OPTION_TILING_FB, "LinearFramebuffer", OPTV_BOOLEAN, {0}, 0}, + {OPTION_SHADOW, "Shadow", OPTV_BOOLEAN, {0}, 0}, + {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN, {0}, 1}, + {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, 1}, +#ifdef INTEL_XVMC + {OPTION_XVMC, "XvMC", OPTV_BOOLEAN, {0}, 1}, +#endif + {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, 0}, + {OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, 0}, + {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, 0}, + {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, 0}, + {OPTION_HOTPLUG, "HotPlug", OPTV_BOOLEAN, {0}, 1}, + {OPTION_RELAXED_FENCING, "RelaxedFencing", OPTV_BOOLEAN, {0}, 1}, +#ifdef USE_SNA + {OPTION_THROTTLE, "Throttle", OPTV_BOOLEAN, {0}, 1}, + {OPTION_VMAP, "UseVmap", OPTV_BOOLEAN, {0}, 1}, + {OPTION_ZAPHOD, "ZaphodHeads", OPTV_STRING, {0}, 0}, + {OPTION_DELAYED_FLUSH, "DelayedFlush", OPTV_BOOLEAN, {0}, 1}, +#endif +#ifdef USE_UXA + {OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0}, 0}, + {OPTION_BUFFER_CACHE, "BufferCache", OPTV_BOOLEAN, {0}, 1}, +#endif + {-1, NULL, OPTV_NONE, {0}, 0} +}; + +OptionInfoPtr intel_options_get(ScrnInfoPtr scrn) +{ + OptionInfoPtr options; + + xf86CollectOptions(scrn, NULL); + if (!(options = malloc(sizeof(intel_options)))) + return NULL; + + memcpy(options, intel_options, sizeof(intel_options)); + xf86ProcessOptions(scrn->scrnIndex, scrn->options, options); + + return options; +} diff --git a/src/intel_options.h b/src/intel_options.h index 8863878a..42a9e560 100644 --- a/src/intel_options.h +++ b/src/intel_options.h @@ -1,6 +1,9 @@ #ifndef INTEL_OPTIONS_H #define INTEL_OPTIONS_H +#include +#include + /* * Note: "ColorKey" is provided for compatibility with the i810 driver. * However, the correct option name is "VideoKey". "ColorKey" usually @@ -40,36 +43,7 @@ enum intel_options { NUM_OPTIONS, }; -static OptionInfoRec intel_options[] = { - {OPTION_ACCEL_METHOD, "AccelMethod", OPTV_STRING, {0}, 0}, - {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE}, - {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, - {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, - {OPTION_TILING_2D, "Tiling", OPTV_BOOLEAN, {0}, TRUE}, - {OPTION_TILING_FB, "LinearFramebuffer", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_SHADOW, "Shadow", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_SWAPBUFFERS_WAIT, "SwapbuffersWait", OPTV_BOOLEAN, {0}, TRUE}, - {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, TRUE}, -#ifdef INTEL_XVMC - {OPTION_XVMC, "XvMC", OPTV_BOOLEAN, {0}, TRUE}, -#endif - {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_DEBUG_FLUSH_BATCHES, "DebugFlushBatches", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_HOTPLUG, "HotPlug", OPTV_BOOLEAN, {0}, TRUE}, - {OPTION_RELAXED_FENCING, "RelaxedFencing", OPTV_BOOLEAN, {0}, TRUE}, -#ifdef USE_SNA - {OPTION_THROTTLE, "Throttle", OPTV_BOOLEAN, {0}, TRUE}, - {OPTION_VMAP, "UseVmap", OPTV_BOOLEAN, {0}, TRUE}, - {OPTION_ZAPHOD, "ZaphodHeads", OPTV_STRING, {0}, FALSE}, - {OPTION_DELAYED_FLUSH, "DelayedFlush", OPTV_BOOLEAN, {0}, TRUE}, -#endif -#ifdef USE_UXA - {OPTION_FALLBACKDEBUG, "FallbackDebug", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_BUFFER_CACHE, "BufferCache", OPTV_BOOLEAN, {0}, TRUE}, -#endif - {-1, NULL, OPTV_NONE, {0}, FALSE} -}; +extern const OptionInfoRec intel_options[]; +OptionInfoPtr intel_options_get(ScrnInfoPtr scrn); #endif /* INTEL_OPTIONS_H */ diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index fb54a24c..9c6994b2 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -259,15 +259,8 @@ static Bool sna_get_early_options(ScrnInfoPtr scrn) { struct sna *sna = to_sna(scrn); - /* Process the options */ - xf86CollectOptions(scrn, NULL); - if (!(sna->Options = malloc(sizeof(intel_options)))) - return FALSE; - - memcpy(sna->Options, intel_options, sizeof(intel_options)); - xf86ProcessOptions(scrn->scrnIndex, scrn->options, sna->Options); - - return TRUE; + sna->Options = intel_options_get(scrn); + return sna->Options != NULL; } struct sna_device {