graphics_KernelMemory: Update i915 paths

This commit updates the paths used for i915 memory values and is a
follow up to the change submitted at [1]. Logging self.GKM.num_errors
is also replaced to address "Unhandled AttributeError:
'graphics_KernelMemory' object has no attribute 'GKM'".

Example failure message:
11/13 08:03:17.044 ERROR|    graphics_utils:1147| Unable to find any sysfs paths for field "memory"
TestFail: Failed: Detected 1 errors accessing graphics memory.

[1] https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1895010

BUG=None
TEST=Verify graphics_KernelMemory passes on a 5.x kernel
     - Build eve or nocturne with an updated kernel.
     - `test_that ${dut_ip} graphics_KernelMemory`

Change-Id: If95b29e514ad48dc53ee8d30a5c24a6fb2f5d83e
Signed-off-by: Edward Baker <edward.baker@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1913635
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
diff --git a/client/cros/graphics/graphics_utils.py b/client/cros/graphics/graphics_utils.py
index 93c8cee..5c966cf 100644
--- a/client/cros/graphics/graphics_utils.py
+++ b/client/cros/graphics/graphics_utils.py
@@ -1062,6 +1062,10 @@
         'gem_objects': ['/sys/kernel/debug/dri/0/i915_gem_objects'],
         'memory': ['/sys/kernel/debug/dri/0/i915_gem_gtt'],
     }
+    # In Linux Kernel 5, i915_gem_gtt merged into i915_gem_objects
+    i915_fields_kernel_5 = {
+        'gem_objects': ['/sys/kernel/debug/dri/0/i915_gem_objects'],
+    }
     cirrus_fields = {}
     virtio_fields = {}
 
@@ -1071,6 +1075,7 @@
         'cirrus': cirrus_fields,
         'exynos5': exynos_fields,
         'i915': i915_fields,
+        'i915_kernel_5': i915_fields_kernel_5,
         'mediatek': mediatek_fields,
         'qualcomm': qualcomm_fields,
         'rockchip': rockchip_fields,
@@ -1103,12 +1108,15 @@
         soc = utils.get_cpu_soc_family()
 
         arch = utils.get_cpu_arch()
+        kernel_version = utils.get_kernel_version()[0:4].rstrip(".")
         if arch == 'x86_64' or arch == 'i386':
             pci_vga_device = utils.run("lspci | grep VGA").stdout.rstrip('\n')
             if "Advanced Micro Devices" in pci_vga_device:
                 soc = 'amdgpu'
             elif "Intel Corporation" in pci_vga_device:
                 soc = 'i915'
+                if utils.compare_versions(kernel_version, "4.19") > 0:
+                    soc = 'i915_kernel_5'
             elif "Cirrus Logic" in pci_vga_device:
                 # Used on qemu with kernels 3.18 and lower. Limited to 800x600
                 # resolution.
diff --git a/client/site_tests/graphics_KernelMemory/graphics_KernelMemory.py b/client/site_tests/graphics_KernelMemory/graphics_KernelMemory.py
index aa4bfd9..7886822 100644
--- a/client/site_tests/graphics_KernelMemory/graphics_KernelMemory.py
+++ b/client/site_tests/graphics_KernelMemory/graphics_KernelMemory.py
@@ -28,4 +28,4 @@
         # We should still be in the login screen and memory use > 0.
         if self._GSC.get_memory_access_errors() > 0:
             raise error.TestFail('Failed: Detected %d errors accessing graphics'
-                                 ' memory.' % self.GKM.num_errors)
+                                 ' memory.' % self._GSC.get_memory_access_errors())