Commit c2ee772b authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Switch back to sw_winsys instead of managing it ourselves

parent 73ee5862
......@@ -68,6 +68,8 @@ struct pipe_surface;
struct pipe_transfer;
struct pipe_vertex_buffer;
struct pipe_vertex_element;
struct pipe_video_buffer;
struct pipe_video_codec;
struct pipe_viewport_state;
struct pipe_compute_state;
union pipe_color_union;
......@@ -631,6 +633,18 @@ struct pipe_context {
bool (*resource_commit)(struct pipe_context *, struct pipe_resource *,
unsigned level, struct pipe_box *box, bool commit);
/**
* Creates a video codec for a specific video format/profile
*/
struct pipe_video_codec *(*create_video_codec)( struct pipe_context *context,
const struct pipe_video_codec *templat );
/**
* Creates a video buffer as decoding target
*/
struct pipe_video_buffer *(*create_video_buffer)( struct pipe_context *context,
const struct pipe_video_buffer *templat );
/**
* Compute kernel execution
*/
......
......@@ -24,6 +24,9 @@
#include "util/u_transfer.h"
#include "util/u_transfer_helper.h"
#include "indices/u_primconvert.h"
#include "state_tracker/sw_winsys.h"
#include "pan_screen.h"
#endif
#define SET_BIT(lval, bit, cond) \
......@@ -1086,9 +1089,9 @@ panfrost_flush(
read(ctx->fd, kernel_events, 128);
/* Display the frame in our cute little window */
//#ifndef HAVE_DRI3
#ifndef HAVE_DRI3
slowfb_update((uint8_t*) ctx->framebuffer.cpu, ctx->stride / 4, ctx->height);
//#endif
#endif
}
#define DEFINE_CASE(c) case PIPE_PRIM_##c: return MALI_GL_##c;
......@@ -1586,6 +1589,14 @@ panfrost_resource_create_front(struct pipe_screen *screen,
so->base.screen = screen;
#ifdef HAVE_DRI3
pipe_reference_init(&so->base.reference, 1);
if (template->bind & PIPE_BIND_DISPLAY_TARGET) {
printf("Size trans: %d\n", sizeof(struct panfrost_screen));
struct sw_winsys *winsys = panfrost_screen(screen)->winsys;
unsigned stride;
so->dt = winsys->displaytarget_create(winsys, template->bind, template->format, template->width0, template->height0, 64, map_front_private, &stride);
printf("Stride: %d\n", stride);
}
#endif
/* TODO: Textures n stuff */
int width = 4; /* RGBA XXX */
......@@ -1649,19 +1660,21 @@ panfrost_transfer_map(struct pipe_context *pctx,
return ((uint8_t *) rsrc->cpu) + transfer->box.x + transfer->box.y * transfer->stride;
}
#include "pan_screen.h"
static void
panfrost_set_framebuffer_state(struct pipe_context *pctx,
const struct pipe_framebuffer_state *fb)
{
struct panfrost_context *ctx = panfrost_context(pctx);
#if 0
int i;
printf("SFR!\n");
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
struct pipe_surface *cb = i < fb->nr_cbufs ? fb->cbufs[i] : NULL;
/* check if changing cbuf */
if (ctx->pipe_framebuffer.cbufs[i] != cb) {
printf("K\n");
if (i != 0) {
printf("XXX: Multiple render targets not supported before t7xx!\n");
break;
......@@ -1670,17 +1683,18 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
/* assign new */
pipe_surface_reference(&ctx->pipe_framebuffer.cbufs[i], cb);
struct softpipe_screen* scr = ctx->base.screen;
struct panfrost_screen* scr = ctx->base.screen;
struct sw_winsys *winsys = scr->winsys;
struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[i];
uint8_t *map = winsys->displaytarget_map(winsys, ((struct softpipe_resource *) surf->texture)->dt, PIPE_TRANSFER_WRITE);
uint8_t *map = winsys->displaytarget_map(winsys, ((struct panfrost_resource *) surf->texture)->dt, PIPE_TRANSFER_WRITE);
printf("Map\n");
trans_setup_framebuffer(ctx, map, fb->width, fb->height);
printf("Setup\n");
}
}
#endif
trans_setup_framebuffer(ctx, NULL, fb->width, fb->height);
//trans_setup_framebuffer(ctx, NULL, fb->width, fb->height);
ctx->pipe_framebuffer.nr_cbufs = fb->nr_cbufs;
......@@ -1976,8 +1990,6 @@ trans_allocate_slab(struct panfrost_context *ctx,
void
trans_setup_framebuffer(struct panfrost_context *ctx, uint32_t *addr, int width, int height)
{
if (ctx->width) return;
ctx->width = width;
ctx->height = height;
ctx->bytes_per_pixel = 4; /* RGB32 */
......
......@@ -20,7 +20,18 @@
#include <sys/mman.h>
#include <assert.h>
#include "pandev.h"
#ifdef HAVE_DRI3
#include "pipe/p_compiler.h"
#include "pipe/p_config.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_format.h"
#include "pipe/p_screen.h"
#include "pipe/p_state.h"
#else
#include "pipe/pipe.h"
#endif
/* Forward declare to avoid extra header dep */
struct prim_convert_context;
......@@ -181,6 +192,8 @@ struct panfrost_sampler_view {
/* Corresponds to pipe_resource for our hacky pre-DRM interface */
struct sw_displaytarget;
struct panfrost_resource {
struct pipe_resource base;
......@@ -194,6 +207,8 @@ struct panfrost_resource {
* CPU-side, untiled texture from mesa */
mali_ptr gpu;
struct sw_displaytarget *dt;
};
static inline struct panfrost_context *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment