[PATCH RFC 031/111] staging: etnaviv: add gem operations structure to etnaviv objects
Lucas Stach
l.stach at pengutronix.de
Thu Apr 2 08:29:33 PDT 2015
From: Russell King <rmk+kernel at arm.linux.org.uk>
Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
drivers/staging/etnaviv/etnaviv_gem.c | 4 +++-
drivers/staging/etnaviv/etnaviv_gem.h | 7 +++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c
index 9e3cd61507d1..eface33ad445 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.c
+++ b/drivers/staging/etnaviv/etnaviv_gem.c
@@ -536,7 +536,9 @@ static void etnaviv_free_obj(struct drm_gem_object *obj)
drm_gem_free_mmap_offset(obj);
- if (obj->import_attach) {
+ if (etnaviv_obj->ops) {
+ etnaviv_obj->ops->release(etnaviv_obj);
+ } else if (obj->import_attach) {
if (etnaviv_obj->vaddr)
dma_buf_vunmap(obj->import_attach->dmabuf,
etnaviv_obj->vaddr);
diff --git a/drivers/staging/etnaviv/etnaviv_gem.h b/drivers/staging/etnaviv/etnaviv_gem.h
index 97302ca6efaa..676cbd46c600 100644
--- a/drivers/staging/etnaviv/etnaviv_gem.h
+++ b/drivers/staging/etnaviv/etnaviv_gem.h
@@ -21,8 +21,11 @@
#include <linux/reservation.h>
#include "etnaviv_drv.h"
+struct etnaviv_gem_ops;
+
struct etnaviv_gem_object {
struct drm_gem_object base;
+ const struct etnaviv_gem_ops *ops;
uint32_t flags;
@@ -64,6 +67,10 @@ struct etnaviv_gem_object {
};
#define to_etnaviv_bo(x) container_of(x, struct etnaviv_gem_object, base)
+struct etnaviv_gem_ops {
+ void (*release)(struct etnaviv_gem_object *);
+};
+
static inline bool is_active(struct etnaviv_gem_object *etnaviv_obj)
{
return etnaviv_obj->gpu != NULL;
--
2.1.4
More information about the dri-devel
mailing list