Lines Matching refs:desc
43 int AHardwareBuffer_allocate(const AHardwareBuffer_Desc* desc, AHardwareBuffer** outBuffer) { in AHardwareBuffer_allocate() argument
44 if (!outBuffer || !desc) return BAD_VALUE; in AHardwareBuffer_allocate()
45 if (!AHardwareBuffer_isValidDescription(desc, /*log=*/true)) return BAD_VALUE; in AHardwareBuffer_allocate()
47 int format = AHardwareBuffer_convertToPixelFormat(desc->format); in AHardwareBuffer_allocate()
48 uint64_t usage = AHardwareBuffer_convertToGrallocUsageBits(desc->usage); in AHardwareBuffer_allocate()
50 desc->width, desc->height, format, desc->layers, usage, in AHardwareBuffer_allocate()
59 desc->width, desc->height, desc->layers, strerror(-err), gbuffer->handle); in AHardwareBuffer_allocate()
368 int AHardwareBuffer_isSupported(const AHardwareBuffer_Desc* desc) { in AHardwareBuffer_isSupported() argument
369 if (!desc) return 0; in AHardwareBuffer_isSupported()
370 if (!AHardwareBuffer_isValidDescription(desc, /*log=*/false)) return 0; in AHardwareBuffer_isSupported()
374 status_t err = gBuffer->isSupported(desc->width, desc->height, desc->format, desc->layers, in AHardwareBuffer_isSupported()
375 desc->usage, &supported); in AHardwareBuffer_isSupported()
383 AHardwareBuffer_Desc trialDesc = *desc; in AHardwareBuffer_isSupported()
385 trialDesc.height = desc->format == AHARDWAREBUFFER_FORMAT_BLOB ? 1 : 4; in AHardwareBuffer_isSupported()
386 if (desc->usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) { in AHardwareBuffer_isSupported()
387 trialDesc.layers = desc->layers == 6 ? 6 : 12; in AHardwareBuffer_isSupported()
389 trialDesc.layers = desc->layers == 1 ? 1 : 2; in AHardwareBuffer_isSupported()
412 int AHardwareBuffer_createFromHandle(const AHardwareBuffer_Desc* desc, in AHardwareBuffer_createFromHandle() argument
420 if (!desc || !handle || !outBuffer) return BAD_VALUE; in AHardwareBuffer_createFromHandle()
424 if (desc->rfu0 != 0 || desc->rfu1 != 0) return BAD_VALUE; in AHardwareBuffer_createFromHandle()
425 if (desc->format == AHARDWAREBUFFER_FORMAT_BLOB && desc->height != 1) return BAD_VALUE; in AHardwareBuffer_createFromHandle()
427 const int format = AHardwareBuffer_convertToPixelFormat(desc->format); in AHardwareBuffer_createFromHandle()
428 const uint64_t usage = AHardwareBuffer_convertToGrallocUsageBits(desc->usage); in AHardwareBuffer_createFromHandle()
430 sp<GraphicBuffer> gbuffer(new GraphicBuffer(handle, wrapMethod, desc->width, desc->height, in AHardwareBuffer_createFromHandle()
431 format, desc->layers, usage, desc->stride)); in AHardwareBuffer_createFromHandle()
448 bool AHardwareBuffer_isValidDescription(const AHardwareBuffer_Desc* desc, bool log) { in AHardwareBuffer_isValidDescription() argument
449 if (desc->width == 0 || desc->height == 0 || desc->layers == 0) { in AHardwareBuffer_isValidDescription()
454 if (!AHardwareBuffer_isValidPixelFormat(desc->format)) { in AHardwareBuffer_isValidDescription()
456 desc->format, desc->format); in AHardwareBuffer_isValidDescription()
460 if (desc->rfu0 != 0 || desc->rfu1 != 0) { in AHardwareBuffer_isValidDescription()
465 if (desc->format == AHARDWAREBUFFER_FORMAT_BLOB) { in AHardwareBuffer_isValidDescription()
466 if (desc->height != 1 || desc->layers != 1) { in AHardwareBuffer_isValidDescription()
475 if (desc->usage & blobInvalidGpuMask) { in AHardwareBuffer_isValidDescription()
480 if (desc->usage & AHARDWAREBUFFER_USAGE_VIDEO_ENCODE) { in AHardwareBuffer_isValidDescription()
484 } else if (AHardwareBuffer_formatIsYuv(desc->format)) { in AHardwareBuffer_isValidDescription()
485 if (desc->layers != 1) { in AHardwareBuffer_isValidDescription()
492 if (desc->usage & yuvInvalidGpuMask) { in AHardwareBuffer_isValidDescription()
498 if (desc->usage & AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA) { in AHardwareBuffer_isValidDescription()
502 if (desc->usage & AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER) { in AHardwareBuffer_isValidDescription()
508 …if ((desc->usage & (AHARDWAREBUFFER_USAGE_CPU_READ_MASK | AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK)) && in AHardwareBuffer_isValidDescription()
509 (desc->usage & AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT)) { in AHardwareBuffer_isValidDescription()
515 if (desc->usage & AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP) { in AHardwareBuffer_isValidDescription()
516 if (desc->width != desc->height) { in AHardwareBuffer_isValidDescription()
520 if (desc->layers % 6 != 0) { in AHardwareBuffer_isValidDescription()