Short summary of fixes pull: bridge: - fix OF-node leak - fix documentation fbdev-emulation: - pass correct format info to drm_helper_mode_fill_fb_struct() panfrost: - print correct RSS size Signed-off-by: Dave Airlie <airlied@redhat.com>
Unified · Split
| @@ -18,6 +18,7 @@ static void drm_aux_bridge_release(struct device *dev) · 17 unmodified lines | ||
| 18 | 18 | { |
| 19 | 19 | struct auxiliary_device *adev = to_auxiliary_dev(dev); |
| 20 | 20 | |
| 21 | + of_node_put(dev->of_node); | |
| 21 | 22 | ida_free(&drm_aux_bridge_ida, adev->id); |
| 22 | 23 | |
| 23 | 24 | kfree(adev); |
| @@ -65,6 +66,7 @@ int drm_aux_bridge_register(struct device *parent) · 41 unmodified lines | ||
| 65 | 66 | |
| 66 | 67 | ret = auxiliary_device_init(adev); |
| 67 | 68 | if (ret) { |
| 69 | + of_node_put(adev->dev.of_node); | |
| 68 | 70 | ida_free(&drm_aux_bridge_ida, adev->id); |
| 69 | 71 | kfree(adev); |
| 70 | 72 | return ret; |
| @@ -1227,6 +1227,7 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_check); · 1226 unmodified lines | ||
| 1227 | 1227 | /** |
| 1228 | 1228 | * drm_bridge_detect - check if anything is attached to the bridge output |
| 1229 | 1229 | * @bridge: bridge control structure |
| 1230 | + * @connector: attached connector | |
| 1230 | 1231 | * |
| 1231 | 1232 | * If the bridge supports output detection, as reported by the |
| 1232 | 1233 | * DRM_BRIDGE_OP_DETECT bridge ops flag, call &drm_bridge_funcs.detect for the |
| @@ -253,6 +253,7 @@ nouveau_check_bl_size(struct nouveau_drm *drm, struct nouveau_bo *nvbo, · 252 unmodified lines | ||
| 253 | 253 | |
| 254 | 254 | int |
| 255 | 255 | nouveau_framebuffer_new(struct drm_device *dev, |
| 256 | + const struct drm_format_info *info, | |
| 256 | 257 | const struct drm_mode_fb_cmd2 *mode_cmd, |
| 257 | 258 | struct drm_gem_object *gem, |
| 258 | 259 | struct drm_framebuffer **pfb) |
| @@ -260,7 +261,6 @@ nouveau_framebuffer_new(struct drm_device *dev, · 1 unmodified line | ||
| 260 | 261 | struct nouveau_drm *drm = nouveau_drm(dev); |
| 261 | 262 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); |
| 262 | 263 | struct drm_framebuffer *fb; |
| 263 | − const struct drm_format_info *info; | |
| 264 | 264 | unsigned int height, i; |
| 265 | 265 | uint32_t tile_mode; |
| 266 | 266 | uint8_t kind; |
| @@ -295,9 +295,6 @@ nouveau_framebuffer_new(struct drm_device *dev, · 28 unmodified lines | ||
| 295 | 295 | kind = nvbo->kind; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | − info = drm_get_format_info(dev, mode_cmd->pixel_format, | |
| 299 | − mode_cmd->modifier[0]); | |
| 300 | − | |
| 301 | 298 | for (i = 0; i < info->num_planes; i++) { |
| 302 | 299 | height = drm_format_info_plane_height(info, |
| 303 | 300 | mode_cmd->height, |
| @@ -321,7 +318,7 @@ nouveau_framebuffer_new(struct drm_device *dev, · 17 unmodified lines | ||
| 321 | 318 | if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL))) |
| 322 | 319 | return -ENOMEM; |
| 323 | 320 | |
| 324 | − drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd); | |
| 321 | + drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd); | |
| 325 | 322 | fb->obj[0] = gem; |
| 326 | 323 | |
| 327 | 324 | ret = drm_framebuffer_init(dev, fb, &nouveau_framebuffer_funcs); |
| @@ -344,7 +341,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev, · 16 unmodified lines | ||
| 344 | 341 | if (!gem) |
| 345 | 342 | return ERR_PTR(-ENOENT); |
| 346 | 343 | |
| 347 | − ret = nouveau_framebuffer_new(dev, mode_cmd, gem, &fb); | |
| 344 | + ret = nouveau_framebuffer_new(dev, info, mode_cmd, gem, &fb); | |
| 348 | 345 | if (ret == 0) |
| 349 | 346 | return fb; |
| 350 | 347 | |
| @@ -8,8 +8,11 @@ · 7 unmodified lines | ||
| 8 | 8 | |
| 9 | 9 | #include <drm/drm_framebuffer.h> |
| 10 | 10 | |
| 11 | +struct drm_format_info; | |
| 12 | + | |
| 11 | 13 | int |
| 12 | 14 | nouveau_framebuffer_new(struct drm_device *dev, |
| 15 | + const struct drm_format_info *info, | |
| 13 | 16 | const struct drm_mode_fb_cmd2 *mode_cmd, |
| 14 | 17 | struct drm_gem_object *gem, |
| 15 | 18 | struct drm_framebuffer **pfb); |
| @@ -351,7 +351,7 @@ struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, · 350 unmodified lines | ||
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | − fb = omap_framebuffer_init(dev, mode_cmd, bos); | |
| 354 | + fb = omap_framebuffer_init(dev, info, mode_cmd, bos); | |
| 355 | 355 | if (IS_ERR(fb)) |
| 356 | 356 | goto error; |
| 357 | 357 | |
| @@ -365,9 +365,9 @@ error: · 7 unmodified lines | ||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, |
| 368 | + const struct drm_format_info *info, | |
| 368 | 369 | const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos) |
| 369 | 370 | { |
| 370 | − const struct drm_format_info *format = NULL; | |
| 371 | 371 | struct omap_framebuffer *omap_fb = NULL; |
| 372 | 372 | struct drm_framebuffer *fb = NULL; |
| 373 | 373 | unsigned int pitch = mode_cmd->pitches[0]; |
| @@ -377,15 +377,12 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, · 3 unmodified lines | ||
| 377 | 377 | dev, mode_cmd, mode_cmd->width, mode_cmd->height, |
| 378 | 378 | (char *)&mode_cmd->pixel_format); |
| 379 | 379 | |
| 380 | − format = drm_get_format_info(dev, mode_cmd->pixel_format, | |
| 381 | − mode_cmd->modifier[0]); | |
| 382 | − | |
| 383 | 380 | for (i = 0; i < ARRAY_SIZE(formats); i++) { |
| 384 | 381 | if (formats[i] == mode_cmd->pixel_format) |
| 385 | 382 | break; |
| 386 | 383 | } |
| 387 | 384 | |
| 388 | − if (!format || i == ARRAY_SIZE(formats)) { | |
| 385 | + if (i == ARRAY_SIZE(formats)) { | |
| 389 | 386 | dev_dbg(dev->dev, "unsupported pixel format: %4.4s\n", |
| 390 | 387 | (char *)&mode_cmd->pixel_format); |
| 391 | 388 | ret = -EINVAL; |
| @@ -399,7 +396,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, · 7 unmodified lines | ||
| 399 | 396 | } |
| 400 | 397 | |
| 401 | 398 | fb = &omap_fb->base; |
| 402 | − omap_fb->format = format; | |
| 399 | + omap_fb->format = info; | |
| 403 | 400 | mutex_init(&omap_fb->lock); |
| 404 | 401 | |
| 405 | 402 | /* |
| @@ -407,23 +404,23 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, · 1 unmodified line | ||
| 407 | 404 | * that the two planes of multiplane formats need the same number of |
| 408 | 405 | * bytes per pixel. |
| 409 | 406 | */ |
| 410 | − if (format->num_planes == 2 && pitch != mode_cmd->pitches[1]) { | |
| 407 | + if (info->num_planes == 2 && pitch != mode_cmd->pitches[1]) { | |
| 411 | 408 | dev_dbg(dev->dev, "pitches differ between planes 0 and 1\n"); |
| 412 | 409 | ret = -EINVAL; |
| 413 | 410 | goto fail; |
| 414 | 411 | } |
| 415 | 412 | |
| 416 | − if (pitch % format->cpp[0]) { | |
| 413 | + if (pitch % info->cpp[0]) { | |
| 417 | 414 | dev_dbg(dev->dev, |
| 418 | 415 | "buffer pitch (%u bytes) is not a multiple of pixel size (%u bytes)\n", |
| 419 | − pitch, format->cpp[0]); | |
| 416 | + pitch, info->cpp[0]); | |
| 420 | 417 | ret = -EINVAL; |
| 421 | 418 | goto fail; |
| 422 | 419 | } |
| 423 | 420 | |
| 424 | − for (i = 0; i < format->num_planes; i++) { | |
| 421 | + for (i = 0; i < info->num_planes; i++) { | |
| 425 | 422 | struct plane *plane = &omap_fb->planes[i]; |
| 426 | − unsigned int vsub = i == 0 ? 1 : format->vsub; | |
| 423 | + unsigned int vsub = i == 0 ? 1 : info->vsub; | |
| 427 | 424 | unsigned int size; |
| 428 | 425 | |
| 429 | 426 | size = pitch * mode_cmd->height / vsub; |
| @@ -440,7 +437,7 @@ struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, · 10 unmodified lines | ||
| 440 | 437 | plane->dma_addr = 0; |
| 441 | 438 | } |
| 442 | 439 | |
| 443 | − drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd); | |
| 440 | + drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd); | |
| 444 | 441 | |
| 445 | 442 | ret = drm_framebuffer_init(dev, fb, &omap_framebuffer_funcs); |
| 446 | 443 | if (ret) { |
| @@ -13,6 +13,7 @@ struct drm_connector; · 12 unmodified lines | ||
| 13 | 13 | struct drm_device; |
| 14 | 14 | struct drm_file; |
| 15 | 15 | struct drm_framebuffer; |
| 16 | +struct drm_format_info; | |
| 16 | 17 | struct drm_gem_object; |
| 17 | 18 | struct drm_mode_fb_cmd2; |
| 18 | 19 | struct drm_plane_state; |
| @@ -23,6 +24,7 @@ struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, · 4 unmodified lines | ||
| 23 | 24 | struct drm_file *file, const struct drm_format_info *info, |
| 24 | 25 | const struct drm_mode_fb_cmd2 *mode_cmd); |
| 25 | 26 | struct drm_framebuffer *omap_framebuffer_init(struct drm_device *dev, |
| 27 | + const struct drm_format_info *info, | |
| 26 | 28 | const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos); |
| 27 | 29 | int omap_framebuffer_pin(struct drm_framebuffer *fb); |
| 28 | 30 | void omap_framebuffer_unpin(struct drm_framebuffer *fb); |
| @@ -197,7 +197,10 @@ int omap_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper, · 196 unmodified lines | ||
| 197 | 197 | goto fail; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | − fb = omap_framebuffer_init(dev, &mode_cmd, &bo); | |
| 200 | + fb = omap_framebuffer_init(dev, | |
| 201 | + drm_get_format_info(dev, mode_cmd.pixel_format, | |
| 202 | + mode_cmd.modifier[0]), | |
| 203 | + &mode_cmd, &bo); | |
| 201 | 204 | if (IS_ERR(fb)) { |
| 202 | 205 | dev_err(dev->dev, "failed to allocate fb\n"); |
| 203 | 206 | /* note: if fb creation failed, we can't rely on fb destroy |
| @@ -432,7 +432,7 @@ static void panfrost_gem_debugfs_bo_print(struct panfrost_gem_object *bo, · 431 unmodified lines | ||
| 432 | 432 | if (!refcount) |
| 433 | 433 | return; |
| 434 | 434 | |
| 435 | − resident_size = bo->base.pages ? bo->base.base.size : 0; | |
| 435 | + resident_size = panfrost_gem_rss(&bo->base.base); | |
| 436 | 436 | |
| 437 | 437 | snprintf(creator_info, sizeof(creator_info), |
| 438 | 438 | "%s/%d", bo->debugfs.creator.process_name, bo->debugfs.creator.tgid); |
| @@ -1297,12 +1297,13 @@ static const struct drm_framebuffer_funcs radeon_fb_funcs = { · 1296 unmodified lines | ||
| 1297 | 1297 | int |
| 1298 | 1298 | radeon_framebuffer_init(struct drm_device *dev, |
| 1299 | 1299 | struct drm_framebuffer *fb, |
| 1300 | + const struct drm_format_info *info, | |
| 1300 | 1301 | const struct drm_mode_fb_cmd2 *mode_cmd, |
| 1301 | 1302 | struct drm_gem_object *obj) |
| 1302 | 1303 | { |
| 1303 | 1304 | int ret; |
| 1304 | 1305 | fb->obj[0] = obj; |
| 1305 | − drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd); | |
| 1306 | + drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd); | |
| 1306 | 1307 | ret = drm_framebuffer_init(dev, fb, &radeon_fb_funcs); |
| 1307 | 1308 | if (ret) { |
| 1308 | 1309 | fb->obj[0] = NULL; |
| @@ -1341,7 +1342,7 @@ radeon_user_framebuffer_create(struct drm_device *dev, · 32 unmodified lines | ||
| 1341 | 1342 | return ERR_PTR(-ENOMEM); |
| 1342 | 1343 | } |
| 1343 | 1344 | |
| 1344 | − ret = radeon_framebuffer_init(dev, fb, mode_cmd, obj); | |
| 1345 | + ret = radeon_framebuffer_init(dev, fb, info, mode_cmd, obj); | |
| 1345 | 1346 | if (ret) { |
| 1346 | 1347 | kfree(fb); |
| 1347 | 1348 | drm_gem_object_put(obj); |
| @@ -53,10 +53,10 @@ static void radeon_fbdev_destroy_pinned_object(struct drm_gem_object *gobj) · 52 unmodified lines | ||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | static int radeon_fbdev_create_pinned_object(struct drm_fb_helper *fb_helper, |
| 56 | + const struct drm_format_info *info, | |
| 56 | 57 | struct drm_mode_fb_cmd2 *mode_cmd, |
| 57 | 58 | struct drm_gem_object **gobj_p) |
| 58 | 59 | { |
| 59 | − const struct drm_format_info *info; | |
| 60 | 60 | struct radeon_device *rdev = fb_helper->dev->dev_private; |
| 61 | 61 | struct drm_gem_object *gobj = NULL; |
| 62 | 62 | struct radeon_bo *rbo = NULL; |
| @@ -67,8 +67,6 @@ static int radeon_fbdev_create_pinned_object(struct drm_fb_helper *fb_helper, · 4 unmodified lines | ||
| 67 | 67 | int height = mode_cmd->height; |
| 68 | 68 | u32 cpp; |
| 69 | 69 | |
| 70 | − info = drm_get_format_info(rdev_to_drm(rdev), mode_cmd->pixel_format, | |
| 71 | − mode_cmd->modifier[0]); | |
| 72 | 70 | cpp = info->cpp[0]; |
| 73 | 71 | |
| 74 | 72 | /* need to align pitch with crtc limits */ |
| @@ -206,6 +204,7 @@ int radeon_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper, · 131 unmodified lines | ||
| 206 | 204 | struct drm_fb_helper_surface_size *sizes) |
| 207 | 205 | { |
| 208 | 206 | struct radeon_device *rdev = fb_helper->dev->dev_private; |
| 207 | + const struct drm_format_info *format_info; | |
| 209 | 208 | struct drm_mode_fb_cmd2 mode_cmd = { }; |
| 210 | 209 | struct fb_info *info; |
| 211 | 210 | struct drm_gem_object *gobj; |
| @@ -224,7 +223,9 @@ int radeon_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper, · 12 unmodified lines | ||
| 224 | 223 | mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, |
| 225 | 224 | sizes->surface_depth); |
| 226 | 225 | |
| 227 | − ret = radeon_fbdev_create_pinned_object(fb_helper, &mode_cmd, &gobj); | |
| 226 | + format_info = drm_get_format_info(rdev_to_drm(rdev), mode_cmd.pixel_format, | |
| 227 | + mode_cmd.modifier[0]); | |
| 228 | + ret = radeon_fbdev_create_pinned_object(fb_helper, format_info, &mode_cmd, &gobj); | |
| 228 | 229 | if (ret) { |
| 229 | 230 | DRM_ERROR("failed to create fbcon object %d\n", ret); |
| 230 | 231 | return ret; |
| @@ -236,7 +237,7 @@ int radeon_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper, · 5 unmodified lines | ||
| 236 | 237 | ret = -ENOMEM; |
| 237 | 238 | goto err_radeon_fbdev_destroy_pinned_object; |
| 238 | 239 | } |
| 239 | − ret = radeon_framebuffer_init(rdev_to_drm(rdev), fb, &mode_cmd, gobj); | |
| 240 | + ret = radeon_framebuffer_init(rdev_to_drm(rdev), fb, format_info, &mode_cmd, gobj); | |
| 240 | 241 | if (ret) { |
| 241 | 242 | DRM_ERROR("failed to initialize framebuffer %d\n", ret); |
| 242 | 243 | goto err_kfree; |
| @@ -40,6 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | |
| 41 | 41 | struct drm_fb_helper; |
| 42 | 42 | struct drm_fb_helper_surface_size; |
| 43 | +struct drm_format_info; | |
| 43 | 44 | |
| 44 | 45 | struct edid; |
| 45 | 46 | struct drm_edid; |
| @@ -890,6 +891,7 @@ extern void · 844 unmodified lines | ||
| 890 | 891 | radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on); |
| 891 | 892 | int radeon_framebuffer_init(struct drm_device *dev, |
| 892 | 893 | struct drm_framebuffer *rfb, |
| 894 | + const struct drm_format_info *info, | |
| 893 | 895 | const struct drm_mode_fb_cmd2 *mode_cmd, |
| 894 | 896 | struct drm_gem_object *obj); |
| 895 | 897 | |
| @@ -866,13 +866,61 @@ struct drm_bridge_funcs { · 865 unmodified lines | ||
| 866 | 866 | struct drm_connector *connector, |
| 867 | 867 | bool enable, int direction); |
| 868 | 868 | |
| 869 | + /** | |
| 870 | + * @hdmi_cec_init: | |
| 871 | + * | |
| 872 | + * Initialize CEC part of the bridge. | |
| 873 | + * | |
| 874 | + * This callback is optional, it can be implemented by bridges that | |
| 875 | + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their | |
| 876 | + * &drm_bridge->ops. | |
| 877 | + * | |
| 878 | + * Returns: | |
| 879 | + * 0 on success, a negative error code otherwise | |
| 880 | + */ | |
| 869 | 881 | int (*hdmi_cec_init)(struct drm_bridge *bridge, |
| 870 | 882 | struct drm_connector *connector); |
| 871 | 883 | |
| 884 | + /** | |
| 885 | + * @hdmi_cec_enable: | |
| 886 | + * | |
| 887 | + * Enable or disable the CEC adapter inside the bridge. | |
| 888 | + * | |
| 889 | + * This callback is optional, it can be implemented by bridges that | |
| 890 | + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their | |
| 891 | + * &drm_bridge->ops. | |
| 892 | + * | |
| 893 | + * Returns: | |
| 894 | + * 0 on success, a negative error code otherwise | |
| 895 | + */ | |
| 872 | 896 | int (*hdmi_cec_enable)(struct drm_bridge *bridge, bool enable); |
| 873 | 897 | |
| 898 | + /** | |
| 899 | + * @hdmi_cec_log_addr: | |
| 900 | + * | |
| 901 | + * Set the logical address of the CEC adapter inside the bridge. | |
| 902 | + * | |
| 903 | + * This callback is optional, it can be implemented by bridges that | |
| 904 | + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their | |
| 905 | + * &drm_bridge->ops. | |
| 906 | + * | |
| 907 | + * Returns: | |
| 908 | + * 0 on success, a negative error code otherwise | |
| 909 | + */ | |
| 874 | 910 | int (*hdmi_cec_log_addr)(struct drm_bridge *bridge, u8 logical_addr); |
| 875 | 911 | |
| 912 | + /** | |
| 913 | + * @hdmi_cec_transmit: | |
| 914 | + * | |
| 915 | + * Transmit the message using the CEC adapter inside the bridge. | |
| 916 | + * | |
| 917 | + * This callback is optional, it can be implemented by bridges that | |
| 918 | + * set the @DRM_BRIDGE_OP_HDMI_CEC_ADAPTER flag in their | |
| 919 | + * &drm_bridge->ops. | |
| 920 | + * | |
| 921 | + * Returns: | |
| 922 | + * 0 on success, a negative error code otherwise | |
| 923 | + */ | |
| 876 | 924 | int (*hdmi_cec_transmit)(struct drm_bridge *bridge, u8 attempts, |
| 877 | 925 | u32 signal_free_time, struct cec_msg *msg); |
| 878 | 926 | |