aboutsummaryrefslogtreecommitdiff
path: root/include/backend/drm/drm.h
diff options
context:
space:
mode:
authorVincent Vanlaer <vincent.vanlaer@skynet.be>2019-02-04 20:47:07 +0100
committerVincent Vanlaer <vincent.vanlaer@skynet.be>2019-02-04 20:47:07 +0100
commit7bc43413edc2db04bbfba395f9606957ff2fa21c (patch)
tree84d41957d4f0a9fe3d8ae7018b45beac6cf27e5c /include/backend/drm/drm.h
parent28f11aec3106c5d0528d1835055c82c4d571c286 (diff)
Allow cursor render surface to be used as fb
In order for a surface to be used as a cursor plane framebuffer, it appears that requiring the buffer to be linear is sufficient. GBM_BO_USE_SCANOUT is added in case GBM_BO_USE_LINEAR isn't sufficient on untested hardware. Fixes #1323 Removed wlr_drm_plane.cursor_bo as it does not serve any purpose anymore. Relevant analysis (taken from the PR description): While trying to implement a fix for #1323, I found that when exporting the rendered surface into a DMA-BUF and reimporting it with `GBM_BO_USE_CURSOR`, the resulting object does not appear to be valid. After some digging (turning on drm-kms debugging and switching to legacy mode), I managed to extract the following error: ``` [drm:__setplane_check.isra.1 [drm]] Invalid pixel format AR24 little-endian (0x34325241), modifier 0x100000000000001 ``` The format itself refers to ARGB8888 which is the same format as `renderer->gbm_format` used in master to create the cursor bo. However, using `gbm_bo_create` with `GBM_BO_USE_CURSOR` results in a modifier of 0. A modifier of zero represents a linear buffer while the modifier of the surface that is rendered to is `I915_FORMAT_MOD_X_TILED` (see https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/uapi/drm/drm_fourcc.h?h=v4.20.6#n263). In order to fix this mismatch in modifier, I added the `GBM_BO_USE_LINEAR` to the render surface and everything started to work just fine. I wondered however, whether the export and import is really necessary. I then decided to test if the back buffer of the render surface works as well, and at least on my hardware (Intel HD 530 and Intel UHD 620) it does. This is the patch in this PR and this requires no exporting and importing. I have to note that I cheated in order to import DMA_BUFs into a cursor bo when doing the first tests, since on import the Intel drivers check that the cursor is 64x64. This is strange since cursor sizes other than 64x64 have been around for quite some time now (https://lists.freedesktop.org/archives/mesa-commit/2014-June/050268.html). Removing this check made everything work fine. I later (while writing this PR) found out that `__DRI_IMAGE_USE_CURSOR` (to which `GBM_BO_USE_CURSOR` translates) has been deprecated in mesa (https://gitlab.freedesktop.org/mesa/mesa/blob/master/include/GL/internal/dri_interface.h#L1296), which makes me wonder what the usecase of `GBM_BO_USE_CURSOR` is. The reason we never encountered this is that when specifying `GBM_BO_USE_WRITE`, a dumb buffer is created trough DRM and the usage flag never reaches the Intel driver directly. The relevant code is in https://gitlab.freedesktop.org/mesa/mesa/blob/master/src/gbm/backends/dri/gbm_dri.c#L1011-1089 . From this it seems that as long as the size, format and modifiers are right, any surface can be used as a cursor.
Diffstat (limited to 'include/backend/drm/drm.h')
-rw-r--r--include/backend/drm/drm.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index 37d9828f..c94d4f7d 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -30,7 +30,6 @@ struct wlr_drm_plane {
// Only used by cursor
float matrix[9];
- struct gbm_bo *cursor_bo;
bool cursor_enabled;
int32_t cursor_hotspot_x, cursor_hotspot_y;