Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Nov 9, 2024
1 parent abd5853 commit 588893c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
9 changes: 6 additions & 3 deletions src/allocator/DRMDumb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ Aquamarine::CDRMDumbBuffer::CDRMDumbBuffer(const SAllocatorBufferParams& params,
size = request.size;
pixelSize = {(double)request.width, (double)request.height};

attrs.size = pixelSize;
attrs.fd = request.handle;
attrs.size = pixelSize;
attrs.fd = request.handle;
attrs.stride = stride;

drm_mode_map_dumb request2 = {
.handle = handle,
Expand Down Expand Up @@ -115,7 +116,9 @@ Aquamarine::CDRMDumbAllocator::~CDRMDumbAllocator() {
}

SP<CDRMDumbAllocator> Aquamarine::CDRMDumbAllocator::create(int drmfd_, Hyprutils::Memory::CWeakPointer<CBackend> backend_) {
return SP<CDRMDumbAllocator>(new CDRMDumbAllocator(drmfd_, backend_));
auto a = SP<CDRMDumbAllocator>(new CDRMDumbAllocator(drmfd_, backend_));
a->self = a;
return a;
}

SP<IBuffer> Aquamarine::CDRMDumbAllocator::acquire(const SAllocatorBufferParams& params, SP<CSwapchain> swapchain_) {
Expand Down
25 changes: 15 additions & 10 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ std::vector<SP<CDRMBackend>> Aquamarine::CDRMBackend::attempt(SP<CBackend> backe
newPrimary = drmBackend;
}

drmBackend->dumbAllocator = CDRMDumbAllocator::create(gpu->fd, backend);

backends.emplace_back(drmBackend);

// so that session can handle udev change/remove events for this gpu
Expand Down Expand Up @@ -1652,19 +1654,24 @@ SP<IBackendImplementation> Aquamarine::CDRMOutput::getBackend() {
}

bool Aquamarine::CDRMOutput::setCursor(SP<IBuffer> buffer, const Vector2D& hotspot) {
auto bufferType = buffer->type();

if ((bufferType == eBufferType::BUFFER_TYPE_SHM && !buffer->shm().success) || (bufferType == eBufferType::BUFFER_TYPE_DMABUF && !buffer->dmabuf().success)) {
backend->backend->log(AQ_LOG_ERROR, "drm: Invalid buffer passed to setCursor");
return false;
}

if (!connector->crtc)
return false;

if (!buffer)
setCursorVisible(false);
else {
auto bufferType = buffer->type();

if (!buffer->good()) {
backend->backend->log(AQ_LOG_ERROR, "drm: bad buffer passed to setCursor");
return false;
}

if ((bufferType == eBufferType::BUFFER_TYPE_SHM && !buffer->shm().success) || (bufferType == eBufferType::BUFFER_TYPE_DMABUF && !buffer->dmabuf().success)) {
backend->backend->log(AQ_LOG_ERROR, "drm: Invalid buffer passed to setCursor");
return false;
}

SP<CDRMFB> fb;

if (backend->primary) {
Expand Down Expand Up @@ -1933,10 +1940,8 @@ uint32_t Aquamarine::CDRMFB::submitBuffer() {
uint32_t newID = 0;

if (buffer->type() == eBufferType::BUFFER_TYPE_DMABUF) {

auto attrs = buffer->dmabuf();

std::array<uint64_t, 4> mods = {0, 0, 0, 0};
std::array<uint64_t, 4> mods = {0, 0, 0, 0};
for (size_t i = 0; i < attrs.planes; ++i) {
mods[i] = attrs.modifier;
}
Expand Down

0 comments on commit 588893c

Please sign in to comment.