1
0
Fork 0

MA-16168 [#imx-1903] Fix GPU driver build error and not work issue on 5.4 kernel

Some drm common code changed, gpu driver need do the matched update on 5.4 kernel.
1. Some drm API name changed.
   drm_gem_object_unreference_unlocked() rename as drm_gem_object_put_unlocked().
   drm_dev_unref() rename as drm_dev_put().
2. Drm/prime remove DRIVER_PRIME, driver needs do the matched update.
3. API gem_prime_export remove input parameter "struct drm_device *dev".

Signed-off-by: Richard Liu <xuegang.liu@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Richard Liu 2019-12-25 08:59:25 +00:00 committed by Xianzhong
parent 61c15e448d
commit 9821cda510
2 changed files with 16 additions and 0 deletions

View File

@ -188,6 +188,11 @@ struct drm_viv_gem_ref_node {
#define DRM_IOCTL_VIV_GEM_ATTACH_AUX DRM_IOWR(DRM_COMMAND_BASE + DRM_VIV_GEM_ATTACH_AUX, struct drm_viv_gem_attach_aux)
#define DRM_IOCTL_VIV_GEM_REF_NODE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIV_GEM_REF_NODE, struct drm_viv_gem_ref_node)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
#define drm_gem_object_unreference_unlocked drm_gem_object_put_unlocked
#define drm_dev_unref drm_dev_put
#endif
#if defined(__cplusplus)
}
#endif

View File

@ -75,10 +75,17 @@ struct viv_gem_object {
gctBOOL cacheable;
};
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
struct dma_buf *viv_gem_prime_export(struct drm_gem_object *gem_obj,
int flags)
{
struct drm_device *drm = gem_obj->dev;
#else
struct dma_buf *viv_gem_prime_export(struct drm_device *drm,
struct drm_gem_object *gem_obj,
int flags)
{
#endif
struct viv_gem_object *viv_obj = container_of(gem_obj, struct viv_gem_object, base);
struct dma_buf *dmabuf = gcvNULL;
gckGALDEVICE gal_dev = (gckGALDEVICE)drm->dev_private;
@ -776,7 +783,11 @@ static const struct file_operations viv_drm_fops = {
};
static struct drm_driver viv_drm_driver = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0)
.driver_features = DRIVER_GEM | DRIVER_RENDER,
#else
.driver_features = DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER,
#endif
.open = viv_drm_open,
.postclose = viv_drm_postclose,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)