<p dir="ltr"><br>
On Apr 11, 2016 9:49 AM, "Ben Widawsky" <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>> wrote:<br>
><br>
> This will fix the spurious error message: "Failed to query GPU properties."<br>
> that was unintentionally added in cc01b63d730.<br>
><br>
> This patch changes the function to return an int so that the caller is able to<br>
> do stuff based on the return value.<br>
><br>
> The equivalent of this patch was in the original series that fixed up the<br>
> warning, but I dropped it at the last moment. It is required to make the desired<br>
> behavior of not warning when trying to query GPU properties from the kernel<br>
> unless there is something the user can do about it.<br>
><br>
> NOTE: Broadwell appears to actually have some issue where the kernel returns<br>
> ENODEV when it shouldn't be. I will investigate this separately.<br>
><br>
> Reported-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
> Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/intel_screen.c | 13 ++++++-------<br>
> 1 file changed, 6 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c<br>
> index 03e6852..d1e8b68 100644<br>
> --- a/src/mesa/drivers/dri/i965/intel_screen.c<br>
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c<br>
> @@ -932,7 +932,7 @@ static const __DRIextension *intelRobustScreenExtensions[] = {<br>
> NULL<br>
> };<br>
><br>
> -static bool<br>
> +static int<br>
> intel_get_param(__DRIscreen *psp, int param, int *value)<br>
> {<br>
> int ret;<br>
> @@ -946,17 +946,16 @@ intel_get_param(__DRIscreen *psp, int param, int *value)<br>
> if (ret) {<br>
> if (ret != -EINVAL)<br>
> _mesa_warning(NULL, "drm_i915_getparam: %d", ret);<br>
> - return false;<br>
> }<br>
><br>
> - return true;<br>
> + return ret;<br>
> }<br>
><br>
> static bool<br>
> intel_get_boolean(__DRIscreen *psp, int param)<br>
> {<br>
> int value = 0;<br>
> - return intel_get_param(psp, param, &value) && value;<br>
> + return (intel_get_param(psp, param, &value) == 0) && value;<br>
> }<br>
><br>
> static void<br>
> @@ -1089,12 +1088,12 @@ intel_detect_sseu(struct intel_screen *intelScreen)<br>
><br>
> ret = intel_get_param(intelScreen->driScrnPriv, I915_PARAM_SUBSLICE_TOTAL,<br>
> &intelScreen->subslice_total);<br>
> - if (ret != -EINVAL)<br>
> + if (ret < 0 && ret != -EINVAL)<br>
> goto err_out;<br>
><br>
> ret = intel_get_param(intelScreen->driScrnPriv,<br>
> I915_PARAM_EU_TOTAL, &intelScreen->eu_total);<br>
> - if (ret != -EINVAL)<br>
> + if (ret < 0 && ret != -EINVAL)<br>
> goto err_out;<br>
><br>
> /* Without this information, we cannot get the right Braswell brandstrings,<br>
> @@ -1110,7 +1109,7 @@ intel_detect_sseu(struct intel_screen *intelScreen)<br>
> err_out:<br>
> intelScreen->subslice_total = -1;<br>
> intelScreen->eu_total = -1;<br>
> - _mesa_warning(NULL, "Failed to query GPU properties.\n");<br>
> + _mesa_warning(NULL, "Failed to query GPU properties (%d).\n", ret);</p>
<p dir="ltr">Isn't there some magic printf thing that will turn an error code into a useful string? I know %m works for errno but is there one you can use when the function returns the error?</p>
<p dir="ltr">Either way,</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></p>
<p dir="ltr">> }<br>
><br>
> static bool<br>
> --<br>
> 2.8.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>