[i-g-t PATCH v1 05/14] lib: Call intel_get_drm_devid only from intel code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx>
---

 lib/igt_fb.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 5f23136e01ac..3e76a419b3ee 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,7 +92,8 @@ static void igt_get_fb_tile_size(int fd, uint64_t tiling, int fb_bpp,
 		}
 		break;
 	case LOCAL_I915_FORMAT_MOD_Y_TILED:
-		if (IS_915(devid))
+		if (is_i915_device(fd) &&
+		    IS_915(intel_get_drm_devid(fd)))
 			*width_ret = 512;
 		else
 			*width_ret = 128;
@@ -145,8 +145,9 @@ void igt_calc_fb_size(int fd, int width, int height, int bpp, uint64_t tiling,
 
 	igt_get_fb_tile_size(fd, tiling, bpp, &tile_width, &tile_height);
 
-	if (intel_gen(intel_get_drm_devid(fd)) <= 3 &&
-	    tiling != LOCAL_DRM_FORMAT_MOD_NONE) {
+	if (is_i915_device(fd) &&
+	    tiling != LOCAL_DRM_FORMAT_MOD_NONE &&
+	    intel_gen(intel_get_drm_devid(fd)) <= 3) {
 		int v;
 
 		/* Round the tiling up to the next power-of-two and the region
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux