]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/commitdiff
fbtestpat: fix stride
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 8 Mar 2016 09:22:11 +0000 (11:22 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 8 Mar 2016 13:42:47 +0000 (15:42 +0200)
tests/fbtestpat.cpp

index 96077578b8486114f2995dd602cf0ce7f52a5c50..529a688c725c9b3fa45f93c526061573fdacb976 100644 (file)
@@ -34,7 +34,7 @@ int main(int argc, char** argv)
        r = ioctl(fd, FBIOGET_FSCREENINFO, &fix);
        FAIL_IF(r, "FBIOGET_FSCREENINFO failed");
 
-       void* ptr = mmap(NULL,
+       uint8_t* ptr = (uint8_t*)mmap(NULL,
                         var.yres_virtual * fix.line_length,
                         PROT_WRITE | PROT_READ,
                         MAP_SHARED, fd, 0);
@@ -51,7 +51,8 @@ int main(int argc, char** argv)
 
        draw_test_pattern(buf);
 
-       memcpy(ptr, buf.map(0), buf.size(0));
+       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);