Merge tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel into drm-next
First -misc pull for 4.10: - drm_format rework from Laurent - reservation patches from Chris that missed 4.9. - aspect ratio support in infoframe helpers and drm mode/edid code (Shashank Sharma) - rotation rework from Ville (first parts at least) - another attempt at the CRC debugfs interface from Tomeu - piles and piles of misc patches all over * tag 'topic/drm-misc-2016-10-24' of git://anongit.freedesktop.org/drm-intel: (55 commits) drm: Use u64 for intermediate dotclock calculations drm/i915: Use the per-plane rotation property drm/omap: Use per-plane rotation property drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 drm/atmel-hlcdc: Use per-plane rotation property drm/arm: Use per-plane rotation property drm: Add support for optional per-plane rotation property drm/atomic: Reject attempts to use multiple rotation angles at once drm: Add drm_rotation_90_or_270() dma-buf/sync_file: hold reference to fence when creating sync_file drm/virtio: kconfig: Fixup white space. drm/fence: release fence reference when canceling event drm/i915: Handle early failure during intel_get_load_detect_pipe drm/fb_cma_helper: do not free fbdev if there is none drm: fix sparse warnings on undeclared symbols in crc debugfs gpu: Remove depends on RESET_CONTROLLER when not a provider i915: don't call drm_atomic_state_put on invalid pointer drm: Don't export the drm_fb_get_bpp_depth() function drm/arm: mali-dp: Replace drm_fb_get_bpp_depth() with drm_format_plane_cpp() drm: vmwgfx: Replace drm_fb_get_bpp_depth() with drm_format_info() ...
This commit is contained in:
@@ -182,6 +182,16 @@ void fence_init(struct fence *fence, const struct fence_ops *ops,
|
||||
void fence_release(struct kref *kref);
|
||||
void fence_free(struct fence *fence);
|
||||
|
||||
/**
|
||||
* fence_put - decreases refcount of the fence
|
||||
* @fence: [in] fence to reduce refcount of
|
||||
*/
|
||||
static inline void fence_put(struct fence *fence)
|
||||
{
|
||||
if (fence)
|
||||
kref_put(&fence->refcount, fence_release);
|
||||
}
|
||||
|
||||
/**
|
||||
* fence_get - increases refcount of the fence
|
||||
* @fence: [in] fence to increase refcount of
|
||||
@@ -210,13 +220,49 @@ static inline struct fence *fence_get_rcu(struct fence *fence)
|
||||
}
|
||||
|
||||
/**
|
||||
* fence_put - decreases refcount of the fence
|
||||
* @fence: [in] fence to reduce refcount of
|
||||
* fence_get_rcu_safe - acquire a reference to an RCU tracked fence
|
||||
* @fence: [in] pointer to fence to increase refcount of
|
||||
*
|
||||
* Function returns NULL if no refcount could be obtained, or the fence.
|
||||
* This function handles acquiring a reference to a fence that may be
|
||||
* reallocated within the RCU grace period (such as with SLAB_DESTROY_BY_RCU),
|
||||
* so long as the caller is using RCU on the pointer to the fence.
|
||||
*
|
||||
* An alternative mechanism is to employ a seqlock to protect a bunch of
|
||||
* fences, such as used by struct reservation_object. When using a seqlock,
|
||||
* the seqlock must be taken before and checked after a reference to the
|
||||
* fence is acquired (as shown here).
|
||||
*
|
||||
* The caller is required to hold the RCU read lock.
|
||||
*/
|
||||
static inline void fence_put(struct fence *fence)
|
||||
static inline struct fence *fence_get_rcu_safe(struct fence * __rcu *fencep)
|
||||
{
|
||||
if (fence)
|
||||
kref_put(&fence->refcount, fence_release);
|
||||
do {
|
||||
struct fence *fence;
|
||||
|
||||
fence = rcu_dereference(*fencep);
|
||||
if (!fence || !fence_get_rcu(fence))
|
||||
return NULL;
|
||||
|
||||
/* The atomic_inc_not_zero() inside fence_get_rcu()
|
||||
* provides a full memory barrier upon success (such as now).
|
||||
* This is paired with the write barrier from assigning
|
||||
* to the __rcu protected fence pointer so that if that
|
||||
* pointer still matches the current fence, we know we
|
||||
* have successfully acquire a reference to it. If it no
|
||||
* longer matches, we are holding a reference to some other
|
||||
* reallocated pointer. This is possible if the allocator
|
||||
* is using a freelist like SLAB_DESTROY_BY_RCU where the
|
||||
* fence remains valid for the RCU grace period, but it
|
||||
* may be reallocated. When using such allocators, we are
|
||||
* responsible for ensuring the reference we get is to
|
||||
* the right fence, as below.
|
||||
*/
|
||||
if (fence == rcu_access_pointer(*fencep))
|
||||
return rcu_pointer_handoff(fence);
|
||||
|
||||
fence_put(fence);
|
||||
} while (1);
|
||||
}
|
||||
|
||||
int fence_signal(struct fence *fence);
|
||||
|
@@ -78,6 +78,8 @@ enum hdmi_picture_aspect {
|
||||
HDMI_PICTURE_ASPECT_NONE,
|
||||
HDMI_PICTURE_ASPECT_4_3,
|
||||
HDMI_PICTURE_ASPECT_16_9,
|
||||
HDMI_PICTURE_ASPECT_64_27,
|
||||
HDMI_PICTURE_ASPECT_256_135,
|
||||
HDMI_PICTURE_ASPECT_RESERVED,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user