modesetting/drmmode: Use drmModeGetFB2
Hi Emil,
Quoted 6 lines · Emil Velikov
Quoted 5 lines · Daniel Stone
Much like AddFB -> AddFB2, GetFB2 lets us get multiple buffers back as well as modifier information. This lets us use -background none with multiplanar formats, or modifiers which can't be inferred via a magic side channel.
Quoted 7 lines
AFAICT there's nothing special (or wrong) with the new API.
The flags field is a bit of an open question - should Xserver or libdrm manage the value passed to the kernel?
Analogously - should we pass the flags back to the user (drmModeFB2::flags)?Current design seems perfectly fine IMHO, although others might disagree.
Thanks for looking at this! I think the flags question is a good one, and that we should probably make the field RW: userspace declaring what it supports (analagous to AddFB2), and the kernel overwriting that with the intersection of what userspace and the kernel support (not analogous, but since it's a getter rather than an add ...).
Quoted 4 lines
Quoted 4 lines
(quoted diff) +0
-0@@ -1090,31 +1094,63 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) if (pixmap) return pixmap;
Quoted 9 lines
Review create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) · line 1098
Quoted 5 lines
(quoted diff) +2
-3- fbcon = drmModeGetFB(drmmode->fd, fbcon_id); - if (fbcon == NULL) - return NULL; + fbcon2 = drmModeGetFB2(drmmode->fd, fbcon_id); + if (fbcon2) {Declare and initialize fbcon2 in one go - C99 feature that everyone has (even the people who use MSVC to build Xserver & friends). Then wrap the whole fbcon2 hunk in a #ifdef
HAVE_GETFB2+ add a configure/meson check.
Sure; the only reason I didn't add an ifdef check is because there's no version released with it yet.
Quoted 2 lines
Alternatively add a weak drmModeGetFB2 function which returns NULL and forget all the above ;-)
If you have a good suggestion for implementing weak symbols then I'm all ears, but last I saw from the Mesa experience no-one could figure out how to do it properly.
Quoted 10 lines
Review create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) · line 1107
Quoted 9 lines
(quoted diff) +9
-0+ width = fbcon2->width; + height = fbcon2->height; + memcpy(handles, fbcon2->handles, sizeof(handles)); + memcpy(strides, fbcon2->pitches, sizeof(strides)); + memcpy(offsets, fbcon2->offsets, sizeof(offsets)); + modifier = fbcon2->modifier; + switch (fbcon2->pixel_format) { + case DRM_FORMAT_RGB565: + depth = 16;Missing bpp?
Correct.
Quoted 2 lines
Idea: Instead of introducing another format <> {depth, bpp} mapping, might as well add some helpers?
I can only see that mapping inside drmmode_create_bo, which is different as it creates everything with an alpha channel, i.e. s/XRGB/ARGB/. Are there some others I'm missing?
Quoted 11 lines
Review create_pixmap_for_fbcon(drmmode_ptr drmmode, ScrnInfoPtr pScrn, int fbcon_id) · line 1117
Quoted 10 lines
(quoted diff) +10
-0+ break; + case DRM_FORMAT_XRGB8888: + depth = 24; + bpp = 32; + break; + case DRM_FORMAT_XRGB2101010: + depth = 30; + bpp = 32; + default: + break;Error instead of silently continuing?
Sure.
Cheers,
Daniel
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel