Skip to content

Commit

Permalink
i915: remove unused custom Android prime support
Browse files Browse the repository at this point in the history
Change-Id: Ieeb4eabad8f0b4a90b313c86b682084cbaeb869f
Signed-off-by: Dmitry Rogozhkin <[email protected]>
  • Loading branch information
dvrogozh committed Nov 12, 2018
1 parent f0f8fc0 commit 8fe32e6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 115 deletions.
8 changes: 0 additions & 8 deletions media_driver/linux/common/os/libdrm/include/mos_bufmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,6 @@ int mos_bo_get_tiling(struct mos_linux_bo *bo, uint32_t * tiling_mode,
uint32_t * swizzle_mode);

int mos_bo_flink(struct mos_linux_bo *bo, uint32_t * name);
#ifdef ANDROID
int mos_bo_prime(struct mos_linux_bo *bo, uint32_t * name);
#endif
int mos_bo_busy(struct mos_linux_bo *bo);
int mos_bo_madvise(struct mos_linux_bo *bo, int madv);
int mos_bo_use_48b_address_range(struct mos_linux_bo *bo, uint32_t enable);
Expand All @@ -206,11 +203,6 @@ int mos_bo_pad_to_size(struct mos_linux_bo *bo, uint64_t pad_to_size);

/* drm_intel_bufmgr_gem.c */
struct mos_bufmgr *mos_bufmgr_gem_init(int fd, int batch_size);
#ifdef ANDROID
struct mos_linux_bo *mos_bo_gem_create_from_prime_fd(struct mos_bufmgr *bufmgr,
const char *name,
unsigned int prime_fd);
#endif
struct mos_linux_bo *mos_bo_gem_create_from_name(struct mos_bufmgr *bufmgr,
const char *name,
unsigned int handle);
Expand Down
9 changes: 0 additions & 9 deletions media_driver/linux/common/os/libdrm/include/mos_bufmgr_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,6 @@ struct mos_bufmgr {
*/
int (*bo_flink) (struct mos_linux_bo *bo, uint32_t * name);

#ifdef ANDROID
/**
* Create a dma-buf prime fd for a buffer which can be used by other apps
*
* \param buf Buffer to create a prime fd for
* \param prime_fd Returned prime fd
*/
int (*bo_prime) (struct mos_linux_bo *bo, uint32_t * prime_fd);
#endif
/**
* Returns 1 if mapping the buffer for write could cause the process
* to block, due to the object being active in the GPU.
Expand Down
88 changes: 0 additions & 88 deletions media_driver/linux/common/os/libdrm/mos_bufmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,65 +1313,6 @@ check_bo_alloc_userptr(struct mos_bufmgr *bufmgr,
tiling_mode, stride, size, flags);
}

#ifdef ANDROID
/**
* Returns a drm_intel_bo wrapping the given buffer prime fd name
*
* This can be used when one application needs to pass a buffer
* object to another thru dma-buf sharing.
*/
struct mos_linux_bo *
mos_bo_gem_create_from_prime_fd(struct mos_bufmgr *bufmgr,
const char *name,
unsigned int prime_fd)
{
struct mos_bufmgr_gem *bufmgr_gem = (struct mos_bufmgr_gem *) bufmgr;
struct mos_bo_gem *bo_gem;
int ret;
struct drm_prime_handle prime;
struct drm_i915_gem_get_tiling get_tiling;
bo_gem = (struct mos_bo_gem *)calloc(1, sizeof(*bo_gem));
if (!bo_gem)
return nullptr;
memclear(prime);
prime.fd = prime_fd;
ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &prime);
if (ret || !prime.handle){
MOS_DBG("Couldn't reference %s handle 0x%08x: %s\n",
name, prime_fd, strerror(errno));
free(bo_gem);
return nullptr;
}
bo_gem->bo.offset = 0;
#ifdef __cplusplus
bo_gem->bo.virt = nullptr;
#else
bo_gem->bo.virtual = nullptr;
#endif
bo_gem->bo.bufmgr = bufmgr;
bo_gem->name = name;
atomic_set(&bo_gem->refcount, 1);
bo_gem->validate_index = -1;
bo_gem->gem_handle = prime.handle;
bo_gem->bo.handle = prime.handle;
bo_gem->global_name = prime_fd;
bo_gem->reusable = false;
memclear(get_tiling);
get_tiling.handle = bo_gem->gem_handle;
ret = drmIoctl(bufmgr_gem->fd,
DRM_IOCTL_I915_GEM_GET_TILING,
&get_tiling);
if (ret != 0) {
mos_gem_bo_unreference(&bo_gem->bo);
return nullptr;
}
bo_gem->tiling_mode = get_tiling.tiling_mode;
bo_gem->swizzle_mode = get_tiling.swizzle_mode;
MOS_DBG("bo_create_from_handle: %d (%s)\n", prime_fd, bo_gem->name);
return &bo_gem->bo;
}
#endif

/**
* Returns a drm_intel_bo wrapping the given buffer object handle.
*
Expand Down Expand Up @@ -3704,32 +3645,6 @@ mos_gem_bo_flink(struct mos_linux_bo *bo, uint32_t * name)
return 0;
}

#ifdef ANDROID
static int
mos_gem_bo_prime(struct mos_linux_bo *bo, uint32_t * prime_fd)
{
struct mos_bufmgr_gem *bufmgr_gem = (struct mos_bufmgr_gem *) bo->bufmgr;
struct mos_bo_gem *bo_gem = (struct mos_bo_gem *) bo;
int ret;

if (!bo_gem->global_name) {
struct drm_prime_handle prime;
memclear(prime);
prime.handle = bo_gem->gem_handle;

ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &prime);
if (ret != 0)
return -errno;
bo_gem->global_name = prime.fd;
bo_gem->reusable = false;

}

*prime_fd = bo_gem->global_name;
return 0;
}
#endif

/**
* Enables unlimited caching of buffer objects for reuse.
*
Expand Down Expand Up @@ -4638,9 +4553,6 @@ mos_bufmgr_gem_init(int fd, int batch_size)
bufmgr_gem->bufmgr.bo_set_tiling = mos_gem_bo_set_tiling;

bufmgr_gem->bufmgr.bo_flink = mos_gem_bo_flink;
#ifdef ANDROID
bufmgr_gem->bufmgr.bo_prime = mos_gem_bo_prime;
#endif
/* Use the new one if available */
if (exec2) {
bufmgr_gem->bufmgr.bo_exec = mos_gem_bo_exec2;
Expand Down
10 changes: 0 additions & 10 deletions media_driver/linux/common/os/libdrm/mos_bufmgr_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,6 @@ mos_bo_flink(struct mos_linux_bo *bo, uint32_t * name)
return -ENODEV;
}

#ifdef ANDROID
int mos_bo_prime(struct mos_linux_bo *bo, uint32_t * name)
{
if (bo->bufmgr->bo_prime)
return bo->bufmgr->bo_prime(bo, name);

return -ENODEV;
}
#endif

#ifndef ANDROID
int
mos_bo_emit_reloc2(struct mos_linux_bo *bo, uint32_t offset,
Expand Down

0 comments on commit 8fe32e6

Please sign in to comment.