2018-11-16 00:42:29 +01:00
|
|
|
/*****************************************************************************\
|
|
|
|
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
|
|
|
This file is licensed under the Snes9x License.
|
|
|
|
For further information, consult the LICENSE file in the root directory.
|
|
|
|
\*****************************************************************************/
|
|
|
|
|
2010-09-25 17:46:12 +02:00
|
|
|
#ifndef __GTK_DISPLAY_DRIVER_XV_H
|
|
|
|
#define __GTK_DISPLAY_DRIVER_XV_H
|
|
|
|
|
2020-07-05 00:53:38 +02:00
|
|
|
#include "gtk_s9x.h"
|
|
|
|
#include "gtk_display_driver.h"
|
|
|
|
|
2010-09-26 11:19:15 +02:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
2010-09-25 17:46:12 +02:00
|
|
|
#include <X11/extensions/XShm.h>
|
|
|
|
#include <X11/extensions/Xvlib.h>
|
|
|
|
|
2018-11-02 21:47:31 +01:00
|
|
|
const uint32 FOURCC_YUY2 = 0x32595559;
|
2010-09-25 17:46:12 +02:00
|
|
|
|
|
|
|
class S9xXVDisplayDriver : public S9xDisplayDriver
|
|
|
|
{
|
2020-07-01 00:28:10 +02:00
|
|
|
public:
|
|
|
|
S9xXVDisplayDriver(Snes9xWindow *window, Snes9xConfig *config);
|
|
|
|
void refresh(int width, int height);
|
|
|
|
int init();
|
|
|
|
void deinit();
|
|
|
|
void update(uint16_t *buffer, int width, int height, int stride_in_pixels);
|
|
|
|
void *get_parameters()
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
void save(const char *filename)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static int query_availability();
|
|
|
|
bool is_ready()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2010-09-25 17:46:12 +02:00
|
|
|
|
2020-07-01 00:28:10 +02:00
|
|
|
private:
|
|
|
|
void clear();
|
|
|
|
void update_image_size(int width, int height);
|
|
|
|
void resize_window(int width, int height);
|
|
|
|
void create_window(int width, int height);
|
2010-09-25 17:46:12 +02:00
|
|
|
|
2020-07-01 00:28:10 +02:00
|
|
|
Display *display;
|
|
|
|
Window xwindow;
|
|
|
|
Colormap xcolormap;
|
|
|
|
XVisualInfo *vi;
|
|
|
|
GdkWindow *gdk_window;
|
2010-09-25 17:46:12 +02:00
|
|
|
|
2020-07-01 00:28:10 +02:00
|
|
|
XvImage *xv_image;
|
|
|
|
int xv_portid;
|
|
|
|
XShmSegmentInfo shm;
|
2010-09-25 17:46:12 +02:00
|
|
|
|
2020-07-01 00:28:10 +02:00
|
|
|
int output_window_width;
|
|
|
|
int output_window_height;
|
|
|
|
int last_known_width;
|
|
|
|
int last_known_height;
|
|
|
|
int xv_image_width;
|
|
|
|
int xv_image_height;
|
|
|
|
int format;
|
|
|
|
int bpp;
|
|
|
|
int bytes_per_pixel;
|
|
|
|
int rshift, gshift, bshift;
|
2010-09-25 17:46:12 +02:00
|
|
|
|
2020-07-01 00:28:10 +02:00
|
|
|
uint8 y_table[65536];
|
|
|
|
uint8 u_table[65536];
|
|
|
|
uint8 v_table[65536];
|
2010-09-25 17:46:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __GTK_DISPLAY_DRIVER_XV_H */
|