diff options
author | Dave Airlie <airlied@redhat.com> | 2017-05-17 22:57:06 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-05-17 22:57:06 -0400 |
commit | e98c58e55f68f8785aebfab1f8c9a03d8de0afe1 (patch) | |
tree | 8357e8fda6efb0867ac39fc6b9211a579721d00a /drivers/gpu/drm/vc4/vc4_validate.c | |
parent | 2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff) | |
parent | 9cf8f5802f39d9991158b29033c852bccfc3a4d4 (diff) |
Merge tag 'drm-misc-next-2017-05-16' of git://anongit.freedesktop.org/git/drm-misc into drm-next
UAPI Changes:
- Return -ENODEV instead of -ENXIO when creating cma fb w/o valid gem (Daniel)
- Add aspect ratio and custom scaling propertis to connector state (Maarten)
Cross-subsystem Changes:
- None
Core Changes:
- Add Laurent as bridge reviewer and Andrzej as bridge maintainer (Archit)
- Maintain new STM driver through -misc (Yannick)
- Misc doc improvements (as is tradition) (Daniel)
- Add driver-private objects to atomic state (Dhinakaran)
- Deprecate preclose hook in modern drivers (use postclose) (Daniel)
- Add hwmode to vblank struct. This fixes mode access in irq context and reduced
a bunch of boilerplate (Daniel)
Driver Changes:
- vc4: Add out-fence support to vc4 V3D rendering (Eric)
- stm: Add stm32f429 display hw and am-480272h3tmqw-t01h panel support (Yannick)
- vc4: Remove 256MB cma limit from vc4 (Eric)
- dw-hdmi: Disable audio when inactive, instead of always enabled (Romain)
- zte: Add support for VGA to the ZTE driver (Shawn)
- i915: Track DP MST bandwidth and check it in atomic_check (Dhinakaran)
- vgem: Enable gem dmabuf import iface to facilitate ion testing (Laura)
- vc4: Add support for Cygnus (new dt compat string + couple bug fixes) (Eric)
- pl111: Add driver for pl111 CLCD display controller (Eric/Tom)
- vgem: Subclass drm_device instead of standalone platform device (Chris)
Cc: Archit Taneja <architt@codeaurora.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Yannick Fertre <yannick.fertre@st.com>
Cc: Romain Perier <romain.perier@collabora.com>
Cc: Navare, Manasi D <manasi.d.navare@intel.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Tom Cooksey <tom.cooksey@arm.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
* tag 'drm-misc-next-2017-05-16' of git://anongit.freedesktop.org/git/drm-misc: (72 commits)
drm: add missing declaration to drm_blend.h
drm/dp: Wait up all outstanding tx waiters
drm/dp: Read the tx msg state once after checking for an event
drm/prime: Forward declare struct device
drm/vblank: Lock down vblank->hwmode more
drm/vblank: drop the mode argument from drm_calc_vbltimestamp_from_scanoutpos
drm/vblank: Add FIXME comments about moving the vblank ts hooks
drm/vblank: Switch to bool in_vblank_irq in get_vblank_timestamp
drm/vblank: Switch drm_driver->get_vblank_timestamp to return a bool
drm/vgem: Convert to a struct drm_device subclass
gpu: drm: gma500: remove dead code
drm/sti: Adjust two checks for null pointers in sti_hqvdp_probe()
drm/sti: Fix typos in a comment line
drm/sti: Fix a typo in a comment line
drm/sti: Replace 17 seq_puts() calls by seq_putc()
drm/sti: Reduce function calls for sequence output at five places
drm/sti: use seq_puts to display a string
drm: Nerf the preclose callback for modern drivers
drm/exynos: Merge pre/postclose hooks
drm/tegra: switch to postclose
...
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_validate.c')
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_validate.c | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c index da6f1e138e8d..3de8f11595c0 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c +++ b/drivers/gpu/drm/vc4/vc4_validate.c | |||
@@ -348,10 +348,11 @@ static int | |||
348 | validate_tile_binning_config(VALIDATE_ARGS) | 348 | validate_tile_binning_config(VALIDATE_ARGS) |
349 | { | 349 | { |
350 | struct drm_device *dev = exec->exec_bo->base.dev; | 350 | struct drm_device *dev = exec->exec_bo->base.dev; |
351 | struct vc4_bo *tile_bo; | 351 | struct vc4_dev *vc4 = to_vc4_dev(dev); |
352 | uint8_t flags; | 352 | uint8_t flags; |
353 | uint32_t tile_state_size, tile_alloc_size; | 353 | uint32_t tile_state_size; |
354 | uint32_t tile_count; | 354 | uint32_t tile_count, bin_addr; |
355 | int bin_slot; | ||
355 | 356 | ||
356 | if (exec->found_tile_binning_mode_config_packet) { | 357 | if (exec->found_tile_binning_mode_config_packet) { |
357 | DRM_ERROR("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); | 358 | DRM_ERROR("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); |
@@ -377,13 +378,28 @@ validate_tile_binning_config(VALIDATE_ARGS) | |||
377 | return -EINVAL; | 378 | return -EINVAL; |
378 | } | 379 | } |
379 | 380 | ||
381 | bin_slot = vc4_v3d_get_bin_slot(vc4); | ||
382 | if (bin_slot < 0) { | ||
383 | if (bin_slot != -EINTR && bin_slot != -ERESTARTSYS) { | ||
384 | DRM_ERROR("Failed to allocate binner memory: %d\n", | ||
385 | bin_slot); | ||
386 | } | ||
387 | return bin_slot; | ||
388 | } | ||
389 | |||
390 | /* The slot we allocated will only be used by this job, and is | ||
391 | * free when the job completes rendering. | ||
392 | */ | ||
393 | exec->bin_slots |= BIT(bin_slot); | ||
394 | bin_addr = vc4->bin_bo->base.paddr + bin_slot * vc4->bin_alloc_size; | ||
395 | |||
380 | /* The tile state data array is 48 bytes per tile, and we put it at | 396 | /* The tile state data array is 48 bytes per tile, and we put it at |
381 | * the start of a BO containing both it and the tile alloc. | 397 | * the start of a BO containing both it and the tile alloc. |
382 | */ | 398 | */ |
383 | tile_state_size = 48 * tile_count; | 399 | tile_state_size = 48 * tile_count; |
384 | 400 | ||
385 | /* Since the tile alloc array will follow us, align. */ | 401 | /* Since the tile alloc array will follow us, align. */ |
386 | exec->tile_alloc_offset = roundup(tile_state_size, 4096); | 402 | exec->tile_alloc_offset = bin_addr + roundup(tile_state_size, 4096); |
387 | 403 | ||
388 | *(uint8_t *)(validated + 14) = | 404 | *(uint8_t *)(validated + 14) = |
389 | ((flags & ~(VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK | | 405 | ((flags & ~(VC4_BIN_CONFIG_ALLOC_INIT_BLOCK_SIZE_MASK | |
@@ -394,35 +410,13 @@ validate_tile_binning_config(VALIDATE_ARGS) | |||
394 | VC4_SET_FIELD(VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128, | 410 | VC4_SET_FIELD(VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE_128, |
395 | VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE)); | 411 | VC4_BIN_CONFIG_ALLOC_BLOCK_SIZE)); |
396 | 412 | ||
397 | /* Initial block size. */ | ||
398 | tile_alloc_size = 32 * tile_count; | ||
399 | |||
400 | /* | ||
401 | * The initial allocation gets rounded to the next 256 bytes before | ||
402 | * the hardware starts fulfilling further allocations. | ||
403 | */ | ||
404 | tile_alloc_size = roundup(tile_alloc_size, 256); | ||
405 | |||
406 | /* Add space for the extra allocations. This is what gets used first, | ||
407 | * before overflow memory. It must have at least 4096 bytes, but we | ||
408 | * want to avoid overflow memory usage if possible. | ||
409 | */ | ||
410 | tile_alloc_size += 1024 * 1024; | ||
411 | |||
412 | tile_bo = vc4_bo_create(dev, exec->tile_alloc_offset + tile_alloc_size, | ||
413 | true); | ||
414 | exec->tile_bo = &tile_bo->base; | ||
415 | if (IS_ERR(exec->tile_bo)) | ||
416 | return PTR_ERR(exec->tile_bo); | ||
417 | list_add_tail(&tile_bo->unref_head, &exec->unref_list); | ||
418 | |||
419 | /* tile alloc address. */ | 413 | /* tile alloc address. */ |
420 | *(uint32_t *)(validated + 0) = (exec->tile_bo->paddr + | 414 | *(uint32_t *)(validated + 0) = exec->tile_alloc_offset; |
421 | exec->tile_alloc_offset); | ||
422 | /* tile alloc size. */ | 415 | /* tile alloc size. */ |
423 | *(uint32_t *)(validated + 4) = tile_alloc_size; | 416 | *(uint32_t *)(validated + 4) = (bin_addr + vc4->bin_alloc_size - |
417 | exec->tile_alloc_offset); | ||
424 | /* tile state address. */ | 418 | /* tile state address. */ |
425 | *(uint32_t *)(validated + 8) = exec->tile_bo->paddr; | 419 | *(uint32_t *)(validated + 8) = bin_addr; |
426 | 420 | ||
427 | return 0; | 421 | return 0; |
428 | } | 422 | } |