...
 
Commits (7)
......@@ -534,8 +534,11 @@ panfrost_viewport(struct panfrost_context *ctx,
-inff, -inff,
inff, inff,
#endif
#if 1
0.0, 0.0,
2048.0, 1600.0,
2400.0, 1600.0,
#endif
},
.depth_range_n = depth_range_n,
......@@ -2355,8 +2358,8 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
ctx->pipe_framebuffer.nr_cbufs = fb->nr_cbufs;
ctx->pipe_framebuffer.samples = fb->samples;
ctx->pipe_framebuffer.layers = fb->layers;
ctx->pipe_framebuffer.width = MIN2(fb->width, 2048);
ctx->pipe_framebuffer.height = MIN2(fb->height, 1280);
ctx->pipe_framebuffer.width = MIN2(fb->width, 2400);
ctx->pipe_framebuffer.height = MIN2(fb->height, 1600);
for (int i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
struct pipe_surface *cb = i < fb->nr_cbufs ? fb->cbufs[i] : NULL;
......@@ -2380,8 +2383,14 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
if (is_scanout) {
/* Lie to use our own */
((struct panfrost_resource *) ctx->pipe_framebuffer.cbufs[i]->texture)->gpu[0] = ctx->framebuffer.gpu;
#if 0
/* dEQP needs the following hack for... some reason...
* It seems to break everything else... */
ctx->pipe_framebuffer.width = 2048;
ctx->pipe_framebuffer.height = 1280;
#endif
}
ctx->vt_framebuffer = panfrost_emit_fbd(ctx);
......@@ -2629,14 +2638,20 @@ panfrost_set_viewport_states(struct pipe_context *pipe,
ctx->pipe_viewport = *viewports;
#if 0
/* TODO: What if not centered? */
float w = abs(viewports->scale[0]) * 2.0;
float h = abs(viewports->scale[1]) * 2.0;
/* TODO: What if not centered?
*
* TODO: The min's are needed to avoid faulting. But is this correct?
*/
float w = MIN2(abs(viewports->scale[0]) * 2.0, ctx->pipe_framebuffer.width);
float h = MIN2(abs(viewports->scale[1]) * 2.0, ctx->pipe_framebuffer.height);
ctx->viewport.floats[2] = w;
ctx->viewport.floats[3] = h;
ctx->viewport.viewport1[0] = MALI_POSITIVE((int) w);
ctx->viewport.viewport1[1] = MALI_POSITIVE((int) h);
#endif
ctx->dirty |= PAN_DIRTY_VIEWPORT;
}
static void
......@@ -2878,7 +2893,7 @@ panfrost_setup_hardware(struct panfrost_context *ctx)
ctx->fd = pandev_open();
#ifdef USE_SLOWFB
panfrost_setup_framebuffer(ctx, 2048, 1280);
panfrost_setup_framebuffer(ctx, 2400, 1600);
#endif
for (int i = 0; i < sizeof(ctx->cmdstream_rings) / sizeof(ctx->cmdstream_rings[0]); ++i)
......
......@@ -25,20 +25,17 @@
#include <stdint.h>
#include "pan_slowfb.h"
#define USE_SHM
#ifndef __ANDROID__
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#ifdef USE_SHM
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#endif
Display *d;
Window w;
......@@ -51,6 +48,14 @@ struct slowfb_info slowfb_init(uint8_t *framebuffer, int width, int height)
int black = BlackPixel(d, DefaultScreen(d));
w = XCreateSimpleWindow(d, DefaultRootWindow(d), 0, 0, 200, 100, 0, black, black);
XSelectInput(d, w, StructureNotifyMask);
#if 0
/* Set us up as a toolbar thingamajig so we can verify fullscreen operation under i3 */
Atom window_type = XInternAtom(d, "_NET_WM_WINDOW_TYPE", 0);
long value = XInternAtom(d, "_NET_WM_WINDOW_TYPE_TOOLBAR", 0);
XChangeProperty(d, w, window_type, XA_ATOM, 32, PropModeReplace, (unsigned char *) &value, 1);
#endif
XMapWindow(d, w);
gc = XCreateGC(d, w, 0, NULL);
......@@ -62,16 +67,12 @@ struct slowfb_info slowfb_init(uint8_t *framebuffer, int width, int height)
}
#ifdef USE_SHM
XShmSegmentInfo *shminfo = calloc(1, sizeof(XShmSegmentInfo));
image = XShmCreateImage(d, DefaultVisual(d, 0), 24, ZPixmap, NULL, shminfo, width, height);
shminfo->shmid = shmget(IPC_PRIVATE, image->bytes_per_line * image->height, IPC_CREAT | 0777);
shminfo->shmaddr = image->data = shmat(shminfo->shmid, 0, 0);
shminfo->readOnly = False;
XShmAttach(d, shminfo);
#else
image = XCreateImage(d, DefaultVisual(d, 0), 24, ZPixmap, 0, (char *) framebuffer, 2048, 1280, 32, 0);
#endif
struct slowfb_info info = {
.framebuffer = (uint8_t *) image->data,
......@@ -83,12 +84,8 @@ struct slowfb_info slowfb_init(uint8_t *framebuffer, int width, int height)
void
slowfb_update(uint8_t *framebuffer, int width, int height)
{
#ifdef USE_SHM
XShmPutImage(d, w, gc, image, 0, 0, 0, 0, 2048, 1280, False);
XShmPutImage(d, w, gc, image, 0, 0, 0, 0, width, height, False);
XFlush(d);
#else
XPutImage(d, w, gc, image, 0, 0, 0, 0, 2048, 1280);
#endif
}
#else
......