replace common qcom sources with samsung ones

This commit is contained in:
SaschaNes
2025-08-12 22:13:00 +02:00
parent ba24dcded9
commit 6f7753de11
5682 changed files with 2450203 additions and 103634 deletions

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __SNAPALLOC_ALLOCATIONRESULT_H__
#define __SNAPALLOC_ALLOCATIONRESULT_H__
#include "SnapHandle.h"
#include <vector>
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
typedef struct AllocationResult {
int stride;
std::vector<SnapHandle *> handles;
} AllocationResult;
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_ALLOCATIONRESULT_H__

View File

@@ -0,0 +1,37 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __SNAPALLOC_BUFFERDESCRIPTOR_H__
#define __SNAPALLOC_BUFFERDESCRIPTOR_H__
#include <PixelFormat.h>
#include <BufferUsage.h>
#include <KeyValuePair.h>
#include <vector>
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
#define QTI_MAX_NAME_LEN 256
typedef struct BufferDescriptor {
char name[QTI_MAX_NAME_LEN];
int width;
int height;
int layerCount;
vendor_qti_hardware_display_common_PixelFormat format = PIXEL_FORMAT_UNSPECIFIED;
vendor_qti_hardware_display_common_BufferUsage usage = CPU_READ_NEVER;
long reservedSize;
std::vector<vendor_qti_hardware_display_common_KeyValuePair> additionalOptions;
} BufferDescriptor;
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_BUFFERDESCRIPTOR_H__

View File

@@ -0,0 +1,62 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __SNAPALLOC_ERROR_H__
#define __SNAPALLOC_ERROR_H__
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
enum Error {
/**
* No error.
*/
NONE = 0,
/**
* Invalid BufferDescriptor.
*/
BAD_DESCRIPTOR = 1,
/**
* Invalid Buffer Handle.
*/
BAD_BUFFER = 2,
/**
* Invalid input.
*/
BAD_VALUE = 3,
/**
* Resource unavailable.
*/
NO_RESOURCES = 5,
/**
* Permanent failure.
*/
UNSUPPORTED = 7,
/**
* Metadata hasn't been set
*/
METADATA_NOT_SET = 9,
/**
* Buffer not freed
*/
BUF_NOT_FREED = 10,
};
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_ERROR_H__

View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#pragma once
#include "AllocationResult.h"
#include "BufferDescriptor.h"
#include "Error.h"
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
class ISnapAlloc {
public:
virtual ~ISnapAlloc() {}
virtual Error Allocate(const BufferDescriptor &in_descriptor, int in_count,
AllocationResult *allocation_result) = 0;
virtual Error IsSupported(const BufferDescriptor &in_descriptor, bool *is_supported) = 0;
};
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#pragma once
#include <vector>
#include "SnapHandle.h"
#include <MetadataType.h>
#include <Address.h>
#include <Rect.h>
#include <Fence.h>
#include "AllocationResult.h"
#include "BufferDescriptor.h"
#include "Error.h"
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
class ISnapMapper {
public:
virtual ~ISnapMapper() {}
virtual Error Retain(const SnapHandle &in_handle) = 0;
virtual Error Release(const SnapHandle &in_handle) = 0;
virtual Error Lock(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_BufferUsage usage,
const vendor_qti_hardware_display_common_Rect &access_region,
const vendor_qti_hardware_display_common_Fence &in_fence,
vendor_qti_hardware_display_common_Address *base_addr) = 0;
virtual Error Unlock(
const SnapHandle &in_handle,
vendor_qti_hardware_display_common_Fence *fence) = 0; // pointer with fence return
virtual Error ValidateBufferSize(const SnapHandle &in_handle,
const BufferDescriptor &in_desc) = 0;
virtual Error FlushLockedBuffer(const SnapHandle &in_handle) = 0;
virtual Error RereadLockedBuffer(const SnapHandle &in_handle) = 0;
virtual Error GetMetadata(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_MetadataType type, void *out) = 0;
virtual Error SetMetadata(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_MetadataType type, void *in) = 0;
virtual Error GetFromBufferDescriptor(const BufferDescriptor &in_desc,
vendor_qti_hardware_display_common_MetadataType type,
void *out) = 0;
virtual Error DumpBuffer(const SnapHandle &in_handle) = 0;
virtual Error DumpBuffers() = 0;
virtual Error ListSupportedMetadataTypes() = 0;
virtual Error GetMetadataState(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_MetadataType type,
bool *out) = 0;
virtual Error RetainViewBuffer(const SnapHandle &in_meta_handle, uint32_t view,
SnapHandle **out_view_handle) = 0;
};
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor

View File

@@ -0,0 +1,87 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SNAPALLOC_SNAPHANDLE_H__
#define __SNAPALLOC_SNAPHANDLE_H__
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
#define SNAP_HANDLE_MAX_FDS 1024
#define SNAP_HANDLE_MAX_INTS 1024
class SnapHandle {
public:
~SnapHandle(){};
SnapHandle(){};
int version;
int num_fds; /* number of file descriptors at &buffer_data[0] */
int num_ints; /* number of ints at &buffer_data[num_fds] */
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wzero-length-array"
#endif
int buffer_data[0]; /* num_fds + num_ints ints */
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
};
inline SnapHandle *snap_handle_create(int num_fds, int num_ints) {
if (num_fds < 0 || num_ints < 0 || num_fds > SNAP_HANDLE_MAX_FDS || num_ints > SNAP_HANDLE_MAX_INTS) {
errno = EINVAL;
return NULL;
}
size_t handle_size = sizeof(SnapHandle) + (sizeof(int) * (num_fds + num_ints));
SnapHandle *h = static_cast<SnapHandle *>(malloc(handle_size));
if (h) {
h->version = sizeof(SnapHandle);
h->num_fds = num_fds;
h->num_ints = num_ints;
}
return h;
}
inline int snap_handle_delete(SnapHandle *h) {
if (h) {
if (h->version != sizeof(SnapHandle))
return -EINVAL;
free(h);
}
return 0;
}
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_SNAPHANDLE_H__