drm/vkms: Add support for writeback module

Add enable_writeback feature to vkms_config as a module.

Signed-off-by: Sumera Priyadarsini <sylphrenadin@gmail.com>
Reviewed-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/15802da4f1cdfed2b728c3d35731732f161dd073.1610391685.git.sylphrenadin@gmail.com
This commit is contained in:
Sumera Priyadarsini 2021-01-12 00:37:22 +05:30 committed by Melissa Wen
parent 2df7af93fd
commit 1e85b7d427
3 changed files with 12 additions and 3 deletions

View File

@ -40,6 +40,10 @@ static bool enable_cursor = true;
module_param_named(enable_cursor, enable_cursor, bool, 0444);
MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support");
static bool enable_writeback = true;
module_param_named(enable_writeback, enable_writeback, bool, 0444);
MODULE_PARM_DESC(enable_writeback, "Enable/Disable writeback connector support");
DEFINE_DRM_GEM_FOPS(vkms_driver_fops);
static void vkms_release(struct drm_device *dev)
@ -189,6 +193,7 @@ static int __init vkms_init(void)
default_config = config;
config->cursor = enable_cursor;
config->writeback = enable_writeback;
return vkms_create(config);
}

View File

@ -83,6 +83,7 @@ struct vkms_output {
struct vkms_device;
struct vkms_config {
bool writeback;
bool cursor;
/* only set when instantiated */
struct vkms_device *dev;

View File

@ -41,6 +41,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
struct drm_crtc *crtc = &output->crtc;
struct drm_plane *primary, *cursor = NULL;
int ret;
int writeback;
primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index);
if (IS_ERR(primary))
@ -80,9 +81,11 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
goto err_attach;
}
ret = vkms_enable_writeback_connector(vkmsdev);
if (ret)
DRM_ERROR("Failed to init writeback connector\n");
if (vkmsdev->config->writeback) {
writeback = vkms_enable_writeback_connector(vkmsdev);
if (writeback)
DRM_ERROR("Failed to init writeback connector\n");
}
drm_mode_config_reset(dev);