tree: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next head: 5ad8e63ebba3d5a0730b43180b200e41eeb9409c commit: c17d048609bf09d4fc78b02964e42eafb66a337e [5/6] drm/gud: Use the shadow plane helper config: mips-allmodconfig compiler: mips-linux-gcc (GCC) 12.1.0 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-misc git://anongit.freedesktop.org/drm/drm-misc git fetch --no-tags drm-misc drm-misc-next git checkout c17d048609bf09d4fc78b02964e42eafb66a337e # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/gpu/drm/gud/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All error/warnings (new ones prefixed by >>): drivers/gpu/drm/gud/gud_pipe.c: In function 'gud_fb_queue_damage': >> drivers/gpu/drm/gud/gud_pipe.c:396:36: error: implicit declaration of function 'vzalloc'; did you mean 'kvzalloc'? [-Werror=implicit-function-declaration] 396 | gdrm->shadow_buf = vzalloc(fb->pitches[0] * fb->height); | ^~~~~~~ | kvzalloc >> drivers/gpu/drm/gud/gud_pipe.c:396:34: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 396 | gdrm->shadow_buf = vzalloc(fb->pitches[0] * fb->height); | ^ drivers/gpu/drm/gud/gud_pipe.c: In function 'gud_pipe_update': >> drivers/gpu/drm/gud/gud_pipe.c:582:17: error: implicit declaration of function 'vfree'; did you mean 'kvfree'? [-Werror=implicit-function-declaration] 582 | vfree(gdrm->shadow_buf); | ^~~~~ | kvfree cc1: some warnings being treated as errors vim +396 drivers/gpu/drm/gud/gud_pipe.c 386 387 static int gud_fb_queue_damage(struct gud_device *gdrm, struct drm_framebuffer *fb, 388 const struct iosys_map *src, struct drm_rect *damage) 389 { 390 struct drm_framebuffer *old_fb = NULL; 391 struct iosys_map shadow_map; 392 393 mutex_lock(&gdrm->damage_lock); 394 395 if (!gdrm->shadow_buf) { > 396 gdrm->shadow_buf = vzalloc(fb->pitches[0] * fb->height); 397 if (!gdrm->shadow_buf) { 398 mutex_unlock(&gdrm->damage_lock); 399 return -ENOMEM; 400 } 401 } 402 403 iosys_map_set_vaddr(&shadow_map, gdrm->shadow_buf); 404 iosys_map_incr(&shadow_map, drm_fb_clip_offset(fb->pitches[0], fb->format, damage)); 405 drm_fb_memcpy(&shadow_map, fb->pitches, src, fb, damage); 406 407 if (fb != gdrm->fb) { 408 old_fb = gdrm->fb; 409 drm_framebuffer_get(fb); 410 gdrm->fb = fb; 411 } 412 413 gdrm->damage.x1 = min(gdrm->damage.x1, damage->x1); 414 gdrm->damage.y1 = min(gdrm->damage.y1, damage->y1); 415 gdrm->damage.x2 = max(gdrm->damage.x2, damage->x2); 416 gdrm->damage.y2 = max(gdrm->damage.y2, damage->y2); 417 418 mutex_unlock(&gdrm->damage_lock); 419 420 queue_work(system_long_wq, &gdrm->work); 421 422 if (old_fb) 423 drm_framebuffer_put(old_fb); 424 425 return 0; 426 } 427 428 static void gud_fb_handle_damage(struct gud_device *gdrm, struct drm_framebuffer *fb, 429 const struct iosys_map *src, struct drm_rect *damage) 430 { 431 int ret; 432 433 if (gdrm->flags & GUD_DISPLAY_FLAG_FULL_UPDATE) 434 drm_rect_init(damage, 0, 0, fb->width, fb->height); 435 436 if (gud_async_flush) { 437 ret = gud_fb_queue_damage(gdrm, fb, src, damage); 438 if (ret != -ENOMEM) 439 return; 440 } 441 442 /* Imported buffers are assumed to be WriteCombined with uncached reads */ 443 gud_flush_damage(gdrm, fb, src, !fb->obj[0]->import_attach, damage); 444 } 445 446 int gud_pipe_check(struct drm_simple_display_pipe *pipe, 447 struct drm_plane_state *new_plane_state, 448 struct drm_crtc_state *new_crtc_state) 449 { 450 struct gud_device *gdrm = to_gud_device(pipe->crtc.dev); 451 struct drm_plane_state *old_plane_state = pipe->plane.state; 452 const struct drm_display_mode *mode = &new_crtc_state->mode; 453 struct drm_atomic_state *state = new_plane_state->state; 454 struct drm_framebuffer *old_fb = old_plane_state->fb; 455 struct drm_connector_state *connector_state = NULL; 456 struct drm_framebuffer *fb = new_plane_state->fb; 457 const struct drm_format_info *format = fb->format; 458 struct drm_connector *connector; 459 unsigned int i, num_properties; 460 struct gud_state_req *req; 461 int idx, ret; 462 size_t len; 463 464 if (WARN_ON_ONCE(!fb)) 465 return -EINVAL; 466 467 if (old_plane_state->rotation != new_plane_state->rotation) 468 new_crtc_state->mode_changed = true; 469 470 if (old_fb && old_fb->format != format) 471 new_crtc_state->mode_changed = true; 472 473 if (!new_crtc_state->mode_changed && !new_crtc_state->connectors_changed) 474 return 0; 475 476 /* Only one connector is supported */ 477 if (hweight32(new_crtc_state->connector_mask) != 1) 478 return -EINVAL; 479 480 if (format->format == DRM_FORMAT_XRGB8888 && gdrm->xrgb8888_emulation_format) 481 format = gdrm->xrgb8888_emulation_format; 482 483 for_each_new_connector_in_state(state, connector, connector_state, i) { 484 if (connector_state->crtc) 485 break; 486 } 487 488 /* 489 * DRM_IOCTL_MODE_OBJ_SETPROPERTY on the rotation property will not have 490 * the connector included in the state. 491 */ 492 if (!connector_state) { 493 struct drm_connector_list_iter conn_iter; 494 495 drm_connector_list_iter_begin(pipe->crtc.dev, &conn_iter); 496 drm_for_each_connector_iter(connector, &conn_iter) { 497 if (connector->state->crtc) { 498 connector_state = connector->state; 499 break; 500 } 501 } 502 drm_connector_list_iter_end(&conn_iter); 503 } 504 505 if (WARN_ON_ONCE(!connector_state)) 506 return -ENOENT; 507 508 len = struct_size(req, properties, 509 GUD_PROPERTIES_MAX_NUM + GUD_CONNECTOR_PROPERTIES_MAX_NUM); 510 req = kzalloc(len, GFP_KERNEL); 511 if (!req) 512 return -ENOMEM; 513 514 gud_from_display_mode(&req->mode, mode); 515 516 req->format = gud_from_fourcc(format->format); 517 if (WARN_ON_ONCE(!req->format)) { 518 ret = -EINVAL; 519 goto out; 520 } 521 522 req->connector = drm_connector_index(connector_state->connector); 523 524 ret = gud_connector_fill_properties(connector_state, req->properties); 525 if (ret < 0) 526 goto out; 527 528 num_properties = ret; 529 for (i = 0; i < gdrm->num_properties; i++) { 530 u16 prop = gdrm->properties[i]; 531 u64 val; 532 533 switch (prop) { 534 case GUD_PROPERTY_ROTATION: 535 /* DRM UAPI matches the protocol so use value directly */ 536 val = new_plane_state->rotation; 537 break; 538 default: 539 WARN_ON_ONCE(1); 540 ret = -EINVAL; 541 goto out; 542 } 543 544 req->properties[num_properties + i].prop = cpu_to_le16(prop); 545 req->properties[num_properties + i].val = cpu_to_le64(val); 546 num_properties++; 547 } 548 549 if (drm_dev_enter(fb->dev, &idx)) { 550 len = struct_size(req, properties, num_properties); 551 ret = gud_usb_set(gdrm, GUD_REQ_SET_STATE_CHECK, 0, req, len); 552 drm_dev_exit(idx); 553 } else { 554 ret = -ENODEV; 555 } 556 out: 557 kfree(req); 558 559 return ret; 560 } 561 562 void gud_pipe_update(struct drm_simple_display_pipe *pipe, 563 struct drm_plane_state *old_state) 564 { 565 struct drm_device *drm = pipe->crtc.dev; 566 struct gud_device *gdrm = to_gud_device(drm); 567 struct drm_plane_state *state = pipe->plane.state; 568 struct drm_shadow_plane_state *shadow_plane_state = to_drm_shadow_plane_state(state); 569 struct drm_framebuffer *fb = state->fb; 570 struct drm_crtc *crtc = &pipe->crtc; 571 struct drm_rect damage; 572 int ret, idx; 573 574 if (crtc->state->mode_changed || !crtc->state->enable) { 575 cancel_work_sync(&gdrm->work); 576 mutex_lock(&gdrm->damage_lock); 577 if (gdrm->fb) { 578 drm_framebuffer_put(gdrm->fb); 579 gdrm->fb = NULL; 580 } 581 gud_clear_damage(gdrm); > 582 vfree(gdrm->shadow_buf); -- 0-DAY CI Kernel Test Service https://01.org/lkp