-
Notifications
You must be signed in to change notification settings - Fork 341
Conversation
render/egl.c
Outdated
@@ -343,6 +337,52 @@ EGLImage wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, | |||
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT; | |||
attribs[atti++] = attributes->modifier[0] >> 32; | |||
} | |||
|
|||
if (attributes->n_planes > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer to do this in some kind of loop rather than as 3 if-statements with copypasta'd bodies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the same but since the constants vary (they have the plane number included) I went that way. Otherwise we'd have to setup all 5 constants upfront with 5 arrays:
pitch_ex_consts[] = [ EGL_DMABUF_PLANE0_PITCH_EX, EGL_DMABUF_PLANE1_EX, ...]
(same for fd, offset, modifier_lo, modifier_hi) and loop over these too or use some macro magic so I went for the open coded version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather set up the array like you suppose.
It turns out egl on my intel advertises NV12 (#726) but not the buffer modifier used by weston-simple-dmabuf-drm (MOD_SAMSUNG_64_32_TILE). If I use another buffer modifier I get something rendered so it doesn't look too bad. |
Nice! Can you provide a weston-simple-dmabuf-drm patch so we can try it? |
It really only disables the modifier atm: so it displays only garbage but we can see that the multiple planes get added at least. |
@emersion I have a more complete NV12 test client now https://github.com/agx/weston/tree/nv12 it renders correctly on weston but rootston seems to pick up the first plane as RGB, I'll have a look |
This renders correctly on my intel card. Besides @SirCmpwn comment I need to cleanup the last patch that handles GL_TEXTURE_EXTERNAL_OES. |
render/egl.c
Outdated
@@ -365,6 +359,52 @@ EGLImage wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, | |||
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT; | |||
attribs[atti++] = attributes->modifier[0] >> 32; | |||
} | |||
|
|||
if (attributes->n_planes > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're adding plane 0 to the array twice.
On Mon, Mar 19, 2018 at 01:37:01PM -0700, Scott Anderson wrote:
ascent12 commented on this pull request.
> @@ -365,6 +359,52 @@ EGLImage wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
attribs[atti++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
attribs[atti++] = attributes->modifier[0] >> 32;
}
+
+ if (attributes->n_planes > 0) {
You're adding plane 0 to the array twice.
Thanks for catching that!
|
34e900c
to
dce155e
Compare
Depends on #736 which should go in first. |
render/egl.c
Outdated
} | ||
} | ||
|
||
|
||
attribs[atti++] = EGL_NONE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe adding an assertion here would be safer:
assert(atti < sizeof(attribs)/sizeof(attribs[0]));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the size of attribs is fixed we're safe but in case we change the number of planes we might forget to increase it so I added the assert.
Is it expected that XRGB and NV12 don't render the same image? |
@emersion where do we render a different image? |
I mean, |
@SirCmpwn is using a loop for the attributes a must have? I do like the open coded version better since it makes it obvious what's happening. Once we support > 4 planes I would agree to not open code it. |
@emersion ahh...thought so. Yes, I didn't bother to reproduce it exactly for the time being, it will make it simpler to find out which method is actually used. |
I don't believe any format exists that has more than 4 planes. In fact, I don't know of any formats with more than 3, although I guess the 4th plane could be for an alpha channel or something. I'd much prefer a loop as well. Unrolling is fine for maybe a few lines of code, but what's going on there is too much. |
@ascent12 I don't think we'll have more than 4 planes anytime soon either (in fact NV12 only uses two and for YUV we have more work ahead). I'll use a loop then. |
Removed the unrolled loop now |
render/egl.c
Outdated
EGL_DMA_BUF_PLANE ## N ## _PITCH_EXT, \ | ||
EGL_DMA_BUF_PLANE ## N ## _MODIFIER_LO_EXT, \ | ||
EGL_DMA_BUF_PLANE ## N ## _MODIFIER_HI_EXT \ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use macros, find another way
LGTM aside from the macro |
On Wed, Mar 21, 2018 at 02:13:51PM +0000, Drew DeVault wrote:
LGTM aside from the macro
Droped the macro in favour or spelled out constants.
|
It seems the macro is still here. |
On Wed, Mar 21, 2018 at 05:42:02PM +0000, emersion wrote:
>Droped the macro in favour or spelled out constants.
It seems the macro is still here.
Oh my, fixed now.
|
Rebased against recent gles2 changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
On Fri, Mar 23, 2018 at 01:41:41PM +0000, Drew DeVault wrote:
Merged #724.
Thanks for pulling this in.
|
Thanks for the hard work! |
This aims to add support for formats with more than one plane like NV12.
Test plan
The drivers I have don't support NV12 but maybe someone's does. Therefore marking as WiP since I can't really test it atm but I'll see if can come up with s.th. else that has more than one plane.
According to https://cgit.freedesktop.org/wayland/weston/commit/?id=ee58911912d88caacf340a5cb6a9e25fcba24996 freedreno supports NV12 if somebody running rootston on freedreno could test it that would be great.