diff options
| -rw-r--r-- | libkms++/decls.h | 1 | ||||
| -rw-r--r-- | libkms++/dumbframebuffer.cpp | 167 | ||||
| -rw-r--r-- | libkms++/dumbframebuffer.h | 39 | ||||
| -rw-r--r-- | libkms++/framebuffer.cpp | 153 | ||||
| -rw-r--r-- | libkms++/framebuffer.h | 30 | ||||
| -rw-r--r-- | libkms++/kms++.h | 1 | ||||
| -rw-r--r-- | libkmstest/conv.cpp | 14 | ||||
| -rw-r--r-- | libkmstest/conv.h | 4 | ||||
| -rw-r--r-- | libkmstest/testpat.cpp | 8 | ||||
| -rw-r--r-- | libkmstest/testpat.h | 2 | ||||
| -rw-r--r-- | lua/luakms.i | 1 | ||||
| -rwxr-xr-x | lua/test.lua | 2 | ||||
| -rwxr-xr-x | py/functest.py | 2 | ||||
| -rw-r--r-- | py/pykms.i | 1 | ||||
| -rwxr-xr-x | py/test.py | 2 | ||||
| -rw-r--r-- | tests/db.cpp | 18 | ||||
| -rw-r--r-- | tests/testpat.cpp | 4 | 
17 files changed, 254 insertions, 195 deletions
| diff --git a/libkms++/decls.h b/libkms++/decls.h index c2cf09f..1415f1f 100644 --- a/libkms++/decls.h +++ b/libkms++/decls.h @@ -8,6 +8,7 @@ class Connector;  class Crtc;  class Encoder;  class Framebuffer; +class DumbFramebuffer;  class DrmObject;  class Plane;  class Property; diff --git a/libkms++/dumbframebuffer.cpp b/libkms++/dumbframebuffer.cpp new file mode 100644 index 0000000..8e77604 --- /dev/null +++ b/libkms++/dumbframebuffer.cpp @@ -0,0 +1,167 @@ + +#include <cstring> +#include <stdexcept> +#include <sys/mman.h> +#include <xf86drm.h> +#include <xf86drmMode.h> +#include <drm_fourcc.h> +#include <drm.h> +#include <drm_mode.h> + +#include "kms++.h" + +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +using namespace std; + +namespace kms +{ + +DumbFramebuffer::DumbFramebuffer(Card &card, uint32_t width, uint32_t height, const char* fourcc) +	:Framebuffer(card, width, height) +{ +	uint32_t a, b, c, d; +	a = fourcc[0]; +	b = fourcc[1]; +	c = fourcc[2]; +	d = fourcc[3]; + +	uint32_t code = ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)); + +	Create(width, height, code); +} + +DumbFramebuffer::~DumbFramebuffer() +{ +	Destroy(); +} + +void DumbFramebuffer::print_short() const +{ +	printf("DumbFramebuffer %d\n", id()); +} + +struct FormatPlaneInfo +{ +	uint8_t bitspp;	/* bits per (macro) pixel */ +	uint8_t xsub; +	uint8_t ysub; +}; + +struct FormatInfo +{ +	uint32_t format; +	uint8_t num_planes; +	struct FormatPlaneInfo planes[4]; +}; + +static const FormatInfo format_info_array[] = { +	/* YUV packed */ +	{ DRM_FORMAT_UYVY, 1, { { 32, 2, 1 } }, }, +	{ DRM_FORMAT_YUYV, 1, { { 32, 2, 1 } }, }, +	/* YUV semi-planar */ +	{ DRM_FORMAT_NV12, 2, { { 8, 1, 1, }, { 16, 2, 2 } }, }, +	/* RGB16 */ +	{ DRM_FORMAT_RGB565, 1, { { 16, 1, 1 } }, }, +	/* RGB32 */ +	{ DRM_FORMAT_XRGB8888, 1, { { 32, 1, 1 } }, }, +}; + +static const FormatInfo& find_format(uint32_t format) +{ +	for (uint i = 0; i < ARRAY_SIZE(format_info_array); ++i) { +		if (format == format_info_array[i].format) +			return format_info_array[i]; +	} + +	throw std::invalid_argument("foo"); +} + +void DumbFramebuffer::Create(uint32_t width, uint32_t height, uint32_t format) +{ +	int r; + +	m_format = format; + +	const FormatInfo& format_info = find_format(format); + +	m_num_planes = format_info.num_planes; + +	for (int i = 0; i < format_info.num_planes; ++i) { +		const FormatPlaneInfo& pi = format_info.planes[i]; +		FramebufferPlane& plane = m_planes[i]; + +		/* create dumb buffer */ +		struct drm_mode_create_dumb creq = drm_mode_create_dumb(); +		creq.width = width / pi.xsub; +		creq.height = height / pi.ysub; +		creq.bpp = pi.bitspp; +		r = drmIoctl(card().fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq); +		if (r) +			throw std::invalid_argument("foo"); + +		plane.handle = creq.handle; +		plane.stride = creq.pitch; +		plane.size = creq.height * creq.pitch; + +		/* +		printf("buf %d: %dx%d, bitspp %d, stride %d, size %d\n", +			i, creq.width, creq.height, pi->bitspp, plane->stride, plane->size); +		*/ + +		/* prepare buffer for memory mapping */ +		struct drm_mode_map_dumb mreq = drm_mode_map_dumb(); +		mreq.handle = plane.handle; +		r = drmIoctl(card().fd(), DRM_IOCTL_MODE_MAP_DUMB, &mreq); +		if (r) +			throw std::invalid_argument("foo"); + +		/* perform actual memory mapping */ +		m_planes[i].map = (uint8_t *)mmap(0, plane.size, PROT_READ | PROT_WRITE, MAP_SHARED, +						  card().fd(), mreq.offset); +		if (plane.map == MAP_FAILED) +			throw std::invalid_argument("foo"); + +		/* clear the framebuffer to 0 */ +		memset(plane.map, 0, plane.size); +	} + +	/* create framebuffer object for the dumb-buffer */ +	uint32_t bo_handles[4] = { m_planes[0].handle, m_planes[1].handle }; +	uint32_t pitches[4] = { m_planes[0].stride, m_planes[1].stride }; +	uint32_t offsets[4] = { 0 }; +	uint32_t id; +	r = drmModeAddFB2(card().fd(), width, height, format, +			  bo_handles, pitches, offsets, &id, 0); +	if (r) +		throw std::invalid_argument("foo"); + +	m_id = id; +} + +void DumbFramebuffer::Destroy() +{ +	/* delete framebuffer */ +	drmModeRmFB(card().fd(), id()); + +	for (uint i = 0; i < m_num_planes; ++i) { +		FramebufferPlane& plane = m_planes[i]; + +		/* unmap buffer */ +		munmap(plane.map, plane.size); + +		/* delete dumb buffer */ +		struct drm_mode_destroy_dumb dreq = drm_mode_destroy_dumb(); +		dreq.handle = plane.handle; +		drmIoctl(card().fd(), DRM_IOCTL_MODE_DESTROY_DUMB, &dreq); + +	} +} + +void DumbFramebuffer::clear() +{ +	for (unsigned i = 0; i < m_num_planes; ++i) +		memset(m_planes[i].map, 0, m_planes[i].size); +} + +} diff --git a/libkms++/dumbframebuffer.h b/libkms++/dumbframebuffer.h new file mode 100644 index 0000000..e7cafb6 --- /dev/null +++ b/libkms++/dumbframebuffer.h @@ -0,0 +1,39 @@ +#pragma once + +#include "framebuffer.h" + +namespace kms +{ +class DumbFramebuffer : public Framebuffer +{ +public: +	DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const char* fourcc); +	virtual ~DumbFramebuffer(); + +	void print_short() const; + +	uint32_t format() const { return m_format; } + +	uint8_t* map(unsigned plane) const { return m_planes[plane].map; } +	uint32_t stride(unsigned plane) const { return m_planes[plane].stride; } +	uint32_t size(unsigned plane) const { return m_planes[plane].size; } + +	void clear(); + +private: +	struct FramebufferPlane { +		uint32_t handle; +		uint32_t size; +		uint32_t stride; +		uint8_t *map; +	}; + +	void Create(uint32_t width, uint32_t height, uint32_t format); +	void Destroy(); + +	unsigned m_num_planes; +	struct FramebufferPlane m_planes[4]; + +	uint32_t m_format; +}; +} diff --git a/libkms++/framebuffer.cpp b/libkms++/framebuffer.cpp index a37c512..bc1fd51 100644 --- a/libkms++/framebuffer.cpp +++ b/libkms++/framebuffer.cpp @@ -1,166 +1,35 @@ -  #include <cstring>  #include <stdexcept>  #include <sys/mman.h>  #include <xf86drm.h>  #include <xf86drmMode.h> -#include <drm_fourcc.h> -#include <drm.h> -#include <drm_mode.h>  #include "kms++.h" -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +using namespace std;  namespace kms  { -Framebuffer::Framebuffer(Card &card, uint32_t width, uint32_t height, const char* fourcc) -	:DrmObject(card, DRM_MODE_OBJECT_FB) -{ -	uint32_t a, b, c, d; -	a = fourcc[0]; -	b = fourcc[1]; -	c = fourcc[2]; -	d = fourcc[3]; - -	uint32_t code = ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)); - -	Create(width, height, code); -} - -Framebuffer::~Framebuffer() -{ -	Destroy(); -} - -void Framebuffer::print_short() const -{ -	printf("Framebuffer %d\n", id()); -} - -struct FormatPlaneInfo -{ -	uint8_t bitspp;	/* bits per (macro) pixel */ -	uint8_t xsub; -	uint8_t ysub; -}; - -struct FormatInfo -{ -	uint32_t format; -	uint8_t num_planes; -	struct FormatPlaneInfo planes[4]; -}; - -static const FormatInfo format_info_array[] = { -	/* YUV packed */ -	{ DRM_FORMAT_UYVY, 1, { { 32, 2, 1 } }, }, -	{ DRM_FORMAT_YUYV, 1, { { 32, 2, 1 } }, }, -	/* YUV semi-planar */ -	{ DRM_FORMAT_NV12, 2, { { 8, 1, 1, }, { 16, 2, 2 } }, }, -	/* RGB16 */ -	{ DRM_FORMAT_RGB565, 1, { { 16, 1, 1 } }, }, -	/* RGB32 */ -	{ DRM_FORMAT_XRGB8888, 1, { { 32, 1, 1 } }, }, -}; - -static const FormatInfo& find_format(uint32_t format) +Framebuffer::Framebuffer(Card& card, int width, int height) +	: DrmObject(card, DRM_MODE_OBJECT_FB), m_width(width), m_height(height)  { -	for (uint i = 0; i < ARRAY_SIZE(format_info_array); ++i) { -		if (format == format_info_array[i].format) -			return format_info_array[i]; -	} - -	throw std::invalid_argument("foo");  } -void Framebuffer::Create(uint32_t width, uint32_t height, uint32_t format) +Framebuffer::Framebuffer(Card& card, uint32_t id) +	: DrmObject(card, id, DRM_MODE_OBJECT_FB)  { -	int r; - -	m_width = width; -	m_height = height; -	m_format = format; - -	const FormatInfo& format_info = find_format(format); - -	m_num_planes = format_info.num_planes; - -	for (int i = 0; i < format_info.num_planes; ++i) { -		const FormatPlaneInfo& pi = format_info.planes[i]; -		FramebufferPlane& plane = m_planes[i]; - -		/* create dumb buffer */ -		struct drm_mode_create_dumb creq = drm_mode_create_dumb(); -		creq.width = m_width / pi.xsub; -		creq.height = m_height / pi.ysub; -		creq.bpp = pi.bitspp; -		r = drmIoctl(card().fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq); -		if (r) -			throw std::invalid_argument("foo"); - -		plane.handle = creq.handle; -		plane.stride = creq.pitch; -		plane.size = creq.height * creq.pitch; - -		/* -		printf("buf %d: %dx%d, bitspp %d, stride %d, size %d\n", -			i, creq.width, creq.height, pi->bitspp, plane->stride, plane->size); -		*/ - -		/* prepare buffer for memory mapping */ -		struct drm_mode_map_dumb mreq = drm_mode_map_dumb(); -		mreq.handle = plane.handle; -		r = drmIoctl(card().fd(), DRM_IOCTL_MODE_MAP_DUMB, &mreq); -		if (r) -			throw std::invalid_argument("foo"); - -		/* perform actual memory mapping */ -		m_planes[i].map = (uint8_t *)mmap(0, plane.size, PROT_READ | PROT_WRITE, MAP_SHARED, -						  card().fd(), mreq.offset); -		if (plane.map == MAP_FAILED) -			throw std::invalid_argument("foo"); +	auto fb = drmModeGetFB(card.fd(), id); -		/* clear the framebuffer to 0 */ -		memset(plane.map, 0, plane.size); -	} +	m_width = fb->width; +	m_height = fb->height; -	/* create framebuffer object for the dumb-buffer */ -	uint32_t bo_handles[4] = { m_planes[0].handle, m_planes[1].handle }; -	uint32_t pitches[4] = { m_planes[0].stride, m_planes[1].stride }; -	uint32_t offsets[4] = { 0 }; -	uint32_t id; -	r = drmModeAddFB2(card().fd(), m_width, m_height, format, -			  bo_handles, pitches, offsets, &id, 0); -	if (r) -		throw std::invalid_argument("foo"); - -	m_id = id; +	drmModeFreeFB(fb);  } -void Framebuffer::Destroy() +void Framebuffer::print_short() const  { -	/* delete framebuffer */ -	drmModeRmFB(card().fd(), id()); - -	for (uint i = 0; i < m_num_planes; ++i) { -		FramebufferPlane& plane = m_planes[i]; - -		/* unmap buffer */ -		munmap(plane.map, plane.size); - -		/* delete dumb buffer */ -		struct drm_mode_destroy_dumb dreq = drm_mode_destroy_dumb(); -		dreq.handle = plane.handle; -		drmIoctl(card().fd(), DRM_IOCTL_MODE_DESTROY_DUMB, &dreq); - -	} +	printf("Framebuffer %d\n", id());  } -void Framebuffer::clear() -{ -	for (unsigned i = 0; i < m_num_planes; ++i) -		memset(m_planes[i].map, 0, m_planes[i].size); -}  } diff --git a/libkms++/framebuffer.h b/libkms++/framebuffer.h index 2710528..33349d8 100644 --- a/libkms++/framebuffer.h +++ b/libkms++/framebuffer.h @@ -4,41 +4,21 @@  namespace kms  { -  class Framebuffer : public DrmObject  {  public: -	Framebuffer(Card& card, uint32_t width, uint32_t height, const char* fourcc); -	virtual ~Framebuffer(); - -	void print_short() const; +	Framebuffer(Card& card, uint32_t id); +	virtual ~Framebuffer() { }  	uint32_t width() const { return m_width; }  	uint32_t height() const { return m_height; } -	uint32_t format() const { return m_format; } - -	uint8_t* map(unsigned plane) const { return m_planes[plane].map; } -	uint32_t stride(unsigned plane) const { return m_planes[plane].stride; } -	uint32_t size(unsigned plane) const { return m_planes[plane].size; } -	void clear(); +	virtual void print_short() const; +protected: +	Framebuffer(Card& card, int width, int height);  private: -	struct FramebufferPlane { -		uint32_t handle; -		uint32_t size; -		uint32_t stride; -		uint8_t *map; -	}; - -	void Create(uint32_t width, uint32_t height, uint32_t format); -	void Destroy(); - -	unsigned m_num_planes; -	struct FramebufferPlane m_planes[4]; -  	uint32_t m_width;  	uint32_t m_height; -	uint32_t m_format;  };  } diff --git a/libkms++/kms++.h b/libkms++/kms++.h index 7d6788d..c446a9e 100644 --- a/libkms++/kms++.h +++ b/libkms++/kms++.h @@ -6,6 +6,7 @@  #include "crtc.h"  #include "encoder.h"  #include "framebuffer.h" +#include "dumbframebuffer.h"  #include "plane.h"  #include "property.h"  #include "pipeline.h" diff --git a/libkmstest/conv.cpp b/libkmstest/conv.cpp index d439253..b716020 100644 --- a/libkmstest/conv.cpp +++ b/libkmstest/conv.cpp @@ -1,13 +1,13 @@  #include <drm_fourcc.h>  #include <stdexcept> -#include "framebuffer.h" +#include "dumbframebuffer.h"  #include "color.h"  #include "conv.h"  namespace kms  { -static RGB read_rgb(const Framebuffer& fb, int x, int y) +static RGB read_rgb(const DumbFramebuffer& fb, int x, int y)  {  	uint32_t *pc = (uint32_t *)(fb.map(0) + fb.stride(0) * y); @@ -16,13 +16,13 @@ static RGB read_rgb(const Framebuffer& fb, int x, int y)  	return RGB((c >> 16) & 0xff, (c >> 8) & 0xff, c & 0xff);  } -static YUV read_rgb_as_yuv(const Framebuffer& fb, int x, int y) +static YUV read_rgb_as_yuv(const DumbFramebuffer& fb, int x, int y)  {  	RGB rgb = read_rgb(fb, x, y);  	return YUV(rgb);  } -static void fb_rgb_to_packed_yuv(Framebuffer& dst_fb, const Framebuffer& src_fb) +static void fb_rgb_to_packed_yuv(DumbFramebuffer& dst_fb, const DumbFramebuffer& src_fb)  {  	unsigned w = src_fb.width();  	unsigned h = src_fb.height(); @@ -57,7 +57,7 @@ static void fb_rgb_to_packed_yuv(Framebuffer& dst_fb, const Framebuffer& src_fb)  	}  } -static void fb_rgb_to_semiplanar_yuv(Framebuffer& dst_fb, const Framebuffer& src_fb) +static void fb_rgb_to_semiplanar_yuv(DumbFramebuffer& dst_fb, const DumbFramebuffer& src_fb)  {  	unsigned w = src_fb.width();  	unsigned h = src_fb.height(); @@ -92,7 +92,7 @@ static void fb_rgb_to_semiplanar_yuv(Framebuffer& dst_fb, const Framebuffer& src  	}  } -static void fb_rgb_to_rgb565(Framebuffer& dst_fb, const Framebuffer& src_fb) +static void fb_rgb_to_rgb565(DumbFramebuffer& dst_fb, const DumbFramebuffer& src_fb)  {  	unsigned w = src_fb.width();  	unsigned h = src_fb.height(); @@ -114,7 +114,7 @@ static void fb_rgb_to_rgb565(Framebuffer& dst_fb, const Framebuffer& src_fb)  	}  } -void color_convert(Framebuffer& dst, const Framebuffer &src) +void color_convert(DumbFramebuffer& dst, const DumbFramebuffer &src)  {  	switch (dst.format()) {  	case DRM_FORMAT_NV12: diff --git a/libkmstest/conv.h b/libkmstest/conv.h index d1b306a..105aaf0 100644 --- a/libkmstest/conv.h +++ b/libkmstest/conv.h @@ -2,7 +2,7 @@  namespace kms  { -class Framebuffer; +class DumbFramebuffer; -void color_convert(Framebuffer& dst, const Framebuffer &src); +void color_convert(DumbFramebuffer& dst, const DumbFramebuffer &src);  } diff --git a/libkmstest/testpat.cpp b/libkmstest/testpat.cpp index 56000f1..958d785 100644 --- a/libkmstest/testpat.cpp +++ b/libkmstest/testpat.cpp @@ -10,7 +10,7 @@  #include <drm_mode.h>  #include "card.h" -#include "framebuffer.h" +#include "dumbframebuffer.h"  #include "testpat.h"  #include "color.h" @@ -18,7 +18,7 @@  namespace kms  { -static void draw_pixel(Framebuffer& buf, unsigned x, unsigned y, RGB color) +static void draw_pixel(DumbFramebuffer& buf, unsigned x, unsigned y, RGB color)  {  	static RGB c1; @@ -74,7 +74,7 @@ static void draw_pixel(Framebuffer& buf, unsigned x, unsigned y, RGB color)  	}  } -static void draw_rgb_test_pattern(Framebuffer& fb) +static void draw_rgb_test_pattern(DumbFramebuffer& fb)  {  	unsigned x, y;  	unsigned w = fb.width(); @@ -146,7 +146,7 @@ static void draw_rgb_test_pattern(Framebuffer& fb)  	}  } -void draw_test_pattern(Framebuffer& fb) +void draw_test_pattern(DumbFramebuffer& fb)  {  	using namespace std::chrono; diff --git a/libkmstest/testpat.h b/libkmstest/testpat.h index b60271a..e051f4a 100644 --- a/libkmstest/testpat.h +++ b/libkmstest/testpat.h @@ -2,5 +2,5 @@  namespace kms  { -void draw_test_pattern(Framebuffer& fb); +void draw_test_pattern(DumbFramebuffer& fb);  } diff --git a/lua/luakms.i b/lua/luakms.i index 0b87857..5530f84 100644 --- a/lua/luakms.i +++ b/lua/luakms.i @@ -17,6 +17,7 @@ using namespace kms;  %include "card.h"  %include "property.h"  %include "framebuffer.h" +%include "dumbframebuffer.h"  %include "plane.h"  %include "connector.h"  %include "encoder.h" diff --git a/lua/test.lua b/lua/test.lua index bc6c4fc..9455944 100755 --- a/lua/test.lua +++ b/lua/test.lua @@ -10,7 +10,7 @@ conn = card:get_first_connected_connector()  mode = conn:get_default_mode() -fb = libluakms.Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); +fb = libluakms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");  libluakms.draw_test_pattern(fb);  crtc = conn:get_current_crtc() diff --git a/py/functest.py b/py/functest.py index 21a543a..24a9a85 100755 --- a/py/functest.py +++ b/py/functest.py @@ -8,7 +8,7 @@ conn = card.get_first_connected_connector()  mode = conn.get_default_mode() -fb = pykms.Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); +fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");  pykms.draw_test_pattern(fb);  crtc = conn.get_current_crtc() @@ -17,6 +17,7 @@ using namespace kms;  %include "card.h"  %include "property.h"  %include "framebuffer.h" +%include "dumbframebuffer.h"  %include "plane.h"  %include "connector.h"  %include "encoder.h" @@ -9,7 +9,7 @@ conn = card.get_first_connected_connector()  mode = conn.get_default_mode() -fb = pykms.Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); +fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");  pykms.draw_test_pattern(fb);  crtc = conn.get_current_crtc() diff --git a/tests/db.cpp b/tests/db.cpp index d70f917..47ed273 100644 --- a/tests/db.cpp +++ b/tests/db.cpp @@ -12,14 +12,14 @@  using namespace std;  using namespace kms; -static void draw_color_bar(Framebuffer& buf, int old_xpos, int xpos, int width); +static void draw_color_bar(DumbFramebuffer& buf, int old_xpos, int xpos, int width);  static void main_loop(Card& card);  class OutputFlipHandler  {  public: -	OutputFlipHandler(Connector* conn, Crtc* crtc, Framebuffer* fb1, Framebuffer* fb2) +	OutputFlipHandler(Connector* conn, Crtc* crtc, DumbFramebuffer* fb1, DumbFramebuffer* fb2)  		: m_connector(conn), m_crtc(crtc), m_fbs { fb1, fb2 }, m_front_buf(1), m_bar_xpos(0)  	{  	} @@ -84,7 +84,7 @@ public:  private:  	Connector* m_connector;  	Crtc* m_crtc; -	Framebuffer* m_fbs[2]; +	DumbFramebuffer* m_fbs[2];  	int m_front_buf;  	int m_bar_xpos; @@ -108,8 +108,8 @@ int main()  		auto mode = conn->get_default_mode(); -		auto fb1 = new Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); -		auto fb2 = new Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); +		auto fb1 = new DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); +		auto fb2 = new DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");  		printf("conn %u, crtc %u, fb1 %u, fb2 %u\n", conn->id(), crtc->id(), fb1->id(), fb2->id()); @@ -207,7 +207,7 @@ static const uint16_t colors16[] = {  	colors32[11].rgb565(),  }; -static void drm_draw_color_bar_rgb888(Framebuffer& buf, int old_xpos, int xpos, int width) +static void drm_draw_color_bar_rgb888(DumbFramebuffer& buf, int old_xpos, int xpos, int width)  {  	for (unsigned y = 0; y < buf.height(); ++y) {  		RGB bcol = colors32[y * ARRAY_SIZE(colors32) / buf.height()]; @@ -223,7 +223,7 @@ static void drm_draw_color_bar_rgb888(Framebuffer& buf, int old_xpos, int xpos,  	}  } -static void drm_draw_color_bar_rgb565(Framebuffer& buf, int old_xpos, int xpos, int width) +static void drm_draw_color_bar_rgb565(DumbFramebuffer& buf, int old_xpos, int xpos, int width)  {  	static_assert(ARRAY_SIZE(colors32) == ARRAY_SIZE(colors16), "bad colors arrays"); @@ -241,7 +241,7 @@ static void drm_draw_color_bar_rgb565(Framebuffer& buf, int old_xpos, int xpos,  	}  } -static void drm_draw_color_bar_semiplanar_yuv(Framebuffer& buf, int old_xpos, int xpos, int width) +static void drm_draw_color_bar_semiplanar_yuv(DumbFramebuffer& buf, int old_xpos, int xpos, int width)  {  	const uint8_t colors[] = {  		0xff, @@ -269,7 +269,7 @@ static void drm_draw_color_bar_semiplanar_yuv(Framebuffer& buf, int old_xpos, in  	}  } -static void draw_color_bar(Framebuffer& buf, int old_xpos, int xpos, int width) +static void draw_color_bar(DumbFramebuffer& buf, int old_xpos, int xpos, int width)  {  	switch (buf.format()) {  	case DRM_FORMAT_NV12: diff --git a/tests/testpat.cpp b/tests/testpat.cpp index eaf1091..02f195a 100644 --- a/tests/testpat.cpp +++ b/tests/testpat.cpp @@ -30,7 +30,7 @@ int main()  		auto mode = conn->get_default_mode(); -		auto fb = new Framebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); +		auto fb = new DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24");  		draw_test_pattern(*fb);  		fbs.push_back(fb); @@ -54,7 +54,7 @@ int main()  		}  		if (plane) { -			auto planefb = new Framebuffer(card, 400, 400, "YUYV"); +			auto planefb = new DumbFramebuffer(card, 400, 400, "YUYV");  			draw_test_pattern(*planefb);  			fbs.push_back(planefb); | 
