Use Android log system in helpers.c.
This code might be loaded by a daemonized process now, so the existing logging to stderr goes nowhere. It's better to use the Android logger. Change-Id: I19f088b8f049f07c9c6839038d2971fad1a0e852 Reviewed-on: https://chromium-review.googlesource.com/971360 Commit-Ready: Alistair Strachan <astrachan@google.com> Tested-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Alistair Strachan <astrachan@google.com> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
ce717c5096
commit
0cfaaa5adb
17 changed files with 98 additions and 99 deletions
6
amdgpu.c
6
amdgpu.c
|
|
@ -235,7 +235,7 @@ static void *amdgpu_addrlib_init(int fd)
|
|||
ret = amdgpu_query_gpu(fd, &gpu_info);
|
||||
|
||||
if (ret) {
|
||||
fprintf(stderr, "[%s]failed with error =%d\n", __func__, ret);
|
||||
drv_log("failed with error =%d\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ static void *amdgpu_addrlib_init(int fd)
|
|||
addr_ret = AddrCreate(&addr_create_input, &addr_create_output);
|
||||
|
||||
if (addr_ret != ADDR_OK) {
|
||||
fprintf(stderr, "[%s]failed error =%d\n", __func__, addr_ret);
|
||||
drv_log("failed error =%d\n", addr_ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -419,7 +419,7 @@ static void *amdgpu_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_AMDGPU_GEM_MMAP, &gem_map);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_AMDGPU_GEM_MMAP failed\n");
|
||||
drv_log("DRM_IOCTL_AMDGPU_GEM_MMAP failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ int32_t cros_gralloc_buffer::lock(const struct rectangle *rect, uint32_t map_fla
|
|||
* just use the first kernel buffer.
|
||||
*/
|
||||
if (drv_num_buffers_per_bo(bo_) != 1) {
|
||||
cros_gralloc_error("Can only support one buffer per bo.");
|
||||
drv_log("Can only support one buffer per bo.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ int32_t cros_gralloc_buffer::lock(const struct rectangle *rect, uint32_t map_fla
|
|||
}
|
||||
|
||||
if (vaddr == MAP_FAILED) {
|
||||
cros_gralloc_error("Mapping failed.");
|
||||
drv_log("Mapping failed.\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ int32_t cros_gralloc_buffer::lock(const struct rectangle *rect, uint32_t map_fla
|
|||
int32_t cros_gralloc_buffer::unlock()
|
||||
{
|
||||
if (lockcount_ <= 0) {
|
||||
cros_gralloc_error("Buffer was not locked.");
|
||||
drv_log("Buffer was not locked.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto
|
|||
bo = drv_bo_create(drv_, descriptor->width, descriptor->height, resolved_format,
|
||||
descriptor->use_flags);
|
||||
if (!bo) {
|
||||
cros_gralloc_error("Failed to create bo.");
|
||||
drv_log("Failed to create bo.\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto
|
|||
*/
|
||||
if (drv_num_buffers_per_bo(bo) != 1) {
|
||||
drv_bo_destroy(bo);
|
||||
cros_gralloc_error("Can only support one buffer per bo.");
|
||||
drv_log("Can only support one buffer per bo.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ int32_t cros_gralloc_driver::retain(buffer_handle_t handle)
|
|||
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ int32_t cros_gralloc_driver::retain(buffer_handle_t handle)
|
|||
}
|
||||
|
||||
if (drmPrimeFDToHandle(drv_get_fd(drv_), hnd->fds[0], &id)) {
|
||||
cros_gralloc_error("drmPrimeFDToHandle failed.");
|
||||
drv_log("drmPrimeFDToHandle failed.\n");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
|
|
@ -214,13 +214,13 @@ int32_t cros_gralloc_driver::release(buffer_handle_t handle)
|
|||
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
auto buffer = get_buffer(hnd);
|
||||
if (!buffer) {
|
||||
cros_gralloc_error("Invalid Reference.");
|
||||
drv_log("Invalid Reference.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -246,13 +246,13 @@ int32_t cros_gralloc_driver::lock(buffer_handle_t handle, int32_t acquire_fence,
|
|||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
auto buffer = get_buffer(hnd);
|
||||
if (!buffer) {
|
||||
cros_gralloc_error("Invalid Reference.");
|
||||
drv_log("Invalid Reference.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -265,13 +265,13 @@ int32_t cros_gralloc_driver::unlock(buffer_handle_t handle, int32_t *release_fen
|
|||
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
auto buffer = get_buffer(hnd);
|
||||
if (!buffer) {
|
||||
cros_gralloc_error("Invalid Reference.");
|
||||
drv_log("Invalid Reference.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -291,13 +291,13 @@ int32_t cros_gralloc_driver::get_backing_store(buffer_handle_t handle, uint64_t
|
|||
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
auto buffer = get_buffer(hnd);
|
||||
if (!buffer) {
|
||||
cros_gralloc_error("Invalid Reference.");
|
||||
drv_log("Invalid Reference.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#include "cros_gralloc_helpers.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cutils/log.h>
|
||||
#include <sync/sync.h>
|
||||
|
||||
uint32_t cros_gralloc_convert_format(int format)
|
||||
|
|
@ -66,30 +64,19 @@ int32_t cros_gralloc_sync_wait(int32_t acquire_fence)
|
|||
*/
|
||||
int err = sync_wait(acquire_fence, 1000);
|
||||
if (err < 0) {
|
||||
cros_gralloc_error("Timed out on sync wait, err = %s", strerror(errno));
|
||||
drv_log("Timed out on sync wait, err = %s\n", strerror(errno));
|
||||
err = sync_wait(acquire_fence, -1);
|
||||
if (err < 0) {
|
||||
cros_gralloc_error("sync wait error = %s", strerror(errno));
|
||||
drv_log("sync wait error = %s\n", strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
err = close(acquire_fence);
|
||||
if (err) {
|
||||
cros_gralloc_error("Unable to close fence fd, err = %s", strerror(errno));
|
||||
drv_log("Unable to close fence fd, err = %s\n", strerror(errno));
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cros_gralloc_log(const char *prefix, const char *file, int line, const char *format, ...)
|
||||
{
|
||||
char buf[50];
|
||||
snprintf(buf, sizeof(buf), "[%s:%s(%d)]", prefix, basename(file), line);
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
__android_log_vprint(ANDROID_LOG_ERROR, buf, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,4 @@ cros_gralloc_handle_t cros_gralloc_convert_handle(buffer_handle_t handle);
|
|||
|
||||
int32_t cros_gralloc_sync_wait(int32_t acquire_fence);
|
||||
|
||||
__attribute__((format(printf, 4, 5))) void cros_gralloc_log(const char *prefix, const char *file,
|
||||
int line, const char *format, ...);
|
||||
|
||||
#define cros_gralloc_error(...) \
|
||||
do { \
|
||||
cros_gralloc_log("CROS_GRALLOC_ERROR", __FILE__, __LINE__, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -113,10 +113,10 @@ static int gralloc0_alloc(alloc_device_t *dev, int w, int h, int format, int usa
|
|||
}
|
||||
|
||||
if (!supported) {
|
||||
cros_gralloc_error("Unsupported combination -- HAL format: %u, HAL usage: %u, "
|
||||
"drv_format: %4.4s, use_flags: %llu",
|
||||
format, usage, reinterpret_cast<char *>(&descriptor.drm_format),
|
||||
static_cast<unsigned long long>(descriptor.use_flags));
|
||||
drv_log("Unsupported combination -- HAL format: %u, HAL usage: %u, "
|
||||
"drv_format: %4.4s, use_flags: %llu\n",
|
||||
format, usage, reinterpret_cast<char *>(&descriptor.drm_format),
|
||||
static_cast<unsigned long long>(descriptor.use_flags));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ static int gralloc0_init(struct gralloc0_module *mod, bool initialize_alloc)
|
|||
|
||||
mod->driver = std::make_unique<cros_gralloc_driver>();
|
||||
if (mod->driver->init()) {
|
||||
cros_gralloc_error("Failed to initialize driver.");
|
||||
drv_log("Failed to initialize driver.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ static int gralloc0_open(const struct hw_module_t *mod, const char *name, struct
|
|||
}
|
||||
|
||||
if (strcmp(name, GRALLOC_HARDWARE_GPU0)) {
|
||||
cros_gralloc_error("Incorrect device name - %s.", name);
|
||||
drv_log("Incorrect device name - %s.\n", name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ static int gralloc0_perform(struct gralloc_module_t const *module, int op, ...)
|
|||
handle = va_arg(args, buffer_handle_t);
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -305,12 +305,12 @@ static int gralloc0_lock_async(struct gralloc_module_t const *module, buffer_han
|
|||
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (hnd->droid_format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
cros_gralloc_error("HAL_PIXEL_FORMAT_YCbCr_*_888 format not compatible.");
|
||||
drv_log("HAL_PIXEL_FORMAT_YCbCr_*_888 format not compatible.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -347,14 +347,14 @@ static int gralloc0_lock_async_ycbcr(struct gralloc_module_t const *module, buff
|
|||
|
||||
auto hnd = cros_gralloc_convert_handle(handle);
|
||||
if (!hnd) {
|
||||
cros_gralloc_error("Invalid handle.");
|
||||
drv_log("Invalid handle.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((hnd->droid_format != HAL_PIXEL_FORMAT_YCbCr_420_888) &&
|
||||
(hnd->droid_format != HAL_PIXEL_FORMAT_YV12) &&
|
||||
(hnd->droid_format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED)) {
|
||||
cros_gralloc_error("Non-YUV format not compatible.");
|
||||
drv_log("Non-YUV format not compatible.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
27
drv.c
27
drv.c
|
|
@ -16,6 +16,11 @@
|
|||
#include <unistd.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include <cutils/log.h>
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
#include "drv_priv.h"
|
||||
#include "helpers.h"
|
||||
#include "util.h"
|
||||
|
|
@ -362,7 +367,7 @@ struct bo *drv_bo_import(struct driver *drv, struct drv_import_fd_data *data)
|
|||
|
||||
seek_end = lseek(data->fds[plane], 0, SEEK_END);
|
||||
if (seek_end == (off_t)(-1)) {
|
||||
fprintf(stderr, "drv: lseek() failed with %s\n", strerror(errno));
|
||||
drv_log("lseek() failed with %s\n", strerror(errno));
|
||||
goto destroy_bo;
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +378,7 @@ struct bo *drv_bo_import(struct driver *drv, struct drv_import_fd_data *data)
|
|||
bo->sizes[plane] = data->offsets[plane + 1] - data->offsets[plane];
|
||||
|
||||
if ((int64_t)bo->offsets[plane] + bo->sizes[plane] > seek_end) {
|
||||
fprintf(stderr, "drv: buffer size is too large.\n");
|
||||
drv_log("buffer size is too large.\n");
|
||||
goto destroy_bo;
|
||||
}
|
||||
|
||||
|
|
@ -658,7 +663,7 @@ size_t drv_num_planes_from_format(uint32_t format)
|
|||
return 3;
|
||||
}
|
||||
|
||||
fprintf(stderr, "drv: UNKNOWN FORMAT %d\n", format);
|
||||
drv_log("UNKNOWN FORMAT %d\n", format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -677,3 +682,19 @@ uint32_t drv_num_buffers_per_bo(struct bo *bo)
|
|||
|
||||
return count;
|
||||
}
|
||||
|
||||
void drv_log_prefix(const char *prefix, const char *file, int line, const char *format, ...)
|
||||
{
|
||||
char buf[50];
|
||||
snprintf(buf, sizeof(buf), "[%s:%s(%d)]", prefix, basename(file), line);
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
#ifdef __ANDROID__
|
||||
__android_log_vprint(ANDROID_LOG_ERROR, buf, format, args);
|
||||
#else
|
||||
fprintf(stderr, "%s ", buf);
|
||||
vfprintf(stderr, format, args);
|
||||
#endif
|
||||
va_end(args);
|
||||
}
|
||||
|
|
|
|||
8
drv.h
8
drv.h
|
|
@ -164,6 +164,14 @@ size_t drv_num_planes_from_format(uint32_t format);
|
|||
|
||||
uint32_t drv_num_buffers_per_bo(struct bo *bo);
|
||||
|
||||
#define drv_log(format, ...) \
|
||||
do { \
|
||||
drv_log_prefix("minigbm", __FILE__, __LINE__, format, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
__attribute__((format(printf, 4, 5))) void drv_log_prefix(const char *prefix, const char *file,
|
||||
int line, const char *format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
7
exynos.c
7
exynos.c
|
|
@ -56,7 +56,7 @@ static int exynos_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint
|
|||
bo->total_size = bo->sizes[0] = height * bo->strides[0];
|
||||
bo->offsets[0] = 0;
|
||||
} else {
|
||||
fprintf(stderr, "drv: unsupported format %X\n", format);
|
||||
drv_log("unsupported format %X\n", format);
|
||||
assert(0);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -72,8 +72,7 @@ static int exynos_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_EXYNOS_GEM_CREATE, &gem_create);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_EXYNOS_GEM_CREATE failed (size=%zu)\n",
|
||||
size);
|
||||
drv_log("DRM_IOCTL_EXYNOS_GEM_CREATE failed (size=%zu)\n", size);
|
||||
goto cleanup_planes;
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +88,7 @@ cleanup_planes:
|
|||
gem_close.handle = bo->handles[plane - 1].u32;
|
||||
int gem_close_ret = drmIoctl(bo->drv->fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
|
||||
if (gem_close_ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_GEM_CLOSE failed: %d\n", gem_close_ret);
|
||||
drv_log("DRM_IOCTL_GEM_CLOSE failed: %d\n", gem_close_ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
16
helpers.c
16
helpers.c
|
|
@ -100,7 +100,7 @@ static uint32_t bpp_from_format(uint32_t format, size_t plane)
|
|||
return 32;
|
||||
}
|
||||
|
||||
fprintf(stderr, "drv: UNKNOWN FORMAT %d\n", format);
|
||||
drv_log("UNKNOWN FORMAT %d\n", format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +211,7 @@ int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_MODE_CREATE_DUMB failed\n");
|
||||
drv_log("DRM_IOCTL_MODE_CREATE_DUMB failed (%d, %d)\n", bo->drv->fd, errno);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -234,8 +234,7 @@ int drv_dumb_bo_destroy(struct bo *bo)
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_MODE_DESTROY_DUMB failed (handle=%x)\n",
|
||||
bo->handles[0].u32);
|
||||
drv_log("DRM_IOCTL_MODE_DESTROY_DUMB failed (handle=%x)\n", bo->handles[0].u32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -261,7 +260,7 @@ int drv_gem_bo_destroy(struct bo *bo)
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_GEM_CLOSE failed (handle=%x) error %d\n",
|
||||
drv_log("DRM_IOCTL_GEM_CLOSE failed (handle=%x) error %d\n",
|
||||
bo->handles[plane].u32, ret);
|
||||
error = ret;
|
||||
}
|
||||
|
|
@ -283,8 +282,7 @@ int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
|||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, &prime_handle);
|
||||
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_PRIME_FD_TO_HANDLE failed (fd=%u)\n",
|
||||
prime_handle.fd);
|
||||
drv_log("DRM_IOCTL_PRIME_FD_TO_HANDLE failed (fd=%u)\n", prime_handle.fd);
|
||||
|
||||
/*
|
||||
* Need to call GEM close on planes that were opened,
|
||||
|
|
@ -320,7 +318,7 @@ void *drv_dumb_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_MAP_DUMB, &map_dumb);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_MODE_MAP_DUMB failed \n");
|
||||
drv_log("DRM_IOCTL_MODE_MAP_DUMB failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +359,7 @@ int drv_mapping_destroy(struct bo *bo)
|
|||
if (!--mapping->vma->refcount) {
|
||||
ret = bo->drv->backend->bo_unmap(bo, mapping->vma);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: munmap failed");
|
||||
drv_log("munmap failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
19
i915.c
19
i915.c
|
|
@ -255,7 +255,7 @@ static int i915_init(struct driver *drv)
|
|||
get_param.value = &device_id;
|
||||
ret = drmIoctl(drv->fd, DRM_IOCTL_I915_GETPARAM, &get_param);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: Failed to get I915_PARAM_CHIPSET_ID\n");
|
||||
drv_log("Failed to get I915_PARAM_CHIPSET_ID\n");
|
||||
free(i915);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -267,7 +267,7 @@ static int i915_init(struct driver *drv)
|
|||
get_param.value = &i915->has_llc;
|
||||
ret = drmIoctl(drv->fd, DRM_IOCTL_I915_GETPARAM, &get_param);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: Failed to get I915_PARAM_HAS_LLC\n");
|
||||
drv_log("Failed to get I915_PARAM_HAS_LLC\n");
|
||||
free(i915);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -349,8 +349,7 @@ static int i915_bo_create_for_modifier(struct bo *bo, uint32_t width, uint32_t h
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_CREATE, &gem_create);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_CREATE failed (size=%llu)\n",
|
||||
gem_create.size);
|
||||
drv_log("DRM_IOCTL_I915_GEM_CREATE failed (size=%llu)\n", gem_create.size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -369,7 +368,7 @@ static int i915_bo_create_for_modifier(struct bo *bo, uint32_t width, uint32_t h
|
|||
gem_close.handle = bo->handles[0].u32;
|
||||
drmIoctl(bo->drv->fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
|
||||
|
||||
fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_SET_TILING failed with %d", errno);
|
||||
drv_log("DRM_IOCTL_I915_GEM_SET_TILING failed with %d\n", errno);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
|
|
@ -425,7 +424,7 @@ static int i915_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
|||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_GET_TILING, &gem_get_tiling);
|
||||
if (ret) {
|
||||
drv_gem_bo_destroy(bo);
|
||||
fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_GET_TILING failed.");
|
||||
drv_log("DRM_IOCTL_I915_GEM_GET_TILING failed.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -451,7 +450,7 @@ static void *i915_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_MMAP, &gem_map);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_MMAP failed\n");
|
||||
drv_log("DRM_IOCTL_I915_GEM_MMAP failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
@ -464,7 +463,7 @@ static void *i915_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &gem_map);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_MMAP_GTT failed\n");
|
||||
drv_log("DRM_IOCTL_I915_GEM_MMAP_GTT failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
@ -473,7 +472,7 @@ static void *i915_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t
|
|||
}
|
||||
|
||||
if (addr == MAP_FAILED) {
|
||||
fprintf(stderr, "drv: i915 GEM mmap failed\n");
|
||||
drv_log("i915 GEM mmap failed\n");
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
|
@ -500,7 +499,7 @@ static int i915_bo_invalidate(struct bo *bo, struct mapping *mapping)
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_SET_DOMAIN, &set_domain);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_SET_DOMAIN with %d\n", ret);
|
||||
drv_log("DRM_IOCTL_I915_GEM_SET_DOMAIN with %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height, ui
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MTK_GEM_CREATE, &gem_create);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_MTK_GEM_CREATE failed (size=%llu)\n",
|
||||
gem_create.size);
|
||||
drv_log("DRM_IOCTL_MTK_GEM_CREATE failed (size=%llu)\n", gem_create.size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +83,7 @@ static void *mediatek_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint3
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MTK_GEM_MAP_OFFSET, &gem_map);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_MTK_GEM_MAP_OFFSET failed\n");
|
||||
drv_log("DRM_IOCTL_MTK_GEM_MAP_OFFSET failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
|||
2
msm.c
2
msm.c
|
|
@ -24,7 +24,7 @@ static int msm_init(struct driver *drv)
|
|||
}
|
||||
|
||||
static int msm_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
uint64_t flags)
|
||||
uint64_t flags)
|
||||
{
|
||||
width = ALIGN(width, MESA_LLVMPIPE_TILE_SIZE);
|
||||
height = ALIGN(height, MESA_LLVMPIPE_TILE_SIZE);
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ static int rockchip_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint
|
|||
} else {
|
||||
if (!has_modifier(modifiers, count, DRM_FORMAT_MOD_LINEAR)) {
|
||||
errno = EINVAL;
|
||||
fprintf(stderr, "no usable modifier found\n");
|
||||
drv_log("no usable modifier found\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -212,8 +212,7 @@ static int rockchip_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint
|
|||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_ROCKCHIP_GEM_CREATE, &gem_create);
|
||||
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_ROCKCHIP_GEM_CREATE failed (size=%llu)\n",
|
||||
gem_create.size);
|
||||
drv_log("DRM_IOCTL_ROCKCHIP_GEM_CREATE failed (size=%llu)\n", gem_create.size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -247,7 +246,7 @@ static void *rockchip_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint3
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_ROCKCHIP_GEM_MAP_OFFSET, &gem_map);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_ROCKCHIP_GEM_MAP_OFFSET failed\n");
|
||||
drv_log("DRM_IOCTL_ROCKCHIP_GEM_MAP_OFFSET failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
|||
6
tegra.c
6
tegra.c
|
|
@ -228,7 +228,7 @@ static int tegra_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint3
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_TEGRA_GEM_CREATE, &gem_create);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_TEGRA_GEM_CREATE failed (size=%zu)\n", size);
|
||||
drv_log("DRM_IOCTL_TEGRA_GEM_CREATE failed (size=%zu)\n", size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ static int tegra_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
|||
} else if (gem_get_tiling.mode == DRM_TEGRA_GEM_TILING_MODE_BLOCK) {
|
||||
bo->tiling = NV_MEM_KIND_C32_2CRA;
|
||||
} else {
|
||||
fprintf(stderr, "tegra_bo_import: unknown tile format %d", gem_get_tiling.mode);
|
||||
drv_log("%s: unknown tile format %d\n", __func__, gem_get_tiling.mode);
|
||||
drv_gem_bo_destroy(bo);
|
||||
assert(0);
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ static void *tegra_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t
|
|||
|
||||
ret = drmCommandWriteRead(bo->drv->fd, DRM_TEGRA_GEM_MMAP, &gem_map, sizeof(gem_map));
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "drv: DRM_TEGRA_GEM_MMAP failed\n");
|
||||
drv_log("DRM_TEGRA_GEM_MMAP failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
|||
5
vc4.c
5
vc4.c
|
|
@ -48,8 +48,7 @@ static int vc4_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VC4_CREATE_BO, &bo_create);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_VC4_GEM_CREATE failed (size=%zu)\n",
|
||||
bo->total_size);
|
||||
drv_log("DRM_IOCTL_VC4_GEM_CREATE failed (size=%zu)\n", bo->total_size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +68,7 @@ static void *vc4_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t m
|
|||
|
||||
ret = drmCommandWriteRead(bo->drv->fd, DRM_VC4_MMAP_BO, &bo_map, sizeof(bo_map));
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_VC4_MMAP_BO failed\n");
|
||||
drv_log("DRM_VC4_MMAP_BO failed\n");
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static int virtio_gpu_bo_create(struct bo *bo, uint32_t width, uint32_t height,
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_RESOURCE_CREATE, &res_create);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_VIRTGPU_RESOURCE_CREATE failed with %s\n",
|
||||
drv_log("DRM_IOCTL_VIRTGPU_RESOURCE_CREATE failed with %s\n",
|
||||
strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ static void *virgl_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_MAP, &gem_map);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_VIRTGPU_MAP failed with %s\n", strerror(errno));
|
||||
drv_log("DRM_IOCTL_VIRTGPU_MAP failed with %s\n", strerror(errno));
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +161,7 @@ static int virtio_gpu_bo_invalidate(struct bo *bo, struct mapping *mapping)
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST, &xfer);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST failed with %s\n",
|
||||
strerror(errno));
|
||||
drv_log("DRM_IOCTL_VIRTGPU_TRANSFER_FROM_HOST failed with %s\n", strerror(errno));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -187,8 +186,7 @@ static int virtio_gpu_bo_flush(struct bo *bo, struct mapping *mapping)
|
|||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST, &xfer);
|
||||
if (ret) {
|
||||
fprintf(stderr, "drv: DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST failed with %s\n",
|
||||
strerror(errno));
|
||||
drv_log("DRM_IOCTL_VIRTGPU_TRANSFER_TO_HOST failed with %s\n", strerror(errno));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue