Commit 7cd467d0 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/gma500: Introduce GEM object functions

GEM object functions deprecate several similar callback interfaces in
struct drm_driver. This patch replaces the per-driver callbacks with
per-instance callbacks in gma500.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923102159.24084-6-tzimmermann@suse.de
parent a64325a1
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include "framebuffer.h" #include "framebuffer.h"
#include "gem.h"
#include "gtt.h" #include "gtt.h"
#include "psb_drv.h" #include "psb_drv.h"
#include "psb_intel_drv.h" #include "psb_intel_drv.h"
...@@ -285,6 +286,7 @@ static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size) ...@@ -285,6 +286,7 @@ static struct gtt_range *psbfb_alloc(struct drm_device *dev, int aligned_size)
/* Begin by trying to use stolen memory backing */ /* Begin by trying to use stolen memory backing */
backing = psb_gtt_alloc_range(dev, aligned_size, "fb", 1, PAGE_SIZE); backing = psb_gtt_alloc_range(dev, aligned_size, "fb", 1, PAGE_SIZE);
if (backing) { if (backing) {
backing->gem.funcs = &psb_gem_object_funcs;
drm_gem_private_object_init(dev, &backing->gem, aligned_size); drm_gem_private_object_init(dev, &backing->gem, aligned_size);
return backing; return backing;
} }
......
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
#include "psb_drv.h" #include "psb_drv.h"
void psb_gem_free_object(struct drm_gem_object *obj) static vm_fault_t psb_gem_fault(struct vm_fault *vmf);
static void psb_gem_free_object(struct drm_gem_object *obj)
{ {
struct gtt_range *gtt = container_of(obj, struct gtt_range, gem); struct gtt_range *gtt = container_of(obj, struct gtt_range, gem);
...@@ -36,6 +38,17 @@ int psb_gem_get_aperture(struct drm_device *dev, void *data, ...@@ -36,6 +38,17 @@ int psb_gem_get_aperture(struct drm_device *dev, void *data,
return -EINVAL; return -EINVAL;
} }
static const struct vm_operations_struct psb_gem_vm_ops = {
.fault = psb_gem_fault,
.open = drm_gem_vm_open,
.close = drm_gem_vm_close,
};
const struct drm_gem_object_funcs psb_gem_object_funcs = {
.free = psb_gem_free_object,
.vm_ops = &psb_gem_vm_ops,
};
/** /**
* psb_gem_create - create a mappable object * psb_gem_create - create a mappable object
* @file: the DRM file of the client * @file: the DRM file of the client
...@@ -63,6 +76,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size, ...@@ -63,6 +76,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size,
dev_err(dev->dev, "no memory for %lld byte GEM object\n", size); dev_err(dev->dev, "no memory for %lld byte GEM object\n", size);
return -ENOSPC; return -ENOSPC;
} }
r->gem.funcs = &psb_gem_object_funcs;
/* Initialize the extra goodies GEM needs to do all the hard work */ /* Initialize the extra goodies GEM needs to do all the hard work */
if (drm_gem_object_init(dev, &r->gem, size) != 0) { if (drm_gem_object_init(dev, &r->gem, size) != 0) {
psb_gtt_free_range(dev, r); psb_gtt_free_range(dev, r);
...@@ -123,7 +137,7 @@ int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev, ...@@ -123,7 +137,7 @@ int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
* vma->vm_private_data points to the GEM object that is backing this * vma->vm_private_data points to the GEM object that is backing this
* mapping. * mapping.
*/ */
vm_fault_t psb_gem_fault(struct vm_fault *vmf) static vm_fault_t psb_gem_fault(struct vm_fault *vmf)
{ {
struct vm_area_struct *vma = vmf->vma; struct vm_area_struct *vma = vmf->vma;
struct drm_gem_object *obj; struct drm_gem_object *obj;
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#ifndef _GEM_H #ifndef _GEM_H
#define _GEM_H #define _GEM_H
extern const struct drm_gem_object_funcs psb_gem_object_funcs;
extern int psb_gem_create(struct drm_file *file, struct drm_device *dev, extern int psb_gem_create(struct drm_file *file, struct drm_device *dev,
u64 size, u32 *handlep, int stolen, u32 align); u64 size, u32 *handlep, int stolen, u32 align);
#endif #endif
...@@ -480,12 +480,6 @@ static const struct dev_pm_ops psb_pm_ops = { ...@@ -480,12 +480,6 @@ static const struct dev_pm_ops psb_pm_ops = {
.runtime_idle = psb_runtime_idle, .runtime_idle = psb_runtime_idle,
}; };
static const struct vm_operations_struct psb_gem_vm_ops = {
.fault = psb_gem_fault,
.open = drm_gem_vm_open,
.close = drm_gem_vm_close,
};
static const struct file_operations psb_gem_fops = { static const struct file_operations psb_gem_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = drm_open, .open = drm_open,
...@@ -507,9 +501,6 @@ static struct drm_driver driver = { ...@@ -507,9 +501,6 @@ static struct drm_driver driver = {
.irq_uninstall = psb_irq_uninstall, .irq_uninstall = psb_irq_uninstall,
.irq_handler = psb_irq_handler, .irq_handler = psb_irq_handler,
.gem_free_object_unlocked = psb_gem_free_object,
.gem_vm_ops = &psb_gem_vm_ops,
.dumb_create = psb_gem_dumb_create, .dumb_create = psb_gem_dumb_create,
.ioctls = psb_ioctls, .ioctls = psb_ioctls,
.fops = &psb_gem_fops, .fops = &psb_gem_fops,
......
...@@ -735,12 +735,10 @@ extern const struct drm_connector_helper_funcs ...@@ -735,12 +735,10 @@ extern const struct drm_connector_helper_funcs
extern const struct drm_connector_funcs psb_intel_lvds_connector_funcs; extern const struct drm_connector_funcs psb_intel_lvds_connector_funcs;
/* gem.c */ /* gem.c */
extern void psb_gem_free_object(struct drm_gem_object *obj);
extern int psb_gem_get_aperture(struct drm_device *dev, void *data, extern int psb_gem_get_aperture(struct drm_device *dev, void *data,
struct drm_file *file); struct drm_file *file);
extern int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev, extern int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args); struct drm_mode_create_dumb *args);
extern vm_fault_t psb_gem_fault(struct vm_fault *vmf);
/* psb_device.c */ /* psb_device.c */
extern const struct psb_ops psb_chip_ops; extern const struct psb_ops psb_chip_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment