[Mesa-dev] [PATCH 3/6] intel: Handle devid overrides using libdrm.

Yuanhan Liu yuanhan.liu at linux.intel.com
Sun Mar 18 18:38:03 PDT 2012


On Fri, Mar 16, 2012 at 04:26:43PM -0700, Eric Anholt wrote:
> ---
>  src/mesa/drivers/dri/intel/intel_screen.c |   23 ++++-------------------
>  1 files changed, 4 insertions(+), 19 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
> index 7939c4d..3f1ef87 100644
> --- a/src/mesa/drivers/dri/intel/intel_screen.c
> +++ b/src/mesa/drivers/dri/intel/intel_screen.c
> @@ -624,8 +624,7 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
>     __DRIscreen *spriv = intelScreen->driScrnPriv;
>     int num_fences = 0;
>  
> -   intelScreen->no_hw = (getenv("INTEL_NO_HW") != NULL ||
> -			 getenv("INTEL_DEVID_OVERRIDE") != NULL);
> +   intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;

Seems that we are doing duplicate things here in Mesa and Libdrm-intel:
  mesa will bypass hardware rendering if INTEL_NO_HW env is set
  libdrm-intel also will bypass hardware rendering if INTEL_DEVID_OVERRIDE is set

They are doing the same thing, but by different env variable, is that
necessary?

>  
>     intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
>     if (intelScreen->bufmgr == NULL) {
> @@ -736,7 +735,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
>     GLenum fb_format[3];
>     GLenum fb_type[3];
>     unsigned int api_mask;
> -   char *devid_override;
>  
>     static const GLenum back_buffer_modes[] = {
>         GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
> @@ -758,20 +756,10 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
>     intelScreen->driScrnPriv = psp;
>     psp->driverPrivate = (void *) intelScreen;
>  
> -   /* Determine chipset ID */
> -   if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
> -			&intelScreen->deviceID))
> -      return false;
> +   if (!intel_init_bufmgr(intelScreen))
> +       return false;
>  
> -   /* Allow an override of the device ID for the purpose of making the
> -    * driver produce dumps for debugging of new chipset enablement.
> -    * This implies INTEL_NO_HW, to avoid programming your actual GPU
> -    * incorrectly.
> -    */
> -   devid_override = getenv("INTEL_DEVID_OVERRIDE");
> -   if (devid_override) {
> -      intelScreen->deviceID = strtod(devid_override, NULL);
> -   }
> +   intelScreen->deviceID = drm_intel_bufmgr_gem_get_devid(intelScreen->bufmgr);
>  
>     intelScreen->kernel_has_gen7_sol_reset =
>        intel_get_boolean(intelScreen->driScrnPriv,
> @@ -818,9 +806,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
>     if (IS_9XX(intelScreen->deviceID) || IS_965(intelScreen->deviceID))
>        psp->api_mask = api_mask;
>  
> -   if (!intel_init_bufmgr(intelScreen))
> -       return false;
> -
>     intelScreen->hw_has_swizzling = intel_detect_swizzling(intelScreen);
>  
>     psp->extensions = intelScreenExtensions;
> -- 
> 1.7.9.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list