tree: git://anongit.freedesktop.org/drm-intel drm-intel-next head: 705d4feeb269e22c4850ad66e2210b737b553236 commit: 705d4feeb269e22c4850ad66e2210b737b553236 [14/14] drm/i915/fb: move user framebuffer stuff to intel_fb.c config: i386-randconfig-a004-20210827 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git remote add drm-intel git://anongit.freedesktop.org/drm-intel git fetch --no-tags drm-intel drm-intel-next git checkout 705d4feeb269e22c4850ad66e2210b737b553236 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>): drivers/gpu/drm/i915/i915_gpu_error.h:299:65: warning: unused parameter 'ee' [-Wunused-parameter] intel_engine_coredump_add_request(struct intel_engine_coredump *ee, ^ drivers/gpu/drm/i915/i915_gpu_error.h:300:28: warning: unused parameter 'rq' [-Wunused-parameter] struct i915_request *rq, ^ drivers/gpu/drm/i915/i915_gpu_error.h:301:13: warning: unused parameter 'gfp' [-Wunused-parameter] gfp_t gfp) ^ drivers/gpu/drm/i915/i915_gpu_error.h:307:61: warning: unused parameter 'ee' [-Wunused-parameter] intel_engine_coredump_add_vma(struct intel_engine_coredump *ee, ^ drivers/gpu/drm/i915/i915_gpu_error.h:308:43: warning: unused parameter 'capture' [-Wunused-parameter] struct intel_engine_capture_vma *capture, ^ drivers/gpu/drm/i915/i915_gpu_error.h:309:36: warning: unused parameter 'compress' [-Wunused-parameter] struct i915_vma_compress *compress) ^ drivers/gpu/drm/i915/i915_gpu_error.h:314:52: warning: unused parameter 'gt' [-Wunused-parameter] i915_vma_capture_prepare(struct intel_gt_coredump *gt) ^ drivers/gpu/drm/i915/i915_gpu_error.h:320:51: warning: unused parameter 'gt' [-Wunused-parameter] i915_vma_capture_finish(struct intel_gt_coredump *gt, ^ drivers/gpu/drm/i915/i915_gpu_error.h:321:30: warning: unused parameter 'compress' [-Wunused-parameter] struct i915_vma_compress *compress) ^ drivers/gpu/drm/i915/i915_gpu_error.h:326:50: warning: unused parameter 'error' [-Wunused-parameter] i915_error_state_store(struct i915_gpu_coredump *error) ^ drivers/gpu/drm/i915/i915_gpu_error.h:330:68: warning: unused parameter 'gpu' [-Wunused-parameter] static inline void i915_gpu_coredump_put(struct i915_gpu_coredump *gpu) ^ drivers/gpu/drm/i915/i915_gpu_error.h:335:49: warning: unused parameter 'i915' [-Wunused-parameter] i915_first_error_state(struct drm_i915_private *i915) ^ drivers/gpu/drm/i915/i915_gpu_error.h:340:68: warning: unused parameter 'i915' [-Wunused-parameter] static inline void i915_reset_error_state(struct drm_i915_private *i915) ^ drivers/gpu/drm/i915/i915_gpu_error.h:344:70: warning: unused parameter 'i915' [-Wunused-parameter] static inline void i915_disable_error_state(struct drm_i915_private *i915, ^ drivers/gpu/drm/i915/i915_gpu_error.h:345:14: warning: unused parameter 'err' [-Wunused-parameter] int err) ^ In file included from drivers/gpu/drm/i915/display/intel_fb.c:10: drivers/gpu/drm/i915/display/intel_display_types.h:1757:8: warning: comparison of integers of different signs: 'enum pipe' and 'unsigned int' [-Wsign-compare] pipe < ARRAY_SIZE(i915->pipe_to_crtc_mapping) && ~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_fb.c:715:61: warning: comparison of integers of different signs: 'int' and 'const unsigned int' [-Wsign-compare] (*x + plane_width) * fb->base.format->cpp[color_plane] > fb->base.pitches[color_plane]) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_fb.c:763:69: warning: unused parameter 'color_plane' [-Wunused-parameter] plane_view_dst_stride_tiles(const struct intel_framebuffer *fb, int color_plane, ^ drivers/gpu/drm/i915/display/intel_fb.c:777:56: warning: unused parameter 'fb' [-Wunused-parameter] plane_view_width_tiles(const struct intel_framebuffer *fb, int color_plane, ^ drivers/gpu/drm/i915/display/intel_fb.c:777:64: warning: unused parameter 'color_plane' [-Wunused-parameter] plane_view_width_tiles(const struct intel_framebuffer *fb, int color_plane, ^ drivers/gpu/drm/i915/display/intel_fb.c:785:57: warning: unused parameter 'fb' [-Wunused-parameter] plane_view_height_tiles(const struct intel_framebuffer *fb, int color_plane, ^ drivers/gpu/drm/i915/display/intel_fb.c:785:65: warning: unused parameter 'color_plane' [-Wunused-parameter] plane_view_height_tiles(const struct intel_framebuffer *fb, int color_plane, ^ drivers/gpu/drm/i915/display/intel_fb.c:817:3: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] check_array_bounds(i915, view->gtt.rotated.plane, color_plane); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_fb.c:14:70: note: expanded from macro 'check_array_bounds' #define check_array_bounds(i915, a, i) drm_WARN_ON(&(i915)->drm, (i) >= ARRAY_SIZE(a)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ include/drm/drm_print.h:563:19: note: expanded from macro 'drm_WARN_ON' drm_WARN((drm), (x), "%s", \ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/drm/drm_print.h:553:7: note: expanded from macro 'drm_WARN' WARN(condition, "%s %s: " format, \ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/asm-generic/bug.h:130:25: note: expanded from macro 'WARN' int __ret_warn_on = !!(condition); \ ^~~~~~~~~ drivers/gpu/drm/i915/display/intel_fb.c:841:3: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] check_array_bounds(i915, view->gtt.remapped.plane, color_plane); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/i915/display/intel_fb.c:14:70: note: expanded from macro 'check_array_bounds' #define check_array_bounds(i915, a, i) drm_WARN_ON(&(i915)->drm, (i) >= ARRAY_SIZE(a)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ include/drm/drm_print.h:563:19: note: expanded from macro 'drm_WARN_ON' drm_WARN((drm), (x), "%s", \ ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/drm/drm_print.h:553:7: note: expanded from macro 'drm_WARN' WARN(condition, "%s %s: " format, \ ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/asm-generic/bug.h:130:25: note: expanded from macro 'WARN' int __ret_warn_on = !!(condition); \ ^~~~~~~~~ drivers/gpu/drm/i915/display/intel_fb.c:937:16: warning: variable 'cpp' set but not used [-Wunused-but-set-variable] unsigned int cpp, size; ^ >> drivers/gpu/drm/i915/display/intel_fb.c:1232:23: warning: unused parameter 'file' [-Wunused-parameter] struct drm_file *file, ^ >> drivers/gpu/drm/i915/display/intel_fb.c:1233:19: warning: unused parameter 'flags' [-Wunused-parameter] unsigned int flags, unsigned int color, ^ >> drivers/gpu/drm/i915/display/intel_fb.c:1233:39: warning: unused parameter 'color' [-Wunused-parameter] unsigned int flags, unsigned int color, ^ >> drivers/gpu/drm/i915/display/intel_fb.c:1234:28: warning: unused parameter 'clips' [-Wunused-parameter] struct drm_clip_rect *clips, ^ >> drivers/gpu/drm/i915/display/intel_fb.c:1235:19: warning: unused parameter 'num_clips' [-Wunused-parameter] unsigned int num_clips) ^ >> drivers/gpu/drm/i915/display/intel_fb.c:1364:23: warning: comparison of integers of different signs: 'unsigned int' and 'int' [-Wsign-compare] if (fb->pitches[i] != ccs_aux_stride) { ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ >> drivers/gpu/drm/i915/display/intel_fb.c:1417:50: warning: unused parameter 'dev' [-Wunused-parameter] intel_user_framebuffer_create(struct drm_device *dev, ^ 1713 warnings generated. vim +/file +1232 drivers/gpu/drm/i915/display/intel_fb.c 1230 1231 static int intel_user_framebuffer_dirty(struct drm_framebuffer *fb, > 1232 struct drm_file *file, > 1233 unsigned int flags, unsigned int color, > 1234 struct drm_clip_rect *clips, > 1235 unsigned int num_clips) 1236 { 1237 struct drm_i915_gem_object *obj = intel_fb_obj(fb); 1238 1239 i915_gem_object_flush_if_display(obj); 1240 intel_frontbuffer_flush(to_intel_frontbuffer(fb), ORIGIN_DIRTYFB); 1241 1242 return 0; 1243 } 1244 1245 static const struct drm_framebuffer_funcs intel_fb_funcs = { 1246 .destroy = intel_user_framebuffer_destroy, 1247 .create_handle = intel_user_framebuffer_create_handle, 1248 .dirty = intel_user_framebuffer_dirty, 1249 }; 1250 1251 int intel_framebuffer_init(struct intel_framebuffer *intel_fb, 1252 struct drm_i915_gem_object *obj, 1253 struct drm_mode_fb_cmd2 *mode_cmd) 1254 { 1255 struct drm_i915_private *dev_priv = to_i915(obj->base.dev); 1256 struct drm_framebuffer *fb = &intel_fb->base; 1257 u32 max_stride; 1258 unsigned int tiling, stride; 1259 int ret = -EINVAL; 1260 int i; 1261 1262 intel_fb->frontbuffer = intel_frontbuffer_get(obj); 1263 if (!intel_fb->frontbuffer) 1264 return -ENOMEM; 1265 1266 i915_gem_object_lock(obj, NULL); 1267 tiling = i915_gem_object_get_tiling(obj); 1268 stride = i915_gem_object_get_stride(obj); 1269 i915_gem_object_unlock(obj); 1270 1271 if (mode_cmd->flags & DRM_MODE_FB_MODIFIERS) { 1272 /* 1273 * If there's a fence, enforce that 1274 * the fb modifier and tiling mode match. 1275 */ 1276 if (tiling != I915_TILING_NONE && 1277 tiling != intel_fb_modifier_to_tiling(mode_cmd->modifier[0])) { 1278 drm_dbg_kms(&dev_priv->drm, 1279 "tiling_mode doesn't match fb modifier\n"); 1280 goto err; 1281 } 1282 } else { 1283 if (tiling == I915_TILING_X) { 1284 mode_cmd->modifier[0] = I915_FORMAT_MOD_X_TILED; 1285 } else if (tiling == I915_TILING_Y) { 1286 drm_dbg_kms(&dev_priv->drm, 1287 "No Y tiling for legacy addfb\n"); 1288 goto err; 1289 } 1290 } 1291 1292 if (!drm_any_plane_has_format(&dev_priv->drm, 1293 mode_cmd->pixel_format, 1294 mode_cmd->modifier[0])) { 1295 drm_dbg_kms(&dev_priv->drm, 1296 "unsupported pixel format %p4cc / modifier 0x%llx\n", 1297 &mode_cmd->pixel_format, mode_cmd->modifier[0]); 1298 goto err; 1299 } 1300 1301 /* 1302 * gen2/3 display engine uses the fence if present, 1303 * so the tiling mode must match the fb modifier exactly. 1304 */ 1305 if (DISPLAY_VER(dev_priv) < 4 && 1306 tiling != intel_fb_modifier_to_tiling(mode_cmd->modifier[0])) { 1307 drm_dbg_kms(&dev_priv->drm, 1308 "tiling_mode must match fb modifier exactly on gen2/3\n"); 1309 goto err; 1310 } 1311 1312 max_stride = intel_fb_max_stride(dev_priv, mode_cmd->pixel_format, 1313 mode_cmd->modifier[0]); 1314 if (mode_cmd->pitches[0] > max_stride) { 1315 drm_dbg_kms(&dev_priv->drm, 1316 "%s pitch (%u) must be at most %d\n", 1317 mode_cmd->modifier[0] != DRM_FORMAT_MOD_LINEAR ? 1318 "tiled" : "linear", 1319 mode_cmd->pitches[0], max_stride); 1320 goto err; 1321 } 1322 1323 /* 1324 * If there's a fence, enforce that 1325 * the fb pitch and fence stride match. 1326 */ 1327 if (tiling != I915_TILING_NONE && mode_cmd->pitches[0] != stride) { 1328 drm_dbg_kms(&dev_priv->drm, 1329 "pitch (%d) must match tiling stride (%d)\n", 1330 mode_cmd->pitches[0], stride); 1331 goto err; 1332 } 1333 1334 /* FIXME need to adjust LINOFF/TILEOFF accordingly. */ 1335 if (mode_cmd->offsets[0] != 0) { 1336 drm_dbg_kms(&dev_priv->drm, 1337 "plane 0 offset (0x%08x) must be 0\n", 1338 mode_cmd->offsets[0]); 1339 goto err; 1340 } 1341 1342 drm_helper_mode_fill_fb_struct(&dev_priv->drm, fb, mode_cmd); 1343 1344 for (i = 0; i < fb->format->num_planes; i++) { 1345 u32 stride_alignment; 1346 1347 if (mode_cmd->handles[i] != mode_cmd->handles[0]) { 1348 drm_dbg_kms(&dev_priv->drm, "bad plane %d handle\n", 1349 i); 1350 goto err; 1351 } 1352 1353 stride_alignment = intel_fb_stride_alignment(fb, i); 1354 if (fb->pitches[i] & (stride_alignment - 1)) { 1355 drm_dbg_kms(&dev_priv->drm, 1356 "plane %d pitch (%d) must be at least %u byte aligned\n", 1357 i, fb->pitches[i], stride_alignment); 1358 goto err; 1359 } 1360 1361 if (is_gen12_ccs_plane(fb, i) && !is_gen12_ccs_cc_plane(fb, i)) { 1362 int ccs_aux_stride = gen12_ccs_aux_stride(fb, i); 1363 > 1364 if (fb->pitches[i] != ccs_aux_stride) { 1365 drm_dbg_kms(&dev_priv->drm, 1366 "ccs aux plane %d pitch (%d) must be %d\n", 1367 i, 1368 fb->pitches[i], ccs_aux_stride); 1369 goto err; 1370 } 1371 } 1372 1373 /* TODO: Add POT stride remapping support for CCS formats as well. */ 1374 if (IS_ALDERLAKE_P(dev_priv) && 1375 mode_cmd->modifier[i] != DRM_FORMAT_MOD_LINEAR && 1376 !intel_fb_needs_pot_stride_remap(intel_fb) && 1377 !is_power_of_2(mode_cmd->pitches[i])) { 1378 drm_dbg_kms(&dev_priv->drm, 1379 "plane %d pitch (%d) must be power of two for tiled buffers\n", 1380 i, mode_cmd->pitches[i]); 1381 goto err; 1382 } 1383 1384 fb->obj[i] = &obj->base; 1385 } 1386 1387 ret = intel_fill_fb_info(dev_priv, intel_fb); 1388 if (ret) 1389 goto err; 1390 1391 if (intel_fb_uses_dpt(fb)) { 1392 struct i915_address_space *vm; 1393 1394 vm = intel_dpt_create(intel_fb); 1395 if (IS_ERR(vm)) { 1396 ret = PTR_ERR(vm); 1397 goto err; 1398 } 1399 1400 intel_fb->dpt_vm = vm; 1401 } 1402 1403 ret = drm_framebuffer_init(&dev_priv->drm, fb, &intel_fb_funcs); 1404 if (ret) { 1405 drm_err(&dev_priv->drm, "framebuffer init failed %d\n", ret); 1406 goto err; 1407 } 1408 1409 return 0; 1410 1411 err: 1412 intel_frontbuffer_put(intel_fb->frontbuffer); 1413 return ret; 1414 } 1415 1416 struct drm_framebuffer * > 1417 intel_user_framebuffer_create(struct drm_device *dev, 1418 struct drm_file *filp, 1419 const struct drm_mode_fb_cmd2 *user_mode_cmd) 1420 { 1421 struct drm_framebuffer *fb; 1422 struct drm_i915_gem_object *obj; 1423 struct drm_mode_fb_cmd2 mode_cmd = *user_mode_cmd; 1424 struct drm_i915_private *i915; 1425 1426 obj = i915_gem_object_lookup(filp, mode_cmd.handles[0]); 1427 if (!obj) 1428 return ERR_PTR(-ENOENT); 1429 1430 /* object is backed with LMEM for discrete */ 1431 i915 = to_i915(obj->base.dev); 1432 if (HAS_LMEM(i915) && !i915_gem_object_can_migrate(obj, INTEL_REGION_LMEM)) { 1433 /* object is "remote", not in local memory */ 1434 i915_gem_object_put(obj); 1435 return ERR_PTR(-EREMOTE); 1436 } 1437 1438 fb = intel_framebuffer_create(obj, &mode_cmd); 1439 i915_gem_object_put(obj); 1440 1441 return fb; 1442 } 1443 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip