<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>

#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>

#include <linux/fb.h>

#include <kms++util/kms++util.h>

using namespace kms;

int main(int argc, char** argv)
{
	const char* fbdev = "/dev/fb0";
	int r;

	int fd = open(fbdev, O_RDWR);
	FAIL_IF(fd < 0, "open %s failed\n", fbdev);

	struct fb_var_screeninfo var;

	r = ioctl(fd, FBIOGET_VSCREENINFO, &var);
	FAIL_IF(r, "FBIOGET_VSCREENINFO failed");

	struct fb_fix_screeninfo fix;

	r = ioctl(fd, FBIOGET_FSCREENINFO, &fix);
	FAIL_IF(r, "FBIOGET_FSCREENINFO failed");

	uint8_t* ptr = (uint8_t*)mmap(NULL,
			 var.yres_virtual * fix.line_length,
			 PROT_WRITE | PROT_READ,
			 MAP_SHARED, fd, 0);

	FAIL_IF(ptr == MAP_FAILED, "mmap failed");

	ExtCPUFramebuffer buf(var.xres, var.yres_virtual, PixelFormat::XRGB8888, ptr, fix.line_length);

	printf("%s: res %dx%d, virtual %dx%d, line_len %d\n",
	       fbdev,
	       var.xres, var.yres,
	       var.xres_virtual, var.yres_virtual,
	       fix.line_length);

	draw_test_pattern(buf);
	draw_text(buf, buf.width() / 2, 0, fbdev, RGB(255, 255, 255));

	for (unsigned y = 0; y < var.yres_virtual; ++y)
		memcpy(ptr + fix.line_length * y, buf.map(0) + buf.stride(0) * y, buf.stride(0));

	close(fd);

	return 0;
}<commit_msg>fbtestpat: remove extra leftover memcpy<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>

#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>

#include <linux/fb.h>

#include <kms++util/kms++util.h>

using namespace kms;

int main(int argc, char** argv)
{
	const char* fbdev = "/dev/fb0";
	int r;

	int fd = open(fbdev, O_RDWR);
	FAIL_IF(fd < 0, "open %s failed\n", fbdev);

	struct fb_var_screeninfo var;

	r = ioctl(fd, FBIOGET_VSCREENINFO, &var);
	FAIL_IF(r, "FBIOGET_VSCREENINFO failed");

	struct fb_fix_screeninfo fix;

	r = ioctl(fd, FBIOGET_FSCREENINFO, &fix);
	FAIL_IF(r, "FBIOGET_FSCREENINFO failed");

	uint8_t* ptr = (uint8_t*)mmap(NULL,
			 var.yres_virtual * fix.line_length,
			 PROT_WRITE | PROT_READ,
			 MAP_SHARED, fd, 0);

	FAIL_IF(ptr == MAP_FAILED, "mmap failed");

	ExtCPUFramebuffer buf(var.xres, var.yres_virtual, PixelFormat::XRGB8888, ptr, fix.line_length);

	printf("%s: res %dx%d, virtual %dx%d, line_len %d\n",
	       fbdev,
	       var.xres, var.yres,
	       var.xres_virtual, var.yres_virtual,
	       fix.line_length);

	draw_test_pattern(buf);
	draw_text(buf, buf.width() / 2, 0, fbdev, RGB(255, 255, 255));

	close(fd);

	return 0;
}
{'fraction_non_alphanumeric': 0.1625, 'fraction_numerical': 0.017424242424242425, 'mean_word_length': 4.282, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1415721', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1117, 'n_words': 240}