Previously these would get leaked if we had multiple bo structs pointing to the same image/GEM BO as each has their own DRI image, but bo_destroy only gets called on the last struct. To mitigate this we have a new callback for every struct where we can free the DRI image. BUG=b:185869479 TEST=Repeatedly open/close camera app on Grunt. Change-Id: I6188346b5bf9e5cbbbbf32a3db621a3fe0276d4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/3270684 Tested-by: Bas Nieuwenhuizen <basni@chromium.org> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Bas Nieuwenhuizen <basni@chromium.org>
44 lines
1.6 KiB
C
44 lines
1.6 KiB
C
/*
|
|
* Copyright 2017 Advanced Micro Devices. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifdef DRV_AMDGPU
|
|
|
|
// Avoid transitively including a bunch of unnecessary headers.
|
|
#define GL_GLEXT_LEGACY
|
|
#include "GL/internal/dri_interface.h"
|
|
#undef GL_GLEXT_LEGACY
|
|
|
|
#include "drv.h"
|
|
|
|
struct dri_driver {
|
|
int fd;
|
|
void *driver_handle;
|
|
__DRIscreen *device;
|
|
__DRIcontext *context; /* Needed for map/unmap operations. */
|
|
const __DRIextension **extensions;
|
|
const __DRIcoreExtension *core_extension;
|
|
const __DRIdri2Extension *dri2_extension;
|
|
const __DRIimageExtension *image_extension;
|
|
const __DRI2flushExtension *flush_extension;
|
|
const __DRIconfig **configs;
|
|
};
|
|
|
|
int dri_init(struct driver *drv, const char *dri_so_path, const char *driver_suffix);
|
|
void dri_close(struct driver *drv);
|
|
int dri_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
|
uint64_t use_flags);
|
|
int dri_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
|
const uint64_t *modifiers, uint32_t modifier_count);
|
|
int dri_bo_import(struct bo *bo, struct drv_import_fd_data *data);
|
|
int dri_bo_release(struct bo *bo);
|
|
int dri_bo_destroy(struct bo *bo);
|
|
void *dri_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags);
|
|
int dri_bo_unmap(struct bo *bo, struct vma *vma);
|
|
size_t dri_num_planes_from_modifier(struct driver *drv, uint32_t format, uint64_t modifier);
|
|
|
|
bool dri_query_modifiers(struct driver *drv, uint32_t format, int max, uint64_t *modifiers,
|
|
int *count);
|
|
#endif
|