mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-08 08:26:10 +00:00
kms_psr_sink_crc: Simplify debugfs reading.
Let's start using igt_debugfs_read helper so we can change the debugfs interface at anytime. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
f1bb20eb7c
commit
05ac611358
@ -199,63 +199,22 @@ static void fill_render(data_t *data, uint32_t handle, unsigned char color)
|
|||||||
|
|
||||||
static bool psr_possible(data_t *data)
|
static bool psr_possible(data_t *data)
|
||||||
{
|
{
|
||||||
FILE *file;
|
char buf[512];
|
||||||
char buf[4096];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (running_with_psr_disabled)
|
igt_debugfs_read("i915_edp_psr_status", buf);
|
||||||
return true;
|
|
||||||
|
|
||||||
file = igt_debugfs_fopen("i915_edp_psr_status", "r");
|
return running_with_psr_disabled ||
|
||||||
igt_require(file);
|
strstr(buf, "Sink_Support: yes\n");
|
||||||
|
|
||||||
/* First dump the entire file into the debug log for later analysis
|
|
||||||
* if required.
|
|
||||||
*/
|
|
||||||
ret = fread(buf, 1, 4095, file);
|
|
||||||
igt_require(ret > 0);
|
|
||||||
buf[ret] = '\0';
|
|
||||||
igt_debug("i915_edp_psr_status:\n%s", buf);
|
|
||||||
fseek(file, 0, SEEK_SET);
|
|
||||||
|
|
||||||
/* Now check that we have all the preconditions required for PSR */
|
|
||||||
ret = fscanf(file, "Sink_Support: %s\n", buf);
|
|
||||||
igt_require_f(ret == 1 && strcmp(buf, "yes") == 0,
|
|
||||||
"Sink_Support: %s\n", buf);
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool psr_active(data_t *data)
|
static bool psr_active(data_t *data)
|
||||||
{
|
{
|
||||||
int ret;
|
char buf[512];
|
||||||
FILE *file;
|
|
||||||
char str[4];
|
|
||||||
|
|
||||||
if (running_with_psr_disabled)
|
igt_debugfs_read("i915_edp_psr_status", buf);
|
||||||
return true;
|
|
||||||
|
|
||||||
file = igt_debugfs_fopen("i915_edp_psr_status", "r");
|
return running_with_psr_disabled ||
|
||||||
igt_require(file);
|
strstr(buf, "HW Enabled & Active bit: yes\n");
|
||||||
|
|
||||||
ret = fscanf(file, "Sink_Support: %s\n", str);
|
|
||||||
igt_assert_neq(ret, 0);
|
|
||||||
ret = fscanf(file, "Source_OK: %s\n", str);
|
|
||||||
igt_assert_neq(ret, 0);
|
|
||||||
ret = fscanf(file, "Enabled: %s\n", str);
|
|
||||||
igt_assert_neq(ret, 0);
|
|
||||||
ret = fscanf(file, "Active: %s\n", str);
|
|
||||||
igt_assert_neq(ret, 0);
|
|
||||||
ret = fscanf(file, "Busy frontbuffer bits: %s\n", str);
|
|
||||||
igt_assert_neq(ret, 0);
|
|
||||||
ret = fscanf(file, "Re-enable work scheduled: %s\n", str);
|
|
||||||
igt_assert_neq(ret, 0);
|
|
||||||
ret = fscanf(file, "HW Enabled & Active bit: %s\n", str);
|
|
||||||
igt_assert_neq(ret, 0);
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
return strcmp(str, "yes") == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool wait_psr_entry(data_t *data)
|
static bool wait_psr_entry(data_t *data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user