Skip to content

Commit

Permalink
linux-dmabuf: Fix rendering issue introduced in commit 9e6529c
Browse files Browse the repository at this point in the history
As the modifiers are collected in a uint64_t array, the function called for each
item of the array needs to use the same type so that bit shift operations don't
result to invalid modifiers.

Issue detected by the mighty Žan Doberšek.

(cherry picked from commit 31db973)
  • Loading branch information
philn authored and aperezdc committed Mar 15, 2019
1 parent 77c2f27 commit 148d41a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/linux-dmabuf/linux-dmabuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ bind_linux_dmabuf(struct wl_client *client, void *data, uint32_t version, uint32
wl_resource_set_implementation(resource, &linux_dmabuf_implementation,
data, NULL);

WS::Instance::singleton().foreachDmaBufModifier([version, resource] (int format, int modifier) {
WS::Instance::singleton().foreachDmaBufModifier([version, resource] (int format, uint64_t modifier) {
if (version >= ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION) {
uint32_t modifier_lo = modifier & 0xFFFFFFFF;
uint32_t modifier_hi = modifier >> 32;
Expand Down
2 changes: 1 addition & 1 deletion src/ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ const struct linux_dmabuf_buffer* Instance::getDmaBufBuffer(struct wl_resource*
return NULL;
}

void Instance::foreachDmaBufModifier(std::function<void (int format, int modifier)> callback)
void Instance::foreachDmaBufModifier(std::function<void (int format, uint64_t modifier)> callback)
{
if (m_eglDisplay == EGL_NO_DISPLAY)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/ws.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Instance {

void importDmaBufBuffer(struct linux_dmabuf_buffer*);
const struct linux_dmabuf_buffer* getDmaBufBuffer(struct wl_resource*) const;
void foreachDmaBufModifier(std::function<void (int format, int modifier)>);
void foreachDmaBufModifier(std::function<void (int format, uint64_t modifier)>);

private:
Instance();
Expand Down

0 comments on commit 148d41a

Please sign in to comment.