summaryrefslogtreecommitdiff
path: root/src/qcam/assets/feathericons/phone.svg
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-05 13:53:53 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-03-05 22:22:47 +0200
commitde1b994bbaa4e34dc39c997d99f47026e7cddcfe (patch)
treecd78f465897e1bdab6953293b3cc6479b9ca7aa2 /src/qcam/assets/feathericons/phone.svg
parent38f7c2af27aa4357cbeb57d4ab716c82067d5a89 (diff)
android: camera_device: Update gralloc usage flags for streams
When configuring streams, the camera HAL is supposed to update the gralloc usage flags to reflect the operations it will need to do on the stream buffers. Failure to do so leads to incorrect format selection by gralloc for the HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED format, as gralloc will not take into consideration the need of the camera to access the buffers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/qcam/assets/feathericons/phone.svg')
0 files changed, 0 insertions, 0 deletions
> 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2020, Google Inc.
 *
 * object.cpp - Object deletion tests
 */

#include <iostream>

#include <libcamera/base/object.h>
#include <libcamera/base/thread.h>

#include "test.h"

using namespace std;
using namespace libcamera;

class TestObject : public Object
{
public:
	TestObject(unsigned int *count)
		: deleteCount_(count)
	{
	}

	~TestObject()
	{
		/* Count the deletions from the correct thread. */
		if (thread() == Thread::current())
			(*deleteCount_)++;
	}

	unsigned int *deleteCount_;
};

class NewThread : public Thread
{
public:
	NewThread(Object *obj)
		: object_(obj)
	{
	}

protected:
	void run()
	{
		object_->deleteLater();
	}

private:
	Object *object_;
};

class ObjectDeleteTest : public Test
{
protected:
	int run()
	{
		/*
		 * Test that deferred deletion is executed from the object's
		 * thread, not the caller's thread.
		 */
		unsigned int count = 0;
		TestObject *obj = new TestObject(&count);

		NewThread thread(obj);
		thread.start();
		thread.wait();

		Thread::current()->dispatchMessages(Message::Type::DeferredDelete);

		if (count != 1) {
			cout << "Failed to dispatch DeferredDelete (" << count << ")" << endl;
			return TestFail;
		}

		/*
		 * Test that multiple calls to deleteLater() delete the object
		 * once only.
		 */
		count = 0;
		obj = new TestObject(&count);
		obj->deleteLater();
		obj->deleteLater();

		Thread::current()->dispatchMessages(Message::Type::DeferredDelete);
		if (count != 1) {
			cout << "Multiple deleteLater() failed (" << count << ")" << endl;
			return TestFail;
		}

		return TestPass;
	}
};

TEST_REGISTER(ObjectDeleteTest)