[Intel-gfx] [i-g-t PATCH v2 06/17] lib: Call intel_get_drm_devid only from intel code

Tomeu Vizoso tomeu.vizoso at collabora.com
Tue Mar 8 14:51:28 UTC 2016


It only makes sense when testing the i915 driver, so don't call it
otherwise.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
---

Changes in v2: None

 lib/igt_fb.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 7b535560033d..f936961a484f 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -76,15 +76,14 @@ static struct format_desc_struct {
 static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 				 unsigned *width_ret, unsigned *height_ret)
 {
-	uint32_t devid = intel_get_drm_devid(fd);
-
 	switch (tiling) {
 	case LOCAL_DRM_FORMAT_MOD_NONE:
 		*width_ret = 64;
 		*height_ret = 1;
 		break;
 	case LOCAL_I915_FORMAT_MOD_X_TILED:
-		if (intel_gen(devid) == 2) {
+		if (is_i915_device(fd) &&
+		    intel_gen(intel_get_drm_devid(fd)) == 2) {
 			*width_ret = 128;
 			*height_ret = 16;
 		} else {
@@ -93,10 +92,11 @@ static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		break;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
-		if (intel_gen(devid) == 2) {
+		if (is_i915_device(fd) &&
+		    intel_gen(intel_get_drm_devid(fd)) == 2) {
 			*width_ret = 128;
 			*height_ret = 16;
-		} else if (IS_915(devid)) {
+		} else if (IS_915(intel_get_drm_devid(fd))) {
 			*width_ret = 512;
 			*height_ret = 8;
 		} else {
-- 
2.5.0



More information about the Intel-gfx mailing list