diff mbox series

[19/22] drm/virtgpu: Use simple encoder

Message ID 20200305155950.2705-20-tzimmermann@suse.de (mailing list archive)
State Not Applicable
Headers show
Series drm: Convert drivers to drm_simple_encoder_init() | expand

Commit Message

Thomas Zimmermann March 5, 2020, 3:59 p.m. UTC
The virtgpu driver uses an empty implementation for its encoder. Replace
the code with the generic simple encoder.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

kernel test robot March 7, 2020, 3:40 p.m. UTC | #1
Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200305]
[cannot apply to rockchip/for-next shawnguo/for-next sunxi/sunxi/for-next tegra/for-next linus/master v5.6-rc4 v5.6-rc3 v5.6-rc2 v5.6-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Thomas-Zimmermann/drm-Convert-drivers-to-drm_simple_encoder_init/20200306-045931
base:    47466dcf84ee66a973ea7d2fca7e582fe9328932
config: i386-randconfig-h002-20200307 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/virtio/virtgpu_display.c: In function 'vgdev_output_init':
>> drivers/gpu/drm/virtio/virtgpu_display.c:276:2: error: implicit declaration of function 'drm_simple_encoder_init'; did you mean 'drm_encoder_init'? [-Werror=implicit-function-declaration]
     drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
     ^~~~~~~~~~~~~~~~~~~~~~~
     drm_encoder_init
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 3 include/linux/slab.h:kmalloc_type
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 4 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/drm/drm_modeset_helper_vtables.h:drm_crtc_helper_add
   Cyclomatic Complexity 1 include/drm/drm_modeset_helper_vtables.h:drm_encoder_helper_add
   Cyclomatic Complexity 1 include/drm/drm_modeset_helper_vtables.h:drm_connector_helper_add
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_enable
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_check
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_flush
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_enc_mode_set
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_enc_enable
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_enc_disable
   Cyclomatic Complexity 2 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_detect
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:vgdev_atomic_commit_tail
   Cyclomatic Complexity 67 include/asm-generic/getorder.h:get_order
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 2 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_framebuffer_init
   Cyclomatic Complexity 5 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_user_framebuffer_create
   Cyclomatic Complexity 5 drivers/gpu/drm/virtio/virtgpu_display.c:vgdev_output_init
   Cyclomatic Complexity 8 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_mode_valid
   Cyclomatic Complexity 4 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_get_modes
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_conn_destroy
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_atomic_disable
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_crtc_mode_set_nofb
   Cyclomatic Complexity 2 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_modeset_init
   Cyclomatic Complexity 2 drivers/gpu/drm/virtio/virtgpu_display.c:virtio_gpu_modeset_fini
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:_GLOBAL__sub_I_00100_0_virtio_gpu_modeset_init
   Cyclomatic Complexity 1 drivers/gpu/drm/virtio/virtgpu_display.c:_GLOBAL__sub_D_00100_1_virtio_gpu_modeset_init
   cc1: some warnings being treated as errors

vim +276 drivers/gpu/drm/virtio/virtgpu_display.c

   243	
   244	static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
   245	{
   246		struct drm_device *dev = vgdev->ddev;
   247		struct virtio_gpu_output *output = vgdev->outputs + index;
   248		struct drm_connector *connector = &output->conn;
   249		struct drm_encoder *encoder = &output->enc;
   250		struct drm_crtc *crtc = &output->crtc;
   251		struct drm_plane *primary, *cursor;
   252	
   253		output->index = index;
   254		if (index == 0) {
   255			output->info.enabled = cpu_to_le32(true);
   256			output->info.r.width = cpu_to_le32(XRES_DEF);
   257			output->info.r.height = cpu_to_le32(YRES_DEF);
   258		}
   259	
   260		primary = virtio_gpu_plane_init(vgdev, DRM_PLANE_TYPE_PRIMARY, index);
   261		if (IS_ERR(primary))
   262			return PTR_ERR(primary);
   263		cursor = virtio_gpu_plane_init(vgdev, DRM_PLANE_TYPE_CURSOR, index);
   264		if (IS_ERR(cursor))
   265			return PTR_ERR(cursor);
   266		drm_crtc_init_with_planes(dev, crtc, primary, cursor,
   267					  &virtio_gpu_crtc_funcs, NULL);
   268		drm_crtc_helper_add(crtc, &virtio_gpu_crtc_helper_funcs);
   269	
   270		drm_connector_init(dev, connector, &virtio_gpu_connector_funcs,
   271				   DRM_MODE_CONNECTOR_VIRTUAL);
   272		drm_connector_helper_add(connector, &virtio_gpu_conn_helper_funcs);
   273		if (vgdev->has_edid)
   274			drm_connector_attach_edid_property(connector);
   275	
 > 276		drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
   277		drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);
   278		encoder->possible_crtcs = 1 << index;
   279	
   280		drm_connector_attach_encoder(connector, encoder);
   281		drm_connector_register(connector);
   282		return 0;
   283	}
   284	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 2b7e6ae65546..cc7fd957a307 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -30,6 +30,7 @@ 
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
 
 #include "virtgpu_drv.h"
 
@@ -240,10 +241,6 @@  static const struct drm_connector_funcs virtio_gpu_connector_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
 
-static const struct drm_encoder_funcs virtio_gpu_enc_funcs = {
-	.destroy = drm_encoder_cleanup,
-};
-
 static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
 {
 	struct drm_device *dev = vgdev->ddev;
@@ -276,8 +273,7 @@  static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index)
 	if (vgdev->has_edid)
 		drm_connector_attach_edid_property(connector);
 
-	drm_encoder_init(dev, encoder, &virtio_gpu_enc_funcs,
-			 DRM_MODE_ENCODER_VIRTUAL, NULL);
+	drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_VIRTUAL);
 	drm_encoder_helper_add(encoder, &virtio_gpu_enc_helper_funcs);
 	encoder->possible_crtcs = 1 << index;