Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions backend/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ bool Backend::IsClientLayer(HwcDisplay *display, HwcLayer *layer) {
!layer->IsLayerUsableAsDevice() ||
display->color_transform_hint() != HAL_COLOR_TRANSFORM_IDENTITY ||
(layer->GetLayerData().pi.RequireScalingOrPhasing() &&
display->GetHwc2()->GetResMan().ForcedScalingWithGpu()) ||
(!IsVideoLayer(layer) && IsDownScaling(layer)) ||
display->GetHwc2()->GetResMan().ForcedScalingWithGpu()) ||
(!IsVideoLayer(layer) && IsDownScaling(layer)) ||
(has_local_memory_flag(layer->GetLayerData().bi->usage) && !layer->GetAllowP2P()) ||
(!display->IsInHeadlessMode() && display->GetPipe().device->IsIvshmDev());
}

Expand Down
3 changes: 2 additions & 1 deletion hwc2_device/HwcLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ void HwcLayer::ImportFb() {
is_pixel_blend_mode_supported = false;

int kms_fd = parent_->GetPipe().device->GetFd();
bool use_shadow_fds = parent_->GetPipe().device->GetName() == "virtio_gpu" &&
bool use_shadow_fds = has_local_memory_flag(layer_data_.bi->usage) &&
parent_->GetPipe().device->GetName() == "virtio_gpu" &&
!allow_p2p_ && (intel_dgpu_fd() >= 0) &&
!virtio_gpu_allow_p2p(kms_fd) && InitializeBlitter(layer_data_.bi.value());
layer_data_.bi->use_shadow_fds = use_shadow_fds;
Expand Down
3 changes: 3 additions & 0 deletions hwc2_device/HwcLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class HwcLayer {
return layer_data_;
}

bool GetAllowP2P() const {
return allow_p2p_;
}
// Layer hooks
HWC2::Error SetCursorPosition(int32_t /*x*/, int32_t /*y*/);
HWC2::Error SetLayerBlendMode(int32_t mode);
Expand Down
6 changes: 6 additions & 0 deletions utils/intel_blit.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

#include "UniqueFd.h"

/* Buffer is allocated on dGPU local memory if this flag is set */
#define GRALLOC_USAGE_PRIVATE_2 (1ull << 30)

#define I915_TILING_4 9

struct intel_info {
Expand Down Expand Up @@ -49,6 +52,9 @@ int intel_create_buffer(struct intel_info *info,
uint64_t modifier, uint32_t *out_handle);
int intel_dgpu_fd();
bool virtio_gpu_allow_p2p(int virtgpu_fd);
inline bool has_local_memory_flag(uint64_t usage) {
return (usage & GRALLOC_USAGE_PRIVATE_2) != 0;
}

class IntelBlitter {
public:
Expand Down